diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-08-16 13:06:47 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-08-16 13:08:36 +0800 |
commit | 582ba50c50e4f6250e82363ff7c9bffcff67fd3c (patch) | |
tree | 459e6ef61ff6e4e573ec72bd9816f38573abd853 | |
parent | e68fb2bd5d5a400f8af7a46f0da356b9c6cd78c6 (diff) | |
download | gsoc2013-evolution-582ba50c50e4f6250e82363ff7c9bffcff67fd3c.tar.gz gsoc2013-evolution-582ba50c50e4f6250e82363ff7c9bffcff67fd3c.tar.zst gsoc2013-evolution-582ba50c50e4f6250e82363ff7c9bffcff67fd3c.zip |
Bug 681882 - Account signature not selected in new composer window
-rw-r--r-- | widgets/misc/e-mail-signature-combo-box.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/widgets/misc/e-mail-signature-combo-box.c b/widgets/misc/e-mail-signature-combo-box.c index 26f87b95eb..275c2538b9 100644 --- a/widgets/misc/e-mail-signature-combo-box.c +++ b/widgets/misc/e-mail-signature-combo-box.c @@ -81,6 +81,49 @@ mail_signature_combo_box_registry_changed (ESourceRegistry *registry, combo_box); } +static gboolean +mail_signature_combo_box_identity_to_signature (GBinding *binding, + const GValue *source_value, + GValue *target_value, + gpointer user_data) +{ + EMailSignatureComboBox *combo_box; + ESourceRegistry *registry; + GObject *source_object; + ESource *source; + ESourceMailIdentity *extension; + const gchar *identity_uid; + const gchar *signature_uid = "none"; + const gchar *extension_name; + + /* Source and target are the same object. */ + source_object = g_binding_get_source (binding); + combo_box = E_MAIL_SIGNATURE_COMBO_BOX (source_object); + registry = e_mail_signature_combo_box_get_registry (combo_box); + + identity_uid = g_value_get_string (source_value); + if (identity_uid == NULL) + return FALSE; + + source = e_source_registry_ref_source (registry, identity_uid); + if (source == NULL) + return FALSE; + + extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY; + if (!e_source_has_extension (source, extension_name)) { + g_object_unref (source); + return FALSE; + } + + extension = e_source_get_extension (source, extension_name); + signature_uid = e_source_mail_identity_get_signature_uid (extension); + g_value_set_string (target_value, signature_uid); + + g_object_unref (source); + + return TRUE; +} + static void mail_signature_combo_box_set_registry (EMailSignatureComboBox *combo_box, ESourceRegistry *registry) @@ -218,6 +261,14 @@ mail_signature_combo_box_constructed (GObject *object) gtk_cell_layout_add_attribute ( cell_layout, cell_renderer, "text", COLUMN_DISPLAY_NAME); + g_object_bind_property_full ( + combo_box, "identity-uid", + combo_box, "active-id", + G_BINDING_DEFAULT, + mail_signature_combo_box_identity_to_signature, + NULL, + NULL, (GDestroyNotify) NULL); + e_mail_signature_combo_box_refresh ( E_MAIL_SIGNATURE_COMBO_BOX (object)); } |