Rearranged smime config slightly, and added encrypt key preference.

2003-10-31  Not Zed  <NotZed@Ximian.com>

        * 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
This commit is contained in:
Not Zed
2003-10-31 04:56:46 +00:00
committed by Michael Zucci
parent 19a21a87e4
commit bb9da6fb0c
4 changed files with 431 additions and 118 deletions

View File

@ -1,3 +1,15 @@
2003-10-31 Not Zed <NotZed@Ximian.com>
* 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 <NotZed@Ximian.com>
* em-format.c (em_format_is_inline): show application/x-pkcs7-mime

View File

@ -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);

View File

@ -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;

View File

@ -2706,17 +2706,295 @@ For example: &quot;Work&quot; or &quot;Personal&quot;</property>
<widget class="GtkTable" id="smime_table">
<property name="border_width">6</property>
<property name="visible">True</property>
<property name="n_rows">3</property>
<property name="n_columns">3</property>
<property name="n_rows">6</property>
<property name="n_columns">4</property>
<property name="homogeneous">False</property>
<property name="row_spacing">3</property>
<property name="column_spacing">3</property>
<property name="row_spacing">5</property>
<property name="column_spacing">9</property>
<child>
<widget class="GtkLabel" id="label469">
<property name="visible">True</property>
<property name="label" translatable="yes">Si_gning certificate:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">smime_sign_key</property>
<accessibility>
<atkrelation target="smime_sign_key" type="label-for"/>
</accessibility>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="smime_sign_key">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label470">
<property name="visible">True</property>
<property name="label" translatable="yes">Encry_ption certificate:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">smime_encrypt_key</property>
<accessibility>
<atkrelation target="smime_encrypt_key" type="label-for"/>
</accessibility>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="smime_encrypt_key">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="smime_encrypt_key_select">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<child>
<widget class="GtkAlignment" id="alignment28">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<widget class="GtkHBox" id="hbox175">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image3">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="button98">
<property name="visible">True</property>
<property name="label" translatable="yes">_Select...</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="smime_sign_key_select">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<child>
<widget class="GtkAlignment" id="alignment29">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<widget class="GtkHBox" id="hbox176">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image4">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label472">
<property name="visible">True</property>
<property name="label" translatable="yes">_Select...</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="smime_sign_key_clear">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-clear</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="smime_encrypt_key_clear">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-clear</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="smime_encrypt_to_self">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">A_lways encrypt to myself when sending encrypted mail</property>
<property name="label" translatable="yes">A_lso encrypt to self when sending encrypted mail</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">False</property>
@ -2725,19 +3003,55 @@ For example: &quot;Work&quot; or &quot;Personal&quot;</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">2</property>
<property name="right_attach">4</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="smime_encrypt_default">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Encrypt outgoing messages (by default)</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">4</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkHSeparator" id="hseparator3">
<property name="visible">True</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">4</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_padding">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="smime_always_sign">
<widget class="GtkCheckButton" id="smime_sign_default">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Alwa_ys sign outgoing messages when using this account</property>
<property name="label" translatable="yes">Digitally _sign outgoing messages (by default)</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">False</property>
@ -2746,106 +3060,13 @@ For example: &quot;Work&quot; or &quot;Personal&quot;</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GnomeHRef" id="get_digital_id">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="url">http://www.verisign.com/products/class1/index.html</property>
<property name="label" translatable="yes">Get Digital ID...</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="digital_ids">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Digital IDs...</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox64">
<property name="border_width">3</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">3</property>
<child>
<widget class="GtkLabel" id="smime_key_label">
<property name="visible">True</property>
<property name="label" translatable="yes">_Certificate ID:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">smime_key</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="smime_key">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
</widget>
</child>