[evolution] Bug 787993 - Mail: Rename and reposition 'Templates' submenu
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug 787993 - Mail: Rename and reposition 'Templates' submenu
- Date: Thu, 8 Oct 2020 11:28:58 +0000 (UTC)
commit c49a647113822eea4d1656a5003055d445df13a5
Author: Milan Crha <mcrha redhat com>
Date: Thu Oct 8 13:28:15 2020 +0200
Bug 787993 - Mail: Rename and reposition 'Templates' submenu
Closes https://bugzilla.gnome.org/show_bug.cgi?id=787993
data/ui/evolution-mail-reader.ui | 4 +++
data/ui/evolution-mail.ui | 2 --
src/mail/e-mail-reader.c | 11 ++++++++
src/mail/e-mail-templates-store.c | 53 ++++++++++++++++++++++-----------------
src/mail/e-mail-templates-store.h | 1 +
src/plugins/templates/templates.c | 4 ++-
6 files changed, 49 insertions(+), 26 deletions(-)
---
diff --git a/data/ui/evolution-mail-reader.ui b/data/ui/evolution-mail-reader.ui
index a057c05cbb..07659a37f9 100644
--- a/data/ui/evolution-mail-reader.ui
+++ b/data/ui/evolution-mail-reader.ui
@@ -64,6 +64,7 @@
<menuitem action='mail-reply-sender'/>
<menuitem action='mail-reply-list'/>
<menuitem action='mail-reply-all'/>
+ <menu action='mail-reply-template'/>
<menuitem action='mail-reply-alternative'/>
<menuitem action='mail-forward'/>
<menu action='mail-forward-as-menu'>
@@ -141,6 +142,7 @@
<menu action='mail-reply-group-menu'>
<menuitem action='mail-reply-all'/>
<menuitem action='mail-reply-list'/>
+ <menu action='mail-reply-template'/>
<menuitem action='mail-reply-alternative'/>
</menu>
</toolitem>
@@ -171,6 +173,7 @@
<placeholder name='mail-message-popup-common-actions'>
<menuitem action='mail-popup-reply-sender'/>
<menuitem action='mail-popup-reply-all'/>
+ <menu action='mail-popup-reply-template'/>
<menuitem action='mail-popup-forward'/>
<separator/>
<menuitem action='mail-popup-message-edit'/>
@@ -186,6 +189,7 @@
<separator/>
<menuitem action='mail-popup-reply-sender'/>
<menuitem action='mail-popup-reply-all'/>
+ <menu action='mail-popup-reply-template'/>
<menuitem action='mail-popup-forward'/>
<separator/>
<menuitem action='mail-popup-message-edit'/>
diff --git a/data/ui/evolution-mail.ui b/data/ui/evolution-mail.ui
index f3b1fac0a2..138c32d3d6 100644
--- a/data/ui/evolution-mail.ui
+++ b/data/ui/evolution-mail.ui
@@ -158,8 +158,6 @@
<menuitem action='mail-search-folder-from-recipients'/>
<menuitem action='mail-search-folder-from-mailing-list'/>
</menu>
- <separator/>
- <placeholder name='mail-message-templates'/>
</popup>
<popup name='mail-search-options'>
<menuitem action='mail-search-advanced-hidden'/>
diff --git a/src/mail/e-mail-reader.c b/src/mail/e-mail-reader.c
index b1e3a80bbf..7733c238d2 100644
--- a/src/mail/e-mail-reader.c
+++ b/src/mail/e-mail-reader.c
@@ -2807,6 +2807,13 @@ static GtkActionEntry mail_reader_entries[] = {
N_("Compose a reply to the sender of the selected message"),
G_CALLBACK (action_mail_reply_sender_cb) },
+ { "mail-reply-template",
+ NULL,
+ N_("Repl_y with Template"),
+ NULL,
+ NULL,
+ NULL },
+
{ "mail-save-as",
"document-save-as",
N_("_Save as mbox…"),
@@ -3078,6 +3085,10 @@ static EPopupActionEntry mail_reader_popup_entries[] = {
NULL,
"mail-reply-sender" },
+ { "mail-popup-reply-template",
+ NULL,
+ "mail-reply-template" },
+
{ "mail-popup-save-as",
NULL,
"mail-save-as" },
diff --git a/src/mail/e-mail-templates-store.c b/src/mail/e-mail-templates-store.c
index 57fdea7c33..0202a4ae23 100644
--- a/src/mail/e-mail-templates-store.c
+++ b/src/mail/e-mail-templates-store.c
@@ -2068,6 +2068,7 @@ templates_store_add_to_menu_recurse (EMailTemplatesStore *templates_store,
GtkUIManager *ui_manager,
GtkActionGroup *action_group,
const gchar *base_menu_path,
+ const gchar *base_popup_path,
guint merge_id,
EMailTemplatesStoreActionFunc action_cb,
gpointer action_cb_user_data,
@@ -2085,8 +2086,9 @@ templates_store_add_to_menu_recurse (EMailTemplatesStore *templates_store,
if (tfd->folder) {
GtkAction *action;
- gchar *action_name, *menu_path = NULL;
+ gchar *action_name, *menu_path = NULL, *popup_path = NULL;
const gchar *use_menu_path;
+ const gchar *use_popup_path;
GSList *link;
if (with_folder_menu) {
@@ -2099,18 +2101,25 @@ templates_store_add_to_menu_recurse (EMailTemplatesStore *templates_store,
gtk_ui_manager_add_ui (ui_manager, merge_id, base_menu_path,
action_name,
action_name, GTK_UI_MANAGER_MENU, FALSE);
+ gtk_ui_manager_add_ui (ui_manager, merge_id, base_popup_path,
action_name,
+ action_name, GTK_UI_MANAGER_MENU, FALSE);
+
menu_path = g_strdup_printf ("%s/%s", base_menu_path, action_name);
use_menu_path = menu_path;
+ popup_path = g_strdup_printf ("%s/%s", base_popup_path, action_name);
+ use_popup_path = popup_path;
+
g_object_unref (action);
g_free (action_name);
} else {
use_menu_path = base_menu_path;
+ use_popup_path = base_popup_path;
}
if (node->children) {
templates_store_add_to_menu_recurse (templates_store, node->children,
- ui_manager, action_group, use_menu_path, merge_id,
+ ui_manager, action_group, use_menu_path, use_popup_path,
merge_id,
action_cb, action_cb_user_data, TRUE, action_count);
}
@@ -2135,12 +2144,17 @@ templates_store_add_to_menu_recurse (EMailTemplatesStore *templates_store,
ui_manager, merge_id, use_menu_path, action_name,
action_name, GTK_UI_MANAGER_MENUITEM, FALSE);
+ gtk_ui_manager_add_ui (
+ ui_manager, merge_id, use_popup_path, action_name,
+ action_name, GTK_UI_MANAGER_MENUITEM, FALSE);
+
g_object_unref (action);
g_free (action_name);
}
}
g_free (menu_path);
+ g_free (popup_path);
}
tmpl_folder_data_unlock (tfd);
@@ -2156,6 +2170,7 @@ e_mail_templates_store_build_menu (EMailTemplatesStore *templates_store,
GtkUIManager *ui_manager,
GtkActionGroup *action_group,
const gchar *base_menu_path,
+ const gchar *base_popup_path,
guint merge_id,
EMailTemplatesStoreActionFunc action_cb,
gpointer action_cb_user_data)
@@ -2165,6 +2180,7 @@ e_mail_templates_store_build_menu (EMailTemplatesStore *templates_store,
gint multiple_accounts = 0;
guint action_count = 0;
const gchar *main_menu_path = base_menu_path;
+ const gchar *main_popup_path = base_popup_path;
gchar *tmp_menu_path = NULL;
gchar *action_name;
@@ -2173,6 +2189,7 @@ e_mail_templates_store_build_menu (EMailTemplatesStore *templates_store,
g_return_if_fail (GTK_IS_UI_MANAGER (ui_manager));
g_return_if_fail (GTK_IS_ACTION_GROUP (action_group));
g_return_if_fail (base_menu_path != NULL);
+ g_return_if_fail (base_popup_path != NULL);
g_return_if_fail (merge_id != 0);
g_return_if_fail (action_cb != NULL);
@@ -2204,25 +2221,6 @@ e_mail_templates_store_build_menu (EMailTemplatesStore *templates_store,
tmpl_store_data_unlock (tsd);
}
- if (multiple_accounts > 0) {
- action_name = g_strdup_printf ("templates-menu-%d", action_count);
- action_count++;
-
- action = gtk_action_new (action_name, _("Templates"), NULL, NULL);
-
- gtk_action_group_add_action (action_group, action);
-
- gtk_ui_manager_add_ui (
- ui_manager, merge_id, base_menu_path, action_name,
- action_name, GTK_UI_MANAGER_MENU, FALSE);
-
- tmp_menu_path = g_strdup_printf ("%s/%s", base_menu_path, action_name);
- main_menu_path = tmp_menu_path;
-
- g_object_unref (action);
- g_free (action_name);
- }
-
for (link = templates_store->priv->stores; link && multiple_accounts > 0; link = g_slist_next (link))
{
TmplStoreData *tsd = link->data;
@@ -2236,8 +2234,9 @@ e_mail_templates_store_build_menu (EMailTemplatesStore *templates_store,
store = g_weak_ref_get (tsd->store_weakref);
if (store) {
- gchar *menu_path = NULL;
+ gchar *menu_path = NULL, *popup_path = NULL;
const gchar *use_menu_path = main_menu_path;
+ const gchar *use_popup_path = main_popup_path;
if (multiple_accounts > 1) {
action_name = g_strdup_printf ("templates-menu-%d", action_count);
@@ -2251,18 +2250,26 @@ e_mail_templates_store_build_menu (EMailTemplatesStore *templates_store,
ui_manager, merge_id, main_menu_path, action_name,
action_name, GTK_UI_MANAGER_MENU, FALSE);
+ gtk_ui_manager_add_ui (
+ ui_manager, merge_id, main_popup_path, action_name,
+ action_name, GTK_UI_MANAGER_MENU, FALSE);
+
menu_path = g_strdup_printf ("%s/%s", main_menu_path, action_name);
use_menu_path = menu_path;
+ popup_path = g_strdup_printf ("%s/%s", main_popup_path, action_name);
+ use_popup_path = popup_path;
+
g_object_unref (action);
g_free (action_name);
}
templates_store_add_to_menu_recurse (templates_store, tsd->folders->children,
- ui_manager, action_group, use_menu_path, merge_id,
+ ui_manager, action_group, use_menu_path, use_popup_path, merge_id,
action_cb, action_cb_user_data, FALSE, &action_count);
g_free (menu_path);
+ g_free (popup_path);
}
g_clear_object (&store);
diff --git a/src/mail/e-mail-templates-store.h b/src/mail/e-mail-templates-store.h
index f9542574bc..cccae1a5cd 100644
--- a/src/mail/e-mail-templates-store.h
+++ b/src/mail/e-mail-templates-store.h
@@ -95,6 +95,7 @@ void e_mail_templates_store_build_menu
GtkUIManager *ui_manager,
GtkActionGroup *action_group,
const gchar *base_menu_path,
+ const gchar *base_popup_path,
guint merge_id,
EMailTemplatesStoreActionFunc action_cb,
gpointer action_cb_user_data);
diff --git a/src/plugins/templates/templates.c b/src/plugins/templates/templates.c
index 6239555450..bfac8a87a7 100644
--- a/src/plugins/templates/templates.c
+++ b/src/plugins/templates/templates.c
@@ -923,7 +923,9 @@ templates_update_actions_cb (EShellView *shell_view,
ui_manager = e_shell_window_get_ui_manager (shell_window);
e_mail_templates_store_build_menu (td->templates_store, shell_view, ui_manager,
action_group,
- "/mail-message-popup/mail-message-templates", td->merge_id,
+ "/main-menu/custom-menus/mail-message-menu/mail-reply-template",
+
"/mail-message-popup/mail-message-popup-common-actions/mail-popup-reply-template",
+ td->merge_id,
action_reply_with_template_cb, shell_view);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]