From bb9da6fb0c1f5bdab633b2526094864250845b0c Mon Sep 17 00:00:00 2001 From: Not Zed Date: Fri, 31 Oct 2003 04:56:46 +0000 Subject: Rearranged smime config slightly, and added encrypt key preference. 2003-10-31 Not Zed * mail-config.glade: Rearranged smime config slightly, and added encrypt key preference. * mail-account-gui.c (mail_account_gui_save, mail_account_gui_new): enable smime always if have_nss. Added new options in glade file and handle changed names. (smime_changed, smime_sign_key_select, smime_sign_key_clear) (smime_encrypt_key_select, smime_encrypt_key_clear): Add a bunch of mostly dummy UI behaviour management stuff. svn path=/trunk/; revision=23145 --- mail/ChangeLog | 12 ++ mail/mail-account-gui.c | 98 +++++++++++-- mail/mail-account-gui.h | 12 +- mail/mail-config.glade | 371 ++++++++++++++++++++++++++++++++++++++---------- 4 files changed, 403 insertions(+), 90 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 2cc7b50be1..12df9b7510 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,15 @@ +2003-10-31 Not Zed + + * mail-config.glade: Rearranged smime config slightly, and added + encrypt key preference. + + * mail-account-gui.c (mail_account_gui_save, + mail_account_gui_new): enable smime always if have_nss. Added new + options in glade file and handle changed names. + (smime_changed, smime_sign_key_select, smime_sign_key_clear) + (smime_encrypt_key_select, smime_encrypt_key_clear): Add a bunch + of mostly dummy UI behaviour management stuff. + 2003-10-30 Not Zed * em-format.c (em_format_is_inline): show application/x-pkcs7-mime diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c index 263051585f..0aec7dcd32 100644 --- a/mail/mail-account-gui.c +++ b/mail/mail-account-gui.c @@ -1406,6 +1406,58 @@ prepare_signatures (MailAccountGui *gui) } } +#if defined (HAVE_NSS) +static void +smime_changed(MailAccountGui *gui) +{ + int act; + const char *tmp; + + tmp = gtk_entry_get_text(gui->smime_sign_key); + act = tmp && tmp[0]; + gtk_widget_set_sensitive((GtkWidget *)gui->smime_sign_key_clear, act); + gtk_widget_set_sensitive((GtkWidget *)gui->smime_sign_default, act); + if (!act) + gtk_toggle_button_set_active(gui->smime_sign_default, FALSE); + + tmp = gtk_entry_get_text(gui->smime_encrypt_key); + act = tmp && tmp[0]; + gtk_widget_set_sensitive((GtkWidget *)gui->smime_encrypt_key_clear, act); + gtk_widget_set_sensitive((GtkWidget *)gui->smime_encrypt_default, act); + gtk_widget_set_sensitive((GtkWidget *)gui->smime_encrypt_to_self, act); + if (!act) { + gtk_toggle_button_set_active(gui->smime_encrypt_default, FALSE); + gtk_toggle_button_set_active(gui->smime_encrypt_to_self, FALSE); + } +} + +static void +smime_sign_key_select(GtkWidget *w, MailAccountGui *gui) +{ + smime_changed(gui); +} + +static void +smime_sign_key_clear(GtkWidget *w, MailAccountGui *gui) +{ + gtk_entry_set_text(gui->smime_sign_key, ""); + smime_changed(gui); +} + +static void +smime_encrypt_key_select(GtkWidget *w, MailAccountGui *gui) +{ + smime_changed(gui); +} + +static void +smime_encrypt_key_clear(GtkWidget *w, MailAccountGui *gui) +{ + gtk_entry_set_text(gui->smime_encrypt_key, ""); + smime_changed(gui); +} +#endif + MailAccountGui * mail_account_gui_new (EAccount *account, EMAccountPrefs *dialog) { @@ -1544,14 +1596,31 @@ mail_account_gui_new (EAccount *account, EMAccountPrefs *dialog) gui->pgp_always_trust = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "pgp_always_trust")); gtk_toggle_button_set_active (gui->pgp_always_trust, account->pgp_always_trust); -#if defined (HAVE_NSS) && defined (SMIME_SUPPORTED) - gui->smime_key = GTK_ENTRY (glade_xml_get_widget (gui->xml, "smime_key")); - if (account->smime_key) - gtk_entry_set_text (gui->smime_key, account->smime_key); - gui->smime_encrypt_to_self = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "smime_encrypt_to_self")); - gtk_toggle_button_set_active (gui->smime_encrypt_to_self, account->smime_encrypt_to_self); - gui->smime_always_sign = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "smime_always_sign")); - gtk_toggle_button_set_active (gui->smime_always_sign, account->smime_always_sign); +#if defined (HAVE_NSS) + gui->smime_sign_key = (GtkEntry *)glade_xml_get_widget (gui->xml, "smime_sign_key"); + if (account->smime_sign_key) + gtk_entry_set_text(gui->smime_sign_key, account->smime_sign_key); + gui->smime_sign_key_select = (GtkButton *)glade_xml_get_widget (gui->xml, "smime_sign_key_select"); + gui->smime_sign_key_clear = (GtkButton *)glade_xml_get_widget (gui->xml, "smime_sign_key_clear"); + g_signal_connect(gui->smime_sign_key_select, "clicked", G_CALLBACK(smime_sign_key_select), gui); + g_signal_connect(gui->smime_sign_key_clear, "clicked", G_CALLBACK(smime_sign_key_clear), gui); + + gui->smime_sign_default = (GtkToggleButton *)glade_xml_get_widget (gui->xml, "smime_sign_default"); + gtk_toggle_button_set_active(gui->smime_sign_default, account->smime_sign_default); + + gui->smime_encrypt_key = (GtkEntry *)glade_xml_get_widget (gui->xml, "smime_encrypt_key"); + if (account->smime_encrypt_key) + gtk_entry_set_text(gui->smime_encrypt_key, account->smime_encrypt_key); + gui->smime_encrypt_key_select = (GtkButton *)glade_xml_get_widget (gui->xml, "smime_encrypt_key_select"); + gui->smime_encrypt_key_clear = (GtkButton *)glade_xml_get_widget (gui->xml, "smime_encrypt_key_clear"); + g_signal_connect(gui->smime_encrypt_key_select, "clicked", G_CALLBACK(smime_encrypt_key_select), gui); + g_signal_connect(gui->smime_encrypt_key_clear, "clicked", G_CALLBACK(smime_encrypt_key_clear), gui); + + gui->smime_encrypt_default = (GtkToggleButton *)glade_xml_get_widget (gui->xml, "smime_encrypt_default"); + gtk_toggle_button_set_active(gui->smime_encrypt_default, account->smime_encrypt_default); + gui->smime_encrypt_to_self = (GtkToggleButton *)glade_xml_get_widget (gui->xml, "smime_encrypt_to_self"); + gtk_toggle_button_set_active(gui->smime_encrypt_to_self, account->smime_encrypt_to_self); + smime_changed(gui); #else { /* Since we don't have NSS, hide the S/MIME config options */ @@ -1560,7 +1629,7 @@ mail_account_gui_new (EAccount *account, EMAccountPrefs *dialog) frame = glade_xml_get_widget (gui->xml, "smime_frame"); gtk_widget_destroy (frame); } -#endif /* HAVE_NSS && SMIME_SUPPORTED */ +#endif /* HAVE_NSS */ return gui; } @@ -1940,11 +2009,14 @@ mail_account_gui_save (MailAccountGui *gui) new->pgp_no_imip_sign = gtk_toggle_button_get_active (gui->pgp_no_imip_sign); new->pgp_always_trust = gtk_toggle_button_get_active (gui->pgp_always_trust); -#if defined (HAVE_NSS) && defined (SMIME_SUPPORTED) - new->smime_key = g_strdup (gtk_entry_get_text (gui->smime_key)); +#if defined (HAVE_NSS) + new->smime_sign_default = gtk_toggle_button_get_active (gui->smime_sign_default); + new->smime_sign_key = g_strdup (gtk_entry_get_text (gui->smime_sign_key)); + + new->smime_encrypt_default = gtk_toggle_button_get_active (gui->smime_encrypt_default); + new->smime_encrypt_key = g_strdup (gtk_entry_get_text (gui->smime_encrypt_key)); new->smime_encrypt_to_self = gtk_toggle_button_get_active (gui->smime_encrypt_to_self); - new->smime_always_sign = gtk_toggle_button_get_active (gui->smime_always_sign); -#endif /* HAVE_NSS && SMIME_SUPPORTED */ +#endif /* HAVE_NSS */ is_storage = provider && (provider->flags & CAMEL_PROVIDER_IS_STORAGE) && !(provider->flags & CAMEL_PROVIDER_IS_EXTERNAL); diff --git a/mail/mail-account-gui.h b/mail/mail-account-gui.h index b2fd033491..3574eddf28 100644 --- a/mail/mail-account-gui.h +++ b/mail/mail-account-gui.h @@ -108,9 +108,17 @@ typedef struct { GtkToggleButton *pgp_always_sign; GtkToggleButton *pgp_no_imip_sign; GtkToggleButton *pgp_always_trust; - GtkEntry *smime_key; + + GtkToggleButton *smime_sign_default; + GtkEntry *smime_sign_key; + GtkButton *smime_sign_key_select; + GtkButton *smime_sign_key_clear; + GtkButton *smime_sign_select; + GtkToggleButton *smime_encrypt_default; GtkToggleButton *smime_encrypt_to_self; - GtkToggleButton *smime_always_sign; + GtkEntry *smime_encrypt_key; + GtkButton *smime_encrypt_key_select; + GtkButton *smime_encrypt_key_clear; } MailAccountGui; diff --git a/mail/mail-config.glade b/mail/mail-config.glade index 884a533a4b..68fc074247 100644 --- a/mail/mail-config.glade +++ b/mail/mail-config.glade @@ -2706,144 +2706,365 @@ For example: "Work" or "Personal" 6 True - 3 - 3 + 6 + 4 False - 3 - 3 + 5 + 9 - + True - True - A_lways encrypt to myself when sending encrypted mail + Si_gning certificate: True - GTK_RELIEF_NORMAL - False - False - True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + smime_sign_key + + + 0 - 2 - 2 - 3 + 1 + 1 + 2 fill - + True True - Alwa_ys sign outgoing messages when using this account - True - GTK_RELIEF_NORMAL - False - False - True + True + True + 0 + + True + * + False - 0 + 1 2 1 2 + + + + + + + True + Encry_ption certificate: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + smime_encrypt_key + + + + + + 0 + 1 + 5 + 6 fill - + True True - http://www.verisign.com/products/class1/index.html - Get Digital ID... + True + True + 0 + + True + * + False - 2 - 3 - 1 - 2 - fill + 1 + 2 + 5 + 6 - + True True - Digital IDs... - True GTK_RELIEF_NORMAL + + + + True + 0.5 + 0.5 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-open + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Select... + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + 2 3 - 0 - 1 + 5 + 6 fill - - 3 + True - False - 3 + True + GTK_RELIEF_NORMAL - + True - _Certificate ID: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 + 0.5 0.5 - 0 - 0 - smime_key - - - 0 - False - False - - + 0 + 0 - - - True - True - True - True - 0 - - True - * - False + + + True + False + 2 + + + + True + gtk-open + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Select... + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + - - 0 - True - True - + + 2 + 3 + 1 + 2 + fill + + + + + + + True + True + gtk-clear + True + GTK_RELIEF_NORMAL + + + 3 + 4 + 1 + 2 + fill + + + + + + + True + True + gtk-clear + True + GTK_RELIEF_NORMAL + + + 3 + 4 + 5 + 6 + fill + + + + + + + True + True + A_lso encrypt to self when sending encrypted mail + True + GTK_RELIEF_NORMAL + False + False + True + 0 - 2 + 4 + 4 + 5 + fill + + + + + + + True + True + _Encrypt outgoing messages (by default) + True + GTK_RELIEF_NORMAL + False + False + True + + + 0 + 4 + 3 + 4 + fill + + + + + + + True + + + 0 + 4 + 2 + 3 + 3 + fill + fill + + + + + + True + True + Digitally _sign outgoing messages (by default) + True + GTK_RELIEF_NORMAL + False + False + True + + + 0 + 4 0 1 fill - fill + -- cgit v1.2.3