aboutsummaryrefslogtreecommitdiffstats
path: root/modules/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-10-28 21:06:15 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-10-28 21:47:57 +0800
commit1cd5fb6de35c30eb1965c9847a808aefac325778 (patch)
tree48e4f26c7017fcc44512d6371a06823a4804ec0f /modules/mail
parentb89a9ae09da810024655a87e5c466c2b171a47b4 (diff)
downloadgsoc2013-evolution-1cd5fb6de35c30eb1965c9847a808aefac325778.tar
gsoc2013-evolution-1cd5fb6de35c30eb1965c9847a808aefac325778.tar.gz
gsoc2013-evolution-1cd5fb6de35c30eb1965c9847a808aefac325778.tar.bz2
gsoc2013-evolution-1cd5fb6de35c30eb1965c9847a808aefac325778.tar.lz
gsoc2013-evolution-1cd5fb6de35c30eb1965c9847a808aefac325778.tar.xz
gsoc2013-evolution-1cd5fb6de35c30eb1965c9847a808aefac325778.tar.zst
gsoc2013-evolution-1cd5fb6de35c30eb1965c9847a808aefac325778.zip
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.
Diffstat (limited to 'modules/mail')
-rw-r--r--modules/mail/e-mail-shell-view-private.c41
-rw-r--r--modules/mail/e-mail-shell-view.c25
2 files changed, 61 insertions, 5 deletions
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c
index dd124f43c6..d28de5a3b1 100644
--- a/modules/mail/e-mail-shell-view-private.c
+++ b/modules/mail/e-mail-shell-view-private.c
@@ -95,13 +95,52 @@ exit:
}
static void
+mail_shell_view_folder_tree_selection_done_cb (EMailShellView *mail_shell_view,
+ GtkWidget *menu)
+{
+ EMailShellSidebar *mail_shell_sidebar;
+ EMFolderTree *folder_tree;
+ MessageList *message_list;
+ EMailReader *reader;
+ const gchar *list_uri;
+ gchar *tree_uri;
+
+ reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content);
+ message_list = e_mail_reader_get_message_list (reader);
+
+ mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
+ folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+
+ list_uri = message_list->folder_uri;
+ tree_uri = em_folder_tree_get_selected_uri (folder_tree);
+
+ /* If the folder tree and message list disagree on the current
+ * folder, reset the folder tree to match the message list. */
+ if (g_strcmp0 (tree_uri, list_uri) != 0)
+ em_folder_tree_set_selected (folder_tree, list_uri, FALSE);
+
+ g_free (tree_uri);
+
+ /* Disconnect from the "selection-done" signal. */
+ g_signal_handlers_disconnect_by_func (
+ menu, mail_shell_view_folder_tree_selection_done_cb,
+ mail_shell_view);
+}
+
+static void
mail_shell_view_folder_tree_popup_event_cb (EShellView *shell_view,
GdkEventButton *event)
{
+ GtkWidget *menu;
const gchar *widget_path;
widget_path = "/mail-folder-popup";
- e_shell_view_show_popup_menu (shell_view, widget_path, event);
+ menu = e_shell_view_show_popup_menu (shell_view, widget_path, event);
+
+ g_signal_connect_swapped (
+ menu, "selection-done",
+ G_CALLBACK (mail_shell_view_folder_tree_selection_done_cb),
+ shell_view);
}
static gboolean
diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c
index d331c080ed..7ce6833463 100644
--- a/modules/mail/e-mail-shell-view.c
+++ b/modules/mail/e-mail-shell-view.c
@@ -399,11 +399,12 @@ static void
mail_shell_view_update_actions (EShellView *shell_view)
{
EMailShellView *mail_shell_view;
+ EMailShellContent *mail_shell_content;
EMailShellSidebar *mail_shell_sidebar;
- EShellContent *shell_content;
EShellSidebar *shell_sidebar;
EShellWindow *shell_window;
EMFolderTree *folder_tree;
+ EMailReader *reader;
EAccount *account = NULL;
GtkAction *action;
const gchar *label;
@@ -420,13 +421,15 @@ mail_shell_view_update_actions (EShellView *shell_view)
gboolean folder_is_store;
gboolean folder_is_trash;
gboolean folder_has_unread_rec = FALSE;
+ gboolean folder_tree_and_message_list_agree = TRUE;
mail_shell_view = E_MAIL_SHELL_VIEW (shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
- shell_content = e_shell_view_get_shell_content (shell_view);
- e_mail_reader_update_actions (E_MAIL_READER (shell_content));
+ mail_shell_content = mail_shell_view->priv->mail_shell_content;
+ reader = E_MAIL_READER (mail_shell_content);
+ e_mail_reader_update_actions (reader);
mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar;
folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
@@ -450,6 +453,18 @@ mail_shell_view_update_actions (EShellView *shell_view)
uri = em_folder_tree_get_selected_uri (folder_tree);
if (uri != NULL) {
EMFolderTreeModel *model;
+ MessageList *message_list;
+
+ /* XXX If the user right-clicks on a folder other than what
+ * the message list is showing, disable folder rename.
+ * Between fetching the CamelFolder asynchronously and
+ * knowing when NOT to move the folder tree selection
+ * back to where it was to avoid cancelling the inline
+ * folder tree editing, it's just too hairy to try to
+ * get right. So we're punting. */
+ message_list = e_mail_reader_get_message_list (reader);
+ folder_tree_and_message_list_agree =
+ (g_strcmp0 (uri, message_list->folder_uri) == 0);
account = mail_config_get_account_by_source_url (uri);
@@ -516,7 +531,9 @@ mail_shell_view_update_actions (EShellView *shell_view)
gtk_action_set_sensitive (action, sensitive);
action = ACTION (MAIL_FOLDER_RENAME);
- sensitive = !folder_is_store && folder_can_be_deleted;
+ sensitive =
+ !folder_is_store && folder_can_be_deleted &&
+ folder_tree_and_message_list_agree;
gtk_action_set_sensitive (action, sensitive);
action = ACTION (MAIL_FOLDER_UNSUBSCRIBE);