[evolution] Bug 269852 - Label should be on "Message" menu when mail is selected



commit 2427b2b5016bfccef4ae0ee45b16cd039e5d6562
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jul 23 19:19:16 2018 +0200

    Bug 269852 - Label should be on "Message" menu when mail is selected
    
    Closes https://bugzilla.gnome.org/show_bug.cgi?id=269852

 data/ui/evolution-mail-reader.ui             |  8 ++++++++
 src/modules/mail/e-mail-shell-view-actions.c | 18 +++++++++++-------
 src/modules/mail/e-mail-shell-view-private.c |  5 ++---
 src/modules/mail/e-mail-shell-view-private.h |  3 ++-
 4 files changed, 23 insertions(+), 11 deletions(-)
---
diff --git a/data/ui/evolution-mail-reader.ui b/data/ui/evolution-mail-reader.ui
index 1174fc4219..c051d745b0 100644
--- a/data/ui/evolution-mail-reader.ui
+++ b/data/ui/evolution-mail-reader.ui
@@ -89,6 +89,14 @@
           <menuitem action="mail-flag-clear"/>
           <menuitem action="mail-flag-completed"/>
           <separator/>
+          <menu action='mail-label-menu'>
+            <menuitem action='mail-label-none'/>
+            <separator/>
+            <placeholder name='mail-label-actions'/>
+            <separator/>
+            <menuitem action='mail-label-new'/>
+          </menu>
+          <separator/>
           <menuitem action="mail-mark-ignore-thread-whole"/>
           <menuitem action="mail-mark-ignore-thread-sub"/>
           <menuitem action="mail-mark-unignore-thread-whole"/>
diff --git a/src/modules/mail/e-mail-shell-view-actions.c b/src/modules/mail/e-mail-shell-view-actions.c
index 259e3536bb..8924a84aeb 100644
--- a/src/modules/mail/e-mail-shell-view-actions.c
+++ b/src/modules/mail/e-mail-shell-view-actions.c
@@ -2493,9 +2493,8 @@ e_mail_shell_view_update_popup_labels (EMailShellView *mail_shell_view)
        GtkActionGroup *action_group;
        GtkTreeIter iter;
        GPtrArray *uids;
-       const gchar *path;
+       const gchar *main_menu_path, *popup_menu_path;
        gboolean valid;
-       guint merge_id;
        gint ii = 0;
 
        g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view));
@@ -2514,11 +2513,12 @@ e_mail_shell_view_update_popup_labels (EMailShellView *mail_shell_view)
                E_MAIL_UI_SESSION (session));
 
        action_group = ACTION_GROUP (MAIL_LABEL);
-       merge_id = mail_shell_view->priv->label_merge_id;
-       path = "/mail-message-popup/mail-label-menu/mail-label-actions";
+       main_menu_path = 
"/main-menu/custom-menus/mail-message-menu/mail-mark-as-menu/mail-label-menu/mail-label-actions";
+       popup_menu_path = "/mail-message-popup/mail-label-menu/mail-label-actions";
 
        /* Unmerge the previous menu items. */
-       gtk_ui_manager_remove_ui (ui_manager, merge_id);
+       gtk_ui_manager_remove_ui (ui_manager, mail_shell_view->priv->main_menu_label_merge_id);
+       gtk_ui_manager_remove_ui (ui_manager, mail_shell_view->priv->popup_menu_label_merge_id);
        e_action_group_remove_all_actions (action_group);
        gtk_ui_manager_ensure_update (ui_manager);
 
@@ -2580,8 +2580,12 @@ e_mail_shell_view_update_popup_labels (EMailShellView *mail_shell_view)
                g_object_unref (label_action);
 
                gtk_ui_manager_add_ui (
-                       ui_manager, merge_id, path, action_name,
-                       action_name, GTK_UI_MANAGER_AUTO, FALSE);
+                       ui_manager, mail_shell_view->priv->main_menu_label_merge_id, main_menu_path,
+                       action_name, action_name, GTK_UI_MANAGER_AUTO, FALSE);
+
+               gtk_ui_manager_add_ui (
+                       ui_manager, mail_shell_view->priv->popup_menu_label_merge_id, popup_menu_path,
+                       action_name, action_name, GTK_UI_MANAGER_AUTO, FALSE);
 
                g_free (label);
                g_free (stock_id);
diff --git a/src/modules/mail/e-mail-shell-view-private.c b/src/modules/mail/e-mail-shell-view-private.c
index 46b8ab3c19..03e3bb977d 100644
--- a/src/modules/mail/e-mail-shell-view-private.c
+++ b/src/modules/mail/e-mail-shell-view-private.c
@@ -535,7 +535,6 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view)
        EMailView *mail_view;
        EMailDisplay *display;
        const gchar *source;
-       guint merge_id;
        gint ii = 0;
 
        shell_view = E_SHELL_VIEW (mail_shell_view);
@@ -563,8 +562,8 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view)
                shell_window, "set-focus",
                G_CALLBACK (e_mail_shell_view_update_labels_sensitivity), shell_view);
 
-       merge_id = gtk_ui_manager_new_merge_id (ui_manager);
-       priv->label_merge_id = merge_id;
+       priv->main_menu_label_merge_id = gtk_ui_manager_new_merge_id (ui_manager);
+       priv->popup_menu_label_merge_id = gtk_ui_manager_new_merge_id (ui_manager);
 
        /* Cache these to avoid lots of awkward casting. */
        priv->mail_shell_backend = g_object_ref (shell_backend);
diff --git a/src/modules/mail/e-mail-shell-view-private.h b/src/modules/mail/e-mail-shell-view-private.h
index f373e249bc..2c60f0c3f8 100644
--- a/src/modules/mail/e-mail-shell-view-private.h
+++ b/src/modules/mail/e-mail-shell-view-private.h
@@ -120,7 +120,8 @@ struct _EMailShellViewPrivate {
 
        /* For UI merging and unmerging. */
        guint merge_id;
-       guint label_merge_id;
+       guint main_menu_label_merge_id;
+       guint popup_menu_label_merge_id;
 
        /* Filter rules correspond to the search entry menu. */
        EFilterRule *search_rules[MAIL_NUM_SEARCH_RULES];


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]