* Fix NB#99494, show proper information banner when moving messages in memory
[modest] / src / modest-ui-actions.c
index 8b387a8..a1b41a4 100644 (file)
@@ -918,7 +918,7 @@ modest_ui_actions_msg_retrieval_check (ModestMailOperation *mail_op,
                                proto = modest_tny_account_get_protocol_type (account);
                                protocol = modest_protocol_registry_get_protocol_by_type (modest_runtime_get_protocol_registry (), proto);
                                if (protocol)
-                                       format = modest_protocol_get_translation (protocol, MODEST_PROTOCOL_TRANSLATION_MSG_NOT_AVAILABLE);
+                                 format = modest_protocol_get_translation (protocol, MODEST_PROTOCOL_TRANSLATION_MSG_NOT_AVAILABLE, subject);
                                g_object_unref (account);
                        }
 
@@ -1195,7 +1195,7 @@ check_memory_full_error (GtkWidget *parent_window, GError *err)
        else if (err->code == TNY_SYSTEM_ERROR_MEMORY)
                /* If the account was created in memory full
                   conditions then tinymail won't be able to
-                  connect so it'll return this error code */                           
+                  connect so it'll return this error code */
                modest_platform_information_banner (parent_window,
                                                    NULL, _("emev_ui_imap_inbox_select_error"));
        else
@@ -3703,6 +3703,9 @@ delete_folder (ModestWindow *window, gboolean move_to_trash)
 
        folder = modest_folder_view_get_selected (MODEST_FOLDER_VIEW (folder_view));
 
+       if (!folder)
+               return FALSE;
+
        /* Show an error if it's an account */
        if (!TNY_IS_FOLDER (folder)) {
                modest_platform_run_information_dialog (GTK_WINDOW (window),
@@ -3712,7 +3715,7 @@ delete_folder (ModestWindow *window, gboolean move_to_trash)
                return FALSE;
        }
 
-       /* Ask the user */      
+       /* Ask the user */
        message =  g_strdup_printf (_("mcen_nc_delete_folder_text"), 
                                    tny_folder_get_name (TNY_FOLDER (folder)));
        response = modest_platform_run_confirmation_dialog (GTK_WINDOW (window),
@@ -5322,7 +5325,7 @@ modest_ui_actions_on_main_window_remove_attachments (GtkAction *action,
  * Checks if we need a connection to do the transfer and if the user
  * wants to connect to complete it
  */
-void
+static void
 modest_ui_actions_xfer_messages_check (GtkWindow *parent_window,
                                       TnyFolderStore *src_folder,
                                       TnyList *headers,
@@ -5334,8 +5337,6 @@ modest_ui_actions_xfer_messages_check (GtkWindow *parent_window,
        TnyAccount *src_account;
        gint uncached_msgs = 0;
 
-       uncached_msgs = header_list_count_uncached_msgs (headers);
-
        /* We don't need any further check if
         *
         * 1- the source folder is local OR
@@ -5357,6 +5358,7 @@ modest_ui_actions_xfer_messages_check (GtkWindow *parent_window,
         * offline, it'll take place the next time we get a
         * connection)
         */
+       uncached_msgs = header_list_count_uncached_msgs (headers);
        src_account = get_account_from_folder_store (src_folder);
        if (uncached_msgs > 0) {
                guint num_headers;
@@ -5379,11 +5381,11 @@ modest_ui_actions_xfer_messages_check (GtkWindow *parent_window,
                if (remote_folder_has_leave_on_server (src_folder) && delete_originals) {
                        const gchar *account_name;
                        gboolean leave_on_server;
-                       
+
                        account_name = modest_tny_account_get_parent_modest_account_name_for_server_account (src_account);
                        leave_on_server = modest_account_mgr_get_leave_on_server (modest_runtime_get_account_mgr (),
                                                                                  account_name);
-                       
+
                        if (leave_on_server == TRUE) {
                                *need_connection = FALSE;
                        } else {
@@ -5402,10 +5404,19 @@ static void
 xfer_messages_error_handler (ModestMailOperation *mail_op, 
                             gpointer user_data)
 {
-       GObject *win = modest_mail_operation_get_source (mail_op);
-       modest_platform_run_information_dialog ((GtkWindow *) win, 
-                                               _("mail_in_ui_folder_move_target_error"), 
-                                               FALSE);
+       GObject *win;
+       const GError *error;
+
+       win = modest_mail_operation_get_source (mail_op);
+       error = modest_mail_operation_get_error (mail_op);
+
+       if (error && is_memory_full_error ((GError *) error))
+               modest_platform_information_banner ((GtkWidget *) win,
+                                                   NULL, _KR("cerm_device_memory_full"));
+       else
+               modest_platform_run_information_dialog ((GtkWindow *) win, 
+                                                       _("mail_in_ui_folder_move_target_error"), 
+                                                       FALSE);
        if (win)
                g_object_unref (win);
 }
@@ -5896,10 +5907,12 @@ do_headers_action (ModestWindow *win,
 
        /* Trick: do a poke status in order to speed up the signaling
           of observers */
-       tny_folder_poke_status (folder);
+       if (folder) {
+               tny_folder_poke_status (folder);
+               g_object_unref (folder);
+       }
 
        /* Frees */
-       g_object_unref (folder);
        g_object_unref (iter);
        g_object_unref (headers_list);
 }