aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2013-01-11 18:00:05 +0800
committerMilan Crha <mcrha@redhat.com>2013-01-11 18:00:05 +0800
commit9ac0364b4ceab80d3623b0fd99dc18729f36a321 (patch)
tree5871ba4b7ceea94d827b0b175d450e77b6e81f6a /addressbook
parent9d1867b99b5a693b364d04e3302224e672111092 (diff)
downloadgsoc2013-evolution-9ac0364b4ceab80d3623b0fd99dc18729f36a321.tar.gz
gsoc2013-evolution-9ac0364b4ceab80d3623b0fd99dc18729f36a321.tar.zst
gsoc2013-evolution-9ac0364b4ceab80d3623b0fd99dc18729f36a321.zip
Bug #691134 - Only autocompleted name is added to a contact list
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
index f722210caf..f68470d103 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -493,6 +493,36 @@ contact_list_editor_selection_changed_cb (GtkTreeSelection *selection,
gtk_tree_path_free (first_item);
}
+static void
+contact_list_editor_add_from_email_entry (EContactListEditor *editor,
+ ENameSelectorEntry *entry)
+{
+ EDestinationStore *store;
+ GList *dests, *diter;
+ gboolean added = FALSE;
+
+ g_return_if_fail (E_IS_CONTACT_LIST_EDITOR (editor));
+ g_return_if_fail (E_IS_NAME_SELECTOR_ENTRY (entry));
+
+ store = e_name_selector_entry_peek_destination_store (entry);
+ dests = e_destination_store_list_destinations (store);
+
+ for (diter = dests; diter; diter = g_list_next (diter)) {
+ EDestination *dest = diter->data;
+
+ if (dest && e_destination_get_address (dest)) {
+ editor->priv->changed = contact_list_editor_add_destination (WIDGET (DIALOG), dest)
+ || editor->priv->changed;
+ added = TRUE;
+ }
+ }
+
+ g_list_free (dests);
+
+ if (!added)
+ contact_list_editor_add_email (editor, gtk_entry_get_text (GTK_ENTRY (entry)));
+}
+
/*********************** Autoconnected Signal Handlers ***********************/
void
@@ -505,9 +535,9 @@ contact_list_editor_add_button_clicked_cb (GtkWidget *widget)
editor = contact_list_editor_extract (widget);
- contact_list_editor_add_email (
+ contact_list_editor_add_from_email_entry (
editor,
- gtk_entry_get_text (GTK_ENTRY (WIDGET (EMAIL_ENTRY))));
+ E_NAME_SELECTOR_ENTRY (WIDGET (EMAIL_ENTRY)));
gtk_entry_set_text (GTK_ENTRY (WIDGET (EMAIL_ENTRY)), "");
}
@@ -678,7 +708,9 @@ contact_list_editor_email_entry_activate_cb (GtkWidget *widget)
editor = contact_list_editor_extract (widget);
entry = GTK_ENTRY (WIDGET (EMAIL_ENTRY));
- contact_list_editor_add_email (editor, gtk_entry_get_text (entry));
+ contact_list_editor_add_from_email_entry (
+ editor,
+ E_NAME_SELECTOR_ENTRY (entry));
gtk_entry_set_text (entry, "");
}