[couchdb-glib] Renamed Couchdb->CouchdbSession and Desktopcouch->DesktopcouchSession



commit 3d3dbf0080df053772aec1ee1ee5b5bf14a60cb9
Author: Rodrigo Moya <rodrigo gnome-db org>
Date:   Mon Jan 11 17:57:19 2010 +0100

    Renamed Couchdb->CouchdbSession and Desktopcouch->DesktopcouchSession

 couchdb-glib/Makefile.am                 |    6 +-
 couchdb-glib/couchdb-document-contact.c  |    4 +-
 couchdb-glib/couchdb-document-contact.h  |    2 +-
 couchdb-glib/couchdb-document.c          |   24 +++---
 couchdb-glib/couchdb-document.h          |    4 +-
 couchdb-glib/couchdb-glib.h              |    2 +-
 couchdb-glib/couchdb-session.c           |  152 +++++++++++++++---------------
 couchdb-glib/couchdb-session.h           |   72 +++++++-------
 couchdb-glib/couchdb-struct-field.h      |    2 +-
 couchdb-glib/dbwatch.c                   |    8 +-
 couchdb-glib/dbwatch.h                   |    6 +-
 couchdb-glib/utils.h                     |    2 +-
 desktopcouch-glib/Makefile.am            |    8 +-
 desktopcouch-glib/desktopcouch-glib.h    |    2 +-
 desktopcouch-glib/desktopcouch-session.c |   38 ++++----
 desktopcouch-glib/desktopcouch-session.h |   28 +++---
 tests/test-couchdb-glib.c                |   32 +++---
 tests/test-desktopcouch-glib.c           |    6 +-
 tests/test-list-databases.c              |   14 ++--
 tests/test-oauth.c                       |   10 +-
 20 files changed, 211 insertions(+), 211 deletions(-)
---
diff --git a/couchdb-glib/Makefile.am b/couchdb-glib/Makefile.am
index e6fba72..cbeb5ca 100644
--- a/couchdb-glib/Makefile.am
+++ b/couchdb-glib/Makefile.am
@@ -25,7 +25,7 @@ couchdb-marshal.c: couchdb-marshal.list $(GLIB_GENMARSHAL)
 	$(GLIB_GENMARSHAL) $< --body --prefix=_couchdb_marshal > $@
 
 libcouchdb_glib_1_0_la_headers =	\
-	couchdb.h			\
+	couchdb-session.h		\
 	couchdb-database-info.h		\
 	couchdb-document.h		\
 	couchdb-document-contact.h	\
@@ -37,7 +37,7 @@ libcouchdb_glib_1_0_la_headers =	\
 	utils.h
 
 libcouchdb_glib_1_0_la_sources =	\
-	couchdb.c			\
+	couchdb-session.c		\
 	couchdb-database-info.c		\
 	couchdb-document.c		\
 	couchdb-document-contact.c	\
@@ -64,7 +64,7 @@ libcouchdb_glib_1_0_la_LDFLAGS =	\
 
 hdir = $(includedir)/couchdb-glib-1.0
 h_DATA = 				\
-	couchdb.h			\
+	couchdb-session.h		\
 	couchdb-glib.h			\
 	couchdb-database-info.h		\
 	couchdb-document-contact.h	\
diff --git a/couchdb-glib/couchdb-document-contact.c b/couchdb-glib/couchdb-document-contact.c
index 677a2e9..7e825e7 100644
--- a/couchdb-glib/couchdb-document-contact.c
+++ b/couchdb-glib/couchdb-document-contact.c
@@ -23,11 +23,11 @@
 #include "utils.h"
 
 CouchdbDocument *
