aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-folder-browser.c
diff options
context:
space:
mode:
Diffstat (limited to 'mail/em-folder-browser.c')
-rw-r--r--mail/em-folder-browser.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c
index fff9fa7c98..9bbf061cc8 100644
--- a/mail/em-folder-browser.c
+++ b/mail/em-folder-browser.c
@@ -122,6 +122,7 @@ struct _EMFolderBrowserPrivate {
guint folder_changed_id;
guint show_wide:1;
+ guint suppress_message_selection:1;
gboolean scope_restricted;
EMMenu *menu; /* toplevel menu manager */
@@ -2007,6 +2008,7 @@ emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri)
{
EMFolderBrowser *emfb = (EMFolderBrowser *) emfv;
struct _EMFolderBrowserPrivate *p = emfb->priv;
+ gboolean different_folder;
message_list_freeze(emfv->list);
@@ -2025,6 +2027,10 @@ emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri)
emfb->priv->folder_changed_id = 0;
}
+ different_folder =
+ emfb->view.folder != NULL &&
+ folder != emfb->view.folder;
+
emfb_parent->set_folder(emfv, folder, uri);
/* This is required since we get activated the first time
@@ -2108,15 +2114,20 @@ emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri)
e_search_bar_paint ((ESearchBar *)emfb->search);
}
- /* set the query manually, so we dont pop up advanced or saved search stuff */
+ /* This function gets triggered several times at startup,
+ * so we don't want to reset the message suppression state
+ * unless we're actually switching to a different folder. */
+ if (different_folder)
+ p->suppress_message_selection = FALSE;
- if ((sstate = camel_object_meta_get (folder, "evolution:selected_uid"))) {
- g_free (emfb->priv->select_uid);
- emfb->priv->select_uid = sstate;
- } else {
- g_free(p->select_uid);
- p->select_uid = NULL;
- }
+ if (!p->suppress_message_selection)
+ sstate = camel_object_meta_get (
+ folder, "evolution:selected_uid");
+ else
+ sstate = NULL;
+
+ g_free (p->select_uid);
+ p->select_uid = sstate;
if (emfv->list->cursor_uid == NULL && emfb->priv->list_built_id == 0)
p->list_built_id = g_signal_connect(emfv->list, "message_list_built", G_CALLBACK (emfb_list_built), emfv);
@@ -2228,3 +2239,9 @@ emfb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act)
emfb_parent->activate(emfv, uic, act);
}
}
+
+void
+em_folder_browser_suppress_message_selection (EMFolderBrowser *emfb)
+{
+ emfb->priv->suppress_message_selection = TRUE;
+}