aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/importers/evolution-vcard-importer.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-05-21 22:02:58 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-06-30 00:42:17 +0800
commit5146ff4c535f443fe25290eb96631e91ad44c8ef (patch)
treeb8cc31419c1f297092e13eedd9a5877f4c106eda /addressbook/importers/evolution-vcard-importer.c
parentea8a59a443f861af88ddb21d5dcbde1c95006203 (diff)
downloadgsoc2013-evolution-5146ff4c535f443fe25290eb96631e91ad44c8ef.tar
gsoc2013-evolution-5146ff4c535f443fe25290eb96631e91ad44c8ef.tar.gz
gsoc2013-evolution-5146ff4c535f443fe25290eb96631e91ad44c8ef.tar.bz2
gsoc2013-evolution-5146ff4c535f443fe25290eb96631e91ad44c8ef.tar.lz
gsoc2013-evolution-5146ff4c535f443fe25290eb96631e91ad44c8ef.tar.xz
gsoc2013-evolution-5146ff4c535f443fe25290eb96631e91ad44c8ef.tar.zst
gsoc2013-evolution-5146ff4c535f443fe25290eb96631e91ad44c8ef.zip
Coding style and whitespace cleanup.
Diffstat (limited to 'addressbook/importers/evolution-vcard-importer.c')
-rw-r--r--addressbook/importers/evolution-vcard-importer.c36
1 files changed, 27 insertions, 9 deletions
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;
}
}