diff options
author | Milan Crha <mcrha@redhat.com> | 2012-09-05 22:43:58 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2012-09-05 22:43:58 +0800 |
commit | e18f1b87095c60977c4c0e0a279e7ee78a049dc6 (patch) | |
tree | e3f16f2372966ae6081c3159f0caf8cd8835fda6 /composer/e-composer-from-header.c | |
parent | 511acab89a83114aad35e9c6f76a8f284907dab9 (diff) | |
download | gsoc2013-evolution-e18f1b87095c60977c4c0e0a279e7ee78a049dc6.tar.gz gsoc2013-evolution-e18f1b87095c60977c4c0e0a279e7ee78a049dc6.tar.zst gsoc2013-evolution-e18f1b87095c60977c4c0e0a279e7ee78a049dc6.zip |
Composer could start with empty From
Diffstat (limited to 'composer/e-composer-from-header.c')
-rw-r--r-- | composer/e-composer-from-header.c | 39 |
1 files changed, 38 insertions, 1 deletions
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)); + } + } } |