From db7d05f2a5d3655e48a3772468f6fe1ed87189a9 Mon Sep 17 00:00:00 2001 From: Sergio Villar Senin Date: Wed, 29 Aug 2007 17:39:18 +0000 Subject: [PATCH] * Improved my last commit, only invalidate cur_folder_store and folder_to_select when the account that it's being removed is the same account than the accounts of any of these folders pmo-trunk-r3143 --- src/widgets/modest-folder-view.c | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/src/widgets/modest-folder-view.c b/src/widgets/modest-folder-view.c index d4a0001..73772cb 100644 --- a/src/widgets/modest-folder-view.c +++ b/src/widgets/modest-folder-view.c @@ -857,14 +857,37 @@ on_account_removed (TnyAccountStore *account_store, self = MODEST_FOLDER_VIEW (user_data); priv = MODEST_FOLDER_VIEW_GET_PRIVATE (self); - /* invalidate the cur_folder_* things */ - sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (self)); - gtk_tree_selection_unselect_all (sel); + /* Invalidate the cur_folder_store only if the selected folder + belongs to the account that is being removed */ + if (priv->cur_folder_store) { + TnyAccount *selected_folder_account = NULL; - /* Invalidate row to select */ + if (TNY_IS_FOLDER (priv->cur_folder_store)) { + selected_folder_account = + tny_folder_get_account (TNY_FOLDER (priv->cur_folder_store)); + } else { + selected_folder_account = + TNY_ACCOUNT (g_object_ref (priv->cur_folder_store)); + } + + if (selected_folder_account == account) { + sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (self)); + gtk_tree_selection_unselect_all (sel); + } + g_object_unref (selected_folder_account); + } + + /* Invalidate row to select only if the folder to select + belongs to the account that is being removed*/ if (priv->folder_to_select) { - g_object_unref (priv->folder_to_select); - priv->folder_to_select = NULL; + TnyAccount *folder_to_select_account = NULL; + + folder_to_select_account = tny_folder_get_account (priv->folder_to_select); + if (folder_to_select_account == account) { + g_object_unref (priv->folder_to_select); + priv->folder_to_select = NULL; + } + g_object_unref (folder_to_select_account); } /* Remove the account from the model */ -- 1.7.9.5