[couchdb-glib] Add couchdb_document_contact_phone_new function



commit b603b367cfbc25f7fc4108d68bd4cb30c9a8309e
Author: Rodrigo Moya <rodrigo gnome-db org>
Date:   Wed Jun 24 16:26:44 2009 +0200

    Add couchdb_document_contact_phone_new function

 couchdb-glib/couchdb-document-contact.c |   15 +++++++++++++++
 couchdb-glib/couchdb-document-contact.h |   13 +++++++------
 2 files changed, 22 insertions(+), 6 deletions(-)
---
diff --git a/couchdb-glib/couchdb-document-contact.c b/couchdb-glib/couchdb-document-contact.c
index 64bb29a..e468e4e 100644
--- a/couchdb-glib/couchdb-document-contact.c
+++ b/couchdb-glib/couchdb-document-contact.c
@@ -283,6 +283,21 @@ couchdb_document_contact_email_set_description (CouchDBStructField *sf, const ch
 	json_object_set_string_member (sf->json_object, "description", description);
 }
 
+CouchDBStructField *
+couchdb_document_contact_phone_new (const char *number, const char *description, gint priority)
+{
+	CouchDBStructField *sf;
+
+	sf = couchdb_struct_field_new_from_json_object (json_object_new ());
+	if (number)
+		couchdb_document_contact_phone_set_number (sf, number);
+	if (description)
+		couchdb_document_contact_phone_set_description (sf, description);
+	couchdb_document_contact_phone_set_priority (sf, priority);
+
+	return sf;
+}
+
 gint
 couchdb_document_contact_phone_get_priority (CouchDBStructField *sf)
 {
diff --git a/couchdb-glib/couchdb-document-contact.h b/couchdb-glib/couchdb-document-contact.h
index 4f51d7c..47e044a 100644
--- a/couchdb-glib/couchdb-document-contact.h
+++ b/couchdb-glib/couchdb-document-contact.h
@@ -58,12 +58,13 @@ void                couchdb_document_contact_email_set_description (CouchDBStruc
  * Utility functions to manipulate phone numbers
  */
 
-gint        couchdb_document_contact_phone_get_priority (CouchDBStructField *sf);
-void        couchdb_document_contact_phone_set_priority (CouchDBStructField *sf, gint priority);
-const char *couchdb_document_contact_phone_get_number (CouchDBStructField *sf);
-void        couchdb_document_contact_phone_set_number (CouchDBStructField *sf, const char *number);
-const char *couchdb_document_contact_phone_get_description (CouchDBStructField *sf);
-void        couchdb_document_contact_phone_set_description (CouchDBStructField *sf, const char *description);
+CouchDBStructField *couchdb_document_contact_phone_new (const char *number, const char *description, gint priority);
+gint                couchdb_document_contact_phone_get_priority (CouchDBStructField *sf);
+void                couchdb_document_contact_phone_set_priority (CouchDBStructField *sf, gint priority);
+const char         *couchdb_document_contact_phone_get_number (CouchDBStructField *sf);
+void                couchdb_document_contact_phone_set_number (CouchDBStructField *sf, const char *number);
+const char         *couchdb_document_contact_phone_get_description (CouchDBStructField *sf);
+void                couchdb_document_contact_phone_set_description (CouchDBStructField *sf, const char *description);
 
 /*
  * Utility functions to manipulate addresses



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