Commit a7194c32 authored by Milan Crha's avatar Milan Crha
Browse files

Bug 339675 - Add option to Include signature in new messages only

parent f582dae7
......@@ -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>
......
......@@ -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;
......
......@@ -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 (
......@@ -2607,6 +2640,17 @@ e_msg_composer_class_init (EMsgComposerClass *class)
E_TYPE_FOCUS_TRACKER,
G_PARAM_READABLE));
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,
......@@ -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");
}
......@@ -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 */
......@@ -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));
......
......@@ -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>
......@@ -602,6 +602,23 @@
<property name="y_options"/>
</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>
......@@ -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>
......
......@@ -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",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment