diff options
author | Milan Crha <mcrha@redhat.com> | 2010-05-20 05:09:26 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2010-05-20 05:09:26 +0800 |
commit | 98adb40685d4a454d792b23c6ba23468b95c6216 (patch) | |
tree | b453678fb5cb4e3f9b90084e380fb22f466e974d /mail | |
parent | 0e7a51c8bb58197beb605f8cd2f87d702912d49a (diff) | |
download | gsoc2013-evolution-98adb40685d4a454d792b23c6ba23468b95c6216.tar gsoc2013-evolution-98adb40685d4a454d792b23c6ba23468b95c6216.tar.gz gsoc2013-evolution-98adb40685d4a454d792b23c6ba23468b95c6216.tar.bz2 gsoc2013-evolution-98adb40685d4a454d792b23c6ba23468b95c6216.tar.lz gsoc2013-evolution-98adb40685d4a454d792b23c6ba23468b95c6216.tar.xz gsoc2013-evolution-98adb40685d4a454d792b23c6ba23468b95c6216.tar.zst gsoc2013-evolution-98adb40685d4a454d792b23c6ba23468b95c6216.zip |
Bug #304415 - Allow change of signature hash algorithm
Diffstat (limited to 'mail')
-rw-r--r-- | mail/em-account-editor.c | 61 | ||||
-rw-r--r-- | mail/mail-config.ui | 138 |
2 files changed, 183 insertions, 16 deletions
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c index e253770562..55b7399e7f 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -2775,6 +2775,65 @@ emae_defaults_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget return w; } +static void +emae_account_hash_algo_combo_changed_cb (GtkComboBox *combobox, EMAccountEditor *emae) +{ + EAccount *account; + gpointer data; + const gchar *text = NULL; + + account = em_account_editor_get_modified_account (emae); + data = g_object_get_data (G_OBJECT (combobox), "account-item"); + + switch (gtk_combo_box_get_active (combobox)) { + case 1: text = "sha1"; + break; + case 2: text = "sha256"; + break; + case 3: + text = "sha384"; + break; + case 4: + text = "sha512"; + break; + } + + e_account_set_string (account, GPOINTER_TO_INT (data), text); +} + +static GtkComboBox * +emae_account_hash_algo_combo (EMAccountEditor *emae, const gchar *name, gint item, GtkBuilder *builder) +{ + EAccount *account; + GtkComboBox *combobox; + const gchar *text; + gint index = 0; + + account = em_account_editor_get_modified_account (emae); + combobox = GTK_COMBO_BOX (e_builder_get_widget (builder, name)); + g_return_val_if_fail (combobox != NULL, NULL); + + text = e_account_get_string (account, item); + if (text) { + if (g_ascii_strcasecmp (text, "sha1") == 0) + index = 1; + else if (g_ascii_strcasecmp (text, "sha256") == 0) + index = 2; + else if (g_ascii_strcasecmp (text, "sha384") == 0) + index = 3; + else if (g_ascii_strcasecmp (text, "sha512") == 0) + index = 4; + } + + gtk_combo_box_set_active (combobox, index); + + g_object_set_data (G_OBJECT (combobox), "account-item", GINT_TO_POINTER (item)); + g_signal_connect (combobox, "changed", G_CALLBACK (emae_account_hash_algo_combo_changed_cb), emae); + gtk_widget_set_sensitive (GTK_WIDGET (combobox), e_account_writable (account, item)); + + return combobox; +} + static GtkWidget * emae_security_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data) { @@ -2793,6 +2852,7 @@ emae_security_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget /* Security */ emae_account_entry (emae, "pgp_key", E_ACCOUNT_PGP_KEY, builder); + emae_account_hash_algo_combo (emae, "pgp_hash_algo", E_ACCOUNT_PGP_HASH_ALGORITHM, builder); emae_account_toggle (emae, "pgp_encrypt_to_self", E_ACCOUNT_PGP_ENCRYPT_TO_SELF, builder); emae_account_toggle (emae, "pgp_always_sign", E_ACCOUNT_PGP_ALWAYS_SIGN, builder); emae_account_toggle (emae, "pgp_no_imip_sign", E_ACCOUNT_PGP_NO_IMIP_SIGN, builder); @@ -2806,6 +2866,7 @@ emae_security_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget g_signal_connect (priv->smime_sign_key_select, "clicked", G_CALLBACK(smime_sign_key_select), emae); g_signal_connect (priv->smime_sign_key_clear, "clicked", G_CALLBACK(smime_sign_key_clear), emae); + emae_account_hash_algo_combo (emae, "smime_hash_algo", E_ACCOUNT_SMIME_HASH_ALGORITHM, builder); priv->smime_sign_default = emae_account_toggle (emae, "smime_sign_default", E_ACCOUNT_SMIME_SIGN_DEFAULT, builder); priv->smime_encrypt_key = emae_account_entry (emae, "smime_encrypt_key", E_ACCOUNT_SMIME_ENCRYPT_KEY, builder); diff --git a/mail/mail-config.ui b/mail/mail-config.ui index e264cfa3d6..d1489becf8 100644 --- a/mail/mail-config.ui +++ b/mail/mail-config.ui @@ -95,6 +95,29 @@ </row> </data> </object> + <object class="GtkListStore" id="hash_algo_model"> + <columns> + <!-- column-name Hash Algo Name --> + <column type="gchararray"/> + </columns> + <data> + <row> + <col id="0" translatable="yes">Default</col> + </row> + <row> + <col id="0" translatable="yes">SHA1</col> + </row> + <row> + <col id="0" translatable="yes">SHA256</col> + </row> + <row> + <col id="0" translatable="yes">SHA384</col> + </row> + <row> + <col id="0" translatable="yes">SHA512</col> + </row> + </data> + </object> <object class="GtkVBox" id="vboxIdentityBorder"> <property name="visible">True</property> <property name="border_width">12</property> @@ -2174,6 +2197,46 @@ For example: "Work" or "Personal"</property> <property name="position">0</property> </packing> </child> + <child> + <object class="GtkHBox" id="hbox4"> + <property name="visible">True</property> + <property name="spacing">12</property> + <child> + <object class="GtkLabel" id="pgp_hash_algo_label"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Si_gning algorithm:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">pgp_hash_algo</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="pgp_hash_algo"> + <property name="visible">True</property> + <property name="model">hash_algo_model</property> + <child> + <object class="GtkCellRendererText" id="pgp_hash_algo_renderer"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> <child> <object class="GtkCheckButton" id="pgp_always_sign"> <property name="label" translatable="yes">Al_ways sign outgoing messages when using this account</property> @@ -2186,7 +2249,7 @@ For example: "Work" or "Personal"</property> <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="position">1</property> + <property name="position">2</property> </packing> </child> <child> @@ -2202,7 +2265,7 @@ For example: "Work" or "Personal"</property> <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="position">2</property> + <property name="position">3</property> </packing> </child> <child> @@ -2217,7 +2280,7 @@ For example: "Work" or "Personal"</property> <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="position">3</property> + <property name="position">4</property> </packing> </child> </object> @@ -2276,7 +2339,7 @@ For example: "Work" or "Personal"</property> <child> <object class="GtkTable" id="smime_table"> <property name="visible">True</property> - <property name="n_rows">6</property> + <property name="n_rows">7</property> <property name="n_columns">3</property> <property name="column_spacing">12</property> <property name="row_spacing">6</property> @@ -2301,8 +2364,8 @@ For example: "Work" or "Personal"</property> <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="top_attach">6</property> + <property name="bottom_attach">7</property> <property name="y_options"></property> </packing> </child> @@ -2317,8 +2380,8 @@ For example: "Work" or "Personal"</property> </object> <packing> <property name="right_attach">3</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> + <property name="top_attach">5</property> + <property name="bottom_attach">6</property> <property name="x_options">GTK_FILL</property> <property name="y_options"></property> </packing> @@ -2334,8 +2397,8 @@ For example: "Work" or "Personal"</property> </object> <packing> <property name="right_attach">3</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> <property name="x_options">GTK_FILL</property> <property name="y_options"></property> </packing> @@ -2361,8 +2424,8 @@ For example: "Work" or "Personal"</property> </object> <packing> <property name="right_attach">3</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> <property name="x_options">GTK_FILL</property> <property name="y_options">GTK_FILL</property> <property name="y_padding">6</property> @@ -2377,8 +2440,8 @@ For example: "Work" or "Personal"</property> <property name="mnemonic_widget">smime_encrypt_key</property> </object> <packing> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> + <property name="top_attach">6</property> + <property name="bottom_attach">7</property> <property name="x_options">GTK_FILL</property> <property name="y_options"></property> </packing> @@ -2502,8 +2565,8 @@ For example: "Work" or "Personal"</property> <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="top_attach">6</property> + <property name="bottom_attach">7</property> <property name="x_options">GTK_FILL</property> <property name="y_options">GTK_FILL</property> </packing> @@ -2618,6 +2681,49 @@ For example: "Work" or "Personal"</property> <property name="y_options">GTK_FILL</property> </packing> </child> + <child> + <object class="GtkLabel" id="smime_hash_algo_label"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Signing _algorithm:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">smime_hash_algo</property> + </object> + <packing> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + </packing> + </child> + <child> + <object class="GtkAlignment" id="smime_hash_algo_alignment"> + <property name="visible">True</property> + <property name="left_padding">0</property> + <property name="xalign">0.0</property> + <property name="xscale">0.0</property> + <child> + <object class="GtkComboBox" id="smime_hash_algo"> + <property name="visible">True</property> + <property name="model">hash_algo_model</property> + <child> + <object class="GtkCellRendererText" id="smime_hash_algo_renderer"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> + </child> + </object> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">GTK_FILL</property> + <property name="y_options"></property> + </packing> + </child> </object> <packing> <property name="position">1</property> |