[evolution-data-server/camel-gobject-do-not-rebase: 7/7] Fix Camel tests and "make check" errors.



commit f52fcd30da92444ac71c37762670b0e9e69de695
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sat Nov 28 14:14:08 2009 -0500

    Fix Camel tests and "make check" errors.

 camel/tests/folder/test1.c             |    9 +--
 camel/tests/folder/test10.c            |   21 ++----
 camel/tests/folder/test11.c            |   70 +++++++++-------
 camel/tests/folder/test2.c             |   13 +---
 camel/tests/folder/test3.c             |   76 +++++++++---------
 camel/tests/folder/test4.c             |    9 +--
 camel/tests/folder/test5.c             |    9 +--
 camel/tests/folder/test6.c             |   13 +---
 camel/tests/folder/test7.c             |   13 +---
 camel/tests/folder/test8.c             |   58 ++++++-------
 camel/tests/folder/test9.c             |   58 ++++++-------
 camel/tests/lib/addresses.h            |    2 +-
 camel/tests/lib/camel-test-provider.c  |   13 ++--
 camel/tests/lib/camel-test-provider.h  |    2 +-
 camel/tests/lib/camel-test.c           |    9 +-
 camel/tests/lib/camel-test.h           |    4 +-
 camel/tests/lib/folders.c              |  144 +++++++++++++++++---------------
 camel/tests/lib/folders.h              |    7 +--
 camel/tests/lib/messages.c             |   67 ++++++++-------
 camel/tests/lib/messages.h             |    2 +-
 camel/tests/lib/session.c              |   18 +---
 camel/tests/lib/session.h              |    2 +-
 camel/tests/lib/streams.c              |    4 -
 camel/tests/lib/streams.h              |    2 +-
 camel/tests/message/test1.c            |    4 +-
 camel/tests/message/test2.c            |    3 +-
 camel/tests/message/test3.c            |   21 ++---
 camel/tests/message/test4.c            |    5 +-
 camel/tests/mime-filter/test-charset.c |    5 +-
 camel/tests/mime-filter/test-crlf.c    |    5 +-
 camel/tests/mime-filter/test-tohtml.c  |   39 +++++----
 camel/tests/mime-filter/test1.c        |   23 +++---
 camel/tests/misc/rfc2047.c             |    4 +-
 camel/tests/misc/split.c               |    8 +-
 camel/tests/misc/test1.c               |    8 +-
 camel/tests/misc/test2.c               |   12 ++--
 camel/tests/misc/url-scan.c            |    4 +-
 camel/tests/misc/url.c                 |   17 ++--
 camel/tests/misc/utf7.c                |    5 +-
 camel/tests/smime/pgp.c                |   68 +++++++--------
 camel/tests/stream/test1.c             |   11 ++-
 camel/tests/stream/test2.c             |   11 +--
 camel/tests/stream/test3.c             |    7 +-
 po/POTFILES.in                         |    1 -
 44 files changed, 404 insertions(+), 482 deletions(-)
---
diff --git a/camel/tests/folder/test1.c b/camel/tests/folder/test1.c
index af9ee01..6ea9adc 100644
--- a/camel/tests/folder/test1.c
+++ b/camel/tests/folder/test1.c
@@ -5,14 +5,13 @@
 #include "folders.h"
 #include "session.h"
 
-#include <camel/camel-service.h>
-#include <camel/camel-store.h>
+#include <camel/camel.h>
 
 static const gchar *local_drivers[] = {
 	"local"
 };
 
-static gchar *local_providers[] = {
+static const gchar *local_providers[] = {
 	"mbox",
 	"mh",
 	"maildir"
@@ -21,15 +20,12 @@ static gchar *local_providers[] = {
 gint main(gint argc, gchar **argv)
 {
 	CamelSession *session;
-	CamelException *ex;
 	gint i;
 	gchar *path;
 
 	camel_test_init(argc, argv);
 	camel_test_provider_init(1, local_drivers);
 
-	ex = camel_exception_new();
-
 	/* clear out any camel-test data */
 	system("/bin/rm -rf /tmp/camel-test");
 
@@ -47,7 +43,6 @@ gint main(gint argc, gchar **argv)
 	}
 
 	g_object_unref (session);
-	camel_exception_free(ex);
 
 	return 0;
 }
diff --git a/camel/tests/folder/test10.c b/camel/tests/folder/test10.c
index 24f185b..804dec3 100644
--- a/camel/tests/folder/test10.c
+++ b/camel/tests/folder/test10.c
@@ -9,8 +9,7 @@
 #include "messages.h"
 #include "session.h"
 
-#include <camel/camel-service.h>
-#include <camel/camel-store.h>
+#include <camel/camel.h>
 
 #define MAX_LOOP (10000)
 #define MAX_THREADS (5)
@@ -18,7 +17,7 @@
 #define d(x)
 
 static const gchar *local_drivers[] = { "local" };
-static gchar *local_providers[] = {
+static const gchar *local_providers[] = {
 	"mbox",
 	"mh",
 	"maildir"
@@ -32,15 +31,12 @@ static gpointer
 worker(gpointer d)
 {
 	gint i;
-	CamelException *ex = camel_exception_new();
 	CamelStore *store;
 	CamelFolder *folder;
 
 	for (i=0;i<MAX_LOOP;i++) {
-		store = camel_session_get_store(session, path, ex);
-		camel_exception_clear(ex);
-		folder = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, ex);
-		camel_exception_clear(ex);
+		store = camel_session_get_store(session, path, NULL);
+		folder = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, NULL);
 		if (testid == 0) {
 			g_object_unref (folder);
 			g_object_unref (store);
@@ -50,22 +46,18 @@ worker(gpointer d)
 		}
 	}
 
-	camel_exception_free(ex);
-
 	return NULL;
 }
 
-gint main(gint argc, gchar **argv)
+gint
+main(gint argc, gchar **argv)
 {
-	CamelException *ex;
 	gint i, j;
 	pthread_t threads[MAX_THREADS];
 
 	camel_test_init(argc, argv);
 	camel_test_provider_init(1, local_drivers);
 
-	ex = camel_exception_new();
-
 	/* clear out any camel-test data */
 	system("/bin/rm -rf /tmp/camel-test");
 
@@ -97,7 +89,6 @@ gint main(gint argc, gchar **argv)
 	}
 
 	g_object_unref (session);
-	camel_exception_free(ex);
 
 	return 0;
 }
diff --git a/camel/tests/folder/test11.c b/camel/tests/folder/test11.c
index ab775a8..8c58b00 100644
--- a/camel/tests/folder/test11.c
+++ b/camel/tests/folder/test11.c
@@ -8,8 +8,7 @@
 #include "camel-test-provider.h"
 #include "session.h"
 
-#include <camel/camel-service.h>
-#include <camel/camel-store.h>
+#include <camel/camel.h>
 
 #define MAX_LOOP (10000)
 #define MAX_THREADS (5)
@@ -96,84 +95,93 @@ check_fi(CamelFolderInfo *fi, CamelFolderInfo *list, gint len)
 	g_ptr_array_free(folders, TRUE);
 }
 
-gint main(gint argc, gchar **argv)
+gint
+main(gint argc, gchar **argv)
 {
-	CamelException *ex;
 	CamelFolder *f1, *f2;
 	CamelStore *store;
 	CamelFolderInfo *fi;
+	GError *error = NULL;
 
 	camel_test_init(argc, argv);
 	camel_test_provider_init(1, local_drivers);
 
-	ex = camel_exception_new();
-
 	/* clear out any camel-test data */
 	system("/bin/rm -rf /tmp/camel-test");
 
 	session = camel_test_session_new("/tmp/camel-test");
-	store = camel_session_get_store(session, "maildir:///tmp/camel-test/maildir", ex);
-	camel_exception_clear(ex);
+	store = camel_session_get_store(session, "maildir:///tmp/camel-test/maildir", NULL);
 
 	camel_test_start("Maildir backward compatability tests");
 
 	camel_test_push("./ prefix path, one level");
-	f1 = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, ex);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
-	f2 = camel_store_get_folder(store, "./testbox", CAMEL_STORE_FOLDER_CREATE, ex);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+	f1 = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, &error);
+	check_msg(error == NULL, "%s", error->message);
+	g_clear_error (&error);
+	f2 = camel_store_get_folder(store, "./testbox", CAMEL_STORE_FOLDER_CREATE, &error);
+	check_msg(error == NULL, "%s", error->message);
+	g_clear_error (&error);
 	check(f1 == f2);
 	check_unref(f2, 2);
 	check_unref(f1, 1);
 	camel_test_pull();
 
 	camel_test_push("./ prefix path, one level, no create");
-	f1 = camel_store_get_folder(store, "testbox2", CAMEL_STORE_FOLDER_CREATE, ex);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
-	f2 = camel_store_get_folder(store, "./testbox2", 0, ex);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+	f1 = camel_store_get_folder(store, "testbox2", CAMEL_STORE_FOLDER_CREATE, &error);
+	check_msg(error == NULL, "%s", error->message);
+	g_clear_error (&error);
+	f2 = camel_store_get_folder(store, "./testbox2", 0, &error);
+	check_msg(error == NULL, "%s", error->message);
+	g_clear_error (&error);
 	check(f1 == f2);
 	check_unref(f2, 2);
 	check_unref(f1, 1);
 	camel_test_pull();
 
 	camel_test_push("./ prefix path, two levels");
-	f1 = camel_store_get_folder(store, "testbox/foo", CAMEL_STORE_FOLDER_CREATE, ex);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
-	f2 = camel_store_get_folder(store, "./testbox/foo", CAMEL_STORE_FOLDER_CREATE, ex);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+	f1 = camel_store_get_folder(store, "testbox/foo", CAMEL_STORE_FOLDER_CREATE, &error);
+	check_msg(error == NULL, "%s", error->message);
+	g_clear_error (&error);
+	f2 = camel_store_get_folder(store, "./testbox/foo", CAMEL_STORE_FOLDER_CREATE, &error);
+	check_msg(error == NULL, "%s", error->message);
+	g_clear_error (&error);
 	check(f1 == f2);
 	check_unref(f2, 2);
 	check_unref(f1, 1);
 	camel_test_pull();
 
 	camel_test_push("'.' == Inbox");
-	f2 = camel_store_get_inbox(store, ex);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
-	f1 = camel_store_get_folder(store, ".", 0, ex);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+	f2 = camel_store_get_inbox(store, &error);
+	check_msg(error == NULL, "%s", error->message);
+	g_clear_error (&error);
+	f1 = camel_store_get_folder(store, ".", 0, &error);
+	check_msg(error == NULL, "%s", error->message);
+	g_clear_error (&error);
 	check(f1 == f2);
 	check_unref(f2, 2);
 	check_unref(f1, 1);
 	camel_test_pull();
 
 	camel_test_push("folder info, recursive");
-	fi = camel_store_get_folder_info(store, "", CAMEL_STORE_FOLDER_INFO_RECURSIVE, ex);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+	fi = camel_store_get_folder_info(store, "", CAMEL_STORE_FOLDER_INFO_RECURSIVE, &error);
+	check_msg(error == NULL, "%s", error->message);
+	g_clear_error (&error);
 	check(fi != NULL);
 	check_fi(fi, fi_list_1, G_N_ELEMENTS (fi_list_1));
 	camel_test_pull();
 
 	camel_test_push("folder info, flat");
-	fi = camel_store_get_folder_info(store, "", 0, ex);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+	fi = camel_store_get_folder_info(store, "", 0, &error);
+	check_msg(error == NULL, "%s", error->message);
+	g_clear_error (&error);
 	check(fi != NULL);
 	check_fi(fi, fi_list_2, G_N_ELEMENTS (fi_list_2));
 	camel_test_pull();
 
 	camel_test_push("folder info, recursive, non root");
-	fi = camel_store_get_folder_info(store, "testbox", CAMEL_STORE_FOLDER_INFO_RECURSIVE, ex);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+	fi = camel_store_get_folder_info(store, "testbox", CAMEL_STORE_FOLDER_INFO_RECURSIVE, &error);
+	check_msg(error == NULL, "%s", error->message);
+	g_clear_error (&error);
 	check(fi != NULL);
 	check_fi(fi, fi_list_3, G_N_ELEMENTS (fi_list_3));
 	camel_test_pull();
@@ -181,8 +189,6 @@ gint main(gint argc, gchar **argv)
 	check_unref(store, 1);
 	check_unref(session, 1);
 
-	camel_exception_free(ex);
-
 	camel_test_end();
 
 	return 0;
diff --git a/camel/tests/folder/test2.c b/camel/tests/folder/test2.c
index 849ced1..297535a 100644
--- a/camel/tests/folder/test2.c
+++ b/camel/tests/folder/test2.c
@@ -10,16 +10,11 @@
 #include "folders.h"
 #include "session.h"
 
