[evolution] Bug 759151 - Always preserve sign/encrypt settings in composer ][



commit 81c448ba5f22733032f42cb54ff5bc6a76f914af
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jan 25 17:22:15 2016 +0100

    Bug 759151 - Always preserve sign/encrypt settings in composer ][

 composer/e-msg-composer.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 188ac12..617f94e 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -1637,6 +1637,7 @@ msg_composer_mail_identity_changed_cb (EMsgComposer *composer)
        gboolean pgp_encrypt;
        gboolean smime_sign;
        gboolean smime_encrypt;
+       gboolean composer_realized;
        const gchar *extension_name;
        const gchar *uid, *active_signature_id;
 
@@ -1670,23 +1671,28 @@ msg_composer_mail_identity_changed_cb (EMsgComposer *composer)
                        composer->priv->mime_type,
                        "text/calendar", 13) != 0);
 
+       /* Preserve options only if the composer was realized, otherwise an account
+          change according to current folder or similar reasons can cause the options
+          to be set, when the default account has it set, but the other not. */
+       composer_realized = gtk_widget_get_realized (GTK_WIDGET (composer));
+
        action = GTK_TOGGLE_ACTION (ACTION (PGP_SIGN));
-       active = gtk_toggle_action_get_active (action);
+       active = composer_realized && gtk_toggle_action_get_active (action);
        active |= (can_sign && pgp_sign);
        gtk_toggle_action_set_active (action, active);
 
        action = GTK_TOGGLE_ACTION (ACTION (PGP_ENCRYPT));
-       active = gtk_toggle_action_get_active (action);
+       active = composer_realized && gtk_toggle_action_get_active (action);
        active |= pgp_encrypt;
        gtk_toggle_action_set_active (action, active);
 
        action = GTK_TOGGLE_ACTION (ACTION (SMIME_SIGN));
-       active = gtk_toggle_action_get_active (action);
+       active = composer_realized && gtk_toggle_action_get_active (action);
        active |= (can_sign && smime_sign);
        gtk_toggle_action_set_active (action, active);
 
        action = GTK_TOGGLE_ACTION (ACTION (SMIME_ENCRYPT));
-       active = gtk_toggle_action_get_active (action);
+       active = composer_realized && gtk_toggle_action_get_active (action);
        active |= smime_encrypt;
        gtk_toggle_action_set_active (action, active);
 


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