From f43bc7ed11621ab41bbae861c81d4ddb8b5bb0ab Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 28 Oct 2009 04:45:06 -0400 Subject: Add a menu to the Forward toolbar button. Allows users to choose different mail forwarding methods without navigating the main menu. Suggested by Ng Oon-Ee on evolution-list. --- mail/e-mail-reader.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 55 insertions(+), 7 deletions(-) (limited to 'mail/e-mail-reader.c') diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index c60054b266..a81352ce12 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -36,6 +36,7 @@ #include "e-util/gconf-bridge.h" #include "shell/e-shell.h" #include "widgets/misc/e-popup-action.h" +#include "widgets/misc/e-menu-tool-action.h" #include "mail/e-mail-browser.h" #include "mail/e-mail-display.h" @@ -1175,13 +1176,6 @@ static GtkActionEntry mail_reader_entries[] = { N_("Flag the selected messages for follow-up"), G_CALLBACK (action_mail_flag_for_followup_cb) }, - { "mail-forward", - "mail-forward", - N_("_Forward"), - "f", - N_("Forward the selected message to someone"), - G_CALLBACK (action_mail_forward_cb) }, - { "mail-forward-attached", NULL, N_("_Attached"), @@ -1189,6 +1183,13 @@ static GtkActionEntry mail_reader_entries[] = { N_("Forward the selected message to someone as an attachment"), G_CALLBACK (action_mail_forward_attached_cb) }, + { "mail-forward-attached-full", + NULL, + N_("Forward As _Attached"), + NULL, + N_("Forward the selected message to someone as an attachment"), + G_CALLBACK (action_mail_forward_attached_cb) }, + { "mail-forward-inline", NULL, N_("_Inline"), @@ -1196,6 +1197,13 @@ static GtkActionEntry mail_reader_entries[] = { N_("Forward the selected message in the body of a new message"), G_CALLBACK (action_mail_forward_inline_cb) }, + { "mail-forward-inline-full", + NULL, + N_("Forward As _Inline"), + NULL, + N_("Forward the selected message in the body of a new message"), + G_CALLBACK (action_mail_forward_inline_cb) }, + { "mail-forward-quoted", NULL, N_("_Quoted"), @@ -1203,6 +1211,13 @@ static GtkActionEntry mail_reader_entries[] = { N_("Forward the selected message quoted like a reply"), G_CALLBACK (action_mail_forward_quoted_cb) }, + { "mail-forward-quoted-full", + NULL, + N_("Forward As _Quoted"), + NULL, + N_("Forward the selected message quoted like a reply"), + G_CALLBACK (action_mail_forward_quoted_cb) }, + { "mail-load-images", "image-x-generic", N_("_Load Images"), @@ -2049,16 +2064,31 @@ mail_reader_update_actions (EMailReader *reader) action = e_mail_reader_get_action (reader, action_name); gtk_action_set_sensitive (action, sensitive); + action_name = "mail-forward-attached-full"; + sensitive = have_an_account && any_messages_selected; + action = e_mail_reader_get_action (reader, action_name); + gtk_action_set_sensitive (action, sensitive); + action_name = "mail-forward-inline"; sensitive = have_an_account && single_message_selected; action = e_mail_reader_get_action (reader, action_name); gtk_action_set_sensitive (action, sensitive); + action_name = "mail-forward-inline-full"; + sensitive = have_an_account && single_message_selected; + action = e_mail_reader_get_action (reader, action_name); + gtk_action_set_sensitive (action, sensitive); + action_name = "mail-forward-quoted"; sensitive = have_an_account && single_message_selected; action = e_mail_reader_get_action (reader, action_name); gtk_action_set_sensitive (action, sensitive); + action_name = "mail-forward-quoted-full"; + sensitive = have_an_account && single_message_selected; + action = e_mail_reader_get_action (reader, action_name); + gtk_action_set_sensitive (action, sensitive); + action_name = "mail-load-images"; sensitive = single_message_selected; action = e_mail_reader_get_action (reader, action_name); @@ -2312,6 +2342,7 @@ e_mail_reader_init (EMailReader *reader) EShellBackend *shell_backend; EShellSettings *shell_settings; EMFormatHTMLDisplay *html_display; + EMenuToolAction *menu_tool_action; EWebView *web_view; GtkActionGroup *action_group; MessageList *message_list; @@ -2344,6 +2375,23 @@ e_mail_reader_init (EMailReader *reader) mail_reader_init_charset_actions (reader); + /* The "mail-forward" action is special: it uses a GtkMenuToolButton + * for its toolbar item type. So we have to create it separately. */ + + menu_tool_action = e_menu_tool_action_new ( + "mail-forward", _("_Forward"), + _("Forward the selected message to someone"), NULL); + + gtk_action_set_icon_name ( + GTK_ACTION (menu_tool_action), "mail-forward"); + + g_signal_connect ( + menu_tool_action, "activate", + G_CALLBACK (action_mail_forward_cb), reader); + + gtk_action_group_add_action_with_accel ( + action_group, GTK_ACTION (menu_tool_action), "f"); + /* Bind GObject properties to GConf keys. */ bridge = gconf_bridge_get (); -- cgit v1.2.3