aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/importers
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-05-21 22:02:58 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-05-22 05:56:06 +0800
commitcb97c2dc8fd97b381af048f206333d5e557892ae (patch)
treec2901380e607a3b439abb1bed165344ba8f4fc83 /addressbook/importers
parent64fa8ad9c0851e2d5c1e90ac2e75af8d455d9fea (diff)
downloadgsoc2013-evolution-cb97c2dc8fd97b381af048f206333d5e557892ae.tar
gsoc2013-evolution-cb97c2dc8fd97b381af048f206333d5e557892ae.tar.gz
gsoc2013-evolution-cb97c2dc8fd97b381af048f206333d5e557892ae.tar.bz2
gsoc2013-evolution-cb97c2dc8fd97b381af048f206333d5e557892ae.tar.lz
gsoc2013-evolution-cb97c2dc8fd97b381af048f206333d5e557892ae.tar.xz
gsoc2013-evolution-cb97c2dc8fd97b381af048f206333d5e557892ae.tar.zst
gsoc2013-evolution-cb97c2dc8fd97b381af048f206333d5e557892ae.zip
Coding style and whitespace cleanup.
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;
}
}