aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/importers
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/importers')
-rw-r--r--addressbook/importers/evolution-ldif-importer.c3
-rw-r--r--addressbook/importers/evolution-vcard-importer.c36
2 files changed, 29 insertions, 10 deletions
diff --git a/addressbook/importers/evolution-ldif-importer.c b/addressbook/importers/evolution-ldif-importer.c
index 4d5ddcc629..c76f0763bf 100644
--- a/addressbook/importers/evolution-ldif-importer.c
+++ b/addressbook/importers/evolution-ldif-importer.c
@@ -432,7 +432,8 @@ resolve_list_card (LDIFImporter *gci, EContact *contact)
EDestination *dest;
EVCardAttribute *attr = e_vcard_attribute_new (NULL, EVC_EMAIL);
- /* Hard-wired for default e-mail, since netscape only exports 1 email address */
+ /* Hard-wired for default e-mail, since
+ * netscape only exports 1 email address. */
dest = e_destination_new ();
e_destination_set_contact (dest, dn_contact, 0);
diff --git a/addressbook/importers/evolution-vcard-importer.c b/addressbook/importers/evolution-vcard-importer.c
index 38a4a57574..97f2551c38 100644
--- a/addressbook/importers/evolution-vcard-importer.c
+++ b/addressbook/importers/evolution-vcard-importer.c
@@ -816,6 +816,9 @@ preview_contact (EWebViewPreview *preview, EContact *contact)
field == E_CONTACT_EMAIL) {
GList *attrs, *a;
gboolean have = FALSE;
+ const gchar *pretty_name;
+
+ pretty_name = e_contact_pretty_name (field);
attrs = e_contact_get_attributes (contact, field);
for (a = attrs; a; a = a->next) {
@@ -825,35 +828,50 @@ preview_contact (EWebViewPreview *preview, EContact *contact)
if (!attr)
continue;
- for (value = e_vcard_attribute_get_values (attr); value; value = value->next) {
+ value = e_vcard_attribute_get_values (attr);
+
+ while (value != NULL) {
const gchar *str = value->data;
if (str && *str) {
e_web_view_preview_add_section (
preview, have ? NULL :
- e_contact_pretty_name (field), str);
+ pretty_name, str);
have = TRUE;
had_value = TRUE;
}
+
+ value = value->next;
}
+
e_vcard_attribute_free (attr);
}
g_list_free (attrs);
+
} else if (field == E_CONTACT_CATEGORIES) {
- gchar *value = e_contact_get (contact, field);
+ const gchar *pretty_name;
+ const gchar *value;
+
+ pretty_name = e_contact_pretty_name (field);
+ value = e_contact_get_const (contact, field);
- if (value && *value) {
- e_web_view_preview_add_section (preview, e_contact_pretty_name (field), value);
+ if (value != NULL && *value != '\0') {
+ e_web_view_preview_add_section (
+ preview, pretty_name, value);
had_value = TRUE;
}
- g_free (value);
} else {
- const gchar *value = e_contact_get_const (contact, field);
+ const gchar *pretty_name;
+ const gchar *value;
+
+ pretty_name = e_contact_pretty_name (field);
+ value = e_contact_get_const (contact, field);
- if (value && *value) {
- e_web_view_preview_add_section (preview, e_contact_pretty_name (field), value);
+ if (value != NULL && *value != '\0') {
+ e_web_view_preview_add_section (
+ preview, pretty_name, value);
had_value = TRUE;
}
}