Bug 748774 - Act on encrypt-by-default from ESourceOpenPGP

This commit is contained in:
Daniel Kahn Gillmor
2015-05-05 16:45:28 +02:00
committed by Milan Crha
parent a0a63fedb9
commit c35c00a3fa
2 changed files with 22 additions and 2 deletions

View File

@ -1611,6 +1611,7 @@ msg_composer_mail_identity_changed_cb (EMsgComposer *composer)
gboolean active;
gboolean can_sign;
gboolean pgp_sign;
gboolean pgp_encrypt;
gboolean smime_sign;
gboolean smime_encrypt;
gboolean is_message_from_edit_as_new;
@ -1633,6 +1634,7 @@ msg_composer_mail_identity_changed_cb (EMsgComposer *composer)
extension_name = E_SOURCE_EXTENSION_OPENPGP;
pgp = e_source_get_extension (source, extension_name);
pgp_sign = e_source_openpgp_get_sign_by_default (pgp);
pgp_encrypt = e_source_openpgp_get_encrypt_by_default (pgp);
extension_name = E_SOURCE_EXTENSION_SMIME;
smime = e_source_get_extension (source, extension_name);
@ -1657,6 +1659,12 @@ msg_composer_mail_identity_changed_cb (EMsgComposer *composer)
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 &= is_message_from_edit_as_new;
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 &= is_message_from_edit_as_new;

View File

@ -463,12 +463,24 @@ mail_config_security_page_constructed (GObject *object)
G_BINDING_SYNC_CREATE |
G_BINDING_BIDIRECTIONAL);
text = _("Always encrypt to _myself when sending encrypted messages");
text = _("Always enc_rypt outgoing messages when using this account");
widget = gtk_check_button_new_with_mnemonic (text);
gtk_widget_set_margin_left (widget, 12);
gtk_grid_attach (GTK_GRID (container), widget, 0, 4, 2, 1);
gtk_widget_show (widget);
e_binding_bind_property (
openpgp_ext, "encrypt-by-default",
widget, "active",
G_BINDING_SYNC_CREATE |
G_BINDING_BIDIRECTIONAL);
text = _("Always encrypt to _myself when sending encrypted messages");
widget = gtk_check_button_new_with_mnemonic (text);
gtk_widget_set_margin_left (widget, 12);
gtk_grid_attach (GTK_GRID (container), widget, 0, 5, 2, 1);
gtk_widget_show (widget);
e_binding_bind_property (
openpgp_ext, "encrypt-to-self",
widget, "active",
@ -478,7 +490,7 @@ mail_config_security_page_constructed (GObject *object)
text = _("Always _trust keys in my keyring when encrypting");
widget = gtk_check_button_new_with_mnemonic (text);
gtk_widget_set_margin_left (widget, 12);
gtk_grid_attach (GTK_GRID (container), widget, 0, 5, 2, 1);
gtk_grid_attach (GTK_GRID (container), widget, 0, 6, 2, 1);
gtk_widget_show (widget);
e_binding_bind_property (