[evolution] Consider full name and also the first part of e-mail address for contact description in the import d



commit 71c0e4e0c2d5d8dfc8ab97650256c11108ffacba
Author: Fridrich Å trba <fridrich strba bluewin ch>
Date:   Thu May 20 14:24:06 2010 +0200

    Consider full name and also the first part of e-mail address for
    contact description in the import dialogue.

 addressbook/importers/evolution-vcard-importer.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/addressbook/importers/evolution-vcard-importer.c b/addressbook/importers/evolution-vcard-importer.c
index 49e7bef..59aba91 100644
--- a/addressbook/importers/evolution-vcard-importer.c
+++ b/addressbook/importers/evolution-vcard-importer.c
@@ -868,6 +868,7 @@ evolution_contact_importer_get_preview_widget (const GList *contacts)
 
 	for (c = contacts; c; c = c->next) {
 		const gchar *description;
+		gchar *free_description = NULL;
 		EContact *contact = (EContact *) c->data;
 
 		if (!contact || !E_IS_CONTACT (contact))
@@ -876,12 +877,26 @@ evolution_contact_importer_get_preview_widget (const GList *contacts)
 		description = e_contact_get_const (contact, E_CONTACT_FILE_AS);
 		if (!description)
 			description = e_contact_get_const (contact, E_CONTACT_UID);
+		if (!description)
+			description = e_contact_get_const (contact, E_CONTACT_FULL_NAME);
+		if (!description) {
+			description = e_contact_get_const (contact, E_CONTACT_EMAIL_1);
+			if (description) {
+				const gchar *at = strchr (description, '@');
+				if (at) {
+					free_description = g_strndup (description, (gsize)(at - description));
+					description = free_description;
+				}
+			}
+		}
 
 		gtk_list_store_append (store, &iter);
 		gtk_list_store_set (store, &iter,
 			0, description ? description : "",
 			1, contact,
 			-1 );
+
+		g_free (free_description);
 	}
 
 	if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter)) {



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