[evolution] Bug 339675 - Add option to Include signature in new messages only
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug 339675 - Add option to Include signature in new messages only
- Date: Thu, 22 Jun 2017 13:24:28 +0000 (UTC)
commit a7194c32291028c4f8faf41cd2fdc916e848e776
Author: Milan Crha <mcrha redhat com>
Date: Thu Jun 22 15:21:31 2017 +0200
Bug 339675 - Add option to Include signature in new messages only
data/org.gnome.evolution.mail.gschema.xml.in | 5 ++
src/composer/e-composer-private.h | 3 +-
src/composer/e-msg-composer.c | 70 +++++++++++++++++++++++++-
src/composer/e-msg-composer.h | 6 ++
src/mail/em-composer-utils.c | 6 ++
src/mail/mail-config.ui | 37 ++++++++++----
src/modules/mail/em-composer-prefs.c | 6 ++
7 files changed, 119 insertions(+), 14 deletions(-)
---
diff --git a/data/org.gnome.evolution.mail.gschema.xml.in b/data/org.gnome.evolution.mail.gschema.xml.in
index 3d0c3cf..99244c0 100644
--- a/data/org.gnome.evolution.mail.gschema.xml.in
+++ b/data/org.gnome.evolution.mail.gschema.xml.in
@@ -160,6 +160,11 @@
<summary>How long to delay Outbox flush when sending messages through Outbox folder</summary>
<description>A delay, in minutes, to wait for the Outbox folder flush. Less than 0 means never flush,
0 means immediately, the rest is the delay interval in minutes.</description>
</key>
+ <key name="composer-signature-in-new-only" type="b">
+ <default>false</default>
+ <_summary>Include signature in new messages only</_summary>
+ <_description>Include selected signature only for new messages, but have no signature added for
Replies or Forwards.</_description>
+ </key>
<key name="composer-top-signature" type="b">
<default>false</default>
<_summary>Put personalized signatures at the top of replies</_summary>
diff --git a/src/composer/e-composer-private.h b/src/composer/e-composer-private.h
index 72b4d07..f8a06b6 100644
--- a/src/composer/e-composer-private.h
+++ b/src/composer/e-composer-private.h
@@ -94,8 +94,7 @@ struct _EMsgComposerPrivate {
gboolean busy;
gboolean disable_signature;
- gboolean is_from_draft;
- gboolean is_from_new_message;
+ gboolean is_reply_or_forward;
/* The web view is uneditable while the editor is busy.
* This is used to restore the previous editable state. */
gboolean saved_editable;
diff --git a/src/composer/e-msg-composer.c b/src/composer/e-msg-composer.c
index 7f299f5..3ea98d5 100644
--- a/src/composer/e-msg-composer.c
+++ b/src/composer/e-msg-composer.c
@@ -91,7 +91,8 @@ enum {
PROP_BUSY,
PROP_EDITOR,
PROP_FOCUS_TRACKER,
- PROP_SHELL
+ PROP_SHELL,
+ PROP_IS_REPLY_OR_FORWARD
};
enum {
@@ -1630,6 +1631,7 @@ msg_composer_mail_identity_changed_cb (EMsgComposer *composer)
gboolean smime_sign;
gboolean smime_encrypt;
gboolean composer_realized;
+ gboolean was_disable_signature, unset_signature = FALSE;
const gchar *extension_name;
const gchar *active_signature_id;
gchar *uid, *alias_name = NULL, *alias_address = NULL, *pgp_keyid, *smime_cert;
@@ -1698,14 +1700,33 @@ msg_composer_mail_identity_changed_cb (EMsgComposer *composer)
active |= smime_encrypt;
gtk_toggle_action_set_active (action, active);
+ was_disable_signature = composer->priv->disable_signature;
+
+ if (e_msg_composer_get_is_reply_or_forward (composer)) {
+ GSettings *settings;
+
+ settings = e_util_ref_settings ("org.gnome.evolution.mail");
+ unset_signature = g_settings_get_boolean (settings, "composer-signature-in-new-only");
+ g_object_unref (settings);
+ }
+
combo_box = e_composer_header_table_get_signature_combo_box (table);
+
+ if (unset_signature)
+ composer->priv->disable_signature = TRUE;
+
e_mail_signature_combo_box_set_identity (combo_box, uid, alias_name, alias_address);
+ if (unset_signature)
+ gtk_combo_box_set_active_id (GTK_COMBO_BOX (combo_box), "none");
+
+ composer->priv->disable_signature = was_disable_signature;
+
g_object_unref (source);
g_free (uid);
active_signature_id = gtk_combo_box_get_active_id (GTK_COMBO_BOX (combo_box));
- if (g_strcmp0 (active_signature_id, E_MAIL_SIGNATURE_AUTOGENERATED_UID) == 0)
+ if (unset_signature || g_strcmp0 (active_signature_id, E_MAIL_SIGNATURE_AUTOGENERATED_UID) == 0)
e_composer_update_signature (composer);
g_free (alias_name);
@@ -2070,6 +2091,12 @@ msg_composer_set_property (GObject *object,
g_value_get_object (value));
return;
+ case PROP_IS_REPLY_OR_FORWARD:
+ e_msg_composer_set_is_reply_or_forward (
+ E_MSG_COMPOSER (object),
+ g_value_get_boolean (value));
+ return;
+
case PROP_SHELL:
msg_composer_set_shell (
E_MSG_COMPOSER (object),
@@ -2105,6 +2132,12 @@ msg_composer_get_property (GObject *object,
E_MSG_COMPOSER (object)));
return;
+ case PROP_IS_REPLY_OR_FORWARD:
+ g_value_set_boolean (
+ value, e_msg_composer_get_is_reply_or_forward (
+ E_MSG_COMPOSER (object)));
+ return;
+
case PROP_SHELL:
g_value_set_object (
value, e_msg_composer_get_shell (
@@ -2609,6 +2642,17 @@ e_msg_composer_class_init (EMsgComposerClass *class)
g_object_class_install_property (
object_class,
+ PROP_IS_REPLY_OR_FORWARD,
+ g_param_spec_boolean (
+ "is-reply-or-forward",
+ "Is Reply Or Forward",
+ "Whether the composed message is a reply or a forward message",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
PROP_SHELL,
g_param_spec_object (
"shell",
@@ -5405,3 +5449,25 @@ e_msg_composer_restore_focus_on_composer (EMsgComposer *composer)
composer->priv->focused_entry = NULL;
}
+
+gboolean
+e_msg_composer_get_is_reply_or_forward (EMsgComposer *composer)
+{
+ g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE);
+
+ return composer->priv->is_reply_or_forward;
+}
+
+void
+e_msg_composer_set_is_reply_or_forward (EMsgComposer *composer,
+ gboolean is_reply_or_forward)
+{
+ g_return_if_fail (E_IS_MSG_COMPOSER (composer));
+
+ if ((composer->priv->is_reply_or_forward ? 1 : 0) == (is_reply_or_forward ? 1 : 0))
+ return;
+
+ composer->priv->is_reply_or_forward = is_reply_or_forward;
+
+ g_object_notify (G_OBJECT (composer), "is-reply-or-forward");
+}
diff --git a/src/composer/e-msg-composer.h b/src/composer/e-msg-composer.h
index 4625171..da82752 100644
--- a/src/composer/e-msg-composer.h
+++ b/src/composer/e-msg-composer.h
@@ -207,6 +207,12 @@ void e_msg_composer_save_focused_widget
void e_msg_composer_restore_focus_on_composer
(EMsgComposer *composer);
gboolean e_msg_composer_is_busy (EMsgComposer *composer);
+gboolean e_msg_composer_get_is_reply_or_forward
+ (EMsgComposer *composer);
+void e_msg_composer_set_is_reply_or_forward
+ (EMsgComposer *composer,
+ gboolean is_reply_or_forward);
+
G_END_DECLS
#endif /* E_MSG_COMPOSER_H */
diff --git a/src/mail/em-composer-utils.c b/src/mail/em-composer-utils.c
index 4aff264..c5de0b6 100644
--- a/src/mail/em-composer-utils.c
+++ b/src/mail/em-composer-utils.c
@@ -2238,6 +2238,8 @@ em_utils_forward_message (EMsgComposer *composer,
g_return_if_fail (E_IS_MSG_COMPOSER (composer));
g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message));
+ e_msg_composer_set_is_reply_or_forward (composer, TRUE);
+
switch (style) {
case E_MAIL_FORWARD_STYLE_ATTACHED:
default:
@@ -2272,6 +2274,8 @@ em_utils_forward_attachment (EMsgComposer *composer,
if (folder != NULL)
g_return_if_fail (CAMEL_IS_FOLDER (folder));
+ e_msg_composer_set_is_reply_or_forward (composer, TRUE);
+
set_up_new_composer (composer, subject, folder);
e_msg_composer_attach (composer, part);
@@ -2508,6 +2512,8 @@ reply_setup_composer (EMsgComposer *composer,
g_return_if_fail (E_IS_MSG_COMPOSER (composer));
g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message));
+ e_msg_composer_set_is_reply_or_forward (composer, TRUE);
+
if (to != NULL)
g_return_if_fail (CAMEL_IS_INTERNET_ADDRESS (to));
diff --git a/src/mail/mail-config.ui b/src/mail/mail-config.ui
index 86c3ee3..977d7ac 100644
--- a/src/mail/mail-config.ui
+++ b/src/mail/mail-config.ui
@@ -535,8 +535,8 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="chkTopSignature">
- <property name="label" translatable="yes">_Keep signature above the original message
on replying</property>
+ <object class="GtkCheckButton" id="chkSignatureInNewOnly">
+ <property name="label" translatable="yes">Include si_gnature in new messages
only</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -552,8 +552,8 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="chkIgnoreListReplyTo">
- <property name="label" translatable="yes">Ig_nore Reply-To: for mailing
lists</property>
+ <object class="GtkCheckButton" id="chkTopSignature">
+ <property name="label" translatable="yes">_Keep signature above the original message
on replying</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -569,8 +569,8 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="chkGroupReplyToList">
- <property name="label" translatable="yes">Gro_up Reply goes only to mailing list, if
possible</property>
+ <object class="GtkCheckButton" id="chkIgnoreListReplyTo">
+ <property name="label" translatable="yes">Ig_nore Reply-To: for mailing
lists</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -586,8 +586,8 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="chkSignReplyIfSigned">
- <property name="label" translatable="yes">Digitally _sign messages when original
message signed (PGP or S/MIME)</property>
+ <object class="GtkCheckButton" id="chkGroupReplyToList">
+ <property name="label" translatable="yes">Gro_up 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>
@@ -603,6 +603,23 @@
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="chkSignReplyIfSigned">
+ <property name="label" translatable="yes">Digitally _sign messages when original
message signed (PGP or S/MIME)</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="xalign">0.5</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="top_attach">7</property>
+ <property name="bottom_attach">8</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
<object class="GtkCheckButton" id="chkWrapQuotedTextInReplies">
<property name="label" translatable="yes">_Wrap quoted text in replies</property>
<property name="visible">True</property>
@@ -614,8 +631,8 @@
</object>
<packing>
<property name="right_attach">2</property>
- <property name="top_attach">7</property>
- <property name="bottom_attach">8</property>
+ <property name="top_attach">8</property>
+ <property name="bottom_attach">9</property>
<property name="y_options"/>
</packing>
</child>
diff --git a/src/modules/mail/em-composer-prefs.c b/src/modules/mail/em-composer-prefs.c
index c393b07..31d5484 100644
--- a/src/modules/mail/em-composer-prefs.c
+++ b/src/modules/mail/em-composer-prefs.c
@@ -1260,6 +1260,12 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
widget, "active",
G_SETTINGS_BIND_DEFAULT);
+ widget = e_builder_get_widget (prefs->builder, "chkSignatureInNewOnly");
+ g_settings_bind (
+ settings, "composer-signature-in-new-only",
+ widget, "active",
+ G_SETTINGS_BIND_DEFAULT);
+
widget = e_builder_get_widget (prefs->builder, "chkTopSignature");
g_settings_bind (
settings, "composer-top-signature",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]