From 1cd5fb6de35c30eb1965c9847a808aefac325778 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 28 Oct 2009 09:06:15 -0400 Subject: Don't update the message list when right-clicking on a folder. After the folder's context menu closes the folder tree selection jumps back to the folder whose contents are showing in the message list. Suggested by Philippe LeCavalier on evolution-list. --- mail/e-mail-reader.c | 10 +++++++--- mail/em-folder-tree.c | 16 ++++++++++++++-- 2 files changed, 21 insertions(+), 5 deletions(-) (limited to 'mail') diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index ff7cd9fd47..2f07a2795a 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -1934,14 +1934,18 @@ mail_reader_set_folder (EMailReader *reader, html_display = e_mail_reader_get_html_display (reader); message_list = e_mail_reader_get_message_list (reader); + if (message_list->folder != NULL) + mail_sync_folder (message_list->folder, NULL, NULL); + + /* Skip the rest if we're already viewing the folder. */ + if (g_strcmp0 (folder_uri, message_list->folder_uri) == 0) + return; + outgoing = folder != NULL && folder_uri != NULL && ( em_utils_folder_is_drafts (folder, folder_uri) || em_utils_folder_is_outbox (folder, folder_uri) || em_utils_folder_is_sent (folder, folder_uri)); - if (message_list->folder != NULL) - mail_sync_folder (message_list->folder, NULL, NULL); - em_format_format (EM_FORMAT (html_display), NULL, NULL, NULL); message_list_set_folder (message_list, folder, folder_uri, outgoing); diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 187522fb0a..a4f91409d9 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -109,6 +109,9 @@ struct _EMFolderTreePrivate { gboolean skip_double_click; GtkCellRenderer *text_renderer; + + /* Signal handler IDs */ + gulong selection_changed_handler_id; }; enum { @@ -599,6 +602,7 @@ folder_tree_button_press_event (GtkWidget *widget, GtkTreeSelection *selection; GtkTreeView *tree_view; GtkTreePath *path; + gulong handler_id; priv = EM_FOLDER_TREE_GET_PRIVATE (widget); @@ -618,9 +622,14 @@ folder_tree_button_press_event (GtkWidget *widget, &path, NULL, NULL, NULL)) goto chainup; - /* select/focus the row that was right-clicked */ + /* Select and focus the row that was right-clicked, but prevent + * a "folder-selected" signal emission since this does not count + * as a folder selection in the sense we mean. */ + handler_id = priv->selection_changed_handler_id; + g_signal_handler_block (selection, handler_id); gtk_tree_selection_select_path (selection, path); gtk_tree_view_set_cursor (tree_view, path, NULL, FALSE); + g_signal_handler_unblock (selection, handler_id); gtk_tree_path_free (path); @@ -835,6 +844,7 @@ folder_tree_init (EMFolderTree *folder_tree) GtkTreeSelection *selection; GHashTable *select_uris_table; EMFolderTreeModel *model; + gulong handler_id; select_uris_table = g_hash_table_new (g_str_hash, g_str_equal); @@ -846,9 +856,11 @@ folder_tree_init (EMFolderTree *folder_tree) selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (folder_tree)); - g_signal_connect_swapped ( + handler_id = g_signal_connect_swapped ( selection, "changed", G_CALLBACK (folder_tree_selection_changed_cb), folder_tree); + + folder_tree->priv->selection_changed_handler_id = handler_id; } GType -- cgit