In ModestFolderView, use delayed refresh is we're trying to do real refresh.
[modest] / src / modest-ui-actions.c
index dd3275c..6f6722d 100644 (file)
@@ -863,7 +863,7 @@ modest_ui_actions_compose_msg(ModestWindow *win,
        if (expected_size > MODEST_MAX_ATTACHMENT_SIZE) {
                modest_platform_run_information_dialog (
                        GTK_WINDOW(win),
-                       _FM("sfil_ib_opening_not_allowed"),
+                       _("mail_ib_error_attachment_size"),
                        TRUE);
                return;
        }
@@ -1744,20 +1744,27 @@ reply_forward_cb (ModestMailOperation *mail_op,
 
        /* Create reply mail */
        switch (rf_helper->action) {
+               /* Use the msg_header to ensure that we have all the
+                  information. The summary can lack some data */
+               TnyHeader *msg_header;
        case ACTION_REPLY:
+               msg_header = tny_msg_get_header (msg);
                new_msg =
-                       modest_tny_msg_create_reply_msg (msg, header, from,
+                       modest_tny_msg_create_reply_msg (msg, msg_header, from,
                                                         (use_signature) ? signature : NULL,
                                                         rf_helper->reply_forward_type,
                                                         MODEST_TNY_MSG_REPLY_MODE_SENDER);
+               g_object_unref (msg_header);
                break;
        case ACTION_REPLY_TO_ALL:
+               msg_header = tny_msg_get_header (msg);
                new_msg =
-                       modest_tny_msg_create_reply_msg (msg, header, from,
+                       modest_tny_msg_create_reply_msg (msg, msg_header, from,
                                                         (use_signature) ? signature : NULL,
                                                         rf_helper->reply_forward_type,
                                                         MODEST_TNY_MSG_REPLY_MODE_ALL);
                edit_type = MODEST_EDIT_TYPE_REPLY;
+               g_object_unref (msg_header);
                break;
        case ACTION_FORWARD:
                new_msg =
@@ -2297,7 +2304,7 @@ modest_ui_actions_do_send_receive (const gchar *account_name,
                if (!acc_name)
                        acc_name  = modest_account_mgr_get_default_account (modest_runtime_get_account_mgr());
                if (!acc_name) {
-                       g_printerr ("modest: cannot get default account\n");
+                       modest_platform_information_banner (NULL, NULL, _("emev_ni_internal_error"));
                        return;
                }
        } else {
@@ -2307,6 +2314,12 @@ modest_ui_actions_do_send_receive (const gchar *account_name,
        acc_store = modest_runtime_get_account_store ();
        account = modest_tny_account_store_get_server_account (acc_store, acc_name, TNY_ACCOUNT_TYPE_STORE);
 
+       if (!account) {
+               g_free (acc_name);
+               modest_platform_information_banner (NULL, NULL, _("emev_ni_internal_error"));
+               return;
+       }
+
        /* Do not automatically refresh accounts that are flagged as
           NO_AUTO_UPDATE. This could be useful for accounts that
           handle their own update times */
@@ -2929,7 +2942,7 @@ enough_space_for_message (ModestMsgEditWindow *edit_window,
        if (expected_size > MODEST_MAX_ATTACHMENT_SIZE) {
                modest_platform_run_information_dialog (
                        GTK_WINDOW(edit_window),
-                       _FM("sfil_ib_opening_not_allowed"),
+                       _("mail_ib_error_attachment_size"),
                        TRUE);
                return FALSE;
        }
@@ -3364,7 +3377,7 @@ do_create_folder_cb (ModestMailOperation *mail_op,
 
        error = modest_mail_operation_get_error (mail_op);
        if (error) {
-               gboolean disk_full;
+               gboolean disk_full = FALSE;
                TnyAccount *account;
                /* Show an error. If there was some problem writing to
                   disk, show it, otherwise show the generic folder
@@ -3433,14 +3446,10 @@ do_create_folder_performer (gboolean canceled,
        ModestMailOperation *mail_op;
 
        if (canceled || err) {
-               TnyAccount *account = modest_mail_operation_get_account (mail_op);
                /* In disk full conditions we could get this error here */
                modest_tny_account_store_check_disk_full_error (modest_runtime_get_account_store(),
                                                                (GtkWidget *) parent_window, err,
-                                                               account,
-                                                               _("mail_in_ui_folder_create_error_memory"));
-               if (account)
-                       g_object_unref (account);
+                                                               NULL, _("mail_in_ui_folder_create_error_memory"));
 
                /* This happens if we have selected the outbox folder
                   as the parent */
@@ -5370,7 +5379,7 @@ modest_ui_actions_move_folder_error_handler (ModestMailOperation *mail_op,
 {
        GObject *win = NULL;
        const GError *error;
-       TnyAccount *account;
+       TnyAccount *account = NULL;
 
 #ifndef MODEST_TOOLKIT_HILDON2
        ModestWindow *main_window = NULL;
@@ -5395,7 +5404,11 @@ modest_ui_actions_move_folder_error_handler (ModestMailOperation *mail_op,
 #endif
        win = modest_mail_operation_get_source (mail_op);
        error = modest_mail_operation_get_error (mail_op);
-       account = modest_mail_operation_get_account (mail_op);
+
+       if (TNY_IS_FOLDER (user_data))
+               account = modest_tny_folder_get_account (TNY_FOLDER (user_data));
+       else if (TNY_IS_ACCOUNT (user_data))
+               account = g_object_ref (user_data);
 
        /* If it's not a disk full error then show a generic error */
        if (!modest_tny_account_store_check_disk_full_error (modest_runtime_get_account_store(),
@@ -5808,15 +5821,10 @@ on_move_folder_cb (gboolean canceled,
 
        mail_op =
                modest_mail_operation_new_with_error_handling (G_OBJECT(parent_window),
-                               modest_ui_actions_move_folder_error_handler,
-                               info->src_folder, NULL);
+                                                              modest_ui_actions_move_folder_error_handler,
+                                                              g_object_ref (info->dst_folder), g_object_unref);
        modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
-                       mail_op);
-
-       /* Select *after* the changes */
-       /* TODO: this function hangs UI after transfer */
-       /*                      modest_folder_view_select_folder (MODEST_FOLDER_VIEW(folder_view), */
-       /*                                                        TNY_FOLDER (src_folder), TRUE); */
+                                        mail_op);
 
        if (MODEST_IS_MAIN_WINDOW (parent_window)) {
                modest_folder_view_select_folder (MODEST_FOLDER_VIEW(info->folder_view),