From e18f1b87095c60977c4c0e0a279e7ee78a049dc6 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 5 Sep 2012 16:43:58 +0200 Subject: Composer could start with empty From --- composer/e-composer-from-header.c | 39 ++++++++++++++++++++++++++++++++++++++- composer/e-msg-composer.c | 9 +++++++-- 2 files changed, 45 insertions(+), 3 deletions(-) (limited to 'composer') diff --git a/composer/e-composer-from-header.c b/composer/e-composer-from-header.c index a844ca3d6a..ceecd68b87 100644 --- a/composer/e-composer-from-header.c +++ b/composer/e-composer-from-header.c @@ -107,7 +107,44 @@ e_composer_from_header_set_active_id (EComposerFromHeader *header, g_return_if_fail (E_IS_COMPOSER_FROM_HEADER (header)); + if (!active_id) + return; + combo_box = GTK_COMBO_BOX (E_COMPOSER_HEADER (header)->input_widget); - gtk_combo_box_set_active_id (combo_box, active_id); + if (!gtk_combo_box_set_active_id (combo_box, active_id) && active_id && *active_id) { + ESourceRegistry *registry; + GtkTreeModel *model; + GtkTreeIter iter; + gint id_column; + + registry = e_composer_header_get_registry (E_COMPOSER_HEADER (header)); + id_column = gtk_combo_box_get_id_column (combo_box); + model = gtk_combo_box_get_model (combo_box); + + if (gtk_tree_model_get_iter_first (model, &iter)) { + do { + gchar *identity_uid = NULL; + + gtk_tree_model_get (model, &iter, id_column, &identity_uid, -1); + + if (identity_uid) { + ESource *source; + + source = e_source_registry_ref_source (registry, identity_uid); + if (source) { + if (g_strcmp0 (e_source_get_parent (source), active_id) == 0) { + g_object_unref (source); + gtk_combo_box_set_active_id (combo_box, identity_uid); + g_free (identity_uid); + break; + } + g_object_unref (source); + } + + g_free (identity_uid); + } + } while (gtk_tree_model_iter_next (model, &iter)); + } + } } diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 0fc5f2f475..777b7e7423 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -575,8 +575,8 @@ build_message_headers (EMsgComposer *composer, camel_mime_message_set_from (message, addr); g_object_unref (addr); - /* X-Evolution-Account */ - header_name = "X-Evolution-Account"; + /* X-Evolution-Identity */ + header_name = "X-Evolution-Identity"; camel_medium_set_header (medium, header_name, uid); /* X-Evolution-Fcc */ @@ -3108,6 +3108,11 @@ e_msg_composer_new_with_message (EShell *shell, /* Restore the mail identity preference. */ identity_uid = (gchar *) camel_medium_get_header ( CAMEL_MEDIUM (message), "X-Evolution-Identity"); + if (!identity_uid) { + /* for backward compatibility */ + identity_uid = (gchar *) camel_medium_get_header ( + CAMEL_MEDIUM (message), "X-Evolution-Account"); + } if (identity_uid != NULL) { identity_uid = g_strstrip (g_strdup (identity_uid)); source = e_source_registry_ref_source (registry, identity_uid); -- cgit