[evolution-couchdb] Use get/set_ext_street couchdb-glib API instead of splitting/joining multiline streets



commit e4587ace620b5a95ab75ec3c045ad4265950d8d1
Author: Rodrigo Moya <rodrigo gnome-db org>
Date:   Mon May 3 10:12:09 2010 +0200

    Use get/set_ext_street couchdb-glib API instead of splitting/joining multiline streets

 addressbook/e-book-backend-couchdb.c |   35 +++++++++------------------------
 configure.ac                         |    2 +-
 2 files changed, 11 insertions(+), 26 deletions(-)
---
diff --git a/addressbook/e-book-backend-couchdb.c b/addressbook/e-book-backend-couchdb.c
index dd759ac..8321fb5 100644
--- a/addressbook/e-book-backend-couchdb.c
+++ b/addressbook/e-book-backend-couchdb.c
@@ -283,7 +283,6 @@ contact_from_couch_document (CouchdbDocument *document)
 	/* parse postal addresses */
 	list = desktopcouch_document_contact_get_addresses (document);
 	while (list != NULL) {
-		char **street_lines;
 		const char *description_str;
 		EContactAddress *contact_address;
 		CouchdbStructField *address = (CouchdbStructField *) list->data;
@@ -291,15 +290,8 @@ contact_from_couch_document (CouchdbDocument *document)
 		contact_address = g_new0 (EContactAddress, 1);
 		contact_address->address_format = g_strdup ("");
 
-		street_lines = g_strsplit (desktopcouch_document_contact_address_get_street (address), "\n", 2);
-		if (street_lines != NULL) {
-			contact_address->street = g_strdup (street_lines[0]);
-			if (street_lines[1] != NULL)
-				contact_address->ext = g_strdup (street_lines[1]);
-			g_strfreev (street_lines);
-		} else
-			contact_address->street = g_strdup (desktopcouch_document_contact_address_get_street (address));
-
+		contact_address->street = g_strdup (desktopcouch_document_contact_address_get_street (address));
+		contact_address->ext = g_strdup (desktopcouch_document_contact_address_get_ext_street (address));
 		contact_address->locality = g_strdup (desktopcouch_document_contact_address_get_city (address));
 		contact_address->region = g_strdup (desktopcouch_document_contact_address_get_state (address));
 		contact_address->country = g_strdup (desktopcouch_document_contact_address_get_country (address));
@@ -602,24 +594,17 @@ contact_postal_address_to_struct_field (EContact *contact, EContactField field,
 
 	contact_address = e_contact_get (contact, field);
 	if (contact_address) {
-		char *street = NULL;
-
-		if (contact_address->ext && *contact_address->ext)
-			street = g_strdup_printf ("%s\n%s", contact_address->street, contact_address->ext);
-		else if (contact_address->street && *contact_address->street)
-			street = g_strdup (contact_address->street);
-
 		sf = desktopcouch_document_contact_address_new (/* FIXME */ NULL,
-							   street,
-							   contact_address->locality,
-							   contact_address->region,
-							   contact_address->country,
-							   contact_address->code,
-							   contact_address->po,
-							   description);
+								contact_address->street,
+								contact_address->ext,
+								contact_address->locality,
+								contact_address->region,
+								contact_address->country,
+								contact_address->code,
+								contact_address->po,
+								description);
 		
 		e_contact_address_free (contact_address);
-		g_free (street);
 	}
 
 	return sf;
diff --git a/configure.ac b/configure.ac
index 3663144..0401173 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,7 +34,7 @@ localedir='$(prefix)/$(DATADIRNAME)/locale'
 AC_SUBST(localedir)
 
 dnl Check for dependencies
-PKG_CHECK_MODULES(EVOLUTION, glib-2.0 couchdb-glib-1.0 >= 0.6.3 desktopcouch-glib-1.0 >= 0.6.3 libebook-1.2 libedata-book-1.2 dbus-glib-1 gnome-keyring-1)
+PKG_CHECK_MODULES(EVOLUTION, glib-2.0 couchdb-glib-1.0 >= 0.6.90 desktopcouch-glib-1.0 >= 0.6.90 libebook-1.2 libedata-book-1.2 dbus-glib-1 gnome-keyring-1)
 AC_SUBST(EVOLUTION_CFLAGS)
 AC_SUBST(EVOLUTION_LIBS)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]