[evolution] Bug 776243 - Cannot change sign/encrypt by default without certificate
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug 776243 - Cannot change sign/encrypt by default without certificate
- Date: Tue, 20 Dec 2016 15:24:46 +0000 (UTC)
commit 3141882627816c1137dfceef60a31a424b25b425
Author: Milan Crha <mcrha redhat com>
Date: Tue Dec 20 16:24:03 2016 +0100
Bug 776243 - Cannot change sign/encrypt by default without certificate
src/composer/e-msg-composer.c | 16 ++++++++---
src/mail/e-mail-config-security-page.c | 45 --------------------------------
2 files changed, 11 insertions(+), 50 deletions(-)
---
diff --git a/src/composer/e-msg-composer.c b/src/composer/e-msg-composer.c
index 7170e2a..3ac6eff 100644
--- a/src/composer/e-msg-composer.c
+++ b/src/composer/e-msg-composer.c
@@ -1627,7 +1627,7 @@ msg_composer_mail_identity_changed_cb (EMsgComposer *composer)
gboolean composer_realized;
const gchar *extension_name;
const gchar *active_signature_id;
- gchar *uid, *alias_name = NULL, *alias_address = NULL;
+ gchar *uid, *alias_name = NULL, *alias_address = NULL, *pgp_keyid, *smime_cert;
table = e_msg_composer_get_header_table (composer);
uid = e_composer_header_table_dup_identity_uid (table, &alias_name, &alias_address);
@@ -1647,13 +1647,19 @@ 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);
+ pgp_keyid = e_source_openpgp_dup_key_id (pgp);
+ pgp_sign = pgp_keyid && *pgp_keyid && e_source_openpgp_get_sign_by_default (pgp);
+ pgp_encrypt = pgp_keyid && *pgp_keyid && e_source_openpgp_get_encrypt_by_default (pgp);
+ g_free (pgp_keyid);
extension_name = E_SOURCE_EXTENSION_SMIME;
smime = e_source_get_extension (source, extension_name);
- smime_sign = e_source_smime_get_sign_by_default (smime);
- smime_encrypt = e_source_smime_get_encrypt_by_default (smime);
+ smime_cert = e_source_smime_dup_signing_certificate (smime);
+ smime_sign = smime_cert && *smime_cert && e_source_smime_get_sign_by_default (smime);
+ g_free (smime_cert);
+ smime_cert = e_source_smime_dup_encryption_certificate (smime);
+ smime_encrypt = smime_cert && *smime_cert && e_source_smime_get_encrypt_by_default (smime);
+ g_free (smime_cert);
can_sign =
(composer->priv->mime_type == NULL) ||
diff --git a/src/mail/e-mail-config-security-page.c b/src/mail/e-mail-config-security-page.c
index 38f9255..dc98ad5 100644
--- a/src/mail/e-mail-config-security-page.c
+++ b/src/mail/e-mail-config-security-page.c
@@ -61,27 +61,6 @@ G_DEFINE_TYPE_WITH_CODE (
E_TYPE_MAIL_CONFIG_PAGE,
e_mail_config_security_page_interface_init))
-static gboolean
-mail_config_security_page_string_has_text (GBinding *binding,
- const GValue *source_value,
- GValue *target_value,
- gpointer unused)
-{
- const gchar *string;
- gchar *stripped;
-
- string = g_value_get_string (source_value);
-
- if (string == NULL)
- string = "";
-
- stripped = g_strstrip (g_strdup (string));
- g_value_set_boolean (target_value, *stripped != '\0');
- g_free (stripped);
-
- return TRUE;
-}
-
static void
mail_config_security_page_cert_selected (ECertSelector *selector,
const gchar *key,
@@ -628,14 +607,6 @@ mail_config_security_page_constructed (GObject *object)
G_BINDING_SYNC_CREATE |
G_BINDING_BIDIRECTIONAL);
- e_binding_bind_property_full (
- smime_ext, "signing-certificate",
- widget, "sensitive",
- G_BINDING_SYNC_CREATE,
- mail_config_security_page_string_has_text,
- NULL,
- NULL, (GDestroyNotify) NULL);
-
/* Add extra padding between signing stuff and encryption stuff. */
gtk_widget_set_margin_bottom (widget, 6);
@@ -693,14 +664,6 @@ mail_config_security_page_constructed (GObject *object)
G_BINDING_SYNC_CREATE |
G_BINDING_BIDIRECTIONAL);
- e_binding_bind_property_full (
- smime_ext, "encryption-certificate",
- widget, "sensitive",
- G_BINDING_SYNC_CREATE,
- mail_config_security_page_string_has_text,
- NULL,
- NULL, (GDestroyNotify) NULL);
-
text = _("Always encrypt to myself when sending encrypted messages");
widget = gtk_check_button_new_with_mnemonic (text);
gtk_widget_set_margin_left (widget, 12);
@@ -713,14 +676,6 @@ mail_config_security_page_constructed (GObject *object)
G_BINDING_SYNC_CREATE |
G_BINDING_BIDIRECTIONAL);
- e_binding_bind_property_full (
- smime_ext, "encryption-certificate",
- widget, "sensitive",
- G_BINDING_SYNC_CREATE,
- mail_config_security_page_string_has_text,
- NULL,
- NULL, (GDestroyNotify) NULL);
-
#endif /* ENABLE_SMIME */
g_object_unref (size_group);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]