-#include <camel/camel-service.h>
-#include <camel/camel-store.h>
-
-#include <camel/camel-folder.h>
-#include <camel/camel-folder-summary.h>
-#include <camel/camel-mime-message.h>
+#include <camel/camel.h>
 
 static const gchar *local_drivers[] = { "local" };
 
-static gchar *stores[] = {
+static const gchar *stores[] = {
 	"mbox:///tmp/camel-test/mbox",
 	"mh:///tmp/camel-test/mh",
 	"maildir:///tmp/camel-test/maildir"
@@ -28,7 +23,6 @@ static gchar *stores[] = {
 gint main(gint argc, gchar **argv)
 {
 	CamelSession *session;
-	CamelException *ex;
 	gint i;
 
 	camel_test_init(argc, argv);
@@ -37,8 +31,6 @@ gint main(gint argc, gchar **argv)
 	/* clear out any camel-test data */
 	system("/bin/rm -rf /tmp/camel-test");
 
-	ex = camel_exception_new();
-
 	session = camel_test_session_new ("/tmp/camel-test");
 
 	/* we iterate over all stores we want to test, with indexing or indexing turned on or off */
@@ -53,7 +45,6 @@ gint main(gint argc, gchar **argv)
 	test_folder_message_ops(session, "spool:///tmp/camel-test/testbox", TRUE, "INBOX");
 
 	check_unref(session, 1);
-	camel_exception_free(ex);
 
 	return 0;
 }
diff --git a/camel/tests/folder/test3.c b/camel/tests/folder/test3.c
index 81e54a8..c7e92aa 100644
--- a/camel/tests/folder/test3.c
+++ b/camel/tests/folder/test3.c
@@ -8,25 +8,21 @@
 #include "folders.h"
 #include "session.h"
 
-#include <camel/camel-service.h>
-#include <camel/camel-store.h>
-
-#include <camel/camel-folder.h>
-#include <camel/camel-folder-summary.h>
-#include <camel/camel-mime-message.h>
+#include <camel/camel.h>
 
 static void
 test_folder_search_sub(CamelFolder *folder, const gchar *expr, gint expected)
 {
-	CamelException *ex = camel_exception_new();
 	GPtrArray *uids;
 	GHashTable *hash;
 	gint i;
+	GError *error = NULL;
 
-	uids = camel_folder_search_by_expression(folder, expr, ex);
+	uids = camel_folder_search_by_expression(folder, expr, &error);
 	check(uids != NULL);
 	check_msg(uids->len == expected, "search %s expected %d got %d", expr, expected, uids->len);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+	check_msg(error == NULL, "%s", error->message);
+	g_clear_error (&error);
 
 	/* check the uid's are actually unique, too */
 	hash = g_hash_table_new(g_str_hash, g_str_equal);
@@ -37,8 +33,6 @@ test_folder_search_sub(CamelFolder *folder, const gchar *expr, gint expected)
 	g_hash_table_destroy(hash);
 
 	camel_folder_search_free(folder, uids);
-
-	camel_exception_free(ex);
 }
 
 static void
@@ -64,7 +58,7 @@ test_folder_search(CamelFolder *folder, const gchar *expr, gint expected)
 
 static struct {
 	gint counts[3];
-	gchar *expr;
+	const gchar *expr;
 } searches[] = {
 	{ { 1, 1, 0 }, "(header-matches \"subject\" \"Test1 message99 subject\")" },
 
@@ -137,7 +131,7 @@ run_search(CamelFolder *folder, gint m)
 
 static const gchar *local_drivers[] = { "local" };
 
-static gchar *stores[] = {
+static const gchar *stores[] = {
 	"mbox:///tmp/camel-test/mbox",
 	"mh:///tmp/camel-test/mh",
 	"maildir:///tmp/camel-test/maildir"
@@ -147,18 +141,16 @@ gint main(gint argc, gchar **argv)
 {
 	CamelSession *session;
 	CamelStore *store;
-	CamelException *ex;
 	CamelFolder *folder;
 	CamelMimeMessage *msg;
 	gint i, j;
 	gint indexed;
 	GPtrArray *uids;
+	GError *error = NULL;
 
 	camel_test_init(argc, argv);
 	camel_test_provider_init(1, local_drivers);
 
-	ex = camel_exception_new();
-
 	/* clear out any camel-test data */
 	system("/bin/rm -rf /tmp/camel-test");
 
@@ -169,7 +161,7 @@ gint main(gint argc, gchar **argv)
 
 	/* we iterate over all stores we want to test, with indexing or indexing turned on or off */
 	for (i = 0; i < G_N_ELEMENTS (stores); i++) {
-		gchar *name = stores[i];
+		const gchar *name = stores[i];
 		for (indexed = 0;indexed<2;indexed++) {
 			gchar *what = g_strdup_printf("folder search: %s (%sindexed)", name, indexed?"":"non-");
 			gint flags;
@@ -178,9 +170,10 @@ gint main(gint argc, gchar **argv)
 			test_free(what);
 
 			push("getting store");
-			store = camel_session_get_store(session, stores[i], ex);
-			check_msg(!camel_exception_is_set(ex), "getting store: %s", camel_exception_get_description(ex));
+			store = camel_session_get_store(session, stores[i], &error);
+			check_msg(error == NULL, "getting store: %s", error->message);
 			check(store != NULL);
+			g_clear_error (&error);
 			pull();
 
 			push("creating %sindexed folder", indexed?"":"non-");
@@ -188,12 +181,13 @@ gint main(gint argc, gchar **argv)
 				flags = CAMEL_STORE_FOLDER_CREATE|CAMEL_STORE_FOLDER_BODY_INDEX;
 			else
 				flags = CAMEL_STORE_FOLDER_CREATE;
-			folder = camel_store_get_folder(store, "testbox", flags, ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			folder = camel_store_get_folder(store, "testbox", flags, &error);
+			check_msg(error == NULL, "%s", error->message);
 			check(folder != NULL);
 
 			/* we need an empty folder for this to work */
 			test_folder_counts(folder, 0, 0);
+			g_clear_error (&error);
 			pull();
 
 			/* append a bunch of messages with specific content */
@@ -214,8 +208,9 @@ gint main(gint argc, gchar **argv)
 				pull();
 
 				push("appending simple message %d", j);
-				camel_folder_append_message(folder, msg, NULL, NULL, ex);
-				check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+				camel_folder_append_message(folder, msg, NULL, NULL, &error);
+				check_msg(error == NULL, "%s", error->message);
+				g_clear_error (&error);
 				pull();
 
 				test_free(subject);
@@ -255,12 +250,12 @@ gint main(gint argc, gchar **argv)
 			camel_test_fatal();
 
 			push("syncing folder, searching");
-			camel_folder_sync(folder, FALSE, ex);
+			camel_folder_sync(folder, FALSE, NULL);
 			run_search(folder, 100);
 			pull();
 
 			push("syncing wiht expunge, search");
-			camel_folder_sync(folder, TRUE, ex);
+			camel_folder_sync(folder, TRUE, NULL);
 			run_search(folder, 100);
 			pull();
 
@@ -274,24 +269,27 @@ gint main(gint argc, gchar **argv)
 			run_search(folder, 100);
 
 			push("syncing");
-			camel_folder_sync(folder, FALSE, ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			camel_folder_sync(folder, FALSE, &error);
+			check_msg(error == NULL, "%s", error->message);
 			run_search(folder, 100);
+			g_clear_error (&error);
 			pull();
 
 			push("expunging");
-			camel_folder_expunge(folder, ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			camel_folder_expunge(folder, &error);
+			check_msg(error == NULL, "%s", error->message);
 			run_search(folder, 50);
+			g_clear_error (&error);
 			pull();
 
 			pull();
 
 			push("closing and re-opening folder");
 			check_unref(folder, 1);
-			folder = camel_store_get_folder(store, "testbox", flags&~(CAMEL_STORE_FOLDER_CREATE), ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			folder = camel_store_get_folder(store, "testbox", flags&~(CAMEL_STORE_FOLDER_CREATE), &error);
+			check_msg(error == NULL, "%s", error->message);
 			check(folder != NULL);
+			g_clear_error (&error);
 
 			push("deleting remaining messages");
 			uids = camel_folder_get_uids(folder);
@@ -303,15 +301,17 @@ gint main(gint argc, gchar **argv)
 			run_search(folder, 50);
 
 			push("syncing");
-			camel_folder_sync(folder, FALSE, ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			camel_folder_sync(folder, FALSE, &error);
+			check_msg(error == NULL, "%s", error->message);
 			run_search(folder, 50);
+			g_clear_error (&error);
 			pull();
 
 			push("expunging");
-			camel_folder_expunge(folder, ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			camel_folder_expunge(folder, &error);
+			check_msg(error == NULL, "%s", error->message);
 			run_search(folder, 0);
+			g_clear_error (&error);
 			pull();
 
 			pull();
@@ -320,8 +320,9 @@ gint main(gint argc, gchar **argv)
 			pull();
 
 			push("deleting test folder, with no messages in it");
-			camel_store_delete_folder(store, "testbox", ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			camel_store_delete_folder(store, "testbox", &error);
+			check_msg(error == NULL, "%s", error->message);
+			g_clear_error (&error);
 			pull();
 
 			check_unref(store, 1);
@@ -330,7 +331,6 @@ gint main(gint argc, gchar **argv)
 	}
 
 	check_unref(session, 1);
-	camel_exception_free(ex);
 
 	return 0;
 }
diff --git a/camel/tests/folder/test4.c b/camel/tests/folder/test4.c
index 5dc53d0..00eab82 100644
--- a/camel/tests/folder/test4.c
+++ b/camel/tests/folder/test4.c
@@ -5,27 +5,23 @@
 #include "folders.h"
 #include "session.h"
 
-#include <camel/camel-service.h>
-#include <camel/camel-store.h>
+#include <camel/camel.h>
 
 static const gchar *imap_drivers[] = { "imap4" };
 
-static gchar *remote_providers[] = {
+static const gchar *remote_providers[] = {
 	"IMAP_TEST_URL",
 };
 
 gint main(gint argc, gchar **argv)
 {
 	CamelSession *session;
-	CamelException *ex;
 	gint i;
 	gchar *path;
 
 	camel_test_init(argc, argv);
 	camel_test_provider_init(1, imap_drivers);
 
-	ex = camel_exception_new();
-
 	/* clear out any camel-test data */
 	system("/bin/rm -rf /tmp/camel-test");
 
@@ -48,7 +44,6 @@ gint main(gint argc, gchar **argv)
 	}
 
 	g_object_unref (session);
-	camel_exception_free(ex);
 
 	return 0;
 }
diff --git a/camel/tests/folder/test5.c b/camel/tests/folder/test5.c
index 3f8ef24..1a81a81 100644
--- a/camel/tests/folder/test5.c
+++ b/camel/tests/folder/test5.c
@@ -5,27 +5,23 @@
 #include "folders.h"
 #include "session.h"
 
-#include <camel/camel-service.h>
-#include <camel/camel-store.h>
+#include <camel/camel.h>
 
 static const gchar *nntp_drivers[] = { "nntp" };
 
-static gchar *remote_providers[] = {
+static const gchar *remote_providers[] = {
 	"NNTP_TEST_URL",
 };
 
 gint main(gint argc, gchar **argv)
 {
 	CamelSession *session;
-	CamelException *ex;
 	gint i;
 	gchar *path;
 
 	camel_test_init(argc, argv);
 	camel_test_provider_init(1, nntp_drivers);
 
-	ex = camel_exception_new();
-
 	/* clear out any camel-test data */
 	system("/bin/rm -rf /tmp/camel-test");
 
@@ -48,7 +44,6 @@ gint main(gint argc, gchar **argv)
 	}
 
 	g_object_unref (session);
-	camel_exception_free(ex);
 
 	return 0;
 }
diff --git a/camel/tests/folder/test6.c b/camel/tests/folder/test6.c
index cd1e657..ad04acf 100644
--- a/camel/tests/folder/test6.c
+++ b/camel/tests/folder/test6.c
@@ -5,22 +5,16 @@
 #include "folders.h"
 #include "session.h"
 
-#include <camel/camel-service.h>
-#include <camel/camel-store.h>
-
-#include <camel/camel-folder.h>
-#include <camel/camel-folder-summary.h>
-#include <camel/camel-mime-message.h>
+#include <camel/camel.h>
 
 static const gchar *imap_drivers[] = { "imap4" };
-static gchar *remote_providers[] = {
+static const gchar *remote_providers[] = {
 	"IMAP_TEST_URL",
 };
 
 gint main(gint argc, gchar **argv)
 {
 	CamelSession *session;
-	CamelException *ex;
 	gint i;
 	gchar *path;
 
@@ -30,8 +24,6 @@ gint main(gint argc, gchar **argv)
 	/* clear out any camel-test data */
 	system("/bin/rm -rf /tmp/camel-test");
 
-	ex = camel_exception_new();
-
 	session = camel_test_session_new ("/tmp/camel-test");
 
 	for (i = 0; i < G_N_ELEMENTS (remote_providers); i++) {
@@ -50,7 +42,6 @@ gint main(gint argc, gchar **argv)
 	}
 
 	check_unref(session, 1);
-	camel_exception_free(ex);
 
 	return 0;
 }
diff --git a/camel/tests/folder/test7.c b/camel/tests/folder/test7.c
index 2b97032..8f1bb0c 100644
--- a/camel/tests/folder/test7.c
+++ b/camel/tests/folder/test7.c
@@ -6,22 +6,16 @@
 #include "messages.h"
 #include "session.h"
 
-#include <camel/camel-service.h>
-#include <camel/camel-store.h>
-
-#include <camel/camel-folder.h>
-#include <camel/camel-folder-summary.h>
-#include <camel/camel-mime-message.h>
+#include <camel/camel.h>
 
 static const gchar *nntp_drivers[] = { "nntp" };
-static gchar *remote_providers[] = {
+static const gchar *remote_providers[] = {
 	"NNTP_TEST_URL",
 };
 
 gint main(gint argc, gchar **argv)
 {
 	CamelSession *session;
-	CamelException *ex;
 	gint i;
 	gchar *path;
 
@@ -31,8 +25,6 @@ gint main(gint argc, gchar **argv)
 	/* clear out any camel-test data */
 	system("/bin/rm -rf /tmp/camel-test");
 
-	ex = camel_exception_new();
-
 	session = camel_test_session_new ("/tmp/camel-test");
 
 	for (i = 0; i < G_N_ELEMENTS (remote_providers); i++) {
@@ -50,7 +42,6 @@ gint main(gint argc, gchar **argv)
 	}
 
 	check_unref(session, 1);
-	camel_exception_free(ex);
 
 	return 0;
 }
diff --git a/camel/tests/folder/test8.c b/camel/tests/folder/test8.c
index 203485f..9c6784e 100644
--- a/camel/tests/folder/test8.c
+++ b/camel/tests/folder/test8.c
@@ -9,8 +9,7 @@
 #include "messages.h"
 #include "session.h"
 
-#include <camel/camel-service.h>
-#include <camel/camel-store.h>
+#include <camel/camel.h>
 
 #define MAX_MESSAGES (100)
 #define MAX_THREADS (10)
@@ -19,7 +18,7 @@
 
 static const gchar *local_drivers[] = { "local" };
 
-static gchar *local_providers[] = {
+static const gchar *local_providers[] = {
 	"mbox",
 	"mh",
 	"maildir"
@@ -31,9 +30,7 @@ test_add_message(CamelFolder *folder, gint j)
 	CamelMimeMessage *msg;
 	gchar *content;
 	gchar *subject;
-	CamelException ex;
-
-	camel_exception_init(&ex);
+	GError *error = NULL;
 
 	push("creating message %d\n", j);
 	msg = test_message_create_simple();
@@ -46,8 +43,9 @@ test_add_message(CamelFolder *folder, gint j)
 	pull();
 
 	push("appending simple message %d", j);
-	camel_folder_append_message(folder, msg, NULL, NULL, &ex);
-	check_msg(!camel_exception_is_set(&ex), "%s", camel_exception_get_description(&ex));
+	camel_folder_append_message(folder, msg, NULL, NULL, &error);
+	check_msg(error == NULL, "%s", error->message);
+	g_clear_error (&error);
 	pull();
 
 	check_unref(msg, 1);
@@ -65,8 +63,8 @@ worker(gpointer d)
 	gint i, j, id = info->id;
 	gchar *sub, *content;
 	GPtrArray *res;
-	CamelException *ex = camel_exception_new();
 	CamelMimeMessage *msg;
+	GError *error = NULL;
 
 	/* we add a message, search for it, twiddle some flags, delete it */
 	/* and flat out */
@@ -77,14 +75,16 @@ worker(gpointer d)
 		sub = g_strdup_printf("(match-all (header-contains \"subject\" \"message %08x subject\"))", id+i);
 
 		push("searching for message %d\n\tusing: %s", id+i, sub);
-		res = camel_folder_search_by_expression(info->folder, sub, ex);
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		res = camel_folder_search_by_expression(info->folder, sub, &error);
+		check_msg(error == NULL, "%s", error->message);
 		check_msg(res->len == 1, "res->len = %d", res->len);
+		g_clear_error (&error);
 		pull();
 
 		push("getting message '%s'", res->pdata[0]);
-		msg = camel_folder_get_message(info->folder, (gchar *)res->pdata[0], ex);
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		msg = camel_folder_get_message(info->folder, (gchar *)res->pdata[0], &error);
+		check_msg(error == NULL, "%s", error->message);
+		g_clear_error (&error);
 		pull();
 
 		content = g_strdup_printf("Test message %08x contents\n\n", id+i);
@@ -111,21 +111,18 @@ worker(gpointer d)
 		if (j<=2) {
 			d(printf("Forcing an expuge\n"));
 			push("expunging folder");
-			camel_folder_expunge(info->folder, ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			camel_folder_expunge(info->folder, &error);
+			check_msg(error == NULL, "%s", error->message);
 			pull();
 		}
 	}
 
-	camel_exception_free(ex);
-
 	return info;
 }
 
 gint main(gint argc, gchar **argv)
 {
 	CamelSession *session;
-	CamelException *ex;
 	gint i, j, index;
 	gchar *path;
 	CamelStore *store;
@@ -133,12 +130,11 @@ gint main(gint argc, gchar **argv)
 	struct _threadinfo *info;
 	CamelFolder *folder;
 	GPtrArray *uids;
+	GError *error = NULL;
 
 	camel_test_init(argc, argv);
 	camel_test_provider_init(1, local_drivers);
 
-	ex = camel_exception_new();
-
 	/* clear out any camel-test data */
 	system("/bin/rm -rf /tmp/camel-test");
 
@@ -152,16 +148,18 @@ gint main(gint argc, gchar **argv)
 
 			push("trying %s index %d", local_providers[j], index);
 			path = g_strdup_printf("%s:///tmp/camel-test/%s", local_providers[j], local_providers[j]);
-			store = camel_session_get_store(session, path, ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			store = camel_session_get_store(session, path, &error);
+			check_msg(error == NULL, "%s", error->message);
+			g_clear_error (&error);
 			test_free(path);
 
 			if (index == 0)
-				folder = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, ex);
+				folder = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, &error);
 			else
 				folder = camel_store_get_folder(store, "testbox",
-								CAMEL_STORE_FOLDER_CREATE|CAMEL_STORE_FOLDER_BODY_INDEX, ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+								CAMEL_STORE_FOLDER_CREATE|CAMEL_STORE_FOLDER_BODY_INDEX, &error);
+			check_msg(error == NULL, "%s", error->message);
+			g_clear_error (&error);
 
 			for (i=0;i<MAX_THREADS;i++) {
 				info = g_malloc(sizeof(*info));
@@ -183,13 +181,14 @@ gint main(gint argc, gchar **argv)
 			}
 			camel_folder_free_uids(folder, uids);
 
-			camel_folder_expunge(folder, ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			camel_folder_expunge(folder, &error);
+			check_msg(error == NULL, "%s", error->message);
 
 			check_unref(folder, 1);
 
-			camel_store_delete_folder(store, "testbox", ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			camel_store_delete_folder(store, "testbox", &error);
+			check_msg(error == NULL, "%s", error->message);
+			g_clear_error (&error);
 
 			check_unref(store, 1);
 
@@ -200,7 +199,6 @@ gint main(gint argc, gchar **argv)
 	}
 
 	g_object_unref (session);
-	camel_exception_free(ex);
 
 	return 0;
 }
diff --git a/camel/tests/folder/test9.c b/camel/tests/folder/test9.c
index aa1f4ba..979e475 100644
--- a/camel/tests/folder/test9.c
+++ b/camel/tests/folder/test9.c
@@ -8,19 +8,12 @@
 #include "folders.h"
 #include "session.h"
 
-#include "camel/camel-service.h"
-#include "camel/camel-store.h"
-
-#include "camel/camel-folder.h"
-#include "camel/camel-folder-summary.h"
-#include "camel/camel-mime-message.h"
-#include "camel/camel-filter-driver.h"
-#include "camel/camel-stream-fs.h"
+#include <camel/camel.h>
 
 static const gchar *local_drivers[] = { "local" };
 
 struct {
-	gchar *name;
+	const gchar *name;
 	CamelFolder *folder;
 } mailboxes[] = {
 	{ "INBOX", NULL },
@@ -31,7 +24,7 @@ struct {
 };
 
 struct {
-	gchar *name, *match, *action;
+	const gchar *name, *match, *action;
 } rules[] = {
 	{ "empty1", "(match-all (header-contains \"Frobnitz\"))", "(copy-to \"folder1\")" },
 	{ "empty2", "(header-contains \"Frobnitz\")", "(copy-to \"folder2\")" },
@@ -46,7 +39,7 @@ struct {
 
 /* broken match rules */
 struct {
-	gchar *name, *match, *action;
+	const gchar *name, *match, *action;
 } brokens[] = {
 	{ "count1", "(body-contains data50)", "(copy-to \"folder1\")" }, /* non string argument */
 	{ "count1", "(body-contains-stuff \"data3\")", "(move-to-folder \"folder2\")" }, /* invalid function */
@@ -62,7 +55,7 @@ struct {
 
 /* broken action rules */
 struct {
-	gchar *name, *match, *action;
+	const gchar *name, *match, *action;
 } brokena[] = {
 	{ "a", "(body-contains \"data2\")", "(body-contains \"help\")" }, /* rule in action */
 	{ "a", "(body-contains \"data2\")", "(move-to-folder-name \"folder2\")" }, /* unknown function */
@@ -74,7 +67,11 @@ struct {
 	{ "a", "(body-contains \"data2\")", "" }, /* empty */
 };
 
-static CamelFolder *get_folder(CamelFilterDriver *d, const gchar *uri, gpointer data, CamelException *ex)
+static CamelFolder *
+get_folder (CamelFilterDriver *d,
+            const gchar *uri,
+            gpointer data,
+            GError **error)
 {
 	gint i;
 
@@ -90,18 +87,16 @@ gint main(gint argc, gchar **argv)
 {
 	CamelSession *session;
 	CamelStore *store;
-	CamelException *ex;
 	CamelFolder *folder;
 	CamelMimeMessage *msg;
 	gint i, j;
 	CamelStream *mbox;
 	CamelFilterDriver *driver;
+	GError *error = NULL;
 
 	camel_test_init(argc, argv);
 	camel_test_provider_init(1, local_drivers);
 
-	ex = camel_exception_new();
-
 	/* clear out any camel-test data */
 	system("/bin/rm -rf /tmp/camel-test");
 
@@ -113,20 +108,22 @@ gint main(gint argc, gchar **argv)
 	/* todo: work out how to do imap/pop/nntp tests */
 
 	push("getting store");
-	store = camel_session_get_store(session, "mbox:///tmp/camel-test/mbox", ex);
-	check_msg(!camel_exception_is_set(ex), "getting store: %s", camel_exception_get_description(ex));
+	store = camel_session_get_store(session, "mbox:///tmp/camel-test/mbox", &error);
+	check_msg(error == NULL, "getting store: %s", error->message);
 	check(store != NULL);
+	g_clear_error (&error);
 	pull();
 
 	push("Creating output folders");
 	for (i = 0; i < G_N_ELEMENTS (mailboxes); i++) {
 		push("creating %s", mailboxes[i].name);
-		mailboxes[i].folder = folder = camel_store_get_folder(store, mailboxes[i].name, CAMEL_STORE_FOLDER_CREATE, ex);
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		mailboxes[i].folder = folder = camel_store_get_folder(store, mailboxes[i].name, CAMEL_STORE_FOLDER_CREATE, &error);
+		check_msg(error == NULL, "%s", error->message);
 		check(folder != NULL);
 
 		/* we need an empty folder for this to work */
 		test_folder_counts(folder, 0, 0);
+		g_clear_error (&error);
 		pull();
 	}
 	pull();
@@ -154,7 +151,8 @@ gint main(gint argc, gchar **argv)
 #if 0
 		push("appending simple message %d", j);
 		camel_folder_append_message(folder, msg, NULL, ex);
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		check_msg(error == NULL, "%s", error->message);
+		g_clear_error (&error);
 		pull();
 #endif
 		test_free(subject);
@@ -175,12 +173,13 @@ gint main(gint argc, gchar **argv)
 
 	push("Executing filters");
 	camel_filter_driver_set_default_folder(driver, mailboxes[0].folder);
-	camel_filter_driver_filter_mbox(driver, "/tmp/camel-test/inbox", NULL, ex);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+	camel_filter_driver_filter_mbox(driver, "/tmp/camel-test/inbox", NULL, &error);
+	check_msg(error == NULL, "%s", error->message);
 
 	/* now need to check the folder counts/etc */
 
 	check_unref(driver, 1);
+	g_clear_error (&error);
 	pull();
 
 	/* this tests that invalid rules are caught */
@@ -190,10 +189,10 @@ gint main(gint argc, gchar **argv)
 		driver = camel_filter_driver_new(session);
 		camel_filter_driver_set_folder_func(driver, get_folder, NULL);
 		camel_filter_driver_add_rule(driver, brokens[i].name, brokens[i].match, brokens[i].action);
-		camel_filter_driver_filter_mbox(driver, "/tmp/camel-test/inbox", NULL, ex);
-		check(camel_exception_is_set(ex));
-		camel_exception_clear(ex);
+		camel_filter_driver_filter_mbox(driver, "/tmp/camel-test/inbox", NULL, &error);
+		check(error != NULL);
 		check_unref(driver, 1);
+		g_clear_error (&error);
 		pull();
 	}
 	pull();
@@ -204,10 +203,10 @@ gint main(gint argc, gchar **argv)
 		driver = camel_filter_driver_new(session);
 		camel_filter_driver_set_folder_func(driver, get_folder, NULL);
 		camel_filter_driver_add_rule(driver, brokena[i].name, brokena[i].match, brokena[i].action);
-		camel_filter_driver_filter_mbox(driver, "/tmp/camel-test/inbox", NULL, ex);
-		check(camel_exception_is_set(ex));
-		camel_exception_clear(ex);
+		camel_filter_driver_filter_mbox(driver, "/tmp/camel-test/inbox", NULL, &error);
+		check(error != NULL);
 		check_unref(driver, 1);
+		g_clear_error (&error);
 		pull();
 	}
 	pull();
@@ -219,7 +218,6 @@ gint main(gint argc, gchar **argv)
 	check_unref(store, 1);
 
 	check_unref(session, 1);
-	camel_exception_free(ex);
 
 	camel_test_end();
 
diff --git a/camel/tests/lib/addresses.h b/camel/tests/lib/addresses.h
index dc35a19..2f6ebd7 100644
--- a/camel/tests/lib/addresses.h
+++ b/camel/tests/lib/addresses.h
@@ -1,5 +1,5 @@
 
-#include <camel/camel-internet-address.h>
+#include <camel/camel.h>
 
 /* addresses.c */
 void test_address_compare(CamelInternetAddress *addr, CamelInternetAddress *addr2);
diff --git a/camel/tests/lib/camel-test-provider.c b/camel/tests/lib/camel-test-provider.c
index 1734b48..9ff9ae8 100644
--- a/camel/tests/lib/camel-test-provider.c
+++ b/camel/tests/lib/camel-test-provider.c
@@ -1,21 +1,22 @@
 
+#include <camel/camel.h>
+
 #include "camel-test-provider.h"
 #include "camel-test.h"
 
-#include "camel-provider.h"
-
-void test_provider_init(gint argc, gchar **argv)
+void
+camel_test_provider_init (gint argc, const gchar **argv)
 {
 	gchar *name, *path;
 	gint i;
-	CamelException ex = { 0 };
+	GError *error = NULL;
 
 	for (i=0;i<argc;i++) {
 		name = g_strdup_printf("libcamel%s."G_MODULE_SUFFIX, argv[i]);
 		path = g_build_filename(CAMEL_BUILD_DIR, "providers", argv[i], ".libs", name, NULL);
 		g_free(name);
-		camel_provider_load(path, &ex);
-		check_msg(!ex.id, "Cannot load provider for '%s', test aborted", argv[i]);
+		camel_provider_load(path, &error);
+		check_msg(error == NULL, "Cannot load provider for '%s', test aborted", argv[i]);
 		g_free(path);
 	}
 }
diff --git a/camel/tests/lib/camel-test-provider.h b/camel/tests/lib/camel-test-provider.h
index 2ab7ba1..3c90ce2 100644
--- a/camel/tests/lib/camel-test-provider.h
+++ b/camel/tests/lib/camel-test-provider.h
@@ -4,6 +4,6 @@
 
 #include <glib.h>
 
-void camel_test_provider_init(gint argc, gchar **argv);
+void camel_test_provider_init(gint argc, const gchar **argv);
 
 #endif
diff --git a/camel/tests/lib/camel-test.c b/camel/tests/lib/camel-test.c
index 06ebcd8..bb886cf 100644
--- a/camel/tests/lib/camel-test.c
+++ b/camel/tests/lib/camel-test.c
@@ -96,7 +96,8 @@ current_state(void)
 	return info;
 }
 
-void test_init(gint argc, gchar **argv)
+void
+camel_test_init(gint argc, gchar **argv)
 {
 	struct stat st;
 	gchar *path;
@@ -120,8 +121,6 @@ void test_init(gint argc, gchar **argv)
 	camel_init (path, FALSE);
 	g_free (path);
 
-	type_init ();
-
 	info_table = g_hash_table_new(0, 0);
 
 	signal(SIGSEGV, die);
@@ -153,7 +152,7 @@ void camel_test_start(const gchar *what)
 	s = current_state();
 
 	if (!setup)
-		test_init(0, 0);
+		camel_test_init(0, 0);
 
 	ok = 1;
 
@@ -340,7 +339,7 @@ gint string_equal(const gchar *a, const gchar *b)
 
 		if (ap - a != bp - a
 		    && ap - 1 > 0
-		    && memcmp(a, b, ap-a) != 0) {
+		    && memcmp(a, b, ap-a) != NULL) {
 			return 0;
 		}
 	}
diff --git a/camel/tests/lib/camel-test.h b/camel/tests/lib/camel-test.h
index 74c3f4c..d71c245 100644
--- a/camel/tests/lib/camel-test.h
+++ b/camel/tests/lib/camel-test.h
@@ -27,8 +27,8 @@ static void check_msg(gint truth, gchar *fmt, ...)
 #endif
 
 #define check_count(object, expected) do { \
-	if (CAMEL_OBJECT(object)->ref_count != expected) { \
-		camel_test_fail("%s->ref_count != %s\n\tref_count = %d", #object, #expected, CAMEL_OBJECT(object)->ref_count); \
+	if (G_OBJECT (object)->ref_count != expected) { \
+		camel_test_fail("%s->ref_count != %s\n\tref_count = %d", #object, #expected, G_OBJECT (object)->ref_count); \
 	} \
 } while (0)
 
diff --git a/camel/tests/lib/folders.c b/camel/tests/lib/folders.c
index c7059f5..fc371a4 100644
--- a/camel/tests/lib/folders.c
+++ b/camel/tests/lib/folders.c
@@ -86,8 +86,8 @@ test_folder_message(CamelFolder *folder, const gchar *uid)
 	CamelMessageInfo *info;
 	GPtrArray *s;
 	gint i;
-	CamelException *ex = camel_exception_new();
 	gint found;
+	GError *error = NULL;
 
 	push("uid %s is in folder", uid);
 
@@ -98,8 +98,8 @@ test_folder_message(CamelFolder *folder, const gchar *uid)
 	camel_folder_free_message_info(folder, info);
 
 	/* then, getting message */
-	msg = camel_folder_get_message(folder, uid, ex);
-	check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+	msg = camel_folder_get_message(folder, uid, &error);
+	check_msg(error == NULL, "%s", error->message);
 	check(msg != NULL);
 
 	/* cross check with info */
@@ -130,7 +130,7 @@ test_folder_message(CamelFolder *folder, const gchar *uid)
 	check(found == 1);
 	camel_folder_free_uids(folder, s);
 
-	camel_exception_free(ex);
+	g_clear_error (&error);
 
 	pull();
 }
@@ -143,8 +143,8 @@ test_folder_not_message(CamelFolder *folder, const gchar *uid)
 	CamelMessageInfo *info;
 	GPtrArray *s;
 	gint i;
-	CamelException *ex = camel_exception_new();
 	gint found;
+	GError *error = NULL;
 
 	push("uid '%s' is not in folder", uid);
 
@@ -156,10 +156,10 @@ test_folder_not_message(CamelFolder *folder, const gchar *uid)
 
 	/* then, getting message */
 	push("no message");
-	msg = camel_folder_get_message(folder, uid, ex);
-	check(camel_exception_is_set(ex));
+	msg = camel_folder_get_message(folder, uid, &error);
+	check(error != NULL);
 	check(msg == NULL);
-	camel_exception_clear(ex);
+	g_clear_error (&error);
 	pull();
 
 	/* see if it is not in the summary (only once) */
@@ -189,7 +189,7 @@ test_folder_not_message(CamelFolder *folder, const gchar *uid)
 	camel_folder_free_uids(folder, s);
 	pull();
 
-	camel_exception_free(ex);
+	g_clear_error (&error);
 
 	pull();
 }
@@ -200,87 +200,91 @@ void
 test_folder_basic(CamelSession *session, const gchar *storename, gint local, gint spool)
 {
 	CamelStore *store;
-	CamelException *ex = camel_exception_new();
 	CamelFolder *folder;
 	gchar *what = g_strdup_printf("testing store: %s", storename);
+	GError *error = NULL;
 
 	camel_test_start(what);
 	test_free(what);
 
 	push("getting store");
-	store = camel_session_get_store(session, storename, ex);
-	check_msg(!camel_exception_is_set(ex), "getting store: %s", camel_exception_get_description(ex));
+	store = camel_session_get_store(session, storename, &error);
+	check_msg(error == NULL, "getting store: %s", error->message);
 	check(store != NULL);
+	g_clear_error (&error);
 	pull();
 
 	/* local providers == no inbox */
 	push("getting inbox folder");
-	folder = camel_store_get_inbox(store, ex);
+	folder = camel_store_get_inbox(store, &error);
 	if (local) {
 		/* Well, maildir can have an inbox */
 		if (folder) {
-			check(!camel_exception_is_set(ex));
+			check(error == NULL);
 			check_unref(folder, 1);
 		} else {
-			check(camel_exception_is_set(ex));
-			camel_exception_clear(ex);
+			check(error != NULL);
 		}
 	} else {
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		check_msg(error == NULL, "%s", error->message);
 		check(folder != NULL);
 		check_unref(folder, 2);
 	}
+	g_clear_error (&error);
 	pull();
 
 	push("getting a non-existant folder, no create");
-	folder = camel_store_get_folder(store, "unknown", 0, ex);
-	check(camel_exception_is_set(ex));
+	folder = camel_store_get_folder(store, "unknown", 0, &error);
+	check(error != NULL);
 	check(folder == NULL);
-	camel_exception_clear(ex);
+	g_clear_error (&error);
 	pull();
 
 	if (!spool) {
 		push("getting a non-existant folder, with create");
-		folder = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, ex);
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		folder = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, &error);
+		check_msg(error == NULL, "%s", error->message);
 		check(folder != NULL);
 		if (local)
 			check_unref(folder, 1);
 		else
 			check_unref(folder, 2);
+		g_clear_error (&error);
 		pull();
 
 		push("getting an existing folder");
-		folder = camel_store_get_folder(store, "testbox", 0, ex);
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		folder = camel_store_get_folder(store, "testbox", 0, &error);
+		check_msg(error == NULL, "%s", error->message);
 		check(folder != NULL);
 		if (local)
 			check_unref(folder, 1);
 		else
 			check_unref(folder, 2);
+		g_clear_error (&error);
 		pull();
 
 		push("renaming a non-existant folder");
-		camel_store_rename_folder(store, "unknown1", "unknown2", ex);
-		check(camel_exception_is_set(ex));
-		camel_exception_clear(ex);
+		camel_store_rename_folder(store, "unknown1", "unknown2", &error);
+		check(error != NULL);
+		g_clear_error (&error);
 		pull();
 
 		push("renaming an existing folder");
-		camel_store_rename_folder(store, "testbox", "testbox2", ex);
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		camel_store_rename_folder(store, "testbox", "testbox2", &error);
+		check_msg(error == NULL, "%s", error->message);
+		g_clear_error (&error);
 		pull();
 
 		push("opening the old name of a renamed folder");
-		folder = camel_store_get_folder(store, "testbox", 0, ex);
-		check(camel_exception_is_set(ex));
+		folder = camel_store_get_folder(store, "testbox", 0, &error);
+		check(error != NULL);
 		check(folder == NULL);
-		camel_exception_clear(ex);
+		g_clear_error (&error);
 		pull();
 
 		push("opening the new name of a renamed folder");
-		folder = camel_store_get_folder(store, "testbox2", 0, ex);
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		folder = camel_store_get_folder(store, "testbox2", 0, &error);
+		check_msg(error == NULL, "%s", error->message);
 		check(folder != NULL);
 		if (local)
 			check_unref(folder, 1);
@@ -290,30 +294,29 @@ test_folder_basic(CamelSession *session, const gchar *storename, gint local, gin
 	}
 
 	push("deleting a non-existant folder");
-	camel_store_delete_folder(store, "unknown", ex);
-	check(camel_exception_is_set(ex));
-	camel_exception_clear(ex);
+	camel_store_delete_folder(store, "unknown", &error);
+	check(error != NULL);
+	g_clear_error (&error);
 	pull();
 
 	if (!spool) {
 		push("deleting an existing folder");
-		camel_store_delete_folder(store, "testbox2", ex);
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		camel_store_delete_folder(store, "testbox2", &error);
+		check_msg(error == NULL, "%s", error->message);
+		g_clear_error (&error);
 		pull();
 	}
 
 	push("opening a folder that has been deleted");
-	folder = camel_store_get_folder(store, "testbox2", 0, ex);
-	check(camel_exception_is_set(ex));
+	folder = camel_store_get_folder(store, "testbox2", 0, &error);
+	check(error != NULL);
 	check(folder == NULL);
-	camel_exception_clear(ex);
+	g_clear_error (&error);
 	pull();
 
 	check_unref(store, 1);
 
 	camel_test_end();
-
-	camel_exception_free(ex);
 }
 
 /* todo: cross-check everything with folder_info checks as well */
@@ -322,13 +325,13 @@ void
 test_folder_message_ops(CamelSession *session, const gchar *name, gint local, const gchar *mailbox)
 {
 	CamelStore *store;
-	CamelException *ex = camel_exception_new();
 	CamelFolder *folder;
 	CamelMimeMessage *msg;
 	gint j;
 	gint indexed, max;
 	GPtrArray *uids;
 	CamelMessageInfo *info;
+	GError *error = NULL;
 
 	max=local?2:1;
 
@@ -340,9 +343,10 @@ test_folder_message_ops(CamelSession *session, const gchar *name, gint local, co
 		test_free(what);
 
 		push("getting store");
-		store = camel_session_get_store(session, name, ex);
-		check_msg(!camel_exception_is_set(ex), "getting store: %s", camel_exception_get_description(ex));
+		store = camel_session_get_store(session, name, &error);
+		check_msg(error == NULL, "getting store: %s", error->message);
 		check(store != NULL);
+		g_clear_error (&error);
 		pull();
 
 		push("creating %sindexed folder", indexed?"":"non-");
@@ -350,18 +354,18 @@ test_folder_message_ops(CamelSession *session, const gchar *name, gint local, co
 			flags = CAMEL_STORE_FOLDER_CREATE|CAMEL_STORE_FOLDER_BODY_INDEX;
 		else
 			flags = CAMEL_STORE_FOLDER_CREATE;
-		folder = camel_store_get_folder(store, mailbox, flags, ex);
+		folder = camel_store_get_folder(store, mailbox, flags, &error);
 
 		/* we can't create mailbox outside of namespace, since we have no api for it, try
 		   using inbox namespace, works for courier */
 		if (folder == NULL) {
 			gchar *mbox = g_strdup_printf("INBOX/%s", mailbox);
 			mailbox = mbox;
-			camel_exception_clear(ex);
-			folder = camel_store_get_folder(store, mailbox, flags, ex);
+			g_clear_error (&error);
+			folder = camel_store_get_folder(store, mailbox, flags, &error);
 		}
 
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		check_msg(error == NULL, "%s", error->message);
 		check(folder != NULL);
 
 		/* verify empty/can't get nonexistant stuff */
@@ -383,15 +387,15 @@ test_folder_message_ops(CamelSession *session, const gchar *name, gint local, co
 			pull();
 
 			push("appending simple message %d", j);
-			camel_folder_append_message(folder, msg, NULL, NULL, ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			camel_folder_append_message(folder, msg, NULL, NULL, &error);
+			check_msg(error == NULL, "%s", error->message);
 
 #if 0
 			/* sigh, this shouldn't be required, but the imap code is too dumb to do it itself */
 			if (!local) {
 				push("forcing a refresh of folder updates");
 				camel_folder_refresh_info(folder, ex);
-				check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+				check_msg(error == NULL, "%s", error->message);
 				pull();
 			}
 #endif
@@ -446,9 +450,10 @@ test_folder_message_ops(CamelSession *session, const gchar *name, gint local, co
 #endif
 
 		push("re-opening folder");
-		folder = camel_store_get_folder(store, mailbox, flags, ex);
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		folder = camel_store_get_folder(store, mailbox, flags, &error);
+		check_msg(error == NULL, "%s", error->message);
 		check(folder != NULL);
+		g_clear_error (&error);
 
 			/* verify counts */
 		test_folder_counts(folder, 10, 10);
@@ -474,8 +479,9 @@ test_folder_message_ops(CamelSession *session, const gchar *name, gint local, co
 		push("deleting first message & expunging");
 		camel_folder_delete_message(folder, uids->pdata[0]);
 		test_folder_counts(folder, 10, 9);
-		camel_folder_expunge(folder, ex);
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		camel_folder_expunge(folder, &error);
+		check_msg(error == NULL, "%s", error->message);
+		g_clear_error (&error);
 		test_folder_not_message(folder, uids->pdata[0]);
 		test_folder_counts(folder, 9, 9);
 
@@ -503,8 +509,9 @@ test_folder_message_ops(CamelSession *session, const gchar *name, gint local, co
 		camel_folder_delete_message(folder, uids->pdata[8]);
 		/* sync? */
 		test_folder_counts(folder, 9, 8);
-		camel_folder_expunge(folder, ex);
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		camel_folder_expunge(folder, &error);
+		check_msg(error == NULL, "%s", error->message);
+		g_clear_error (&error);
 		test_folder_not_message(folder, uids->pdata[8]);
 		test_folder_counts(folder, 8, 8);
 
@@ -534,8 +541,9 @@ test_folder_message_ops(CamelSession *session, const gchar *name, gint local, co
 		}
 		/* sync? */
 		test_folder_counts(folder, 8, 0);
-		camel_folder_expunge(folder, ex);
-		check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+		camel_folder_expunge(folder, &error);
+		check_msg(error == NULL, "%s", error->message);
+		g_clear_error (&error);
 		for (j=0;j<8;j++) {
 			test_folder_not_message(folder, uids->pdata[j]);
 		}
@@ -552,21 +560,21 @@ test_folder_message_ops(CamelSession *session, const gchar *name, gint local, co
 
 		if (g_ascii_strcasecmp(mailbox, "INBOX") != 0) {
 			push("deleting test folder, with no messages in it");
-			camel_store_delete_folder(store, mailbox, ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			camel_store_delete_folder(store, mailbox, &error);
+			check_msg(error == NULL, "%s", error->message);
+			g_clear_error (&error);
 			pull();
 		}
 
 		if (!local) {
 			push("disconneect service");
-			camel_service_disconnect((CamelService *)store, TRUE, ex);
-			check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex));
+			camel_service_disconnect((CamelService *)store, TRUE, &error);
+			check_msg(error == NULL, "%s", error->message);
+			g_clear_error (&error);
 			pull();
 		}
 
 		check_unref(store, 1);
 		camel_test_end();
 	}
-
-	camel_exception_free(ex);
 }
diff --git a/camel/tests/lib/folders.h b/camel/tests/lib/folders.h
index de2fb10..006a297 100644
--- a/camel/tests/lib/folders.h
+++ b/camel/tests/lib/folders.h
@@ -1,10 +1,5 @@
 
-#include "camel/camel-session.h"
-#include "camel/camel-store.h"
-
-#include <camel/camel-folder.h>
-#include <camel/camel-folder-summary.h>
-#include <camel/camel-mime-message.h>
+#include <camel/camel.h>
 
 /* check the total/unread is what we think it should be, everywhere it can be determined */
 void test_folder_counts(CamelFolder *folder, gint total, gint unread);
diff --git a/camel/tests/lib/messages.c b/camel/tests/lib/messages.c
index 0ddf1fb..6dd9802 100644
--- a/camel/tests/lib/messages.c
+++ b/camel/tests/lib/messages.c
@@ -5,11 +5,6 @@
 #include "messages.h"
 #include "camel-test.h"
 
-#include <camel/camel-multipart.h>
-#include <camel/camel-mime-message.h>
-#include <camel/camel-stream-fs.h>
-#include <camel/camel-stream-mem.h>
-
 CamelMimeMessage *
 test_message_create_simple(void)
 {
@@ -62,14 +57,14 @@ test_message_set_content_simple(CamelMimePart *part, gint how, const gchar *type
 		break;
 	case 3:
 		ba = g_byte_array_new();
-		g_byte_array_append(ba, text, len);
+		g_byte_array_append(ba, (guint8 *) text, len);
 
 		content = (CamelStreamMem *)camel_stream_mem_new_with_byte_array(ba);
 		ba = NULL;
 		break;
 	case 4:
 		ba = g_byte_array_new();
-		g_byte_array_append(ba, text, len);
+		g_byte_array_append(ba, (guint8 *) text, len);
 
 		content = (CamelStreamMem *)camel_stream_mem_new();
 		camel_stream_mem_set_byte_array(content, ba);
@@ -100,7 +95,7 @@ test_message_write_file(CamelMimeMessage *msg, const gchar *name)
 	camel_data_wrapper_write_to_stream((CamelDataWrapper *)msg, (CamelStream *)file);
 	ret = camel_stream_close((CamelStream *)file);
 
-	check(((CamelObject *)file)->ref_count == 1);
+	check(G_OBJECT (file)->ref_count == 1);
 	g_object_unref (file);
 
 	return ret;
@@ -117,7 +112,7 @@ test_message_read_file(const gchar *name)
 
 	camel_data_wrapper_construct_from_stream((CamelDataWrapper *)msg2, (CamelStream *)file);
 	/* file's refcount may be > 1 if the message is real big */
-	check(CAMEL_OBJECT(file)->ref_count >=1);
+	check(G_OBJECT(file)->ref_count >=1);
 	g_object_unref (file);
 
 	return msg2;
@@ -156,26 +151,28 @@ hexdump (const guchar *in, gint inlen)
 gint
 test_message_compare_content(CamelDataWrapper *dw, const gchar *text, gint len)
 {
-	CamelStreamMem *content;
+	CamelStream *content;
+	GByteArray *byte_array;
 
 	/* sigh, ok, so i len == 0, dw will probably be 0 too
 	   camel_mime_part_set_content is weird like that */
 	if (dw == 0 && len == 0)
 		return 0;
 
-	content = (CamelStreamMem *)camel_stream_mem_new();
-	camel_data_wrapper_decode_to_stream(dw, (CamelStream *)content);
+	byte_array = g_byte_array_new ();
+	content = camel_stream_mem_new_with_byte_array (byte_array);
+	camel_data_wrapper_decode_to_stream (dw, content);
 
-	if (content->buffer->len != len) {
+	if (byte_array->len != len) {
 		printf ("original text:\n");
-		hexdump (text, len);
+		hexdump ((guchar *) text, len);
 
 		printf ("new text:\n");
-		hexdump (content->buffer->data, content->buffer->len);
+		hexdump (byte_array->data, byte_array->len);
 	}
 
-	check_msg(content->buffer->len == len, "buffer->len = %d, len = %d", content->buffer->len, len);
-	check_msg(memcmp(content->buffer->data, text, content->buffer->len) == 0, "len = %d", len);
+	check_msg(byte_array->len == len, "buffer->len = %d, len = %d", byte_array->len, len);
+	check_msg(memcmp(byte_array->data, text, byte_array->len) == 0, "len = %d", len);
 
 	check_unref(content, 1);
 
@@ -186,25 +183,29 @@ gint
 test_message_compare (CamelMimeMessage *msg)
 {
 	CamelMimeMessage *msg2;
-	CamelStreamMem *mem1, *mem2;
+	CamelStream *mem1, *mem2;
+	GByteArray *buffer1;
+	GByteArray *buffer2;
 
-	mem1 = (CamelStreamMem *) camel_stream_mem_new ();
-	check_msg(camel_data_wrapper_write_to_stream ((CamelDataWrapper *) msg, (CamelStream *) mem1) != -1, "write_to_stream 1 failed");
+	buffer1 = g_byte_array_new ();
+	mem1 = camel_stream_mem_new_with_byte_array (buffer1);
+	check_msg(camel_data_wrapper_write_to_stream ((CamelDataWrapper *) msg, mem1) != -1, "write_to_stream 1 failed");
 	camel_stream_reset ((CamelStream *) mem1);
 
 	msg2 = camel_mime_message_new ();
-	check_msg(camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) msg2, (CamelStream *) mem1) != -1, "construct_from_stream 1 failed");
+	check_msg(camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) msg2, mem1) != -1, "construct_from_stream 1 failed");
 	camel_stream_reset ((CamelStream *) mem1);
 
-	mem2 = (CamelStreamMem *) camel_stream_mem_new ();
-	check_msg(camel_data_wrapper_write_to_stream ((CamelDataWrapper *) msg2, (CamelStream *) mem2) != -1, "write_to_stream 2 failed");
+	buffer2 = g_byte_array_new ();
+	mem2 = camel_stream_mem_new_with_byte_array (buffer2);
+	check_msg(camel_data_wrapper_write_to_stream ((CamelDataWrapper *) msg2, mem2) != -1, "write_to_stream 2 failed");
 	camel_stream_reset ((CamelStream *) mem2);
 
-	if (mem1->buffer->len != mem2->buffer->len) {
+	if (buffer1->len != buffer2->len) {
 		CamelDataWrapper *content;
 
-		printf ("mem1 stream:\n%.*s\n", mem1->buffer->len, mem1->buffer->data);
-		printf ("mem2 stream:\n%.*s\n\n", mem2->buffer->len, mem2->buffer->data);
+		printf ("mem1 stream:\n%.*s\n", buffer1->len, buffer1->data);
+		printf ("mem2 stream:\n%.*s\n\n", buffer2->len, buffer2->data);
 
 		printf("msg1:\n");
 		test_message_dump_structure(msg);
@@ -216,11 +217,11 @@ test_message_compare (CamelMimeMessage *msg)
 
 	check_unref(msg2, 1);
 
-	check_msg (mem1->buffer->len == mem2->buffer->len,
-		   "mem1->buffer->len = %d, mem2->buffer->len = %d",
-		   mem1->buffer->len, mem2->buffer->len);
+	check_msg (buffer1->len == buffer2->len,
+		   "buffer1->len = %d, buffer2->len = %d",
+		   buffer1->len, buffer2->len);
 
-	check_msg (memcmp (mem1->buffer->data, mem2->buffer->data, mem1->buffer->len) == 0, "msg/stream compare");
+	check_msg (memcmp (buffer1->data, buffer2->data, buffer1->len) == 0, "msg/stream compare");
 
 	g_object_unref (mem1);
 	g_object_unref (mem2);
@@ -253,11 +254,11 @@ message_dump_rec(CamelMimeMessage *msg, CamelMimePart *part, gint depth)
 	s[depth] = 0;
 
 	mime_type = camel_data_wrapper_get_mime_type((CamelDataWrapper *)part);
-	printf("%sPart <%s>\n", s, ((CamelObject *)part)->class->name);
+	printf("%sPart <%s>\n", s, G_OBJECT_TYPE_NAME (part));
 	printf("%sContent-Type: %s\n", s, mime_type);
 	g_free(mime_type);
 	printf("%s encoding: %s\n", s, camel_transfer_encoding_to_string(((CamelDataWrapper *)part)->encoding));
-	printf("%s part encoding: %s\n", s, camel_transfer_encoding_to_string(part->encoding));
+	printf("%s part encoding: %s\n", s, camel_transfer_encoding_to_string(camel_mime_part_get_encoding (part)));
 
 	containee = camel_medium_get_content (CAMEL_MEDIUM (part));
 
@@ -265,7 +266,7 @@ message_dump_rec(CamelMimeMessage *msg, CamelMimePart *part, gint depth)
 		return;
 
 	mime_type = camel_data_wrapper_get_mime_type(containee);
-	printf("%sContent <%s>\n", s, ((CamelObject *)containee)->class->name);
+	printf("%sContent <%s>\n", s, G_OBJECT_TYPE_NAME (containee));
 	printf ("%sContent-Type: %s\n", s, mime_type);
 	g_free (mime_type);
 	printf("%s encoding: %s\n", s, camel_transfer_encoding_to_string(((CamelDataWrapper *)containee)->encoding));
diff --git a/camel/tests/lib/messages.h b/camel/tests/lib/messages.h
index 6b4d560..1bacbab 100644
--- a/camel/tests/lib/messages.h
+++ b/camel/tests/lib/messages.h
@@ -1,5 +1,5 @@
 
-#include <camel/camel-mime-message.h>
+#include <camel/camel.h>
 
 /* how many ways to set the content contents */
 #define SET_CONTENT_WAYS (5)
diff --git a/camel/tests/lib/session.c b/camel/tests/lib/session.c
index 0ef047c..1a87069 100644
--- a/camel/tests/lib/session.c
+++ b/camel/tests/lib/session.c
@@ -4,28 +4,20 @@
 
 #include "session.h"
 
-static void
-class_init (CamelTestSessionClass *camel_test_session_class)
-{
-	CamelSessionClass *camel_session_class =
-		CAMEL_SESSION_CLASS (camel_test_session_class);
-}
-
 GType
 camel_test_session_get_type (void)
 {
 	static GType type = G_TYPE_INVALID;
 
 	if (G_UNLIKELY (type == G_TYPE_INVALID))
-		type = camel_type_register (
+		type = g_type_register_static_simple (
 			CAMEL_TYPE_SESSION,
 			"CamelTestSession",
-			sizeof (CamelTestSession),
 			sizeof (CamelTestSessionClass),
-			(GClassInitFunc) class_init,
-			NULL,
-			NULL,
-			NULL);
+			(GClassInitFunc) NULL,
+			sizeof (CamelTestSession),
+			(GInstanceInitFunc) NULL,
+			0);
 
 	return type;
 }
diff --git a/camel/tests/lib/session.h b/camel/tests/lib/session.h
index 9838338..2b2e5ec 100644
--- a/camel/tests/lib/session.h
+++ b/camel/tests/lib/session.h
@@ -1,4 +1,4 @@
-#include <camel/camel-session.h>
+#include <camel/camel.h>
 
 /* Standard GObject macros */
 #define CAMEL_TYPE_TEST_SESSION \
diff --git a/camel/tests/lib/streams.c b/camel/tests/lib/streams.c
index d4916ac..4229a35 100644
--- a/camel/tests/lib/streams.c
+++ b/camel/tests/lib/streams.c
@@ -7,10 +7,6 @@
 
 #include <string.h>
 
-#include "camel/camel-stream.h"
-#include "camel/camel-seekable-stream.h"
-#include "camel/camel-seekable-substream.h"
-
 #include "streams.h"
 
 #include "camel-test.h"
diff --git a/camel/tests/lib/streams.h b/camel/tests/lib/streams.h
index aac9a80..d2b47e2 100644
--- a/camel/tests/lib/streams.h
+++ b/camel/tests/lib/streams.h
@@ -1,5 +1,5 @@
 
-#include "camel/camel-seekable-stream.h"
+#include <camel/camel.h>
 
 /* call one, then the other on the same stream content */
 void test_stream_seekable_writepart(CamelSeekableStream *s);
diff --git a/camel/tests/message/test1.c b/camel/tests/message/test1.c
index e4c2ac6..c38f8ca 100644
--- a/camel/tests/message/test1.c
+++ b/camel/tests/message/test1.c
@@ -25,9 +25,7 @@
 #include <unistd.h>
 #include <string.h>
 
-#include <camel/camel-mime-message.h>
-#include <camel/camel-stream-fs.h>
-#include <camel/camel-stream-mem.h>
+#include <camel/camel.h>
 
 struct _text {
 	gchar *text;
diff --git a/camel/tests/message/test2.c b/camel/tests/message/test2.c
index f72290d..efe0a1b 100644
--- a/camel/tests/message/test2.c
+++ b/camel/tests/message/test2.c
@@ -9,8 +9,7 @@
 #include <stdio.h>
 #include <iconv.h>
 
-#include <camel/camel-internet-address.h>
-#include <camel/camel-address.h>
+#include <camel/camel.h>
 
 #include "address-data.h"
 
diff --git a/camel/tests/message/test3.c b/camel/tests/message/test3.c
index e1ca811..7e99c4a 100644
--- a/camel/tests/message/test3.c
+++ b/camel/tests/message/test3.c
@@ -10,10 +10,7 @@
 #include <unistd.h>
 #include <string.h>
 
-#include <camel/camel-mime-message.h>
-#include <camel/camel-stream-fs.h>
-#include <camel/camel-stream-mem.h>
-#include "camel/camel-multipart.h"
+#include <camel/camel.h>
 
 gint main(gint argc, gchar **argv)
 {
@@ -42,37 +39,37 @@ gint main(gint argc, gchar **argv)
 	part = camel_mime_part_new();
 	test_message_set_content_simple(part, 0, "text/plain", "content part 1", strlen("content part 1"));
 	camel_multipart_add_part(mp, part);
-	check(CAMEL_OBJECT(part)->ref_count == 2);
+	check(G_OBJECT(part)->ref_count == 2);
 	check(camel_multipart_get_number(mp) == 1);
 	check(camel_multipart_get_part(mp, 0) == part);
 	check(camel_multipart_get_part(mp, 1) == NULL);
 
 	camel_multipart_remove_part(mp, part);
-	check(CAMEL_OBJECT(part)->ref_count == 1);
+	check(G_OBJECT(part)->ref_count == 1);
 	check(camel_multipart_get_number(mp) == 0);
 	check(camel_multipart_get_part(mp, 0) == NULL);
 	check(camel_multipart_get_part(mp, 1) == NULL);
 
 	camel_multipart_add_part_at(mp, part, 0);
-	check(CAMEL_OBJECT(part)->ref_count == 2);
+	check(G_OBJECT(part)->ref_count == 2);
 	check(camel_multipart_get_number(mp) == 1);
 	check(camel_multipart_get_part(mp, 0) == part);
 	check(camel_multipart_get_part(mp, 1) == NULL);
 
 	check(camel_multipart_remove_part_at(mp, 1) == NULL);
-	check(CAMEL_OBJECT(part)->ref_count == 2);
+	check(G_OBJECT(part)->ref_count == 2);
 	check(camel_multipart_get_number(mp) == 1);
 	check(camel_multipart_get_part(mp, 0) == part);
 	check(camel_multipart_get_part(mp, 1) == NULL);
 
 	check(camel_multipart_remove_part_at(mp, 0) == part);
-	check(CAMEL_OBJECT(part)->ref_count == 1);
+	check(G_OBJECT(part)->ref_count == 1);
 	check(camel_multipart_get_number(mp) == 0);
 	check(camel_multipart_get_part(mp, 0) == NULL);
 	check(camel_multipart_get_part(mp, 1) == NULL);
 
 	camel_multipart_add_part(mp, part);
-	check(CAMEL_OBJECT(part)->ref_count == 2);
+	check(G_OBJECT(part)->ref_count == 2);
 	check(camel_multipart_get_number(mp) == 1);
 	check(camel_multipart_get_part(mp, 0) == part);
 	check(camel_multipart_get_part(mp, 1) == NULL);
@@ -80,7 +77,7 @@ gint main(gint argc, gchar **argv)
 	part2 = camel_mime_part_new();
 	test_message_set_content_simple(part2, 0, "text/plain", "content part 2", strlen("content part 2"));
 	camel_multipart_add_part(mp, part2);
-	check(CAMEL_OBJECT(part2)->ref_count == 2);
+	check(G_OBJECT(part2)->ref_count == 2);
 	check(camel_multipart_get_number(mp) == 2);
 	check(camel_multipart_get_part(mp, 0) == part);
 	check(camel_multipart_get_part(mp, 1) == part2);
@@ -88,7 +85,7 @@ gint main(gint argc, gchar **argv)
 	part3 = camel_mime_part_new();
 	test_message_set_content_simple(part3, 0, "text/plain", "content part 3", strlen("content part 3"));
 	camel_multipart_add_part_at(mp, part3, 1);
-	check(CAMEL_OBJECT(part3)->ref_count == 2);
+	check(G_OBJECT(part3)->ref_count == 2);
 	check(camel_multipart_get_number(mp) == 3);
 	check(camel_multipart_get_part(mp, 0) == part);
 	check(camel_multipart_get_part(mp, 1) == part3);
diff --git a/camel/tests/message/test4.c b/camel/tests/message/test4.c
index 432bb30..3bd0113 100644
--- a/camel/tests/message/test4.c
+++ b/camel/tests/message/test4.c
@@ -30,10 +30,7 @@
 #include "camel-test.h"
 #include "messages.h"
 
-#include <camel/camel-multipart.h>
-#include <camel/camel-mime-message.h>
-#include <camel/camel-stream-fs.h>
-#include <camel/camel-stream-mem.h>
+#include <camel/camel.h>
 
 #if 0
 static void
diff --git a/camel/tests/mime-filter/test-charset.c b/camel/tests/mime-filter/test-charset.c
index 644807e..e5b3177 100644
--- a/camel/tests/mime-filter/test-charset.c
+++ b/camel/tests/mime-filter/test-charset.c
@@ -11,10 +11,7 @@
 
 #include "camel-test.h"
 
-#include <camel/camel-stream-fs.h>
-#include <camel/camel-stream-mem.h>
-#include <camel/camel-stream-filter.h>
-#include <camel/camel-mime-filter-charset.h>
+#include <camel/camel.h>
 
 #define d(x)
 
diff --git a/camel/tests/mime-filter/test-crlf.c b/camel/tests/mime-filter/test-crlf.c
index 954733b..31b5740 100644
--- a/camel/tests/mime-filter/test-crlf.c
+++ b/camel/tests/mime-filter/test-crlf.c
@@ -9,10 +9,7 @@
 
 #include "camel-test.h"
 
-#include <camel/camel-stream-fs.h>
-#include <camel/camel-stream-mem.h>
-#include <camel/camel-stream-filter.h>
-#include <camel/camel-mime-filter-crlf.h>
+#include <camel/camel.h>
 
 #define d(x)
 
diff --git a/camel/tests/mime-filter/test-tohtml.c b/camel/tests/mime-filter/test-tohtml.c
index 4ae6a14..e0b5c9d 100644
--- a/camel/tests/mime-filter/test-tohtml.c
+++ b/camel/tests/mime-filter/test-tohtml.c
@@ -14,10 +14,7 @@
 
 #include "camel-test.h"
 
-#include <camel/camel-stream-fs.h>
-#include <camel/camel-stream-mem.h>
-#include <camel/camel-stream-filter.h>
-#include <camel/camel-mime-filter-tohtml.h>
+#include <camel/camel.h>
 
 #define d(x)
 
@@ -26,7 +23,8 @@
 static void
 test_filter(CamelMimeFilter *f, const gchar *inname, const gchar *outname)
 {
-	CamelStreamMem *in, *out;
+	CamelStream *in, *out;
+	GByteArray *in_buffer, *out_buffer;
 	CamelStream *indisk, *outdisk, *filter;
 	gint id;
 
@@ -39,25 +37,27 @@ test_filter(CamelMimeFilter *f, const gchar *inname, const gchar *outname)
 	outdisk = camel_stream_fs_new_with_name(outname, O_RDONLY, 0);
 	check(outdisk);
 
-	out = (CamelStreamMem *)camel_stream_mem_new();
-	check(camel_stream_write_to_stream(outdisk, (CamelStream *)out) > 0);
+	out_buffer = g_byte_array_new ();
+	out = camel_stream_mem_new_with_byte_array (out_buffer);
+	check(camel_stream_write_to_stream(outdisk, out) > 0);
 
 	camel_test_pull();
 
 	camel_test_push("reading through filter stream");
 
-	in = (CamelStreamMem *)camel_stream_mem_new();
+	in_buffer = g_byte_array_new ();
+	in = camel_stream_mem_new_with_byte_array (in_buffer);
 
 	filter = camel_stream_filter_new (indisk);
 	check_count(indisk, 2);
 	id = camel_stream_filter_add((CamelStreamFilter *)filter, f);
 	check_count(f, 2);
 
-	check(camel_stream_write_to_stream(filter, (CamelStream *)in) > 0);
-	check_msg(in->buffer->len == out->buffer->len
-		  && memcmp(in->buffer->data, out->buffer->data, in->buffer->len) == 0,
-		  "Buffer content mismatch, %d != %d, in = '%.*s' != out = '%.*s'", in->buffer->len, out->buffer->len,
-		  in->buffer->len, in->buffer->data, out->buffer->len, out->buffer->data);
+	check(camel_stream_write_to_stream(filter, in) > 0);
+	check_msg(in_buffer->len == out_buffer->len
+		  && memcmp(in_buffer->data, out_buffer->data, in_buffer->len) == 0,
+		  "Buffer content mismatch, %d != %d, in = '%.*s' != out = '%.*s'", in_buffer->len, out_buffer->len,
+		  in_buffer->len, in_buffer->data, out_buffer->len, out_buffer->data);
 
 	camel_test_pull();
 
@@ -74,18 +74,19 @@ test_filter(CamelMimeFilter *f, const gchar *inname, const gchar *outname)
 
 	camel_test_push("writing through filter stream");
 
-	in = (CamelStreamMem *)camel_stream_mem_new();
-	filter = camel_stream_filter_new ((CamelStream *)in);
+	in_buffer = g_byte_array_new ();
+	in = camel_stream_mem_new_with_byte_array (in_buffer);
+	filter = camel_stream_filter_new (in);
 	check_count(in, 2);
 	id = camel_stream_filter_add((CamelStreamFilter *)filter, f);
 	check_count(f, 2);
 
 	check(camel_stream_write_to_stream(indisk, filter) > 0);
 	check(camel_stream_flush(filter) == 0);
-	check_msg(in->buffer->len == out->buffer->len
-		  && memcmp(in->buffer->data, out->buffer->data, in->buffer->len) == 0,
-		  "Buffer content mismatch, %d != %d, in = '%.*s' != out = '%.*s'", in->buffer->len, out->buffer->len,
-		  in->buffer->len, in->buffer->data, out->buffer->len, out->buffer->data);
+	check_msg(in_buffer->len == out_buffer->len
+		  && memcmp(in_buffer->data, out_buffer->data, in_buffer->len) == 0,
+		  "Buffer content mismatch, %d != %d, in = '%.*s' != out = '%.*s'", in_buffer->len, out_buffer->len,
+		  in_buffer->len, in_buffer->data, out_buffer->len, out_buffer->data);
 
 	camel_stream_filter_remove((CamelStreamFilter *)filter, id);
 	check_unref(filter, 1);
diff --git a/camel/tests/mime-filter/test1.c b/camel/tests/mime-filter/test1.c
index e3506f5..c416d3e 100644
--- a/camel/tests/mime-filter/test1.c
+++ b/camel/tests/mime-filter/test1.c
@@ -9,10 +9,7 @@
 
 #include "camel-test.h"
 
-#include <camel/camel-stream-fs.h>
-#include <camel/camel-stream-mem.h>
-#include <camel/camel-stream-filter.h>
-#include <camel/camel-mime-filter-canon.h>
+#include <camel/camel.h>
 
 #define d(x)
 
@@ -21,8 +18,8 @@
 
 struct {
 	gint flags;
-	gchar *in;
-	gchar *out;
+	const gchar *in;
+	const gchar *out;
 } tests[] = {
 	{ CAMEL_MIME_FILTER_CANON_FROM|CAMEL_MIME_FILTER_CANON_CRLF,
 	  "From \nRussia - with love.\n\n",
@@ -56,7 +53,7 @@ struct {
 gint
 main (gint argc, gchar **argv)
 {
-	CamelStreamFilter *filter;
+	CamelStream *filter;
 	CamelMimeFilter *sh;
 	gint i;
 
@@ -71,12 +68,14 @@ main (gint argc, gchar **argv)
 
 		/* try all write sizes */
 		for (step=1;step<20;step++) {
-			CamelStreamMem *out;
-			gchar *p;
+			CamelStream *out;
+			GByteArray *buffer;
+			const gchar *p;
 
 			camel_test_push("Chunk size %d\n", step);
 
-			out = (CamelStreamMem *)camel_stream_mem_new();
+			buffer = g_byte_array_new ();
+			out = camel_stream_mem_new_with_byte_array (buffer);
 			filter = camel_stream_filter_new ((CamelStream *)out);
 			sh = camel_mime_filter_canon_new(tests[i].flags);
 			check(camel_stream_filter_add(filter, sh) != -1);
@@ -91,8 +90,8 @@ main (gint argc, gchar **argv)
 			}
 			camel_stream_flush((CamelStream *)filter);
 
-			check_msg(out->buffer->len == strlen(tests[i].out), "Buffer length mismatch: expected %d got %d\n or '%s' got '%.*s'", strlen(tests[i].out), out->buffer->len, tests[i].out, out->buffer->len, out->buffer->data);
-			check_msg(0 == memcmp(out->buffer->data, tests[i].out, out->buffer->len), "Buffer mismatch: expected '%s' got '%.*s'", tests[i].out, out->buffer->len, out->buffer->data);
+			check_msg(buffer->len == strlen(tests[i].out), "Buffer length mismatch: expected %d got %d\n or '%s' got '%.*s'", strlen(tests[i].out), buffer->len, tests[i].out, buffer->len, buffer->data);
+			check_msg(0 == memcmp(buffer->data, tests[i].out, buffer->len), "Buffer mismatch: expected '%s' got '%.*s'", tests[i].out, buffer->len, buffer->data);
 			check_unref(filter, 1);
 			check_unref(out, 1);
 
diff --git a/camel/tests/misc/rfc2047.c b/camel/tests/misc/rfc2047.c
index d970e37..8c3cd59 100644
--- a/camel/tests/misc/rfc2047.c
+++ b/camel/tests/misc/rfc2047.c
@@ -28,8 +28,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <camel/camel-object.h>
-#include <camel/camel-mime-utils.h>
+
+#include <camel/camel.h>
 
 #include "camel-test.h"
 
diff --git a/camel/tests/misc/split.c b/camel/tests/misc/split.c
index 8d1f748..ddb6b61 100644
--- a/camel/tests/misc/split.c
+++ b/camel/tests/misc/split.c
@@ -12,10 +12,10 @@
 /* TODO: should put utf8 stuff here too */
 
 static struct {
-	gchar *word;
+	const gchar *word;
 	gint count;
 	struct {
-		gchar *word;
+		const gchar *word;
 		gint type;
 	} splits[5];
 } split_tests[] = {
@@ -33,10 +33,10 @@ static struct {
 };
 
 static struct {
-	gchar *word;
+	const gchar *word;
 	gint count;
 	struct {
-		gchar *word;
+		const gchar *word;
 		gint type;
 	} splits[5];
 } simple_tests[] = {
diff --git a/camel/tests/misc/test1.c b/camel/tests/misc/test1.c
index dc6affd..0a30863 100644
--- a/camel/tests/misc/test1.c
+++ b/camel/tests/misc/test1.c
@@ -4,14 +4,14 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <camel/camel-object.h>
-#include <camel/camel-mime-utils.h>
+
+#include <camel/camel.h>
 
 #include "camel-test.h"
 
 struct {
-	gchar *header;
-	gchar *values[5];
+	const gchar *header;
+	const gchar *values[5];
 } test1[] = {
 	{ "<test camel host>", { "test camel host" } },
 	{ "(this is a comment) <test camel host>", { "test camel host" } },
diff --git a/camel/tests/misc/test2.c b/camel/tests/misc/test2.c
index 7bc372d..603e28d 100644
--- a/camel/tests/misc/test2.c
+++ b/camel/tests/misc/test2.c
@@ -5,17 +5,17 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <camel/camel-object.h>
-#include <camel/camel-mime-utils.h>
+
+#include <camel/camel.h>
 
 #include "camel-test.h"
 
 /* NB: We know which order the params will be decoded in, plain in the order they come,
    and rfc2184 encoded following those, sorted lexigraphically */
 struct {
-	gchar *list;
+	const gchar *list;
 	gint count;
-	gchar *params[8];
+	const gchar *params[8];
 } test1[] = {
 	{ "; charset=\"iso-8859-1\"",
 	  1,
@@ -46,8 +46,8 @@ struct {
 
 struct {
 	gint count;
-	gchar *params[8];
-	gchar *list;
+	const gchar *params[8];
+	const gchar *list;
 } test2[] = {
 	{ 1,
 	  { "name", "Doul\xC3\xADk01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123457890123456789123456789" },
diff --git a/camel/tests/misc/url-scan.c b/camel/tests/misc/url-scan.c
index 3cc3fcd..7cd268b 100644
--- a/camel/tests/misc/url-scan.c
+++ b/camel/tests/misc/url-scan.c
@@ -28,12 +28,12 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <camel/camel-mime-filter-tohtml.h>
+#include <camel/camel.h>
 
 #include "camel-test.h"
 
 struct {
-	gchar *text, *url;
+	const gchar *text, *url;
 } url_tests[] = {
 	{ "bob foo com", "mailto:bob foo com" },
 	{ "Ends with bob foo com", "mailto:bob foo com" },
diff --git a/camel/tests/misc/url.c b/camel/tests/misc/url.c
index b3b186c..b620d06 100644
--- a/camel/tests/misc/url.c
+++ b/camel/tests/misc/url.c
@@ -4,14 +4,15 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <camel/camel-url.h>
+
+#include <camel/camel.h>
 
 #include "camel-test.h"
 
-gchar *base = "http://a/b/c/d;p?q#f";;
+const gchar *base = "http://a/b/c/d;p?q#f";;
 
 struct {
-	gchar *url_string, *result;
+	const gchar *url_string, *result;
 } tests[] = {
 	{ "g:h", "g:h" },
 	{ "g", "http://a/b/c/g"; },
@@ -73,20 +74,20 @@ gint
 main (gint argc, gchar **argv)
 {
 	CamelURL *base_url, *url;
-	CamelException ex;
 	gchar *url_string;
 	gint i;
+	GError *error = NULL;
 
 	camel_test_init (argc, argv);
 
 	camel_test_start ("URL parsing");
 
 	camel_test_push ("base URL parsing");
-	camel_exception_init (&ex);
-	base_url = camel_url_new (base, &ex);
+	base_url = camel_url_new (base, &error);
 	if (!base_url) {
-		camel_test_fail ("Could not parse %s: %s\n", base,
-				 camel_exception_get_description (&ex));
+		camel_test_fail (
+			"Could not parse %s: %s\n",
+			base, error->message);
 	}
 	camel_test_pull ();
 
diff --git a/camel/tests/misc/utf7.c b/camel/tests/misc/utf7.c
index 94dfe83..293671c 100644
--- a/camel/tests/misc/utf7.c
+++ b/camel/tests/misc/utf7.c
@@ -4,13 +4,14 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <camel/camel-utf8.h>
+
+#include <camel/camel.h>
 
 #include "camel-test.h"
 
 static struct {
 	guchar *utf8;
-	gchar *utf7;
+	const gchar *utf7;
 	guint32 unicode[200];
 } tests[] = {
 	/* the escape gchar */
diff --git a/camel/tests/smime/pgp.c b/camel/tests/smime/pgp.c
index f184802..7fa4fc6 100644
--- a/camel/tests/smime/pgp.c
+++ b/camel/tests/smime/pgp.c
@@ -28,17 +28,16 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/wait.h>
-#include <camel/camel-gpg-context.h>
-#include <camel/camel-stream-mem.h>
-#include <camel/camel-mime-part.h>
+
+#include <camel/camel.h>
 
 #include "camel-test.h"
 #include "session.h"
 
-#define CAMEL_PGP_SESSION_TYPE     (camel_pgp_session_get_type ())
-#define CAMEL_PGP_SESSION(obj)     (G_TYPE_CHECK_INSTANCE_CAST((obj), CAMEL_PGP_SESSION_TYPE, CamelPgpSession))
-#define CAMEL_PGP_SESSION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), CAMEL_PGP_SESSION_TYPE, CamelPgpSessionClass))
-#define CAMEL_PGP_IS_SESSION(o)    (G_TYPE_CHECK_INSTANCE_TYPE((o), CAMEL_PGP_SESSION_TYPE))
+#define CAMEL_TYPE_PGP_SESSION     (camel_pgp_session_get_type ())
+#define CAMEL_PGP_SESSION(obj)     (G_TYPE_CHECK_INSTANCE_CAST((obj), CAMEL_TYPE_PGP_SESSION, CamelPgpSession))
+#define CAMEL_PGP_SESSION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), CAMEL_TYPE_PGP_SESSION, CamelPgpSessionClass))
+#define CAMEL_PGP_IS_SESSION(o)    (G_TYPE_CHECK_INSTANCE_TYPE((o), CAMEL_TYPE_PGP_SESSION))
 
 typedef struct _CamelPgpSession {
 	CamelSession parent_object;
@@ -53,7 +52,7 @@ typedef struct _CamelPgpSessionClass {
 static gchar *get_password (CamelSession *session, const gchar *prompt,
 			   guint32 flags,
 			   CamelService *service, const gchar *item,
-			   CamelException *ex);
+			   GError **error);
 
 static void
 init (CamelPgpSession *session)
@@ -76,22 +75,21 @@ camel_pgp_session_get_type (void)
 	static GType type = G_TYPE_INVALID;
 
 	if (G_UNLIKELY (type == G_TYPE_INVALID))
-		type = camel_type_register (
+		type = g_type_register_static_simple (
 			camel_test_session_get_type (),
 			"CamelPgpSession",
-			sizeof (CamelPgpSession),
 			sizeof (CamelPgpSessionClass),
 			(GClassInitFunc) class_init,
-			NULL,
+			sizeof (CamelPgpSession),
 			(GInstanceInitFunc) init,
-			NULL);
+			0);
 
 	return type;
 }
 
 static gchar *
 get_password (CamelSession *session, const gchar *prompt, guint32 flags,
-	      CamelService *service, const gchar *item, CamelException *ex)
+	      CamelService *service, const gchar *item, GError **error)
 {
 	return g_strdup ("no.secret");
 }
@@ -111,15 +109,15 @@ gint main (gint argc, gchar **argv)
 {
 	CamelSession *session;
 	CamelCipherContext *ctx;
-	CamelException *ex;
 	CamelCipherValidity *valid;
 	CamelStream *stream1, *stream2;
+	GByteArray *buffer1, *buffer2;
 	struct _CamelMimePart *sigpart, *conpart, *encpart, *outpart;
 	CamelDataWrapper *dw;
 	GPtrArray *recipients;
-	GByteArray *buf;
 	gchar *before, *after;
 	gint ret;
+	GError *error = NULL;
 
 	if (getenv("CAMEL_TEST_GPG") == NULL)
 		return 77;
@@ -144,8 +142,6 @@ gint main (gint argc, gchar **argv)
 
 	session = camel_pgp_session_new ("/tmp/camel-test");
 
-	ex = camel_exception_new ();
-
 	ctx = camel_gpg_context_new (session);
 	camel_gpg_context_set_always_trust (CAMEL_GPG_CONTEXT (ctx), TRUE);
 
@@ -165,19 +161,19 @@ gint main (gint argc, gchar **argv)
 	sigpart = camel_mime_part_new();
 
 	camel_test_push ("PGP signing");
-	camel_cipher_sign (ctx, "no user no domain", CAMEL_CIPHER_HASH_SHA1, conpart, sigpart, ex);
-	if (camel_exception_is_set(ex)) {
-		printf("PGP signing failed assuming non-functional environment\n%s", camel_exception_get_description (ex));
+	camel_cipher_sign (ctx, "no user no domain", CAMEL_CIPHER_HASH_SHA1, conpart, sigpart, &error);
+	if (error != NULL) {
+		printf("PGP signing failed assuming non-functional environment\n%s", error->message);
 		camel_test_pull();
 		return 77;
 	}
 	camel_test_pull ();
 
-	camel_exception_clear (ex);
+	g_clear_error (&error);
 
 	camel_test_push ("PGP verify");
-	valid = camel_cipher_verify (ctx, sigpart, ex);
-	check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex));
+	valid = camel_cipher_verify (ctx, sigpart, &error);
+	check_msg (error == NULL, "%s", error->message);
 	check_msg (camel_cipher_validity_get_valid (valid), "%s", camel_cipher_validity_get_description (valid));
 	camel_cipher_validity_free (valid);
 	camel_test_pull ();
@@ -199,34 +195,34 @@ gint main (gint argc, gchar **argv)
 
 	encpart = camel_mime_part_new();
 
-	camel_exception_clear (ex);
+	g_clear_error (&error);
 
 	camel_test_push ("PGP encrypt");
 	recipients = g_ptr_array_new ();
-	g_ptr_array_add (recipients, "no user no domain");
-	camel_cipher_encrypt (ctx, "no user no domain", recipients, conpart, encpart, ex);
-	check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex));
+	g_ptr_array_add (recipients, (guint8 *) "no user no domain");
+	camel_cipher_encrypt (ctx, "no user no domain", recipients, conpart, encpart, &error);
+	check_msg (error == NULL, "%s", error->message);
 	g_ptr_array_free (recipients, TRUE);
 	camel_test_pull ();
 
-	camel_exception_clear (ex);
+	g_clear_error (&error);
 
 	camel_test_push ("PGP decrypt");
 	outpart = camel_mime_part_new();
-	valid = camel_cipher_decrypt (ctx, encpart, outpart, ex);
-	check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex));
+	valid = camel_cipher_decrypt (ctx, encpart, outpart, &error);
+	check_msg (error == NULL, "%s", error->message);
 	check_msg (valid->encrypt.status == CAMEL_CIPHER_VALIDITY_ENCRYPT_ENCRYPTED, "%s", valid->encrypt.description);
 
-	stream1 = camel_stream_mem_new();
-	stream2 = camel_stream_mem_new();
+	buffer1 = g_byte_array_new ();
+	stream1 = camel_stream_mem_new_with_byte_array (buffer1);
+	buffer2 = g_byte_array_new ();
+	stream2 = camel_stream_mem_new_with_byte_array (buffer2);
 
 	camel_data_wrapper_write_to_stream((CamelDataWrapper *)conpart, stream1);
 	camel_data_wrapper_write_to_stream((CamelDataWrapper *)outpart, stream2);
 
-	buf = CAMEL_STREAM_MEM (stream1)->buffer;
-	before = g_strndup (buf->data, buf->len);
-	buf = CAMEL_STREAM_MEM (stream2)->buffer;
-	after = g_strndup (buf->data, buf->len);
+	before = g_strndup ((gchar *) buffer1->data, buffer1->len);
+	after = g_strndup ((gchar *) buffer2->data, buffer2->len);
 	check_msg (string_equal (before, after), "before = '%s', after = '%s'", before, after);
 	g_free (before);
 	g_free (after);
diff --git a/camel/tests/stream/test1.c b/camel/tests/stream/test1.c
index eea05f8..a441108 100644
--- a/camel/tests/stream/test1.c
+++ b/camel/tests/stream/test1.c
@@ -8,9 +8,10 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
-#include "camel/camel-stream-fs.h"
+#include <camel/camel.h>
 
-gint main(gint argc, gchar **argv)
+gint
+main(gint argc, gchar **argv)
 {
 	CamelSeekableStream *ss = NULL;
 	gint i;
@@ -44,7 +45,7 @@ gint main(gint argc, gchar **argv)
 		switch (i) {
 		case 0:
 			ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_CREAT|O_RDWR|O_TRUNC, 0600);
-			fd = ((CamelStreamFs *)ss)->fd;
+			fd = camel_stream_fs_get_fd ((CamelStreamFs *)ss);
 			break;
 		case 1:
 			fd = open("stream.txt", O_CREAT|O_RDWR|O_TRUNC, 0600);
@@ -72,7 +73,7 @@ gint main(gint argc, gchar **argv)
 		switch (i) {
 		case 0:
 			ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_RDWR, 0);
-			fd = ((CamelStreamFs *)ss)->fd;
+			fd = camel_stream_fs_get_fd ((CamelStreamFs *)ss);
 			break;
 		case 1:
 			fd = open("stream.txt", O_RDWR, 0);
@@ -92,7 +93,7 @@ gint main(gint argc, gchar **argv)
 		switch (i) {
 		case 0:
 			ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_RDWR|O_TRUNC, 0);
-			fd = ((CamelStreamFs *)ss)->fd;
+			fd = camel_stream_fs_get_fd ((CamelStreamFs *)ss);
 			break;
 		case 1:
 			fd = open("stream.txt", O_RDWR|O_TRUNC, 0);
diff --git a/camel/tests/stream/test2.c b/camel/tests/stream/test2.c
index 5ef0fc0..3836d0e 100644
--- a/camel/tests/stream/test2.c
+++ b/camel/tests/stream/test2.c
@@ -8,17 +8,14 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
-#include "camel/camel-stream-mem.h"
+#include <camel/camel.h>
 
-gint main(gint argc, gchar **argv)
+gint
+main(gint argc, gchar **argv)
 {
 	CamelSeekableStream *ss = NULL;
-	gint i;
-	gint fd = -1;
-	struct stat st;
-	gint size;
-	gchar buffer[1024];
 	GByteArray *ba;
+	gint i;
 
 	camel_test_init(argc, argv);
 
diff --git a/camel/tests/stream/test3.c b/camel/tests/stream/test3.c
index d11015d..b76d687 100644
--- a/camel/tests/stream/test3.c
+++ b/camel/tests/stream/test3.c
@@ -8,9 +8,7 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
-#include "camel/camel-stream-mem.h"
-#include "camel/camel-stream-fs.h"
-#include "camel/camel-seekable-substream.h"
+#include <camel/camel.h>
 
 struct {
 	off_t lower, upper;
@@ -33,7 +31,8 @@ struct {
 	{ 10245, CAMEL_STREAM_UNBOUND },
 };
 
-gint main(gint argc, gchar **argv)
+gint
+main(gint argc, gchar **argv)
 {
 	CamelSeekableStream *ss = NULL;
 	gint i, j;
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 9a53c18..f88318d 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -45,7 +45,6 @@ camel/camel-digest-summary.c
 camel/camel-disco-diary.c
 camel/camel-disco-folder.c
 camel/camel-disco-store.c
-camel/camel-exception.c
 camel/camel-file-utils.c
 camel/camel-filter-driver.c
 camel/camel-filter-search.c



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