From: Sergio Villar Senin Date: Wed, 3 Jun 2009 18:41:14 +0000 (+0200) Subject: Fixes NB#117408, message not removed from outbox when the account it belongs to is... X-Git-Tag: 3.0.17-rc11~12 X-Git-Url: http://git.maemo.org/git/?a=commitdiff_plain;ds=sidebyside;h=3fc3ac7e0f19fa348036eef38bfe7f03079e42ff;hp=500ca5aaa772a1a8eb28942e70c9945f0152d53c;p=modest Fixes NB#117408, message not removed from outbox when the account it belongs to is removed --- diff --git a/src/hildon2/modest-hildon2-window-mgr.c b/src/hildon2/modest-hildon2-window-mgr.c index b4035c2..b55ce9d 100644 --- a/src/hildon2/modest-hildon2-window-mgr.c +++ b/src/hildon2/modest-hildon2-window-mgr.c @@ -937,7 +937,6 @@ on_account_removed (TnyAccountStore *acc_store, { HildonWindowStack *stack; ModestWindow *current_top; - gboolean has_accounts; /* Ignore transport account removals */ if (TNY_IS_TRANSPORT_ACCOUNT (account)) @@ -945,7 +944,6 @@ on_account_removed (TnyAccountStore *acc_store, stack = hildon_window_stack_get_default (); current_top = (ModestWindow *) hildon_window_stack_peek (stack); - has_accounts = modest_account_mgr_has_accounts (modest_runtime_get_account_mgr (), TRUE); /* if we're showing the header view of the currently deleted account, or the outbox and we deleted the last account, @@ -953,7 +951,6 @@ on_account_removed (TnyAccountStore *acc_store, if (current_top && MODEST_IS_HEADER_WINDOW (current_top)) { ModestHeaderView *header_view; TnyFolder *folder; - gboolean deleted = FALSE; header_view = modest_header_window_get_header_view (MODEST_HEADER_WINDOW (current_top)); folder = modest_header_view_get_folder (header_view); @@ -964,25 +961,18 @@ on_account_removed (TnyAccountStore *acc_store, my_account = tny_folder_get_account (folder); if (my_account) { - if (my_account == account) { + if (my_account == account) close_all_but_first (stack); - deleted = TRUE; - } + g_object_unref (my_account); } } /* Close if viewing outbox and no account left */ - if (tny_folder_get_folder_type (folder) == TNY_FOLDER_TYPE_OUTBOX) { - if (!has_accounts) { - close_all_but_first (stack); - deleted = TRUE; - } - } - g_object_unref (folder); + if (tny_folder_get_folder_type (folder) == TNY_FOLDER_TYPE_OUTBOX) + close_all_but_first (stack); - if (deleted) - current_top = (ModestWindow *) hildon_window_stack_peek (stack); + g_object_unref (folder); } } } diff --git a/src/widgets/modest-header-view.c b/src/widgets/modest-header-view.c index 9753537..4e1d1d3 100644 --- a/src/widgets/modest-header-view.c +++ b/src/widgets/modest-header-view.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -2233,10 +2234,19 @@ on_account_removed (TnyAccountStore *self, if (priv->folder) { TnyAccount *my_account; - my_account = tny_folder_get_account (priv->folder); - if (my_account == account) - modest_header_view_clear (MODEST_HEADER_VIEW (user_data)); - g_object_unref (my_account); + if (TNY_IS_MERGE_FOLDER (priv->folder) && + tny_folder_get_folder_type (priv->folder) == TNY_FOLDER_TYPE_OUTBOX) { + ModestTnyAccountStore *acc_store = modest_runtime_get_account_store (); + my_account = modest_tny_account_store_get_local_folders_account (acc_store); + } else { + my_account = tny_folder_get_account (priv->folder); + } + + if (my_account) { + if (my_account == account) + modest_header_view_clear (MODEST_HEADER_VIEW (user_data)); + g_object_unref (my_account); + } } }