#ifdef MODEST_PLATFORM_MAEMO
#include "maemo/modest-osso-state-saving.h"
-#include "maemo/modest-maemo-utils.h"
#include "maemo/modest-hildon-includes.h"
#include "maemo/modest-connection-specific-smtp-window.h"
#endif /* MODEST_PLATFORM_MAEMO */
+#include <modest-utils.h>
#include "widgets/modest-ui-constants.h"
#include <widgets/modest-main-window.h>
modest_ui_actions_run_account_setup_wizard (ModestWindow *win)
{
gboolean result = FALSE;
-#ifdef MODEST_PLATFORM_MAEMO
GtkWindow *dialog, *wizard;
gint dialog_response;
/* Show the easy-setup wizard: */
dialog = modest_window_mgr_get_modal (modest_runtime_get_window_mgr());
- if (dialog && MODEST_IS_EASYSETUP_WIZARD_DIALOG(dialog)) {
+ if (dialog) {
/* old wizard is active already;
*/
gtk_window_present (GTK_WINDOW(dialog));
/* there is no such wizard yet */
- wizard = GTK_WINDOW (modest_easysetup_wizard_dialog_new ());
+ wizard = GTK_WINDOW (modest_platform_get_account_settings_wizard ());
modest_window_mgr_set_modal (modest_runtime_get_window_mgr(), wizard);
/* always present a main window in the background
/* Check whether an account was created: */
result = modest_account_mgr_has_accounts(modest_runtime_get_account_mgr(), TRUE);
}
-#endif
return result;
}
ModestWindow *win)
{
/* This is currently only implemented for Maemo */
-#ifdef MODEST_PLATFORM_MAEMO /* Defined in config.h */
if (!modest_account_mgr_has_accounts (modest_runtime_get_account_mgr(), TRUE)) {
if (!modest_ui_actions_run_account_setup_wizard (win))
g_debug ("%s: wizard was already running", __FUNCTION__);
/* The accounts dialog must be modal */
modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), account_win);
- modest_maemo_show_dialog_and_forget (GTK_WINDOW (win), GTK_DIALOG (account_win));
+ modest_utils_show_dialog_and_forget (GTK_WINDOW (win), GTK_DIALOG (account_win));
}
-#else
- GtkWidget *dialog, *label;
-
- /* Create the widgets */
-
- dialog = gtk_dialog_new_with_buttons ("Message",
- GTK_WINDOW(win),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_OK,
- GTK_RESPONSE_NONE,
- NULL);
- label = gtk_label_new ("Hello World!");
-
- /* Ensure that the dialog box is destroyed when the user responds. */
-
- g_signal_connect_swapped (dialog, "response",
- G_CALLBACK (gtk_widget_destroy),
- dialog);
-
- /* Add the label, and show everything we've added to the dialog. */
-
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox),
- label);
- gtk_widget_show_all (dialog);
-#endif /* MODEST_PLATFORM_MAEMO */
}
#ifdef MODEST_PLATFORM_MAEMO
/* Show banner */
- modest_platform_information_banner (NULL, NULL, _("mail_ib_opening_draft_message"));
+ modest_platform_information_banner_with_timeout
+ (NULL, NULL, _("mail_ib_opening_draft_message"), 1200);
} else {
gchar *uid = modest_tny_folder_get_header_unique_id (header);
gchar *error_msg;
ModestTransportStoreProtocol proto;
TnyList *not_opened_headers;
+ TnyConnectionStatus status;
not_opened_headers = TNY_LIST (user_data);
- if (err) {
+ status = tny_account_get_connection_status (account);
+ if (err || canceled) {
/* TODO: Show an error ? */
goto clean;
}
g_object_unref (source);
}
+gboolean
+retrieve_all_messages_cb (GObject *source,
+ guint num_msgs,
+ guint retrieve_limit)
+{
+ GtkWindow *window;
+ gchar *msg;
+ gint response;
+
+ window = GTK_WINDOW (source);
+ msg = g_strdup_printf (_("mail_nc_msg_count_limit_exceeded"),
+ num_msgs, retrieve_limit);
+
+ /* Ask the user if they want to retrieve all the messages */
+ response =
+ modest_platform_run_confirmation_dialog_with_buttons (window, msg,
+ _("mcen_bd_get_all"),
+ _("mcen_bd_newest_only"));
+ /* Free and return */
+ g_free (msg);
+ return (response == GTK_RESPONSE_ACCEPT) ? TRUE : FALSE;
+}
+
typedef struct {
TnyAccount *account;
ModestWindow *win;
modest_main_window_notify_send_receive_initied (MODEST_MAIN_WINDOW (info->win));
}
- mail_op = modest_mail_operation_new_with_error_handling (G_OBJECT (info->win),
+ mail_op = modest_mail_operation_new_with_error_handling ((info->win) ? G_OBJECT (info->win) : NULL,
modest_ui_actions_send_receive_error_handler,
NULL, NULL);
/* Send & receive. */
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_op);
modest_mail_operation_update_account (mail_op, info->account_name, (info->win) ? FALSE : TRUE,
+ (info->win) ? retrieve_all_messages_cb : NULL,
new_messages_arrived, info->win);
g_object_unref (G_OBJECT (mail_op));
/* Refresh the current folder. The if is always TRUE it's just an extra check */
if (MODEST_IS_MAIN_WINDOW (win)) {
- GtkWidget *header_view, *folder_view;
+ GtkWidget *folder_view;
TnyFolderStore *folder_store;
folder_view =
folder_store = modest_folder_view_get_selected (MODEST_FOLDER_VIEW (folder_view));
- /* No need to refresh the INBOX the send_receive will do it for us */
- if (folder_store && TNY_IS_FOLDER (folder_store) &&
- tny_folder_get_folder_type (TNY_FOLDER (folder_store)) != TNY_FOLDER_TYPE_INBOX) {
- header_view =
- modest_main_window_get_child_widget (MODEST_MAIN_WINDOW (win),
- MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW);
-
- /* We do not need to set the contents style
- because it hasn't changed. We also do not
- need to save the widget status. Just force
- a refresh */
- modest_header_view_set_folder (MODEST_HEADER_VIEW(header_view),
- TNY_FOLDER (folder_store),
- folder_refreshed_cb,
- MODEST_MAIN_WINDOW (win));
- }
-
if (folder_store)
g_object_unref (folder_store);
}
} else {
const gchar *active_account_name = NULL;
ModestAccountMgr *mgr = NULL;
- ModestAccountData *acc_data = NULL;
+ ModestAccountSettings *settings = NULL;
+ ModestServerAccountSettings *store_settings = NULL;
modest_folder_view_set_style (MODEST_FOLDER_VIEW (*tree_view),
MODEST_FOLDER_VIEW_STYLE_SHOW_ALL);
active_account_name = modest_window_get_active_account (MODEST_WINDOW (win));
mgr = modest_runtime_get_account_mgr ();
- acc_data = modest_account_mgr_get_account_data (mgr, active_account_name);
+ settings = modest_account_mgr_load_account_settings (mgr, active_account_name);
+
+ if (settings) {
+ const gchar *store_account_name;
+ store_settings = modest_account_settings_get_store_settings (settings);
+ store_account_name = modest_server_account_settings_get_account_name (store_settings);
- /* Set the new visible & active account */
- if (acc_data && acc_data->store_account) {
modest_folder_view_set_account_id_of_visible_server_account (MODEST_FOLDER_VIEW (*tree_view),
- acc_data->store_account->account_name);
- modest_account_mgr_free_account_data (mgr, acc_data);
+ store_account_name);
+ g_object_unref (store_settings);
+ g_object_unref (settings);
}
}
{
ModestWindow *main_window = NULL;
GObject *win = NULL;
- const GError *error = NULL;
- const gchar *message = NULL;
-
- /* Get error message */
- error = modest_mail_operation_get_error (mail_op);
- if (error != NULL && error->message != NULL) {
- message = error->message;
- } else {
- message = _("mail_in_ui_folder_move_target_error");
- }
/* Disable next automatic folder selection */
main_window = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr (),
/* Show notification dialog */
win = modest_mail_operation_get_source (mail_op);
- modest_platform_run_information_dialog ((GtkWindow *) win, message);
+ modest_platform_run_information_dialog ((GtkWindow *) win, _("mail_in_ui_folder_move_target_error"));
if (win)
g_object_unref (win);
}
update_account does it always automatically */
if (folder_store && TNY_IS_FOLDER (folder_store) &&
tny_folder_get_folder_type (TNY_FOLDER (folder_store)) != TNY_FOLDER_TYPE_INBOX) {
+ ModestMailOperation *refresh_op;
header_view = modest_main_window_get_child_widget (main_win,
MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW);
because it hasn't changed. We also do not
need to save the widget status. Just force
a refresh */
- modest_header_view_set_folder (MODEST_HEADER_VIEW(header_view),
- TNY_FOLDER (folder_store),
- folder_refreshed_cb,
- main_win);
+ refresh_op = modest_mail_operation_new (G_OBJECT (main_win));
+ modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), refresh_op);
+ modest_mail_operation_refresh_folder (refresh_op, TNY_FOLDER (folder_store),
+ folder_refreshed_cb, main_win);
+ g_object_unref (refresh_op);
}
if (folder_store)