[evolution-data-server] Bug 655833 — Mailing addresses for Google Contacts not saving if PO Box…
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Bug 655833 — Mailing addresses for Google Contacts not saving if PO Box…
- Date: Tue, 16 Aug 2011 23:52:36 +0000 (UTC)
commit 794ff7ce1031b41d26aa69dc1bb6095ede2ffe8b
Author: Philip Withnall <philip tecnocode co uk>
Date: Tue Aug 16 23:26:28 2011 +0100
Bug 655833 â Mailing addresses for Google Contacts not saving if PO Boxâ
Fix editing postal addresses of contacts where the PO box field is not
filled in.
Closes: bgo#655833
.../backends/google/e-book-backend-google.c | 23 +++++++++++++------
1 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/addressbook/backends/google/e-book-backend-google.c b/addressbook/backends/google/e-book-backend-google.c
index ac4a05a..1261b17 100644
--- a/addressbook/backends/google/e-book-backend-google.c
+++ b/addressbook/backends/google/e-book-backend-google.c
@@ -3593,7 +3593,7 @@ gdata_gd_postal_address_from_attribute (EVCardAttribute *attr, gboolean *have_pr
GList *values;
values = e_vcard_attribute_get_values (attr);
- if (values && values->data && *((gchar *) values->data) != '\0') {
+ if (values && values->data) {
GList *types, *value;
gchar *rel;
const gchar *label;
@@ -3609,12 +3609,6 @@ gdata_gd_postal_address_from_attribute (EVCardAttribute *attr, gboolean *have_pr
address = gdata_gd_postal_address_new (rel, label, primary);
g_free (rel);
- __debug__ ("New %spostal address entry %s (%s/%s)",
- gdata_gd_postal_address_is_primary (address) ? "primary " : "",
- gdata_gd_postal_address_get_address (address),
- gdata_gd_postal_address_get_relation_type (address),
- gdata_gd_postal_address_get_label (address));
-
/* Set the components of the address from the vCard's attribute values */
value = values;
gdata_gd_postal_address_set_po_box (address, (*((gchar *) value->data) != '\0') ? value->data : NULL);
@@ -3642,6 +3636,21 @@ gdata_gd_postal_address_from_attribute (EVCardAttribute *attr, gboolean *have_pr
if (!value)
return address;
gdata_gd_postal_address_set_country (address, (*((gchar *) value->data) != '\0') ? value->data : NULL, NULL);
+
+ /* Throw it away if nothing was set */
+ if (gdata_gd_postal_address_get_po_box (address) == NULL && gdata_gd_postal_address_get_house_name (address) == NULL &&
+ gdata_gd_postal_address_get_street (address) == NULL && gdata_gd_postal_address_get_city (address) == NULL &&
+ gdata_gd_postal_address_get_region (address) == NULL && gdata_gd_postal_address_get_postcode (address) == NULL &&
+ gdata_gd_postal_address_get_country (address) == NULL) {
+ g_object_unref (address);
+ return NULL;
+ }
+
+ __debug__ ("New %spostal address entry %s (%s/%s)",
+ gdata_gd_postal_address_is_primary (address) ? "primary " : "",
+ gdata_gd_postal_address_get_address (address),
+ gdata_gd_postal_address_get_relation_type (address),
+ gdata_gd_postal_address_get_label (address));
}
return address;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]