[couchdb-glib] Add categories API for contacts documents



commit 11ba1fd962f084c4368c1d0520cb32ba4e0e1bc0
Author: Rodrigo Moya <rodrigo gnome-db org>
Date:   Wed Jan 27 14:30:28 2010 +0100

    Add categories API for contacts documents

 desktopcouch-glib/desktopcouch-document-contact.c |   27 +++++++++++++++++++++
 desktopcouch-glib/desktopcouch-document-contact.h |    3 ++
 2 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/desktopcouch-glib/desktopcouch-document-contact.c b/desktopcouch-glib/desktopcouch-document-contact.c
index 7085cfc..8a7c3df 100644
--- a/desktopcouch-glib/desktopcouch-document-contact.c
+++ b/desktopcouch-glib/desktopcouch-document-contact.c
@@ -596,6 +596,33 @@ desktopcouch_document_contact_set_urls (CouchdbDocument *document, GSList *list)
 	json_object_set_object_member (couchdb_document_get_json_object (document), "urls", urls_json);
 }
 
+/**
+ * desktopcouch_document_contact_get_categories:
+ * @document: A #CouchdbDocument object
+ *
+ * Get the list of categories (as a string) for this contact document.
+ *
+ * Return value: A comma separated list of categories as a string.
+ */
+const char *
+desktopcouch_document_contact_get_categories (CouchdbDocument *document)
+{
+	g_return_val_if_fail (COUCHDB_IS_DOCUMENT (document), NULL);
+	g_return_val_if_fail (desktopcouch_document_is_contact (document), NULL);
+
+	return couchdb_document_get_string_field (document, "categories");
+}
+
+void
+desktopcouch_document_contact_set_categories (CouchdbDocument *document, const char *categories)
+{
+	g_return_if_fail (COUCHDB_IS_DOCUMENT (document));
+	g_return_if_fail (desktopcouch_document_is_contact (document));
+	g_return_if_fail (categories != NULL);
+
+	couchdb_document_set_string_field (document, "categories", categories);
+}
+
 const char *
 desktopcouch_document_contact_get_notes (CouchdbDocument *document)
 {
diff --git a/desktopcouch-glib/desktopcouch-document-contact.h b/desktopcouch-glib/desktopcouch-document-contact.h
index 596cc84..6d48975 100644
--- a/desktopcouch-glib/desktopcouch-document-contact.h
+++ b/desktopcouch-glib/desktopcouch-document-contact.h
@@ -79,6 +79,9 @@ void        desktopcouch_document_contact_set_im_addresses (CouchdbDocument *doc
 GSList     *desktopcouch_document_contact_get_urls (CouchdbDocument *document);
 void        desktopcouch_document_contact_set_urls (CouchdbDocument *document, GSList *list);
 
+const char *desktopcouch_document_contact_get_categories (CouchdbDocument *document);
+void        desktopcouch_document_contact_set_categories (CouchdbDocument *document, const char *categories);
+
 const char *desktopcouch_document_contact_get_notes (CouchdbDocument *document);
 void        desktopcouch_document_contact_set_notes (CouchdbDocument *document, const char *notes);
 



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