* Partially fixes NB#84315, clear the list of old headers when updating an account
authorSergio Villar Senin <svillar@igalia.com>
Wed, 16 Apr 2008 08:39:26 +0000 (08:39 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Wed, 16 Apr 2008 08:39:26 +0000 (08:39 +0000)
* Added a missing initialization
* Added an extra check

pmo-trunk-r4419

src/maemo/modest-main-window.c
src/modest-mail-operation.c
src/modest-ui-actions.c
src/widgets/modest-folder-view.c

index 31d4bf3..308ff82 100644 (file)
@@ -1622,18 +1622,18 @@ on_account_changed (TnyAccountStore *account_store,
                     gpointer user_data)
 {
        ModestMainWindow *win = MODEST_MAIN_WINDOW (user_data);
-       
-       /* We need to refresh the details widget because it could have changed */
-       if (modest_main_window_get_contents_style(win) == MODEST_MAIN_WINDOW_CONTENTS_STYLE_DETAILS) {
-               modest_main_window_set_contents_style (win, MODEST_MAIN_WINDOW_CONTENTS_STYLE_DETAILS);
-       }
 
-       /* Update the menus as well, the account name could be
-          changed. Transport accounts and local ones (MMC and the
-          Local folders account do now cause menu changes */
-       if (TNY_IS_STORE_ACCOUNT (account) && 
-           modest_tny_folder_store_is_remote (TNY_FOLDER_STORE (account)))
-               update_menus (MODEST_MAIN_WINDOW (user_data));
+       /* Transport accounts and local ones (MMC and the Local
+          folders account do now cause menu changes */
+       if (TNY_IS_STORE_ACCOUNT (account)) {
+               /* We need to refresh the details widget because it could have changed */
+               if (modest_main_window_get_contents_style(win) == MODEST_MAIN_WINDOW_CONTENTS_STYLE_DETAILS)
+                       modest_main_window_set_contents_style (win, MODEST_MAIN_WINDOW_CONTENTS_STYLE_DETAILS);
+
+               /* Update the menus as well, name could change */
+               if (modest_tny_folder_store_is_remote (TNY_FOLDER_STORE (account)))
+                       update_menus (MODEST_MAIN_WINDOW (user_data));
+       }
 }
 
 /* 
index 11a5bbb..d818fed 100644 (file)
@@ -2174,6 +2174,7 @@ modest_mail_operation_get_msg (ModestMailOperation *self,
        helper->last_total_bytes = 0;
        helper->sum_total_bytes = 0;
        helper->total_bytes = tny_header_get_message_size (header);
+       helper->more_msgs = NULL;
 
        modest_mail_operation_notify_start (self);
        
index ab114bd..31c6429 100644 (file)
@@ -3116,6 +3116,11 @@ on_rename_folder_cb (ModestMailOperation *mail_op,
 {
        ModestFolderView *folder_view;
 
+       /* If the window was closed when renaming a folder this could
+          happen */
+       if (MODEST_IS_FOLDER_VIEW (user_data))
+               return;
+
        folder_view = MODEST_FOLDER_VIEW (user_data);
        /* Note that if the rename fails new_folder will be NULL */
        if (new_folder) {
index a555d7b..9618ab2 100644 (file)
@@ -1262,6 +1262,7 @@ on_account_changed (TnyAccountStore *account_store,
 {
        ModestFolderViewPrivate *priv;
        GtkTreeModel *sort_model, *filter_model;
+       GtkTreeSelection *sel;
 
        /* Ignore transport account insertions, we're not showing them
           in the folder view */
@@ -1290,6 +1291,10 @@ on_account_changed (TnyAccountStore *account_store,
                return;
        }
 
+       /* Unselect the folder, clear the header list */
+       sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (user_data));
+       gtk_tree_selection_unselect_all (sel);
+
        /* Remove the account from the model */
        tny_list_remove (TNY_LIST (gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (sort_model))),
                         G_OBJECT (tny_account));
@@ -2850,7 +2855,6 @@ on_row_inserted_maybe_select_folder (GtkTreeModel *tree_model,
                priv->folder_to_select = g_object_ref (instance);
        }
        g_object_unref (instance);
-
        
        if (priv->folder_to_select) {
                
@@ -2865,8 +2869,7 @@ on_row_inserted_maybe_select_folder (GtkTreeModel *tree_model,
                        gtk_tree_selection_select_iter (sel, iter);
                        gtk_tree_view_set_cursor (GTK_TREE_VIEW(self), path, NULL, FALSE);
 
-                       gtk_tree_path_free (path);
-               
+                       gtk_tree_path_free (path);              
                }
 
                /* Disable next */