From 21b0925061702c0c2a6ee30819c739409bba39d2 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Thu, 15 Jul 2010 10:20:14 +0100 Subject: Change 'Reply to All' toolbar button into configurable 'Group Reply' ...with a dropdown menu like the Forward button, and configuration for whether it tries to do 'Reply to List' by default. --- mail/e-mail-reader.c | 54 +++++++++++++++++++++++++++++++++++- mail/evolution-mail.schemas.in | 17 ++++++++++++ mail/mail-config.ui | 19 +++++++++++-- modules/mail/e-mail-shell-settings.c | 4 +++ modules/mail/em-composer-prefs.c | 5 ++++ ui/evolution-mail-reader.ui | 7 ++++- 6 files changed, 102 insertions(+), 4 deletions(-) diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index 7e3ac3950e..9a6d5cb3ea 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -912,6 +912,21 @@ action_mail_reply_all_cb (GtkAction *action, e_mail_reader_reply_to_message (reader, NULL, REPLY_MODE_ALL); } +static void +action_mail_reply_group_cb (GtkAction *action, + EMailReader *reader) +{ + GConfClient *gconf = mail_config_get_gconf_client (); + gboolean reply_list = gconf_client_get_bool (gconf, + "/apps/evolution/mail/composer/group_reply_to_list", NULL); + guint32 state = e_mail_reader_check_state (reader); + + if (reply_list && (state & E_MAIL_READER_SELECTION_IS_MAILING_LIST)) + e_mail_reader_reply_to_message (reader, NULL, REPLY_MODE_LIST); + else + action_mail_reply_all_cb(action, reader); +} + static void action_mail_reply_list_cb (GtkAction *action, EMailReader *reader) @@ -1586,7 +1601,7 @@ static GtkActionEntry mail_reader_entries[] = { G_CALLBACK (action_mail_redirect_cb) }, { "mail-reply-all", - "mail-reply-all", + NULL, N_("Reply to _All"), "r", N_("Compose a reply to all the recipients of the selected message"), @@ -1706,6 +1721,13 @@ static GtkActionEntry mail_reader_entries[] = { NULL, NULL }, + { "mail-reply-group-menu", + NULL, + N_("_Group Reply"), + NULL, + NULL, + NULL }, + { "mail-goto-menu", GTK_STOCK_JUMP_TO, N_("_Go To"), @@ -2568,6 +2590,16 @@ mail_reader_update_actions (EMailReader *reader, action = e_mail_reader_get_action (reader, action_name); gtk_action_set_sensitive (action, sensitive); + action_name = "mail-reply-group"; + sensitive = have_enabled_account && single_message_selected; + action = e_mail_reader_get_action (reader, action_name); + gtk_action_set_sensitive (action, sensitive); + + action_name = "mail-reply-group-menu"; + sensitive = have_enabled_account && any_messages_selected; + action = e_mail_reader_get_action (reader, action_name); + gtk_action_set_sensitive (action, sensitive); + action_name = "mail-reply-list"; sensitive = have_enabled_account && single_message_selected && selection_is_mailing_list; @@ -2778,6 +2810,22 @@ e_mail_reader_init (EMailReader *reader) gtk_action_group_add_action_with_accel ( action_group, GTK_ACTION (menu_tool_action), "f"); + /* Likewise the "mail-reply-group" action */ + + menu_tool_action = e_menu_tool_action_new ( + "mail-reply-group", _("Group Reply"), + _("Reply to the mailing list, or to all recipients"), NULL); + + gtk_action_set_icon_name ( + GTK_ACTION (menu_tool_action), "mail-reply-all"); + + g_signal_connect ( + menu_tool_action, "activate", + G_CALLBACK (action_mail_reply_group_cb), reader); + + gtk_action_group_add_action_with_accel ( + action_group, GTK_ACTION (menu_tool_action), "g"); + /* Add the other actions the normal way. */ gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); @@ -2817,6 +2865,10 @@ e_mail_reader_init (EMailReader *reader) action = e_mail_reader_get_action (reader, action_name); g_object_set (action, "is-important", TRUE, NULL); + action_name = "mail-reply-group"; + action = e_mail_reader_get_action (reader, action_name); + g_object_set (action, "is-important", TRUE, NULL); + action_name = "mail-next"; action = e_mail_reader_get_action (reader, action_name); g_object_set (action, "short-label", _("Next"), NULL); diff --git a/mail/evolution-mail.schemas.in b/mail/evolution-mail.schemas.in index aa63695f2b..de4f4daa8f 100644 --- a/mail/evolution-mail.schemas.in +++ b/mail/evolution-mail.schemas.in @@ -59,6 +59,23 @@ + + /schemas/apps/evolution/mail/composer/group_reply_to_list + /apps/evolution/mail/composer/group_reply_to_list + evolution-mail + bool + false + + Group Reply replies to list + + Instead of the normal "Reply to All" behaviour, this option will + make the 'Group Reply' toolbar button try to reply only to the + mailing list through which you happened to receive the copy of + the message to which you're replying. + + + + /schemas/apps/evolution/mail/composer/reply_start_bottom /apps/evolution/mail/composer/reply_start_bottom diff --git a/mail/mail-config.ui b/mail/mail-config.ui index a5110ee9b8..8603940dcd 100644 --- a/mail/mail-config.ui +++ b/mail/mail-config.ui @@ -4529,6 +4529,21 @@ For example: "Work" or "Personal" 5 + + + Group Reply goes only to mailing list, if possible + True + True + False + True + True + + + False + False + 6 + + True @@ -4657,7 +4672,7 @@ For example: "Work" or "Personal" - 6 + 7 @@ -4733,7 +4748,7 @@ For example: "Work" or "Personal" - 7 + 8 diff --git a/modules/mail/e-mail-shell-settings.c b/modules/mail/e-mail-shell-settings.c index 29433aa3e6..c17cc8744f 100644 --- a/modules/mail/e-mail-shell-settings.c +++ b/modules/mail/e-mail-shell-settings.c @@ -219,6 +219,10 @@ e_mail_shell_settings_init (EShell *shell) "composer-ignore-list-reply-to", "/apps/evolution/mail/composer/ignore_list_reply_to"); + e_shell_settings_install_property_for_key ( + "composer-group-reply-to-list", + "/apps/evolution/mail/composer/group_reply_to_list"); + e_shell_settings_install_property_for_key ( "composer-prompt-only-bcc", "/apps/evolution/mail/prompts/only_bcc"); diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c index ad3cb46041..93620669a3 100644 --- a/modules/mail/em-composer-prefs.c +++ b/modules/mail/em-composer-prefs.c @@ -452,6 +452,11 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, shell_settings, "composer-ignore-list-reply-to", widget, "active"); + widget = e_builder_get_widget (prefs->builder, "chkGroupReplyToList"); + e_mutual_binding_new ( + shell_settings, "composer-group-reply-to-list", + widget, "active"); + widget = e_builder_get_widget (prefs->builder, "chkTopSignature"); e_mutual_binding_new ( shell_settings, "composer-top-signature", diff --git a/ui/evolution-mail-reader.ui b/ui/evolution-mail-reader.ui index ad0b401676..3c2888708d 100644 --- a/ui/evolution-mail-reader.ui +++ b/ui/evolution-mail-reader.ui @@ -111,7 +111,12 @@ - + + + + + + -- cgit v1.2.3