[evolution] Change 'Reply to All' toolbar button into configurable 'Group Reply'



commit 21b0925061702c0c2a6ee30819c739409bba39d2
Author: David Woodhouse <David Woodhouse intel com>
Date:   Thu Jul 15 10:20:14 2010 +0100

    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 7e3ac39..9a6d5cb 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -913,6 +913,21 @@ action_mail_reply_all_cb (GtkAction *action,
 }
 
 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"),
 	  "<Shift><Control>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), "<Control>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), "<Control>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 aa63695..de4f4da 100644
--- a/mail/evolution-mail.schemas.in
+++ b/mail/evolution-mail.schemas.in
@@ -60,6 +60,23 @@
     </schema>
 
     <schema>
+      <key>/schemas/apps/evolution/mail/composer/group_reply_to_list</key>
+      <applyto>/apps/evolution/mail/composer/group_reply_to_list</applyto>
+      <owner>evolution-mail</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+         <short>Group Reply replies to list</short>
+         <long>
+           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.
+	 </long>
+      </locale>
+    </schema>
+
+    <schema>
       <key>/schemas/apps/evolution/mail/composer/reply_start_bottom</key>
       <applyto>/apps/evolution/mail/composer/reply_start_bottom</applyto>
       <owner>evolution-mail</owner>
diff --git a/mail/mail-config.ui b/mail/mail-config.ui
index a5110ee..8603940 100644
--- a/mail/mail-config.ui
+++ b/mail/mail-config.ui
@@ -4530,6 +4530,21 @@ For example: "Work" or "Personal"</property>
                           </packing>
                         </child>
                         <child>
+                          <object class="GtkCheckButton" id="chkGroupReplyToList">
+                            <property name="label" translatable="yes">Group Reply goes only to mailing list, if possible</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="draw_indicator">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">6</property>
+                          </packing>
+                        </child>
+                        <child>
                           <object class="GtkTable" id="tableForwardsReplies">
                             <property name="visible">True</property>
                             <property name="n_rows">3</property>
@@ -4657,7 +4672,7 @@ For example: "Work" or "Personal"</property>
                             </child>
                           </object>
                           <packing>
-                            <property name="position">6</property>
+                            <property name="position">7</property>
                           </packing>
                         </child>
                         <child>
@@ -4733,7 +4748,7 @@ For example: "Work" or "Personal"</property>
                             </child>
                           </object>
                           <packing>
-                            <property name="position">7</property>
+                            <property name="position">8</property>
                           </packing>
                         </child>
                       </object>
diff --git a/modules/mail/e-mail-shell-settings.c b/modules/mail/e-mail-shell-settings.c
index 29433aa..c17cc87 100644
--- a/modules/mail/e-mail-shell-settings.c
+++ b/modules/mail/e-mail-shell-settings.c
@@ -220,6 +220,10 @@ e_mail_shell_settings_init (EShell *shell)
 		"/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 ad3cb46..9362066 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 ad0b401..3c28887 100644
--- a/ui/evolution-mail-reader.ui
+++ b/ui/evolution-mail-reader.ui
@@ -111,7 +111,12 @@
   <toolbar name='main-toolbar'>
     <placeholder name='mail-toolbar-common'>
       <toolitem action='mail-reply-sender'/>
-      <toolitem action='mail-reply-all'/>
+      <toolitem action='mail-reply-group'>
+        <menu action='mail-reply-group-menu'>
+          <menuitem action='mail-reply-all'/>
+          <menuitem action='mail-reply-list'/>
+        </menu>
+      </toolitem>
       <toolitem action='mail-forward'>
         <menu action='mail-forward-as-menu'>
           <menuitem action='mail-forward-attached-full'/>



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