{
HildonWindowStack *stack;
ModestWindow *current_top;
- gboolean has_accounts;
/* Ignore transport account removals */
if (TNY_IS_TRANSPORT_ACCOUNT (account))
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,
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);
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);
}
}
}
#include <tny-folder-monitor.h>
#include <tny-folder-change.h>
#include <tny-error.h>
+#include <tny-merge-folder.h>
#include <string.h>
#include <modest-header-view.h>
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);
+ }
}
}