[evolution] I#795 - Add signature position option to Alternative Reply
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] I#795 - Add signature position option to Alternative Reply
- Date: Fri, 6 Mar 2020 08:48:10 +0000 (UTC)
commit feaf535c38ff3156e603dd06b5b902f484684315
Author: Milan Crha <mcrha redhat com>
Date: Fri Mar 6 09:50:12 2020 +0100
I#795 - Add signature position option to Alternative Reply
Closes https://gitlab.gnome.org/GNOME/evolution/issues/795
data/org.gnome.evolution.mail.gschema.xml.in | 5 +++
src/mail/e-mail-enums.h | 10 ++++--
src/mail/em-composer-utils.c | 50 ++++++++++++++++++++++------
3 files changed, 52 insertions(+), 13 deletions(-)
---
diff --git a/data/org.gnome.evolution.mail.gschema.xml.in b/data/org.gnome.evolution.mail.gschema.xml.in
index dbb2550a86..d3edbea056 100644
--- a/data/org.gnome.evolution.mail.gschema.xml.in
+++ b/data/org.gnome.evolution.mail.gschema.xml.in
@@ -789,6 +789,11 @@
<_summary>Put the cursor at the bottom of alternative replies</_summary>
<_description>This determines whether the cursor is placed at the top of the message or the bottom
when using Alternative Reply.</_description>
</key>
+ <key name="alt-reply-top-signature" enum="org.gnome.evolution.mail.ThreeState">
+ <default>'inconsistent'</default>
+ <_summary>Put the signature at the top of the message</_summary>
+ <_description>This determines whether the signature is placed at the top of the message or the bottom
when using Alternative Reply.</_description>
+ </key>
<key name="alt-reply-template-apply" type="b">
<default>false</default>
<_summary>Apply chosen template when using Alternative Reply</_summary>
diff --git a/src/mail/e-mail-enums.h b/src/mail/e-mail-enums.h
index 0f94c6da06..4ec1605709 100644
--- a/src/mail/e-mail-enums.h
+++ b/src/mail/e-mail-enums.h
@@ -58,7 +58,11 @@ typedef enum {
* @E_MAIL_REPLY_FLAG_TOP_POSTING: Force top posting; cannot be used together
* with @E_MAIL_REPLY_FLAG_BOTTOM_POSTING. If none it set, then uses global settings.
* @E_MAIL_REPLY_FLAG_BOTTOM_POSTING: Force bottom posting; cannot be used together
- * with @E_MAIL_REPLY_FLAG_BOTTOM_POSTING. If none it set, then uses global settings.
+ * with @E_MAIL_REPLY_FLAG_TOP_POSTING. If none it set, then uses global settings.
+ * @E_MAIL_REPLY_FLAG_TOP_SIGNATURE: Force placing signature to the top; cannot be used together
+ * with @E_MAIL_REPLY_FLAG_BOTTOM_SIGNATURE. If none it set, then uses global settings.
+ * @E_MAIL_REPLY_FLAG_BOTTOM_SIGNATURE: Force placing signature to the bottom; cannot be used together
+ * with @E_MAIL_REPLY_FLAG_TOP_SIGNATURE. If none it set, then uses global settings.
*
* Flags influencing behavior of em_utils_reply_to_message().
*
@@ -70,7 +74,9 @@ typedef enum { /*< flags >*/
E_MAIL_REPLY_FLAG_FORMAT_PLAIN = 1 << 1,
E_MAIL_REPLY_FLAG_FORMAT_HTML = 1 << 2,
E_MAIL_REPLY_FLAG_TOP_POSTING = 1 << 3,
- E_MAIL_REPLY_FLAG_BOTTOM_POSTING = 1 << 4
+ E_MAIL_REPLY_FLAG_BOTTOM_POSTING = 1 << 4,
+ E_MAIL_REPLY_FLAG_TOP_SIGNATURE = 1 << 5,
+ E_MAIL_REPLY_FLAG_BOTTOM_SIGNATURE = 1 << 6
} EMailReplyFlags;
G_END_DECLS
diff --git a/src/mail/em-composer-utils.c b/src/mail/em-composer-utils.c
index 1e8748ceb4..11bb4ef70b 100644
--- a/src/mail/em-composer-utils.c
+++ b/src/mail/em-composer-utils.c
@@ -4023,6 +4023,7 @@ em_utils_reply_alternative (GtkWindow *parent,
GtkRadioButton *style_default, *style_attach, *style_inline, *style_quote, *style_no_quote;
GtkToggleButton *html_format;
GtkToggleButton *bottom_posting;
+ GtkToggleButton *top_signature;
GtkCheckButton *apply_template;
GtkComboBox *templates;
GtkCheckButton *preserve_message_subject;
@@ -4142,6 +4143,9 @@ em_utils_reply_alternative (GtkWindow *parent,
bottom_posting = GTK_TOGGLE_BUTTON (gtk_check_button_new_with_mnemonic (_("Start _typing at the
bottom")));
gtk_box_pack_start (vbox, GTK_WIDGET (bottom_posting), FALSE, FALSE, 0);
+ top_signature = GTK_TOGGLE_BUTTON (gtk_check_button_new_with_mnemonic (_("_Keep signature above the
original message")));
+ gtk_box_pack_start (vbox, GTK_WIDGET (top_signature), FALSE, FALSE, 0);
+
/* One line gap between sections */
widget = gtk_label_new (" ");
gtk_box_pack_start (vbox, widget, FALSE, FALSE, 0);
@@ -4275,6 +4279,7 @@ em_utils_reply_alternative (GtkWindow *parent,
emcu_three_state_set_value (html_format, g_settings_get_enum (settings, "alt-reply-html-format"));
emcu_three_state_set_value (bottom_posting, g_settings_get_enum (settings, "alt-reply-start-bottom"));
+ emcu_three_state_set_value (top_signature, g_settings_get_enum (settings, "alt-reply-top-signature"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (apply_template), g_settings_get_boolean (settings,
"alt-reply-template-apply"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (preserve_message_subject), g_settings_get_boolean
(settings, "alt-reply-template-preserve-subject"));
@@ -4283,6 +4288,7 @@ em_utils_reply_alternative (GtkWindow *parent,
emcu_connect_three_state_changer (html_format);
emcu_connect_three_state_changer (bottom_posting);
+ emcu_connect_three_state_changer (top_signature);
e_binding_bind_property (
apply_template, "active",
@@ -4325,12 +4331,17 @@ em_utils_reply_alternative (GtkWindow *parent,
style_no_quote, "sensitive",
G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN);
- /* Similarly with bottom posting, which doesn't work when using Templates */
+ /* Similarly with other options, which don't work when using Templates */
e_binding_bind_property (
apply_template, "active",
bottom_posting, "sensitive",
G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN);
+ e_binding_bind_property (
+ apply_template, "active",
+ top_signature, "sensitive",
+ G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN);
+
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
GtkTreeIter iter;
AltReplyContext *context;
@@ -4375,6 +4386,14 @@ em_utils_reply_alternative (GtkWindow *parent,
else if (three_state == E_THREE_STATE_OFF)
context->flags |= E_MAIL_REPLY_FLAG_TOP_POSTING;
+ three_state = emcu_three_state_get_value (top_signature);
+ g_settings_set_enum (settings, "alt-reply-top-signature", three_state);
+
+ if (three_state == E_THREE_STATE_ON)
+ context->flags |= E_MAIL_REPLY_FLAG_TOP_SIGNATURE;
+ else if (three_state == E_THREE_STATE_OFF)
+ context->flags |= E_MAIL_REPLY_FLAG_BOTTOM_SIGNATURE;
+
g_settings_set_enum (settings, "alt-reply-style", context->style);
g_settings_set_boolean (settings, "alt-reply-template-apply", gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON (apply_template)));
g_settings_set_boolean (settings, "alt-reply-template-preserve-subject",
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (preserve_message_subject)));
@@ -4426,6 +4445,23 @@ em_utils_reply_alternative (GtkWindow *parent,
g_clear_object (&settings);
}
+static void
+em_utils_update_by_reply_flags (EContentEditor *cnt_editor,
+ guint32 reply_flags) /* EMailReplyFlags */
+{
+ if ((reply_flags & (E_MAIL_REPLY_FLAG_TOP_POSTING | E_MAIL_REPLY_FLAG_BOTTOM_POSTING)) != 0) {
+ e_content_editor_set_start_bottom (cnt_editor,
+ (reply_flags & E_MAIL_REPLY_FLAG_TOP_POSTING) != 0 ?
+ E_THREE_STATE_OFF : E_THREE_STATE_ON);
+ }
+
+ if ((reply_flags & (E_MAIL_REPLY_FLAG_TOP_SIGNATURE | E_MAIL_REPLY_FLAG_BOTTOM_SIGNATURE)) != 0) {
+ e_content_editor_set_top_signature (cnt_editor,
+ (reply_flags & E_MAIL_REPLY_FLAG_TOP_SIGNATURE) != 0 ?
+ E_THREE_STATE_ON : E_THREE_STATE_OFF);
+ }
+}
+
/**
* em_utils_reply_to_message:
* @composer: an #EMsgComposer
@@ -4473,11 +4509,7 @@ em_utils_reply_to_message (EMsgComposer *composer,
e_content_editor_set_html_mode (cnt_editor, (reply_flags & E_MAIL_REPLY_FLAG_FORMAT_HTML) !=
0);
}
- if ((reply_flags & (E_MAIL_REPLY_FLAG_TOP_POSTING | E_MAIL_REPLY_FLAG_BOTTOM_POSTING)) != 0) {
- e_content_editor_set_start_bottom (cnt_editor,
- (reply_flags & E_MAIL_REPLY_FLAG_TOP_POSTING) != 0 ?
- E_THREE_STATE_OFF : E_THREE_STATE_ON);
- }
+ em_utils_update_by_reply_flags (cnt_editor, reply_flags);
to = camel_internet_address_new ();
cc = camel_internet_address_new ();
@@ -4600,11 +4632,7 @@ em_utils_reply_to_message (EMsgComposer *composer,
em_utils_apply_send_account_override_to_composer (composer, folder);
/* This is required to be done (also) at the end */
- if ((reply_flags & (E_MAIL_REPLY_FLAG_TOP_POSTING | E_MAIL_REPLY_FLAG_BOTTOM_POSTING)) != 0) {
- e_content_editor_set_start_bottom (cnt_editor,
- (reply_flags & E_MAIL_REPLY_FLAG_TOP_POSTING) != 0 ?
- E_THREE_STATE_OFF : E_THREE_STATE_ON);
- }
+ em_utils_update_by_reply_flags (cnt_editor, reply_flags);
composer_set_no_change (composer);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]