Merge lp:~rodrigo-moya/evolution-couchdb/application-annotations-support into lp:evolution-couchdb

Proposed by Rodrigo Moya
Status: Merged
Approved by: Eric Casteleijn
Approved revision: 56
Merge reported by: Rodrigo Moya
Merged at revision: not available
Proposed branch: lp:~rodrigo-moya/evolution-couchdb/application-annotations-support
Merge into: lp:evolution-couchdb
Diff against target: None lines
To merge this branch: bzr merge lp:~rodrigo-moya/evolution-couchdb/application-annotations-support
Reviewer Review Type Date Requested Status
Elliot Murphy (community) Approve
Eric Casteleijn (community) Approve
Review via email: mp+10375@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Rodrigo Moya (rodrigo-moya) wrote :

Depend on couchdb-glib >= 0.4.4
Add support for application_annotations field

Revision history for this message
Eric Casteleijn (thisfred) wrote :

Code looks like it's doing the right things, but then my C sucks... :)

review: Approve
Revision history for this message
Elliot Murphy (statik) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addressbook/e-book-backend-couchdb.c'
2--- addressbook/e-book-backend-couchdb.c 2009-08-17 22:30:09 +0000
3+++ addressbook/e-book-backend-couchdb.c 2009-08-19 11:38:13 +0000
4@@ -25,8 +25,9 @@
5 #include <libedata-book/e-data-book-view.h>
6 #include <dbus/dbus-glib.h>
7
8-#define COUCHDB_REVISION_PROP "X-COUCHDB-REVISION"
9-#define COUCHDB_UUID_PROP "X-COUCHDB-UUID"
10+#define COUCHDB_REVISION_PROP "X-COUCHDB-REVISION"
11+#define COUCHDB_UUID_PROP "X-COUCHDB-UUID"
12+#define COUCHDB_APPLICATION_ANNOTATIONS_PROP "X-COUCHDB-APPLICATION-ANNOTATIONS"
13
14 G_DEFINE_TYPE (EBookBackendCouchDB, e_book_backend_couchdb, E_TYPE_BOOK_BACKEND);
15
16@@ -258,6 +259,19 @@
17 }
18 }
19
20+ /* application annotations */
21+ if (couchdb_document_has_field (document, "application_annotations")) {
22+ CouchDBStructField *annotations = couchdb_document_get_application_annotations (document);
23+
24+ str = couchdb_struct_field_to_string (annotations);
25+ e_vcard_add_attribute_with_value (E_VCARD (contact),
26+ e_vcard_attribute_new (NULL, COUCHDB_APPLICATION_ANNOTATIONS_PROP),
27+ str);
28+
29+ g_free (str);
30+ couchdb_struct_field_unref (annotations);
31+ }
32+
33 /* convert the contact to a VCARD string to be returned */
34 str = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
35
36@@ -389,7 +403,7 @@
37 const EContactAddress *contact_address;
38
39 /* create the CouchDBDocument to put on the database */
40- document = couchdb_document_new (couchdb_backend->couchdb);
41+ document = couchdb_document_contact_new (couchdb_backend->couchdb);
42
43 str = e_contact_get_const (contact, E_CONTACT_UID);
44 if (str)
45@@ -505,6 +519,18 @@
46 g_free (dt_str);
47 }
48
49+ /* application annotations */
50+ str = e_vcard_attribute_get_value (e_vcard_get_attribute (E_VCARD (contact), COUCHDB_APPLICATION_ANNOTATIONS_PROP));
51+ if (str) {
52+ CouchDBStructField *annotations;
53+
54+ annotations = couchdb_struct_field_new_from_string (str);
55+ if (annotations) {
56+ couchdb_document_set_application_annotations (document, annotations);
57+ couchdb_struct_field_unref (annotations);
58+ }
59+ }
60+
61 return document;
62 }
63
64
65=== modified file 'configure.ac'
66--- configure.ac 2009-08-12 08:55:48 +0000
67+++ configure.ac 2009-08-19 11:38:13 +0000
68@@ -34,7 +34,7 @@
69 AC_SUBST(localedir)
70
71 dnl Check for dependencies
72-PKG_CHECK_MODULES(EVOLUTION, glib-2.0 couchdb-glib-1.0 >= 0.4.3 libebook-1.2 libedata-book-1.2 dbus-glib-1)
73+PKG_CHECK_MODULES(EVOLUTION, glib-2.0 couchdb-glib-1.0 >= 0.4.4 libebook-1.2 libedata-book-1.2 dbus-glib-1)
74 AC_SUBST(EVOLUTION_CFLAGS)
75 AC_SUBST(EVOLUTION_LIBS)
76

Subscribers

People subscribed via source and target branches