From 71c0e4e0c2d5d8dfc8ab97650256c11108ffacba Mon Sep 17 00:00:00 2001 From: Fridrich Štrba Date: Thu, 20 May 2010 14:24:06 +0200 Subject: 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 file changed, 15 insertions(+) (limited to 'addressbook/importers') diff --git a/addressbook/importers/evolution-vcard-importer.c b/addressbook/importers/evolution-vcard-importer.c index 49e7bef70b..59aba913d2 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)) { -- cgit