[evolution-couchdb] Depend on couchdb-glib >= 0.4.4



commit 66d6635ec7d67739ebabbe7a52af805145f7e052
Author: Rodrigo Moya <rodrigo gnome-db org>
Date:   Wed Aug 19 19:03:34 2009 +0200

    Depend on couchdb-glib >= 0.4.4
    Add support for application_annotations field
    Use couchdb_document_contact_new for creating contact documents

 addressbook/e-book-backend-couchdb.c |   32 +++++++++++++++++++++++++++++---
 configure.ac                         |    2 +-
 2 files changed, 30 insertions(+), 4 deletions(-)
---
diff --git a/addressbook/e-book-backend-couchdb.c b/addressbook/e-book-backend-couchdb.c
index bc73a0f..9b5a4b1 100644
--- a/addressbook/e-book-backend-couchdb.c
+++ b/addressbook/e-book-backend-couchdb.c
@@ -25,8 +25,9 @@
 #include <libedata-book/e-data-book-view.h>
 #include <dbus/dbus-glib.h>
 
-#define COUCHDB_REVISION_PROP "X-COUCHDB-REVISION"
-#define COUCHDB_UUID_PROP     "X-COUCHDB-UUID"
+#define COUCHDB_REVISION_PROP                "X-COUCHDB-REVISION"
+#define COUCHDB_UUID_PROP                    "X-COUCHDB-UUID"
+#define COUCHDB_APPLICATION_ANNOTATIONS_PROP "X-COUCHDB-APPLICATION-ANNOTATIONS"
 
 G_DEFINE_TYPE (EBookBackendCouchDB, e_book_backend_couchdb, E_TYPE_BOOK_BACKEND);
 
@@ -258,6 +259,19 @@ vcard_from_couch_document (CouchDBDocument *document)
 		}
 	}
 
+	/* application annotations */
+	if (couchdb_document_has_field (document, "application_annotations")) {
+		CouchDBStructField *annotations = couchdb_document_get_application_annotations (document);
+
+		str = couchdb_struct_field_to_string (annotations);
+		e_vcard_add_attribute_with_value (E_VCARD (contact),
+						  e_vcard_attribute_new (NULL, COUCHDB_APPLICATION_ANNOTATIONS_PROP),
+						  str);
+
+		g_free (str);
+		couchdb_struct_field_unref (annotations);
+	}
+
 	/* convert the contact to a VCARD string to be returned */
 	str = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
 
@@ -389,7 +403,7 @@ couch_document_from_contact (EBookBackendCouchDB *couchdb_backend, EContact *con
 	const EContactAddress *contact_address;
 
 	/* create the CouchDBDocument to put on the database */
-	document = couchdb_document_new (couchdb_backend->couchdb);
+	document = couchdb_document_contact_new (couchdb_backend->couchdb);
 
 	str = e_contact_get_const (contact, E_CONTACT_UID);
 	if (str)
@@ -505,6 +519,18 @@ couch_document_from_contact (EBookBackendCouchDB *couchdb_backend, EContact *con
 		g_free (dt_str);
 	}
 
+	/* application annotations */
+	str = e_vcard_attribute_get_value (e_vcard_get_attribute (E_VCARD (contact), COUCHDB_APPLICATION_ANNOTATIONS_PROP));
+	if (str) {
+		CouchDBStructField *annotations;
+
+		annotations = couchdb_struct_field_new_from_string (str);
+		if (annotations) {
+			couchdb_document_set_application_annotations (document, annotations);
+			couchdb_struct_field_unref (annotations);
+		}
+	}
+
 	return document;
 }
 
diff --git a/configure.ac b/configure.ac
index 7fc268d..3c3cf46 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.4.3 libebook-1.2 libedata-book-1.2 dbus-glib-1)
+PKG_CHECK_MODULES(EVOLUTION, glib-2.0 couchdb-glib-1.0 >= 0.4.4 libebook-1.2 libedata-book-1.2 dbus-glib-1)
 AC_SUBST(EVOLUTION_CFLAGS)
 AC_SUBST(EVOLUTION_LIBS)
 



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