-couchdb_document_contact_new (Couchdb *couchdb)
+couchdb_document_contact_new (CouchdbSession *couchdb)
 {
 	CouchdbDocument *document;
 
-	g_return_val_if_fail (COUCHDB_IS (couchdb), NULL);
+	g_return_val_if_fail (COUCHDB_IS_SESSION (couchdb), NULL);
 
 	document = couchdb_document_new (couchdb);
 	if (document)
diff --git a/couchdb-glib/couchdb-document-contact.h b/couchdb-glib/couchdb-document-contact.h
index a24506e..ae91794 100644
--- a/couchdb-glib/couchdb-document-contact.h
+++ b/couchdb-glib/couchdb-document-contact.h
@@ -30,7 +30,7 @@ G_BEGIN_DECLS
 
 #define COUCHDB_RECORD_TYPE_CONTACT "http://www.freedesktop.org/wiki/Specifications/desktopcouch/contact";
 
-CouchdbDocument *couchdb_document_contact_new (Couchdb *couchdb);
+CouchdbDocument *couchdb_document_contact_new (CouchdbSession *couchdb);
 gboolean         couchdb_document_is_contact (CouchdbDocument *document);
 
 /*
diff --git a/couchdb-glib/couchdb-document.c b/couchdb-glib/couchdb-document.c
index 9068f01..08ca264 100644
--- a/couchdb-glib/couchdb-document.c
+++ b/couchdb-glib/couchdb-document.c
@@ -31,7 +31,7 @@
 struct _CouchdbDocument {
 	GObject		parent;
 
-	Couchdb		*couchdb;
+	CouchdbSession  *couchdb;
 	char		*dbname;
 	JsonNode	*root_node;
 };
@@ -66,7 +66,7 @@ couchdb_document_init (CouchdbDocument *document)
 }
 
 CouchdbDocument *
-couchdb_document_new (Couchdb *couchdb)
+couchdb_document_new (CouchdbSession *couchdb)
 {
 	CouchdbDocument *document;
 
@@ -81,7 +81,7 @@ couchdb_document_new (Couchdb *couchdb)
 }
 
 CouchdbDocument *
-couchdb_document_get (Couchdb *couchdb,
+couchdb_document_get (CouchdbSession *couchdb,
 		      const char *dbname,
 		      const char *docid,
 		      GError **error)
@@ -90,14 +90,14 @@ couchdb_document_get (Couchdb *couchdb,
 	JsonParser *parser;
 	CouchdbDocument *document = NULL;
 
-	g_return_val_if_fail (COUCHDB_IS (couchdb), NULL);
+	g_return_val_if_fail (COUCHDB_IS_SESSION (couchdb), NULL);
 	g_return_val_if_fail (dbname != NULL, NULL);
 	g_return_val_if_fail (docid != NULL, NULL);
 
 	encoded_docid = soup_uri_encode (docid, NULL);
-	url = g_strdup_printf ("%s/%s/%s", couchdb_get_uri (couchdb), dbname, encoded_docid);
+	url = g_strdup_printf ("%s/%s/%s", couchdb_session_get_uri (couchdb), dbname, encoded_docid);
 	parser = json_parser_new ();
-	if (couchdb_send_message (couchdb, SOUP_METHOD_GET, url, NULL, parser, error)) {
+	if (couchdb_session_send_message (couchdb, SOUP_METHOD_GET, url, NULL, parser, error)) {
 		document = g_object_new (COUCHDB_TYPE_DOCUMENT, NULL);
 		document->couchdb = couchdb;
 		document->dbname = g_strdup (dbname);
@@ -132,13 +132,13 @@ couchdb_document_put (CouchdbDocument *document,
 		char *encoded_docid;
 
 		encoded_docid = soup_uri_encode (id, NULL);
-		url = g_strdup_printf ("%s/%s/%s", couchdb_get_uri (document->couchdb), dbname, encoded_docid);		
-		send_ok = couchdb_send_message (document->couchdb, SOUP_METHOD_PUT, url, body, parser, error);
+		url = g_strdup_printf ("%s/%s/%s", couchdb_session_get_uri (document->couchdb), dbname, encoded_docid);		
+		send_ok = couchdb_session_send_message (document->couchdb, SOUP_METHOD_PUT, url, body, parser, error);
 
 		g_free (encoded_docid);
 	} else {
-		url = g_strdup_printf ("%s/%s/", couchdb_get_uri (document->couchdb), dbname);
-		send_ok = couchdb_send_message (document->couchdb, SOUP_METHOD_POST, url, body, parser, error);
+		url = g_strdup_printf ("%s/%s/", couchdb_session_get_uri (document->couchdb), dbname);
+		send_ok = couchdb_session_send_message (document->couchdb, SOUP_METHOD_POST, url, body, parser, error);
 	}
 
 	if (send_ok) {
@@ -184,10 +184,10 @@ couchdb_document_delete (CouchdbDocument *document, GError **error)
 	if (!id || !revision) /* we can't remove a document without an ID and/or a REVISION */
 		return FALSE;
 
-	url = g_strdup_printf ("%s/%s/%s?rev=%s", couchdb_get_uri (document->couchdb), document->dbname, id, revision);
+	url = g_strdup_printf ("%s/%s/%s?rev=%s", couchdb_session_get_uri (document->couchdb), document->dbname, id, revision);
 	
 	/* We don't parse the http response, therefore the parser arg is NULL */
-	if (couchdb_send_message (document->couchdb, SOUP_METHOD_DELETE, url, NULL, NULL, error)) {
+	if (couchdb_session_send_message (document->couchdb, SOUP_METHOD_DELETE, url, NULL, NULL, error)) {
 		result = TRUE;		
 		g_signal_emit_by_name (document->couchdb, "document_deleted", document->dbname, id);
 	}
diff --git a/couchdb-glib/couchdb-document.h b/couchdb-glib/couchdb-document.h
index 4714958..0853380 100644
--- a/couchdb-glib/couchdb-document.h
+++ b/couchdb-glib/couchdb-document.h
@@ -46,9 +46,9 @@ typedef struct {
 
 GType            couchdb_document_get_type 		(void);
 
-CouchdbDocument *couchdb_document_new			(Couchdb         *couchdb);
+CouchdbDocument *couchdb_document_new			(CouchdbSession  *couchdb);
 
-CouchdbDocument *couchdb_document_get			(Couchdb         *couchdb,
+CouchdbDocument *couchdb_document_get			(CouchdbSession  *couchdb,
 	                                                 const char      *dbname,
 	                                                 const char      *docid,
 	                                                 GError          **error);
diff --git a/couchdb-glib/couchdb-glib.h b/couchdb-glib/couchdb-glib.h
index f042f00..e466b0d 100644
--- a/couchdb-glib/couchdb-glib.h
+++ b/couchdb-glib/couchdb-glib.h
@@ -25,7 +25,7 @@
 #define __COUCHDB_GLIB_H__
 
 #include <couchdb-types.h>
-#include <couchdb.h>
+#include <couchdb-session.h>
 #include <couchdb-database-info.h>
 #include <couchdb-document.h>
 #include <couchdb-document-contact.h>
diff --git a/couchdb-glib/couchdb-session.c b/couchdb-glib/couchdb-session.c
index 1530ed9..fb3e383 100644
--- a/couchdb-glib/couchdb-session.c
+++ b/couchdb-glib/couchdb-session.c
@@ -24,7 +24,7 @@
 #include <libsoup/soup-logger.h>
 #include <libsoup/soup-gnome.h>
 #include <libsoup/soup-message.h>
-#include "couchdb.h"
+#include "couchdb-session.h"
 #include "couchdb-document-info.h"
 #include "couchdb-marshal.h"
 #include "dbwatch.h"
@@ -35,7 +35,7 @@
 #include "oauth.h"
 #endif
 
-struct _CouchdbPrivate {
+struct _CouchdbSessionPrivate {
 	GObject parent;
 
 	char *uri;
@@ -50,7 +50,7 @@ struct _CouchdbPrivate {
 	char *oauth_token_secret;	
 };
 
-G_DEFINE_TYPE(Couchdb, couchdb, G_TYPE_OBJECT)
+G_DEFINE_TYPE(CouchdbSession, couchdb_session, G_TYPE_OBJECT)
 
 enum {
 	DATABASE_CREATED,
@@ -60,7 +60,7 @@ enum {
 	DOCUMENT_DELETED,
 	LAST_SIGNAL
 };
-static guint couchdb_signals[LAST_SIGNAL];
+static guint couchdb_session_signals[LAST_SIGNAL];
 
 enum {
     PROP_0,
@@ -68,9 +68,9 @@ enum {
 };
 
 static void
-couchdb_finalize (GObject *object)
+couchdb_session_finalize (GObject *object)
 {
-	Couchdb *couchdb = COUCHDB (object);
+	CouchdbSession *couchdb = COUCHDB_SESSION (object);
 
 	g_hash_table_destroy (couchdb->priv->db_watchlist);
 
@@ -88,17 +88,17 @@ couchdb_finalize (GObject *object)
 
 	g_free (couchdb->priv);
 
-	G_OBJECT_CLASS (couchdb_parent_class)->finalize (object);
+	G_OBJECT_CLASS (couchdb_session_parent_class)->finalize (object);
 }
 
 static void
-couchdb_set_property (GObject         *object,
-                      guint            prop_id,
-                      const GValue    *value,
-                      GParamSpec      *pspec)
+couchdb_session_set_property (GObject         *object,
+			      guint            prop_id,
+			      const GValue    *value,
+			      GParamSpec      *pspec)
 
 {
-	Couchdb *couchdb = COUCHDB (object);
+	CouchdbSession *couchdb = COUCHDB_SESSION (object);
 
 	switch (prop_id) {
 	case PROP_URI:
@@ -112,12 +112,12 @@ couchdb_set_property (GObject         *object,
 }
 
 static void
-couchdb_get_property (GObject         *object,
-                      guint            prop_id,
-                      GValue          *value,
-                      GParamSpec      *pspec)
+couchdb_session_get_property (GObject         *object,
+			      guint            prop_id,
+			      GValue          *value,
+			      GParamSpec      *pspec)
 {
-	Couchdb *couchdb = COUCHDB (object);
+	CouchdbSession *couchdb = COUCHDB_SESSION (object);
 
 	switch (prop_id) {
 	case PROP_URI:
@@ -130,13 +130,13 @@ couchdb_get_property (GObject         *object,
 }
 
 static void
-couchdb_class_init (CouchdbClass *klass)
+couchdb_session_class_init (CouchdbSessionClass *klass)
 {
 	GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-	object_class->finalize = couchdb_finalize;
-	object_class->set_property = couchdb_set_property;
-	object_class->get_property = couchdb_get_property;
+	object_class->finalize = couchdb_session_finalize;
+	object_class->set_property = couchdb_session_set_property;
+	object_class->get_property = couchdb_session_get_property;
 
 	g_object_class_install_property (object_class,
         	                         PROP_URI,
@@ -147,49 +147,49 @@ couchdb_class_init (CouchdbClass *klass)
 							      G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 
 	/* Signals */
-	couchdb_signals[DATABASE_CREATED] =
+	couchdb_session_signals[DATABASE_CREATED] =
 		g_signal_new ("database_created",
 			      G_OBJECT_CLASS_TYPE (object_class),
 			      G_SIGNAL_RUN_LAST,
-			      G_STRUCT_OFFSET (CouchdbClass, database_created),
+			      G_STRUCT_OFFSET (CouchdbSessionClass, database_created),
 			      NULL, NULL,
 			      g_cclosure_marshal_VOID__STRING,
 			      G_TYPE_NONE, 1,
 			      G_TYPE_STRING);
-	couchdb_signals[DATABASE_DELETED] =
+	couchdb_session_signals[DATABASE_DELETED] =
 		g_signal_new ("database_deleted",
 			      G_OBJECT_CLASS_TYPE (object_class),
 			      G_SIGNAL_RUN_LAST,
-			      G_STRUCT_OFFSET (CouchdbClass, database_deleted),
+			      G_STRUCT_OFFSET (CouchdbSessionClass, database_deleted),
 			      NULL, NULL,
 			      g_cclosure_marshal_VOID__STRING,
 			      G_TYPE_NONE, 1,
 			      G_TYPE_STRING);
-	couchdb_signals[DOCUMENT_CREATED] =
+	couchdb_session_signals[DOCUMENT_CREATED] =
 		g_signal_new ("document_created",
 			      G_OBJECT_CLASS_TYPE (object_class),
 			      G_SIGNAL_RUN_LAST,
-			      G_STRUCT_OFFSET (CouchdbClass, document_created),
+			      G_STRUCT_OFFSET (CouchdbSessionClass, document_created),
 			      NULL, NULL,
 			      _couchdb_marshal_VOID__STRING_OBJECT,
 			      G_TYPE_NONE, 2,
 			      G_TYPE_STRING,
 			      G_TYPE_OBJECT);
-	couchdb_signals[DOCUMENT_UPDATED] =
+	couchdb_session_signals[DOCUMENT_UPDATED] =
 		g_signal_new ("document_updated",
 			      G_OBJECT_CLASS_TYPE (object_class),
 			      G_SIGNAL_RUN_LAST,
-			      G_STRUCT_OFFSET (CouchdbClass, document_updated),
+			      G_STRUCT_OFFSET (CouchdbSessionClass, document_updated),
 			      NULL, NULL,
 			      _couchdb_marshal_VOID__STRING_OBJECT,
 			      G_TYPE_NONE, 2,
 			      G_TYPE_STRING,
 			      G_TYPE_OBJECT);
-	couchdb_signals[DOCUMENT_DELETED] =
+	couchdb_session_signals[DOCUMENT_DELETED] =
 		g_signal_new ("document_deleted",
 			      G_OBJECT_CLASS_TYPE (object_class),
 			      G_SIGNAL_RUN_LAST,
-			      G_STRUCT_OFFSET (CouchdbClass, document_deleted),
+			      G_STRUCT_OFFSET (CouchdbSessionClass, document_deleted),
 			      NULL, NULL,
 			      _couchdb_marshal_VOID__STRING_STRING,
 			      G_TYPE_NONE, 2,
@@ -198,9 +198,9 @@ couchdb_class_init (CouchdbClass *klass)
 }
 
 static void
-couchdb_init (Couchdb *couchdb)
+couchdb_session_init (CouchdbSession *couchdb)
 {
-	couchdb->priv = g_new0 (CouchdbPrivate, 1);
+	couchdb->priv = g_new0 (CouchdbSessionPrivate, 1);
 
 	couchdb->priv->db_watchlist = g_hash_table_new_full (g_str_hash, g_str_equal,
 						       (GDestroyNotify) g_free,
@@ -221,33 +221,33 @@ couchdb_init (Couchdb *couchdb)
 	soup_session_add_feature_by_type (couchdb->priv->http_session, SOUP_TYPE_LOGGER);
 }
 
-Couchdb *
-couchdb_new (const char *uri)
+CouchdbSession *
+couchdb_session_new (const char *uri)
 {
-	return g_object_new (COUCHDB_TYPE, "uri", uri, NULL);
+	return g_object_new (COUCHDB_TYPE_SESSION, "uri", uri, NULL);
 }
 
 const char *
-couchdb_get_uri (Couchdb *couchdb)
+couchdb_session_get_uri (CouchdbSession *couchdb)
 {
-	g_return_val_if_fail (COUCHDB_IS (couchdb), NULL);
+	g_return_val_if_fail (COUCHDB_IS_SESSION (couchdb), NULL);
 
 	return (const char *) couchdb->priv->uri;
 }
 
 GSList *
-couchdb_list_databases (Couchdb *couchdb, GError **error)
+couchdb_session_list_databases (CouchdbSession *couchdb, GError **error)
 {
 	char *url;
 	GSList *dblist = NULL;
 	JsonParser *parser;
 
-	g_return_val_if_fail (COUCHDB_IS (couchdb), NULL);
+	g_return_val_if_fail (COUCHDB_IS_SESSION (couchdb), NULL);
 
 	/* Prepare request */
 	url = g_strdup_printf ("%s/_all_dbs", couchdb->priv->uri);
 	parser = json_parser_new ();
-	if (couchdb_send_message (couchdb, SOUP_METHOD_GET, url, NULL, parser, error)) {
+	if (couchdb_session_send_message (couchdb, SOUP_METHOD_GET, url, NULL, parser, error)) {
 		JsonNode *root_node;
 
 		root_node = json_parser_get_root (parser);
@@ -271,18 +271,18 @@ couchdb_list_databases (Couchdb *couchdb, GError **error)
 }
 
 CouchdbDatabaseInfo *
-couchdb_get_database_info (Couchdb *couchdb, const char *dbname, GError **error)
+couchdb_session_get_database_info (CouchdbSession *couchdb, const char *dbname, GError **error)
 {
 	char *url;
 	JsonParser *parser;
 	CouchdbDatabaseInfo *result = NULL;
 
-	g_return_val_if_fail (COUCHDB_IS (couchdb), NULL);
+	g_return_val_if_fail (COUCHDB_IS_SESSION (couchdb), NULL);
 	g_return_val_if_fail (dbname != NULL, NULL);
 
 	url = g_strdup_printf ("%s/%s/", couchdb->priv->uri, dbname);
 	parser = json_parser_new ();
-	if (couchdb_send_message (couchdb, SOUP_METHOD_GET, url, NULL, parser, error)) {
+	if (couchdb_session_send_message (couchdb, SOUP_METHOD_GET, url, NULL, parser, error)) {
 		JsonNode *root_node;
 
 		root_node = json_parser_get_root (parser);
@@ -303,18 +303,18 @@ couchdb_get_database_info (Couchdb *couchdb, const char *dbname, GError **error)
 }
 
 gboolean
-couchdb_create_database (Couchdb *couchdb, const char *dbname, GError **error)
+couchdb_session_create_database (CouchdbSession *couchdb, const char *dbname, GError **error)
 {
 	char *url;
 	JsonParser *parser;
 	gboolean result = FALSE;
 
-	g_return_val_if_fail (COUCHDB_IS (couchdb), FALSE);
+	g_return_val_if_fail (COUCHDB_IS_SESSION (couchdb), FALSE);
 	g_return_val_if_fail (dbname != NULL, FALSE);
 
 	url = g_strdup_printf ("%s/%s/", couchdb->priv->uri, dbname);
 	parser = json_parser_new ();
-	if (couchdb_send_message (couchdb, SOUP_METHOD_PUT, url, NULL, parser, error)) {
+	if (couchdb_session_send_message (couchdb, SOUP_METHOD_PUT, url, NULL, parser, error)) {
 		JsonNode *root_node;
 
 		root_node = json_parser_get_root (parser);
@@ -333,18 +333,18 @@ couchdb_create_database (Couchdb *couchdb, const char *dbname, GError **error)
 }
 
 gboolean
-couchdb_delete_database (Couchdb *couchdb, const char *dbname, GError **error)
+couchdb_session_delete_database (CouchdbSession *couchdb, const char *dbname, GError **error)
 {
 	char *url;
 	JsonParser *parser;
 	gboolean result = FALSE;
 
-	g_return_val_if_fail (COUCHDB_IS (couchdb), FALSE);
+	g_return_val_if_fail (COUCHDB_IS_SESSION (couchdb), FALSE);
 	g_return_val_if_fail (dbname != NULL, FALSE);
 
 	url = g_strdup_printf ("%s/%s/", couchdb->priv->uri, dbname);
 	parser = json_parser_new ();
-	if (couchdb_send_message (couchdb, SOUP_METHOD_DELETE, url, NULL, parser, error)) {
+	if (couchdb_session_send_message (couchdb, SOUP_METHOD_DELETE, url, NULL, parser, error)) {
 		JsonNode *root_node;
 
 		root_node = json_parser_get_root (parser);
@@ -368,7 +368,7 @@ couchdb_delete_database (Couchdb *couchdb, const char *dbname, GError **error)
 }
 
 void
-couchdb_free_database_list (GSList *dblist)
+couchdb_session_free_database_list (GSList *dblist)
 {
 	g_return_if_fail (dblist != NULL);
 
@@ -377,23 +377,23 @@ couchdb_free_database_list (GSList *dblist)
 }
 
 /**
- * couchdb_list_documents:
+ * couchdb_session_list_documents:
  *
  * Return Value: (element-type Couchdb.DocumentInfo) (transfer full)
  */
 GSList *
-couchdb_list_documents (Couchdb *couchdb, const char *dbname, GError **error)
+couchdb_session_list_documents (CouchdbSession *couchdb, const char *dbname, GError **error)
 {
 	char *url;
 	JsonParser *parser;
 	GSList *doclist = NULL;
 
-	g_return_val_if_fail (COUCHDB_IS (couchdb), NULL);
+	g_return_val_if_fail (COUCHDB_IS_SESSION (couchdb), NULL);
 	g_return_val_if_fail (dbname != NULL, NULL);
 
 	url = g_strdup_printf ("%s/%s/_all_docs", couchdb->priv->uri, dbname);
 	parser = json_parser_new ();
-	if (couchdb_send_message (couchdb, SOUP_METHOD_GET, url, NULL, parser, error)) {
+	if (couchdb_session_send_message (couchdb, SOUP_METHOD_GET, url, NULL, parser, error)) {
 		JsonNode *root_node;
 
 		root_node = json_parser_get_root (parser);
@@ -427,7 +427,7 @@ couchdb_list_documents (Couchdb *couchdb, const char *dbname, GError **error)
 }
 
 void
-couchdb_free_document_list (GSList *doclist)
+couchdb_session_free_document_list (GSList *doclist)
 {
 	g_return_if_fail (doclist != NULL);
 
@@ -436,13 +436,13 @@ couchdb_free_document_list (GSList *doclist)
 }
 
 void
-couchdb_listen_for_changes (Couchdb *couchdb, const char *dbname)
+couchdb_session_listen_for_changes (CouchdbSession *couchdb, const char *dbname)
 {
 	DBWatch *watch;
 	CouchdbDatabaseInfo *db_info;
 	GError *error = NULL;
 
-	g_return_if_fail (COUCHDB_IS (couchdb));
+	g_return_if_fail (COUCHDB_IS_SESSION (couchdb));
 	g_return_if_fail (dbname != NULL);
 
 	watch = g_hash_table_lookup (couchdb->priv->db_watchlist, dbname);
@@ -452,7 +452,7 @@ couchdb_listen_for_changes (Couchdb *couchdb, const char *dbname)
 	}
 
 	/* Retrieve information for database, to know the last_update_sequence */
-	db_info = couchdb_get_database_info (couchdb, dbname, &error);
+	db_info = couchdb_session_get_database_info (couchdb, dbname, &error);
 	if (!db_info) {
 		g_warning ("Could not retrieve information for '%s' database: %s",
 			   dbname, error->message);
@@ -472,25 +472,25 @@ couchdb_listen_for_changes (Couchdb *couchdb, const char *dbname)
 }
 
 /**
- * couchdb_enable_oauth:
- * @couchdb: A #Couchdb object
+ * couchdb_session_enable_oauth:
+ * @couchdb: A #CouchdbSession object
  * @consumer_key: Consumer key to use
  * @consumer_secret: Consumer secret to use
  * @token_key: Token key to use
  * @token_secret: Token secret to use
  *
- * Enables oAuth signing of all requests for the given #Couchdb object.
+ * Enables oAuth signing of all requests for the given #CouchdbSession object.
  *
  * Return value: TRUE if oAuth is enabled in the library or FALSE if not.
  */
 gboolean
-couchdb_enable_oauth (Couchdb *couchdb,
-		      const char *consumer_key,
-		      const char *consumer_secret,
-		      const char *token_key,
-		      const char *token_secret)
+couchdb_session_enable_oauth (CouchdbSession *couchdb,
+			      const char *consumer_key,
+			      const char *consumer_secret,
+			      const char *token_key,
+			      const char *token_secret)
 {
-	g_return_val_if_fail (COUCHDB_IS (couchdb), FALSE);
+	g_return_val_if_fail (COUCHDB_IS_SESSION (couchdb), FALSE);
 
 #ifdef HAVE_OAUTH
 	if (couchdb->priv->oauth_enabled) {
@@ -513,16 +513,16 @@ couchdb_enable_oauth (Couchdb *couchdb,
 }
 
 gboolean
-couchdb_is_oauth_enabled (Couchdb *couchdb)
+couchdb_session_is_oauth_enabled (CouchdbSession *couchdb)
 {
-	g_return_val_if_fail (COUCHDB_IS (couchdb), FALSE);
+	g_return_val_if_fail (COUCHDB_IS_SESSION (couchdb), FALSE);
 	
 	return couchdb->priv->oauth_enabled;
 }
 
 
 static void
-couchdb_add_oauth_signature (Couchdb *couchdb, SoupMessage *http_message, const char *method, const char *url)
+couchdb_session_add_oauth_signature (CouchdbSession *couchdb, SoupMessage *http_message, const char *method, const char *url)
 {
 	/* This method is a no-op if we are configured without OAUTH */
 #ifdef HAVE_OAUTH
@@ -589,7 +589,7 @@ couchdb_add_oauth_signature (Couchdb *couchdb, SoupMessage *http_message, const
 }
 
 static gboolean
-parse_json_response (Couchdb *couchdb, JsonParser *json_parser, SoupMessage *http_message, GError **error)
+parse_json_response (CouchdbSession *couchdb, JsonParser *json_parser, SoupMessage *http_message, GError **error)
 {
 	SoupBuffer *buffer;
         GString *str = NULL;
@@ -629,12 +629,12 @@ debug_print_headers (const char *name, const char *value, gpointer user_data)
 }
 
 gboolean
-couchdb_send_message (Couchdb *couchdb, const char *method, const char *url, const char *body, JsonParser *parser, GError **error)
+couchdb_session_send_message (CouchdbSession *couchdb, const char *method, const char *url, const char *body, JsonParser *parser, GError **error)
 {
 	SoupMessage *http_message;
 	guint status;
 	
-	g_return_val_if_fail (COUCHDB_IS (couchdb), FALSE);
+	g_return_val_if_fail (COUCHDB_IS_SESSION (couchdb), FALSE);
 	g_return_val_if_fail (method != NULL, FALSE);
 	g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 	
@@ -644,8 +644,8 @@ couchdb_send_message (Couchdb *couchdb, const char *method, const char *url, con
 					  body, strlen (body));
 	}
 
-	if (couchdb_is_oauth_enabled (couchdb))
-		couchdb_add_oauth_signature (couchdb, http_message, method, url);
+	if (couchdb_session_is_oauth_enabled (couchdb))
+		couchdb_session_add_oauth_signature (couchdb, http_message, method, url);
 	
 
 	g_debug ("Sending %s to %s... with headers\n: ", method, url);
diff --git a/couchdb-glib/couchdb-session.h b/couchdb-glib/couchdb-session.h
index 2f57fa3..8fe982b 100644
--- a/couchdb-glib/couchdb-session.h
+++ b/couchdb-glib/couchdb-session.h
@@ -21,8 +21,8 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#ifndef __COUCHDB_H__
-#define __COUCHDB_H__
+#ifndef __COUCHDB_SESSION_H__
+#define __COUCHDB_SESSION_H__
 
 #include <glib.h>
 #include <glib-object.h>
@@ -32,60 +32,60 @@
 
 G_BEGIN_DECLS
 
-#define COUCHDB_TYPE                (couchdb_get_type ())
-#define COUCHDB(obj)                (G_TYPE_CHECK_INSTANCE_CAST ((obj), COUCHDB_TYPE, Couchdb))
-#define COUCHDB_IS(obj)             (G_TYPE_CHECK_INSTANCE_TYPE ((obj), COUCHDB_TYPE))
-#define COUCHDB_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST ((klass), COUCHDB_TYPE, CouchdbClass))
-#define COUCHDB_IS_CLASS(klass)     (G_TYPE_CHECK_CLASS_TYPE ((klass), COUCHDB_TYPE))
-#define COUCHDB_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS ((obj), COUCHDB_TYPE, CouchdbClass))
+#define COUCHDB_TYPE_SESSION                (couchdb_session_get_type ())
+#define COUCHDB_SESSION(obj)                (G_TYPE_CHECK_INSTANCE_CAST ((obj), COUCHDB_TYPE_SESSION, CouchdbSession))
+#define COUCHDB_IS_SESSION(obj)             (G_TYPE_CHECK_INSTANCE_TYPE ((obj), COUCHDB_TYPE_SESSION))
+#define COUCHDB_SESSION_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST ((klass), COUCHDB_TYPE_SESSION, CouchdbSessionClass))
+#define COUCHDB_IS_SESSION_CLASS(klass)     (G_TYPE_CHECK_CLASS_TYPE ((klass), COUCHDB_TYPE_SESSION))
+#define COUCHDB_SESSION_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS ((obj), COUCHDB_TYPE_SESSION, CouchdbSessionClass))
 
-typedef struct _CouchdbPrivate CouchdbPrivate;
+typedef struct _CouchdbSessionPrivate CouchdbSessionPrivate;
 
 typedef struct {
 	GObject parent;
 
-	CouchdbPrivate *priv;
-} Couchdb;
+	CouchdbSessionPrivate *priv;
+} CouchdbSession;
 
 typedef struct {
 	GObjectClass parent_class;
 
-	void (* database_created) (Couchdb *couchdb, const char *dbname);
-	void (* database_deleted) (Couchdb *couchdb, const char *dbname);
+	void (* database_created) (CouchdbSession *couchdb, const char *dbname);
+	void (* database_deleted) (CouchdbSession *couchdb, const char *dbname);
 
-	void (* document_created) (Couchdb *couchdb, const char *dbname, CouchdbDocument *document);
-	void (* document_updated) (Couchdb *couchdb, const char *dbname, CouchdbDocument *document);
-	void (* document_deleted) (Couchdb *couchdb, const char *dbname, const char *docid);
-} CouchdbClass;
+	void (* document_created) (CouchdbSession *couchdb, const char *dbname, CouchdbDocument *document);
+	void (* document_updated) (CouchdbSession *couchdb, const char *dbname, CouchdbDocument *document);
+	void (* document_deleted) (CouchdbSession *couchdb, const char *dbname, const char *docid);
+} CouchdbSessionClass;
 
-GType       couchdb_get_type (void);
-Couchdb    *couchdb_new (const char *uri);
+GType                couchdb_session_get_type (void);
+CouchdbSession      *couchdb_session_new (const char *uri);
 
-const char *couchdb_get_uri (Couchdb *couchdb);
+const char          *couchdb_session_get_uri (CouchdbSession *couchdb);
 
-GSList              *couchdb_list_databases (Couchdb *couchdb, GError **error);
-void                 couchdb_free_database_list (GSList *dblist);
+GSList              *couchdb_session_list_databases (CouchdbSession *couchdb, GError **error);
+void                 couchdb_session_free_database_list (GSList *dblist);
 
-CouchdbDatabaseInfo *couchdb_get_database_info (Couchdb *couchdb, const char *dbname, GError **error);
+CouchdbDatabaseInfo *couchdb_session_get_database_info (CouchdbSession *couchdb, const char *dbname, GError **error);
 
-gboolean             couchdb_create_database (Couchdb *couchdb, const char *dbname, GError **error);
-gboolean             couchdb_delete_database (Couchdb *couchdb, const char *dbname, GError **error);
+gboolean             couchdb_session_create_database (CouchdbSession *couchdb, const char *dbname, GError **error);
+gboolean             couchdb_session_delete_database (CouchdbSession *couchdb, const char *dbname, GError **error);
 
-void                 couchdb_listen_for_changes (Couchdb *couchdb, const char *dbname);
+void                 couchdb_session_listen_for_changes (CouchdbSession *couchdb, const char *dbname);
 
-gboolean             couchdb_enable_oauth (Couchdb *couchdb,
-					   const char *consumer_key,
-					   const char *consumer_secret,
-					   const char *token_key,
-					   const char *token_secret);
-void                 couchdb_disable_oauth (Couchdb *couchdb);
+gboolean             couchdb_session_enable_oauth (CouchdbSession *couchdb,
+						   const char *consumer_key,
+						   const char *consumer_secret,
+						   const char *token_key,
+						   const char *token_secret);
+void                 couchdb_session_disable_oauth (CouchdbSession *couchdb);
 
-gboolean             couchdb_is_oauth_enabled (Couchdb *couchdb);
+gboolean             couchdb_session_is_oauth_enabled (CouchdbSession *couchdb);
 
-gboolean             couchdb_send_message (Couchdb *couchdb, const char *method, const char *url, const char *body, JsonParser *parser, GError **error);
+gboolean             couchdb_session_send_message (CouchdbSession *couchdb, const char *method, const char *url, const char *body, JsonParser *parser, GError **error);
 
-GSList          *couchdb_list_documents (Couchdb *couchdb, const char *dbname, GError **error);
-void             couchdb_free_document_list (GSList *doclist);
+GSList              *couchdb_session_list_documents (CouchdbSession *couchdb, const char *dbname, GError **error);
+void                 couchdb_session_free_document_list (GSList *doclist);
 
 G_END_DECLS
 
diff --git a/couchdb-glib/couchdb-struct-field.h b/couchdb-glib/couchdb-struct-field.h
index 58408b8..0987239 100644
--- a/couchdb-glib/couchdb-struct-field.h
+++ b/couchdb-glib/couchdb-struct-field.h
@@ -27,7 +27,7 @@
 #include <glib.h>
 #include <glib-object.h>
 #include <json-glib/json-glib.h>
-#include "couchdb.h"
+#include "couchdb-session.h"
 #include "couchdb-types.h"
 
 G_BEGIN_DECLS
diff --git a/couchdb-glib/dbwatch.c b/couchdb-glib/dbwatch.c
index 1384303..0c800ab 100644
--- a/couchdb-glib/dbwatch.c
+++ b/couchdb-glib/dbwatch.c
@@ -80,11 +80,11 @@ watch_timeout_cb (gpointer user_data)
 	DBWatch *watch = (DBWatch *) user_data;
 
 	url = g_strdup_printf ("%s/%s/_changes?since=%d",
-			       couchdb_get_uri (watch->couchdb),
+			       couchdb_session_get_uri (watch->couchdb),
 			       watch->dbname,
 			       watch->last_update_seq);
 	parser = json_parser_new ();
-	if (couchdb_send_message (watch->couchdb, SOUP_METHOD_GET, url, NULL, parser, &error)) {
+	if (couchdb_session_send_message (watch->couchdb, SOUP_METHOD_GET, url, NULL, parser, &error)) {
 		JsonNode *root_node;
 
 		root_node = json_parser_get_root (parser);
@@ -113,7 +113,7 @@ watch_timeout_cb (gpointer user_data)
 }
 
 DBWatch *
-dbwatch_new (Couchdb *couchdb, const gchar *dbname, gint update_seq)
+dbwatch_new (CouchdbSession *couchdb, const gchar *dbname, gint update_seq)
 {
 	DBWatch *watch;
 	guint timeout;
@@ -124,7 +124,7 @@ dbwatch_new (Couchdb *couchdb, const gchar *dbname, gint update_seq)
 	watch->last_update_seq = update_seq;
 
 	/* Set timeout to check for changes every 5 minutes*/
-	if (g_str_has_prefix (couchdb_get_uri (watch->couchdb), "http://127.0.0.1";))
+	if (g_str_has_prefix (couchdb_session_get_uri (watch->couchdb), "http://127.0.0.1";))
 		timeout = LOCAL_TIMEOUT_SECONDS;
 	else
 		timeout = REMOTE_TIMEOUT_SECONDS;
diff --git a/couchdb-glib/dbwatch.h b/couchdb-glib/dbwatch.h
index 331badb..ae6f26c 100644
--- a/couchdb-glib/dbwatch.h
+++ b/couchdb-glib/dbwatch.h
@@ -23,17 +23,17 @@
 #define __DBWATCH_H__
 
 #include <glib.h>
-#include "couchdb.h"
+#include "couchdb-session.h"
 #include "utils.h"
 
 typedef struct {
-	Couchdb *couchdb;
+	CouchdbSession *couchdb;
 	gchar *dbname;
 	gint last_update_seq;
 	guint timeout_id;
 } DBWatch;
 
-DBWatch *dbwatch_new (Couchdb *couchdb, const gchar *dbname, gint update_seq);
+DBWatch *dbwatch_new (CouchdbSession *couchdb, const gchar *dbname, gint update_seq);
 void     dbwatch_free (DBWatch *watch);
 
 #endif /* __DBWATCH_H__ */
diff --git a/couchdb-glib/utils.h b/couchdb-glib/utils.h
index 94e6bcd..ca857a2 100644
--- a/couchdb-glib/utils.h
+++ b/couchdb-glib/utils.h
@@ -25,7 +25,7 @@
 #include <glib.h>
 #include <json-glib/json-glib.h>
 #include "config.h"
-#include "couchdb.h"
+#include "couchdb-session.h"
 
 #define COUCHDB_ERROR couchdb_error_quark()
 GQuark      couchdb_error_quark (void);
diff --git a/desktopcouch-glib/Makefile.am b/desktopcouch-glib/Makefile.am
index eee4e30..d621706 100644
--- a/desktopcouch-glib/Makefile.am
+++ b/desktopcouch-glib/Makefile.am
@@ -7,11 +7,11 @@ lib_LTLIBRARIES = libdesktopcouch-glib-1.0.la
 
 libdesktopcouch_glib_1_0_la_headers =	\
 	desktopcouch-glib.h		\
-	desktopcouch.h
+	desktopcouch-session.h
 
 libdesktopcouch_glib_1_0_la_SOURCES =		\
 	$(libdesktopcouch_glib_1_0_la_headers) 	\
-	desktopcouch.c
+	desktopcouch-session.c
 
 libdesktopcouch_glib_1_0_la_LIBADD =				\
 	$(top_builddir)/couchdb-glib/libcouchdb-glib-1.0.la	\
@@ -24,7 +24,7 @@ libdesktopcouch_glib_1_0_la_LDFLAGS =	\
 hdir = $(includedir)/desktopcouch-glib-1.0
 h_DATA = 			\
 	desktopcouch-glib.h	\
-	desktopcouch.h
+	desktopcouch-session.h
 
 if HAVE_INTROSPECTION
 
@@ -57,7 +57,7 @@ Desktopcouch-1.0.gir: libdesktopcouch-glib-1.0.la
 Desktopcouch-1.0.typelib: Desktopcouch-1.0.gir
 	LD_LIBRARY_PATH=.libs$${LD_LIBRARY_PATH:+:$$LD_LIBRARY_PATH} \
 	$(INTROSPECTION_COMPILER) \
-	--includedir=$(srcdir) \
+	--includedir=$(srcdir)/couchdb-glib \
 	--includedir=. \
 	$(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
 
diff --git a/desktopcouch-glib/desktopcouch-glib.h b/desktopcouch-glib/desktopcouch-glib.h
index 23a8d73..e5ee60a 100644
--- a/desktopcouch-glib/desktopcouch-glib.h
+++ b/desktopcouch-glib/desktopcouch-glib.h
@@ -22,6 +22,6 @@
 #ifndef __DESKTOPCOUCH_GLIB_H__
 #define __DESKTOPCOUCH_GLIB_H__
 
-#include <desktopcouch.h>
+#include <desktopcouch-session.h>
 
 #endif /* __DESKTOPCOUCH_GLIB_H__ */
diff --git a/desktopcouch-glib/desktopcouch-session.c b/desktopcouch-glib/desktopcouch-session.c
index 18b3969..af3a641 100644
--- a/desktopcouch-glib/desktopcouch-session.c
+++ b/desktopcouch-glib/desktopcouch-session.c
@@ -21,38 +21,38 @@
 
 #include <dbus/dbus-glib.h>
 #include <gnome-keyring.h>
-#include "desktopcouch.h"
+#include "desktopcouch-session.h"
 
-G_DEFINE_TYPE(Desktopcouch, desktopcouch, COUCHDB_TYPE)
+G_DEFINE_TYPE(DesktopcouchSession, desktopcouch_session, COUCHDB_TYPE_SESSION)
 
 static void
-desktopcouch_finalize (GObject *object)
+desktopcouch_session_finalize (GObject *object)
 {
-	G_OBJECT_CLASS (desktopcouch_parent_class)->finalize (object);
+	G_OBJECT_CLASS (desktopcouch_session_parent_class)->finalize (object);
 }
 
 static void
-desktopcouch_class_init (DesktopcouchClass *klass)
+desktopcouch_session_class_init (DesktopcouchSessionClass *klass)
 {
 	GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-	object_class->finalize = desktopcouch_finalize;
+	object_class->finalize = desktopcouch_session_finalize;
 }
 
 static void
-desktopcouch_init (Desktopcouch *dc)
+desktopcouch_session_init (DesktopcouchSession *dc)
 {
 }
 
 /**
- * desktopcouch_new:
+ * desktopcouch_session_new:
  *
- * Create a #Couchdb instance prepared to connect to desktopcouch.
+ * Create a #CouchdbSession instance prepared to connect to desktopcouch.
  *
- * Return value: A #Couchdb instance.
+ * Return value: A #CouchdbSession instance.
  */
-Desktopcouch *
-desktopcouch_new (void)
+DesktopcouchSession *
+desktopcouch_session_new (void)
 {
 	char *uri = NULL;
 	DBusGConnection *bus;
@@ -100,7 +100,7 @@ desktopcouch_new (void)
 		if (result == GNOME_KEYRING_RESULT_OK && items_found != NULL) {
 			gchar **items;
 			char *oauth_c_key = NULL, *oauth_c_secret = NULL, *oauth_t_key = NULL, *oauth_t_secret = NULL;
-			Desktopcouch *dc;
+			DesktopcouchSession *dc;
 			GnomeKeyringFound *first_item = (GnomeKeyringFound *) items_found->data;
 
 			items = g_strsplit (first_item->secret, ":", 4);
@@ -115,12 +115,12 @@ desktopcouch_new (void)
 			gnome_keyring_found_list_free (items_found);
 
 			/* Enable OAuth on this connection */
-			dc = DESKTOPCOUCH (g_object_new (DESKTOPCOUCH_TYPE, "uri", uri, NULL));
-			couchdb_enable_oauth (COUCHDB (dc),
-					      oauth_c_key,
-					      oauth_c_secret,
-					      oauth_t_key,
-					      oauth_t_secret);
+			dc = DESKTOPCOUCH_SESSION (g_object_new (DESKTOPCOUCH_TYPE_SESSION, "uri", uri, NULL));
+			couchdb_session_enable_oauth (COUCHDB_SESSION (dc),
+						      oauth_c_key,
+						      oauth_c_secret,
+						      oauth_t_key,
+						      oauth_t_secret);
 
 			g_free (oauth_c_key);
 			g_free (oauth_c_secret);
diff --git a/desktopcouch-glib/desktopcouch-session.h b/desktopcouch-glib/desktopcouch-session.h
index e697ee4..1f1cd0e 100644
--- a/desktopcouch-glib/desktopcouch-session.h
+++ b/desktopcouch-glib/desktopcouch-session.h
@@ -19,30 +19,30 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#ifndef __DESKTOPCOUCH_H__
-#define __DESKTOPCOUCH_H__
+#ifndef __DESKTOPCOUCH_SESSION_H__
+#define __DESKTOPCOUCH_SESSION_H__
 
 #include <couchdb-glib.h>
 
 G_BEGIN_DECLS
 
-#define DESKTOPCOUCH_TYPE                (desktopcouch_get_type ())
-#define DESKTOPCOUCH(obj)                (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOPCOUCH_TYPE, Desktopcouch))
-#define DESKTOPCOUCH_IS(obj)             (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOPCOUCH_TYPE))
-#define DESKTOPCOUCH_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOPCOUCH_TYPE, DesktopcouchClass))
-#define DESKTOPCOUCH_IS_CLASS(klass)     (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOPCOUCH_TYPE))
-#define DESKTOPCOUCH_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOPCOUCH_TYPE, DesktopouchClass))
+#define DESKTOPCOUCH_TYPE_SESSION                (desktopcouch_session_get_type ())
+#define DESKTOPCOUCH_SESSION(obj)                (G_TYPE_CHECK_INSTANCE_CAST ((obj), DESKTOPCOUCH_TYPE_SESSION, DesktopcouchSession))
+#define DESKTOPCOUCH_IS_SESSION(obj)             (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DESKTOPCOUCH_TYPE_SESSION))
+#define DESKTOPCOUCH_SESSION_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST ((klass), DESKTOPCOUCH_TYPE_SESSION, DesktopcouchSessionClass))
+#define DESKTOPCOUCH_IS_SESSION_CLASS(klass)     (G_TYPE_CHECK_CLASS_TYPE ((klass), DESKTOPCOUCH_TYPE_SESSION))
+#define DESKTOPCOUCH_SESSION_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS ((obj), DESKTOPCOUCH_TYPE_SESSION, DesktopouchSessionClass))
 
 typedef struct {
-	Couchdb parent;
-} Desktopcouch;
+	CouchdbSession parent;
+} DesktopcouchSession;
 
 typedef struct {
-	CouchdbClass parent_class;
-} DesktopcouchClass;
+	CouchdbSessionClass parent_class;
+} DesktopcouchSessionClass;
 
-GType         desktopcouch_get_type (void);
-Desktopcouch *desktopcouch_new (void);
+GType                desktopcouch_session_get_type (void);
+DesktopcouchSession *desktopcouch_session_new (void);
 
 G_END_DECLS
 
diff --git a/tests/test-couchdb-glib.c b/tests/test-couchdb-glib.c
index 816a917..cc283ef 100644
--- a/tests/test-couchdb-glib.c
+++ b/tests/test-couchdb-glib.c
@@ -22,7 +22,7 @@
 #include <couchdb-glib.h>
 #include <utils.h>
 
-static Couchdb *couchdb;
+static CouchdbSession *couchdb;
 
 static void
 test_list_databases (void)
@@ -30,7 +30,7 @@ test_list_databases (void)
 	GError *error = NULL;
 	GSList *dblist;
 
-	dblist = couchdb_list_databases (couchdb, &error);
+	dblist = couchdb_session_list_databases (couchdb, &error);
 	if (error != NULL) {
 		/* A critical will abort the test case */
 		g_critical ("Error listing databases: %s", error->message);
@@ -43,18 +43,18 @@ test_list_databases (void)
 		GSList *doclist;
 
 		error = NULL;
-		dbinfo = couchdb_get_database_info (couchdb, (const char *) dblist->data, &error);
+		dbinfo = couchdb_session_get_database_info (couchdb, (const char *) dblist->data, &error);
 		g_assert (error == NULL);
 		g_assert (dbinfo != NULL);
 		g_assert (couchdb_database_info_get_dbname (dbinfo) != NULL);
 
 		/* Get list of documents to compare against couchdb_database_info_get_documents_count */
 		error = NULL;
-		doclist = couchdb_list_documents (couchdb, (const char *) dblist->data, &error);
+		doclist = couchdb_session_list_documents (couchdb, (const char *) dblist->data, &error);
 		g_assert (error == NULL);
 		g_assert (g_slist_length (doclist) == couchdb_database_info_get_documents_count (dbinfo));
 		if (doclist)
-			couchdb_free_document_list (doclist);
+			couchdb_session_free_document_list (doclist);
 
 		dblist = g_slist_remove (dblist, dblist->data);
 		couchdb_database_info_unref (dbinfo);
@@ -67,14 +67,14 @@ test_list_documents (void)
 	GError *error = NULL;
 	GSList *dblist;
 
-	dblist = couchdb_list_databases (couchdb, &error);
+	dblist = couchdb_session_list_databases (couchdb, &error);
 	g_assert (error == NULL);
 
 	while (dblist != NULL) {
 		GSList *doclist;
 
 		error = NULL;
-		doclist = couchdb_list_documents (couchdb, (const char *) dblist->data, &error);
+		doclist = couchdb_session_list_documents (couchdb, (const char *) dblist->data, &error);
 		g_assert (error == NULL);
 
 		while (doclist) {
@@ -116,13 +116,13 @@ test_change_databases (void)
 	g_assert (dbname != NULL);
 
 	/* Create database */
-	couchdb_create_database (couchdb, dbname, &error);
+	couchdb_session_create_database (couchdb, dbname, &error);
 	if (error) {
 		g_critical ("Error creating database '%s': %s", dbname, error->message);
 		g_error_free (error);
 	}
 
-	couchdb_listen_for_changes (couchdb, dbname);
+	couchdb_session_listen_for_changes (couchdb, dbname);
 
 	/* Create some documents */
 	for (i = 0; i < 10; i++) {
@@ -145,7 +145,7 @@ test_change_databases (void)
 	}
 	
 	/* Delete database */
-	g_assert (couchdb_delete_database (couchdb, dbname, &error));
+	g_assert (couchdb_session_delete_database (couchdb, dbname, &error));
 	g_assert (error == NULL);
 
 	/* Free memory */
@@ -153,19 +153,19 @@ test_change_databases (void)
 }
 
 static void
-db_created_cb (Couchdb *couchdb, const char *dbname, gpointer user_data)
+db_created_cb (CouchdbSession *couchdb, const char *dbname, gpointer user_data)
 {
 	g_print ("Database %s has been created\n", dbname);
 }
 
 static void
-db_deleted_cb (Couchdb *couchdb, const char *dbname, gpointer user_data)
+db_deleted_cb (CouchdbSession *couchdb, const char *dbname, gpointer user_data)
 {
 	g_print ("Database %s has been deleted\n", dbname);
 }
 
 static void
-doc_changed_cb (Couchdb *couchdb, const char *dbname, CouchdbDocument *document, gpointer user_data)
+doc_changed_cb (CouchdbSession *couchdb, const char *dbname, CouchdbDocument *document, gpointer user_data)
 {
 	char *doc_str;
 
@@ -179,7 +179,7 @@ doc_changed_cb (Couchdb *couchdb, const char *dbname, CouchdbDocument *document,
 }
 
 static void
-doc_deleted_cb (Couchdb *couchdb, const char *dbname, const char *docid, gpointer user_data)
+doc_deleted_cb (CouchdbSession *couchdb, const char *dbname, const char *docid, gpointer user_data)
 {
 	g_print ("Document %s in database %s has been deleted\n", docid, dbname);
 }
@@ -192,8 +192,8 @@ main (int argc, char *argv[])
 	g_test_init (&argc, &argv, NULL);
 
 	/* Initialize data needed for all tests */
-	couchdb =  argc > 1 ? couchdb_new (argv[1]) : couchdb_new (NULL);
-	g_printf ("Connecting to Couchdb at %s\n", couchdb_get_uri (couchdb));
+	couchdb =  argc > 1 ? couchdb_session_new (argv[1]) : couchdb_session_new (NULL);
+	g_printf ("Connecting to Couchdb at %s\n", couchdb_session_get_uri (couchdb));
 	
 	if (!couchdb) {
 		g_print ("Could not create Couchdb object\n");
diff --git a/tests/test-desktopcouch-glib.c b/tests/test-desktopcouch-glib.c
index 672f874..d8bb659 100644
--- a/tests/test-desktopcouch-glib.c
+++ b/tests/test-desktopcouch-glib.c
@@ -21,14 +21,14 @@
 
 #include <desktopcouch-glib.h>
 
-static Desktopcouch *dc = NULL;
+static DesktopcouchSession *dc = NULL;
 
 static void
 test_connect_desktopcouch (void)
 {
-	dc = desktopcouch_new ();
+	dc = desktopcouch_session_new ();
 
-	g_assert (DESKTOPCOUCH_IS (dc));
+	g_assert (DESKTOPCOUCH_IS_SESSION (dc));
 }
 
 int
diff --git a/tests/test-list-databases.c b/tests/test-list-databases.c
index 4a534e8..34086f4 100644
--- a/tests/test-list-databases.c
+++ b/tests/test-list-databases.c
@@ -24,7 +24,7 @@
 int
 main (int argc, char *argv[])
 {
-	Couchdb *couchdb;
+	CouchdbSession *couchdb;
 	GSList *dblist, *sl;
 	GError *error = NULL;
 
@@ -33,15 +33,15 @@ main (int argc, char *argv[])
 	g_thread_init (NULL);
 
 	/* Initialize Couchdb */
-	couchdb =  argc > 1 ? couchdb_new (argv[1]) : couchdb_new (NULL);
-	g_printf ("Connecting to Couchdb at %s\n", couchdb_get_uri (couchdb));
+	couchdb =  argc > 1 ? couchdb_session_new (argv[1]) : couchdb_session_new (NULL);
+	g_printf ("Connecting to Couchdb at %s\n", couchdb_session_get_uri (couchdb));
 	
 	if (!couchdb) {
 		g_print ("Could not create Couchdb object\n");
 		return -1;
 	}
 
-	dblist = couchdb_list_databases (couchdb, &error);
+	dblist = couchdb_session_list_databases (couchdb, &error);
 	if (error != NULL) {
 		g_critical ("Error listing databases: %s", error->message);
 		g_error_free (error);
@@ -53,7 +53,7 @@ main (int argc, char *argv[])
 
 		error = NULL;
 		g_print ("Found database %s\n", (const char *) sl->data);
-		dbinfo = couchdb_get_database_info (couchdb, (const char *) sl->data, &error);
+		dbinfo = couchdb_session_get_database_info (couchdb, (const char *) sl->data, &error);
 		if (dbinfo) {
 			g_print ("\tDatabase name: %s\n",
 				 couchdb_database_info_get_dbname (dbinfo));
@@ -75,7 +75,7 @@ main (int argc, char *argv[])
 
 		/* now, get list of documents */
 		error = NULL;
-		doclist = couchdb_list_documents (couchdb, (const char *) sl->data, &error);
+		doclist = couchdb_session_list_documents (couchdb, (const char *) sl->data, &error);
 		if (doclist) {
 			GSList *sl_doc;
 
@@ -112,7 +112,7 @@ main (int argc, char *argv[])
 		}
 	}
 
-	couchdb_free_database_list (dblist);
+	couchdb_session_free_database_list (dblist);
 	g_object_unref (G_OBJECT (couchdb));
 
 	return 0;
diff --git a/tests/test-oauth.c b/tests/test-oauth.c
index 913156c..4d82f7e 100644
--- a/tests/test-oauth.c
+++ b/tests/test-oauth.c
@@ -66,7 +66,7 @@ main (int argc, char *argv[])
 	char *c_key, *c_secret, *t_key, *t_secret, *url, *method, *nonce, *timestamp;
 	char *liboauth_signed;
 	char *command_line, *command_line_output;
-	Couchdb *couchdb;
+	CouchdbSession *couchdb;
 	GSList *db_list;
 	GError *error = NULL;
 
@@ -111,10 +111,10 @@ main (int argc, char *argv[])
 	g_type_init ();
 	g_thread_init (NULL);
 
-	couchdb = couchdb_new (url);
-	couchdb_enable_oauth (couchdb, c_key, c_secret, t_key, t_secret);
+	couchdb = couchdb_session_new (url);
+	couchdb_session_enable_oauth (couchdb, c_key, c_secret, t_key, t_secret);
 
-	db_list = couchdb_list_databases (couchdb, &error);
+	db_list = couchdb_session_list_databases (couchdb, &error);
 	if (db_list != NULL) {
 		GSList *sl;
 
@@ -122,7 +122,7 @@ main (int argc, char *argv[])
 			g_print ("Found database %s\n", (const char *) sl->data);
 		}
 
-		couchdb_free_database_list (db_list);
+		couchdb_session_free_database_list (db_list);
 	} else if (error != NULL) {
 		g_print ("Could not get list of databases: %s\n", error->message);
 		g_error_free (error);



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