[evolution/webkit] Bug #653644 - Warning when adding plain address into a contact list



commit 46aee556732e24be24ff0536ce45608d7422d3cb
Author: Dan VrÃtil <dvratil redhat com>
Date:   Wed Jun 29 20:53:42 2011 +0200

    Bug #653644 - Warning when adding plain address into a contact list

 .../contact-list-editor/e-contact-list-editor.c    |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 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 a0de8a5..41c9f27 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -191,7 +191,6 @@ contact_list_editor_add_destination (GtkWidget *widget,
 {
 	EContactListEditor *editor = contact_list_editor_extract (widget);
 	EContactListModel *model = E_CONTACT_LIST_MODEL (editor->priv->model);
-	EDestinationStore *dest_store;
 	GtkTreeView *treeview = GTK_TREE_VIEW (WIDGET (TREE_VIEW));
 	GtkTreePath *path;
 	gboolean ignore_conflicts = TRUE;
@@ -244,9 +243,6 @@ contact_list_editor_add_destination (GtkWidget *widget,
 		gtk_tree_view_expand_to_path (treeview, path);
 		gtk_tree_path_free (path);
 
-		dest_store = e_name_selector_entry_peek_destination_store (E_NAME_SELECTOR_ENTRY (WIDGET (EMAIL_ENTRY)));
-		e_destination_store_remove_destination (dest_store, dest);
-
 		return TRUE;
 	}
 
@@ -257,10 +253,21 @@ static void
 contact_list_editor_add_email (EContactListEditor *editor,
 			       const gchar *email)
 {
+	CamelInternetAddress *addr;
 	EContactListEditorPrivate *priv = editor->priv;
-
 	EDestination *dest = e_destination_new ();
-	e_destination_set_email (dest, email);
+
+	addr = camel_internet_address_new ();
+	if (camel_address_unformat (CAMEL_ADDRESS (addr), email) == 1) {
+		const gchar *name, *mail;
+		camel_internet_address_get (addr, 0, &name, &mail);
+		e_destination_set_email (dest, mail);
+		e_destination_set_name (dest, name);
+	} else {
+		e_destination_set_email (dest, email);
+	}
+	g_object_unref (addr);
+
 	priv->changed = contact_list_editor_add_destination (WIDGET (DIALOG), dest) || priv->changed;
 
 	contact_list_editor_update (editor);
@@ -872,6 +879,7 @@ contact_list_editor_select_button_clicked_cb (GtkWidget *widget)
 		EDestination *destination = iter->data;
 
 		contact_list_editor_add_destination (widget, destination);
+		e_destination_store_remove_destination (store, destination);
 	}
 
 	g_list_free (list);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]