[evolution-data-server/eclient] New EBookClient/ECalClient API deprecating EBook/ECal



commit 43a8ec0adbfa3167608e26aab50cc2bbcaa1f81b
Author: Milan Crha <mcrha redhat com>
Date:   Mon Apr 18 15:44:58 2011 +0200

    New EBookClient/ECalClient API deprecating EBook/ECal

 addressbook/backends/file/e-book-backend-file.c    |  326 +-
 .../backends/google/e-book-backend-google.c        |  186 +-
 .../backends/groupwise/e-book-backend-groupwise.c  | 1301 ++--
 addressbook/backends/ldap/e-book-backend-ldap.c    | 1035 ++--
 addressbook/backends/vcf/e-book-backend-vcf.c      |  119 +-
 .../backends/webdav/e-book-backend-webdav.c        |  191 +-
 addressbook/libebook/Makefile.am                   |    2 +
 addressbook/libebook/e-book-client.c               | 2477 +++++++
 addressbook/libebook/e-book-client.h               |  160 +
 addressbook/libebook/e-book-view-private.h         |    5 +-
 addressbook/libebook/e-book-view.c                 |   99 +-
 addressbook/libebook/e-book-view.h                 |   16 +-
 addressbook/libebook/e-book.c                      |  308 +-
 addressbook/libebook/e-book.h                      |    5 +
 addressbook/libedata-book/Makefile.am              |    1 -
 addressbook/libedata-book/e-book-backend-sync.c    |  325 +-
 addressbook/libedata-book/e-book-backend-sync.h    |   83 +-
 addressbook/libedata-book/e-book-backend.c         |  578 +--
 addressbook/libedata-book/e-book-backend.h         |  207 +-
 addressbook/libedata-book/e-data-book-factory.c    |   41 +-
 addressbook/libedata-book/e-data-book-factory.h    |    2 +-
 addressbook/libedata-book/e-data-book-types.h      |   17 -
 addressbook/libedata-book/e-data-book-view.c       |   61 +-
 addressbook/libedata-book/e-data-book-view.h       |   51 +-
 addressbook/libedata-book/e-data-book.c            |  855 ++-
 addressbook/libedata-book/e-data-book.h            |   89 +-
 addressbook/libedata-book/opid.c                   |   75 -
 addressbook/libedata-book/opid.h                   |   28 -
 addressbook/libegdbus/Makefile.am                  |   28 +-
 addressbook/libegdbus/e-gdbus-book-factory.c       |  551 ++
 addressbook/libegdbus/e-gdbus-book-factory.h       |  120 +
 addressbook/libegdbus/e-gdbus-book-view.c          |  668 ++
 addressbook/libegdbus/e-gdbus-book-view.h          |  148 +
 addressbook/libegdbus/e-gdbus-book.c               | 1120 +++
 addressbook/libegdbus/e-gdbus-book.h               |  273 +
 addressbook/libegdbus/e-gdbus-egdbusbook.c         | 4483 ------------
 addressbook/libegdbus/e-gdbus-egdbusbook.h         |  640 --
 addressbook/libegdbus/e-gdbus-egdbusbookfactory.c  | 1112 ---
 addressbook/libegdbus/e-gdbus-egdbusbookfactory.h  |  202 -
 addressbook/libegdbus/e-gdbus-egdbusbookview.c     | 2025 ------
 addressbook/libegdbus/e-gdbus-egdbusbookview.h     |  285 -
 addressbook/libegdbus/e-gdbus-marshallers.c        |  343 -
 addressbook/libegdbus/e-gdbus-marshallers.h        |   77 -
 addressbook/libegdbus/e-gdbus-typemappers.h        |   11 -
 calendar/backends/caldav/e-cal-backend-caldav.c    |  445 +-
 .../backends/contacts/e-cal-backend-contacts.c     |  190 +-
 calendar/backends/file/e-cal-backend-file.c        |  621 +--
 .../groupwise/e-cal-backend-groupwise-utils.c      |   22 +-
 .../groupwise/e-cal-backend-groupwise-utils.h      |    2 +-
 .../backends/groupwise/e-cal-backend-groupwise.c   |  653 +--
 calendar/backends/http/e-cal-backend-http.c        |  348 +-
 calendar/backends/weather/e-cal-backend-weather.c  |  235 +-
 calendar/libecal/Makefile.am                       |    2 +
 calendar/libecal/e-cal-client.c                    | 4393 ++++++++++++
 calendar/libecal/e-cal-client.h                    |  211 +
 calendar/libecal/e-cal-component.c                 |    6 +-
 calendar/libecal/e-cal-types.h                     |    3 +-
 calendar/libecal/e-cal-util.c                      |    5 +-
 calendar/libecal/e-cal-view-private.h              |    6 +-
 calendar/libecal/e-cal-view.c                      |  104 +-
 calendar/libecal/e-cal-view.h                      |   11 +
 calendar/libecal/e-cal.c                           |  728 ++-
 calendar/libecal/e-cal.h                           |   12 +
 calendar/libedata-cal/e-cal-backend-sexp.c         |    8 +-
 calendar/libedata-cal/e-cal-backend-sync.c         |  721 +--
 calendar/libedata-cal/e-cal-backend-sync.h         |  213 +-
 calendar/libedata-cal/e-cal-backend.c              | 1242 ++--
 calendar/libedata-cal/e-cal-backend.h              |  222 +-
 calendar/libedata-cal/e-data-cal-common.h          |    3 -
 calendar/libedata-cal/e-data-cal-factory.c         |   68 +-
 calendar/libedata-cal/e-data-cal-factory.h         |   15 +-
 calendar/libedata-cal/e-data-cal-types.h           |   12 -
 calendar/libedata-cal/e-data-cal-view.c            |  254 +-
 calendar/libedata-cal/e-data-cal-view.h            |   52 +-
 calendar/libedata-cal/e-data-cal.c                 | 1483 +++--
 calendar/libedata-cal/e-data-cal.h                 |   94 +-
 calendar/libegdbus/Makefile.am                     |   27 +-
 calendar/libegdbus/e-gdbus-cal-factory.c           |  604 ++
 calendar/libegdbus/e-gdbus-cal-factory.h           |  116 +
 calendar/libegdbus/e-gdbus-cal-view.c              |  669 ++
 calendar/libegdbus/e-gdbus-cal-view.h              |  141 +
 calendar/libegdbus/e-gdbus-cal.c                   | 1581 +++++
 calendar/libegdbus/e-gdbus-cal.h                   |  347 +
 calendar/libegdbus/e-gdbus-egdbuscal.c             | 7222 --------------------
 calendar/libegdbus/e-gdbus-egdbuscal.h             | 1011 ---
 calendar/libegdbus/e-gdbus-egdbuscalfactory.c      | 1130 ---
 calendar/libegdbus/e-gdbus-egdbuscalfactory.h      |  205 -
 calendar/libegdbus/e-gdbus-egdbuscalview.c         | 2043 ------
 calendar/libegdbus/e-gdbus-egdbuscalview.h         |  287 -
 calendar/libegdbus/e-gdbus-marshallers.c           |  474 --
 calendar/libegdbus/e-gdbus-marshallers.h           |  104 -
 calendar/libegdbus/e-gdbus-marshallers.list        |   14 -
 calendar/libegdbus/e-gdbus-typemappers.h           |   11 -
 configure.ac                                       |   14 +-
 libedataserver/Makefile.am                         |   16 +-
 libedataserver/e-client.c                          | 1951 ++++++
 libedataserver/e-client.h                          |  168 +
 libedataserver/e-credentials.c                     |  560 ++
 libedataserver/e-credentials.h                     |   86 +
 libedataserver/e-data-server-util.c                |   84 +
 libedataserver/e-data-server-util.h                |    5 +
 .../e-gdbus-marshallers.list                       |   17 +-
 libedataserver/e-gdbus-templates.c                 | 1663 +++++
 libedataserver/e-gdbus-templates.h                 |  747 ++
 libedataserver/e-operation-pool.c                  |  136 +
 libedataserver/e-operation-pool.h                  |   36 +
 libedataserverui/Makefile.am                       |   11 +-
 libedataserverui/e-client-authenticate.c           |  185 +
 libedataserverui/e-client-authenticate.h           |   37 +
 po/POTFILES.in                                     |    3 +
 tests/libebook/Makefile.am                         |    2 +-
 tests/libebook/client/Makefile.am                  |  104 +
 tests/libebook/client/client-test-utils.c          |  434 ++
 tests/libebook/client/client-test-utils.h          |   27 +
 tests/libebook/client/test-client-add-contact.c    |  101 +
 tests/libebook/client/test-client-async.c          |  130 +
 tests/libebook/client/test-client-get-book-view.c  |  168 +
 .../libebook/client/test-client-get-capabilities.c |  250 +
 tests/libebook/client/test-client-get-contact.c    |   75 +
 .../client/test-client-get-required-fields.c       |  235 +
 .../test-client-get-supported-auth-methods.c       |  235 +
 .../client/test-client-get-supported-fields.c      |  235 +
 tests/libebook/client/test-client-modify-contact.c |  168 +
 tests/libebook/client/test-client-nonexistent-id.c |   44 +
 .../client/test-client-remove-contact-by-uid.c     |  132 +
 tests/libebook/client/test-client-remove-contact.c |  136 +
 .../libebook/client/test-client-remove-contacts.c  |  166 +
 tests/libebook/client/test-client-remove.c         |   73 +
 tests/libebook/client/test-client-search.c         |   62 +
 tests/libebook/client/test-client-self.c           |   46 +
 .../client/test-client-stress-factory--fifo.c      |   50 +
 .../client/test-client-stress-factory--serial.c    |   37 +
 .../test-client-stress-factory--single-book.c      |   62 +
 tests/libebook/client/test-client-stress-views.c   |  124 +
 tests/libebook/client/test-client.c                |   78 +
 tests/libebook/test-categories.c                   |    2 +-
 tests/libebook/test-date.c                         |    2 +-
 tests/libebook/test-photo.c                        |    2 +-
 tests/libebook/test-query.c                        |    2 +-
 tests/libebook/test-string.c                       |    2 +-
 tests/libebook/test-undefinedfield.c               |    2 +-
 tests/libebook/test-untyped-phones.c               |    2 +-
 tests/libecal/Makefile.am                          |    2 +
 tests/libecal/client/Makefile.am                   |   89 +
 tests/libecal/client/client-test-utils.c           |  350 +
 tests/libecal/client/client-test-utils.h           |   25 +
 tests/libecal/client/test-client-add-timezone.c    |  218 +
 tests/libecal/client/test-client-create-object.c   |  319 +
 tests/libecal/client/test-client-examine.c         |  489 ++
 .../client/test-client-get-attachment-uris.c       |  196 +
 tests/libecal/client/test-client-get-free-busy.c   |  159 +
 tests/libecal/client/test-client-get-object-list.c |  210 +
 tests/libecal/client/test-client-get-view.c        |  227 +
 tests/libecal/client/test-client-modify-object.c   |  199 +
 tests/libecal/client/test-client-open.c            |  134 +
 tests/libecal/client/test-client-receive-objects.c |  148 +
 tests/libecal/client/test-client-refresh.c         |  135 +
 tests/libecal/client/test-client-remove-object.c   |  162 +
 tests/libecal/client/test-client-send-objects.c    |  175 +
 .../client/test-client-stress-factory--fifo.c      |   51 +
 .../client/test-client-stress-factory--serial.c    |   38 +
 .../test-client-stress-factory--single-cal.c       |   63 +
 tests/libecal/client/test-client-stress-views.c    |  116 +
 163 files changed, 32160 insertions(+), 29351 deletions(-)
---
diff --git a/addressbook/backends/file/e-book-backend-file.c b/addressbook/backends/file/e-book-backend-file.c
index 5020a0f..49d32f1 100644
--- a/addressbook/backends/file/e-book-backend-file.c
+++ b/addressbook/backends/file/e-book-backend-file.c
@@ -248,7 +248,7 @@ do_create (EBookBackendFile  *bf,
 static void
 e_book_backend_file_create_contact (EBookBackendSync *backend,
 				    EDataBook *book,
-				    guint32 opid,
+				    GCancellable *cancellable,
 				    const gchar *vcard,
 				    EContact **contact,
 				    GError **perror)
@@ -263,18 +263,18 @@ e_book_backend_file_create_contact (EBookBackendSync *backend,
 static void
 e_book_backend_file_remove_contacts (EBookBackendSync *backend,
 				     EDataBook *book,
-				     guint32 opid,
-				     GList *id_list,
-				     GList **ids,
+				     GCancellable *cancellable,
+				     const GSList *id_list,
+				     GSList **ids,
 				     GError **perror)
 {
 	EBookBackendFile *bf = E_BOOK_BACKEND_FILE (backend);
 	DB             *db = bf->priv->file_db;
 	DBT            id_dbt;
 	gint            db_error;
-	gchar          *id;
-	GList         *l;
-	GList         *removed_cards = NULL;
+	const gchar    *id;
+	const GSList   *l;
+	GSList         *removed_cards = NULL;
 
 	for (l = id_list; l; l = l->next) {
 		id = l->data;
@@ -288,7 +288,7 @@ e_book_backend_file_remove_contacts (EBookBackendSync *backend,
 			continue;
 		}
 
-		removed_cards = g_list_prepend (removed_cards, id);
+		removed_cards = g_slist_prepend (removed_cards, g_strdup (id));
 	}
 
 	/* if we actually removed some, try to sync */
@@ -301,7 +301,7 @@ e_book_backend_file_remove_contacts (EBookBackendSync *backend,
 	*ids = removed_cards;
 
 	for (l = removed_cards; l; l = l->next) {
-		gchar *id = l->data;
+		id = l->data;
 		e_book_backend_summary_remove_contact (bf->priv->summary, id);
 	}
 }
@@ -309,7 +309,7 @@ e_book_backend_file_remove_contacts (EBookBackendSync *backend,
 static void
 e_book_backend_file_modify_contact (EBookBackendSync *backend,
 				    EDataBook *book,
-				    guint32 opid,
+				    GCancellable *cancellable,
 				    const gchar *vcard,
 				    EContact **contact,
 				    GError **perror)
@@ -368,7 +368,7 @@ e_book_backend_file_modify_contact (EBookBackendSync *backend,
 static void
 e_book_backend_file_get_contact (EBookBackendSync *backend,
 				 EDataBook *book,
-				 guint32 opid,
+				 GCancellable *cancellable,
 				 const gchar *id,
 				 gchar **vcard,
 				 GError **perror)
@@ -400,9 +400,9 @@ e_book_backend_file_get_contact (EBookBackendSync *backend,
 static void
 e_book_backend_file_get_contact_list (EBookBackendSync *backend,
 				      EDataBook *book,
-				      guint32 opid,
+				      GCancellable *cancellable,
 				      const gchar *query,
-				      GList **contacts,
+				      GSList **contacts,
 				      GError **perror)
 {
 	EBookBackendFile *bf = E_BOOK_BACKEND_FILE (backend);
@@ -413,7 +413,7 @@ e_book_backend_file_get_contact_list (EBookBackendSync *backend,
 	EBookBackendSExp *card_sexp = NULL;
 	gboolean search_needed;
 	const gchar *search = query;
-	GList *contact_list = NULL;
+	GSList *contact_list = NULL;
 
 	d(printf ("e_book_backend_file_get_contact_list (%s)\n", search));
 	if (e_book_backend_summary_is_summary_query (bf->priv->summary, search)) {
@@ -435,7 +435,7 @@ e_book_backend_file_get_contact_list (EBookBackendSync *backend,
 
 			db_error = db->get (db, NULL, &id_dbt, &vcard_dbt, 0);
 			if (db_error == 0) {
-				contact_list = g_list_prepend (contact_list, vcard_dbt.data);
+				contact_list = g_slist_prepend (contact_list, vcard_dbt.data);
 			} else {
 				g_warning (G_STRLOC ": db->get failed with %s", db_strerror (db_error));
 				db_error_to_gerror (db_error, perror);
@@ -475,7 +475,7 @@ e_book_backend_file_get_contact_list (EBookBackendSync *backend,
 			    || strcmp (id_dbt.data, E_BOOK_BACKEND_FILE_VERSION_NAME)) {
 
 				if ((!search_needed) || (card_sexp != NULL && e_book_backend_sexp_match_vcard  (card_sexp, vcard_dbt.data))) {
-					contact_list = g_list_prepend (contact_list, vcard_dbt.data);
+					contact_list = g_slist_prepend (contact_list, vcard_dbt.data);
 				}
 			}
 
@@ -567,10 +567,10 @@ book_view_thread (gpointer data)
 	query = e_data_book_view_get_card_query (book_view);
 
 	if ( !strcmp (query, "(contains \"x-evolution-any-field\" \"\")")) {
-		e_data_book_view_notify_status_message (book_view, _("Loading..."));
+		e_data_book_view_notify_progress (book_view, -1, _("Loading..."));
 		allcontacts = TRUE;
 	} else {
-		e_data_book_view_notify_status_message (book_view, _("Searching..."));
+		e_data_book_view_notify_progress (book_view, -1, _("Searching..."));
 		allcontacts = FALSE;
 	}
 
@@ -695,216 +695,55 @@ e_book_backend_file_stop_book_view (EBookBackend  *backend,
 		g_thread_join (closure->thread);
 }
 
-typedef struct {
-	DB *db;
-
-	GList *add_cards;
-	GList *add_ids;
-	GList *mod_cards;
-	GList *mod_ids;
-	GList *del_ids;
-	GList *del_cards;
-} EBookBackendFileChangeContext;
-
-static void
-e_book_backend_file_changes_foreach_key (const gchar *key, gpointer user_data)
-{
-	EBookBackendFileChangeContext *ctx = user_data;
-	DB      *db = ctx->db;
-	DBT     id_dbt, vcard_dbt;
-	gint     db_error = 0;
-
-	string_to_dbt (key, &id_dbt);
-	memset (&vcard_dbt, 0, sizeof (vcard_dbt));
-	vcard_dbt.flags = DB_DBT_MALLOC;
-
-	db_error = db->get (db, NULL, &id_dbt, &vcard_dbt, 0);
-
-	if (db_error != 0) {
-		EContact *contact;
-		gchar *id = id_dbt.data;
-		gchar *vcard_string;
-
-		contact = e_contact_new ();
-		e_contact_set (contact, E_CONTACT_UID, id);
-
-		vcard_string = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
-
-		ctx->del_ids = g_list_append (ctx->del_ids,
-					      g_strdup (id));
-		ctx->del_cards = g_list_append (ctx->del_cards,
-						vcard_string);
-
-		g_object_unref (contact);
-
-		g_free (vcard_dbt.data);
-	}
-}
-
-static void
-e_book_backend_file_get_changes (EBookBackendSync *backend,
-				 EDataBook *book,
-				 guint32 opid,
-				 const gchar *change_id,
-				 GList **changes_out,
-				 GError **perror)
+static gchar *
+e_book_backend_file_extract_path_from_source (ESource *source)
 {
-	EBookBackendFile *bf = E_BOOK_BACKEND_FILE (backend);
-	gint     db_error = 0;
-	DBT     id_dbt, vcard_dbt;
-	gchar    *filename;
-	EDbHash *ehash;
-	GList *i, *v;
-	DB      *db = bf->priv->file_db;
-	DBC *dbc;
-	GList *changes = NULL;
-	EBookBackendFileChangeContext ctx;
-
-	memset (&id_dbt, 0, sizeof (id_dbt));
-	memset (&vcard_dbt, 0, sizeof (vcard_dbt));
-
-	memset (&ctx, 0, sizeof (ctx));
-
-	ctx.db = db;
-
-	/* Find the changed ids */
-	filename = g_strdup_printf ("%s/%s" CHANGES_DB_SUFFIX, bf->priv->dirname, change_id);
-	ehash = e_dbhash_new (filename);
-	g_free (filename);
-
-	db_error = db->cursor (db, NULL, &dbc, 0);
-
-	if (db_error != 0) {
-		g_warning (G_STRLOC ": db->cursor failed with %s", db_strerror (db_error));
-	} else {
-		db_error = dbc->c_get (dbc, &id_dbt, &vcard_dbt, DB_FIRST);
-
-		while (db_error == 0) {
+	gchar *filename = NULL;
+	const gchar *absolute_uri;
 
-			/* don't include the version in the list of cards */
-			if (id_dbt.size != strlen (E_BOOK_BACKEND_FILE_VERSION_NAME) + 1
-			    || strcmp (id_dbt.data, E_BOOK_BACKEND_FILE_VERSION_NAME)) {
-				EContact *contact;
-				gchar *id = id_dbt.data;
-				gchar *vcard_string;
+	absolute_uri = e_source_peek_absolute_uri (source);
 
-				/* Remove fields the user can't change
-				 * and can change without the rest of the
-				 * card changing
-				 */
-				contact = create_contact (id_dbt.data, vcard_dbt.data);
+	if (absolute_uri && g_str_has_prefix (absolute_uri, "local://")) {
+		gchar *uri;
 
-#ifdef notyet
-				g_object_set (card, "last_use", NULL, "use_score", 0.0, NULL);
-#endif
-				vcard_string = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
-				g_object_unref (contact);
-
-				/* check what type of change has occurred, if any */
-				switch (e_dbhash_compare (ehash, id, vcard_string)) {
-				case E_DBHASH_STATUS_SAME:
-					g_free (vcard_string);
-					break;
-				case E_DBHASH_STATUS_NOT_FOUND:
-					ctx.add_cards = g_list_append (ctx.add_cards, vcard_string);
-					ctx.add_ids = g_list_append (ctx.add_ids, g_strdup (id));
-					break;
-				case E_DBHASH_STATUS_DIFFERENT:
-					ctx.mod_cards = g_list_append (ctx.mod_cards, vcard_string);
-					ctx.mod_ids = g_list_append (ctx.mod_ids, g_strdup (id));
-					break;
-				}
-			}
+		uri = g_strconcat ("file://", absolute_uri + 8, NULL);
+		filename = g_filename_from_uri (uri, NULL, NULL);
+		g_free (uri);
 
-			db_error = dbc->c_get (dbc, &id_dbt, &vcard_dbt, DB_NEXT);
+		if (!g_file_test (filename, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
+			g_free (filename);
+			filename = NULL;
 		}
-		dbc->c_close (dbc);
 	}
 
-	e_dbhash_foreach_key (ehash, (EDbHashFunc)e_book_backend_file_changes_foreach_key, &ctx);
+	if (!filename) {
+		const gchar *user_data_dir;
+		const gchar *source_dir;
+		gchar *mangled_source_dir;
 
-	/* Send the changes */
-	if (db_error != DB_NOTFOUND) {
-		g_warning ("e_book_backend_file_changes: error building list\n");
-		*changes_out = NULL;
-		db_error_to_gerror (db_error, perror);
-	}
-	else {
-		/* Update the hash and build our changes list */
-		for (i = ctx.add_ids, v = ctx.add_cards; i != NULL; i = i->next, v = v->next) {
-			gchar *id = i->data;
-			gchar *vcard = v->data;
+		user_data_dir = e_get_user_data_dir ();
+		source_dir = e_source_peek_relative_uri (source);
 
-			e_dbhash_add (ehash, id, vcard);
-			changes = g_list_prepend (changes,
-						  e_book_backend_change_add_new (vcard));
+		if (!source_dir || !g_str_equal (source_dir, "system"))
+			source_dir = e_source_peek_uid (source);
 
-			g_free (i->data);
-			g_free (v->data);
-		}
-		for (i = ctx.mod_ids, v = ctx.mod_cards; i != NULL; i = i->next, v = v->next) {
-			gchar *id = i->data;
-			gchar *vcard = v->data;
+		/* Mangle the URI to not contain invalid characters. */
+		mangled_source_dir = g_strdelimit (g_strdup (source_dir), ":/", '_');
 
-			e_dbhash_add (ehash, id, vcard);
-			changes = g_list_prepend (changes,
-						  e_book_backend_change_modify_new (vcard));
-
-			g_free (i->data);
-			g_free (v->data);
-		}
-		for (i = ctx.del_ids, v = ctx.del_cards; i != NULL; i = i->next, v = v->next) {
-			gchar *id = i->data;
-			gchar *vcard = v->data;
+		filename = g_build_filename (
+			user_data_dir, "addressbook", mangled_source_dir, NULL);
 
-			e_dbhash_remove (ehash, id);
-
-			changes = g_list_prepend (changes,
-						  e_book_backend_change_delete_new (vcard));
-			g_free (i->data);
-			g_free (v->data);
-		}
-
-		e_dbhash_write (ehash);
-
-		*changes_out = changes;
+		g_free (mangled_source_dir);
 	}
 
-	e_dbhash_destroy (ehash);
-}
-
-static gchar *
-e_book_backend_file_extract_path_from_source (ESource *source)
-{
-	const gchar *user_data_dir;
-	const gchar *source_dir;
-	gchar *mangled_source_dir;
-	gchar *filename;
-
-	user_data_dir = e_get_user_data_dir ();
-	source_dir = e_source_peek_relative_uri (source);
-
-	if (!source_dir || !g_str_equal (source_dir, "system"))
-		source_dir = e_source_peek_uid (source);
-
-	/* Mangle the URI to not contain invalid characters. */
-	mangled_source_dir = g_strdelimit (g_strdup (source_dir), ":/", '_');
-
-	filename = g_build_filename (
-		user_data_dir, "addressbook", mangled_source_dir, NULL);
-
-	g_free (mangled_source_dir);
-
 	return filename;
 }
 
 static void
 e_book_backend_file_authenticate_user (EBookBackendSync *backend,
 				       EDataBook *book,
-				       guint32 opid,
-				       const gchar *user,
-				       const gchar *passwd,
-				       const gchar *auth_method,
+				       GCancellable *cancellable,
+				       ECredentials *credentials,
 				       GError **perror)
 {
 	/* Success */
@@ -913,21 +752,21 @@ e_book_backend_file_authenticate_user (EBookBackendSync *backend,
 static void
 e_book_backend_file_get_required_fields (EBookBackendSync *backend,
 					  EDataBook *book,
-					  guint32 opid,
-					  GList **fields_out,
+					  GCancellable *cancellable,
+					  GSList **fields_out,
 					  GError **perror)
 {
-	GList *fields = NULL;
+	GSList *fields = NULL;
 
-	fields = g_list_append (fields , g_strdup (e_contact_field_name (E_CONTACT_FILE_AS)));
+	fields = g_slist_append (fields , g_strdup (e_contact_field_name (E_CONTACT_FILE_AS)));
 	*fields_out = fields;
 }
 
 static void
 e_book_backend_file_get_supported_auth_methods (EBookBackendSync *backend,
 						EDataBook *book,
-						guint32 opid,
-						GList **methods_out,
+						GCancellable *cancellable,
+						GSList **methods_out,
 						GError **perror)
 {
 	*methods_out = NULL;
@@ -936,17 +775,17 @@ e_book_backend_file_get_supported_auth_methods (EBookBackendSync *backend,
 static void
 e_book_backend_file_get_supported_fields (EBookBackendSync *backend,
 					  EDataBook *book,
-					  guint32 opid,
-					  GList **fields_out,
+					  GCancellable *cancellable,
+					  GSList **fields_out,
 					  GError **perror)
 {
-	GList *fields = NULL;
+	GSList *fields = NULL;
 	gint i;
 
 	/* XXX we need a way to say "we support everything", since the
 	   file backend does */
 	for (i = 1; i < E_CONTACT_FIELD_LAST; i++)
-		fields = g_list_append (fields, g_strdup (e_contact_field_name (i)));
+		fields = g_slist_append (fields, g_strdup (e_contact_field_name (i)));
 
 	*fields_out = fields;
 }
@@ -1095,14 +934,16 @@ file_errcall (const gchar *buf1, gchar *buf2)
 }
 
 static void
-e_book_backend_file_load_source (EBookBackend           *backend,
-				 ESource                *source,
-				 gboolean                only_if_exists,
-				 GError                **perror)
+e_book_backend_file_open (EBookBackendSync       *backend,
+			  EDataBook              *book,
+			  GCancellable		*cancellable,
+			  gboolean               only_if_exists,
+			  GError	       **perror)
 {
 	EBookBackendFile *bf = E_BOOK_BACKEND_FILE (backend);
 	gchar           *dirname, *filename;
-	gboolean        writable = FALSE;
+	gboolean        readonly = TRUE;
+	ESource *source = e_book_backend_get_source (E_BOOK_BACKEND (backend));
 	gint             db_error;
 	DB *db;
 	DB_ENV *env;
@@ -1197,7 +1038,7 @@ e_book_backend_file_load_source (EBookBackend           *backend,
 	}
 
 	if (db_error == 0) {
-		writable = TRUE;
+		readonly = FALSE;
 	} else {
 		db->close (db, 0);
 		db_error = db_create (&db, env, 0);
@@ -1241,7 +1082,7 @@ e_book_backend_file_load_source (EBookBackend           *backend,
 			db_error = (*db->open) (db, NULL, filename, NULL, DB_HASH, DB_CREATE | DB_THREAD, 0666);
 			if (db_error != 0) {
 				db->close (db, 0);
-				g_warning ("db->open (... DB_CREATE ...) failed with %s", db_strerror (db_error));
+				g_warning ("db->open (... %s ... DB_CREATE ...) failed with %s", filename, db_strerror (db_error));
 			}
 			else {
 #ifdef CREATE_DEFAULT_VCARD
@@ -1253,7 +1094,7 @@ e_book_backend_file_load_source (EBookBackend           *backend,
 					g_object_unref (contact);
 #endif
 
-				writable = TRUE;
+				readonly = FALSE;
 			}
 		}
 	}
@@ -1302,8 +1143,10 @@ e_book_backend_file_load_source (EBookBackend           *backend,
 		}
 	}
 
-	e_book_backend_set_is_loaded (backend, TRUE);
-	e_book_backend_set_is_writable (backend, writable);
+	e_book_backend_set_is_loaded (E_BOOK_BACKEND (backend), TRUE);
+	e_book_backend_set_is_readonly (E_BOOK_BACKEND (backend), readonly);
+	e_book_backend_notify_online (E_BOOK_BACKEND (backend), TRUE);
+	e_book_backend_notify_readonly (E_BOOK_BACKEND (backend), readonly);
 }
 
 static gboolean
@@ -1327,7 +1170,7 @@ select_changes (const gchar *name)
 static void
 e_book_backend_file_remove (EBookBackendSync *backend,
 			    EDataBook        *book,
-			    guint32           opid,
+			    GCancellable *cancellable,
 			    GError          **perror)
 {
 	EBookBackendFile *bf = E_BOOK_BACKEND_FILE (backend);
@@ -1375,25 +1218,17 @@ e_book_backend_file_remove (EBookBackendSync *backend,
 	   that the addressbook is still valid */
 }
 
-static gchar *
-e_book_backend_file_get_static_capabilities (EBookBackend *backend)
-{
-	return g_strdup("local,do-initial-query,bulk-removes,contact-lists");
-}
-
 static void
-e_book_backend_file_cancel_operation (EBookBackend *backend, EDataBook *book, GError **perror)
+e_book_backend_file_get_capabilities (EBookBackendSync *backend, EDataBook *book, GCancellable *cancellable, gchar **capabilities, GError **error)
 {
-	g_propagate_error (perror, EDB_ERROR (COULD_NOT_CANCEL));
+	*capabilities = g_strdup ("local,do-initial-query,bulk-removes,contact-lists");
 }
 
 static void
-e_book_backend_file_set_mode (EBookBackend *backend, EDataBookMode mode)
+e_book_backend_file_set_online (EBookBackend *backend, gboolean is_online)
 {
-	if (e_book_backend_is_loaded (backend)) {
-		e_book_backend_notify_writable (backend, TRUE);
-		e_book_backend_notify_connection_status (backend, TRUE);
-	}
+	if (e_book_backend_is_loaded (backend))
+		e_book_backend_notify_online (backend, TRUE);
 }
 
 static void
@@ -1519,20 +1354,19 @@ e_book_backend_file_class_init (EBookBackendFileClass *klass)
 	backend_class = E_BOOK_BACKEND_CLASS (klass);
 
 	/* Set the virtual methods. */
-	backend_class->load_source			= e_book_backend_file_load_source;
-	backend_class->get_static_capabilities		= e_book_backend_file_get_static_capabilities;
 	backend_class->start_book_view			= e_book_backend_file_start_book_view;
 	backend_class->stop_book_view			= e_book_backend_file_stop_book_view;
-	backend_class->cancel_operation			= e_book_backend_file_cancel_operation;
-	backend_class->set_mode				= e_book_backend_file_set_mode;
+	backend_class->set_online			= e_book_backend_file_set_online;
 	backend_class->sync				= e_book_backend_file_sync;
+
+	sync_class->open_sync				= e_book_backend_file_open;
 	sync_class->remove_sync				= e_book_backend_file_remove;
+	sync_class->get_capabilities_sync		= e_book_backend_file_get_capabilities;
 	sync_class->create_contact_sync			= e_book_backend_file_create_contact;
 	sync_class->remove_contacts_sync		= e_book_backend_file_remove_contacts;
 	sync_class->modify_contact_sync			= e_book_backend_file_modify_contact;
 	sync_class->get_contact_sync			= e_book_backend_file_get_contact;
 	sync_class->get_contact_list_sync		= e_book_backend_file_get_contact_list;
-	sync_class->get_changes_sync			= e_book_backend_file_get_changes;
 	sync_class->authenticate_user_sync		= e_book_backend_file_authenticate_user;
 	sync_class->get_supported_auth_methods_sync	= e_book_backend_file_get_supported_auth_methods;
 	sync_class->get_supported_fields_sync		= e_book_backend_file_get_supported_fields;
diff --git a/addressbook/backends/google/e-book-backend-google.c b/addressbook/backends/google/e-book-backend-google.c
index f3cd23b..a06fb22 100644
--- a/addressbook/backends/google/e-book-backend-google.c
+++ b/addressbook/backends/google/e-book-backend-google.c
@@ -51,7 +51,7 @@ typedef enum {
 } CacheType;
 
 struct _EBookBackendGooglePrivate {
-	EDataBookMode mode;
+	gboolean is_online;
 	GList *bookviews;
 
 	CacheType cache_type;
@@ -371,7 +371,7 @@ cache_needs_update (EBookBackend *backend, guint *remaining_secs)
 		*remaining_secs = G_MAXUINT;
 
 	/* We never want to update in offline mode */
-	if (priv->mode != E_DATA_BOOK_MODE_REMOTE)
+	if (!priv->is_online)
 		return FALSE;
 
 	rv = cache_get_last_update_tv (backend, &last);
@@ -463,19 +463,21 @@ on_sequence_complete (EBookBackend *backend, GError *error)
 }
 
 static GCancellable *
-start_operation (EBookBackend *backend, guint32 opid, const gchar *message)
+start_operation (EBookBackend *backend, guint32 opid, GCancellable *cancellable, const gchar *message)
 {
 	EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
-	GCancellable *cancellable;
 	GList *iter;
 
 	/* Insert the operation into the set of active cancellable operations */
-	cancellable = g_cancellable_new ();
+	if (cancellable)
+		g_object_ref (cancellable);
+	else
+		cancellable = g_cancellable_new ();
 	g_hash_table_insert (priv->cancellables, GUINT_TO_POINTER (opid), g_object_ref (cancellable));
 
 	/* Send out a status message to each view */
 	for (iter = priv->bookviews; iter; iter = iter->next)
-		e_data_book_view_notify_status_message (E_DATA_BOOK_VIEW (iter->data), message);
+		e_data_book_view_notify_progress (E_DATA_BOOK_VIEW (iter->data), -1, message);
 
 	return cancellable;
 }
@@ -586,7 +588,7 @@ get_new_contacts (EBookBackend *backend)
 	}
 
 	/* Query for new contacts asynchronously */
-	cancellable = start_operation (backend, 0, _("Querying for updated contactsâ?¦"));
+	cancellable = start_operation (backend, 0, NULL, _("Querying for updated contactsâ?¦"));
 	gdata_contacts_service_query_contacts_async (GDATA_CONTACTS_SERVICE (priv->service), query, cancellable,
 						     (GDataQueryProgressCallback) (last_updated ? process_subsequent_entry : process_initial_entry),
 						     backend, (GAsyncReadyCallback) get_new_contacts_cb, backend);
@@ -704,7 +706,7 @@ get_groups (EBookBackend *backend)
 	}
 
 	/* Run the query asynchronously */
-	cancellable = start_operation (backend, 1, _("Querying for updated groupsâ?¦"));
+	cancellable = start_operation (backend, 1, NULL, _("Querying for updated groupsâ?¦"));
 	gdata_contacts_service_query_groups_async (GDATA_CONTACTS_SERVICE (priv->service), query, cancellable,
 						   (GDataQueryProgressCallback) process_group, backend, (GAsyncReadyCallback) get_groups_cb, backend);
 
@@ -768,8 +770,8 @@ cache_refresh_if_needed (EBookBackend *backend)
 
 	__debug__ (G_STRFUNC);
 
-	if (priv->mode != E_DATA_BOOK_MODE_REMOTE || !priv->service || !gdata_service_is_authenticated (priv->service)) {
-		__debug__ ("We are not connected to Google%s.", (priv->mode != E_DATA_BOOK_MODE_REMOTE) ? " (offline mode)" : "");
+	if (!priv->is_online || !priv->service || !gdata_service_is_authenticated (priv->service)) {
+		__debug__ ("We are not connected to Google%s.", (!priv->is_online) ? " (offline mode)" : "");
 		return TRUE;
 	}
 
@@ -852,20 +854,19 @@ finish:
 }
 
 static void
-e_book_backend_google_create_contact (EBookBackend *backend, EDataBook *book, guint32 opid, const gchar *vcard_str)
+e_book_backend_google_create_contact (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, const gchar *vcard_str)
 {
 	EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
 	EContact *contact;
 	GDataEntry *entry;
 	gchar *xml;
 	CreateContactData *data;
-	GCancellable *cancellable;
 
 	__debug__ (G_STRFUNC);
 
 	__debug__ ("Creating: %s", vcard_str);
 
-	if (priv->mode != E_DATA_BOOK_MODE_REMOTE) {
+	if (!priv->is_online) {
 		e_data_book_respond_create (book, opid, EDB_ERROR (OFFLINE_UNAVAILABLE), NULL);
 		return;
 	}
@@ -888,7 +889,7 @@ e_book_backend_google_create_contact (EBookBackend *backend, EDataBook *book, gu
 	data->book = g_object_ref (book);
 	data->opid = opid;
 
-	cancellable = start_operation (backend, opid, _("Creating new contactâ?¦"));
+	cancellable = start_operation (backend, opid, cancellable, _("Creating new contactâ?¦"));
 	gdata_contacts_service_insert_contact_async (GDATA_CONTACTS_SERVICE (priv->service), GDATA_CONTACTS_CONTACT (entry), cancellable,
 						     (GAsyncReadyCallback) create_contact_cb, data);
 	g_object_unref (cancellable);
@@ -907,7 +908,7 @@ remove_contact_cb (GDataService *service, GAsyncResult *result, RemoveContactDat
 {
 	GError *gdata_error = NULL;
 	gboolean success;
-	GList *ids;
+	GSList *ids;
 
 	__debug__ (G_STRFUNC);
 
@@ -925,9 +926,9 @@ remove_contact_cb (GDataService *service, GAsyncResult *result, RemoveContactDat
 	}
 
 	/* List the entry's ID in the success list */
-	ids = g_list_prepend (NULL, data->uid);
+	ids = g_slist_prepend (NULL, data->uid);
 	e_data_book_respond_remove_contacts (data->book, data->opid, NULL, ids);
-	g_list_free (ids);
+	g_slist_free (ids);
 
 finish:
 	g_free (data->uid);
@@ -937,18 +938,17 @@ finish:
 }
 
 static void
-e_book_backend_google_remove_contacts (EBookBackend *backend, EDataBook *book, guint32 opid, GList *id_list)
+e_book_backend_google_remove_contacts (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, const GSList *id_list)
 {
 	EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
 	const gchar *uid = id_list->data;
 	GDataEntry *entry = NULL;
 	EContact *cached_contact;
-	GCancellable *cancellable;
 	RemoveContactData *data;
 
 	__debug__ (G_STRFUNC);
 
-	if (priv->mode != E_DATA_BOOK_MODE_REMOTE) {
+	if (!priv->is_online) {
 		e_data_book_respond_remove_contacts (book, opid, EDB_ERROR (OFFLINE_UNAVAILABLE), NULL);
 		return;
 	}
@@ -981,7 +981,7 @@ e_book_backend_google_remove_contacts (EBookBackend *backend, EDataBook *book, g
 	data->opid = opid;
 	data->uid = g_strdup (uid);
 
-	cancellable = start_operation (backend, opid, _("Deleting contactâ?¦"));
+	cancellable = start_operation (backend, opid, cancellable, _("Deleting contactâ?¦"));
 	gdata_service_delete_entry_async (GDATA_SERVICE (priv->service), entry, cancellable, (GAsyncReadyCallback) remove_contact_cb, data);
 	g_object_unref (cancellable);
 	g_object_unref (entry);
@@ -1035,20 +1035,19 @@ finish:
 }
 
 static void
-e_book_backend_google_modify_contact (EBookBackend *backend, EDataBook *book, guint32 opid, const gchar *vcard_str)
+e_book_backend_google_modify_contact (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, const gchar *vcard_str)
 {
 	EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
 	EContact *contact, *cached_contact;
 	GDataEntry *entry = NULL;
 	const gchar *uid;
 	ModifyContactData *data;
-	GCancellable *cancellable;
 
 	__debug__ (G_STRFUNC);
 
 	__debug__ ("Updating: %s", vcard_str);
 
-	if (priv->mode != E_DATA_BOOK_MODE_REMOTE) {
+	if (!priv->is_online) {
 		e_data_book_respond_modify (book, opid, EDB_ERROR (OFFLINE_UNAVAILABLE), NULL);
 		return;
 	}
@@ -1089,14 +1088,14 @@ e_book_backend_google_modify_contact (EBookBackend *backend, EDataBook *book, gu
 	data->book = g_object_ref (book);
 	data->opid = opid;
 
-	cancellable = start_operation (backend, opid, _("Modifying contactâ?¦"));
+	cancellable = start_operation (backend, opid, cancellable, _("Modifying contactâ?¦"));
 	gdata_service_update_entry_async (GDATA_SERVICE (priv->service), entry, cancellable, (GAsyncReadyCallback) modify_contact_cb, data);
 	g_object_unref (cancellable);
 	g_object_unref (entry);
 }
 
 static void
-e_book_backend_google_get_contact (EBookBackend *backend, EDataBook *book, guint32 opid, const gchar *uid)
+e_book_backend_google_get_contact (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, const gchar *uid)
 {
 	EContact *contact;
 	gchar *vcard_str;
@@ -1120,10 +1119,11 @@ e_book_backend_google_get_contact (EBookBackend *backend, EDataBook *book, guint
 }
 
 static void
-e_book_backend_google_get_contact_list (EBookBackend *backend, EDataBook *book, guint32 opid, const gchar *query)
+e_book_backend_google_get_contact_list (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, const gchar *query)
 {
 	EBookBackendSExp *sexp;
-	GList *all_contacts, *filtered_contacts = NULL;
+	GList *all_contacts;
+	GSList *filtered_contacts = NULL;
 
 	__debug__ (G_STRFUNC);
 
@@ -1137,7 +1137,7 @@ e_book_backend_google_get_contact_list (EBookBackend *backend, EDataBook *book,
 		/* If the search expression matches the contact, include it in the search results */
 		if (e_book_backend_sexp_match_contact (sexp, contact)) {
 			gchar *vcard_str = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
-			filtered_contacts = g_list_append (filtered_contacts, vcard_str);
+			filtered_contacts = g_slist_append (filtered_contacts, vcard_str);
 		}
 
 		g_object_unref (contact);
@@ -1146,7 +1146,9 @@ e_book_backend_google_get_contact_list (EBookBackend *backend, EDataBook *book,
 	g_object_unref (sexp);
 
 	e_data_book_respond_get_contact_list (book, opid, NULL, filtered_contacts);
-	g_list_free (filtered_contacts);
+
+	g_slist_foreach (filtered_contacts, (GFunc) g_free, NULL);
+	g_slist_free (filtered_contacts);
 }
 
 static gboolean
@@ -1196,7 +1198,7 @@ e_book_backend_google_start_book_view (EBookBackend *backend, EDataBookView *boo
 	priv->bookviews = g_list_append (priv->bookviews, bookview);
 
 	e_data_book_view_ref (bookview);
-	e_data_book_view_notify_status_message (bookview, _("Loadingâ?¦"));
+	e_data_book_view_notify_progress (bookview, -1, _("Loadingâ?¦"));
 
 	/* Ensure that we're ready to support a view */
 	set_live_mode (backend, TRUE);
@@ -1205,7 +1207,7 @@ e_book_backend_google_start_book_view (EBookBackend *backend, EDataBookView *boo
 	if (cache_needs_update (backend, NULL)) {
 		if (!priv->service || !gdata_service_is_authenticated (priv->service)) {
 			/* We need authorization first */
-			e_book_backend_notify_auth_required (backend);
+			e_book_backend_notify_auth_required (backend, NULL);
 		} else {
 			/* Update in an idle function, so that this call doesn't block */
 			priv->idle_id = g_idle_add ((GSourceFunc) on_refresh_idle, backend);
@@ -1288,7 +1290,7 @@ authenticate_user_cb (GDataService *service, GAsyncResult *result, AuthenticateU
 	}
 
 	finish_operation (data->backend, data->opid);
-	e_book_backend_notify_writable (data->backend, (!gdata_error) ? TRUE : FALSE);
+	e_book_backend_notify_readonly (data->backend, gdata_error ? TRUE : FALSE);
 	e_data_book_respond_authenticate_user (data->book, data->opid, book_error);
 
 	g_object_unref (data->book);
@@ -1297,30 +1299,28 @@ authenticate_user_cb (GDataService *service, GAsyncResult *result, AuthenticateU
 }
 
 static void
-e_book_backend_google_authenticate_user (EBookBackend *backend, EDataBook *book, guint32 opid,
-                                         const gchar *username, const gchar *password, const gchar *auth_method)
+e_book_backend_google_authenticate_user (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, ECredentials *credentials)
 {
 	EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
 	AuthenticateUserData *data;
-	GCancellable *cancellable;
 
 	__debug__ (G_STRFUNC);
 
-	if (priv->mode != E_DATA_BOOK_MODE_REMOTE) {
-		e_book_backend_notify_writable (backend, FALSE);
-		e_book_backend_notify_connection_status (backend, FALSE);
+	if (!priv->is_online) {
+		e_book_backend_notify_readonly (backend, TRUE);
+		e_book_backend_notify_online (backend, FALSE);
 		e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (SUCCESS));
 		return;
 	}
 
 	if (priv->service && gdata_service_is_authenticated (priv->service)) {
 		g_warning ("Connection to Google already established.");
-		e_book_backend_notify_writable (backend, TRUE);
+		e_book_backend_notify_readonly (backend, FALSE);
 		e_data_book_respond_authenticate_user (book, opid, NULL);
 		return;
 	}
 
-	if (!username || username[0] == 0 || !password || password[0] == 0) {
+	if (!credentials || !e_credentials_has_key (credentials, E_CREDENTIALS_KEY_USERNAME) || !e_credentials_has_key (credentials, E_CREDENTIALS_KEY_PASSWORD)) {
 		e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (AUTHENTICATION_FAILED));
 		return;
 	}
@@ -1343,31 +1343,31 @@ e_book_backend_google_authenticate_user (EBookBackend *backend, EDataBook *book,
 	data->book = g_object_ref (book);
 	data->opid = opid;
 
-	cancellable = start_operation (backend, opid, _("Authenticating with the serverâ?¦"));
-	gdata_service_authenticate_async (priv->service, username, password, cancellable, (GAsyncReadyCallback) authenticate_user_cb, data);
+	cancellable = start_operation (backend, opid, cancellable, _("Authenticating with the serverâ?¦"));
+	gdata_service_authenticate_async (priv->service, e_credentials_peek (credentials, E_CREDENTIALS_KEY_USERNAME), e_credentials_peek (credentials, E_CREDENTIALS_KEY_PASSWORD), cancellable, (GAsyncReadyCallback) authenticate_user_cb, data);
 	g_object_unref (cancellable);
 }
 
 static void
-e_book_backend_google_get_supported_auth_methods (EBookBackend *backend, EDataBook *book, guint32 opid)
+e_book_backend_google_get_supported_auth_methods (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable)
 {
-	GList methods = { (gpointer) "plain/password", NULL, NULL };
+	GSList methods = { (gpointer) "plain/password", NULL, };
 
 	__debug__ (G_STRFUNC);
 	e_data_book_respond_get_supported_auth_methods (book, opid, NULL, &methods);
 }
 
 static void
-e_book_backend_google_get_required_fields (EBookBackend *backend, EDataBook *book, guint32 opid)
+e_book_backend_google_get_required_fields (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable)
 {
 	__debug__ (G_STRFUNC);
 	e_data_book_respond_get_required_fields (book, opid, NULL, NULL);
 }
 
 static void
-e_book_backend_google_get_supported_fields (EBookBackend *backend, EDataBook *book, guint32 opid)
+e_book_backend_google_get_supported_fields (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable)
 {
-	GList *fields = NULL;
+	GSList *fields = NULL;
 	guint i;
 	const gint supported_fields[] = {
 		E_CONTACT_FULL_NAME,
@@ -1481,39 +1481,33 @@ e_book_backend_google_get_supported_fields (EBookBackend *backend, EDataBook *bo
 	/* Add all the fields above to the list */
 	for (i = 0; i < G_N_ELEMENTS (supported_fields); i++) {
 		const gchar *field_name = e_contact_field_name (supported_fields[i]);
-		fields = g_list_prepend (fields, (gpointer) field_name);
+		fields = g_slist_prepend (fields, (gpointer) field_name);
 	}
 
 	e_data_book_respond_get_supported_fields (book, opid, NULL, fields);
-	g_list_free (fields);
+	g_slist_free (fields);
 }
 
 static void
-e_book_backend_google_get_changes (EBookBackend *backend, EDataBook *book, guint32 opid, const gchar *change_id)
-{
-	__debug__ (G_STRFUNC);
-	e_data_book_respond_get_changes (book, opid, EDB_ERROR (OTHER_ERROR), NULL);
-}
-
-static void
-e_book_backend_google_remove (EBookBackend *backend, EDataBook *book, guint32 opid)
+e_book_backend_google_remove (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable)
 {
 	__debug__ (G_STRFUNC);
 	e_data_book_respond_remove (book, opid, NULL);
 }
 
 static void
-e_book_backend_google_load_source (EBookBackend *backend, ESource *source, gboolean only_if_exists, GError **error)
+e_book_backend_google_open (EBookBackend *backend, EDataBook *book, guint opid, GCancellable *cancellable, gboolean only_if_exists)
 {
 	EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
 	const gchar *refresh_interval_str, *use_ssl_str, *use_cache_str;
 	guint refresh_interval;
 	gboolean use_ssl, use_cache;
+	ESource *source = e_book_backend_get_source (backend);
 
 	__debug__ (G_STRFUNC);
 
 	if (priv->cancellables) {
-		g_propagate_error (error, EDB_ERROR_EX (OTHER_ERROR, "Source already loaded!"));
+		e_data_book_respond_open (book, opid, EDB_ERROR_EX (OTHER_ERROR, "Source already loaded!"));
 		return;
 	}
 
@@ -1552,25 +1546,29 @@ e_book_backend_google_load_source (EBookBackend *backend, ESource *source, gbool
 
 	/* Set up ready to be interacted with */
 	e_book_backend_set_is_loaded (backend, TRUE);
-	e_book_backend_set_is_writable (backend, FALSE);
-	e_book_backend_notify_connection_status (backend, (priv->mode == E_DATA_BOOK_MODE_REMOTE) ? TRUE : FALSE);
+	e_book_backend_set_is_readonly (backend, TRUE);
+	e_book_backend_notify_online (backend, priv->is_online);
+	e_book_backend_notify_readonly (backend, TRUE);
 
-	if (priv->mode == E_DATA_BOOK_MODE_REMOTE) {
+	if (priv->is_online) {
 		/* We're going online, so we need to authenticate and create the service and proxy.
 		 * This is done in e_book_backend_google_authenticate_user() when it gets the authentication data. */
-		e_book_backend_notify_auth_required (backend);
+		e_book_backend_notify_auth_required (backend, NULL);
 	}
+
+	e_data_book_respond_open (book, opid, NULL /* Success */);
 }
 
-static gchar *
-e_book_backend_google_get_static_capabilities (EBookBackend *backend)
+static void
+e_book_backend_google_get_capabilities (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable)
 {
 	__debug__ (G_STRFUNC);
-	return g_strdup ("net,do-initial-query,contact-lists");
+
+	e_data_book_respond_get_capabilities (book, opid, NULL, "net,do-initial-query,contact-lists");
 }
 
 static void
-e_book_backend_google_cancel_operation (EBookBackend *backend, EDataBook *book, GError **error)
+google_cancel_all_operations (EBookBackend *backend)
 {
 	GHashTableIter iter;
 	gpointer opid_ptr;
@@ -1587,31 +1585,29 @@ e_book_backend_google_cancel_operation (EBookBackend *backend, EDataBook *book,
 }
 
 static void
-e_book_backend_google_set_mode (EBookBackend *backend, EDataBookMode mode)
+e_book_backend_google_set_online (EBookBackend *backend, gboolean is_online)
 {
 	EBookBackendGooglePrivate *priv = E_BOOK_BACKEND_GOOGLE (backend)->priv;
-	gboolean online = (mode == E_DATA_BOOK_MODE_REMOTE);
-
 	__debug__ (G_STRFUNC);
 
-	if (mode == priv->mode)
+	if (is_online == priv->is_online)
 		return;
 
-	priv->mode = mode;
+	priv->is_online = is_online;
 
-	e_book_backend_notify_connection_status (backend, online);
+	e_book_backend_notify_online (backend, is_online);
 
-	if (online) {
+	if (is_online) {
 		/* Going online, so we need to re-authenticate and re-create the service and proxy.
 		 * This is done in e_book_backend_google_authenticate_user() when it gets the authentication data. */
-		e_book_backend_notify_auth_required (backend);
+		e_book_backend_notify_auth_required (backend, NULL);
 	} else {
 		/* Going offline, so cancel all running operations */
-		e_book_backend_google_cancel_operation (backend, NULL, NULL);
+		google_cancel_all_operations (backend);
 
 		/* Mark the book as unwriteable if we're going offline, but don't do the inverse when we go online;
 		 * e_book_backend_google_authenticate_user() will mark us as writeable again once the user's authenticated again. */
-		e_book_backend_notify_writable (backend, FALSE);
+		e_book_backend_notify_readonly (backend, TRUE);
 
 		/* We can free our service and proxy */
 		if (priv->service)
@@ -1632,7 +1628,7 @@ e_book_backend_google_dispose (GObject *object)
 	__debug__ (G_STRFUNC);
 
 	/* Cancel all outstanding operations */
-	e_book_backend_google_cancel_operation (E_BOOK_BACKEND (object), NULL, NULL);
+	google_cancel_all_operations (E_BOOK_BACKEND (object));
 
 	while (priv->bookviews) {
 		e_data_book_view_unref (priv->bookviews->data);
@@ -1680,23 +1676,21 @@ e_book_backend_google_class_init (EBookBackendGoogleClass *klass)
 	g_type_class_add_private (klass, sizeof (EBookBackendGooglePrivate));
 
 	/* Set the virtual methods. */
-	backend_class->load_source                  = e_book_backend_google_load_source;
-	backend_class->get_static_capabilities      = e_book_backend_google_get_static_capabilities;
-	backend_class->start_book_view              = e_book_backend_google_start_book_view;
-	backend_class->stop_book_view               = e_book_backend_google_stop_book_view;
-	backend_class->cancel_operation             = e_book_backend_google_cancel_operation;
-	backend_class->set_mode                     = e_book_backend_google_set_mode;
-	backend_class->remove                       = e_book_backend_google_remove;
-	backend_class->create_contact               = e_book_backend_google_create_contact;
-	backend_class->remove_contacts              = e_book_backend_google_remove_contacts;
-	backend_class->modify_contact               = e_book_backend_google_modify_contact;
-	backend_class->get_contact                  = e_book_backend_google_get_contact;
-	backend_class->get_contact_list             = e_book_backend_google_get_contact_list;
-	backend_class->get_changes                  = e_book_backend_google_get_changes;
-	backend_class->authenticate_user            = e_book_backend_google_authenticate_user;
-	backend_class->get_supported_fields         = e_book_backend_google_get_supported_fields;
-	backend_class->get_required_fields          = e_book_backend_google_get_required_fields;
-	backend_class->get_supported_auth_methods   = e_book_backend_google_get_supported_auth_methods;
+	backend_class->open				= e_book_backend_google_open;
+	backend_class->get_capabilities			= e_book_backend_google_get_capabilities;
+	backend_class->start_book_view			= e_book_backend_google_start_book_view;
+	backend_class->stop_book_view			= e_book_backend_google_stop_book_view;
+	backend_class->set_online			= e_book_backend_google_set_online;
+	backend_class->remove				= e_book_backend_google_remove;
+	backend_class->create_contact			= e_book_backend_google_create_contact;
+	backend_class->remove_contacts			= e_book_backend_google_remove_contacts;
+	backend_class->modify_contact			= e_book_backend_google_modify_contact;
+	backend_class->get_contact			= e_book_backend_google_get_contact;
+	backend_class->get_contact_list			= e_book_backend_google_get_contact_list;
+	backend_class->authenticate_user		= e_book_backend_google_authenticate_user;
+	backend_class->get_supported_fields		= e_book_backend_google_get_supported_fields;
+	backend_class->get_required_fields		= e_book_backend_google_get_required_fields;
+	backend_class->get_supported_auth_methods	= e_book_backend_google_get_supported_auth_methods;
 
 	object_class->dispose  = e_book_backend_google_dispose;
 	object_class->finalize = e_book_backend_google_finalize;
diff --git a/addressbook/backends/groupwise/e-book-backend-groupwise.c b/addressbook/backends/groupwise/e-book-backend-groupwise.c
index 3fc997e..9b625b7 100644
--- a/addressbook/backends/groupwise/e-book-backend-groupwise.c
+++ b/addressbook/backends/groupwise/e-book-backend-groupwise.c
@@ -78,12 +78,12 @@ struct _EBookBackendGroupwisePrivate {
 	gboolean only_if_exists;
 	GHashTable *categories_by_id;
 	GHashTable *categories_by_name;
-	gboolean is_writable;
+	gboolean is_readonly;
 	gboolean is_cache_ready;
 	gboolean is_summary_ready;
 	gboolean marked_for_offline;
 	gchar *use_ssl;
-	gint mode;
+	gboolean is_online;
 	EBookBackendSummary *summary;
 	GMutex *update_cache_mutex;
 	GMutex *update_mutex;
@@ -1188,6 +1188,7 @@ static void
 e_book_backend_groupwise_create_contact (EBookBackend *backend,
 					 EDataBook *book,
 					 guint32 opid,
+					 GCancellable *cancellable,
 					 const gchar *vcard )
 {
 	EContact *contact;
@@ -1204,116 +1205,101 @@ e_book_backend_groupwise_create_contact (EBookBackend *backend,
 
 	egwb = E_BOOK_BACKEND_GROUPWISE (backend);
 
-	switch (egwb->priv->mode) {
-
-	case E_DATA_BOOK_MODE_LOCAL :
+	if (!egwb->priv->is_online) {
 		e_data_book_respond_create (book, opid, EDB_ERROR (REPOSITORY_OFFLINE), NULL);
 		return;
+	}
 
-	case  E_DATA_BOOK_MODE_REMOTE :
-
-		if (egwb->priv->cnc == NULL) {
-			e_data_book_respond_create (book, opid, EDB_ERROR (AUTHENTICATION_REQUIRED), NULL);
-			return;
-		}
-		if (!egwb->priv->is_writable) {
-			e_data_book_respond_create (book, opid, EDB_ERROR (PERMISSION_DENIED), NULL);
-			return;
-		}
-		contact = e_contact_new_from_vcard (vcard);
-		item = e_gw_item_new_empty ();
-		e_gw_item_set_item_type (item, e_contact_get (contact, E_CONTACT_IS_LIST) ? E_GW_ITEM_TYPE_GROUP :E_GW_ITEM_TYPE_CONTACT);
-		e_gw_item_set_container_id (item, g_strdup (egwb->priv->container_id));
+	if (egwb->priv->cnc == NULL) {
+		e_data_book_respond_create (book, opid, EDB_ERROR (AUTHENTICATION_REQUIRED), NULL);
+		return;
+	}
+	if (egwb->priv->is_readonly) {
+		e_data_book_respond_create (book, opid, EDB_ERROR (PERMISSION_DENIED), NULL);
+		return;
+	}
+	contact = e_contact_new_from_vcard (vcard);
+	item = e_gw_item_new_empty ();
+	e_gw_item_set_item_type (item, e_contact_get (contact, E_CONTACT_IS_LIST) ? E_GW_ITEM_TYPE_GROUP :E_GW_ITEM_TYPE_CONTACT);
+	e_gw_item_set_container_id (item, g_strdup (egwb->priv->container_id));
 
-		for (i = 0; i < G_N_ELEMENTS (mappings); i++) {
-			element_type = mappings[i].element_type;
-			if (element_type == ELEMENT_TYPE_SIMPLE)  {
-				value =  e_contact_get (contact, mappings[i].field_id);
-				if (value != NULL)
-					e_gw_item_set_field_value (item, mappings[i].element_name, value);
-			} else if (element_type == ELEMENT_TYPE_COMPLEX) {
-				if (mappings[i].field_id == E_CONTACT_CATEGORIES) {
-					set_categories_in_gw_item (item, contact, egwb);
-				}
-				else if (mappings[i].field_id == E_CONTACT_EMAIL) {
-					if (e_contact_get (contact, E_CONTACT_IS_LIST))
-						set_members_in_gw_item (item, contact, egwb);
-				}
-				else {
-					mappings[i].set_value_in_gw_item (item, contact);
-				}
+	for (i = 0; i < G_N_ELEMENTS (mappings); i++) {
+		element_type = mappings[i].element_type;
+		if (element_type == ELEMENT_TYPE_SIMPLE)  {
+			value =  e_contact_get (contact, mappings[i].field_id);
+			if (value != NULL)
+				e_gw_item_set_field_value (item, mappings[i].element_name, value);
+		} else if (element_type == ELEMENT_TYPE_COMPLEX) {
+			if (mappings[i].field_id == E_CONTACT_CATEGORIES) {
+				set_categories_in_gw_item (item, contact, egwb);
+			} else if (mappings[i].field_id == E_CONTACT_EMAIL) {
+				if (e_contact_get (contact, E_CONTACT_IS_LIST))
+					set_members_in_gw_item (item, contact, egwb);
+			} else {
+				mappings[i].set_value_in_gw_item (item, contact);
 			}
 		}
-		id = NULL;
+	}
+	id = NULL;
+	status = e_gw_connection_create_item (egwb->priv->cnc, item, &id);
+	if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
 		status = e_gw_connection_create_item (egwb->priv->cnc, item, &id);
-		if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-			status = e_gw_connection_create_item (egwb->priv->cnc, item, &id);
-
-		/* Make sure server has returned  an id for the created contact */
-		if (status == E_GW_CONNECTION_STATUS_OK && id) {
-			e_contact_set (contact, E_CONTACT_UID, id);
-			g_free (id);
-			e_book_backend_db_cache_add_contact (egwb->priv->file_db, contact);
-			egwb->priv->file_db->sync (egwb->priv->file_db, 0);
-			e_book_backend_summary_add_contact (egwb->priv->summary, contact);
-			e_data_book_respond_create (book, opid, EDB_ERROR (SUCCESS), contact);
 
-		}
-		else {
-			e_data_book_respond_create (book, opid, EDB_ERROR_FAILED_STATUS (OTHER_ERROR, status), NULL);
-		}
-		g_object_unref (item);
-		return;
-	default:
-		break;
+	/* Make sure server has returned  an id for the created contact */
+	if (status == E_GW_CONNECTION_STATUS_OK && id) {
+		e_contact_set (contact, E_CONTACT_UID, id);
+		g_free (id);
+		e_book_backend_db_cache_add_contact (egwb->priv->file_db, contact);
+		egwb->priv->file_db->sync (egwb->priv->file_db, 0);
+		e_book_backend_summary_add_contact (egwb->priv->summary, contact);
+		e_data_book_respond_create (book, opid, EDB_ERROR (SUCCESS), contact);
+	} else {
+		e_data_book_respond_create (book, opid, EDB_ERROR_FAILED_STATUS (OTHER_ERROR, status), NULL);
 	}
+	g_object_unref (item);
 }
 
 static void
 e_book_backend_groupwise_remove_contacts (EBookBackend *backend,
 					  EDataBook    *book,
 					  guint32 opid,
-					  GList *id_list)
+					  GCancellable *cancellable,
+					  const GSList *id_list)
 {
 	gchar *id;
 	EBookBackendGroupwise *ebgw;
-	GList *deleted_ids = NULL;
+	GSList *deleted_ids = NULL;
 
 	if (enable_debug)
 		printf ("\ne_book_backend_groupwise_remove_contacts...\n");
 
 	ebgw = E_BOOK_BACKEND_GROUPWISE (backend);
 
-	switch (ebgw->priv->mode) {
-
-	case E_DATA_BOOK_MODE_LOCAL :
+	if (!ebgw->priv->is_online) {
 		e_data_book_respond_remove_contacts (book, opid, EDB_ERROR (REPOSITORY_OFFLINE), NULL);
 		return;
+	}
 
-	case E_DATA_BOOK_MODE_REMOTE :
-		if (ebgw->priv->cnc == NULL) {
-			e_data_book_respond_remove_contacts (book, opid, EDB_ERROR (AUTHENTICATION_REQUIRED), NULL);
-			return;
-		}
-
-		if (!ebgw->priv->is_writable) {
-			e_data_book_respond_remove_contacts (book, opid, EDB_ERROR (PERMISSION_DENIED), NULL);
-			return;
-		}
+	if (ebgw->priv->cnc == NULL) {
+		e_data_book_respond_remove_contacts (book, opid, EDB_ERROR (AUTHENTICATION_REQUIRED), NULL);
+		return;
+	}
 
-		for (; id_list != NULL; id_list = g_list_next (id_list)) {
-			id = (gchar *) id_list->data;
-			e_gw_connection_remove_item (ebgw->priv->cnc, ebgw->priv->container_id, id);
-			deleted_ids =  g_list_append (deleted_ids, id);
-			e_book_backend_db_cache_remove_contact (ebgw->priv->file_db, id);
-			e_book_backend_summary_remove_contact (ebgw->priv->summary, id);
-		}
-		ebgw->priv->file_db->sync (ebgw->priv->file_db, 0);
-		e_data_book_respond_remove_contacts (book, opid, EDB_ERROR (SUCCESS),  deleted_ids);
+	if (ebgw->priv->is_readonly) {
+		e_data_book_respond_remove_contacts (book, opid, EDB_ERROR (PERMISSION_DENIED), NULL);
 		return;
-	default :
-		break;
 	}
+
+	for (; id_list != NULL; id_list = id_list->next) {
+		id = (gchar *) id_list->data;
+		e_gw_connection_remove_item (ebgw->priv->cnc, ebgw->priv->container_id, id);
+		deleted_ids =  g_slist_append (deleted_ids, id);
+		e_book_backend_db_cache_remove_contact (ebgw->priv->file_db, id);
+		e_book_backend_summary_remove_contact (ebgw->priv->summary, id);
+	}
+	ebgw->priv->file_db->sync (ebgw->priv->file_db, 0);
+	e_data_book_respond_remove_contacts (book, opid, EDB_ERROR (SUCCESS),  deleted_ids);
+	g_slist_free (deleted_ids);
 }
 
 static void
@@ -1357,6 +1343,7 @@ static void
 e_book_backend_groupwise_modify_contact (EBookBackend *backend,
 					 EDataBook    *book,
 					 guint32       opid,
+					 GCancellable *cancellable,
 					 const gchar   *vcard)
 {
 	EContact *contact;
@@ -1373,86 +1360,79 @@ e_book_backend_groupwise_modify_contact (EBookBackend *backend,
 		printf ("\ne_book_backend_groupwise_modify_contact...\n");
 	egwb = E_BOOK_BACKEND_GROUPWISE (backend);
 
-	switch (egwb->priv->mode) {
-
-	case E_DATA_BOOK_MODE_LOCAL :
+	if (!egwb->priv->is_online) {
 		e_data_book_respond_modify (book, opid, EDB_ERROR (REPOSITORY_OFFLINE), NULL);
 		return;
-	case E_DATA_BOOK_MODE_REMOTE :
+	}
 
-		if (egwb->priv->cnc == NULL) {
-			e_data_book_respond_modify (book, opid, EDB_ERROR (AUTHENTICATION_REQUIRED), NULL);
-			return;
-		}
-		if (!egwb->priv->is_writable) {
-			e_data_book_respond_modify (book, opid, EDB_ERROR (PERMISSION_DENIED), NULL);
-			return;
-		}
-		contact = e_contact_new_from_vcard (vcard);
-		new_item = e_gw_item_new_empty ();
+	if (egwb->priv->cnc == NULL) {
+		e_data_book_respond_modify (book, opid, EDB_ERROR (AUTHENTICATION_REQUIRED), NULL);
+		return;
+	}
+	if (egwb->priv->is_readonly) {
+		e_data_book_respond_modify (book, opid, EDB_ERROR (PERMISSION_DENIED), NULL);
+		return;
+	}
+	contact = e_contact_new_from_vcard (vcard);
+	new_item = e_gw_item_new_empty ();
 
-		for (i = 0; i < G_N_ELEMENTS (mappings); i++) {
-			element_type = mappings[i].element_type;
-			if (element_type == ELEMENT_TYPE_SIMPLE)  {
-				value =  e_contact_get (contact, mappings[i].field_id);
-				if (value &&  *value)
-					e_gw_item_set_field_value (new_item, mappings[i].element_name, value);
-			} else if (element_type == ELEMENT_TYPE_COMPLEX) {
-				if (mappings[i].field_id == E_CONTACT_CATEGORIES)
-					set_categories_in_gw_item (new_item, contact, egwb);
-				else if (mappings[i].field_id == E_CONTACT_EMAIL) {
-					if (e_contact_get (contact, E_CONTACT_IS_LIST))
-						set_members_in_gw_item (new_item, contact, egwb);
-				}
-				else
-					mappings[i].set_value_in_gw_item (new_item, contact);
-			}
+	for (i = 0; i < G_N_ELEMENTS (mappings); i++) {
+		element_type = mappings[i].element_type;
+		if (element_type == ELEMENT_TYPE_SIMPLE)  {
+			value =  e_contact_get (contact, mappings[i].field_id);
+			if (value &&  *value)
+				e_gw_item_set_field_value (new_item, mappings[i].element_name, value);
+		} else if (element_type == ELEMENT_TYPE_COMPLEX) {
+			if (mappings[i].field_id == E_CONTACT_CATEGORIES)
+				set_categories_in_gw_item (new_item, contact, egwb);
+			else if (mappings[i].field_id == E_CONTACT_EMAIL) {
+				if (e_contact_get (contact, E_CONTACT_IS_LIST))
+					set_members_in_gw_item (new_item, contact, egwb);
+			} else
+				mappings[i].set_value_in_gw_item (new_item, contact);
 		}
+	}
 
-		id = e_contact_get (contact, E_CONTACT_UID);
-		old_item = NULL;
-		status = e_gw_connection_get_item (egwb->priv->cnc, egwb->priv->container_id, id, NULL,  &old_item);
+	id = e_contact_get (contact, E_CONTACT_UID);
+	old_item = NULL;
+	status = e_gw_connection_get_item (egwb->priv->cnc, egwb->priv->container_id, id, NULL,  &old_item);
 
-		if (old_item == NULL) {
-			e_data_book_respond_modify (book, opid, EDB_ERROR (CONTACT_NOT_FOUND), NULL);
-			return;
-		}
+	if (old_item == NULL) {
+		e_data_book_respond_modify (book, opid, EDB_ERROR (CONTACT_NOT_FOUND), NULL);
+		return;
+	}
 
-		if (status != E_GW_CONNECTION_STATUS_OK) {
-			e_data_book_respond_modify (book, opid, EDB_ERROR_FAILED_STATUS (OTHER_ERROR, status), NULL);
-			return;
-		}
+	if (status != E_GW_CONNECTION_STATUS_OK) {
+		e_data_book_respond_modify (book, opid, EDB_ERROR_FAILED_STATUS (OTHER_ERROR, status), NULL);
+		return;
+	}
 
-		if (e_contact_get (contact, E_CONTACT_IS_LIST))
-			set_member_changes (new_item, old_item, egwb);
+	if (e_contact_get (contact, E_CONTACT_IS_LIST))
+		set_member_changes (new_item, old_item, egwb);
 
-		set_changes_in_gw_item (new_item, old_item);
+	set_changes_in_gw_item (new_item, old_item);
 
-		e_gw_item_set_item_type (new_item, e_gw_item_get_item_type (old_item));
-		status = e_gw_connection_modify_item (egwb->priv->cnc, id, new_item);
-		if (status == E_GW_CONNECTION_STATUS_OK) {
-			e_data_book_respond_modify (book, opid, EDB_ERROR (SUCCESS), contact);
-			e_book_backend_db_cache_remove_contact (egwb->priv->file_db, id);
-			e_book_backend_summary_remove_contact (egwb->priv->summary, id);
-			e_book_backend_db_cache_add_contact (egwb->priv->file_db, contact);
-			egwb->priv->file_db->sync (egwb->priv->file_db, 0);
-			e_book_backend_summary_add_contact (egwb->priv->summary, contact);
-		}
-		else
-			e_data_book_respond_modify (book, opid, EDB_ERROR_FAILED_STATUS (OTHER_ERROR, status), NULL);
-		g_object_unref (new_item);
-		g_object_ref (old_item);
-		g_object_unref (contact);
-		return;
-	default :
-		break;
-	}
+	e_gw_item_set_item_type (new_item, e_gw_item_get_item_type (old_item));
+	status = e_gw_connection_modify_item (egwb->priv->cnc, id, new_item);
+	if (status == E_GW_CONNECTION_STATUS_OK) {
+		e_data_book_respond_modify (book, opid, EDB_ERROR (SUCCESS), contact);
+		e_book_backend_db_cache_remove_contact (egwb->priv->file_db, id);
+		e_book_backend_summary_remove_contact (egwb->priv->summary, id);
+		e_book_backend_db_cache_add_contact (egwb->priv->file_db, contact);
+		egwb->priv->file_db->sync (egwb->priv->file_db, 0);
+		e_book_backend_summary_add_contact (egwb->priv->summary, contact);
+	} else
+		e_data_book_respond_modify (book, opid, EDB_ERROR_FAILED_STATUS (OTHER_ERROR, status), NULL);
+	g_object_unref (new_item);
+	g_object_ref (old_item);
+	g_object_unref (contact);
 }
 
 static void
 e_book_backend_groupwise_get_contact (EBookBackend *backend,
 				      EDataBook    *book,
 				      guint32       opid,
+				      GCancellable *cancellable,
 				      const gchar   *id)
 {
 	EBookBackendGroupwise *gwb;
@@ -1466,46 +1446,39 @@ e_book_backend_groupwise_get_contact (EBookBackend *backend,
 
 	gwb =  E_BOOK_BACKEND_GROUPWISE (backend);
 
-	switch (gwb->priv->mode) {
-
-	case E_DATA_BOOK_MODE_LOCAL :
+	if (!gwb->priv->is_online) {
 		contact = e_book_backend_db_cache_get_contact (gwb->priv->file_db, id);
 		vcard =  e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
 		if (contact) {
 			e_data_book_respond_get_contact (book, opid, EDB_ERROR (SUCCESS), vcard);
 			g_free (vcard);
 			g_object_unref (contact);
-		}
-		else {
+		} else {
 			e_data_book_respond_get_contact (book, opid, EDB_ERROR (CONTACT_NOT_FOUND), "");
 		}
 		return;
+	}
 
-	case E_DATA_BOOK_MODE_REMOTE :
-		if (gwb->priv->cnc == NULL) {
-			e_data_book_respond_get_contact (book, opid, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, "Not connected"), NULL);
-			return;
-		}
-		status = e_gw_connection_get_item (gwb->priv->cnc, gwb->priv->container_id, id,
+	if (gwb->priv->cnc == NULL) {
+		e_data_book_respond_get_contact (book, opid, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, "Not connected"), NULL);
+		return;
+	}
+	status = e_gw_connection_get_item (gwb->priv->cnc, gwb->priv->container_id, id,
 						   "name email default members", &item);
-		if (status == E_GW_CONNECTION_STATUS_OK) {
-			if (item) {
-				contact = e_contact_new ();
-				fill_contact_from_gw_item (contact, item, gwb->priv->categories_by_id);
-				e_contact_set (contact, E_CONTACT_BOOK_URI, gwb->priv->original_uri);
-				vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
-				e_data_book_respond_get_contact (book, opid, EDB_ERROR (SUCCESS), vcard);
-				g_free (vcard);
-				g_object_unref (contact);
-				g_object_unref (item);
-				return;
-			}
+	if (status == E_GW_CONNECTION_STATUS_OK) {
+		if (item) {
+			contact = e_contact_new ();
+			fill_contact_from_gw_item (contact, item, gwb->priv->categories_by_id);
+			e_contact_set (contact, E_CONTACT_BOOK_URI, gwb->priv->original_uri);
+			vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
+			e_data_book_respond_get_contact (book, opid, EDB_ERROR (SUCCESS), vcard);
+			g_free (vcard);
+			g_object_unref (contact);
+			g_object_unref (item);
+			return;
 		}
-		e_data_book_respond_get_contact (book, opid, EDB_ERROR (CONTACT_NOT_FOUND), "");
-		return;
-	default :
-		break;
 	}
+	e_data_book_respond_get_contact (book, opid, EDB_ERROR (CONTACT_NOT_FOUND), "");
 }
 
 typedef struct {
@@ -1855,7 +1828,7 @@ e_book_backend_groupwise_build_gw_filter (EBookBackendGroupwise *ebgw, const gch
 	sexp_data = g_new0 (EBookBackendGroupwiseSExpData, 1);
 	sexp_data->filter = filter;
 	sexp_data->is_filter_valid = TRUE;
-	sexp_data->is_personal_book = e_book_backend_is_writable ( E_BOOK_BACKEND (ebgw));
+	sexp_data->is_personal_book = !e_book_backend_is_readonly (E_BOOK_BACKEND (ebgw));
 	sexp_data->auto_completion = 0;
 	sexp_data->search_string = NULL;
 
@@ -1894,9 +1867,10 @@ static void
 e_book_backend_groupwise_get_contact_list (EBookBackend *backend,
 					   EDataBook    *book,
 					   guint32       opid,
+					   GCancellable *cancellable,
 					   const gchar   *query )
 {
-	GList *vcard_list;
+	GSList *vcard_list;
 	gint status;
 	GList *gw_items, *contacts = NULL, *temp;
 	EContact *contact;
@@ -1914,10 +1888,7 @@ e_book_backend_groupwise_get_contact_list (EBookBackend *backend,
 	if (enable_debug)
 		printf ("\ne_book_backend_groupwise_get_contact_list...\n");
 
-	switch (egwb->priv->mode) {
-
-	case E_DATA_BOOK_MODE_LOCAL :
-
+	if (!egwb->priv->is_online) {
 		if (!egwb->priv->file_db) {
 			e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (REPOSITORY_OFFLINE), NULL);
 			return;
@@ -1944,115 +1915,110 @@ e_book_backend_groupwise_get_contact_list (EBookBackend *backend,
 
 		temp = contacts;
 		for (; contacts != NULL; contacts = g_list_next (contacts)) {
-			vcard_list = g_list_append (vcard_list,
-						    e_vcard_to_string (E_VCARD (contacts->data),
-						    EVC_FORMAT_VCARD_30));
+			vcard_list = g_slist_append (vcard_list,
+						     e_vcard_to_string (E_VCARD (contacts->data), EVC_FORMAT_VCARD_30));
 			g_object_unref (contacts->data);
 		}
 		e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (SUCCESS), vcard_list);
+		g_slist_foreach (vcard_list, (GFunc) g_free, NULL);
+		g_slist_free (vcard_list);
 		if (temp)
 			g_list_free (temp);
 		return;
+	}
 
-	case E_DATA_BOOK_MODE_REMOTE:
-
-		if (egwb->priv->cnc == NULL) {
-			e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (AUTHENTICATION_REQUIRED), NULL);
-			return;
-		}
+	if (egwb->priv->cnc == NULL) {
+		e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (AUTHENTICATION_REQUIRED), NULL);
+		return;
+	}
 
-		match_needed = TRUE;
-		card_sexp = e_book_backend_sexp_new (query);
-		if (!card_sexp) {
-			e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (INVALID_QUERY), vcard_list);
-		}
+	match_needed = TRUE;
+	card_sexp = e_book_backend_sexp_new (query);
+	if (!card_sexp) {
+		e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (INVALID_QUERY), NULL);
+		return;
+	}
 
-		status = E_GW_CONNECTION_STATUS_OK;
-		if (egwb->priv->is_cache_ready ) {
-			if (egwb->priv->is_summary_ready &&
-			    e_book_backend_summary_is_summary_query (egwb->priv->summary, query)) {
-				ids = e_book_backend_summary_search (egwb->priv->summary, query);
+	status = E_GW_CONNECTION_STATUS_OK;
+	if (egwb->priv->is_cache_ready ) {
+		if (egwb->priv->is_summary_ready &&
+		    e_book_backend_summary_is_summary_query (egwb->priv->summary, query)) {
+			ids = e_book_backend_summary_search (egwb->priv->summary, query);
 
-				if (!egwb->priv->is_writable) {
-					gint i;
-					for (i = 0; i < ids->len; i++) {
-						gchar *uid = g_ptr_array_index (ids, i);
-						contact = e_book_backend_db_cache_get_contact (egwb->priv->file_db, uid);
-						vcard_list = g_list_append (vcard_list,
-							    e_vcard_to_string (E_VCARD (contact),
-							    EVC_FORMAT_VCARD_30));
-						g_object_unref (contact);
-					}
-					g_ptr_array_free (ids, TRUE);
-					ids = NULL;
+			if (egwb->priv->is_readonly) {
+				gint i;
+				for (i = 0; i < ids->len; i++) {
+					gchar *uid = g_ptr_array_index (ids, i);
+					contact = e_book_backend_db_cache_get_contact (egwb->priv->file_db, uid);
+					vcard_list = g_slist_append (vcard_list,
+						    e_vcard_to_string (E_VCARD (contact),
+						    EVC_FORMAT_VCARD_30));
+					g_object_unref (contact);
 				}
+				g_ptr_array_free (ids, TRUE);
+				ids = NULL;
 			}
-			else {
-				ids = e_book_backend_db_cache_search (egwb->priv->file_db, query);
-			}
+		} else {
+			ids = e_book_backend_db_cache_search (egwb->priv->file_db, query);
+		}
 
-			if (ids && ids->len > 0) {
-				status = e_gw_connection_get_items_from_ids (egwb->priv->cnc,
-									egwb->priv->container_id,
-									"name email default members",
-									ids, &gw_items);
-				if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
+		if (ids && ids->len > 0) {
+			status = e_gw_connection_get_items_from_ids (egwb->priv->cnc,
+								egwb->priv->container_id,
+								"name email default members",
+								ids, &gw_items);
+			if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
 				status = e_gw_connection_get_items_from_ids (egwb->priv->cnc,
-									egwb->priv->container_id,
-									"name email default members",
-									ids, &gw_items);
-			}
-			if (ids)
-				g_ptr_array_free (ids, TRUE);
+								egwb->priv->container_id,
+								"name email default members",
+								ids, &gw_items);
+		}
+		if (ids)
+			g_ptr_array_free (ids, TRUE);
+		match_needed = FALSE;
+	} else {
+		if (strcmp (query, "(contains \"x-evolution-any-field\" \"\")") != 0)
+			filter = e_book_backend_groupwise_build_gw_filter (egwb,
+									   query,
+									   &is_auto_completion,
+									   NULL);
+		if (filter)
 			match_needed = FALSE;
-		} else {
-			if (strcmp (query, "(contains \"x-evolution-any-field\" \"\")") != 0)
-				filter = e_book_backend_groupwise_build_gw_filter (egwb,
-										   query,
-										   &is_auto_completion,
-										   NULL);
-			if (filter)
-				match_needed = FALSE;
+		status = e_gw_connection_get_items (egwb->priv->cnc,
+						    egwb->priv->container_id,
+						    "name email default members",
+						    filter, &gw_items);
+		if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
 			status = e_gw_connection_get_items (egwb->priv->cnc,
 							    egwb->priv->container_id,
 							    "name email default members",
 							    filter, &gw_items);
-			if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-				status = e_gw_connection_get_items (egwb->priv->cnc,
-								    egwb->priv->container_id,
-								    "name email default members",
-								    filter, &gw_items);
-		}
+	}
 
-		if (status != E_GW_CONNECTION_STATUS_OK) {
-			e_data_book_respond_get_contact_list (book, opid, EDB_ERROR_FAILED_STATUS (OTHER_ERROR, status), NULL);
-			return;
-		}
-		for (; gw_items != NULL; gw_items = g_list_next (gw_items)) {
-			contact = e_contact_new ();
-			fill_contact_from_gw_item (contact, E_GW_ITEM (gw_items->data), egwb->priv->categories_by_id);
-			e_contact_set (contact, E_CONTACT_BOOK_URI, egwb->priv->original_uri);
-			if (match_needed &&  e_book_backend_sexp_match_contact (card_sexp, contact))
-				vcard_list = g_list_append (vcard_list,
-							    e_vcard_to_string (E_VCARD (contact),
-							    EVC_FORMAT_VCARD_30));
-			else
-				vcard_list = g_list_append (vcard_list,
-							    e_vcard_to_string (E_VCARD (contact),
-							    EVC_FORMAT_VCARD_30));
-			g_object_unref (contact);
-			g_object_unref (gw_items->data);
-		}
-		if (gw_items)
-			g_list_free (gw_items);
-		e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (SUCCESS), vcard_list);
-		if (filter)
-			g_object_unref (filter);
+	if (status != E_GW_CONNECTION_STATUS_OK) {
+		e_data_book_respond_get_contact_list (book, opid, EDB_ERROR_FAILED_STATUS (OTHER_ERROR, status), NULL);
 		return;
-	default :
-		break;
-
 	}
+	for (; gw_items != NULL; gw_items = g_list_next (gw_items)) {
+		contact = e_contact_new ();
+		fill_contact_from_gw_item (contact, E_GW_ITEM (gw_items->data), egwb->priv->categories_by_id);
+		e_contact_set (contact, E_CONTACT_BOOK_URI, egwb->priv->original_uri);
+		if (match_needed &&  e_book_backend_sexp_match_contact (card_sexp, contact))
+			vcard_list = g_slist_append (vcard_list,
+						     e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30));
+		else
+			vcard_list = g_slist_append (vcard_list,
+						     e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30));
+		g_object_unref (contact);
+		g_object_unref (gw_items->data);
+	}
+	if (gw_items)
+		g_list_free (gw_items);
+	e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (SUCCESS), vcard_list);
+	if (filter)
+		g_object_unref (filter);
+	g_slist_foreach (vcard_list, (GFunc) g_free, NULL);
+	g_slist_free (vcard_list);
 }
 
 typedef struct {
@@ -2147,9 +2113,7 @@ book_view_thread (gpointer data)
 	query = e_data_book_view_get_card_query (book_view);
 	if (enable_debug)
 		printf ("get view for query %s \n", query);
-	switch (gwb->priv->mode) {
-
-	case E_DATA_BOOK_MODE_LOCAL :
+	if (!gwb->priv->is_online) {
 		if (!gwb->priv->file_db) {
 			e_data_book_view_notify_complete (book_view, NULL /* Success */);
 			return NULL;
@@ -2189,211 +2153,200 @@ book_view_thread (gpointer data)
 			g_list_free (temp_list);
 		e_data_book_view_unref (book_view);
 		return NULL;
+	}
 
-	case E_DATA_BOOK_MODE_REMOTE :
-
-		if (gwb->priv->cnc == NULL) {
-			GError *edb_err = EDB_ERROR (AUTHENTICATION_REQUIRED);
-
-			e_data_book_view_notify_complete (book_view, edb_err);
-			e_data_book_view_unref (book_view);
-			g_error_free (edb_err);
-			return NULL;
-		}
-
-		if (enable_debug)
-			g_get_current_time (&start);
+	if (gwb->priv->cnc == NULL) {
+		GError *edb_err = EDB_ERROR (AUTHENTICATION_REQUIRED);
+		e_data_book_view_notify_complete (book_view, edb_err);
+		e_data_book_view_unref (book_view);
+		g_error_free (edb_err);
+		return NULL;
+	}
 
-		filter = e_book_backend_groupwise_build_gw_filter (gwb, query, &is_auto_completion, &search_string);
-		view = "name email default members";
-		if (is_auto_completion && !g_getenv ("AUTOCOMPLETE_EXPAND_CL"))
-			view = "name email";
+	if (enable_debug)
+		g_get_current_time (&start);
 
-		if (search_string) {
-			if (filter)
-				g_object_unref (filter);
+	filter = e_book_backend_groupwise_build_gw_filter (gwb, query, &is_auto_completion, &search_string);
+	view = "name email default members";
+	if (is_auto_completion && !g_getenv ("AUTOCOMPLETE_EXPAND_CL"))
+		view = "name email";
 
-			/* groupwise server supports only name, rebuild the filter */
-			filter = e_gw_filter_new ();
-			e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_BEGINS,
-							  "fullName/lastName", search_string);
-			e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_BEGINS,
-							  "fullName/firstName", search_string);
-			e_gw_filter_group_conditions (filter, E_GW_FILTER_OP_OR, 2);
-			g_free (search_string);
-		}
+	if (search_string) {
+		if (filter)
+			g_object_unref (filter);
 
-		if (!gwb->priv->is_writable && !filter && (g_getenv ("GW_HIDE_SYSBOOK") || (!gwb->priv->is_cache_ready))) {
+		/* groupwise server supports only name, rebuild the filter */
+		filter = e_gw_filter_new ();
+		e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_BEGINS,
+						  "fullName/lastName", search_string);
+		e_gw_filter_add_filter_component (filter, E_GW_FILTER_OP_BEGINS,
+						  "fullName/firstName", search_string);
+		e_gw_filter_group_conditions (filter, E_GW_FILTER_OP_OR, 2);
+		g_free (search_string);
+	}
 
-				e_data_book_view_notify_complete (book_view, NULL /* Success */);
-				e_data_book_view_unref (book_view);
-				if (filter)
-					g_object_unref (filter);
-				return NULL;
-		}
-		else
-			status =  E_GW_CONNECTION_STATUS_OK;
+	if (gwb->priv->is_readonly && !filter && (g_getenv ("GW_HIDE_SYSBOOK") || (!gwb->priv->is_cache_ready))) {
+		e_data_book_view_notify_complete (book_view, NULL /* Success */);
+		e_data_book_view_unref (book_view);
+		if (filter)
+			g_object_unref (filter);
+		return NULL;
+	} else
+		status =  E_GW_CONNECTION_STATUS_OK;
 
-		/* Check if the data is found on summary */
-		if (gwb->priv->is_summary_ready &&
-		    e_book_backend_summary_is_summary_query (gwb->priv->summary, query)) {
-			if (enable_debug)
-				printf("reading the uids from summary file\n");
-			ids = e_book_backend_summary_search (gwb->priv->summary, query);
-		}
+	/* Check if the data is found on summary */
+	if (gwb->priv->is_summary_ready &&
+	    e_book_backend_summary_is_summary_query (gwb->priv->summary, query)) {
+		if (enable_debug)
+			printf("reading the uids from summary file\n");
+		ids = e_book_backend_summary_search (gwb->priv->summary, query);
+	}
 
-		/*
-		 * Search for contact in cache, if not found, read from server
-		 */
+	/*
+	 * Search for contact in cache, if not found, read from server
+	 */
 
-		if (ids && ids->len > 0) {
+	if (ids && ids->len > 0) {
+		if (enable_debug)
+			printf ("number of matches found in summary %d\n", ids->len);
+		/* read from summary */
+		if (gwb->priv->is_cache_ready && gwb->priv->is_readonly) {
+			/* read from cache, only for system address book, as we refresh
+			 * only system address book, periodically.
+			 */
 			if (enable_debug)
-				printf ("number of matches found in summary %d\n", ids->len);
-			/* read from summary */
-			if (gwb->priv->is_cache_ready && !gwb->priv->is_writable) {
-				/* read from cache, only for system address book, as we refresh
-				 * only system address book, periodically.
-				 */
-				if (enable_debug)
-					printf ("reading contacts from cache for the uids in summary \n");
-				if (!is_auto_completion)
-					e_data_book_view_notify_status_message (book_view,
-										_("Searching..."));
-				get_contacts_from_cache (gwb, query, ids, book_view, closure);
-				g_ptr_array_free (ids, TRUE);
-				e_data_book_view_unref (book_view);
-				if (enable_debug) {
-					g_get_current_time (&end);
-					diff = end.tv_sec * 1000 + end.tv_usec/1000;
-					diff -= start.tv_sec * 1000 + start.tv_usec/1000;
-					printf("reading contacts from cache took %ld.%03ld seconds\n",
-						diff/1000,diff%1000);
-				}
-				if (filter)
-					g_object_unref (filter);
-				return NULL;
+				printf ("reading contacts from cache for the uids in summary \n");
+			if (!is_auto_completion)
+				e_data_book_view_notify_progress (book_view, -1,
+									_("Searching..."));
+			get_contacts_from_cache (gwb, query, ids, book_view, closure);
+			g_ptr_array_free (ids, TRUE);
+			e_data_book_view_unref (book_view);
+			if (enable_debug) {
+				g_get_current_time (&end);
+				diff = end.tv_sec * 1000 + end.tv_usec/1000;
+				diff -= start.tv_sec * 1000 + start.tv_usec/1000;
+				printf("reading contacts from cache took %ld.%03ld seconds\n",
+					diff/1000,diff%1000);
 			}
-			else {
-				/* read from server for the ids */
-				/* either autocompletion or search query and cache not ready */
-				if (enable_debug)
-					printf ("reading contacts from server for the uids in summary \n");
-				if (!is_auto_completion)
-					e_data_book_view_notify_status_message (book_view,
-										_("Searching..."));
+			if (filter)
+				g_object_unref (filter);
+			return NULL;
+		} else {
+			/* read from server for the ids */
+			/* either autocompletion or search query and cache not ready */
+			if (enable_debug)
+				printf ("reading contacts from server for the uids in summary \n");
+			if (!is_auto_completion)
+				e_data_book_view_notify_progress (book_view, -1,
+									_("Searching..."));
+			status = e_gw_connection_get_items_from_ids (gwb->priv->cnc,
+								     gwb->priv->container_id,
+								     view, ids, &gw_items);
+			if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
 				status = e_gw_connection_get_items_from_ids (gwb->priv->cnc,
 									     gwb->priv->container_id,
 									     view, ids, &gw_items);
-				if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-					status = e_gw_connection_get_items_from_ids (gwb->priv->cnc,
-										     gwb->priv->container_id,
-										     view, ids, &gw_items);
-				if (enable_debug && status == E_GW_CONNECTION_STATUS_OK)
-					printf ("read contacts from server \n");
-			}
-		}
-		else {
-			if (gwb->priv->is_cache_ready) {
-				contacts = e_book_backend_db_cache_get_contacts (gwb->priv->file_db, query);
-				temp_list = contacts;
-				for (; contacts != NULL; contacts = g_list_next (contacts)) {
-					if (!e_flag_is_set (closure->running)) {
-						for (;contacts != NULL; contacts = g_list_next (contacts))
-							g_object_unref (contacts->data);
-						break;
-					}
-					e_data_book_view_notify_update (book_view, E_CONTACT (contacts->data));
-					g_object_unref (contacts->data);
+			if (enable_debug && status == E_GW_CONNECTION_STATUS_OK)
+				printf ("read contacts from server \n");
+		}
+	} else {
+		if (gwb->priv->is_cache_ready) {
+			contacts = e_book_backend_db_cache_get_contacts (gwb->priv->file_db, query);
+			temp_list = contacts;
+			for (; contacts != NULL; contacts = g_list_next (contacts)) {
+				if (!e_flag_is_set (closure->running)) {
+					for (;contacts != NULL; contacts = g_list_next (contacts))
+						g_object_unref (contacts->data);
+					break;
 				}
-				if (e_flag_is_set (closure->running))
-					e_data_book_view_notify_complete (book_view, NULL /* Success */);
-				if (temp_list)
-					g_list_free (temp_list);
-				e_data_book_view_unref (book_view);
-
-				if (filter)
-					g_object_unref (filter);
-
-				if (ids)
-					g_ptr_array_free (ids, TRUE);
-
-				return NULL;
+				e_data_book_view_notify_update (book_view, E_CONTACT (contacts->data));
+				g_object_unref (contacts->data);
 			}
-
-			/* no summary information found, read from server */
-			if (enable_debug)
-				printf ("summary not found, reading the contacts from server\n");
-			if (!is_auto_completion) {
-				if (filter)
-					e_data_book_view_notify_status_message (book_view, _("Searching..."));
-				else
-					e_data_book_view_notify_status_message (book_view, _("Loading..."));
-			}
-			status = e_gw_connection_get_items (gwb->priv->cnc,
-							    gwb->priv->container_id,
-							    view, filter, &gw_items);
-			if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-				status = e_gw_connection_get_items (gwb->priv->cnc,
-								    gwb->priv->container_id,
-								    view, filter, &gw_items);
-		}
-
-		if (ids)
-			g_ptr_array_free (ids, TRUE);
-
-		if (status != E_GW_CONNECTION_STATUS_OK) {
-			GError *edb_err = EDB_ERROR_FAILED_STATUS (OTHER_ERROR, status);
-			e_data_book_view_notify_complete (book_view, edb_err);
+			if (e_flag_is_set (closure->running))
+				e_data_book_view_notify_complete (book_view, NULL /* Success */);
+			if (temp_list)
+				g_list_free (temp_list);
 			e_data_book_view_unref (book_view);
-			g_error_free (edb_err);
+
 			if (filter)
 				g_object_unref (filter);
-			return NULL;
-		}
 
-		temp_list = gw_items;
-		for (; gw_items != NULL; gw_items = g_list_next (gw_items)) {
+			if (ids)
+				g_ptr_array_free (ids, TRUE);
 
-			if (!e_flag_is_set (closure->running)) {
-				for (;gw_items != NULL; gw_items = g_list_next (gw_items))
-					g_object_unref (gw_items->data);
-				break;
-			}
+			return NULL;
+		}
 
-			count++;
-			contact = e_contact_new ();
-			fill_contact_from_gw_item (contact,
-						   E_GW_ITEM (gw_items->data),
-						   gwb->priv->categories_by_id);
-			e_contact_set (contact, E_CONTACT_BOOK_URI, gwb->priv->original_uri);
-			if (e_contact_get_const (contact, E_CONTACT_UID))
-				e_data_book_view_notify_update (book_view, contact);
+		/* no summary information found, read from server */
+		if (enable_debug)
+			printf ("summary not found, reading the contacts from server\n");
+		if (!is_auto_completion) {
+			if (filter)
+				e_data_book_view_notify_progress (book_view, -1, _("Searching..."));
 			else
-				g_critical ("Id missing for item %s\n", (gchar *)e_contact_get_const (contact, E_CONTACT_FILE_AS));
-			g_object_unref (contact);
-			g_object_unref (gw_items->data);
+				e_data_book_view_notify_progress (book_view, -1, _("Loading..."));
 		}
-		if (temp_list)
-			g_list_free (temp_list);
-		if (e_flag_is_set (closure->running))
-			e_data_book_view_notify_complete (book_view, NULL /* Success */);
+		status = e_gw_connection_get_items (gwb->priv->cnc,
+						    gwb->priv->container_id,
+						    view, filter, &gw_items);
+		if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
+			status = e_gw_connection_get_items (gwb->priv->cnc,
+							    gwb->priv->container_id,
+							    view, filter, &gw_items);
+	}
+
+	if (ids)
+		g_ptr_array_free (ids, TRUE);
+
+	if (status != E_GW_CONNECTION_STATUS_OK) {
+		GError *edb_err = EDB_ERROR_FAILED_STATUS (OTHER_ERROR, status);
+		e_data_book_view_notify_complete (book_view, edb_err);
+		e_data_book_view_unref (book_view);
+		g_error_free (edb_err);
 		if (filter)
 			g_object_unref (filter);
-		e_data_book_view_unref (book_view);
+		return NULL;
+	}
 
-		if (enable_debug) {
-			g_get_current_time (&end);
-			diff = end.tv_sec * 1000 + end.tv_usec/1000;
-			diff -= start.tv_sec * 1000 + start.tv_usec/1000;
-			printf("reading %d contacts from server took %ld.%03ld seconds\n",
-				count, diff/1000,diff%1000);
+	temp_list = gw_items;
+	for (; gw_items != NULL; gw_items = g_list_next (gw_items)) {
+
+		if (!e_flag_is_set (closure->running)) {
+			for (;gw_items != NULL; gw_items = g_list_next (gw_items))
+				g_object_unref (gw_items->data);
+			break;
 		}
 
-		return NULL;
-	default :
-		break;
+		count++;
+		contact = e_contact_new ();
+		fill_contact_from_gw_item (contact,
+					   E_GW_ITEM (gw_items->data),
+					   gwb->priv->categories_by_id);
+		e_contact_set (contact, E_CONTACT_BOOK_URI, gwb->priv->original_uri);
+		if (e_contact_get_const (contact, E_CONTACT_UID))
+			e_data_book_view_notify_update (book_view, contact);
+		else
+			g_critical ("Id missing for item %s\n", (gchar *)e_contact_get_const (contact, E_CONTACT_FILE_AS));
+		g_object_unref (contact);
+		g_object_unref (gw_items->data);
 	}
+	if (temp_list)
+		g_list_free (temp_list);
+	if (e_flag_is_set (closure->running))
+		e_data_book_view_notify_complete (book_view, NULL /* Success */);
+	if (filter)
+		g_object_unref (filter);
 	e_data_book_view_unref (book_view);
+
+	if (enable_debug) {
+		g_get_current_time (&end);
+		diff = end.tv_sec * 1000 + end.tv_usec/1000;
+		diff -= start.tv_sec * 1000 + start.tv_usec/1000;
+		printf("reading %d contacts from server took %ld.%03ld seconds\n",
+			count, diff/1000,diff%1000);
+	}
+
 	return NULL;
 }
 
@@ -2423,54 +2376,34 @@ e_book_backend_groupwise_stop_book_view (EBookBackend  *backend,
 }
 
 static void
-e_book_backend_groupwise_get_changes (EBookBackend *backend,
-				      EDataBook    *book,
-				      guint32       opid,
-				      const gchar *change_id  )
-{
-	if (enable_debug)
-		printf ("\ne_book_backend_groupwise_get_changes...\n");
-
-	/* FIXME : provide implmentation */
-
-}
-
-static void
 book_view_notify_status (EDataBookView *view, const gchar *status)
 {
 	if (!view)
 		return;
-	e_data_book_view_notify_status_message (view, status);
+	e_data_book_view_notify_progress (view, -1, status);
 }
 
-static EDataBookView *
-find_book_view (EBookBackendGroupwise *ebgw)
+static gboolean
+pick_view_cb (EDataBookView *view, gpointer user_data)
 {
-	EList *views = e_book_backend_get_book_views (E_BOOK_BACKEND (ebgw));
-	EIterator *iter;
-	EDataBookView *rv = NULL;
+	EDataBookView **pick = user_data;
 
-	if (!views)
-		return NULL;
+	g_return_val_if_fail (user_data != NULL, FALSE);
 
-	iter = e_list_get_iterator (views);
+	/* just always use the first book view */
+	*pick = view;
 
-	if (!iter) {
-		g_object_unref (views);
-		return NULL;
-	}
+	return view == NULL;
+}
 
-	if (e_iterator_is_valid (iter)) {
-		/* just always use the first book view */
-		EDataBookView *v = (EDataBookView*)e_iterator_get (iter);
-		if (v)
-			rv = v;
-	}
+static EDataBookView *
+find_book_view (EBookBackendGroupwise *ebgw)
+{
+	EDataBookView *pick = NULL;
 
-	g_object_unref (iter);
-	g_object_unref (views);
+	e_book_backend_foreach_view (E_BOOK_BACKEND (ebgw), pick_view_cb, &pick);
 
-	return rv;
+	return pick;
 }
 
 static void
@@ -3199,9 +3132,8 @@ static void
 e_book_backend_groupwise_authenticate_user (EBookBackend *backend,
 					    EDataBook    *book,
 					    guint32       opid,
-					    const gchar *user,
-					    const gchar *passwd,
-					    const gchar *auth_method)
+					    GCancellable *cancellable,
+					    ECredentials *credentials)
 {
 	EBookBackendGroupwise *ebgw;
 	EBookBackendGroupwisePrivate *priv;
@@ -3222,215 +3154,199 @@ e_book_backend_groupwise_authenticate_user (EBookBackend *backend,
 			printf("book_name:%s\n", priv->book_name);
 	}
 
-	switch (ebgw->priv->mode) {
-	case E_DATA_BOOK_MODE_LOCAL:
+	if (!ebgw->priv->is_online) {
 		/* load summary file for offline use */
 		g_mkdir_with_parents (g_path_get_dirname (priv->summary_file_name), 0700);
 		priv->summary = e_book_backend_summary_new (priv->summary_file_name,
 						    SUMMARY_FLUSH_TIMEOUT);
 		e_book_backend_summary_load (priv->summary);
 
-		e_book_backend_notify_writable (backend, FALSE);
-		e_book_backend_notify_connection_status (backend, FALSE);
+		e_book_backend_notify_readonly (backend, TRUE);
+		e_book_backend_notify_online (backend, FALSE);
 		e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (SUCCESS));
 		return;
+	}
 
-	case E_DATA_BOOK_MODE_REMOTE:
-
-		if (priv->cnc) { /*we have already authenticated to server */
-			printf("already authenticated\n");
-			e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (SUCCESS));
-			return;
-		}
-
-		priv->cnc = e_gw_connection_new_with_error_handler (priv->uri, user, passwd, &error);
-		if (!E_IS_GW_CONNECTION(priv->cnc) && priv->use_ssl && g_str_equal (priv->use_ssl, "when-possible")) {
-			http_uri = g_strconcat ("http://";, priv->uri + 8, NULL);
-			priv->cnc = e_gw_connection_new (http_uri, user, passwd);
-			g_free (http_uri);
-		}
+	if (priv->cnc) { /*we have already authenticated to server */
+		printf("already authenticated\n");
+		e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (SUCCESS));
+		return;
+	}
 
-		if (!E_IS_GW_CONNECTION (priv->cnc)) {
+	priv->cnc = e_gw_connection_new_with_error_handler (priv->uri, e_credentials_peek (credentials, E_CREDENTIALS_KEY_USERNAME), e_credentials_peek (credentials, E_CREDENTIALS_KEY_PASSWORD), &error);
+	if (!E_IS_GW_CONNECTION(priv->cnc) && priv->use_ssl && g_str_equal (priv->use_ssl, "when-possible")) {
+		http_uri = g_strconcat ("http://";, priv->uri + 8, NULL);
+		priv->cnc = e_gw_connection_new (http_uri, e_credentials_peek (credentials, E_CREDENTIALS_KEY_USERNAME), e_credentials_peek (credentials, E_CREDENTIALS_KEY_PASSWORD));
+		g_free (http_uri);
+	}
 
-			if (error.status == E_GW_CONNECTION_STATUS_INVALID_PASSWORD)
-				e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (AUTHENTICATION_FAILED));
-			else
-				e_data_book_respond_authenticate_user (book, opid, EDB_ERROR_FAILED_STATUS (OTHER_ERROR, error.status));
-			return;
-		}
+	if (!E_IS_GW_CONNECTION (priv->cnc)) {
+		if (error.status == E_GW_CONNECTION_STATUS_INVALID_PASSWORD)
+			e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (AUTHENTICATION_FAILED));
+		else
+			e_data_book_respond_authenticate_user (book, opid, EDB_ERROR_FAILED_STATUS (OTHER_ERROR, error.status));
+		return;
+	}
 
-		id = NULL;
-		is_writable = FALSE;
+	id = NULL;
+	is_writable = TRUE;
+	status = e_gw_connection_get_address_book_id (priv->cnc,  priv->book_name, &id, &is_writable);
+	if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
 		status = e_gw_connection_get_address_book_id (priv->cnc,  priv->book_name, &id, &is_writable);
-		if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-			status = e_gw_connection_get_address_book_id (priv->cnc,  priv->book_name, &id, &is_writable);
-		if (status == E_GW_CONNECTION_STATUS_OK) {
-			if ((id == NULL) && !priv->only_if_exists) {
-				status = e_gw_connection_create_book (priv->cnc, priv->book_name,  &id);
-				is_writable = TRUE;
-				if (status != E_GW_CONNECTION_STATUS_OK ) {
-					e_data_book_respond_authenticate_user (book, opid, EDB_ERROR_FAILED_STATUS (OTHER_ERROR, status));
-					return;
-				}
+	if (status == E_GW_CONNECTION_STATUS_OK) {
+		if ((id == NULL) && !priv->only_if_exists) {
+			status = e_gw_connection_create_book (priv->cnc, priv->book_name,  &id);
+			is_writable = TRUE;
+			if (status != E_GW_CONNECTION_STATUS_OK ) {
+				e_data_book_respond_authenticate_user (book, opid, EDB_ERROR_FAILED_STATUS (OTHER_ERROR, status));
+				return;
 			}
 		}
-		if (id != NULL) {
-			priv->container_id = g_strdup (id);
-			g_free (id);
-			e_book_backend_set_is_writable (backend, is_writable);
-			e_book_backend_notify_writable (backend, is_writable);
-			e_book_backend_notify_connection_status (backend, TRUE);
-			priv->is_writable = is_writable;
-			e_gw_connection_get_categories (priv->cnc, &priv->categories_by_id, &priv->categories_by_name);
-			if (!e_gw_connection_get_version (priv->cnc))
-				e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (INVALID_SERVER_VERSION));
-			else
-				e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (SUCCESS));
-		} else {
-			e_book_backend_set_is_loaded (backend, FALSE);
-			e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (NO_SUCH_BOOK));
-		}
-
-		/* initialize summary file */
-		tmpfile = g_path_get_dirname (priv->summary_file_name);
-		g_mkdir_with_parents (tmpfile, 0700);
-		g_free (tmpfile);
-		priv->summary = e_book_backend_summary_new (priv->summary_file_name,
-							    SUMMARY_FLUSH_TIMEOUT);
+	}
+	if (id != NULL) {
+		priv->container_id = g_strdup (id);
+		g_free (id);
+		e_book_backend_set_is_readonly (backend, !is_writable);
+		e_book_backend_notify_readonly (backend, !is_writable);
+		e_book_backend_notify_online (backend, TRUE);
+		priv->is_readonly = !is_writable;
+		e_gw_connection_get_categories (priv->cnc, &priv->categories_by_id, &priv->categories_by_name);
+		if (!e_gw_connection_get_version (priv->cnc))
+			e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (INVALID_SERVER_VERSION));
+		else
+			e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (SUCCESS));
+	} else {
+		e_book_backend_set_is_loaded (backend, FALSE);
+		e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (NO_SUCH_BOOK));
+	}
 
-		if (!ebgw->priv->file_db) {
-				e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (OTHER_ERROR));
-				return;
-		}
-		if (e_book_backend_db_cache_is_populated (ebgw->priv->file_db)) {
-			if (enable_debug)
-				printf("cache is populated\n");
+	/* initialize summary file */
+	tmpfile = g_path_get_dirname (priv->summary_file_name);
+	g_mkdir_with_parents (tmpfile, 0700);
+	g_free (tmpfile);
+	priv->summary = e_book_backend_summary_new (priv->summary_file_name,
+						    SUMMARY_FLUSH_TIMEOUT);
 
-			if (!e_book_backend_summary_load (priv->summary))
-				build_summary (ebgw);
+	if (!ebgw->priv->file_db) {
+		e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (OTHER_ERROR));
+		return;
+	}
+	if (e_book_backend_db_cache_is_populated (ebgw->priv->file_db)) {
+		if (enable_debug)
+			printf("cache is populated\n");
 
-			ebgw->priv->is_cache_ready = TRUE;
-			ebgw->priv->is_summary_ready = TRUE;
+		if (!e_book_backend_summary_load (priv->summary))
+			build_summary (ebgw);
 
-			if (priv->is_writable) {
-				if (enable_debug) {
-					printf("is writable\n");
-					printf("creating update_cache thread\n");
-				}
-				g_thread_create ((GThreadFunc) update_cache, ebgw, FALSE, NULL);
-			}
-			else if (priv->marked_for_offline) {
-				GThread *t;
-				if (enable_debug)
-					printf("marked for offline\n");
-				if (enable_debug)
-					printf("creating update_address_book_deltas thread\n");
-
-				t = g_thread_create ((GThreadFunc) update_address_book_deltas, ebgw, TRUE, NULL);
-
-				/* spawn a thread to update the system address book cache
-				 * at given intervals
-				 */
-				cache_refresh_interval_set = g_getenv ("BOOK_CACHE_REFRESH_INTERVAL");
-				if (cache_refresh_interval_set) {
-					cache_refresh_interval = g_ascii_strtod (cache_refresh_interval_set,
-										NULL); /* use this */
-					cache_refresh_interval *= (60*1000);
-				}
+		ebgw->priv->is_cache_ready = TRUE;
+		ebgw->priv->is_summary_ready = TRUE;
 
-				/* set the cache refresh time */
-				g_thread_join (t);
-				if (enable_debug)
-					printf ("creating cache refresh thread for GW system book \n");
-				priv->cache_timeout = g_timeout_add (cache_refresh_interval,
-								     (GSourceFunc) update_address_book_cache,
-								     (gpointer)ebgw);
-			}
-		}
-		else if (priv->is_writable) {  /* for personal books we always cache */
-			/* Personal address book and frequent contacts */
+		if (!priv->is_readonly) {
 			if (enable_debug) {
-				printf("else if is _writable");
-				printf("build_cahe thread");
+				printf("is writable\n");
+				printf("creating update_cache thread\n");
 			}
-			g_thread_create ((GThreadFunc) build_cache, ebgw, FALSE, NULL);
-		}
-		else if (priv->marked_for_offline) {
+			g_thread_create ((GThreadFunc) update_cache, ebgw, FALSE, NULL);
+		} else if (priv->marked_for_offline) {
 			GThread *t;
 			if (enable_debug)
-				printf("else if marked_for_offline\n");
-			/* System address book */
-			/* cache is not populated and book is not writable and marked for offline usage */
+				printf("marked for offline\n");
 			if (enable_debug)
 				printf("creating update_address_book_deltas thread\n");
+
 			t = g_thread_create ((GThreadFunc) update_address_book_deltas, ebgw, TRUE, NULL);
-			g_thread_join (t);
+
+			/* spawn a thread to update the system address book cache
+			 * at given intervals
+			 */
+			cache_refresh_interval_set = g_getenv ("BOOK_CACHE_REFRESH_INTERVAL");
+			if (cache_refresh_interval_set) {
+				cache_refresh_interval = g_ascii_strtod (cache_refresh_interval_set,
+									NULL); /* use this */
+				cache_refresh_interval *= (60*1000);
+			}
+
 			/* set the cache refresh time */
+			g_thread_join (t);
 			if (enable_debug)
 				printf ("creating cache refresh thread for GW system book \n");
 			priv->cache_timeout = g_timeout_add (cache_refresh_interval,
 							     (GSourceFunc) update_address_book_cache,
 							     (gpointer)ebgw);
 		}
-		return;
-	default :
-		break;
+	} else if (!priv->is_readonly) {  /* for personal books we always cache */
+		/* Personal address book and frequent contacts */
+		if (enable_debug) {
+			printf("else if is _writable");
+			printf("build_cahe thread");
+		}
+		g_thread_create ((GThreadFunc) build_cache, ebgw, FALSE, NULL);
+	} else if (priv->marked_for_offline) {
+		GThread *t;
+		if (enable_debug)
+			printf("else if marked_for_offline\n");
+		/* System address book */
+		/* cache is not populated and book is readonly and marked for offline usage */
+		if (enable_debug)
+			printf("creating update_address_book_deltas thread\n");
+		t = g_thread_create ((GThreadFunc) update_address_book_deltas, ebgw, TRUE, NULL);
+		g_thread_join (t);
+		/* set the cache refresh time */
+		if (enable_debug)
+			printf ("creating cache refresh thread for GW system book \n");
+		priv->cache_timeout = g_timeout_add (cache_refresh_interval,
+						     (GSourceFunc) update_address_book_cache,
+						     (gpointer)ebgw);
 	}
 }
 
 static void
 e_book_backend_groupwise_get_required_fields (EBookBackend *backend,
 					       EDataBook    *book,
-					       guint32       opid)
+					       guint32       opid,
+					       GCancellable *cancellable)
 {
-	GList *fields = NULL;
+	GSList *fields = NULL;
 
 	if (enable_debug)
 		printf ("\ne_book_backend_groupwise_get_required_fields...\n");
 
-	fields = g_list_append (fields, (gchar *)e_contact_field_name (E_CONTACT_FILE_AS));
+	fields = g_slist_append (fields, (gchar *)e_contact_field_name (E_CONTACT_FILE_AS));
 	e_data_book_respond_get_supported_fields (book, opid,
 						  EDB_ERROR (SUCCESS),
 						  fields);
-	g_list_free (fields);
+	g_slist_free (fields);
 
 }
 
 static void
 e_book_backend_groupwise_get_supported_fields (EBookBackend *backend,
 					       EDataBook    *book,
-					       guint32       opid)
+					       guint32       opid,
+					       GCancellable *cancellable)
 {
-	GList *fields = NULL;
+	GSList *fields = NULL;
 	gint i;
 
 	if (enable_debug)
 		printf ("\ne_book_backend_groupwise_get_supported_fields...\n");
 
 	for (i = 0; i < G_N_ELEMENTS (mappings); i++)
-		fields = g_list_append (fields, g_strdup (e_contact_field_name (mappings[i].field_id)));
-	fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_EMAIL_2)));
-	fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_EMAIL_3)));
-	fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_ICQ)));
-	fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_YAHOO)));
-	fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_GADUGADU)));
-	fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_MSN)));
-	fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_SKYPE)));
-	fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_JABBER)));
-	fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_GROUPWISE)));
-	fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_ADDRESS_WORK)));
+		fields = g_slist_append (fields, g_strdup (e_contact_field_name (mappings[i].field_id)));
+	fields = g_slist_append (fields, g_strdup (e_contact_field_name (E_CONTACT_EMAIL_2)));
+	fields = g_slist_append (fields, g_strdup (e_contact_field_name (E_CONTACT_EMAIL_3)));
+	fields = g_slist_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_ICQ)));
+	fields = g_slist_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_YAHOO)));
+	fields = g_slist_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_GADUGADU)));
+	fields = g_slist_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_MSN)));
+	fields = g_slist_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_SKYPE)));
+	fields = g_slist_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_JABBER)));
+	fields = g_slist_append (fields, g_strdup (e_contact_field_name (E_CONTACT_IM_GROUPWISE)));
+	fields = g_slist_append (fields, g_strdup (e_contact_field_name (E_CONTACT_ADDRESS_WORK)));
 	e_data_book_respond_get_supported_fields (book, opid,
 						  EDB_ERROR (SUCCESS),
 						  fields);
-	g_list_free (fields);
-}
-
-static void
-e_book_backend_groupwise_cancel_operation (EBookBackend *backend, EDataBook *book, GError **perror)
-{
-	if (enable_debug)
-		printf ("\ne_book_backend_groupwise_cancel_operation...\n");
-	g_propagate_error (perror, EDB_ERROR (COULD_NOT_CANCEL));
+	g_slist_free (fields);
 }
 
 static void
@@ -3444,13 +3360,15 @@ file_errcall (const gchar *buf1, gchar *buf2)
 }
 
 static void
-e_book_backend_groupwise_load_source (EBookBackend           *backend,
-				      ESource                *source,
-				      gboolean                only_if_exists,
-				      GError                **perror)
+e_book_backend_groupwise_open (EBookBackend	*backend,
+			       EDataBook	*book,
+			       guint		 opid,
+			       GCancellable	*cancellable,
+			       gboolean		 only_if_exists)
 {
 	EBookBackendGroupwise *ebgw;
 	EBookBackendGroupwisePrivate *priv;
+	ESource *source;
 	gchar *dirname, *filename, *tmp;
 	gchar *book_name;
 	gchar *uri;
@@ -3465,6 +3383,7 @@ e_book_backend_groupwise_load_source (EBookBackend           *backend,
 	const gchar *offline;
 
 	cache_dir = e_book_backend_get_cache_dir (backend);
+	source = e_book_backend_get_source (backend);
 
 	if (enable_debug)
 		printf("\ne_book_backend_groupwise_load_source.. \n");
@@ -3479,7 +3398,7 @@ e_book_backend_groupwise_load_source (EBookBackend           *backend,
 	uri =  e_source_get_uri (source);
 	priv->original_uri = g_strdup (uri);
 	if (uri == NULL) {
-		g_propagate_error (perror, EDB_ERROR_EX (OTHER_ERROR, "No URI given"));
+		e_data_book_respond_open (book, opid, EDB_ERROR_EX (OTHER_ERROR, "No URI given"));
 		return;
 	}
 
@@ -3489,7 +3408,7 @@ e_book_backend_groupwise_load_source (EBookBackend           *backend,
 		uri = g_strdup (tokens[0]);
 	book_name = g_strdup (tokens[1]);
 	if (book_name == NULL) {
-		g_propagate_error (perror, EDB_ERROR_EX (OTHER_ERROR, "No book name recognized for a URI"));
+		e_data_book_respond_open (book, opid, EDB_ERROR_EX (OTHER_ERROR, "No book name recognized for a URI"));
 		return;
 	}
 	g_strfreev (tokens);
@@ -3518,7 +3437,7 @@ e_book_backend_groupwise_load_source (EBookBackend           *backend,
 		g_warning ("db recovery failed with %d", db_error);
 		g_free (dirname);
 		g_free (filename);
-		g_propagate_error (perror, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, "DB recovery failed with code 0x%x", db_error));
+		e_data_book_respond_open (book, opid, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, "DB recovery failed with code 0x%x", db_error));
 		return;
 	}
 
@@ -3534,7 +3453,7 @@ e_book_backend_groupwise_load_source (EBookBackend           *backend,
 			g_static_mutex_unlock (&global_env_lock);
 			g_free (dirname);
 			g_free (filename);
-			g_propagate_error (perror, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, "db_env_create failed with code 0x%x", db_error));
+			e_data_book_respond_open (book, opid, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, "db_env_create failed with code 0x%x", db_error));
 			return;
 		}
 
@@ -3545,7 +3464,7 @@ e_book_backend_groupwise_load_source (EBookBackend           *backend,
 			g_static_mutex_unlock (&global_env_lock);
 			g_free (dirname);
 			g_free (filename);
-			g_propagate_error (perror, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, "db_env_open failed with code 0x%x", db_error));
+			e_data_book_respond_open (book, opid, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, "db_env_open failed with code 0x%x", db_error));
 			return;
 		}
 
@@ -3563,7 +3482,7 @@ e_book_backend_groupwise_load_source (EBookBackend           *backend,
 		g_warning ("db_create failed with %d", db_error);
 		g_free (dirname);
 		g_free (filename);
-		g_propagate_error (perror, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, "db_create failed with code 0x%x", db_error));
+		e_data_book_respond_open (book, opid, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, "db_create failed with code 0x%x", db_error));
 		return;
 	}
 
@@ -3576,7 +3495,7 @@ e_book_backend_groupwise_load_source (EBookBackend           *backend,
 			g_warning ("db format upgrade failed with %d", db_error);
 			g_free (filename);
 			g_free (dirname);
-			g_propagate_error (perror, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, "db format upgrade failed with code 0x%x", db_error));
+			e_data_book_respond_open (book, opid, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, "db format upgrade failed with code 0x%x", db_error));
 			return;
 		}
 
@@ -3593,9 +3512,9 @@ e_book_backend_groupwise_load_source (EBookBackend           *backend,
 		rv = g_mkdir_with_parents (dirname, 0700);
 		if (rv == -1 && errno != EEXIST) {
 			if (errno == EACCES || errno == EPERM)
-				g_propagate_error (perror, EDB_ERROR (PERMISSION_DENIED));
+				e_data_book_respond_open (book, opid, EDB_ERROR (PERMISSION_DENIED));
 			else
-				g_propagate_error (perror, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, "Failed to make directory %s: %s", dirname, g_strerror (errno)));
+				e_data_book_respond_open (book, opid, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, "Failed to make directory %s: %s", dirname, g_strerror (errno)));
 			g_free (dirname);
 			g_free (filename);
 			return;
@@ -3614,12 +3533,12 @@ e_book_backend_groupwise_load_source (EBookBackend           *backend,
 		ebgw->priv->file_db = NULL;
 		g_free (filename);
 		g_free (dirname);
-		g_propagate_error (perror, EDB_ERROR (OTHER_ERROR));
+		e_data_book_respond_open (book, opid, EDB_ERROR (OTHER_ERROR));
 		return;
 	}
 
-	if (priv->mode ==  E_DATA_BOOK_MODE_LOCAL &&  !priv->marked_for_offline ) {
-		g_propagate_error (perror, EDB_ERROR (OFFLINE_UNAVAILABLE));
+	if (!priv->is_online &&  !priv->marked_for_offline ) {
+		e_data_book_respond_open (book, opid, EDB_ERROR (OFFLINE_UNAVAILABLE));
 		return;
 	}
 
@@ -3627,20 +3546,15 @@ e_book_backend_groupwise_load_source (EBookBackend           *backend,
 	priv->only_if_exists = only_if_exists;
 
 	e_book_backend_set_is_loaded (E_BOOK_BACKEND (backend), TRUE);
-	e_book_backend_set_is_writable (E_BOOK_BACKEND (backend), FALSE);
-	if (priv->mode == E_DATA_BOOK_MODE_LOCAL) {
-		e_book_backend_notify_writable (backend, FALSE);
-		e_book_backend_notify_connection_status (backend, FALSE);
-	}
-	else {
-		e_book_backend_notify_connection_status (backend, TRUE);
-	}
+	e_book_backend_set_is_readonly (E_BOOK_BACKEND (backend), TRUE);
+	e_book_backend_notify_readonly (backend, TRUE);
+	e_book_backend_notify_online (backend, priv->is_online);
 
-	if (priv->mode == E_DATA_BOOK_MODE_LOCAL)
+	if (!priv->is_online)
 		if (!g_file_test (filename, G_FILE_TEST_IS_REGULAR)) {
 			g_free (uri);
 			e_uri_free (parsed_uri);
-			g_propagate_error (perror, EDB_ERROR (OFFLINE_UNAVAILABLE));
+			e_data_book_respond_open (book, opid, EDB_ERROR (OFFLINE_UNAVAILABLE));
 			return;
 		}
 
@@ -3656,12 +3570,15 @@ e_book_backend_groupwise_load_source (EBookBackend           *backend,
 		printf ("summary file name = %s\ncache file name = %s \n",
 			 priv->summary_file_name, e_file_cache_get_filename (E_FILE_CACHE (priv->cache)));
 	}*/
+
+	e_data_book_respond_open (book, opid, NULL /* Success */);
 }
 
 static void
 e_book_backend_groupwise_remove (EBookBackend *backend,
 				 EDataBook        *book,
-				 guint32           opid)
+				 guint32           opid,
+				 GCancellable *cancellable)
 {
 	EBookBackendGroupwise *ebgw;
 	gint status;
@@ -3673,7 +3590,7 @@ e_book_backend_groupwise_remove (EBookBackend *backend,
 		e_data_book_respond_remove (book,  opid,  EDB_ERROR (AUTHENTICATION_REQUIRED));
 		return;
 	}
-	if (!ebgw->priv->is_writable) {
+	if (ebgw->priv->is_readonly) {
 		e_data_book_respond_remove (book,  opid,  EDB_ERROR (PERMISSION_DENIED));
 		return;
 	}
@@ -3685,63 +3602,58 @@ e_book_backend_groupwise_remove (EBookBackend *backend,
 	g_unlink (e_book_backend_db_cache_get_filename (ebgw->priv->file_db));
 }
 
-static gchar *
-e_book_backend_groupwise_get_static_capabilities (EBookBackend *backend)
+static void
+e_book_backend_groupwise_get_capabilities (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable)
 {
 	if (enable_debug)
-		printf ("\ne_book_backend_groupwise_get_static_capabilities...\n");
+		printf ("\n%s...\n", G_STRFUNC);
 
 	/* do-initialy-query is enabled for system address book also, so that we get the
 	 * book_view, which is needed for displaying cache update progress.
 	 * and null query is handled for system address book.
 	 */
-	return g_strdup ("net,bulk-removes,do-initial-query,contact-lists");
+	e_data_book_respond_get_capabilities (book, opid, NULL, "net,bulk-removes,do-initial-query,contact-lists");
 }
 
 static void
-e_book_backend_groupwise_get_supported_auth_methods (EBookBackend *backend, EDataBook *book, guint32 opid)
+e_book_backend_groupwise_get_supported_auth_methods (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable)
 {
-	GList *auth_methods = NULL;
+	GSList *auth_methods = NULL;
 	gchar *auth_method;
 
 	if (enable_debug)
 		printf ("\ne_book_backend_groupwise_get_supported_auth_methods...\n");
 	auth_method =  g_strdup_printf ("plain/password");
-	auth_methods = g_list_append (auth_methods, auth_method);
+	auth_methods = g_slist_append (auth_methods, auth_method);
 	e_data_book_respond_get_supported_auth_methods (book,
 							opid,
 							EDB_ERROR (SUCCESS),
 							auth_methods);
 	g_free (auth_method);
-	g_list_free (auth_methods);
+	g_slist_free (auth_methods);
 }
 
 static void
-e_book_backend_groupwise_set_mode (EBookBackend *backend,
-                                   EDataBookMode mode)
+e_book_backend_groupwise_set_online (EBookBackend *backend, gboolean is_online)
 {
 	EBookBackendGroupwise *bg;
 
 	if (enable_debug)
 		printf ("\ne_book_backend_groupwise_set_mode...\n");
 	bg = E_BOOK_BACKEND_GROUPWISE (backend);
-	bg->priv->mode = mode;
+	bg->priv->is_online = is_online;
 	if (e_book_backend_is_loaded (backend)) {
-		if (mode == E_DATA_BOOK_MODE_LOCAL) {
-			e_book_backend_notify_writable (backend, FALSE);
-			e_book_backend_notify_connection_status (backend, FALSE);
+		if (!is_online) {
+			e_book_backend_notify_readonly (backend, TRUE);
+			e_book_backend_notify_online (backend, FALSE);
 			if (bg->priv->cnc) {
 				g_object_unref (bg->priv->cnc);
 				bg->priv->cnc=NULL;
 			}
-		}
-		else if (mode == E_DATA_BOOK_MODE_REMOTE) {
-			if (bg->priv->is_writable)
-				e_book_backend_notify_writable (backend, TRUE);
-			else
-				e_book_backend_notify_writable (backend, FALSE);
-			e_book_backend_notify_connection_status (backend, TRUE);
-			e_book_backend_notify_auth_required (backend);
+		} else {
+			e_book_backend_notify_readonly (backend, bg->priv->is_readonly);
+			e_book_backend_notify_online (backend, TRUE);
+			e_book_backend_notify_auth_required (backend, NULL);
 		}
 	}
 }
@@ -3869,25 +3781,24 @@ e_book_backend_groupwise_class_init (EBookBackendGroupwiseClass *klass)
 	parent_class = E_BOOK_BACKEND_CLASS (klass);
 
 	/* Set the virtual methods. */
-	parent_class->load_source             = e_book_backend_groupwise_load_source;
-	parent_class->get_static_capabilities = e_book_backend_groupwise_get_static_capabilities;
-
-	parent_class->create_contact          = e_book_backend_groupwise_create_contact;
-	parent_class->remove_contacts         = e_book_backend_groupwise_remove_contacts;
-	parent_class->modify_contact          = e_book_backend_groupwise_modify_contact;
-	parent_class->get_contact             = e_book_backend_groupwise_get_contact;
-	parent_class->get_contact_list        = e_book_backend_groupwise_get_contact_list;
-	parent_class->start_book_view         = e_book_backend_groupwise_start_book_view;
-	parent_class->stop_book_view          = e_book_backend_groupwise_stop_book_view;
-	parent_class->get_changes             = e_book_backend_groupwise_get_changes;
-	parent_class->authenticate_user       = e_book_backend_groupwise_authenticate_user;
-	parent_class->get_required_fields     = e_book_backend_groupwise_get_required_fields;
-	parent_class->get_supported_fields    = e_book_backend_groupwise_get_supported_fields;
-	parent_class->get_supported_auth_methods = e_book_backend_groupwise_get_supported_auth_methods;
-	parent_class->cancel_operation        = e_book_backend_groupwise_cancel_operation;
-	parent_class->remove                  = e_book_backend_groupwise_remove;
-	parent_class->set_mode                = e_book_backend_groupwise_set_mode;
-	object_class->dispose                 = e_book_backend_groupwise_dispose;
+	parent_class->open				= e_book_backend_groupwise_open;
+	parent_class->get_capabilities			= e_book_backend_groupwise_get_capabilities;
+
+	parent_class->create_contact			= e_book_backend_groupwise_create_contact;
+	parent_class->remove_contacts			= e_book_backend_groupwise_remove_contacts;
+	parent_class->modify_contact			= e_book_backend_groupwise_modify_contact;
+	parent_class->get_contact			= e_book_backend_groupwise_get_contact;
+	parent_class->get_contact_list			= e_book_backend_groupwise_get_contact_list;
+	parent_class->start_book_view			= e_book_backend_groupwise_start_book_view;
+	parent_class->stop_book_view			= e_book_backend_groupwise_stop_book_view;
+	parent_class->authenticate_user			= e_book_backend_groupwise_authenticate_user;
+	parent_class->get_required_fields		= e_book_backend_groupwise_get_required_fields;
+	parent_class->get_supported_fields		= e_book_backend_groupwise_get_supported_fields;
+	parent_class->get_supported_auth_methods	= e_book_backend_groupwise_get_supported_auth_methods;
+	parent_class->remove				= e_book_backend_groupwise_remove;
+	parent_class->set_online			= e_book_backend_groupwise_set_online;
+
+	object_class->dispose				= e_book_backend_groupwise_dispose;
 }
 
 static void
@@ -3896,7 +3807,7 @@ e_book_backend_groupwise_init (EBookBackendGroupwise *backend)
 	EBookBackendGroupwisePrivate *priv;
 
 	priv= g_new0 (EBookBackendGroupwisePrivate, 1);
-	priv->is_writable = TRUE;
+	priv->is_readonly = FALSE;
 	priv->is_cache_ready = FALSE;
 	priv->is_summary_ready = FALSE;
 	priv->marked_for_offline = FALSE;
diff --git a/addressbook/backends/ldap/e-book-backend-ldap.c b/addressbook/backends/ldap/e-book-backend-ldap.c
index 8ad5a20..ea384d3 100644
--- a/addressbook/backends/ldap/e-book-backend-ldap.c
+++ b/addressbook/backends/ldap/e-book-backend-ldap.c
@@ -199,8 +199,8 @@ struct _EBookBackendLDAPPrivate {
 
 	LDAP     *ldap;
 
-	GList    *supported_fields;
-	GList    *supported_auth_methods;
+	GSList   *supported_fields;
+	GSList   *supported_auth_methods;
 
 	EBookBackendCache *cache;
 
@@ -211,7 +211,7 @@ struct _EBookBackendLDAPPrivate {
 	gboolean evolutionPersonChecked;
 	gboolean marked_for_offline;
 
-	gint mode;
+	gboolean is_online;
 	/* our operations */
 	GStaticRecMutex op_hash_mutex;
 	GHashTable *id_to_op;
@@ -444,46 +444,58 @@ can_browse (EBookBackend *backend)
 		strcmp (e_source_get_property (e_book_backend_get_source (backend), "can-browse"), "1") == 0;
 }
 
+static gboolean
+pick_view_cb (EDataBookView *view, gpointer user_data)
+{
+	EDataBookView **pick = user_data;
+
+	g_return_val_if_fail (user_data != NULL, FALSE);
+
+	/* just always use the first book view */
+	*pick = view;
+
+	return view == NULL;
+}
+
 static EDataBookView*
 find_book_view (EBookBackendLDAP *bl)
 {
-	EList *views = e_book_backend_get_book_views (E_BOOK_BACKEND (bl));
-	EIterator *iter = e_list_get_iterator (views);
-	EDataBookView *rv = NULL;
-
-	if (e_iterator_is_valid (iter)) {
-		/* just always use the first book view */
-		EDataBookView *v = (EDataBookView*)e_iterator_get (iter);
-		if (v)
-			rv = v;
-	}
+	EDataBookView *pick = NULL;
 
-	g_object_unref (iter);
-	g_object_unref (views);
+	e_book_backend_foreach_view (E_BOOK_BACKEND (bl), pick_view_cb, &pick);
 
-	return rv;
+	return pick;
 }
 
+struct check_data
+{
+	EDataBookView *to_find;
+	gboolean found;
+};
+
 static gboolean
-book_view_is_valid (EBookBackendLDAP *bl, EDataBookView *book_view)
+check_view_cb (EDataBookView *view, gpointer user_data)
 {
-	gboolean found = FALSE;
-	EList *views;
-	EIterator *iter;
+	struct check_data *cd = user_data;
 
-	if (!book_view)
-		return FALSE;
+	g_return_val_if_fail (user_data != NULL, FALSE);
 
-	views = e_book_backend_get_book_views (E_BOOK_BACKEND (bl));
+	cd->found = view == cd->to_find;
 
-	for (iter = e_list_get_iterator (views); e_iterator_is_valid (iter) && !found; e_iterator_next (iter)) {
-		found = book_view == e_iterator_get (iter);
-	}
+	return !cd->found;
+}
+
+static gboolean
+book_view_is_valid (EBookBackendLDAP *bl, EDataBookView *book_view)
+{
+	struct check_data cd;
+
+	cd.to_find = book_view;
+	cd.found = FALSE;
 
-	g_object_unref (iter);
-	g_object_unref (views);
+	e_book_backend_foreach_view (E_BOOK_BACKEND (bl), check_view_cb, &cd);
 
-	return found;
+	return cd.found;
 }
 
 static void
@@ -491,7 +503,7 @@ book_view_notify_status (EBookBackendLDAP *bl, EDataBookView *view, const gchar
 {
 	if (!book_view_is_valid (bl, view))
 		return;
-	e_data_book_view_notify_status_message (view, status);
+	e_data_book_view_notify_progress (view, -1, status);
 }
 
 static void
@@ -502,23 +514,23 @@ add_to_supported_fields (EBookBackendLDAP *bl, gchar **attrs, GHashTable *attr_h
 		gchar *query_prop = g_hash_table_lookup (attr_hash, attrs[i]);
 
 		if (query_prop) {
-			bl->priv->supported_fields = g_list_append (bl->priv->supported_fields, g_strdup (query_prop));
+			bl->priv->supported_fields = g_slist_append (bl->priv->supported_fields, g_strdup (query_prop));
 
 			/* handle the list attributes here */
 			if (!strcmp (query_prop, e_contact_field_name (E_CONTACT_EMAIL))) {
-				bl->priv->supported_fields = g_list_append (bl->priv->supported_fields, g_strdup (e_contact_field_name (E_CONTACT_EMAIL_1)));
-				bl->priv->supported_fields = g_list_append (bl->priv->supported_fields, g_strdup (e_contact_field_name (E_CONTACT_EMAIL_2)));
-				bl->priv->supported_fields = g_list_append (bl->priv->supported_fields, g_strdup (e_contact_field_name (E_CONTACT_EMAIL_3)));
-				bl->priv->supported_fields = g_list_append (bl->priv->supported_fields, g_strdup (e_contact_field_name (E_CONTACT_EMAIL_4)));
+				bl->priv->supported_fields = g_slist_append (bl->priv->supported_fields, g_strdup (e_contact_field_name (E_CONTACT_EMAIL_1)));
+				bl->priv->supported_fields = g_slist_append (bl->priv->supported_fields, g_strdup (e_contact_field_name (E_CONTACT_EMAIL_2)));
+				bl->priv->supported_fields = g_slist_append (bl->priv->supported_fields, g_strdup (e_contact_field_name (E_CONTACT_EMAIL_3)));
+				bl->priv->supported_fields = g_slist_append (bl->priv->supported_fields, g_strdup (e_contact_field_name (E_CONTACT_EMAIL_4)));
 			}
 			else if (!strcmp (query_prop, e_contact_field_name (E_CONTACT_PHONE_BUSINESS))) {
-				bl->priv->supported_fields = g_list_append (bl->priv->supported_fields, g_strdup (e_contact_field_name (E_CONTACT_PHONE_BUSINESS_2)));
+				bl->priv->supported_fields = g_slist_append (bl->priv->supported_fields, g_strdup (e_contact_field_name (E_CONTACT_PHONE_BUSINESS_2)));
 			}
 			else if (!strcmp (query_prop, e_contact_field_name (E_CONTACT_PHONE_HOME))) {
-				bl->priv->supported_fields = g_list_append (bl->priv->supported_fields, g_strdup (e_contact_field_name (E_CONTACT_PHONE_HOME_2)));
+				bl->priv->supported_fields = g_slist_append (bl->priv->supported_fields, g_strdup (e_contact_field_name (E_CONTACT_PHONE_HOME_2)));
 			}
 			else if (!strcmp (query_prop, e_contact_field_name (E_CONTACT_CATEGORY_LIST) )) {
-				bl->priv->supported_fields = g_list_append (bl->priv->supported_fields, g_strdup (e_contact_field_name (E_CONTACT_CATEGORIES)));
+				bl->priv->supported_fields = g_slist_append (bl->priv->supported_fields, g_strdup (e_contact_field_name (E_CONTACT_CATEGORIES)));
 			}
 
 		}
@@ -622,7 +634,7 @@ check_schema_support (EBookBackendLDAP *bl)
 			   of draconian acl's that keep subschema
 			   reads from working until the user is
 			   authed. */
-			if (!e_book_backend_is_writable (E_BOOK_BACKEND (bl))) {
+			if (e_book_backend_is_readonly (E_BOOK_BACKEND (bl))) {
 				g_warning ("subschema read returned nothing before successful auth");
 				bl->priv->evolutionPersonChecked = FALSE;
 			}
@@ -756,20 +768,20 @@ query_ldap_root_dse (EBookBackendLDAP *bl)
 	if (values) {
 		gchar *auth_method;
 		if (bl->priv->supported_auth_methods) {
-			g_list_foreach (bl->priv->supported_auth_methods, (GFunc)g_free, NULL);
-			g_list_free (bl->priv->supported_auth_methods);
+			g_slist_foreach (bl->priv->supported_auth_methods, (GFunc) g_free, NULL);
+			g_slist_free (bl->priv->supported_auth_methods);
 		}
 		bl->priv->supported_auth_methods = NULL;
 
 		auth_method = g_strdup_printf ("ldap/simple-binddn|%s", _("Using Distinguished Name (DN)"));
-		bl->priv->supported_auth_methods = g_list_append (bl->priv->supported_auth_methods, auth_method);
+		bl->priv->supported_auth_methods = g_slist_append (bl->priv->supported_auth_methods, auth_method);
 
 		auth_method = g_strdup_printf ("ldap/simple-email|%s", _("Using Email Address"));
-		bl->priv->supported_auth_methods = g_list_append (bl->priv->supported_auth_methods, auth_method);
+		bl->priv->supported_auth_methods = g_slist_append (bl->priv->supported_auth_methods, auth_method);
 
 		for (i = 0; values[i]; i++) {
 			auth_method = g_strdup_printf ("sasl/%s|%s", values[i], values[i]);
-			bl->priv->supported_auth_methods = g_list_append (bl->priv->supported_auth_methods, auth_method);
+			bl->priv->supported_auth_methods = g_slist_append (bl->priv->supported_auth_methods, auth_method);
 			if (enable_debug)
 				g_message ("supported SASL mechanism: %s", values[i]);
 		}
@@ -984,7 +996,7 @@ e_book_backend_ldap_connect (EBookBackendLDAP *bl)
 			}
 			return EDB_ERROR (SUCCESS);
 		} else if (ldap_error == LDAP_UNWILLING_TO_PERFORM) {
-			e_book_backend_notify_auth_required (E_BOOK_BACKEND (bl));
+			e_book_backend_notify_auth_required (E_BOOK_BACKEND (bl), NULL);
 			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
 			return EDB_ERROR (AUTHENTICATION_REQUIRED);
 		} else {
@@ -1564,6 +1576,7 @@ static void
 e_book_backend_ldap_create_contact (EBookBackend *backend,
 				    EDataBook    *book,
 				    guint32       opid,
+				    GCancellable *cancellable,
 				    const gchar   *vcard)
 {
 	LDAPCreateOp *create_op = g_new0 (LDAPCreateOp, 1);
@@ -1575,128 +1588,122 @@ e_book_backend_ldap_create_contact (EBookBackend *backend,
 	LDAPMod **ldap_mods;
 	gchar *new_uid;
 
-	switch (bl->priv->mode) {
-
-	case E_DATA_BOOK_MODE_LOCAL :
+	if (!bl->priv->is_online) {
 		e_data_book_respond_create (book, opid, EDB_ERROR (REPOSITORY_OFFLINE), NULL);
 		return;
-	case E_DATA_BOOK_MODE_REMOTE :
+	}
 
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
-		if (!bl->priv->ldap) {
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
-			e_data_book_respond_create (book, opid, EDB_ERROR_NOT_CONNECTED (), NULL);
-			return;
-		}
+	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	if (!bl->priv->ldap) {
 		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		e_data_book_respond_create (book, opid, EDB_ERROR_NOT_CONNECTED (), NULL);
+		return;
+	}
+	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
 
-		book_view = find_book_view (bl);
+	book_view = find_book_view (bl);
 
-		if (enable_debug)
-			printf ("Create Contact: vcard = %s\n", vcard);
+	if (enable_debug)
+		printf ("Create Contact: vcard = %s\n", vcard);
 
-		create_op->new_contact = e_contact_new_from_vcard (vcard);
+	create_op->new_contact = e_contact_new_from_vcard (vcard);
 
-		new_uid = create_dn_from_contact (create_op->new_contact, bl->priv->ldap_rootdn);
-		create_op->dn = create_full_dn_from_contact (new_uid, bl->priv->ldap_rootdn);
+	new_uid = create_dn_from_contact (create_op->new_contact, bl->priv->ldap_rootdn);
+	create_op->dn = create_full_dn_from_contact (new_uid, bl->priv->ldap_rootdn);
 
-		e_contact_set (create_op->new_contact, E_CONTACT_UID, create_op->dn);
+	e_contact_set (create_op->new_contact, E_CONTACT_UID, create_op->dn);
 
-		/* build our mods */
-		mod_array = build_mods_from_contacts (bl, NULL, create_op->new_contact, NULL, new_uid);
-		g_free (new_uid);
+	/* build our mods */
+	mod_array = build_mods_from_contacts (bl, NULL, create_op->new_contact, NULL, new_uid);
+	g_free (new_uid);
 
 #if 0
-		if (!mod_array) {
-			/* there's an illegal field in there.  report
-			   UnsupportedAttribute back */
-			e_data_book_respond_create (book,
-						    EDB_ERROR (UNSUPPORTED_FIELD),
-						    NULL);
+	if (!mod_array) {
+		/* there's an illegal field in there.  report
+		   UnsupportedAttribute back */
+		e_data_book_respond_create (book,
+					    EDB_ERROR (UNSUPPORTED_FIELD),
+					    NULL);
 
-			g_free (create_op->dn);
-			g_object_unref (create_op->new_contact);
-			g_free (create_op);
-			return;
-		}
+		g_free (create_op->dn);
+		g_object_unref (create_op->new_contact);
+		g_free (create_op);
+		return;
+	}
 #endif
 
-		/* remove the NULL at the end */
-		g_ptr_array_remove (mod_array, NULL);
+	/* remove the NULL at the end */
+	g_ptr_array_remove (mod_array, NULL);
 
-		/* add our objectclass(es) */
-		if (e_contact_get (create_op->new_contact, E_CONTACT_IS_LIST))
-			add_objectclass_mod (bl, mod_array, NULL, TRUE, FALSE);
-		else
-			add_objectclass_mod (bl, mod_array, NULL, FALSE, FALSE);
+	/* add our objectclass(es) */
+	if (e_contact_get (create_op->new_contact, E_CONTACT_IS_LIST))
+		add_objectclass_mod (bl, mod_array, NULL, TRUE, FALSE);
+	else
+		add_objectclass_mod (bl, mod_array, NULL, FALSE, FALSE);
 
-		/* then put the NULL back */
-		g_ptr_array_add (mod_array, NULL);
+	/* then put the NULL back */
+	g_ptr_array_add (mod_array, NULL);
 
 #ifdef LDAP_DEBUG_ADD
-		if (enable_debug) {
-			gint i;
-			printf ("Sending the following to the server as ADD\n");
-			printf ("Adding DN: %s\n", create_op->dn);
-
-			for (i = 0; g_ptr_array_index (mod_array, i); i++) {
-				LDAPMod *mod = g_ptr_array_index (mod_array, i);
-				if (mod->mod_op & LDAP_MOD_DELETE)
-					printf ("del ");
-				else if (mod->mod_op & LDAP_MOD_REPLACE)
-					printf ("rep ");
-				else
-					printf ("add ");
-				if (mod->mod_op & LDAP_MOD_BVALUES)
-					printf ("ber ");
-				else
-					printf ("    ");
+	if (enable_debug) {
+		gint i;
+		printf ("Sending the following to the server as ADD\n");
+		printf ("Adding DN: %s\n", create_op->dn);
+
+		for (i = 0; g_ptr_array_index (mod_array, i); i++) {
+			LDAPMod *mod = g_ptr_array_index (mod_array, i);
+			if (mod->mod_op & LDAP_MOD_DELETE)
+				printf ("del ");
+			else if (mod->mod_op & LDAP_MOD_REPLACE)
+				printf ("rep ");
+			else
+				printf ("add ");
+			if (mod->mod_op & LDAP_MOD_BVALUES)
+				printf ("ber ");
+			else
+				printf ("    ");
 
-				printf (" %s:\n", mod->mod_type);
+			printf (" %s:\n", mod->mod_type);
 
-				if (mod->mod_op & LDAP_MOD_BVALUES) {
-					gint j;
-					for (j = 0; mod->mod_bvalues[j] && mod->mod_bvalues[j]->bv_val; j++)
-						printf ("\t\t'%s'\n", mod->mod_bvalues[j]->bv_val);
-				}
-				else {
-					gint j;
+			if (mod->mod_op & LDAP_MOD_BVALUES) {
+				gint j;
+				for (j = 0; mod->mod_bvalues[j] && mod->mod_bvalues[j]->bv_val; j++)
+					printf ("\t\t'%s'\n", mod->mod_bvalues[j]->bv_val);
+			} else {
+				gint j;
 
-					for (j = 0; mod->mod_values[j]; j++)
-						printf ("\t\t'%s'\n", mod->mod_values[j]);
-				}
+				for (j = 0; mod->mod_values[j]; j++)
+					printf ("\t\t'%s'\n", mod->mod_values[j]);
 			}
 		}
+	}
 #endif
 
-		ldap_mods = (LDAPMod**)mod_array->pdata;
+	ldap_mods = (LDAPMod**)mod_array->pdata;
 
-		do {
-			book_view_notify_status (bl, book_view, _("Adding contact to LDAP server..."));
-			g_static_rec_mutex_lock (&eds_ldap_handler_lock);
-			err = ldap_add_ext (bl->priv->ldap, create_op->dn, ldap_mods,
-					    NULL, NULL, &create_contact_msgid);
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
-
-		} while (e_book_backend_ldap_reconnect (bl, book_view, err));
+	do {
+		book_view_notify_status (bl, book_view, _("Adding contact to LDAP server..."));
+		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		err = ldap_add_ext (bl->priv->ldap, create_op->dn, ldap_mods,
+				    NULL, NULL, &create_contact_msgid);
+		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	} while (e_book_backend_ldap_reconnect (bl, book_view, err));
 
-		/* and clean up */
-		free_mods (mod_array);
+	/* and clean up */
+	free_mods (mod_array);
 
-		if (LDAP_SUCCESS != err) {
-			e_data_book_respond_create (create_op->op.book,
-						    opid,
-						    ldap_error_to_response (err),
-						    NULL);
-			create_contact_dtor ((LDAPOp*)create_op);
-			return;
-		}
-		else {
-			g_print ("ldap_add_ext returned %d\n", err);
-			ldap_op_add ((LDAPOp*)create_op, backend, book,
-				     book_view, opid, create_contact_msgid,
-				     create_contact_handler, create_contact_dtor);
-		}
+	if (LDAP_SUCCESS != err) {
+		e_data_book_respond_create (create_op->op.book,
+					    opid,
+					    ldap_error_to_response (err),
+					    NULL);
+		create_contact_dtor ((LDAPOp*)create_op);
+		return;
+	} else {
+		g_print ("ldap_add_ext returned %d\n", err);
+		ldap_op_add ((LDAPOp*)create_op, backend, book,
+			     book_view, opid, create_contact_msgid,
+			     create_contact_handler, create_contact_dtor);
 	}
 }
 
@@ -1712,7 +1719,7 @@ remove_contact_handler (LDAPOp *op, LDAPMessage *res)
 	EBookBackendLDAP *bl = E_BOOK_BACKEND_LDAP (op->backend);
 	gchar *ldap_error_msg;
 	gint ldap_error;
-	GList *ids = NULL;
+	GSList *ids = NULL;
 
 	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
 	if (!bl->priv->ldap) {
@@ -1748,12 +1755,12 @@ remove_contact_handler (LDAPOp *op, LDAPMessage *res)
 
 	ldap_memfree (ldap_error_msg);
 
-	ids = g_list_append (ids, remove_op->id);
+	ids = g_slist_append (ids, remove_op->id);
 	e_data_book_respond_remove_contacts (remove_op->op.book,
 					     op->opid,
 					     ldap_error_to_response (ldap_error),
 					     ldap_error == LDAP_SUCCESS ? ids : NULL);
-	g_list_free (ids);
+	g_slist_free (ids);
 	ldap_op_finished (op);
 }
 
@@ -1770,7 +1777,8 @@ static void
 e_book_backend_ldap_remove_contacts (EBookBackend *backend,
 				     EDataBook    *book,
 				     guint32       opid,
-				     GList        *ids)
+				     GCancellable *cancellable,
+				     const GSList *ids)
 {
 	LDAPRemoveOp *remove_op = g_new (LDAPRemoveOp, 1);
 	EBookBackendLDAP *bl = E_BOOK_BACKEND_LDAP (backend);
@@ -1778,59 +1786,54 @@ e_book_backend_ldap_remove_contacts (EBookBackend *backend,
 	gint remove_msgid;
 	gint ldap_error;
 
-	switch (bl->priv->mode) {
-
-	case E_DATA_BOOK_MODE_LOCAL :
+	if (!bl->priv->is_online) {
 		e_data_book_respond_remove_contacts (book, opid, EDB_ERROR (REPOSITORY_OFFLINE), NULL);
 		g_free (remove_op);
 		return;
-	case E_DATA_BOOK_MODE_REMOTE :
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
-		if (!bl->priv->ldap) {
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
-			e_data_book_respond_remove_contacts (book, opid, EDB_ERROR_NOT_CONNECTED (), NULL);
-			g_free (remove_op);
-			return;
-		}
+	}
+
+	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	if (!bl->priv->ldap) {
 		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		e_data_book_respond_remove_contacts (book, opid, EDB_ERROR_NOT_CONNECTED (), NULL);
+		g_free (remove_op);
+		return;
+	}
+	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
 
-		book_view = find_book_view (bl);
+	book_view = find_book_view (bl);
 
-		/*
-		** since we didn't pass "bulk-removes" in our static
-		** capabilities, we should only get 1 length lists here, so
-		** the id we're deleting is the first and only id in the list.
-		*/
-		remove_op->id = g_strdup (ids->data);
+	/*
+	** since we didn't pass "bulk-removes" in our static
+	** capabilities, we should only get 1 length lists here, so
+	** the id we're deleting is the first and only id in the list.
+	*/
+	remove_op->id = g_strdup (ids->data);
 
-		do {
-			book_view_notify_status (bl, book_view, _("Removing contact from LDAP server..."));
+	do {
+		book_view_notify_status (bl, book_view, _("Removing contact from LDAP server..."));
 
-			g_static_rec_mutex_lock (&eds_ldap_handler_lock);
-			ldap_error = ldap_delete_ext (bl->priv->ldap,
-						      remove_op->id,
-						      NULL, NULL, &remove_msgid);
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
-		} while (e_book_backend_ldap_reconnect (bl, book_view, ldap_error));
+		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		ldap_error = ldap_delete_ext (bl->priv->ldap,
+					      remove_op->id,
+					      NULL, NULL, &remove_msgid);
+		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	} while (e_book_backend_ldap_reconnect (bl, book_view, ldap_error));
 
-		if (ldap_error != LDAP_SUCCESS) {
-			e_data_book_respond_remove_contacts (remove_op->op.book,
-							     opid,
-							     ldap_error_to_response (ldap_error),
-							     NULL);
-			ldap_op_finished ((LDAPOp*)remove_op);
-			remove_contact_dtor ((LDAPOp*)remove_op);
-			return;
-		}
-		else {
-			g_print ("ldap_delete_ext returned %d\n", ldap_error);
-			ldap_op_add ((LDAPOp*)remove_op, backend, book,
-				     book_view, opid, remove_msgid,
-				     remove_contact_handler, remove_contact_dtor);
-		}
-		break;
+	if (ldap_error != LDAP_SUCCESS) {
+		e_data_book_respond_remove_contacts (remove_op->op.book,
+						     opid,
+						     ldap_error_to_response (ldap_error),
+						     NULL);
+		ldap_op_finished ((LDAPOp*)remove_op);
+		remove_contact_dtor ((LDAPOp*)remove_op);
+		return;
+	} else {
+		g_print ("ldap_delete_ext returned %d\n", ldap_error);
+		ldap_op_add ((LDAPOp*)remove_op, backend, book,
+			     book_view, opid, remove_msgid,
+			     remove_contact_handler, remove_contact_dtor);
 	}
-
 }
 
 /*
@@ -2209,6 +2212,7 @@ static void
 e_book_backend_ldap_modify_contact (EBookBackend *backend,
 				    EDataBook    *book,
 				    guint32       opid,
+				    GCancellable *cancellable,
 				    const gchar   *vcard)
 {
 	LDAPModifyOp *modify_op = g_new0 (LDAPModifyOp, 1);
@@ -2217,54 +2221,50 @@ e_book_backend_ldap_modify_contact (EBookBackend *backend,
 	gint modify_contact_msgid;
 	EDataBookView *book_view;
 
-	switch (bl->priv->mode) {
-
-	case E_DATA_BOOK_MODE_LOCAL :
+	if (!bl->priv->is_online) {
 		e_data_book_respond_modify (book, opid, EDB_ERROR (REPOSITORY_OFFLINE), NULL);
 		return;
-	case E_DATA_BOOK_MODE_REMOTE :
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
-		if (!bl->priv->ldap) {
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
-			e_data_book_respond_modify (book, opid, EDB_ERROR_NOT_CONNECTED (), NULL);
-			g_free (modify_op);
-			return;
-		}
-		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	}
 
-		book_view = find_book_view (bl);
+	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	if (!bl->priv->ldap) {
+		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		e_data_book_respond_modify (book, opid, EDB_ERROR_NOT_CONNECTED (), NULL);
+		g_free (modify_op);
+		return;
+	}
+	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
 
-		if (enable_debug)
-			printf ("Modify Contact: vcard = %s\n", vcard);
-		modify_op->contact = e_contact_new_from_vcard (vcard);
-		modify_op->id = e_contact_get_const (modify_op->contact, E_CONTACT_UID);
+	book_view = find_book_view (bl);
 
-		do {
-			book_view_notify_status (bl, book_view, _("Modifying contact from LDAP server..."));
+	if (enable_debug)
+		printf ("Modify Contact: vcard = %s\n", vcard);
+	modify_op->contact = e_contact_new_from_vcard (vcard);
+	modify_op->id = e_contact_get_const (modify_op->contact, E_CONTACT_UID);
 
-			g_static_rec_mutex_lock (&eds_ldap_handler_lock);
-			ldap_error = ldap_search_ext (bl->priv->ldap, modify_op->id,
-						      LDAP_SCOPE_BASE,
-						      "(objectclass=*)",
-						      NULL, 0, NULL, NULL,
-						      NULL, /* XXX timeout */
-						      1, &modify_contact_msgid);
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	do {
+		book_view_notify_status (bl, book_view, _("Modifying contact from LDAP server..."));
 
-		} while (e_book_backend_ldap_reconnect (bl, book_view, ldap_error));
+		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		ldap_error = ldap_search_ext (bl->priv->ldap, modify_op->id,
+					      LDAP_SCOPE_BASE,
+					      "(objectclass=*)",
+					      NULL, 0, NULL, NULL,
+					      NULL, /* XXX timeout */
+					      1, &modify_contact_msgid);
+		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	} while (e_book_backend_ldap_reconnect (bl, book_view, ldap_error));
 
-		if (ldap_error == LDAP_SUCCESS) {
-			ldap_op_add ((LDAPOp*)modify_op, backend, book,
-				     book_view, opid, modify_contact_msgid,
-				     modify_contact_search_handler, modify_contact_dtor);
-		}
-		else {
-			e_data_book_respond_modify (book,
-						    opid,
-						    ldap_error_to_response (ldap_error),
-						    NULL);
-			modify_contact_dtor ((LDAPOp*)modify_op);
-		}
+	if (ldap_error == LDAP_SUCCESS) {
+		ldap_op_add ((LDAPOp*)modify_op, backend, book,
+			     book_view, opid, modify_contact_msgid,
+			     modify_contact_search_handler, modify_contact_dtor);
+	} else {
+		e_data_book_respond_modify (book,
+					    opid,
+					    ldap_error_to_response (ldap_error),
+					    NULL);
+		modify_contact_dtor ((LDAPOp*)modify_op);
 	}
 }
 
@@ -2381,6 +2381,7 @@ static void
 e_book_backend_ldap_get_contact (EBookBackend *backend,
 				 EDataBook    *book,
 				 guint32       opid,
+				 GCancellable *cancellable,
 				 const gchar   *id)
 {
 	LDAPGetContactOp *get_contact_op;
@@ -2391,9 +2392,7 @@ e_book_backend_ldap_get_contact (EBookBackend *backend,
 	GTimeVal start, end;
 	gulong diff;
 
-	switch (bl->priv->mode) {
-
-	case E_DATA_BOOK_MODE_LOCAL :
+	if (!bl->priv->is_online) {
 		if (bl->priv->marked_for_offline && bl->priv->cache) {
 			EContact *contact = e_book_backend_cache_get_contact (bl->priv->cache, id);
 			gchar *vcard_str;
@@ -2416,65 +2415,61 @@ e_book_backend_ldap_get_contact (EBookBackend *backend,
 
 		e_data_book_respond_get_contact(book, opid, EDB_ERROR (REPOSITORY_OFFLINE), "");
 		return;
+	}
 
-	case E_DATA_BOOK_MODE_REMOTE :
-
-		if (enable_debug) {
-			printf("e_book_backend_ldap_get_contact ... \n");
-			g_get_current_time (&start);
-		}
+	if (enable_debug) {
+		printf("e_book_backend_ldap_get_contact ... \n");
+		g_get_current_time (&start);
+	}
 
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
-		if (!bl->priv->ldap) {
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
-			e_data_book_respond_get_contact (book, opid, EDB_ERROR_NOT_CONNECTED (), "");
-			if (enable_debug)
-				printf("e_book_backend_ldap_get_contact ... ldap handler is NULL\n");
-			return;
-		}
+	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	if (!bl->priv->ldap) {
 		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		e_data_book_respond_get_contact (book, opid, EDB_ERROR_NOT_CONNECTED (), "");
+		if (enable_debug)
+			printf("e_book_backend_ldap_get_contact ... ldap handler is NULL\n");
+		return;
+	}
+	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
 
-		get_contact_op = g_new0 (LDAPGetContactOp, 1);
-		book_view = find_book_view (bl);
+	get_contact_op = g_new0 (LDAPGetContactOp, 1);
+	book_view = find_book_view (bl);
 
-		do {
-			g_static_rec_mutex_lock (&eds_ldap_handler_lock);
-			ldap_error = ldap_search_ext (bl->priv->ldap, id,
-						      LDAP_SCOPE_BASE,
-						      "(objectclass=*)",
-						      NULL, 0, NULL, NULL,
-						      NULL, /* XXX timeout */
-						      1, &get_contact_msgid);
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
-		} while (e_book_backend_ldap_reconnect (bl, book_view, ldap_error));
+	do {
+		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		ldap_error = ldap_search_ext (bl->priv->ldap, id,
+					      LDAP_SCOPE_BASE,
+					      "(objectclass=*)",
+					      NULL, 0, NULL, NULL,
+					      NULL, /* XXX timeout */
+					      1, &get_contact_msgid);
+		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	} while (e_book_backend_ldap_reconnect (bl, book_view, ldap_error));
 
-		if (ldap_error == LDAP_SUCCESS) {
-			ldap_op_add ((LDAPOp*)get_contact_op, backend, book,
-				     book_view, opid, get_contact_msgid,
-				     get_contact_handler, get_contact_dtor);
+	if (ldap_error == LDAP_SUCCESS) {
+		ldap_op_add ((LDAPOp*)get_contact_op, backend, book,
+			     book_view, opid, get_contact_msgid,
+			     get_contact_handler, get_contact_dtor);
 
-			if (enable_debug) {
-				printf("e_book_backend_ldap_get_contact invoked get_contact_handler\n");
-				g_get_current_time (&end);
-				diff = end.tv_sec * 1000 + end.tv_usec/1000;
-				diff -= start.tv_sec * 1000 + start.tv_usec/1000;
-				printf("and took %ld.%03ld seconds\n",
-							diff/1000, diff%1000);
-			}
-		}
-		else {
-			e_data_book_respond_get_contact (book,
-							 opid,
-							 ldap_error_to_response (ldap_error),
-							 "");
-			get_contact_dtor ((LDAPOp*)get_contact_op);
+		if (enable_debug) {
+			printf ("e_book_backend_ldap_get_contact invoked get_contact_handler\n");
+			g_get_current_time (&end);
+			diff = end.tv_sec * 1000 + end.tv_usec/1000;
+			diff -= start.tv_sec * 1000 + start.tv_usec/1000;
+			printf ("and took %ld.%03ld seconds\n", diff/1000, diff%1000);
 		}
+	} else {
+		e_data_book_respond_get_contact (book,
+						 opid,
+						 ldap_error_to_response (ldap_error),
+						 "");
+		get_contact_dtor ((LDAPOp*)get_contact_op);
 	}
 }
 
 typedef struct {
 	LDAPOp op;
-	GList *contacts;
+	GSList *contacts;
 } LDAPGetContactListOp;
 
 static void
@@ -2520,8 +2515,7 @@ contact_list_handler (LDAPOp *op, LDAPMessage *res)
 			if (enable_debug)
 				printf ("vcard = %s\n", vcard);
 
-			contact_list_op->contacts = g_list_append (contact_list_op->contacts,
-								   vcard);
+			contact_list_op->contacts = g_slist_append (contact_list_op->contacts, vcard);
 
 			g_object_unref (contact);
 
@@ -2593,6 +2587,9 @@ contact_list_dtor (LDAPOp *op)
 {
 	LDAPGetContactListOp *contact_list_op = (LDAPGetContactListOp*)op;
 
+	g_slist_foreach (contact_list_op->contacts, (GFunc) g_free, NULL);
+	g_slist_free (contact_list_op->contacts);
+
 	g_free (contact_list_op);
 }
 
@@ -2600,6 +2597,7 @@ static void
 e_book_backend_ldap_get_contact_list (EBookBackend *backend,
 				      EDataBook    *book,
 				      guint32       opid,
+				      GCancellable *cancellable,
 				      const gchar   *query)
 {
 	LDAPGetContactListOp *contact_list_op;
@@ -2616,85 +2614,83 @@ e_book_backend_ldap_get_contact_list (EBookBackend *backend,
 		g_get_current_time (&start);
 	}
 
-	switch (bl->priv->mode) {
-
-	case E_DATA_BOOK_MODE_LOCAL :
+	if (!bl->priv->is_online) {
 		if (bl->priv->marked_for_offline && bl->priv->cache) {
 			GList *contacts;
-			GList *vcard_strings = NULL;
+			GSList *vcard_strings = NULL;
 			GList *l;
 
 			contacts = e_book_backend_cache_get_contacts (bl->priv->cache, query);
 
 			for (l = contacts; l; l = g_list_next (l)) {
 				EContact *contact = l->data;
-				vcard_strings = g_list_prepend (vcard_strings, e_vcard_to_string (E_VCARD (contact),
-								EVC_FORMAT_VCARD_30));
+				vcard_strings = g_slist_prepend (vcard_strings, e_vcard_to_string (E_VCARD (contact),
+								 EVC_FORMAT_VCARD_30));
 				g_object_unref (contact);
 			}
 
 			g_list_free (contacts);
 			e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (SUCCESS), vcard_strings);
+			g_slist_foreach (vcard_strings, (GFunc) g_free, NULL);
+			g_slist_free (vcard_strings);
 			return;
 		}
 
 		e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (REPOSITORY_OFFLINE), NULL);
 		return;
+	}
 
-	case E_DATA_BOOK_MODE_REMOTE:
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
-		if (!bl->priv->ldap) {
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
-			e_data_book_respond_get_contact_list (book, opid, EDB_ERROR_NOT_CONNECTED (), NULL);
-			if (enable_debug)
-				printf ("e_book_backend_ldap_get_contact_list... ldap handler is NULL\n");
-			return;
-		}
+	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	if (!bl->priv->ldap) {
 		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		e_data_book_respond_get_contact_list (book, opid, EDB_ERROR_NOT_CONNECTED (), NULL);
+		if (enable_debug)
+			printf ("e_book_backend_ldap_get_contact_list... ldap handler is NULL\n");
+		return;
+	}
+	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
 
-		contact_list_op = g_new0 (LDAPGetContactListOp, 1);
-		book_view = find_book_view (bl);
+	contact_list_op = g_new0 (LDAPGetContactListOp, 1);
+	book_view = find_book_view (bl);
 
-		ldap_query = e_book_backend_ldap_build_query (bl, query);
+	ldap_query = e_book_backend_ldap_build_query (bl, query);
 
-		if (enable_debug)
-			printf ("getting contact list with filter: %s\n", ldap_query);
+	if (enable_debug)
+		printf ("getting contact list with filter: %s\n", ldap_query);
 
-		do {
-			g_static_rec_mutex_lock (&eds_ldap_handler_lock);
-			ldap_error = ldap_search_ext (bl->priv->ldap,
-						      bl->priv->ldap_rootdn,
-						      bl->priv->ldap_scope,
-						      ldap_query,
-						      NULL, 0, NULL, NULL,
-						      NULL, /* XXX timeout */
-						      LDAP_NO_LIMIT, &contact_list_msgid);
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
-		} while (e_book_backend_ldap_reconnect (bl, book_view, ldap_error));
+	do {
+		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		ldap_error = ldap_search_ext (bl->priv->ldap,
+					      bl->priv->ldap_rootdn,
+					      bl->priv->ldap_scope,
+					      ldap_query,
+					      NULL, 0, NULL, NULL,
+					      NULL, /* XXX timeout */
+					      LDAP_NO_LIMIT, &contact_list_msgid);
+		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	} while (e_book_backend_ldap_reconnect (bl, book_view, ldap_error));
 
-		g_free (ldap_query);
+	g_free (ldap_query);
 
-		if (ldap_error == LDAP_SUCCESS) {
-			ldap_op_add ((LDAPOp*)contact_list_op, backend, book,
-				     book_view, opid, contact_list_msgid,
-				     contact_list_handler, contact_list_dtor);
-			if (enable_debug) {
-				g_get_current_time (&end);
+	if (ldap_error == LDAP_SUCCESS) {
+		ldap_op_add ((LDAPOp*)contact_list_op, backend, book,
+			     book_view, opid, contact_list_msgid,
+			     contact_list_handler, contact_list_dtor);
+		if (enable_debug) {
+			g_get_current_time (&end);
 
-				diff = end.tv_sec * 1000 + end.tv_usec/1000;
-				diff -= start.tv_sec * 1000 + start.tv_usec/1000;
+			diff = end.tv_sec * 1000 + end.tv_usec/1000;
+			diff -= start.tv_sec * 1000 + start.tv_usec/1000;
 
-				printf ("e_book_backend_ldap_get_contact_list invoked contact_list_handler ");
-				printf ("and took %ld.%03ld seconds\n", diff/1000, diff%1000);
-			}
-		}
-		else {
-			e_data_book_respond_get_contact_list (book,
-							      opid,
-							      ldap_error_to_response (ldap_error),
-							      NULL);
-			contact_list_dtor ((LDAPOp*)contact_list_op);
+			printf ("e_book_backend_ldap_get_contact_list invoked contact_list_handler ");
+			printf ("and took %ld.%03ld seconds\n", diff/1000, diff%1000);
 		}
+	} else {
+		e_data_book_respond_get_contact_list (book,
+						      opid,
+						      ldap_error_to_response (ldap_error),
+						      NULL);
+		contact_list_dtor ((LDAPOp*)contact_list_op);
 	}
 }
 
@@ -4172,8 +4168,6 @@ build_contact_from_entry (EBookBackendLDAP *bl,
 							/* get the e-mail id for each member and add them to the list */
 
 							book_view = find_book_view (bl);
-							if (book_view)
-								view_limit = e_data_book_view_get_max_results (book_view);
 							if (view_limit == -1 || view_limit > bl->priv->ldap_limit)
 								view_limit = bl->priv->ldap_limit;
 
@@ -4457,8 +4451,7 @@ e_book_backend_ldap_search (EBookBackendLDAP *bl,
 		g_get_current_time (&start);
 	}
 
-	switch (bl->priv->mode) {
-	case E_DATA_BOOK_MODE_LOCAL :
+	if (!bl->priv->is_online) {
 		if (!(bl->priv->marked_for_offline && bl->priv->cache)) {
 			GError *edb_err = EDB_ERROR (REPOSITORY_OFFLINE);
 			e_data_book_view_notify_complete (view, edb_err);
@@ -4479,86 +4472,81 @@ e_book_backend_ldap_search (EBookBackendLDAP *bl,
 
 		e_data_book_view_notify_complete (view, NULL /* Success */);
 		return;
+	}
 
-	case E_DATA_BOOK_MODE_REMOTE :
-		ldap_query = e_book_backend_ldap_build_query (bl, e_data_book_view_get_card_query (view));
-
-		/* search for nonempty full names */
-		if (!ldap_query && can_browse ((EBookBackend *)bl))
-			ldap_query = g_strdup ("(cn=*)");
+	ldap_query = e_book_backend_ldap_build_query (bl, e_data_book_view_get_card_query (view));
 
-		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
-		if (ldap_query != NULL && bl->priv->ldap) {
-			gint ldap_err;
-			gint search_msgid;
-			gint view_limit;
+	/* search for nonempty full names */
+	if (!ldap_query && can_browse ((EBookBackend *)bl))
+		ldap_query = g_strdup ("(cn=*)");
 
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+	if (ldap_query != NULL && bl->priv->ldap) {
+		gint ldap_err;
+		gint search_msgid;
+		gint view_limit;
 
-			view_limit = e_data_book_view_get_max_results (view);
-			if (view_limit == -1 || view_limit > bl->priv->ldap_limit)
-				view_limit = bl->priv->ldap_limit;
+		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
 
-			if (enable_debug)
-				printf ("searching server using filter: %s (expecting max %d results)\n", ldap_query, view_limit);
+		view_limit = -1;
+		if (view_limit == -1 || view_limit > bl->priv->ldap_limit)
+			view_limit = bl->priv->ldap_limit;
 
-			do {
-				book_view_notify_status (bl, view, _("Searching..."));
+		if (enable_debug)
+			printf ("searching server using filter: %s (expecting max %d results)\n", ldap_query, view_limit);
 
-				g_static_rec_mutex_lock (&eds_ldap_handler_lock);
-				ldap_err = ldap_search_ext (bl->priv->ldap, bl->priv->ldap_rootdn,
-							    bl->priv->ldap_scope,
-							    ldap_query,
-							    NULL, 0,
-							    NULL, /* XXX */
-							    NULL, /* XXX */
-							    NULL, /* XXX timeout */
-							    view_limit, &search_msgid);
-				g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
-			} while (e_book_backend_ldap_reconnect (bl, view, ldap_err));
+		do {
+			book_view_notify_status (bl, view, _("Searching..."));
 
-			g_free (ldap_query);
+			g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+			ldap_err = ldap_search_ext (bl->priv->ldap, bl->priv->ldap_rootdn,
+						    bl->priv->ldap_scope,
+						    ldap_query,
+						    NULL, 0,
+						    NULL, /* XXX */
+						    NULL, /* XXX */
+						    NULL, /* XXX timeout */
+						    view_limit, &search_msgid);
+			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		} while (e_book_backend_ldap_reconnect (bl, view, ldap_err));
 
-			if (ldap_err != LDAP_SUCCESS) {
-				book_view_notify_status (bl, view, ldap_err2string (ldap_err));
-				return;
-			}
-			else if (search_msgid == -1) {
-				book_view_notify_status (bl, view,
-							 _("Error performing search"));
-				return;
-			}
-			else {
-				LDAPSearchOp *op = g_new0 (LDAPSearchOp, 1);
+		g_free (ldap_query);
 
-				d(printf ("adding search_op (%p, %d)\n", view, search_msgid));
+		if (ldap_err != LDAP_SUCCESS) {
+			book_view_notify_status (bl, view, ldap_err2string (ldap_err));
+			return;
+		} else if (search_msgid == -1) {
+			book_view_notify_status (bl, view, _("Error performing search"));
+			return;
+		} else {
+			LDAPSearchOp *op = g_new0 (LDAPSearchOp, 1);
 
-				op->view = view;
-				op->aborted = FALSE;
-				e_data_book_view_ref (view);
+			d(printf ("adding search_op (%p, %d)\n", view, search_msgid));
 
-				ldap_op_add ((LDAPOp*)op, E_BOOK_BACKEND (bl), book, view,
-					     0, search_msgid,
-					     ldap_search_handler, ldap_search_dtor);
+			op->view = view;
+			op->aborted = FALSE;
+			e_data_book_view_ref (view);
 
-				if (enable_debug) {
-					printf ("e_book_backend_ldap_search invoked ldap_search_handler ");
-					g_get_current_time (&end);
-					diff = end.tv_sec * 1000 + end.tv_usec/1000;
-					diff -= start.tv_sec * 1000 + start.tv_usec/1000;
-					printf("and took  %ld.%03ld seconds\n", diff/1000,diff%1000);
-				}
+			ldap_op_add ((LDAPOp*)op, E_BOOK_BACKEND (bl), book, view,
+				     0, search_msgid,
+				     ldap_search_handler, ldap_search_dtor);
 
-				g_object_set_data (G_OBJECT (view), "EBookBackendLDAP.BookView::search_op", op);
+			if (enable_debug) {
+				printf ("e_book_backend_ldap_search invoked ldap_search_handler ");
+				g_get_current_time (&end);
+				diff = end.tv_sec * 1000 + end.tv_usec/1000;
+				diff -= start.tv_sec * 1000 + start.tv_usec/1000;
+				printf("and took  %ld.%03ld seconds\n", diff/1000,diff%1000);
 			}
-			return;
-		}
-		else {
-			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
-			/* Ignore NULL query */
-			e_data_book_view_notify_complete (view, NULL /* Success */);
-			return;
+
+			g_object_set_data (G_OBJECT (view), "EBookBackendLDAP.BookView::search_op", op);
 		}
+		return;
+	} else {
+		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
+		/* Ignore NULL query */
+		e_data_book_view_notify_complete (view, NULL /* Success */);
+		return;
 	}
 }
 
@@ -4570,11 +4558,6 @@ e_book_backend_ldap_start_book_view (EBookBackend  *backend,
 
 	d(printf ("start_book_view (%p)\n", view));
 
-	/* we start at 1 so the user sees stuff as it appears and we
-	   aren't left waiting for more cards to show up, if the
-	   connection is slow. */
-	e_data_book_view_set_thresholds (view, 1, 3000);
-
 	e_book_backend_ldap_search (bl, NULL /* XXX ugh */, view);
 }
 
@@ -4594,15 +4577,6 @@ e_book_backend_ldap_stop_book_view (EBookBackend  *backend,
 	}
 }
 
-static void
-e_book_backend_ldap_get_changes (EBookBackend *backend,
-				 EDataBook    *book,
-				 guint32       opid,
-				 const gchar   *change_id)
-{
-	/* FIXME: implement */
-}
-
 #define LDAP_SIMPLE_PREFIX "ldap/simple-"
 #define SASL_PREFIX "sasl/"
 
@@ -4643,21 +4617,21 @@ generate_cache_handler (LDAPOp *op, LDAPMessage *res)
 		while (e != NULL) {
 			EContact *contact = build_contact_from_entry (bl, e, NULL, NULL);
 
-			contact_list_op->contacts = g_list_prepend (contact_list_op->contacts, contact);
+			contact_list_op->contacts = g_slist_prepend (contact_list_op->contacts, contact);
 
 			g_static_rec_mutex_lock (&eds_ldap_handler_lock);
 			e = ldap_next_entry (bl->priv->ldap, e);
 			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
 		}
 	} else {
-		GList *l;
+		GSList *l;
 		gint contact_num = 0;
 		gchar *status_msg;
 
 		e_file_cache_clean (E_FILE_CACHE (bl->priv->cache));
 
 		e_file_cache_freeze_changes (E_FILE_CACHE (bl->priv->cache));
-		for (l = contact_list_op->contacts; l; l = g_list_next (l)) {
+		for (l = contact_list_op->contacts; l; l = g_slist_next (l)) {
 			EContact *contact = l->data;
 
 			contact_num++;
@@ -4688,13 +4662,13 @@ static void
 generate_cache_dtor (LDAPOp *op)
 {
 	LDAPGetContactListOp *contact_list_op = (LDAPGetContactListOp *) op;
-	GList *l;
+	GSList *l;
 
-	for (l = contact_list_op->contacts; l; l = g_list_next (l)) {
+	for (l = contact_list_op->contacts; l; l = g_slist_next (l)) {
 		g_object_unref (l->data);
 	}
 
-	g_list_free (contact_list_op->contacts);
+	g_slist_free (contact_list_op->contacts);
 	g_free (contact_list_op);
 }
 
@@ -4757,21 +4731,22 @@ static void
 e_book_backend_ldap_authenticate_user (EBookBackend *backend,
 				       EDataBook    *book,
 				       guint32       opid,
-				       const gchar   *user,
-				       const gchar   *passwd,
-				       const gchar   *auth_method)
+				       GCancellable *cancellable,
+				       ECredentials *credentials)
 {
 	EBookBackendLDAP *bl = E_BOOK_BACKEND_LDAP (backend);
 	gint ldap_error;
 	gchar *dn = NULL;
+	const gchar *auth_method = e_credentials_peek (credentials, E_CREDENTIALS_KEY_AUTH_METHOD);
+	const gchar *user = e_credentials_peek (credentials, E_CREDENTIALS_KEY_USERNAME);
 
 	if (enable_debug)
 		printf ("e_book_backend_ldap_authenticate_user ... \n");
 
 	g_static_rec_mutex_lock (&eds_ldap_handler_lock);
-	if (bl->priv->mode == E_DATA_BOOK_MODE_LOCAL) {
-		e_book_backend_notify_writable (backend, FALSE);
-		e_book_backend_notify_connection_status (backend, FALSE);
+	if (!bl->priv->is_online) {
+		e_book_backend_notify_readonly (backend, TRUE);
+		e_book_backend_notify_online (backend, FALSE);
 		e_data_book_respond_authenticate_user (book,
 						       opid,
 						       EDB_ERROR (SUCCESS));
@@ -4838,10 +4813,10 @@ e_book_backend_ldap_authenticate_user (EBookBackend *backend,
 		}
 
 		g_free (bl->priv->auth_dn);
-		g_free (bl->priv->auth_passwd);
+		e_credentials_util_safe_free_string (bl->priv->auth_passwd);
 
 		bl->priv->auth_dn = dn;
-		bl->priv->auth_passwd = g_strdup (passwd);
+		bl->priv->auth_passwd = e_credentials_get (credentials, E_CREDENTIALS_KEY_PASSWORD);
 
 		/* now authenticate against the DN we were either supplied or queried for */
 		if (enable_debug)
@@ -4898,7 +4873,7 @@ e_book_backend_ldap_authenticate_user (EBookBackend *backend,
 		ldap_error = ldap_sasl_bind_s (bl->priv->ldap,
 					       NULL,
 					       auth_method + strlen (SASL_PREFIX),
-					       passwd,
+					       e_credentials_peek (credentials, E_CREDENTIALS_KEY_PASSWORD),
 					       NULL,
 					       NULL,
 					       NULL);
@@ -4922,8 +4897,8 @@ e_book_backend_ldap_authenticate_user (EBookBackend *backend,
 	}
 
 	if (ldap_error == LDAP_SUCCESS) {
-
-		e_book_backend_set_is_writable (backend, TRUE);
+		e_book_backend_set_is_readonly (backend, FALSE);
+		e_book_backend_notify_readonly (backend, FALSE);
 
 		/* force a requery on the root dse since some ldap
 		   servers are set up such that they don't report
@@ -4940,7 +4915,7 @@ e_book_backend_ldap_authenticate_user (EBookBackend *backend,
 				g_warning ("Failed to perform root dse query after authenticating, (ldap_error 0x%02x)", ldap_error);
 		}
 
-		e_data_book_report_writable (book, TRUE);
+		e_data_book_report_readonly (book, FALSE);
 
 		if (bl->priv->marked_for_offline && bl->priv->cache)
 			generate_cache (bl);
@@ -4950,29 +4925,29 @@ e_book_backend_ldap_authenticate_user (EBookBackend *backend,
 static void
 e_book_backend_ldap_get_required_fields (EBookBackend *backend,
 					  EDataBook    *book,
-					  guint32       opid)
-
+					  guint32       opid,
+					  GCancellable *cancellable)
 {
-	GList *fields = NULL;
+	GSList *fields = NULL;
 
 	/*FIMEME we should look at mandatory attributs in the schema
 	  and return all those fields here */
-	fields = g_list_append (fields, (gchar *)e_contact_field_name (E_CONTACT_FILE_AS));
-	fields = g_list_append (fields, (gchar *)e_contact_field_name (E_CONTACT_FULL_NAME));
-	fields = g_list_append (fields, (gchar *)e_contact_field_name (E_CONTACT_FAMILY_NAME));
+	fields = g_slist_append (fields, (gchar *)e_contact_field_name (E_CONTACT_FILE_AS));
+	fields = g_slist_append (fields, (gchar *)e_contact_field_name (E_CONTACT_FULL_NAME));
+	fields = g_slist_append (fields, (gchar *)e_contact_field_name (E_CONTACT_FAMILY_NAME));
 
 	e_data_book_respond_get_required_fields (book,
 						  opid,
 						  EDB_ERROR (SUCCESS),
 						  fields);
-	g_list_free (fields);
+	g_slist_free (fields);
 }
 
 static void
 e_book_backend_ldap_get_supported_fields (EBookBackend *backend,
 					  EDataBook    *book,
-					  guint32       opid)
-
+					  guint32       opid,
+					  GCancellable *cancellable)
 {
 	EBookBackendLDAP *bl = E_BOOK_BACKEND_LDAP (backend);
 
@@ -4985,8 +4960,8 @@ e_book_backend_ldap_get_supported_fields (EBookBackend *backend,
 static void
 e_book_backend_ldap_get_supported_auth_methods (EBookBackend *backend,
 						EDataBook    *book,
-						guint32       opid)
-
+						guint32       opid,
+						GCancellable *cancellable)
 {
 	EBookBackendLDAP *bl = E_BOOK_BACKEND_LDAP (backend);
 
@@ -5010,7 +4985,7 @@ ldap_cancel_op (gpointer key, gpointer value, gpointer data)
 }
 
 static void
-e_book_backend_ldap_cancel_operation (EBookBackend *backend, EDataBook *book, GError **perror)
+ldap_cancel_all_operations (EBookBackend *backend)
 {
 	EBookBackendLDAP *bl = E_BOOK_BACKEND_LDAP (backend);
 
@@ -5020,12 +4995,14 @@ e_book_backend_ldap_cancel_operation (EBookBackend *backend, EDataBook *book, GE
 }
 
 static void
-e_book_backend_ldap_load_source (EBookBackend             *backend,
-				 ESource                  *source,
-				 gboolean                  only_if_exists,
-				 GError                  **perror)
+e_book_backend_ldap_open (EBookBackend	*backend,
+			  EDataBook	*book,
+			  guint		 opid,
+			  GCancellable	*cancellable,
+			  gboolean	 only_if_exists)
 {
 	EBookBackendLDAP *bl = E_BOOK_BACKEND_LDAP (backend);
+	ESource *source = e_book_backend_get_source (backend);
 	LDAPURLDesc    *lud;
 	gint ldap_error;
 	gint limit = 100;
@@ -5041,7 +5018,7 @@ e_book_backend_ldap_load_source (EBookBackend             *backend,
 	g_assert (bl->priv->connected == FALSE);
 
 	if (enable_debug)
-		printf ("e_book_backend_ldap_load_source ... \n");
+		printf ("%s ... \n", G_STRFUNC);
 
 	uri = e_source_get_uri (source);
 	cache_dir = e_book_backend_get_cache_dir (backend);
@@ -5088,9 +5065,9 @@ e_book_backend_ldap_load_source (EBookBackend             *backend,
 		ldap_free_urldesc (lud);
 	} else {
 		if (enable_debug)
-			printf ("e_book_backend_ldap_load_source ... failed to parse the ldap URI %s\n", uri);
+			printf ("%s ... failed to parse the ldap URI %s\n", G_STRFUNC, uri);
 		g_free (uri);
-		g_propagate_error (perror, EDB_ERROR_EX (OTHER_ERROR, "Failed to parse LDAP URI"));
+		e_data_book_respond_open (book, opid, EDB_ERROR_EX (OTHER_ERROR, "Failed to parse LDAP URI"));
 		return;
 	}
 
@@ -5105,31 +5082,31 @@ e_book_backend_ldap_load_source (EBookBackend             *backend,
 
 	g_free (uri);
 
-	if (bl->priv->mode == E_DATA_BOOK_MODE_LOCAL) {
+	if (!bl->priv->is_online) {
 		/* Offline */
 
 		e_book_backend_set_is_loaded (backend, TRUE);
-		e_book_backend_set_is_writable (backend, FALSE);
-		e_book_backend_notify_writable (backend, FALSE);
-		e_book_backend_notify_connection_status (backend, FALSE);
+		e_book_backend_set_is_readonly (backend, TRUE);
+		e_book_backend_notify_readonly (backend, TRUE);
+		e_book_backend_notify_online (backend, FALSE);
 
 		if (!bl->priv->marked_for_offline) {
-			g_propagate_error (perror, EDB_ERROR (OFFLINE_UNAVAILABLE));
+			e_data_book_respond_open (book, opid, EDB_ERROR (OFFLINE_UNAVAILABLE));
 			return;
 		}
 
 #if 0
 		if (!e_book_backend_cache_is_populated (bl->priv->cache)) {
-			g_propagate_error (perror, EDB_ERROR (OFFLINE_UNAVAILABLE));
+			e_data_book_respond_open (book, opid, EDB_ERROR (OFFLINE_UNAVAILABLE));
 			return;
 		}
 #endif
-
+		e_data_book_respond_open (book, opid, NULL /* Success */);
 		return;
 	} else {
-		e_book_backend_set_is_writable (backend, TRUE);
-		e_book_backend_notify_writable (backend, TRUE);
-		e_book_backend_notify_connection_status (backend, TRUE);
+		e_book_backend_set_is_readonly (backend, FALSE);
+		e_book_backend_notify_readonly (backend, FALSE);
+		e_book_backend_notify_online (backend, TRUE);
 	}
 
 	str = e_source_get_property (source, "auth");
@@ -5138,11 +5115,12 @@ e_book_backend_ldap_load_source (EBookBackend             *backend,
 		/* Requires authentication, do not try to bind without it,
 		   but report success instead, as we are loaded. */
 		if (enable_debug)
-			printf ("e_book_backend_ldap_load_source ... skipping anonymous bind, because auth required\n");
+			printf ("%s ... skipping anonymous bind, because auth required\n", G_STRFUNC);
 
 		if (!e_book_backend_is_loaded (backend))
-			e_book_backend_notify_auth_required (backend);
+			e_book_backend_notify_auth_required (backend, NULL);
 		e_book_backend_set_is_loaded (backend, TRUE);
+		e_data_book_respond_open (book, opid, NULL /* Success */);
 		return;
 	}
 
@@ -5150,22 +5128,25 @@ e_book_backend_ldap_load_source (EBookBackend             *backend,
 	err = e_book_backend_ldap_connect (bl);
 	if (err) {
 		if (enable_debug)
-			printf ("e_book_backend_ldap_load_source ... failed to connect to server \n");
-		g_propagate_error (perror, err);
+			printf ("%s ... failed to connect to server \n", G_STRFUNC);
+		e_data_book_respond_open (book, opid, err);
 		return;
 	}
 
 	if (auth_required && !e_book_backend_is_loaded (backend)) {
-		e_book_backend_notify_auth_required (E_BOOK_BACKEND (bl));
+		e_book_backend_notify_auth_required (E_BOOK_BACKEND (bl), NULL);
+		e_data_book_respond_open (book, opid, NULL /* Success */);
 		return;
 	}
 
 	if (bl->priv->marked_for_offline)
 		generate_cache (bl);
+
+	e_data_book_respond_open (book, opid, NULL /* Success */);
 }
 
 static void
-e_book_backend_ldap_remove (EBookBackend *backend, EDataBook *book, guint32 opid)
+e_book_backend_ldap_remove (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable)
 {
 	/* if we ever add caching, we'll remove it here, but for now,
 	   just report back Success */
@@ -5173,78 +5154,81 @@ e_book_backend_ldap_remove (EBookBackend *backend, EDataBook *book, guint32 opid
 	e_data_book_respond_remove (book, opid, EDB_ERROR (SUCCESS));
 }
 
-static gchar *
-e_book_backend_ldap_get_static_capabilities (EBookBackend *backend)
+static void
+e_book_backend_ldap_get_capabilities (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable)
 {
 	if (can_browse (backend) || E_BOOK_BACKEND_LDAP (backend)->priv->marked_for_offline)
-		return g_strdup ("net,anon-access,contact-lists,do-initial-query");
+		e_data_book_respond_get_capabilities (book, opid, NULL, "net,anon-access,contact-lists,do-initial-query");
 	else
-		return g_strdup("net,anon-access,contact-lists");
+		e_data_book_respond_get_capabilities (book, opid, NULL, "net,anon-access,contact-lists");
 }
 
 #if 0
+
+struct call_data {
+	EBookBackend *backend;
+	static void (* func) (EBookBackend  *backend, EDataBookView *view);
+};
+
+static gboolean
+call_cb (EDataBookView *view, gpointer user_data)
+{
+	struct call_data *cd = user_data;
+
+	g_return_val_if_fail (user_data != NULL, FALSE);
+	g_return_val_if_fail (cd->func != NULL, FALSE);
+	g_return_val_if_fail (cd->backend != NULL, FALSE);
+
+	(* cd->func) (cd->backend, view);
+
+	return TRUE;
+}
+
 static void
 stop_views (EBookBackend *backend)
 {
-	EList     *book_views;
-	EIterator *iter;
-
-	book_views = e_book_backend_get_book_views (backend);
-	iter = e_list_get_iterator (book_views);
+	struct call_data cd;
 
-	while (e_iterator_is_valid (iter)) {
-		EDataBookView *data_book_view = (EDataBookView *) e_iterator_get (iter);
-		e_book_backend_ldap_stop_book_view (backend, data_book_view);
-		e_iterator_next (iter);
-	}
+	cd.backend = backend;
+	cd.func = e_book_backend_ldap_stop_book_view;
 
-	g_object_unref (iter);
-	g_object_unref (book_views);
+	e_book_backend_foreach_view (backend, call_cb, &cd);
 }
 
 static void
 start_views (EBookBackend *backend)
 {
-	EList     *book_views;
-	EIterator *iter;
-
-	book_views = e_book_backend_get_book_views (backend);
-	iter = e_list_get_iterator (book_views);
+	struct call_data cd;
 
-	while (e_iterator_is_valid (iter)) {
-		EDataBookView *data_book_view = (EDataBookView *) e_iterator_get (iter);
-		e_book_backend_ldap_start_book_view (backend, data_book_view);
-		e_iterator_next (iter);
-	}
+	cd.backend = backend;
+	cd.func = e_book_backend_ldap_start_book_view;
 
-	g_object_unref (iter);
-	g_object_unref (book_views);
+	e_book_backend_foreach_view (backend, call_cb, &cd);
 }
 #endif
 
 static void
-e_book_backend_ldap_set_mode (EBookBackend *backend,
-                              EDataBookMode mode)
+e_book_backend_ldap_set_online (EBookBackend *backend, gboolean is_online)
 {
 	EBookBackendLDAP *bl = E_BOOK_BACKEND_LDAP (backend);
 
-	if (bl->priv->mode == mode)
+	if (bl->priv->is_online == is_online)
 		return;
 
-	bl->priv->mode = mode;
+	bl->priv->is_online = is_online;
 #if 0
 	stop_views (backend);
 #endif
 
 	/* Cancel all running operations */
-	e_book_backend_ldap_cancel_operation (backend, NULL, NULL);
+	ldap_cancel_all_operations (backend);
 
-	if (mode == E_DATA_BOOK_MODE_LOCAL) {
+	if (!is_online) {
 		/* Go offline */
 
-		e_book_backend_set_is_writable (backend, FALSE);
-		e_book_backend_notify_writable (backend, FALSE);
-		e_book_backend_notify_connection_status (backend, FALSE);
+		e_book_backend_set_is_readonly (backend, TRUE);
+		e_book_backend_notify_readonly (backend, TRUE);
+		e_book_backend_notify_online (backend, FALSE);
 
 #if 0
 		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
@@ -5261,19 +5245,18 @@ e_book_backend_ldap_set_mode (EBookBackend *backend,
 		if (e_book_backend_is_loaded (backend))
 			start_views (backend);
 #endif
-	}
-	else if (mode == E_DATA_BOOK_MODE_REMOTE) {
+	} else {
 		/* Go online */
 
-		e_book_backend_set_is_writable (backend, TRUE);
-		e_book_backend_notify_writable (backend, TRUE);
-		e_book_backend_notify_connection_status (backend, TRUE);
+		e_book_backend_set_is_readonly (backend, FALSE);
+		e_book_backend_notify_readonly (backend, FALSE);
+		e_book_backend_notify_online (backend, TRUE);
 
 		if (e_book_backend_is_loaded (backend)) {
 			GError *error;
 
 			error = e_book_backend_ldap_connect (bl);
-			e_book_backend_notify_auth_required (backend);
+			e_book_backend_notify_auth_required (backend, NULL);
 
 			if (error)
 				g_error_free (error);
@@ -5337,13 +5320,13 @@ e_book_backend_ldap_dispose (GObject *object)
 		}
 
 		if (bl->priv->supported_fields) {
-			g_list_foreach (bl->priv->supported_fields, (GFunc)g_free, NULL);
-			g_list_free (bl->priv->supported_fields);
+			g_slist_foreach (bl->priv->supported_fields, (GFunc) g_free, NULL);
+			g_slist_free (bl->priv->supported_fields);
 		}
 
 		if (bl->priv->supported_auth_methods) {
-			g_list_foreach (bl->priv->supported_auth_methods, (GFunc)g_free, NULL);
-			g_list_free (bl->priv->supported_auth_methods);
+			g_slist_foreach (bl->priv->supported_auth_methods, (GFunc) g_free, NULL);
+			g_slist_free (bl->priv->supported_auth_methods);
 		}
 		if (bl->priv->summary_file_name) {
 			g_free (bl->priv->summary_file_name);
@@ -5380,24 +5363,22 @@ e_book_backend_ldap_class_init (EBookBackendLDAPClass *klass)
 	parent_class = E_BOOK_BACKEND_CLASS (klass);
 
 	/* Set the virtual methods. */
-	parent_class->load_source             = e_book_backend_ldap_load_source;
-	parent_class->remove                  = e_book_backend_ldap_remove;
-	parent_class->get_static_capabilities = e_book_backend_ldap_get_static_capabilities;
-
-	parent_class->create_contact          = e_book_backend_ldap_create_contact;
-	parent_class->remove_contacts         = e_book_backend_ldap_remove_contacts;
-	parent_class->modify_contact          = e_book_backend_ldap_modify_contact;
-	parent_class->get_contact             = e_book_backend_ldap_get_contact;
-	parent_class->get_contact_list        = e_book_backend_ldap_get_contact_list;
-	parent_class->start_book_view         = e_book_backend_ldap_start_book_view;
-	parent_class->stop_book_view          = e_book_backend_ldap_stop_book_view;
-	parent_class->get_changes             = e_book_backend_ldap_get_changes;
-	parent_class->authenticate_user       = e_book_backend_ldap_authenticate_user;
-	parent_class->get_required_fields    = e_book_backend_ldap_get_required_fields;
-	parent_class->get_supported_fields    = e_book_backend_ldap_get_supported_fields;
-	parent_class->get_supported_auth_methods = e_book_backend_ldap_get_supported_auth_methods;
-	parent_class->cancel_operation	      = e_book_backend_ldap_cancel_operation;
-	parent_class->set_mode                = e_book_backend_ldap_set_mode;
+	parent_class->open				= e_book_backend_ldap_open;
+	parent_class->remove				= e_book_backend_ldap_remove;
+	parent_class->get_capabilities			= e_book_backend_ldap_get_capabilities;
+
+	parent_class->create_contact			= e_book_backend_ldap_create_contact;
+	parent_class->remove_contacts			= e_book_backend_ldap_remove_contacts;
+	parent_class->modify_contact			= e_book_backend_ldap_modify_contact;
+	parent_class->get_contact			= e_book_backend_ldap_get_contact;
+	parent_class->get_contact_list			= e_book_backend_ldap_get_contact_list;
+	parent_class->start_book_view			= e_book_backend_ldap_start_book_view;
+	parent_class->stop_book_view			= e_book_backend_ldap_stop_book_view;
+	parent_class->authenticate_user			= e_book_backend_ldap_authenticate_user;
+	parent_class->get_required_fields		= e_book_backend_ldap_get_required_fields;
+	parent_class->get_supported_fields		= e_book_backend_ldap_get_supported_fields;
+	parent_class->get_supported_auth_methods	= e_book_backend_ldap_get_supported_auth_methods;
+	parent_class->set_online			= e_book_backend_ldap_set_online;
 
 	object_class->dispose = e_book_backend_ldap_dispose;
 }
@@ -5415,7 +5396,7 @@ e_book_backend_ldap_init (EBookBackendLDAP *backend)
 	priv->id_to_op		     = g_hash_table_new (g_int_hash, g_int_equal);
 	priv->poll_timeout	     = -1;
 	priv->marked_for_offline     = FALSE;
-	priv->mode                   = E_DATA_BOOK_MODE_REMOTE;
+	priv->is_online              = TRUE;
 	priv->is_summary_ready	     = FALSE;
 	priv->reserved1	     = NULL;
 	priv->reserved2	     = NULL;
diff --git a/addressbook/backends/vcf/e-book-backend-vcf.c b/addressbook/backends/vcf/e-book-backend-vcf.c
index 29c8b5e..861200b 100644
--- a/addressbook/backends/vcf/e-book-backend-vcf.c
+++ b/addressbook/backends/vcf/e-book-backend-vcf.c
@@ -273,7 +273,7 @@ do_create (EBookBackendVCF  *bvcf,
 static void
 e_book_backend_vcf_create_contact (EBookBackendSync *backend,
 				   EDataBook *book,
-				   guint32 opid,
+				   GCancellable *cancellable,
 				   const gchar *vcard,
 				   EContact **contact,
 				   GError **perror)
@@ -291,14 +291,14 @@ e_book_backend_vcf_create_contact (EBookBackendSync *backend,
 static void
 e_book_backend_vcf_remove_contacts (EBookBackendSync *backend,
 				    EDataBook *book,
-				    guint32 opid,
-				    GList *id_list,
-				    GList **ids,
+				    GCancellable *cancellable,
+				    const GSList *id_list,
+				    GSList **ids,
 				    GError **perror)
 {
 	/* FIXME: make this handle bulk deletes like the file backend does */
 	EBookBackendVCF *bvcf = E_BOOK_BACKEND_VCF (backend);
-	gchar *id = id_list->data;
+	const gchar *id = id_list->data;
 	GList *elem;
 
 	g_mutex_lock (bvcf->priv->mutex);
@@ -324,13 +324,13 @@ e_book_backend_vcf_remove_contacts (EBookBackendSync *backend,
 							       vcf_flush_file, bvcf);
 	g_mutex_unlock (bvcf->priv->mutex);
 
-	*ids = g_list_append (*ids, id);
+	*ids = g_slist_append (*ids, g_strdup (id));
 }
 
 static void
 e_book_backend_vcf_modify_contact (EBookBackendSync *backend,
 				   EDataBook *book,
-				   guint32 opid,
+				   GCancellable *cancellable,
 				   const gchar *vcard,
 				   EContact **contact,
 				   GError **perror)
@@ -363,7 +363,7 @@ e_book_backend_vcf_modify_contact (EBookBackendSync *backend,
 static void
 e_book_backend_vcf_get_contact (EBookBackendSync *backend,
 				EDataBook *book,
-				guint32 opid,
+				GCancellable *cancellable,
 				const gchar *id,
 				gchar **vcard,
 				GError **perror)
@@ -385,23 +385,23 @@ typedef struct {
 	EBookBackendVCF      *bvcf;
 	gboolean            search_needed;
 	EBookBackendSExp *card_sexp;
-	GList              *list;
+	GSList              *list;
 } GetContactListClosure;
 
 static void
 foreach_get_contact_compare (gchar *vcard_string, GetContactListClosure *closure)
 {
 	if ((!closure->search_needed) || e_book_backend_sexp_match_vcard  (closure->card_sexp, vcard_string)) {
-		closure->list = g_list_append (closure->list, g_strdup (vcard_string));
+		closure->list = g_slist_append (closure->list, g_strdup (vcard_string));
 	}
 }
 
 static void
 e_book_backend_vcf_get_contact_list (EBookBackendSync *backend,
 				     EDataBook *book,
-				     guint32 opid,
+				     GCancellable *cancellable,
 				     const gchar *query,
-				     GList **contacts,
+				     GSList **contacts,
 				     GError **perror)
 {
 	EBookBackendVCF *bvcf = E_BOOK_BACKEND_VCF (backend);
@@ -472,9 +472,9 @@ book_view_thread (gpointer data)
 	query = e_data_book_view_get_card_query (book_view);
 
 	if ( !strcmp (query, "(contains \"x-evolution-any-field\" \"\")"))
-		e_data_book_view_notify_status_message (book_view, _("Loading..."));
+		e_data_book_view_notify_progress (book_view, -1, _("Loading..."));
 	else
-		e_data_book_view_notify_status_message (book_view, _("Searching..."));
+		e_data_book_view_notify_progress (book_view, -1, _("Searching..."));
 
 	d(printf ("signalling parent thread\n"));
 	e_flag_set (closure->running);
@@ -542,10 +542,8 @@ e_book_backend_vcf_extract_path_from_uri (const gchar *uri)
 static void
 e_book_backend_vcf_authenticate_user (EBookBackendSync *backend,
 				      EDataBook *book,
-				      guint32 opid,
-				      const gchar *user,
-				      const gchar *passwd,
-				      const gchar *auth_method,
+				      GCancellable *cancellable,
+				      ECredentials *credentials,
 				      GError **perror)
 {
 	/* Success */
@@ -554,30 +552,30 @@ e_book_backend_vcf_authenticate_user (EBookBackendSync *backend,
 static void
 e_book_backend_vcf_get_required_fields (EBookBackendSync *backend,
 					EDataBook *book,
-					guint32 opid,
-					GList **fields_out,
+					GCancellable *cancellable,
+					GSList **fields_out,
 					GError **perror)
 {
-	GList *fields = NULL;
+	GSList *fields = NULL;
 
-	fields = g_list_append (fields , g_strdup (e_contact_field_name (E_CONTACT_FILE_AS)));
+	fields = g_slist_append (fields , g_strdup (e_contact_field_name (E_CONTACT_FILE_AS)));
 	*fields_out = fields;
 }
 
 static void
 e_book_backend_vcf_get_supported_fields (EBookBackendSync *backend,
 					 EDataBook *book,
-					 guint32 opid,
-					 GList **fields_out,
+					 GCancellable *cancellable,
+					 GSList **fields_out,
 					 GError **perror)
 {
-	GList *fields = NULL;
+	GSList *fields = NULL;
 	gint i;
 
 	/* XXX we need a way to say "we support everything", since the
 	   vcf backend does */
 	for (i = 0; i < E_CONTACT_FIELD_LAST; i++)
-		fields = g_list_append (fields, (gchar *)e_contact_field_name (i));
+		fields = g_slist_append (fields, (gchar *)e_contact_field_name (i));
 
 	*fields_out = fields;
 }
@@ -587,14 +585,16 @@ e_book_backend_vcf_get_supported_fields (EBookBackendSync *backend,
 #endif
 
 static void
-e_book_backend_vcf_load_source (EBookBackend             *backend,
-				ESource                  *source,
-				gboolean                  only_if_exists,
-				GError                  **perror)
+e_book_backend_vcf_open (EBookBackendSync        *backend,
+			 EDataBook		 *book,
+			 GCancellable		 *cancellable,
+			 gboolean		  only_if_exists,
+			 GError			**perror)
 {
 	EBookBackendVCF *bvcf = E_BOOK_BACKEND_VCF (backend);
+	ESource *source = e_book_backend_get_source (E_BOOK_BACKEND (backend));
 	gchar           *dirname;
-	gboolean        writable = FALSE;
+	gboolean        readonly = TRUE;
 	gchar          *uri;
 	gint fd;
 
@@ -611,7 +611,7 @@ e_book_backend_vcf_load_source (EBookBackend             *backend,
 		(GDestroyNotify) NULL);
 
 	if (fd != -1) {
-		writable = TRUE;
+		readonly = FALSE;
 	} else {
 		fd = g_open (bvcf->priv->filename, O_RDONLY | O_BINARY, 0);
 
@@ -644,7 +644,7 @@ e_book_backend_vcf_load_source (EBookBackend             *backend,
 				g_object_unref (contact);
 #endif
 
-				writable = TRUE;
+				readonly = FALSE;
 			}
 		}
 	}
@@ -659,32 +659,25 @@ e_book_backend_vcf_load_source (EBookBackend             *backend,
 
 	load_file (bvcf, fd);
 
-	e_book_backend_set_is_loaded (backend, TRUE);
-	e_book_backend_set_is_writable (backend, writable);
+	e_book_backend_set_is_loaded (E_BOOK_BACKEND (backend), TRUE);
+	e_book_backend_set_is_readonly (E_BOOK_BACKEND (backend), readonly);
+	e_book_backend_notify_readonly (E_BOOK_BACKEND (backend), readonly);
+	e_book_backend_notify_online (E_BOOK_BACKEND (backend), TRUE);
 
 	g_free (uri);
 }
 
-static gchar *
-e_book_backend_vcf_get_static_capabilities (EBookBackend *backend)
-{
-	return g_strdup("local,do-initial-query,contact-lists");
-}
-
 static void
-e_book_backend_vcf_cancel_operation (EBookBackend *backend, EDataBook *book, GError **perror)
+e_book_backend_vcf_get_capabilities (EBookBackendSync *backend, EDataBook *book, GCancellable *cancellable, gchar **capabilities, GError **error)
 {
-	g_propagate_error (perror, EDB_ERROR (COULD_NOT_CANCEL));
+	*capabilities = g_strdup ("local,do-initial-query,contact-lists");
 }
 
 static void
-e_book_backend_vcf_set_mode (EBookBackend *backend,
-                             EDataBookMode mode)
+e_book_backend_vcf_set_online (EBookBackend *backend, gboolean is_online)
 {
-	if (e_book_backend_is_loaded (backend)) {
-		e_book_backend_notify_writable (backend, TRUE);
-		e_book_backend_notify_connection_status (backend, TRUE);
-	}
+	if (e_book_backend_is_loaded (backend))
+		e_book_backend_notify_online (backend, TRUE);
 }
 
 /**
@@ -743,20 +736,20 @@ e_book_backend_vcf_class_init (EBookBackendVCFClass *klass)
 	backend_class = E_BOOK_BACKEND_CLASS (klass);
 
 	/* Set the virtual methods. */
-	backend_class->load_source             = e_book_backend_vcf_load_source;
-	backend_class->get_static_capabilities = e_book_backend_vcf_get_static_capabilities;
-	backend_class->start_book_view         = e_book_backend_vcf_start_book_view;
-	backend_class->stop_book_view          = e_book_backend_vcf_stop_book_view;
-	backend_class->cancel_operation        = e_book_backend_vcf_cancel_operation;
-	backend_class->set_mode                = e_book_backend_vcf_set_mode;
-	sync_class->create_contact_sync        = e_book_backend_vcf_create_contact;
-	sync_class->remove_contacts_sync       = e_book_backend_vcf_remove_contacts;
-	sync_class->modify_contact_sync        = e_book_backend_vcf_modify_contact;
-	sync_class->get_contact_sync           = e_book_backend_vcf_get_contact;
-	sync_class->get_contact_list_sync      = e_book_backend_vcf_get_contact_list;
-	sync_class->authenticate_user_sync     = e_book_backend_vcf_authenticate_user;
-	sync_class->get_required_fields_sync   = e_book_backend_vcf_get_required_fields;
-	sync_class->get_supported_fields_sync  = e_book_backend_vcf_get_supported_fields;
+	backend_class->start_book_view		= e_book_backend_vcf_start_book_view;
+	backend_class->stop_book_view		= e_book_backend_vcf_stop_book_view;
+	backend_class->set_online		= e_book_backend_vcf_set_online;
+
+	sync_class->open_sync			= e_book_backend_vcf_open;
+	sync_class->get_capabilities_sync	= e_book_backend_vcf_get_capabilities;
+	sync_class->create_contact_sync		= e_book_backend_vcf_create_contact;
+	sync_class->remove_contacts_sync	= e_book_backend_vcf_remove_contacts;
+	sync_class->modify_contact_sync		= e_book_backend_vcf_modify_contact;
+	sync_class->get_contact_sync		= e_book_backend_vcf_get_contact;
+	sync_class->get_contact_list_sync	= e_book_backend_vcf_get_contact_list;
+	sync_class->authenticate_user_sync	= e_book_backend_vcf_authenticate_user;
+	sync_class->get_required_fields_sync	= e_book_backend_vcf_get_required_fields;
+	sync_class->get_supported_fields_sync	= e_book_backend_vcf_get_supported_fields;
 
 	object_class->dispose = e_book_backend_vcf_dispose;
 }
diff --git a/addressbook/backends/webdav/e-book-backend-webdav.c b/addressbook/backends/webdav/e-book-backend-webdav.c
index 29d3147..02927c8 100644
--- a/addressbook/backends/webdav/e-book-backend-webdav.c
+++ b/addressbook/backends/webdav/e-book-backend-webdav.c
@@ -65,7 +65,7 @@ G_DEFINE_TYPE (EBookBackendWebdav, e_book_backend_webdav, E_TYPE_BOOK_BACKEND)
 static EBookBackendClass *parent_class;
 
 struct _EBookBackendWebdavPrivate {
-	gint                mode;
+	gboolean           is_online;
 	gboolean           marked_for_offline;
 	SoupSession       *session;
 	EProxy		  *proxy;
@@ -288,7 +288,7 @@ webdav_handle_auth_request (EBookBackendWebdav *webdav)
 	if (priv->username != NULL) {
 		g_free (priv->username);
 		priv->username = NULL;
-		g_free (priv->password);
+		e_credentials_util_safe_free_string (priv->password);
 		priv->password = NULL;
 
 		return EDB_ERROR (AUTHENTICATION_FAILED);
@@ -298,8 +298,7 @@ webdav_handle_auth_request (EBookBackendWebdav *webdav)
 }
 
 static void
-e_book_backend_webdav_create_contact (EBookBackend *backend,
-		EDataBook *book, guint32 opid, const gchar *vcard)
+e_book_backend_webdav_create_contact (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, const gchar *vcard)
 {
 	EBookBackendWebdav        *webdav = E_BOOK_BACKEND_WEBDAV (backend);
 	EBookBackendWebdavPrivate *priv   = webdav->priv;
@@ -308,7 +307,7 @@ e_book_backend_webdav_create_contact (EBookBackend *backend,
 	guint                      status;
 	gchar			  *status_reason = NULL;
 
-	if (priv->mode == E_DATA_BOOK_MODE_LOCAL) {
+	if (!priv->is_online) {
 		e_data_book_respond_create (book, opid, EDB_ERROR (REPOSITORY_OFFLINE), NULL);
 		return;
 	}
@@ -386,15 +385,14 @@ delete_contact (EBookBackendWebdav *webdav, const gchar *uri)
 }
 
 static void
-e_book_backend_webdav_remove_contacts (EBookBackend *backend,
-		EDataBook *book, guint32 opid, GList *id_list)
+e_book_backend_webdav_remove_contacts (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, const GSList *id_list)
 {
 	EBookBackendWebdav        *webdav      = E_BOOK_BACKEND_WEBDAV (backend);
 	EBookBackendWebdavPrivate *priv        = webdav->priv;
-	GList                     *deleted_ids = NULL;
-	GList                     *list;
+	GSList                    *deleted_ids = NULL;
+	const GSList              *list;
 
-	if (priv->mode == E_DATA_BOOK_MODE_LOCAL) {
+	if (!priv->is_online) {
 		e_data_book_respond_remove_contacts (book, opid,
 				EDB_ERROR (REPOSITORY_OFFLINE), NULL);
 		return;
@@ -415,16 +413,17 @@ e_book_backend_webdav_remove_contacts (EBookBackend *backend,
 			continue;
 		}
 		e_book_backend_cache_remove_contact (priv->cache, uid);
-		deleted_ids = g_list_append (deleted_ids, list->data);
+		deleted_ids = g_slist_append (deleted_ids, list->data);
 	}
 
 	e_data_book_respond_remove_contacts (book, opid,
 			EDB_ERROR (SUCCESS),  deleted_ids);
+
+	g_slist_free (deleted_ids);
 }
 
 static void
-e_book_backend_webdav_modify_contact (EBookBackend *backend,
-		EDataBook *book, guint32 opid, const gchar *vcard)
+e_book_backend_webdav_modify_contact (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, const gchar *vcard)
 {
 	EBookBackendWebdav        *webdav  = E_BOOK_BACKEND_WEBDAV (backend);
 	EBookBackendWebdavPrivate *priv    = webdav->priv;
@@ -434,7 +433,7 @@ e_book_backend_webdav_modify_contact (EBookBackend *backend,
 	guint status;
 	gchar *status_reason = NULL;
 
-	if (priv->mode == E_DATA_BOOK_MODE_LOCAL) {
+	if (!priv->is_online) {
 		e_data_book_respond_create (book, opid,
 				EDB_ERROR (REPOSITORY_OFFLINE), NULL);
 		g_object_unref (contact);
@@ -494,15 +493,14 @@ e_book_backend_webdav_modify_contact (EBookBackend *backend,
 }
 
 static void
-e_book_backend_webdav_get_contact (EBookBackend *backend, EDataBook *book,
-		guint32 opid, const gchar *uid)
+e_book_backend_webdav_get_contact (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, const gchar *uid)
 {
 	EBookBackendWebdav        *webdav = E_BOOK_BACKEND_WEBDAV (backend);
 	EBookBackendWebdavPrivate *priv   = webdav->priv;
 	EContact                  *contact;
 	gchar                      *vcard;
 
-	if (priv->mode == E_DATA_BOOK_MODE_LOCAL) {
+	if (!priv->is_online) {
 		contact = e_book_backend_cache_get_contact (priv->cache, uid);
 	} else {
 		contact = download_contact (webdav, uid);
@@ -860,7 +858,7 @@ download_contacts (EBookBackendWebdav *webdav, EFlag *running,
 	}
 
 	if (book_view != NULL) {
-		e_data_book_view_notify_status_message (book_view,
+		e_data_book_view_notify_progress (book_view, -1,
 				"Loading Addressbook summary...");
 	}
 
@@ -920,7 +918,7 @@ download_contacts (EBookBackendWebdav *webdav, EFlag *running,
 			gfloat percent = 100.0 / count * i;
 			gchar buf[100];
 			snprintf(buf, sizeof(buf), "Loading Contacts (%d%%)", (gint)percent);
-			e_data_book_view_notify_status_message (book_view, buf);
+			e_data_book_view_notify_progress (book_view, -1, buf);
 		}
 
 		/* skip collections */
@@ -1012,7 +1010,7 @@ e_book_backend_webdav_start_book_view (EBookBackend *backend,
 	EBookBackendWebdav        *webdav = E_BOOK_BACKEND_WEBDAV (backend);
 	EBookBackendWebdavPrivate *priv   = webdav->priv;
 
-	if (priv->mode == E_DATA_BOOK_MODE_REMOTE) {
+	if (priv->is_online) {
 		WebdavBackendSearchClosure *closure
 			= init_closure (book_view, E_BOOK_BACKEND_WEBDAV (backend));
 
@@ -1043,7 +1041,7 @@ e_book_backend_webdav_stop_book_view (EBookBackend *backend,
 	WebdavBackendSearchClosure *closure;
 	gboolean                    need_join;
 
-	if (webdav->priv->mode == E_DATA_BOOK_MODE_LOCAL)
+	if (!webdav->priv->is_online)
 		return;
 
 	closure = get_closure (book_view);
@@ -1059,16 +1057,15 @@ e_book_backend_webdav_stop_book_view (EBookBackend *backend,
 }
 
 static void
-e_book_backend_webdav_get_contact_list (EBookBackend *backend, EDataBook *book,
-		guint32 opid, const gchar *query)
+e_book_backend_webdav_get_contact_list (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, const gchar *query)
 {
 	EBookBackendWebdav        *webdav = E_BOOK_BACKEND_WEBDAV (backend);
 	EBookBackendWebdavPrivate *priv   = webdav->priv;
 	GList                     *contact_list;
-	GList                     *vcard_list;
+	GSList                    *vcard_list;
 	GList                     *c;
 
-	if (priv->mode == E_DATA_BOOK_MODE_REMOTE) {
+	if (priv->is_online) {
 		/* make sure the cache is up to date */
 		GError *error = download_contacts (webdav, NULL, NULL);
 
@@ -1085,26 +1082,27 @@ e_book_backend_webdav_get_contact_list (EBookBackend *backend, EDataBook *book,
 		EContact *contact = c->data;
 		gchar     *vcard
 			= e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
-		vcard_list = g_list_append (vcard_list, vcard);
+		vcard_list = g_slist_append (vcard_list, vcard);
 		g_object_unref (contact);
 	}
 	g_list_free (contact_list);
 
 	e_data_book_respond_get_contact_list (book, opid, EDB_ERROR (SUCCESS), vcard_list);
+
+	g_slist_foreach (vcard_list, (GFunc) g_free, NULL);
+	g_slist_free (vcard_list);
 }
 
 static void
-e_book_backend_webdav_authenticate_user (EBookBackend *backend, EDataBook *book,
-		guint32 opid, const gchar *user, const gchar *password,
-		const gchar *auth_method)
+e_book_backend_webdav_authenticate_user (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, ECredentials *credentials)
 {
 	EBookBackendWebdav        *webdav = E_BOOK_BACKEND_WEBDAV (backend);
 	EBookBackendWebdavPrivate *priv   = webdav->priv;
 	SoupMessage               *message;
 	guint                      status;
 
-	priv->username = g_strdup (user);
-	priv->password = g_strdup (password);
+	priv->username = e_credentials_get (credentials, E_CREDENTIALS_KEY_USERNAME);
+	priv->password = e_credentials_get (credentials, E_CREDENTIALS_KEY_PASSWORD);
 
 	/* Evolution API requires a direct feedback on the authentication,
 	 * so we send a PROPFIND to test wether user/password is correct */
@@ -1115,7 +1113,7 @@ e_book_backend_webdav_authenticate_user (EBookBackend *backend, EDataBook *book,
 	if (status == 401 || status == 407) {
 		g_free (priv->username);
 		priv->username = NULL;
-		g_free (priv->password);
+		e_credentials_util_safe_free_string (priv->password);
 		priv->password = NULL;
 
 		e_data_book_respond_authenticate_user (book, opid, EDB_ERROR (AUTHENTICATION_FAILED));
@@ -1125,48 +1123,44 @@ e_book_backend_webdav_authenticate_user (EBookBackend *backend, EDataBook *book,
 }
 
 static void
-e_book_backend_webdav_get_supported_fields (EBookBackend *backend,
-		EDataBook *book, guint32 opid)
+e_book_backend_webdav_get_supported_fields (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable)
 {
-	GList *fields = NULL;
+	GSList *fields = NULL;
 	gint    i;
 
 	/* we support everything */
 	for (i = 1; i < E_CONTACT_FIELD_LAST; ++i) {
-		fields = g_list_append (fields, g_strdup (e_contact_field_name (i)));
+		fields = g_slist_append (fields, (gpointer) e_contact_field_name (i));
 	}
 
 	e_data_book_respond_get_supported_fields (book, opid, EDB_ERROR (SUCCESS), fields);
-	g_list_foreach (fields, (GFunc) g_free, NULL);
-	g_list_free (fields);
+	g_slist_free (fields);
 }
 
 static void
-e_book_backend_webdav_get_supported_auth_methods (EBookBackend *backend,
-		EDataBook *book, guint32 opid)
+e_book_backend_webdav_get_supported_auth_methods (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable)
 {
-	GList *auth_methods = NULL;
+	GSList *auth_methods = NULL;
 
-	auth_methods = g_list_append(auth_methods, g_strdup("plain/password"));
+	auth_methods = g_slist_append (auth_methods, (gpointer) "plain/password");
 
 	e_data_book_respond_get_supported_auth_methods (book, opid, EDB_ERROR (SUCCESS), auth_methods);
 
-	g_list_foreach (auth_methods, (GFunc) g_free, NULL);
-	g_list_free (auth_methods);
+	g_slist_free (auth_methods);
 }
 
 static void
-e_book_backend_webdav_get_required_fields (EBookBackend *backend,
-		EDataBook *book, guint32 opid)
+e_book_backend_webdav_get_required_fields (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable)
 {
-	GList       *fields = NULL;
+	GSList      *fields = NULL;
 	const gchar *field_name;
 
 	field_name = e_contact_field_name (E_CONTACT_FILE_AS);
-	fields     = g_list_append (fields , g_strdup (field_name));
+	fields     = g_slist_append (fields , (gpointer) field_name);
 
 	e_data_book_respond_get_supported_fields (book, opid, EDB_ERROR (SUCCESS), fields);
-	g_list_free (fields);
+
+	g_slist_free (fields);
 }
 
 /** authentication callback for libsoup */
@@ -1180,8 +1174,7 @@ static void soup_authenticate (SoupSession *session, SoupMessage *message,
 		return;
 
 	if (priv->username != NULL) {
-		soup_auth_authenticate (auth, g_strdup (priv->username),
-				       g_strdup (priv->password));
+		soup_auth_authenticate (auth, priv->username, priv->password);
 	}
 }
 
@@ -1203,11 +1196,11 @@ proxy_settings_changed (EProxy *proxy, gpointer user_data)
 }
 
 static void
-e_book_backend_webdav_load_source (EBookBackend *backend,
-                                  ESource *source, gboolean only_if_exists, GError **perror)
+e_book_backend_webdav_open (EBookBackend *backend, EDataBook *book, guint opid, GCancellable *cancellable, gboolean only_if_exists)
 {
 	EBookBackendWebdav        *webdav = E_BOOK_BACKEND_WEBDAV (backend);
 	EBookBackendWebdavPrivate *priv   = webdav->priv;
+	ESource			  *source = e_book_backend_get_source (backend);
 	gchar                     *uri;
 	const gchar               *cache_dir;
 	const gchar               *offline;
@@ -1224,7 +1217,7 @@ e_book_backend_webdav_load_source (EBookBackend *backend,
 
 	uri = e_source_get_uri (source);
 	if (uri == NULL) {
-		g_propagate_error (perror, EDB_ERROR_EX (OTHER_ERROR, "No uri given for addressbook"));
+		e_data_book_respond_open (book, opid, EDB_ERROR_EX (OTHER_ERROR, "No uri given for addressbook"));
 		return;
 	}
 
@@ -1232,7 +1225,7 @@ e_book_backend_webdav_load_source (EBookBackend *backend,
 	g_free (uri);
 
 	if (!suri) {
-		g_propagate_error (perror, EDB_ERROR_EX (OTHER_ERROR, "Invalid uri given for addressbook"));
+		e_data_book_respond_open (book, opid, EDB_ERROR_EX (OTHER_ERROR, "Invalid uri given for addressbook"));
 		return;
 	}
 
@@ -1240,17 +1233,16 @@ e_book_backend_webdav_load_source (EBookBackend *backend,
 	if (offline && g_str_equal(offline, "1"))
 		priv->marked_for_offline = TRUE;
 
-	if (priv->mode == E_DATA_BOOK_MODE_LOCAL
-			&& !priv->marked_for_offline ) {
+	if (!priv->is_online && !priv->marked_for_offline ) {
 		soup_uri_free (suri);
-		g_propagate_error (perror, EDB_ERROR (OFFLINE_UNAVAILABLE));
+		e_data_book_respond_open (book, opid, EDB_ERROR (OFFLINE_UNAVAILABLE));
 		return;
 	}
 
 	if (!suri->scheme || !g_str_equal (suri->scheme, "webdav")) {
 		/* the book is not for us */
 		soup_uri_free (suri);
-		g_propagate_error (perror, EDB_ERROR_EX (OTHER_ERROR, "Not a webdav uri"));
+		e_data_book_respond_open (book, opid, EDB_ERROR_EX (OTHER_ERROR, "Not a webdav uri"));
 		return;
 	}
 
@@ -1291,7 +1283,7 @@ e_book_backend_webdav_load_source (EBookBackend *backend,
 	priv->uri = soup_uri_to_string (suri, FALSE);
 	if (!priv->uri) {
 		soup_uri_free (suri);
-		g_propagate_error (perror, EDB_ERROR_EX (OTHER_ERROR, "Cannot transform SoupURI to string"));
+		e_data_book_respond_open (book, opid, EDB_ERROR_EX (OTHER_ERROR, "Cannot transform SoupURI to string"));
 		return;
 	}
 
@@ -1310,55 +1302,49 @@ e_book_backend_webdav_load_source (EBookBackend *backend,
 	proxy_settings_changed (priv->proxy, priv);
 	webdav_debug_setup (priv->session);
 
-	e_book_backend_notify_auth_required (backend);
+	e_book_backend_notify_auth_required (backend, NULL);
 	e_book_backend_set_is_loaded (backend, TRUE);
-	e_book_backend_notify_connection_status (backend, TRUE);
-	e_book_backend_set_is_writable (backend, TRUE);
-	e_book_backend_notify_writable (backend, TRUE);
+	e_book_backend_notify_online (backend, TRUE);
+	e_book_backend_set_is_readonly (backend, FALSE);
+	e_book_backend_notify_readonly (backend, FALSE);
 
 	soup_uri_free (suri);
+
+	e_data_book_respond_open (book, opid, NULL /* Success */);
 }
 
 static void
-e_book_backend_webdav_remove (EBookBackend *backend,	EDataBook *book,
-		guint32 opid)
+e_book_backend_webdav_remove (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable)
 {
 	e_data_book_respond_remove (book, opid, EDB_ERROR (SUCCESS));
 }
 
 static void
-e_book_backend_webdav_set_mode (EBookBackend *backend,
-                               EDataBookMode mode)
+e_book_backend_webdav_set_online (EBookBackend *backend, gboolean is_online)
 {
 	EBookBackendWebdav *webdav = E_BOOK_BACKEND_WEBDAV (backend);
 
-	webdav->priv->mode = mode;
+	webdav->priv->is_online = is_online;
 
 	/* set_mode is called before the backend is loaded */
 	if (!e_book_backend_is_loaded (backend))
 		return;
 
-	if (mode == E_DATA_BOOK_MODE_LOCAL) {
-		e_book_backend_set_is_writable (backend, FALSE);
-		e_book_backend_notify_writable (backend, FALSE);
-		e_book_backend_notify_connection_status (backend, FALSE);
-	} else if (mode == E_DATA_BOOK_MODE_REMOTE) {
-		e_book_backend_set_is_writable (backend, TRUE);
-		e_book_backend_notify_writable (backend, TRUE);
-		e_book_backend_notify_connection_status (backend, TRUE);
+	if (!is_online) {
+		e_book_backend_set_is_readonly (backend, TRUE);
+		e_book_backend_notify_readonly (backend, TRUE);
+		e_book_backend_notify_online (backend, FALSE);
+	} else {
+		e_book_backend_set_is_readonly (backend, FALSE);
+		e_book_backend_notify_readonly (backend, FALSE);
+		e_book_backend_notify_online (backend, TRUE);
 	}
 }
 
-static gchar *
-e_book_backend_webdav_get_static_capabilities (EBookBackend *backend)
-{
-	return g_strdup("net,do-initial-query,contact-lists");
-}
-
 static void
-e_book_backend_webdav_cancel_operation (EBookBackend *backend, EDataBook *book, GError **perror)
+e_book_backend_webdav_get_capabilities (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable)
 {
-	g_propagate_error (perror, EDB_ERROR (COULD_NOT_CANCEL));
+	e_data_book_respond_get_capabilities (book, opid, NULL, "net,do-initial-query,contact-lists");
 }
 
 EBookBackend *
@@ -1381,7 +1367,7 @@ e_book_backend_webdav_dispose (GObject *object)
 	do_unref (priv->cache);
 	do_free (priv->uri);
 	do_free (priv->username);
-	do_free (priv->password);
+	if (priv->password) { e_credentials_util_safe_free_string (priv->password); priv->password = NULL; }
 
 	#undef do_unref
 	#undef do_free
@@ -1400,23 +1386,22 @@ e_book_backend_webdav_class_init (EBookBackendWebdavClass *klass)
 	backend_class = E_BOOK_BACKEND_CLASS (klass);
 
 	/* Set the virtual methods. */
-	backend_class->load_source                = e_book_backend_webdav_load_source;
-	backend_class->get_static_capabilities    = e_book_backend_webdav_get_static_capabilities;
-
-	backend_class->create_contact             = e_book_backend_webdav_create_contact;
-	backend_class->remove_contacts            = e_book_backend_webdav_remove_contacts;
-	backend_class->modify_contact             = e_book_backend_webdav_modify_contact;
-	backend_class->get_contact                = e_book_backend_webdav_get_contact;
-	backend_class->get_contact_list           = e_book_backend_webdav_get_contact_list;
-	backend_class->start_book_view            = e_book_backend_webdav_start_book_view;
-	backend_class->stop_book_view             = e_book_backend_webdav_stop_book_view;
-	backend_class->authenticate_user          = e_book_backend_webdav_authenticate_user;
-	backend_class->get_supported_fields       = e_book_backend_webdav_get_supported_fields;
-	backend_class->get_required_fields        = e_book_backend_webdav_get_required_fields;
-	backend_class->cancel_operation           = e_book_backend_webdav_cancel_operation;
-	backend_class->get_supported_auth_methods = e_book_backend_webdav_get_supported_auth_methods;
-	backend_class->remove                     = e_book_backend_webdav_remove;
-	backend_class->set_mode                   = e_book_backend_webdav_set_mode;
+	backend_class->open				= e_book_backend_webdav_open;
+	backend_class->get_capabilities			= e_book_backend_webdav_get_capabilities;
+
+	backend_class->create_contact			= e_book_backend_webdav_create_contact;
+	backend_class->remove_contacts			= e_book_backend_webdav_remove_contacts;
+	backend_class->modify_contact			= e_book_backend_webdav_modify_contact;
+	backend_class->get_contact			= e_book_backend_webdav_get_contact;
+	backend_class->get_contact_list			= e_book_backend_webdav_get_contact_list;
+	backend_class->start_book_view			= e_book_backend_webdav_start_book_view;
+	backend_class->stop_book_view			= e_book_backend_webdav_stop_book_view;
+	backend_class->authenticate_user		= e_book_backend_webdav_authenticate_user;
+	backend_class->get_supported_fields		= e_book_backend_webdav_get_supported_fields;
+	backend_class->get_required_fields		= e_book_backend_webdav_get_required_fields;
+	backend_class->get_supported_auth_methods	= e_book_backend_webdav_get_supported_auth_methods;
+	backend_class->remove				= e_book_backend_webdav_remove;
+	backend_class->set_online			= e_book_backend_webdav_set_online;
 
 	object_class->dispose                     = e_book_backend_webdav_dispose;
 
diff --git a/addressbook/libebook/Makefile.am b/addressbook/libebook/Makefile.am
index 07b3475..682b37a 100644
--- a/addressbook/libebook/Makefile.am
+++ b/addressbook/libebook/Makefile.am
@@ -21,6 +21,7 @@ libebook_1_2_la_CPPFLAGS = \
 libebook_1_2_la_SOURCES =				\
 	$(MARSHAL_GENERATED)				\
 	e-address-western.c				\
+	e-book-client.c					\
 	e-book-query.c					\
 	e-book-view-private.h				\
 	e-book-view.c					\
@@ -46,6 +47,7 @@ libebookincludedir = $(privincludedir)/libebook
 
 libebookinclude_HEADERS =				\
 	e-address-western.h				\
+	e-book-client.h					\
 	e-book-query.h					\
 	e-book-view.h					\
 	e-book-types.h					\
diff --git a/addressbook/libebook/e-book-client.c b/addressbook/libebook/e-book-client.c
new file mode 100644
index 0000000..7cf6cc7
--- /dev/null
+++ b/addressbook/libebook/e-book-client.c
@@ -0,0 +1,2477 @@
+/*
+ * e-book-client.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+#include <glib/gi18n-lib.h>
+#include <gio/gio.h>
+
+#include "libedataserver/e-data-server-util.h"
+
+#include "e-book-client.h"
+#include "e-contact.h"
+#include "e-name-western.h"
+#include "e-book-view-private.h"
+
+#include "e-gdbus-book.h"
+#include "e-gdbus-book-factory.h"
+#include "e-gdbus-book-view.h"
+
+struct _EBookClientPrivate
+{
+	/* GDBus data */
+	GDBusProxy *gdbus_book;
+	guint gone_signal_id;
+};
+
+G_DEFINE_TYPE (EBookClient, e_book_client, E_TYPE_CLIENT)
+
+GQuark
+e_book_client_error_quark (void)
+{
+	static GQuark q = 0;
+	if (q == 0)
+		q = g_quark_from_static_string ("e-book-client-error-quark");
+
+	return q;
+}
+
+const gchar *
+e_book_client_error_to_string (EBookClientError code)
+{
+	switch (code) {
+	case E_BOOK_CLIENT_ERROR_SUCCESS:
+		return C_("BookClientError", "Success");
+	case E_BOOK_CLIENT_ERROR_INVALID_ARG:
+		return C_("BookClientError", "Invalid argument");
+	case E_BOOK_CLIENT_ERROR_BUSY:
+		return C_("BookClientError", "Backend is busy");
+	case E_BOOK_CLIENT_ERROR_REPOSITORY_OFFLINE:
+		return C_("BookClientError", "Repository offline");
+	case E_BOOK_CLIENT_ERROR_NO_SUCH_BOOK:
+		return C_("BookClientError", "No such book");
+	case E_BOOK_CLIENT_ERROR_NO_SELF_CONTACT:
+		return C_("BookClientError", "No self contact");
+	case E_BOOK_CLIENT_ERROR_SOURCE_NOT_LOADED:
+		return C_("BookClientError", "Source not loaded");
+	case E_BOOK_CLIENT_ERROR_SOURCE_ALREADY_LOADED:
+		return C_("BookClientError", "Source already loaded");
+	case E_BOOK_CLIENT_ERROR_PERMISSION_DENIED:
+		return C_("BookClientError", "Permission denied");
+	case E_BOOK_CLIENT_ERROR_CONTACT_NOT_FOUND:
+		return C_("BookClientError", "Contact not found");
+	case E_BOOK_CLIENT_ERROR_CONTACT_ID_ALREADY_EXISTS:
+		return C_("BookClientError", "Contact ID already exists");
+	case E_BOOK_CLIENT_ERROR_PROTOCOL_NOT_SUPPORTED:
+		return C_("BookClientError", "Protocol not supported");
+	case E_BOOK_CLIENT_ERROR_CANCELLED:
+		return C_("BookClientError", "Cancelled");
+	case E_BOOK_CLIENT_ERROR_COULD_NOT_CANCEL:
+		return C_("BookClientError", "Could not cancel");
+	case E_BOOK_CLIENT_ERROR_AUTHENTICATION_FAILED:
+		return C_("BookClientError", "Authentication failed");
+	case E_BOOK_CLIENT_ERROR_AUTHENTICATION_REQUIRED:
+		return C_("BookClientError", "Authentication required");
+	case E_BOOK_CLIENT_ERROR_TLS_NOT_AVAILABLE:
+		return C_("BookClientError", "TLS not available");
+	case E_BOOK_CLIENT_ERROR_DBUS_ERROR:
+		return C_("BookClientError", "D-Bus error");
+	case E_BOOK_CLIENT_ERROR_NO_SUCH_SOURCE:
+		return C_("BookClientError", "No such source");
+	case E_BOOK_CLIENT_ERROR_OFFLINE_UNAVAILABLE:
+		return C_("BookClientError", "Offline unavailable");
+	case E_BOOK_CLIENT_ERROR_OTHER_ERROR:
+		return C_("BookClientError", "Other error");
+	case E_BOOK_CLIENT_ERROR_INVALID_SERVER_VERSION:
+		return C_("BookClientError", "Invalid server version");
+	case E_BOOK_CLIENT_ERROR_UNSUPPORTED_AUTHENTICATION_METHOD:
+		return C_("BookClientError", "Unsupported authentication method");
+	case E_BOOK_CLIENT_ERROR_NO_SPACE:
+		return C_("BookClientError", "No space");
+	case E_BOOK_CLIENT_ERROR_NOT_SUPPORTED:
+		return C_("BookClientError", "Not supported");
+	}
+
+	return C_("BookClientError", "Unknown error");
+}
+
+/**
+ * If the GError is a remote error, extract the EBookClientError embedded inside.
+ * Otherwise return DBUS_ERROR.
+ */
+static EBookClientError
+get_client_error_from_gerror (GError *error)
+{
+	#define err(a,b) "org.gnome.evolution.dataserver.AddressBook." a, b
+	static struct {
+		const gchar *name;
+		EBookClientError err_code;
+	} errors[] = {
+		{ err ("Success",				E_BOOK_CLIENT_ERROR_SUCCESS) },
+		{ err ("RepositoryOffline",			E_BOOK_CLIENT_ERROR_REPOSITORY_OFFLINE) },
+		{ err ("PermissionDenied",			E_BOOK_CLIENT_ERROR_PERMISSION_DENIED) },
+		{ err ("ContactNotFound",			E_BOOK_CLIENT_ERROR_CONTACT_NOT_FOUND) },
+		{ err ("ContactIDAlreadyExists",		E_BOOK_CLIENT_ERROR_CONTACT_ID_ALREADY_EXISTS) },
+		{ err ("AuthenticationFailed",			E_BOOK_CLIENT_ERROR_AUTHENTICATION_FAILED) },
+		{ err ("AuthenticationRequired",		E_BOOK_CLIENT_ERROR_AUTHENTICATION_REQUIRED) },
+		{ err ("UnsupportedField",			E_BOOK_CLIENT_ERROR_OTHER_ERROR) },
+		{ err ("UnsupportedAuthenticationMethod",	E_BOOK_CLIENT_ERROR_UNSUPPORTED_AUTHENTICATION_METHOD) },
+		{ err ("TLSNotAvailable",			E_BOOK_CLIENT_ERROR_TLS_NOT_AVAILABLE) },
+		{ err ("NoSuchBook",				E_BOOK_CLIENT_ERROR_NO_SUCH_BOOK) },
+		{ err ("BookRemoved",				E_BOOK_CLIENT_ERROR_NO_SUCH_SOURCE) },
+		{ err ("OfflineUnavailable",			E_BOOK_CLIENT_ERROR_OFFLINE_UNAVAILABLE) },
+		{ err ("SearchSizeLimitExceeded",		E_BOOK_CLIENT_ERROR_OTHER_ERROR) },
+		{ err ("SearchTimeLimitExceeded",		E_BOOK_CLIENT_ERROR_OTHER_ERROR) },
+		{ err ("InvalidQuery",				E_BOOK_CLIENT_ERROR_OTHER_ERROR) },
+		{ err ("QueryRefused",				E_BOOK_CLIENT_ERROR_OTHER_ERROR) },
+		{ err ("CouldNotCancel",			E_BOOK_CLIENT_ERROR_COULD_NOT_CANCEL) },
+		{ err ("OtherError",				E_BOOK_CLIENT_ERROR_OTHER_ERROR) },
+		{ err ("InvalidServerVersion",			E_BOOK_CLIENT_ERROR_INVALID_SERVER_VERSION) },
+		{ err ("NoSpace",				E_BOOK_CLIENT_ERROR_NO_SPACE) },
+		{ err ("InvalidArg",				E_BOOK_CLIENT_ERROR_INVALID_ARG) },
+		{ err ("NotSupported",				E_BOOK_CLIENT_ERROR_NOT_SUPPORTED) }
+	};
+	#undef err
+
+	if G_LIKELY (error == NULL)
+		return E_BOOK_CLIENT_ERROR_SUCCESS;
+
+	if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_DBUS_ERROR)) {
+		gchar *name;
+		gint i;
+
+		name = g_dbus_error_get_remote_error (error);
+
+		for (i = 0; i < G_N_ELEMENTS (errors); i++) {
+			if (g_ascii_strcasecmp (errors[i].name, name) == 0) {
+				g_free (name);
+				return errors[i].err_code;
+			}
+		}
+
+		g_warning (G_STRLOC ": Unmatched error name %s", name);
+		g_free (name);
+
+		return E_BOOK_CLIENT_ERROR_OTHER_ERROR;
+	} else if (error->domain == E_BOOK_CLIENT_ERROR) {
+		return error->code;
+	} else {
+		/* In this case the error was caused by DBus. Dump the message to the
+		   console as otherwise we have no idea what the problem is. */
+		g_debug ("DBus error: %s", error->message);
+		return E_BOOK_CLIENT_ERROR_DBUS_ERROR;
+	}
+}
+
+/**
+ * If the specified GError is a remote error, then create a new error
+ * representing the remote error.  If the error is anything else, then
+ * leave it alone.
+ */
+static gboolean
+unwrap_dbus_error (GError *error, GError **client_error)
+{
+	if (error == NULL)
+		return TRUE;
+
+	if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_DBUS_ERROR)) {
+		if (client_error) {
+			gint code;
+
+			code = get_client_error_from_gerror (error);
+			g_dbus_error_strip_remote_error (error);
+
+			*client_error = g_error_new_literal (E_BOOK_CLIENT_ERROR, code, error->message);
+		}
+
+		g_error_free (error);
+	} else {
+		if (client_error) {
+			if (error->domain == G_DBUS_ERROR)
+				g_dbus_error_strip_remote_error (error);
+			*client_error = error;
+		} else {
+			g_error_free (error);
+		}
+	}
+
+	return FALSE;
+}
+
+static guint active_book_clients = 0, book_connection_closed_id = 0;
+static EGdbusBookFactory *book_factory_proxy = NULL;
+static GStaticRecMutex book_factory_proxy_lock = G_STATIC_REC_MUTEX_INIT;
+#define LOCK_FACTORY()   g_static_rec_mutex_lock (&book_factory_proxy_lock)
+#define UNLOCK_FACTORY() g_static_rec_mutex_unlock (&book_factory_proxy_lock)
+
+static void gdbus_book_factory_proxy_closed_cb (GDBusConnection *connection, gboolean remote_peer_vanished, GError *error, gpointer user_data);
+
+static void
+gdbus_book_factory_proxy_disconnect (GDBusConnection *connection)
+{
+	LOCK_FACTORY ();
+
+	if (!connection && book_factory_proxy)
+		connection = g_dbus_proxy_get_connection (G_DBUS_PROXY (book_factory_proxy));
+
+	if (connection && book_connection_closed_id) {
+		g_dbus_connection_signal_unsubscribe (connection, book_connection_closed_id);
+		g_signal_handlers_disconnect_by_func (connection, gdbus_book_factory_proxy_closed_cb, NULL);
+	}
+
+	if (book_factory_proxy)
+		g_object_unref (book_factory_proxy);
+
+	book_connection_closed_id = 0;
+	book_factory_proxy = NULL;
+
+	UNLOCK_FACTORY ();
+}
+
+static void
+gdbus_book_factory_proxy_closed_cb (GDBusConnection *connection, gboolean remote_peer_vanished, GError *error, gpointer user_data)
+{
+	GError *err = NULL;
+
+	LOCK_FACTORY ();
+
+	gdbus_book_factory_proxy_disconnect (connection);
+
+	if (error)
+		unwrap_dbus_error (g_error_copy (error), &err);
+
+	if (err) {
+		g_debug ("GDBus connection is closed%s: %s", remote_peer_vanished ? ", remote peer vanished" : "", err->message);
+		g_error_free (err);
+	} else if (active_book_clients) {
+		g_debug ("GDBus connection is closed%s", remote_peer_vanished ? ", remote peer vanished" : "");
+	}
+
+	UNLOCK_FACTORY ();
+}
+
+static void
+gdbus_book_factory_connection_gone_cb (GDBusConnection *connection, const gchar *sender_name, const gchar *object_path, const gchar *interface_name, const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+	/* signal subscription takes care of correct parameters,
+	   thus just do what is to be done here */
+	gdbus_book_factory_proxy_closed_cb (connection, TRUE, NULL, user_data);
+}
+
+static gboolean
+gdbus_book_factory_activate (GError **error)
+{
+	GDBusConnection *connection;
+
+	LOCK_FACTORY ();
+
+	if (G_LIKELY (book_factory_proxy)) {
+		UNLOCK_FACTORY ();
+		return TRUE;
+	}
+
+	book_factory_proxy = e_gdbus_book_factory_proxy_new_for_bus_sync (
+		G_BUS_TYPE_SESSION,
+		G_DBUS_PROXY_FLAGS_NONE,
+		ADDRESS_BOOK_DBUS_SERVICE_NAME,
+		"/org/gnome/evolution/dataserver/AddressBookFactory",
+		NULL,
+		error);
+
+	if (!book_factory_proxy) {
+		UNLOCK_FACTORY ();
+		return FALSE;
+	}
+
+	connection = g_dbus_proxy_get_connection (G_DBUS_PROXY (book_factory_proxy));
+	book_connection_closed_id = g_dbus_connection_signal_subscribe (connection,
+		NULL,						/* sender */
+		"org.freedesktop.DBus",				/* interface */
+		"NameOwnerChanged",				/* member */
+		"/org/freedesktop/DBus",			/* object_path */
+		"org.gnome.evolution.dataserver.AddressBook",	/* arg0 */
+		G_DBUS_SIGNAL_FLAGS_NONE,
+		gdbus_book_factory_connection_gone_cb, NULL, NULL);
+
+	g_signal_connect (connection, "closed", G_CALLBACK (gdbus_book_factory_proxy_closed_cb), NULL);
+
+	UNLOCK_FACTORY ();
+
+	return TRUE;
+}
+
+static void gdbus_book_client_disconnect (EBookClient *client);
+
+/*
+ * Called when the addressbook server dies.
+ */
+static void
+gdbus_book_client_closed_cb (GDBusConnection *connection, gboolean remote_peer_vanished, GError *error, EBookClient *client)
+{
+	GError *err = NULL;
+
+	g_assert (E_IS_BOOK_CLIENT (client));
+
+	if (error)
+		unwrap_dbus_error (g_error_copy (error), &err);
+
+	if (err) {
+		g_debug (G_STRLOC ": EBookClient GDBus connection is closed%s: %s", remote_peer_vanished ? ", remote peer vanished" : "", err->message);
+		g_error_free (err);
+	} else {
+		g_debug (G_STRLOC ": EBookClient GDBus connection is closed%s", remote_peer_vanished ? ", remote peer vanished" : "");
+	}
+
+	gdbus_book_client_disconnect (client);
+
+	e_client_emit_backend_died (E_CLIENT (client));
+}
+
+static void
+gdbus_book_client_connection_gone_cb (GDBusConnection *connection, const gchar *sender_name, const gchar *object_path, const gchar *interface_name, const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+	/* signal subscription takes care of correct parameters,
+	   thus just do what is to be done here */
+	gdbus_book_client_closed_cb (connection, TRUE, NULL, user_data);
+}
+
+static void
+gdbus_book_client_disconnect (EBookClient *client)
+{
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (E_IS_BOOK_CLIENT (client));
+	g_return_if_fail (client->priv != NULL);
+
+	/* Ensure that everything relevant is NULL */
+	LOCK_FACTORY ();
+
+	if (client->priv->gdbus_book) {
+		GDBusConnection *connection = g_dbus_proxy_get_connection (G_DBUS_PROXY (client->priv->gdbus_book));
+
+		g_signal_handlers_disconnect_by_func (connection, gdbus_book_client_closed_cb, client);
+		g_dbus_connection_signal_unsubscribe (connection, client->priv->gone_signal_id);
+		client->priv->gone_signal_id = 0;
+
+		e_gdbus_book_call_close_sync (client->priv->gdbus_book, NULL, NULL);
+		g_object_unref (client->priv->gdbus_book);
+		client->priv->gdbus_book = NULL;
+	}
+
+	UNLOCK_FACTORY ();
+}
+
+static void
+backend_error_cb (EGdbusBook *object, const gchar *message, EBookClient *client)
+{
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (E_IS_BOOK_CLIENT (client));
+	g_return_if_fail (message != NULL);
+
+	e_client_emit_backend_error (E_CLIENT (client), message);
+}
+
+static void
+readonly_cb (EGdbusBook *object, gboolean readonly, EBookClient *client)
+{
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (E_IS_BOOK_CLIENT (client));
+
+	e_client_set_readonly (E_CLIENT (client), readonly);
+}
+
+static void
+online_cb (EGdbusBook *object, gboolean is_online, EBookClient *client)
+{
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (E_IS_BOOK_CLIENT (client));
+
+	e_client_set_online (E_CLIENT (client), is_online);
+}
+
+static void
+auth_required_cb (EGdbusBook *object, const gchar * const *credentials_strv, EBookClient *client)
+{
+	ECredentials *credentials;
+
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (E_IS_BOOK_CLIENT (client));
+
+	if (credentials_strv)
+		credentials = e_credentials_new_strv (credentials_strv);
+	else
+		credentials = e_credentials_new ();
+
+	e_client_process_authentication (E_CLIENT (client), credentials);
+
+	e_credentials_free (credentials);
+}
+
+/**
+ * e_book_client_new:
+ * @source: An #ESource pointer
+ * @error: A #GError pointer
+ *
+ * Creates a new #EBookClient corresponding to the given source.  There are
+ * only two operations that are valid on this book at this point:
+ * e_client_open(), and e_client_remove().
+ *
+ * Returns: a new but unopened #EBookClient.
+ *
+ * Since: 3.2
+ **/
+EBookClient *
+e_book_client_new (ESource *source, GError **error)
+{
+	EBookClient *client;
+	GError *err = NULL;
+	GDBusConnection *connection;
+	gchar *xml, *gdbus_xml = NULL;
+	gchar *path = NULL;
+
+	g_return_val_if_fail (source != NULL, NULL);
+	g_return_val_if_fail (E_IS_SOURCE (source), NULL);
+
+	if (!gdbus_book_factory_activate (&err)) {
+		if (err) {
+			unwrap_dbus_error (err, &err);
+			g_warning ("%s: Failed to run book factory: %s", G_STRFUNC, err->message);
+			g_propagate_error (error, err);
+		} else {
+			g_warning ("%s: Failed to run book factory: Unknown error", G_STRFUNC);
+			g_set_error_literal (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_DBUS_ERROR, _("Failed to run book factory"));
+		}
+
+		return NULL;
+	}
+
+	xml = e_source_to_standalone_xml (source);
+	if (!xml || !*xml) {
+		g_free (xml);
+		g_set_error_literal (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_INVALID_ARG, _("Invalid source"));
+		return NULL;
+	}
+
+	client = g_object_new (E_TYPE_BOOK_CLIENT, "source", source, NULL);
+
+	if (!e_gdbus_book_factory_call_get_book_sync (G_DBUS_PROXY (book_factory_proxy), e_util_ensure_gdbus_string (xml, &gdbus_xml), &path, NULL, &err)) {
+		unwrap_dbus_error (err, &err);
+		g_free (xml);
+		g_free (gdbus_xml);
+		g_warning ("%s: Cannot get book from factory: %s", G_STRFUNC, err ? err->message : "[no error]");
+		if (err)
+			g_propagate_error (error, err);
+		g_object_unref (client);
+
+		return NULL;
+	}
+
+	g_free (xml);
+	g_free (gdbus_xml);
+
+	client->priv->gdbus_book = G_DBUS_PROXY (e_gdbus_book_proxy_new_sync (g_dbus_proxy_get_connection (G_DBUS_PROXY (book_factory_proxy)),
+						      G_DBUS_PROXY_FLAGS_NONE,
+						      ADDRESS_BOOK_DBUS_SERVICE_NAME,
+						      path,
+						      NULL,
+						      &err));
+
+	if (!client->priv->gdbus_book) {
+		g_free (path);
+		unwrap_dbus_error (err, &err);
+		g_warning ("%s: Cannot create cal proxy: %s", G_STRFUNC, err ? err->message : "Unknown error");
+		if (err)
+			g_propagate_error (error, err);
+
+		g_object_unref (client);
+
+		return NULL;
+	}
+
+	g_free (path);
+
+	connection = g_dbus_proxy_get_connection (G_DBUS_PROXY (client->priv->gdbus_book));
+	client->priv->gone_signal_id = g_dbus_connection_signal_subscribe (connection,
+		"org.freedesktop.DBus",				/* sender */
+		"org.freedesktop.DBus",				/* interface */
+		"NameOwnerChanged",				/* member */
+		"/org/freedesktop/DBus",			/* object_path */
+		"org.gnome.evolution.dataserver.AddressBook",	/* arg0 */
+		G_DBUS_SIGNAL_FLAGS_NONE,
+		gdbus_book_client_connection_gone_cb, client, NULL);
+
+	g_signal_connect (connection, "closed", G_CALLBACK (gdbus_book_client_closed_cb), client);
+
+	g_signal_connect (client->priv->gdbus_book, "backend_error", G_CALLBACK (backend_error_cb), client);
+	g_signal_connect (client->priv->gdbus_book, "readonly", G_CALLBACK (readonly_cb), client);
+	g_signal_connect (client->priv->gdbus_book, "online", G_CALLBACK (online_cb), client);
+	g_signal_connect (client->priv->gdbus_book, "auth-required", G_CALLBACK (auth_required_cb), client);
+
+	return client;
+}
+
+/**
+ * e_book_client_new_from_uri:
+ * @uri: the URI to load
+ * @error: A #GError pointer
+ *
+ * Creates a new #EBookClient corresponding to the given uri.  See the
+ * documentation for e_book_client_new() for further information.
+ *
+ * Returns: a new but unopened #EBookClient.
+ *
+ * Since: 3.2
+ **/
+EBookClient *
+e_book_client_new_from_uri (const gchar *uri, GError **error)
+{
+	ESourceList *source_list = NULL;
+	ESource *source;
+	EBookClient *client;
+
+	g_return_val_if_fail (uri != NULL, NULL);
+
+	if (!e_book_client_get_sources (&source_list, error))
+		return NULL;
+
+	source = e_client_util_get_source_for_uri (source_list, uri);
+	if (!source && g_str_has_prefix (uri, "file://")) {
+		gchar *local_uri;
+
+		local_uri = g_strconcat ("local://", uri + 7, NULL);
+		source = e_client_util_get_source_for_uri (source_list, uri);
+
+		g_free (local_uri);
+	}
+
+	if (!source) {
+		g_object_unref (source_list);
+		g_set_error (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_INVALID_ARG, _("Incorrect uri '%s'"), uri);
+
+		return NULL;
+	}
+
+	client = e_book_client_new (source, error);
+
+	g_object_unref (source);
+	g_object_unref (source_list);
+
+	return client;
+}
+
+/**
+ * e_book_client_new_system_addressbook:
+ * @error: A #GError pointer
+ *
+ * Creates a new #EBookClient corresponding to the user's system
+ * addressbook.  See the documentation for e_book_client_new() for further
+ * information.
+ *
+ * Returns: a new but unopened #EBookClient.
+ *
+ * Since: 3.2
+ **/
+EBookClient *
+e_book_client_new_system_addressbook (GError **error)
+{
+	ESourceList *source_list = NULL;
+	ESource *source;
+	EBookClient *client;
+
+	if (!e_book_client_get_sources (&source_list, error))
+		return NULL;
+
+	source = e_client_util_get_system_source (source_list);
+	if (!source) {
+		g_object_unref (source_list);
+		g_set_error_literal (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_NO_SUCH_SOURCE, _("Failed to find system book"));
+
+		return NULL;
+	}
+
+	client = e_book_client_new (source, error);
+
+	g_object_unref (source);
+	g_object_unref (source_list);
+
+	return client;
+}
+
+/**
+ * e_book_client_new_default_addressbook:
+ * @error: return location for a #GError, or %NULL
+ *
+ * Creates a new #EBookClient corresponding to the user's default
+ * address book.  See the documentation for e_book_client_new() for
+ * further information.
+ *
+ * Returns: a new but unopened #EBookClient
+ *
+ * Since: 3.2
+ **/
+EBookClient *
+e_book_client_new_default_addressbook (GError **error)
+{
+	ESourceList *source_list = NULL;
+	ESource *source;
+	EBookClient *client;
+
+	if (!e_book_client_get_sources (&source_list, error))
+		return NULL;
+
+	source = e_source_list_peek_default_source (source_list);
+	if (!source) {
+		g_set_error_literal (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_NO_SUCH_BOOK, _("Address book does not exist"));
+		g_object_unref (source_list);
+
+		return NULL;
+	}
+
+	client = e_book_client_new (source, error);
+
+	g_object_unref (source_list);
+
+	return client;
+}
+
+/**
+ * e_book_client_set_default:
+ * @client: An #EBookClient pointer
+ * @error: A #GError pointer
+ *
+ * Sets the #ESource of the #EBookClient as the "default" addressbook.  This is the source
+ * that will be loaded in the e_book_client_get_default_addressbook() call.
+ *
+ * Returns: %TRUE if the setting was stored in libebook's ESourceList, otherwise %FALSE.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_set_default (EBookClient *client, GError **error)
+{
+	ESource *source;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+
+	source = e_client_get_source (E_CLIENT (client));
+	g_return_val_if_fail (source != NULL, FALSE);
+
+	return e_book_client_set_default_source (source, error);
+}
+
+/**
+ * e_book_client_set_default_source:
+ * @source: An #ESource pointer
+ * @error: A #GError pointer
+ *
+ * Sets @source as the "default" addressbook.  This is the source that
+ * will be loaded in the e_book_client_get_default_addressbook() call.
+ *
+ * Returns: %TRUE if the setting was stored in libebook's ESourceList, otherwise %FALSE.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_set_default_source (ESource *source, GError **error)
+{
+	ESourceList *source_list = NULL;
+	gboolean res = FALSE;
+
+	g_return_val_if_fail (source != NULL, FALSE);
+	g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
+
+	if (!e_book_client_get_sources (&source_list, error))
+		return FALSE;
+
+	res = e_client_util_set_default (source_list, source);
+
+	if (res)
+		res = e_source_list_sync (source_list, error);
+	else
+		g_set_error (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_INVALID_ARG,
+			_("There was no source for UID '%s' stored in a source list."), e_source_peek_uid (source));
+
+	g_object_unref (source_list);
+
+	return res;
+}
+
+/**
+ * e_book_client_get_sources:
+ * @sources: (out): A pointer to an #ESourceList to set
+ * @error: A pointer to a GError to set on error
+ *
+ * Populate @*sources with the list of all sources which have been
+ * added to Evolution.
+ *
+ * Returns: %TRUE if @sources was set, otherwise %FALSE.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_get_sources (ESourceList **sources, GError **error)
+{
+	GConfClient *gconf;
+
+	g_return_val_if_fail (sources != NULL, FALSE);
+
+	gconf = gconf_client_get_default ();
+	*sources = e_source_list_new_for_gconf (gconf, "/apps/evolution/addressbook/sources");
+	g_object_unref (gconf);
+
+	return TRUE;
+}
+
+#define SELF_UID_KEY "/apps/evolution/addressbook/self/self_uid"
+
+static EContact *
+make_me_card (void)
+{
+	GString *vcard;
+	const gchar *s;
+	EContact *contact;
+
+	vcard = g_string_new ("BEGIN:VCARD\nVERSION:3.0\n");
+
+	s = g_get_user_name ();
+	if (s)
+		g_string_append_printf (vcard, "NICKNAME:%s\n", s);
+
+	s = g_get_real_name ();
+	if (s && strcmp (s, "Unknown") != 0) {
+		ENameWestern *western;
+
+		g_string_append_printf (vcard, "FN:%s\n", s);
+
+		western = e_name_western_parse (s);
+		g_string_append_printf (vcard, "N:%s;%s;%s;%s;%s\n",
+					western->last ? western->last : "",
+					western->first ? western->first : "",
+					western->middle ? western->middle : "",
+					western->prefix ? western->prefix : "",
+					western->suffix ? western->suffix : "");
+		e_name_western_free (western);
+	}
+	g_string_append (vcard, "END:VCARD");
+
+	contact = e_contact_new_from_vcard (vcard->str);
+
+	g_string_free (vcard, TRUE);
+
+	return contact;
+}
+
+/**
+ * e_book_client_get_self:
+ * @contact: an #EContact pointer to set
+ * @client: an #EBookClient pointer to set
+ * @error: a #GError to set on failure
+ *
+ * Get the #EContact referring to the user of the address book
+ * and set it in @contact and @client.
+ *
+ * Returns: %TRUE if successful, otherwise %FALSE.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_get_self (EContact **contact, EBookClient **client, GError **error)
+{
+	GError *local_error = NULL;
+	GConfClient *gconf;
+	gchar *uid;
+
+	g_return_val_if_fail (contact != NULL, FALSE);
+	g_return_val_if_fail (client != NULL, FALSE);
+
+	*client = e_book_client_new_system_addressbook (&local_error);
+	if (!*client) {
+		g_propagate_error (error, local_error);
+		return FALSE;
+	}
+
+	if (!e_client_open_sync (E_CLIENT (*client), FALSE, NULL, &local_error)) {
+		g_object_unref (*client);
+		*client = NULL;
+		g_propagate_error (error, local_error);
+
+		return FALSE;
+	}
+
+	gconf = gconf_client_get_default ();
+	uid = gconf_client_get_string (gconf, SELF_UID_KEY, NULL);
+	g_object_unref (gconf);
+
+	if (uid) {
+		gboolean got;
+
+		/* Don't care about errors because we'll create a new card on failure */
+		got = e_book_client_get_contact_sync (*client, uid, contact, NULL, NULL);
+		g_free (uid);
+		if (got)
+			return TRUE;
+	}
+
+	uid = NULL;
+	*contact = make_me_card ();
+	if (!e_book_client_add_contact_sync (*client, *contact, &uid, NULL, &local_error)) {
+		g_object_unref (*client);
+		*client = NULL;
+		g_object_unref (*contact);
+		*contact = NULL;
+		g_propagate_error (error, local_error);
+		return FALSE;
+	}
+
+	if (uid) {
+		e_contact_set (*contact, E_CONTACT_UID, uid);
+		g_free (uid);
+	}
+
+	e_book_client_set_self (*client, *contact, NULL);
+
+	return TRUE;
+}
+
+/**
+ * e_book_client_set_self:
+ * @client: an #EBookClient
+ * @contact: an #EContact
+ * @error: a #GError to set on failure
+ *
+ * Specify that @contact residing in @client is the #EContact that
+ * refers to the user of the address book.
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_set_self (EBookClient *client, EContact *contact, GError **error)
+{
+	GConfClient *gconf;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (contact != NULL, FALSE);
+	g_return_val_if_fail (e_contact_get_const (contact, E_CONTACT_UID) != NULL, FALSE);
+
+	gconf = gconf_client_get_default ();
+	gconf_client_set_string (gconf, SELF_UID_KEY, e_contact_get_const (contact, E_CONTACT_UID), NULL);
+	g_object_unref (gconf);
+
+	return TRUE;
+}
+
+/**
+ * e_book_client_is_self:
+ * @contact: an #EContact
+ *
+ * Check if @contact is the user of the address book.
+ *
+ * Returns: %TRUE if @contact is the user, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_is_self (EContact *contact)
+{
+	GConfClient *gconf;
+	gchar *uid;
+	gboolean is_self;
+
+	g_return_val_if_fail (contact && E_IS_CONTACT (contact), FALSE);
+
+	gconf = gconf_client_get_default ();
+	uid = gconf_client_get_string (gconf, SELF_UID_KEY, NULL);
+	g_object_unref (gconf);
+
+	is_self = uid && !g_strcmp0 (uid, e_contact_get_const (contact, E_CONTACT_UID));
+
+	g_free (uid);
+
+	return is_self;
+}
+
+static guint32
+book_client_open (EClient *client, gboolean only_if_exists, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	return e_client_proxy_call_boolean (client, only_if_exists, cancellable, callback, user_data, book_client_open,
+			e_gdbus_book_call_open,
+			e_gdbus_book_call_open_finish, NULL, NULL, NULL, NULL);
+}
+
+static gboolean
+book_client_open_finish (EClient *client, GAsyncResult *result, GError **error)
+{
+	return e_client_proxy_call_finish_void (client, result, error, book_client_open);
+}
+
+static gboolean
+book_client_open_sync (EClient *client, gboolean only_if_exists, GCancellable *cancellable, GError **error)
+{
+	EBookClient *book_client;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
+
+	book_client = E_BOOK_CLIENT (client);
+	g_return_val_if_fail (book_client != NULL, FALSE);
+	g_return_val_if_fail (book_client->priv != NULL, FALSE);
+
+	if (!book_client->priv->gdbus_book) {
+		g_set_error_literal (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_DBUS_ERROR, _("D-Bus book proxy gone"));
+		return FALSE;
+	}
+
+	return e_client_proxy_call_sync_boolean__void (client, only_if_exists, cancellable, error, e_gdbus_book_call_open_sync);
+}
+
+static guint32
+book_client_remove (EClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	return e_client_proxy_call_void (client, cancellable, callback, user_data, book_client_remove,
+			e_gdbus_book_call_remove,
+			e_gdbus_book_call_remove_finish, NULL, NULL, NULL, NULL);
+}
+
+static gboolean
+book_client_remove_finish (EClient *client, GAsyncResult *result, GError **error)
+{
+	return e_client_proxy_call_finish_void (client, result, error, book_client_remove);
+}
+
+static gboolean
+book_client_remove_sync (EClient *client, GCancellable *cancellable, GError **error)
+{
+	EBookClient *book_client;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
+
+	book_client = E_BOOK_CLIENT (client);
+	g_return_val_if_fail (book_client != NULL, FALSE);
+	g_return_val_if_fail (book_client->priv != NULL, FALSE);
+
+	if (!book_client->priv->gdbus_book) {
+		g_set_error_literal (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_DBUS_ERROR, _("D-Bus book proxy gone"));
+		return FALSE;
+	}
+
+	return e_client_proxy_call_sync_void__void (client, cancellable, error, e_gdbus_book_call_remove_sync);
+}
+
+
+/**
+ * e_book_client_get_capabilities:
+ * @client: an #EBookClient
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Starts retrieval of the list of capabilities which the backend for this address book
+ * supports. The call is finished by e_book_client_get_capabilities_finish() from
+ * the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Note: Usually is sufficient to use e_client_get_capabilities() or e_client_check_capability(),
+ * which caches capabilities of a backend on the client side.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_book_client_get_capabilities (EBookClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	return e_client_proxy_call_void (E_CLIENT (client), cancellable, callback, user_data, e_book_client_get_capabilities,
+			e_gdbus_book_call_get_capabilities,
+			NULL, NULL, e_gdbus_book_call_get_capabilities_finish, NULL, NULL);
+}
+
+/**
+ * e_book_client_get_capabilities_finish:
+ * @client: an #EBookClient
+ * @result: a #GAsyncResult
+ * @capabilities: (out): list of strings with capabilities
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_book_client_get_capabilities() and
+ * sets @capabilities to a list of strings of backend capabilities.
+ * This list should be freed with e_client_util_free_string_slist().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_get_capabilities_finish (EBookClient *client, GAsyncResult *result, GSList **capabilities, GError **error)
+{
+	gboolean res;
+	gchar *out_string = NULL;
+
+	g_return_val_if_fail (capabilities != NULL, FALSE);
+
+	res = e_client_proxy_call_finish_string (E_CLIENT (client), result, &out_string, error, e_book_client_get_capabilities);
+
+	if (res && out_string)
+		*capabilities = e_client_util_parse_capabilities (out_string);
+	else
+		*capabilities = NULL;
+
+	g_free (out_string);
+
+	return res;
+}
+
+/**
+ * e_book_client_get_capabilities_sync:
+ * @client: an #EBookClient
+ * @capabilities: (out): list of strings with capabilities
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Retrieves a list of capabilities which the backend for this address book
+ * supports and sets @capabilities to that list.
+ * This list should be freed with e_client_util_free_string_slist().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Note: Usually is sufficient to use e_client_get_capabilities() or e_client_check_capability(),
+ * which caches capabilities of a backend on the client side.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_get_capabilities_sync (EBookClient *client, GSList **capabilities, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar *out_string = NULL;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (capabilities != NULL, FALSE);
+
+	if (!client->priv->gdbus_book) {
+		g_set_error_literal (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_DBUS_ERROR, _("D-Bus book proxy gone"));
+		return FALSE;
+	}
+
+	res = e_client_proxy_call_sync_void__string (E_CLIENT (client), &out_string, cancellable, error, e_gdbus_book_call_get_capabilities_sync);
+
+	if (res && out_string)
+		*capabilities = e_client_util_parse_capabilities (out_string);
+	else
+		*capabilities = NULL;
+
+	g_free (out_string);
+
+	return res;
+}
+
+/**
+ * e_book_client_get_required_fields:
+ * @client: an #EBookClient
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Gets a list of fields that are required to be filled in for
+ * all contacts in this @client. The call is finished by
+ * e_book_client_get_required_fields_finish() from the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_book_client_get_required_fields (EBookClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	return e_client_proxy_call_void (E_CLIENT (client), cancellable, callback, user_data, e_book_client_get_required_fields,
+			e_gdbus_book_call_get_required_fields,
+			NULL, NULL, NULL, e_gdbus_book_call_get_required_fields_finish, NULL);
+}
+
+/**
+ * e_book_client_get_required_fields_finish:
+ * @client: an #EBookClient
+ * @result: a #GAsyncResult
+ * @fields: (out): list of strings with required fields
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_book_client_get_required_fields() and
+ * sets @fields to a list of strings of required fields by a backend.
+ * This list should be freed with e_client_util_free_string_slist().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_get_required_fields_finish (EBookClient *client, GAsyncResult *result, GSList **fields, GError **error)
+{
+	gboolean res;
+	gchar **out_strv = NULL;
+
+	g_return_val_if_fail (fields != NULL, FALSE);
+
+	res = e_client_proxy_call_finish_strv (E_CLIENT (client), result, &out_strv, error, e_book_client_get_required_fields);
+
+	if (res && out_strv)
+		*fields = e_client_util_strv_to_slist ((const gchar * const *) out_strv);
+	else
+		*fields = NULL;
+
+	g_strfreev (out_strv);
+
+	return res;
+}
+
+/**
+ * e_book_client_get_required_fields_sync:
+ * @client: an #EBookClient
+ * @fields: (out): list of strings with required fields
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Gets a list of fields that are required to be filled in for
+ * all contacts in this @client. Sets @fields to a list of strings
+ * of required fields by a backend.
+ * This list should be freed with e_client_util_free_string_slist().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_get_required_fields_sync (EBookClient *client, GSList **fields, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar **out_strv = NULL;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (fields != NULL, FALSE);
+
+	if (!client->priv->gdbus_book) {
+		g_set_error_literal (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_DBUS_ERROR, _("D-Bus book proxy gone"));
+		return FALSE;
+	}
+
+	res = e_client_proxy_call_sync_void__strv (E_CLIENT (client), &out_strv, cancellable, error, e_gdbus_book_call_get_required_fields_sync);
+
+	if (res && out_strv)
+		*fields = e_client_util_strv_to_slist ((const gchar * const *) out_strv);
+	else
+		*fields = NULL;
+
+	g_strfreev (out_strv);
+
+	return res;
+}
+
+/**
+ * e_book_client_get_supported_fields:
+ * @client: an #EBookClient
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Gets a list of fields that can be stored for contacts
+ * in this @client. Other fields may be discarded. The call is finished by
+ * e_book_client_get_supported_fields_finish() from the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_book_client_get_supported_fields (EBookClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	return e_client_proxy_call_void (E_CLIENT (client), cancellable, callback, user_data, e_book_client_get_supported_fields,
+			e_gdbus_book_call_get_supported_fields,
+			NULL, NULL, NULL, e_gdbus_book_call_get_supported_fields_finish, NULL);
+}
+
+/**
+ * e_book_client_get_supported_fields_finish:
+ * @client: an #EBookClient
+ * @result: a #GAsyncResult
+ * @fields: (out): list of strings with supported fields
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_book_client_get_supported_fields() and
+ * sets @fields to a list of strings of supported fields by a backend.
+ * This list should be freed with e_client_util_free_string_slist().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_get_supported_fields_finish (EBookClient *client, GAsyncResult *result, GSList **fields, GError **error)
+{
+	gboolean res;
+	gchar **out_strv = NULL;
+
+	g_return_val_if_fail (fields != NULL, FALSE);
+
+	res = e_client_proxy_call_finish_strv (E_CLIENT (client), result, &out_strv, error, e_book_client_get_supported_fields);
+
+	if (res && out_strv)
+		*fields = e_client_util_strv_to_slist ((const gchar * const *) out_strv);
+	else
+		*fields = NULL;
+
+	g_strfreev (out_strv);
+
+	return res;
+}
+
+/**
+ * e_book_client_get_supported_fields_sync:
+ * @client: an #EBookClient
+ * @fields: (out): list of strings with supported fields
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Gets a list of fields that can be stored for contacts
+ * in this @client. Other fields may be discarded. Sets @fields
+ * to a list of strings of required fields by a backend.
+ * This list should be freed with e_client_util_free_string_slist().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_get_supported_fields_sync (EBookClient *client, GSList **fields, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar **out_strv = NULL;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+
+	if (!client->priv->gdbus_book) {
+		g_set_error_literal (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_DBUS_ERROR, _("D-Bus book proxy gone"));
+		return FALSE;
+	}
+
+	res = e_client_proxy_call_sync_void__strv (E_CLIENT (client), &out_strv, cancellable, error, e_gdbus_book_call_get_supported_fields_sync);
+
+	if (res && out_strv)
+		*fields = e_client_util_strv_to_slist ((const gchar * const *) out_strv);
+	else
+		*fields = NULL;
+
+	g_strfreev (out_strv);
+
+	return res;
+}
+
+/**
+ * e_book_client_get_supported_auth_methods:
+ * @client: an #EBookClient
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Queries @client for the list of authentication methods it supports.
+ * The call is finished by e_book_client_get_supported_auth_methods_finish()
+ * from the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_book_client_get_supported_auth_methods (EBookClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	return e_client_proxy_call_void (E_CLIENT (client), cancellable, callback, user_data, e_book_client_get_supported_auth_methods,
+			e_gdbus_book_call_get_supported_auth_methods,
+			NULL, NULL, NULL, e_gdbus_book_call_get_supported_auth_methods_finish, NULL);
+}
+
+/**
+ * e_book_client_get_supported_auth_methods_finish:
+ * @client: an #EBookClient
+ * @result: a #GAsyncResult
+ * @auth_methods: (out): list of strings with supported authentication methods
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_book_client_get_supported_auth_methods() and
+ * sets @auth_methods to a list of strings of supported authentication methods by a backend.
+ * This list should be freed with e_client_util_free_string_slist().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_get_supported_auth_methods_finish	(EBookClient *client, GAsyncResult *result, GSList **auth_methods, GError **error)
+{
+	gboolean res;
+	gchar **out_strv = NULL;
+
+	res = e_client_proxy_call_finish_strv (E_CLIENT (client), result, &out_strv, error, e_book_client_get_supported_auth_methods);
+
+	if (res && out_strv)
+		*auth_methods = e_client_util_strv_to_slist ((const gchar * const *) out_strv);
+	else
+		*auth_methods = NULL;
+
+	g_strfreev (out_strv);
+
+	return res;
+}
+
+/**
+ * e_book_client_get_supported_auth_methods_sync:
+ * @client: an #EBookClient
+ * @auth_methods: (out): list of strings with supported authentication methods
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Queries @client for the list of authentication methods it supports.
+ * This list should be freed with e_client_util_free_string_slist().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_get_supported_auth_methods_sync (EBookClient *client, GSList **auth_methods, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar **out_strv = NULL;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+
+	if (!client->priv->gdbus_book) {
+		g_set_error_literal (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_DBUS_ERROR, _("D-Bus book proxy gone"));
+		return FALSE;
+	}
+
+	res = e_client_proxy_call_sync_void__strv (E_CLIENT (client), &out_strv, cancellable, error, e_gdbus_book_call_get_supported_auth_methods_sync);
+
+	if (res && out_strv)
+		*auth_methods = e_client_util_strv_to_slist ((const gchar * const *) out_strv);
+	else
+		*auth_methods = NULL;
+
+	g_strfreev (out_strv);
+
+	return res;
+}
+
+/**
+ * e_book_client_add_contact:
+ * @client: an #EBookClient
+ * @contact: an #EContact
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Adds @contact to @client.
+ * The call is finished by e_book_client_add_contact_finish()
+ * from the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_book_client_add_contact (EBookClient *client, const EContact *contact, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	guint32 opid;
+	gchar *vcard, *gdbus_vcard = NULL;
+
+	g_return_val_if_fail (contact != NULL, 0);
+	g_return_val_if_fail (E_IS_CONTACT (contact), 0);
+
+	vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
+
+	opid = e_client_proxy_call_string (E_CLIENT (client), e_util_ensure_gdbus_string (vcard, &gdbus_vcard), cancellable, callback, user_data, e_book_client_add_contact,
+			e_gdbus_book_call_add_contact,
+			NULL, NULL, e_gdbus_book_call_add_contact_finish, NULL, NULL);
+
+	g_free (vcard);
+	g_free (gdbus_vcard);
+
+	return opid;
+}
+
+/**
+ * e_book_client_add_contact_finish:
+ * @client: an #EBookClient
+ * @result: a #GAsyncResult
+ * @added_uid: (out): UID of a newly added contact; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_book_client_add_contact() and
+ * sets @added_uid to a UID of a newly added contact.
+ * This string should be freed with g_free().
+ *
+ * Note: This is not modifying original #EContact.
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_add_contact_finish (EBookClient *client, GAsyncResult *result, gchar **added_uid, GError **error)
+{
+	gboolean res;
+	gchar *out_uid = NULL;
+
+	res = e_client_proxy_call_finish_string (E_CLIENT (client), result, &out_uid, error, e_book_client_add_contact);
+
+	if (res && out_uid && added_uid) {
+		*added_uid = out_uid;
+	} else {
+		g_free (out_uid);
+		if (added_uid)
+			*added_uid = NULL;
+	}
+
+	return res;
+}
+
+/**
+ * e_book_client_add_contact_sync:
+ * @client: an #EBookClient
+ * @contact: an #EContact
+ * @added_uid: (out): UID of a newly added contact; can be %NULL
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Adds @contact to @client and
+ * sets @added_uid to a UID of a newly added contact.
+ * This string should be freed with g_free().
+ *
+ * Note: This is not modifying original @contact, thus if it's needed,
+ * then use e_contact_set (contact, E_CONTACT_UID, new_uid).
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_add_contact_sync (EBookClient *client, const EContact *contact, gchar **added_uid, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar *vcard, *gdbus_vcard = NULL, *out_uid = NULL;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+
+	if (!client->priv->gdbus_book) {
+		g_set_error_literal (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_DBUS_ERROR, _("D-Bus book proxy gone"));
+		return FALSE;
+	}
+
+	vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
+
+	res = e_client_proxy_call_sync_string__string (E_CLIENT (client), e_util_ensure_gdbus_string (vcard, &gdbus_vcard), &out_uid, cancellable, error, e_gdbus_book_call_add_contact_sync);
+
+	if (res && out_uid && added_uid) {
+		*added_uid = out_uid;
+	} else {
+		g_free (out_uid);
+		if (added_uid)
+			*added_uid = NULL;
+	}
+
+	g_free (vcard);
+	g_free (gdbus_vcard);
+
+	return res;
+}
+
+/**
+ * e_book_client_modify_contact:
+ * @client: an #EBookClient
+ * @contact: an #EContact
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Applies the changes made to @contact to the stored version in @client.
+ * The call is finished by e_book_client_modify_contact_finish()
+ * from the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_book_client_modify_contact (EBookClient *client, const EContact *contact, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	guint32 opid;
+	gchar *vcard, *gdbus_vcard = NULL;
+
+	g_return_val_if_fail (contact != NULL, 0);
+	g_return_val_if_fail (E_IS_CONTACT (contact), 0);
+
+	vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
+
+	opid = e_client_proxy_call_string (E_CLIENT (client), e_util_ensure_gdbus_string (vcard, &gdbus_vcard), cancellable, callback, user_data, e_book_client_modify_contact,
+			e_gdbus_book_call_modify_contact,
+			e_gdbus_book_call_modify_contact_finish, NULL, NULL, NULL, NULL);
+
+	g_free (vcard);
+	g_free (gdbus_vcard);
+
+	return opid;
+}
+
+/**
+ * e_book_client_modify_contact_finish:
+ * @client: an #EBookClient
+ * @result: a #GAsyncResult
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_book_client_modify_contact().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_modify_contact_finish (EBookClient *client, GAsyncResult *result, GError **error)
+{
+	return e_client_proxy_call_finish_void (E_CLIENT (client), result, error, e_book_client_modify_contact);
+}
+
+/**
+ * e_book_client_modify_contact_sync:
+ * @client: an #EBookClient
+ * @contact: an #EContact
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Applies the changes made to @contact to the stored version in @client.
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_modify_contact_sync (EBookClient *client, const EContact *contact, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar *vcard, *gdbus_vcard = NULL;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+
+	if (!client->priv->gdbus_book) {
+		g_set_error_literal (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_DBUS_ERROR, _("D-Bus book proxy gone"));
+		return FALSE;
+	}
+
+	vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
+
+	res = e_client_proxy_call_sync_string__void (E_CLIENT (client), e_util_ensure_gdbus_string (vcard, &gdbus_vcard), cancellable, error, e_gdbus_book_call_modify_contact_sync);
+
+	g_free (vcard);
+	g_free (gdbus_vcard);
+
+	return res;
+}
+
+/**
+ * e_book_client_remove_contact:
+ * @client: an #EBookClient
+ * @contact: an #EContact
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Removes @contact from the @client.
+ * The call is finished by e_book_client_remove_contact_finish()
+ * from the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_book_client_remove_contact (EBookClient *client, const EContact *contact, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	guint32 opid;
+	gchar *uid;
+	const gchar *lst[2];
+
+	g_return_val_if_fail (contact != NULL, 0);
+	g_return_val_if_fail (E_IS_CONTACT (contact), 0);
+
+	uid = e_util_utf8_make_valid (e_contact_get_const ((EContact *) contact, E_CONTACT_UID));
+	g_return_val_if_fail (uid != NULL, 0);
+
+	lst[0] = uid;
+	lst[1] = NULL;
+
+	opid = e_client_proxy_call_strv (E_CLIENT (client), lst, cancellable, callback, user_data, e_book_client_remove_contact,
+			e_gdbus_book_call_remove_contacts,
+			e_gdbus_book_call_remove_contacts_finish, NULL, NULL, NULL, NULL);
+
+	g_free (uid);
+
+	return opid;
+}
+
+/**
+ * e_book_client_remove_contact_finish:
+ * @client: an #EBookClient
+ * @result: a #GAsyncResult
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_book_client_remove_contact().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_remove_contact_finish (EBookClient *client, GAsyncResult *result, GError **error)
+{
+	return e_client_proxy_call_finish_void (E_CLIENT (client), result, error, e_book_client_remove_contact);
+}
+
+/**
+ * e_book_client_remove_contact_sync:
+ * @client: an #EBookClient
+ * @contact: an #EContact
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Removes @contact from the @client.
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_remove_contact_sync (EBookClient *client, const EContact *contact, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar *uid;
+	const gchar *lst[2];
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (contact != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CONTACT (contact), FALSE);
+
+	if (!client->priv->gdbus_book) {
+		g_set_error_literal (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_DBUS_ERROR, _("D-Bus book proxy gone"));
+		return FALSE;
+	}
+
+	uid = e_util_utf8_make_valid (e_contact_get_const ((EContact *) contact, E_CONTACT_UID));
+	g_return_val_if_fail (uid != NULL, 0);
+
+	lst[0] = uid;
+	lst[1] = NULL;
+
+	res = e_client_proxy_call_sync_strv__void (E_CLIENT (client), lst, cancellable, error, e_gdbus_book_call_remove_contacts_sync);
+
+	g_free (uid);
+
+	return res;
+}
+
+/**
+ * e_book_client_remove_contact_by_uid:
+ * @client: an #EBookClient
+ * @uid: a UID of a contact to remove
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Removes contact with @uid from the @client.
+ * The call is finished by e_book_client_remove_contact_by_uid_finish()
+ * from the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_book_client_remove_contact_by_uid (EBookClient *client, const gchar *uid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	guint32 opid;
+	gchar *safe_uid;
+	const gchar *lst[2];
+
+	g_return_val_if_fail (uid != NULL, 0);
+
+	safe_uid = e_util_utf8_make_valid (uid);
+	g_return_val_if_fail (safe_uid != NULL, 0);
+
+	lst[0] = safe_uid;
+	lst[1] = NULL;
+
+	opid = e_client_proxy_call_strv (E_CLIENT (client), lst, cancellable, callback, user_data, e_book_client_remove_contact_by_uid,
+			e_gdbus_book_call_remove_contacts,
+			e_gdbus_book_call_remove_contacts_finish, NULL, NULL, NULL, NULL);
+
+	g_free (safe_uid);
+
+	return opid;
+}
+
+/**
+ * e_book_client_remove_contact_by_uid_finish:
+ * @client: an #EBookClient
+ * @result: a #GAsyncResult
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_book_client_remove_contact_by_uid().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_remove_contact_by_uid_finish (EBookClient *client, GAsyncResult *result, GError **error)
+{
+	return e_client_proxy_call_finish_void (E_CLIENT (client), result, error, e_book_client_remove_contact_by_uid);
+}
+
+/**
+ * e_book_client_remove_contact_by_uid_sync:
+ * @client: an #EBookClient
+ * @uid: a UID of a contact to remove
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Removes contact with @uid from the @client.
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_remove_contact_by_uid_sync (EBookClient *client, const gchar *uid, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar *safe_uid;
+	const gchar *lst[2];
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (uid != NULL, FALSE);
+
+	if (!client->priv->gdbus_book) {
+		g_set_error_literal (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_DBUS_ERROR, _("D-Bus book proxy gone"));
+		return FALSE;
+	}
+
+	safe_uid = e_util_utf8_make_valid (uid);
+	g_return_val_if_fail (safe_uid != NULL, FALSE);
+
+	lst[0] = safe_uid;
+	lst[1] = NULL;
+
+	res = e_client_proxy_call_sync_strv__void (E_CLIENT (client), lst, cancellable, error, e_gdbus_book_call_remove_contacts_sync);
+
+	g_free (safe_uid);
+
+	return res;
+}
+
+/**
+ * e_book_client_remove_contacts:
+ * @client: an #EBookClient
+ * @uids: a #GSList of UIDs to remove
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Removes the contacts with uids from the list @uids from @client.  This is
+ * always more efficient than calling e_book_client_remove_contact() if you
+ * have more than one uid to remove, as some backends can implement it
+ * as a batch request.
+ * The call is finished by e_book_client_remove_contacts_finish()
+ * from the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_book_client_remove_contacts (EBookClient *client, const GSList *uids, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	guint32 opid;
+	gchar **lst;
+
+	g_return_val_if_fail (uids != NULL, 0);
+
+	lst = e_client_util_slist_to_strv (uids);
+	g_return_val_if_fail (lst != NULL, 0);
+
+	opid = e_client_proxy_call_strv (E_CLIENT (client), (const gchar * const *) lst, cancellable, callback, user_data, e_book_client_remove_contacts,
+			e_gdbus_book_call_remove_contacts,
+			e_gdbus_book_call_remove_contacts_finish, NULL, NULL, NULL, NULL);
+
+	g_strfreev (lst);
+
+	return opid;
+}
+
+/**
+ * e_book_client_remove_contacts_finish:
+ * @client: an #EBookClient
+ * @result: a #GAsyncResult
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_book_client_remove_contacts().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_remove_contacts_finish (EBookClient *client, GAsyncResult *result, GError **error)
+{
+	return e_client_proxy_call_finish_void (E_CLIENT (client), result, error, e_book_client_remove_contacts);
+}
+
+/**
+ * e_book_client_remove_contacts_sync:
+ * @client: an #EBookClient
+ * @uids: a #GSList of UIDs to remove
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Removes the contacts with uids from the list @uids from @client.  This is
+ * always more efficient than calling e_book_client_remove_contact() if you
+ * have more than one uid to remove, as some backends can implement it
+ * as a batch request.
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_remove_contacts_sync (EBookClient *client, const GSList *uids, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar **lst;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (uids != NULL, FALSE);
+
+	if (!client->priv->gdbus_book) {
+		g_set_error_literal (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_DBUS_ERROR, _("D-Bus book proxy gone"));
+		return FALSE;
+	}
+
+	lst = e_client_util_slist_to_strv (uids);
+	g_return_val_if_fail (lst != NULL, FALSE);
+
+	res = e_client_proxy_call_sync_strv__void (E_CLIENT (client), (const gchar * const *) lst, cancellable, error, e_gdbus_book_call_remove_contacts_sync);
+
+	g_strfreev (lst);
+
+	return res;
+}
+
+/**
+ * e_book_client_get_contact:
+ * @client: an #EBookClient
+ * @uid: a unique string ID specifying the contact
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Receive #EContact from the @client for the gived @uid.
+ * The call is finished by e_book_client_get_contact_finish()
+ * from the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_book_client_get_contact (EBookClient *client, const gchar *uid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	guint32 opid;
+	gchar *safe_uid;
+
+	g_return_val_if_fail (uid != NULL, 0);
+
+	safe_uid = e_util_utf8_make_valid (uid);
+	g_return_val_if_fail (safe_uid != NULL, 0);
+	
+	opid = e_client_proxy_call_string (E_CLIENT (client), safe_uid, cancellable, callback, user_data, e_book_client_get_contact,
+			e_gdbus_book_call_get_contact,
+			NULL, NULL, e_gdbus_book_call_get_contact_finish, NULL, NULL);
+
+	g_free (safe_uid);
+
+	return opid;
+}
+
+/**
+ * e_book_client_get_contact_finish:
+ * @client: an #EBookClient
+ * @result: a #GAsyncResult
+ * @contact: (out) an #EContact for previously given uid
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_book_client_get_contact().
+ * If successful, then the @contact is set to newly allocated
+ * #EContact, which should be freed with g_object_unref().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_get_contact_finish (EBookClient *client, GAsyncResult *result, EContact **contact, GError **error)
+{
+	gboolean res;
+	gchar *vcard = NULL;
+
+	g_return_val_if_fail (contact != NULL, FALSE);
+
+	res = e_client_proxy_call_finish_string (E_CLIENT (client), result, &vcard, error, e_book_client_get_contact);
+
+	if (vcard && res)
+		*contact = e_contact_new_from_vcard (vcard);
+	else
+		*contact = NULL;
+
+	g_free (vcard);
+
+	return res;
+}
+
+/**
+ * e_book_client_get_contact_sync:
+ * @client: an #EBookClient
+ * @uid: a unique string ID specifying the contact
+ * @contact: (out) an #EContact for given @uid
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Receive #EContact from the @client for the gived @uid.
+ * If successful, then the @contact is set to newly allocated
+ * #EContact, which should be freed with g_object_unref().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_get_contact_sync (EBookClient *client, const gchar *uid, EContact **contact, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar *vcard = NULL, *safe_uid;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (uid != NULL, FALSE);
+	g_return_val_if_fail (contact != NULL, FALSE);
+
+	if (!client->priv->gdbus_book) {
+		g_set_error_literal (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_DBUS_ERROR, _("D-Bus book proxy gone"));
+		return FALSE;
+	}
+
+	safe_uid = e_util_utf8_make_valid (uid);
+	g_return_val_if_fail (safe_uid != NULL, FALSE);
+
+	res = e_client_proxy_call_sync_string__string (E_CLIENT (client), safe_uid, &vcard, cancellable, error, e_gdbus_book_call_get_contact_sync);
+
+	if (vcard && res)
+		*contact = e_contact_new_from_vcard (vcard);
+	else
+		*contact = NULL;
+
+	g_free (safe_uid);
+	g_free (vcard);
+
+	return res;
+}
+
+/**
+ * e_book_client_get_contacts:
+ * @client: an #EBookClient
+ * @query: an #EBookQuery
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Query @client with @query, receiving a list of contacts which
+ * matched. The call is finished by e_book_client_get_contacts_finish()
+ * from the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_book_client_get_contacts (EBookClient *client, const EBookQuery *query, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	guint32 opid;
+	gchar *sexp, *gdbus_sexp = NULL;
+
+	g_return_val_if_fail (query != NULL, 0);
+
+	sexp = e_book_query_to_string ((EBookQuery *) query);
+
+	opid = e_client_proxy_call_string (E_CLIENT (client), e_util_ensure_gdbus_string (sexp, &gdbus_sexp), cancellable, callback, user_data, e_book_client_get_contacts,
+			e_gdbus_book_call_get_contact_list,
+			NULL, NULL, NULL, e_gdbus_book_call_get_contact_list_finish, NULL);
+
+	g_free (sexp);
+	g_free (gdbus_sexp);
+
+	return opid;
+}
+
+/**
+ * e_book_client_get_contacts_finish:
+ * @client: an #EBookClient
+ * @result: a #GAsyncResult
+ * @contacts: (out) a #GSList of matched #EContact-s
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_book_client_get_contacts().
+ * If successful, then the @contacts is set to newly allocated list of #EContact-s,
+ * which should be freed with e_client_util_free_object_slist().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_get_contacts_finish (EBookClient *client, GAsyncResult *result, GSList **contacts, GError **error)
+{
+	gboolean res;
+	gchar **vcards = NULL;
+
+	g_return_val_if_fail (contacts != NULL, FALSE);
+
+	res = e_client_proxy_call_finish_strv (E_CLIENT (client), result, &vcards, error, e_book_client_get_contacts);
+
+	if (vcards && res) {
+		gint ii;
+		GSList *slist = NULL;
+
+		for (ii = 0; vcards[ii]; ii++) {
+			slist = g_slist_prepend (slist, e_contact_new_from_vcard (vcards[ii]));
+		}
+
+		*contacts = g_slist_reverse (slist);
+	} else {
+		*contacts = NULL;
+	}
+
+	g_strfreev (vcards);
+
+	return res;
+}
+
+/**
+ * e_book_client_get_contacts_sync:
+ * @client: an #EBookClient
+ * @query: an #EBookQuery
+ * @contacts: (out) a #GSList of matched #EContact-s
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Query @client with @query, receiving a list of contacts which matched.
+ * If successful, then the @contacts is set to newly allocated #GSList of
+ * #EContact-s, which should be freed with e_client_util_free_object_slist().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_get_contacts_sync (EBookClient *client, const EBookQuery *query, GSList **contacts, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar *sexp, *gdbus_sexp = NULL;
+	gchar **vcards = NULL;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (query != NULL, FALSE);
+	g_return_val_if_fail (contacts != NULL, FALSE);
+
+	if (!client->priv->gdbus_book) {
+		g_set_error_literal (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_DBUS_ERROR, _("D-Bus book proxy gone"));
+		return FALSE;
+	}
+
+	sexp = e_book_query_to_string ((EBookQuery *) query);
+
+	res = e_client_proxy_call_sync_string__strv (E_CLIENT (client), e_util_ensure_gdbus_string (sexp, &gdbus_sexp), &vcards, cancellable, error, e_gdbus_book_call_get_contact_list_sync);
+
+	if (vcards && res) {
+		gint ii;
+		GSList *slist = NULL;
+
+		for (ii = 0; vcards[ii]; ii++) {
+			slist = g_slist_prepend (slist, e_contact_new_from_vcard (vcards[ii]));
+		}
+
+		*contacts = g_slist_reverse (slist);
+	} else {
+		*contacts = NULL;
+	}
+
+	g_free (sexp);
+	g_free (gdbus_sexp);
+	g_strfreev (vcards);
+
+	return res;
+}
+
+/**
+ * e_book_client_get_view:
+ * @client: an #EBookClient
+ * @query: an #EBookQuery
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Query @client with @query, creating an #EBookView.
+ * The call is finished by e_book_client_get_view_finish()
+ * from the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_book_client_get_view (EBookClient *client, const EBookQuery *query, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	guint32 opid;
+	gchar *sexp, *gdbus_sexp = NULL;
+
+	g_return_val_if_fail (query != NULL, 0);
+
+	sexp = e_book_query_to_string ((EBookQuery *) query);
+
+	opid = e_client_proxy_call_string (E_CLIENT (client), e_util_ensure_gdbus_string (sexp, &gdbus_sexp), cancellable, callback, user_data, e_book_client_get_view,
+			e_gdbus_book_call_get_view,
+			NULL, NULL, e_gdbus_book_call_get_view_finish, NULL, NULL);
+
+	g_free (sexp);
+	g_free (gdbus_sexp);
+
+	return opid;
+}
+
+static gboolean
+complete_get_view (EBookClient *client, gboolean res, gchar *view_path, EBookView **book_view, GError **error)
+{
+	g_return_val_if_fail (book_view != NULL, FALSE);
+
+	if (view_path && res && book_factory_proxy) {
+		GError *local_error = NULL;
+		EGdbusBookView *gdbus_bookview;
+
+		gdbus_bookview = e_gdbus_book_view_proxy_new_sync (g_dbus_proxy_get_connection (G_DBUS_PROXY (book_factory_proxy)),
+								G_DBUS_PROXY_FLAGS_NONE,
+								ADDRESS_BOOK_DBUS_SERVICE_NAME,
+								view_path,
+								NULL,
+								&local_error);
+
+		if (gdbus_bookview) {
+			*book_view = _e_book_view_new (client, gdbus_bookview);
+		} else {
+			*book_view = NULL;
+			res = FALSE;
+		}
+
+		if (local_error)
+			unwrap_dbus_error (local_error, error);
+	} else {
+		*book_view = NULL;
+		res = FALSE;
+	}
+
+	if (!*book_view && error && !*error)
+		g_set_error_literal (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_DBUS_ERROR, _("Cannot get connection to view"));
+
+	g_free (view_path);
+
+	return res;
+}
+
+/**
+ * e_book_client_get_view_finish:
+ * @client: an #EBookClient
+ * @result: a #GAsyncResult
+ * @book_view: (out) an #EBookView
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_book_client_get_view().
+ * If successful, then the @book_view is set to newly allocated #EBookView,
+ * which should be freed with g_object_unref().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_get_view_finish (EBookClient *client, GAsyncResult *result, EBookView **book_view, GError **error)
+{
+	gboolean res;
+	gchar *view_path = NULL;
+
+	g_return_val_if_fail (book_view != NULL, FALSE);
+
+	res = e_client_proxy_call_finish_string (E_CLIENT (client), result, &view_path, error, e_book_client_get_view);
+
+	return complete_get_view (client, res, view_path, book_view, error);
+}
+
+/**
+ * e_book_client_get_view_sync:
+ * @client: an #EBookClient
+ * @query: an #EBookQuery
+ * @book_view: (out) an #EBookView
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Query @client with @query, creating an #EBookView.
+ * If successful, then the @book_view is set to newly allocated #EBookView,
+ * which should be freed with g_object_unref().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_book_client_get_view_sync (EBookClient *client, const EBookQuery *query, EBookView **book_view, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar *sexp, *gdbus_sexp = NULL;
+	gchar *view_path = NULL;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_BOOK_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (query != NULL, FALSE);
+	g_return_val_if_fail (book_view != NULL, FALSE);
+
+	if (!client->priv->gdbus_book) {
+		g_set_error_literal (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_DBUS_ERROR, _("D-Bus book proxy gone"));
+		return FALSE;
+	}
+
+	sexp = e_book_query_to_string ((EBookQuery *) query);
+
+	res = e_client_proxy_call_sync_string__string (E_CLIENT (client), e_util_ensure_gdbus_string (sexp, &gdbus_sexp), &view_path, cancellable, error, e_gdbus_book_call_get_view_sync);
+
+	g_free (sexp);
+	g_free (gdbus_sexp);
+
+	return complete_get_view (client, res, view_path, book_view, error);
+}
+
+static GDBusProxy *
+book_client_get_dbus_proxy (EClient *client)
+{
+	EBookClient *book_client;
+
+	g_return_val_if_fail (client != NULL, NULL);
+
+	book_client = E_BOOK_CLIENT (client);
+	g_return_val_if_fail (book_client != NULL, NULL);
+	g_return_val_if_fail (book_client->priv != NULL, NULL);
+
+	return book_client->priv->gdbus_book;
+}
+
+static void
+book_client_unwrap_dbus_error (EClient *client, GError *dbus_error, GError **out_error)
+{
+	unwrap_dbus_error (dbus_error, out_error);
+}
+
+static void
+book_client_handle_authentication (EClient *client, const ECredentials *credentials)
+{
+	EBookClient *book_client;
+	GError *error = NULL;
+	gchar **strv;
+
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (credentials != NULL);
+
+	book_client = E_BOOK_CLIENT (client);
+	g_return_if_fail (book_client != NULL);
+	g_return_if_fail (book_client->priv != NULL);
+
+	if (!book_client->priv->gdbus_book)
+		return;
+
+	strv = e_credentials_to_strv (credentials);
+	g_return_if_fail (strv != NULL);
+
+	e_gdbus_book_call_authenticate_user_sync (book_client->priv->gdbus_book, (const gchar * const *) strv, NULL, &error);
+
+	g_strfreev (strv);
+
+	if (error) {
+		g_debug ("%s: Failed to authenticate user: %s", G_STRFUNC, error->message);
+		g_error_free (error);
+	}
+}
+
+static gchar *
+book_client_retrieve_capabilities (EClient *client)
+{
+	EBookClient *book_client;
+	GError *error = NULL;
+	gchar *capabilities = NULL;
+
+	g_return_val_if_fail (client != NULL, NULL);
+
+	book_client = E_BOOK_CLIENT (client);
+	g_return_val_if_fail (book_client != NULL, NULL);
+	g_return_val_if_fail (book_client->priv != NULL, NULL);
+
+	if (!book_client->priv->gdbus_book)
+		return NULL;
+
+	e_gdbus_book_call_get_capabilities_sync (book_client->priv->gdbus_book, &capabilities, NULL, &error);
+
+	if (error) {
+		g_debug ("%s: Failed to retrieve capabilitites: %s", G_STRFUNC, error->message);
+		g_error_free (error);
+	}
+
+	return capabilities;
+}
+
+static void
+e_book_client_init (EBookClient *client)
+{
+	LOCK_FACTORY ();
+	active_book_clients++;
+	UNLOCK_FACTORY ();
+
+	client->priv = G_TYPE_INSTANCE_GET_PRIVATE (client, E_TYPE_BOOK_CLIENT, EBookClientPrivate);
+}
+
+static void
+book_client_dispose (GObject *object)
+{
+	EClient *client;
+
+	client = E_CLIENT (object);
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (client->priv != NULL);
+
+	e_client_cancel_all (client);
+
+	gdbus_book_client_disconnect (E_BOOK_CLIENT (client));
+
+	/* Chain up to parent's dispose() method. */
+	G_OBJECT_CLASS (e_book_client_parent_class)->dispose (object);
+}
+
+static void
+book_client_finalize (GObject *object)
+{
+	EBookClient *client;
+	EBookClientPrivate *priv;
+
+	client = E_BOOK_CLIENT (object);
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (client->priv != NULL);
+
+	priv = client->priv;
+
+	/* Chain up to parent's finalize() method. */
+	G_OBJECT_CLASS (e_book_client_parent_class)->finalize (object);
+
+	LOCK_FACTORY ();
+	active_book_clients--;
+	if (!active_book_clients)
+		gdbus_book_factory_proxy_disconnect (NULL);
+	UNLOCK_FACTORY ();
+}
+
+static void
+e_book_client_class_init (EBookClientClass *klass)
+{
+	GObjectClass *object_class;
+	EClientClass *client_class;
+
+	g_type_class_add_private (klass, sizeof (EBookClientPrivate));
+
+	object_class = G_OBJECT_CLASS (klass);
+	object_class->dispose = book_client_dispose;
+	object_class->finalize = book_client_finalize;
+
+	client_class = E_CLIENT_CLASS (klass);
+	client_class->get_dbus_proxy = book_client_get_dbus_proxy;
+	client_class->unwrap_dbus_error = book_client_unwrap_dbus_error;
+	client_class->handle_authentication = book_client_handle_authentication;
+	client_class->retrieve_capabilities = book_client_retrieve_capabilities;
+	client_class->open = book_client_open;
+	client_class->open_finish = book_client_open_finish;
+	client_class->open_sync = book_client_open_sync;
+	client_class->remove = book_client_remove;
+	client_class->remove_finish = book_client_remove_finish;
+	client_class->remove_sync = book_client_remove_sync;
+}
diff --git a/addressbook/libebook/e-book-client.h b/addressbook/libebook/e-book-client.h
new file mode 100644
index 0000000..5e81e61
--- /dev/null
+++ b/addressbook/libebook/e-book-client.h
@@ -0,0 +1,160 @@
+/*
+ * e-book-client.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#ifndef E_BOOK_CLIENT_H
+#define E_BOOK_CLIENT_H
+
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <libedataserver/e-client.h>
+#include <libedataserver/e-source-list.h>
+#include <libebook/e-book-query.h>
+#include <libebook/e-book-view.h>
+
+#define E_TYPE_BOOK_CLIENT		(e_book_client_get_type ())
+#define E_BOOK_CLIENT(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_BOOK_CLIENT, EBookClient))
+#define E_BOOK_CLIENT_CLASS(k)		(G_TYPE_CHECK_CLASS_CAST ((k), E_TYPE_BOOK_CLIENT, EBookClientClass))
+#define E_IS_BOOK_CLIENT(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_BOOK_CLIENT))
+#define E_IS_BOOK_CLIENT_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_BOOK_CLIENT))
+#define E_BOOK_CLIENT_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_BOOK_CLIENT, EBookClientClass))
+
+G_BEGIN_DECLS
+
+#define E_BOOK_CLIENT_ERROR e_book_client_error_quark ()
+
+GQuark e_book_client_error_quark (void) G_GNUC_CONST;
+
+typedef enum {
+	E_BOOK_CLIENT_ERROR_SUCCESS,
+	E_BOOK_CLIENT_ERROR_INVALID_ARG,
+	E_BOOK_CLIENT_ERROR_BUSY,
+	E_BOOK_CLIENT_ERROR_REPOSITORY_OFFLINE,
+	E_BOOK_CLIENT_ERROR_NO_SUCH_BOOK,
+	E_BOOK_CLIENT_ERROR_NO_SELF_CONTACT,
+	E_BOOK_CLIENT_ERROR_SOURCE_NOT_LOADED,
+	E_BOOK_CLIENT_ERROR_SOURCE_ALREADY_LOADED,
+	E_BOOK_CLIENT_ERROR_PERMISSION_DENIED,
+	E_BOOK_CLIENT_ERROR_CONTACT_NOT_FOUND,
+	E_BOOK_CLIENT_ERROR_CONTACT_ID_ALREADY_EXISTS,
+	E_BOOK_CLIENT_ERROR_PROTOCOL_NOT_SUPPORTED,
+	E_BOOK_CLIENT_ERROR_CANCELLED,
+	E_BOOK_CLIENT_ERROR_COULD_NOT_CANCEL,
+	E_BOOK_CLIENT_ERROR_AUTHENTICATION_FAILED,
+	E_BOOK_CLIENT_ERROR_AUTHENTICATION_REQUIRED,
+	E_BOOK_CLIENT_ERROR_TLS_NOT_AVAILABLE,
+	E_BOOK_CLIENT_ERROR_DBUS_ERROR,
+	E_BOOK_CLIENT_ERROR_NO_SUCH_SOURCE,
+	E_BOOK_CLIENT_ERROR_OFFLINE_UNAVAILABLE,
+	E_BOOK_CLIENT_ERROR_OTHER_ERROR,
+	E_BOOK_CLIENT_ERROR_INVALID_SERVER_VERSION,
+	E_BOOK_CLIENT_ERROR_UNSUPPORTED_AUTHENTICATION_METHOD,
+	E_BOOK_CLIENT_ERROR_NO_SPACE,
+	E_BOOK_CLIENT_ERROR_NOT_SUPPORTED
+} EBookClientError;
+
+const gchar *e_book_client_error_to_string (EBookClientError code);
+
+typedef struct _EBookClient        EBookClient;
+typedef struct _EBookClientClass   EBookClientClass;
+typedef struct _EBookClientPrivate EBookClientPrivate;
+
+struct _EBookClient {
+	EClient parent;
+
+	/*< private >*/
+	EBookClientPrivate *priv;
+};
+
+struct _EBookClientClass {
+	EClientClass parent;
+};
+
+GType		e_book_client_get_type				(void);
+
+/* Creating a new addressbook */
+EBookClient *	e_book_client_new				(ESource *source, GError **error);
+EBookClient *	e_book_client_new_from_uri			(const gchar *uri, GError **error);
+EBookClient *	e_book_client_new_system_addressbook		(GError **error);
+EBookClient *	e_book_client_new_default_addressbook		(GError **error);
+
+/* Addressbook discovery */
+gboolean	e_book_client_set_default			(EBookClient *client, GError **error);
+gboolean	e_book_client_set_default_source		(ESource *source, GError **error);
+gboolean	e_book_client_get_sources			(ESourceList **sources, GError **error);
+
+/* Identity */
+gboolean	e_book_client_get_self				(EContact **contact, EBookClient **client, GError **error);
+gboolean	e_book_client_set_self				(EBookClient *client, EContact *contact, GError **error);
+gboolean	e_book_client_is_self				(EContact *contact);
+
+/* Addressbook methods */
+guint32		e_book_client_get_capabilities			(EBookClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_book_client_get_capabilities_finish		(EBookClient *client, GAsyncResult *result, GSList **capabilities, GError **error);
+gboolean	e_book_client_get_capabilities_sync		(EBookClient *client, GSList **capabilities, GCancellable *cancellable, GError **error);
+
+guint32		e_book_client_get_required_fields		(EBookClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_book_client_get_required_fields_finish	(EBookClient *client, GAsyncResult *result, GSList **fields, GError **error);
+gboolean	e_book_client_get_required_fields_sync		(EBookClient *client, GSList **fields, GCancellable *cancellable, GError **error);
+
+guint32		e_book_client_get_supported_fields		(EBookClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_book_client_get_supported_fields_finish	(EBookClient *client, GAsyncResult *result, GSList **fields, GError **error);
+gboolean	e_book_client_get_supported_fields_sync		(EBookClient *client, GSList **fields, GCancellable *cancellable, GError **error);
+
+guint32		e_book_client_get_supported_auth_methods	(EBookClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_book_client_get_supported_auth_methods_finish	(EBookClient *client, GAsyncResult *result, GSList **auth_methods, GError **error);
+gboolean	e_book_client_get_supported_auth_methods_sync	(EBookClient *client, GSList **auth_methods, GCancellable *cancellable, GError **error);
+
+guint32		e_book_client_add_contact			(EBookClient *client, const EContact *contact, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_book_client_add_contact_finish		(EBookClient *client, GAsyncResult *result, gchar **added_uid, GError **error);
+gboolean	e_book_client_add_contact_sync			(EBookClient *client, const EContact *contact, gchar **added_uid, GCancellable *cancellable, GError **error);
+
+guint32		e_book_client_modify_contact			(EBookClient *client, const EContact *contact, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_book_client_modify_contact_finish		(EBookClient *client, GAsyncResult *result, GError **error);
+gboolean	e_book_client_modify_contact_sync		(EBookClient *client, const EContact *contact, GCancellable *cancellable, GError **error);
+
+guint32		e_book_client_remove_contact			(EBookClient *client, const EContact *contact, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_book_client_remove_contact_finish		(EBookClient *client, GAsyncResult *result, GError **error);
+gboolean	e_book_client_remove_contact_sync		(EBookClient *client, const EContact *contact, GCancellable *cancellable, GError **error);
+
+guint32		e_book_client_remove_contact_by_uid		(EBookClient *client, const gchar *uid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_book_client_remove_contact_by_uid_finish	(EBookClient *client, GAsyncResult *result, GError **error);
+gboolean	e_book_client_remove_contact_by_uid_sync	(EBookClient *client, const gchar *uid, GCancellable *cancellable, GError **error);
+
+guint32		e_book_client_remove_contacts			(EBookClient *client, const GSList *uids, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_book_client_remove_contacts_finish		(EBookClient *client, GAsyncResult *result, GError **error);
+gboolean	e_book_client_remove_contacts_sync		(EBookClient *client, const GSList *uids, GCancellable *cancellable, GError **error);
+
+guint32		e_book_client_get_contact			(EBookClient *client, const gchar *uid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_book_client_get_contact_finish		(EBookClient *client, GAsyncResult *result, EContact **contact, GError **error);
+gboolean	e_book_client_get_contact_sync			(EBookClient *client, const gchar *uid, EContact **contact, GCancellable *cancellable, GError **error);
+
+guint32		e_book_client_get_contacts			(EBookClient *client, const EBookQuery *query, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_book_client_get_contacts_finish		(EBookClient *client, GAsyncResult *result, GSList **contacts, GError **error);
+gboolean	e_book_client_get_contacts_sync			(EBookClient *client, const EBookQuery *query, GSList **contacts, GCancellable *cancellable, GError **error);
+
+guint32		e_book_client_get_view				(EBookClient *client, const EBookQuery *query, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_book_client_get_view_finish			(EBookClient *client, GAsyncResult *result, EBookView **book_view, GError **error);
+gboolean	e_book_client_get_view_sync			(EBookClient *client, const EBookQuery *query, EBookView **book_view, GCancellable *cancellable, GError **error);
+
+G_END_DECLS
+
+#endif /* E_BOOK_CLIENT_H */
diff --git a/addressbook/libebook/e-book-view-private.h b/addressbook/libebook/e-book-view-private.h
index 16a6461..f0acdca 100644
--- a/addressbook/libebook/e-book-view-private.h
+++ b/addressbook/libebook/e-book-view-private.h
@@ -23,11 +23,14 @@
 #define __E_BOOK_VIEW_PRIVATE_H__
 
 #include "e-book.h"
+#include "e-book-client.h"
 #include "e-book-view.h"
 
 struct _EGdbusBookView;
 
-EBookView *_e_book_view_new (EBook *book, struct _EGdbusBookView *gdbus_bookview);
+EBookView *_e_book_view_new (EBookClient *book_client, struct _EGdbusBookView *gdbus_bookview);
+
+EBookView *_e_book_view_new_with_book (EBook *book, struct _EGdbusBookView *gdbus_bookview);
 
 G_END_DECLS
 
diff --git a/addressbook/libebook/e-book-view.c b/addressbook/libebook/e-book-view.c
index 369c628..417cba1 100644
--- a/addressbook/libebook/e-book-view.c
+++ b/addressbook/libebook/e-book-view.c
@@ -21,18 +21,26 @@
  */
 
 #include <glib-object.h>
+
+#ifndef E_BOOK_DISABLE_DEPRECATED
 #include "e-book.h"
+#endif
+
+#include "e-book-client.h"
 #include "e-book-view.h"
 #include "e-book-view-private.h"
 #include "e-book-marshal.h"
 #include "libedata-book/e-data-book-types.h"
-#include "e-gdbus-egdbusbookview.h"
+#include "e-gdbus-book-view.h"
 
 G_DEFINE_TYPE (EBookView, e_book_view, G_TYPE_OBJECT);
 
 struct _EBookViewPrivate {
 	EGdbusBookView *gdbus_bookview;
+	#ifndef E_BOOK_DISABLE_DEPRECATED
 	EBook *book;
+	#endif
+	EBookClient *book_client;
 	gboolean running;
 };
 
@@ -51,7 +59,7 @@ enum {
 static guint signals[LAST_SIGNAL];
 
 static void
-contacts_added_cb (EGdbusBookView *object, const gchar * const *vcards, EBookView *book_view)
+objects_added_cb (EGdbusBookView *object, const gchar * const *vcards, EBookView *book_view)
 {
 	const gchar * const *p;
 	GList *contacts = NULL;
@@ -72,7 +80,7 @@ contacts_added_cb (EGdbusBookView *object, const gchar * const *vcards, EBookVie
 }
 
 static void
-contacts_changed_cb (EGdbusBookView *object, const gchar * const *vcards, EBookView *book_view)
+objects_changed_cb (EGdbusBookView *object, const gchar * const *vcards, EBookView *book_view)
 {
 	const gchar * const *p;
 	GList *contacts = NULL;
@@ -92,7 +100,7 @@ contacts_changed_cb (EGdbusBookView *object, const gchar * const *vcards, EBookV
 }
 
 static void
-contacts_removed_cb (EGdbusBookView *object, const gchar * const *ids, EBookView *book_view)
+objects_removed_cb (EGdbusBookView *object, const gchar * const *ids, EBookView *book_view)
 {
 	const gchar * const *p;
 	GList *list = NULL;
@@ -112,7 +120,7 @@ contacts_removed_cb (EGdbusBookView *object, const gchar * const *ids, EBookView
 }
 
 static void
-status_message_cb (EGdbusBookView *object, const gchar *message, EBookView *book_view)
+progress_cb (EGdbusBookView *object, guint percent, const gchar *message, EBookView *book_view)
 {
 	if (!book_view->priv->running)
 		return;
@@ -155,18 +163,43 @@ complete_cb (EGdbusBookView *object, /* EDataBookStatus */ guint status, const g
 }
 
 /*
- * e_book_view_new:
- * @book: an #EBook
+ * _e_book_view_new:
+ * @book_client: an #EBookClient
  * @gdbus_bookview: The #EGdbusBookView to get signals from
  *
- * Creates a new #EBookView based on #EBook and listening to @gdbus_bookview.  This
- * is a private function, applications should call #e_book_get_book_view or
+ * Creates a new #EBookView based on #EBookClient and listening to @gdbus_bookview.
+ * This is a private function, applications should call #e_book_get_book_view or
  * #e_book_async_get_book_view.
  *
  * Returns: A new #EBookView.
  **/
 EBookView *
-_e_book_view_new (EBook *book, EGdbusBookView *gdbus_bookview)
+_e_book_view_new (EBookClient *book_client, EGdbusBookView *gdbus_bookview)
+{
+	EBookView *view;
+	EBookViewPrivate *priv;
+
+	view = g_object_new (E_TYPE_BOOK_VIEW, NULL);
+	priv = view->priv;
+
+	priv->book_client = g_object_ref (book_client);
+
+	/* Take ownership of the gdbus_bookview object */
+	priv->gdbus_bookview = gdbus_bookview;
+
+	g_object_add_weak_pointer (G_OBJECT (gdbus_bookview), (gpointer) &priv->gdbus_bookview);
+	g_signal_connect (priv->gdbus_bookview, "objects-added", G_CALLBACK (objects_added_cb), view);
+	g_signal_connect (priv->gdbus_bookview, "objects-changed", G_CALLBACK (objects_changed_cb), view);
+	g_signal_connect (priv->gdbus_bookview, "objects-removed", G_CALLBACK (objects_removed_cb), view);
+	g_signal_connect (priv->gdbus_bookview, "progress", G_CALLBACK (progress_cb), view);
+	g_signal_connect (priv->gdbus_bookview, "complete", G_CALLBACK (complete_cb), view);
+
+	return view;
+}
+
+#ifndef E_BOOK_DISABLE_DEPRECATED
+EBookView *
+_e_book_view_new_with_book (EBook *book, EGdbusBookView *gdbus_bookview)
 {
 	EBookView *view;
 	EBookViewPrivate *priv;
@@ -180,10 +213,10 @@ _e_book_view_new (EBook *book, EGdbusBookView *gdbus_bookview)
 	priv->gdbus_bookview = gdbus_bookview;
 
 	g_object_add_weak_pointer (G_OBJECT (gdbus_bookview), (gpointer) &priv->gdbus_bookview);
-	g_signal_connect (priv->gdbus_bookview, "contacts-added", G_CALLBACK (contacts_added_cb), view);
-	g_signal_connect (priv->gdbus_bookview, "contacts-changed", G_CALLBACK (contacts_changed_cb), view);
-	g_signal_connect (priv->gdbus_bookview, "contacts-removed", G_CALLBACK (contacts_removed_cb), view);
-	g_signal_connect (priv->gdbus_bookview, "status-message", G_CALLBACK (status_message_cb), view);
+	g_signal_connect (priv->gdbus_bookview, "objects-added", G_CALLBACK (objects_added_cb), view);
+	g_signal_connect (priv->gdbus_bookview, "objects-changed", G_CALLBACK (objects_changed_cb), view);
+	g_signal_connect (priv->gdbus_bookview, "objects-removed", G_CALLBACK (objects_removed_cb), view);
+	g_signal_connect (priv->gdbus_bookview, "progress", G_CALLBACK (progress_cb), view);
 	g_signal_connect (priv->gdbus_bookview, "complete", G_CALLBACK (complete_cb), view);
 
 	return view;
@@ -198,6 +231,8 @@ _e_book_view_new (EBook *book, EGdbusBookView *gdbus_bookview)
  * Returns: an #EBook.
  *
  * Since: 2.22
+ *
+ * Deprecated: 3.2: Use #EBookClient and e_book_view_get_book_client() instead
  **/
 EBook *
 e_book_view_get_book (EBookView *book_view)
@@ -206,6 +241,25 @@ e_book_view_get_book (EBookView *book_view)
 
 	return book_view->priv->book;
 }
+#endif /* E_BOOK_DISABLE_DEPRECATED */
+
+/**
+ * e_book_view_get_book_client:
+ * @book_view: an #EBookView
+ *
+ * Returns the #EBookClient that this book view is monitoring.
+ *
+ * Returns: an #EBookClient.
+ *
+ * Since: 3.2
+ **/
+EBookClient *
+e_book_view_get_book_client (EBookView *book_view)
+{
+	g_return_val_if_fail (E_IS_BOOK_VIEW (book_view), NULL);
+
+	return book_view->priv->book_client;
+}
 
 /**
  * e_book_view_start:
@@ -223,7 +277,7 @@ e_book_view_start (EBookView *book_view)
 	book_view->priv->running = TRUE;
 
 	if (book_view->priv->gdbus_bookview) {
-		e_gdbus_book_view_call_start_sync (book_view->priv->gdbus_bookview, NULL, &error);
+		e_gdbus_book_view_call_start_sync (G_DBUS_PROXY (book_view->priv->gdbus_bookview), NULL, &error);
 		if (error) {
 			g_warning ("Cannot start book view: %s\n", error->message);
 
@@ -255,7 +309,7 @@ e_book_view_stop (EBookView *book_view)
 	book_view->priv->running = FALSE;
 
 	if (book_view->priv->gdbus_bookview) {
-		e_gdbus_book_view_call_stop_sync (book_view->priv->gdbus_bookview, NULL, &error);
+		e_gdbus_book_view_call_stop_sync (G_DBUS_PROXY (book_view->priv->gdbus_bookview), NULL, &error);
 		if (error) {
 			g_warning ("Cannot stop book view: %s\n", error->message);
 			g_error_free (error);
@@ -269,7 +323,11 @@ e_book_view_init (EBookView *book_view)
 	book_view->priv = G_TYPE_INSTANCE_GET_PRIVATE (
 		book_view, E_TYPE_BOOK_VIEW, EBookViewPrivate);
 	book_view->priv->gdbus_bookview = NULL;
+
+	#ifndef E_BOOK_DISABLE_DEPRECATED	
 	book_view->priv->book = NULL;
+	#endif
+	book_view->priv->book_client = NULL;
 	book_view->priv->running = FALSE;
 }
 
@@ -282,7 +340,7 @@ e_book_view_dispose (GObject *object)
 		GError *error = NULL;
 
 		g_signal_handlers_disconnect_matched (book_view->priv->gdbus_bookview, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, book_view);
-		e_gdbus_book_view_call_dispose_sync (book_view->priv->gdbus_bookview, NULL, &error);
+		e_gdbus_book_view_call_dispose_sync (G_DBUS_PROXY (book_view->priv->gdbus_bookview), NULL, &error);
 		g_object_unref (book_view->priv->gdbus_bookview);
 		book_view->priv->gdbus_bookview = NULL;
 
@@ -292,10 +350,17 @@ e_book_view_dispose (GObject *object)
 		}
 	}
 
+	#ifndef E_BOOK_DISABLE_DEPRECATED
 	if (book_view->priv->book) {
 		g_object_unref (book_view->priv->book);
 		book_view->priv->book = NULL;
 	}
+	#endif
+
+	if (book_view->priv->book_client) {
+		g_object_unref (book_view->priv->book_client);
+		book_view->priv->book_client = NULL;
+	}
 
 	/* Chain up to parent's dispose() method. */
 	G_OBJECT_CLASS (e_book_view_parent_class)->dispose (object);
diff --git a/addressbook/libebook/e-book-view.h b/addressbook/libebook/e-book-view.h
index 2148f74..5566051 100644
--- a/addressbook/libebook/e-book-view.h
+++ b/addressbook/libebook/e-book-view.h
@@ -28,7 +28,11 @@ typedef struct _EBookView        EBookView;
 typedef struct _EBookViewClass   EBookViewClass;
 typedef struct _EBookViewPrivate EBookViewPrivate;
 
+#ifndef E_BOOK_DISABLE_DEPRECATED
 struct _EBook;  /* Forward reference */
+#endif /* E_BOOK_DISABLE_DEPRECATED */
+
+struct _EBookClient;  /* Forward reference */
 
 struct _EBookView {
 	GObject     parent;
@@ -59,12 +63,16 @@ struct _EBookViewClass {
 	void (*_ebook_reserved4) (void);
 };
 
-GType              e_book_view_get_type               (void);
+GType			e_book_view_get_type		(void);
+
+void			e_book_view_start		(EBookView *book_view);
+void			e_book_view_stop		(EBookView *book_view);
 
-void               e_book_view_start                  (EBookView *book_view);
-void               e_book_view_stop                   (EBookView *book_view);
+#ifndef E_BOOK_DISABLE_DEPRECATED
+struct _EBook *		e_book_view_get_book		(EBookView *book_view);
+#endif
 
-struct _EBook     *e_book_view_get_book               (EBookView *book_view);
+struct _EBookClient *	e_book_view_get_book_client	(EBookView *book_view);
 
 G_END_DECLS
 
diff --git a/addressbook/libebook/e-book.c b/addressbook/libebook/e-book.c
index aeb281b..26b6b5e 100644
--- a/addressbook/libebook/e-book.c
+++ b/addressbook/libebook/e-book.c
@@ -20,6 +20,9 @@
  * Author: Ross Burton <ross linux intel com>
  */
 
+/* e-book deprecated since 3.2, use e-book-client instead */
+#ifndef E_BOOK_DISABLE_DEPRECATED
+
 /**
  * SECTION:e-book
  *
@@ -28,6 +31,8 @@
  * structure in the asynchronous callback, instead of a status code only.
  *
  * As an example, e_book_async_open() is replaced by e_book_open_async().
+ *
+ * Deprecated: 3.2: Use #EBookClient instead.
  */
 
 #include <config.h>
@@ -43,9 +48,9 @@
 #include "e-book-view-private.h"
 #include "e-book-marshal.h"
 
-#include "e-gdbus-egdbusbookfactory.h"
-#include "e-gdbus-egdbusbook.h"
-#include "e-gdbus-egdbusbookview.h"
+#include "e-gdbus-book.h"
+#include "e-gdbus-book-factory.h"
+#include "e-gdbus-book-view.h"
 
 static gchar ** flatten_stringlist (GList *list);
 static GList *array_to_stringlist (gchar **list);
@@ -65,7 +70,7 @@ enum {
 static guint e_book_signals[LAST_SIGNAL];
 
 struct _EBookPrivate {
-	EGdbusBook *gdbus_book;
+	GDBusProxy *gdbus_book;
 	guint gone_signal_id;
 
 	ESource *source;
@@ -347,27 +352,27 @@ e_book_activate (GError **error)
 }
 
 static void
-writable_cb (EGdbusBook *object, gboolean writable, EBook *book)
+readonly_cb (EGdbusBook *object, gboolean readonly, EBook *book)
 {
 	g_return_if_fail (E_IS_BOOK (book));
 
-	book->priv->writable = writable;
+	book->priv->writable = !readonly;
 
-	g_signal_emit (G_OBJECT (book), e_book_signals[WRITABLE_STATUS], 0, writable);
+	g_signal_emit (G_OBJECT (book), e_book_signals[WRITABLE_STATUS], 0, book->priv->writable);
 }
 
 static void
-connection_cb (EGdbusBook *object, gboolean connected, EBook *book)
+online_cb (EGdbusBook *object, gboolean is_online, EBook *book)
 {
 	g_return_if_fail (E_IS_BOOK (book));
 
-	book->priv->connected = connected;
+	book->priv->connected = is_online;
 
-	g_signal_emit (G_OBJECT (book), e_book_signals[CONNECTION_STATUS], 0, connected);
+	g_signal_emit (G_OBJECT (book), e_book_signals[CONNECTION_STATUS], 0, is_online);
 }
 
 static void
-auth_required_cb (EGdbusBook *object, EBook *book)
+auth_required_cb (EGdbusBook *object, const ECredentials *credentials, EBook *book)
 {
 	g_return_if_fail (E_IS_BOOK (book));
 
@@ -383,6 +388,8 @@ auth_required_cb (EGdbusBook *object, EBook *book)
  * Adds @contact to @book.
  *
  * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_book_client_add_contact_sync() instead.
  **/
 gboolean
 e_book_add_contact (EBook *book,
@@ -422,7 +429,7 @@ add_contact_reply (GObject *gdbus_book, GAsyncResult *res, gpointer user_data)
 	EBookIdCallback cb = data->callback;
 	#endif
 
-	e_gdbus_book_call_add_contact_finish (E_GDBUS_BOOK (gdbus_book), &uid, res, &error);
+	e_gdbus_book_call_add_contact_finish (G_DBUS_PROXY (gdbus_book), res, &uid, &error);
 
 	unwrap_gerror (error, &err);
 
@@ -505,6 +512,8 @@ e_book_async_add_contact (EBook *book,
  * Returns: %TRUE if the operation was started, %FALSE otherwise.
  *
  * Since: 2.32
+ *
+ * Deprecated: 3.2: Use e_book_client_add_contact() and e_book_client_add_contact_finish() instead.
  **/
 gboolean
 e_book_add_contact_async (EBook *book,
@@ -546,6 +555,8 @@ e_book_add_contact_async (EBook *book,
  * @book.
  *
  * Returns: %TRUE if successful, %FALSE otherwise
+ *
+ * Deprecated: 3.2: Use e_book_client_modify_contact_sync() instead.
  **/
 gboolean
 e_book_commit_contact (EBook *book,
@@ -579,7 +590,7 @@ modify_contact_reply (GObject *gdbus_book, GAsyncResult *res, gpointer user_data
 	EBookCallback cb = data->callback;
 	#endif
 
-	e_gdbus_book_call_modify_contact_finish (E_GDBUS_BOOK (gdbus_book), res, &error);
+	e_gdbus_book_call_modify_contact_finish (G_DBUS_PROXY (gdbus_book), res, &error);
 
 	unwrap_gerror (error, &err);
 
@@ -657,6 +668,8 @@ e_book_async_commit_contact (EBook *book,
  * Returns: %TRUE if the operation was started, %FALSE otherwise.
  *
  * Since: 2.32
+ *
+ * Deprecated: 3.2: Use e_book_client_modify_contact() and e_book_client_modify_contact_finish() instead.
  **/
 gboolean
 e_book_commit_contact_async (EBook *book,
@@ -700,6 +713,8 @@ e_book_commit_contact_async (EBook *book,
  * must be freed by the caller.
  *
  * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_book_client_get_required_fields_sync() instead.
  **/
 gboolean
 e_book_get_required_fields (EBook *book,
@@ -737,7 +752,7 @@ get_required_fields_reply (GObject *gdbus_book, GAsyncResult *res, gpointer user
 	#endif
 	EList *efields = NULL;
 
-	e_gdbus_book_call_get_required_fields_finish (E_GDBUS_BOOK (gdbus_book), &fields, res, &error);
+	e_gdbus_book_call_get_required_fields_finish (G_DBUS_PROXY (gdbus_book), res, &fields, &error);
 
 	efields = array_to_elist (fields);
 
@@ -808,6 +823,8 @@ e_book_async_get_required_fields (EBook *book,
  * Returns: %TRUE if the operation was started, %FALSE otherwise.
  *
  * Since: 2.32
+ *
+ * Deprecated: 3.2: Use e_book_client_get_required_fields() and e_book_client_get_required_fields_finish() instead.
  **/
 gboolean
 e_book_get_required_fields_async (EBook *book,
@@ -843,6 +860,8 @@ e_book_get_required_fields_async (EBook *book,
  * #GList and the strings must be freed by the caller.
  *
  * Returns: %TRUE if successful, %FALSE otherwise
+ *
+ * Deprecated: 3.2: Use e_book_client_get_supported_fields_sync() instead.
  **/
 gboolean
 e_book_get_supported_fields  (EBook *book,
@@ -880,7 +899,7 @@ get_supported_fields_reply (GObject *gdbus_book, GAsyncResult *res, gpointer use
 	#endif
 	EList *efields;
 
-	e_gdbus_book_call_get_supported_fields_finish (E_GDBUS_BOOK (gdbus_book), &fields, res, &error);
+	e_gdbus_book_call_get_supported_fields_finish (G_DBUS_PROXY (gdbus_book), res, &fields, &error);
 
 	efields = array_to_elist (fields);
 
@@ -953,6 +972,8 @@ e_book_async_get_supported_fields (EBook *book,
  * Returns: %TRUE if successful, %FALSE otherwise.
  *
  * Since: 2.32
+ *
+ * Deprecated: 3.2: Use e_book_client_get_supported_fields() and e_book_client_get_supported_fields_finish() instead.
  **/
 gboolean
 e_book_get_supported_fields_async (EBook *book,
@@ -987,6 +1008,8 @@ e_book_get_supported_fields_async (EBook *book,
  * #GList and the strings must be freed by the caller.
  *
  * Returns: %TRUE if successful, %FALSE otherwise
+ *
+ * Deprecated: 3.2: Use e_book_client_get_supported_auth_methods_sync() instead.
  **/
 gboolean
 e_book_get_supported_auth_methods (EBook *book,
@@ -1024,7 +1047,7 @@ get_supported_auth_methods_reply (GObject *gdbus_book, GAsyncResult *res, gpoint
 	#endif
 	EList *emethods;
 
-	e_gdbus_book_call_get_supported_auth_methods_finish (E_GDBUS_BOOK (gdbus_book), &methods, res, &error);
+	e_gdbus_book_call_get_supported_auth_methods_finish (G_DBUS_PROXY (gdbus_book), res, &methods, &error);
 
 	emethods = array_to_elist (methods);
 
@@ -1095,6 +1118,8 @@ e_book_async_get_supported_auth_methods (EBook *book,
  * Returns: %TRUE if successful, %FALSE otherwise.
  *
  * Since: 2.32
+ *
+ * Deprecated: 3.2: Use e_book_client_get_supported_auth_methods() and e_book_client_get_supported_auth_methods_finish() instead.
  **/
 gboolean
 e_book_get_supported_auth_methods_async (EBook *book,
@@ -1131,6 +1156,8 @@ e_book_get_supported_auth_methods_async (EBook *book,
  * methods returned using e_book_get_supported_auth_methods.
  *
  * Returns: %TRUE if successful, %FALSE otherwise
+ *
+ * Deprecated: 3.2: Connect to EClient::authenticate signal instead.
  **/
 gboolean
 e_book_authenticate_user (EBook *book,
@@ -1140,21 +1167,26 @@ e_book_authenticate_user (EBook *book,
                           GError **error)
 {
 	GError *err = NULL;
-	gchar *gdbus_user = NULL, *gdbus_passwd = NULL, *gdbus_auth_method = NULL;
+	ECredentials *credentials;
+	gchar **credentials_strv;
 
 	g_return_val_if_fail (E_IS_BOOK (book), FALSE);
 
 	e_return_error_if_fail (
 		book->priv->gdbus_book, E_BOOK_ERROR_REPOSITORY_OFFLINE);
 
-	e_gdbus_book_call_authenticate_user_sync (book->priv->gdbus_book,
-		e_util_ensure_gdbus_string (user, &gdbus_user),
-		e_util_ensure_gdbus_string (passwd, &gdbus_passwd),
-		e_util_ensure_gdbus_string (auth_method, &gdbus_auth_method), NULL, &err);
+	credentials = e_credentials_new_args (
+		E_CREDENTIALS_KEY_USERNAME, user,
+		E_CREDENTIALS_KEY_PASSWORD, passwd,
+		E_CREDENTIALS_KEY_AUTH_METHOD, auth_method,
+		NULL);
 
-	g_free (gdbus_user);
-	g_free (gdbus_passwd);
-	g_free (gdbus_auth_method);
+	credentials_strv = e_credentials_to_strv (credentials);
+
+	e_gdbus_book_call_authenticate_user_sync (book->priv->gdbus_book, (const gchar * const *) credentials_strv, NULL, &err);
+
+	g_strfreev (credentials_strv);
+	e_credentials_free (credentials);
 
 	return unwrap_gerror (err, error);
 }
@@ -1169,7 +1201,7 @@ authenticate_user_reply (GObject *gdbus_book, GAsyncResult *res, gpointer user_d
 	EBookCallback cb = data->callback;
 	#endif
 
-	e_gdbus_book_call_authenticate_user_finish (E_GDBUS_BOOK (gdbus_book), res, &error);
+	e_gdbus_book_call_authenticate_user_finish (G_DBUS_PROXY (gdbus_book), res, &error);
 
 	unwrap_gerror (error, &err);
 
@@ -1215,7 +1247,8 @@ e_book_async_authenticate_user (EBook *book,
                                 gpointer closure)
 {
 	AsyncData *data;
-	gchar *gdbus_user = NULL, *gdbus_passwd = NULL, *gdbus_auth_method = NULL;
+	ECredentials *credentials;
+	gchar **credentials_strv;
 
 	g_return_val_if_fail (E_IS_BOOK (book), FALSE);
 	g_return_val_if_fail (user != NULL, FALSE);
@@ -1230,14 +1263,18 @@ e_book_async_authenticate_user (EBook *book,
 	data->callback = cb;
 	data->closure = closure;
 
-	e_gdbus_book_call_authenticate_user (book->priv->gdbus_book,
-		e_util_ensure_gdbus_string (user, &gdbus_user),
-		e_util_ensure_gdbus_string (passwd, &gdbus_passwd),
-		e_util_ensure_gdbus_string (auth_method, &gdbus_auth_method), NULL, authenticate_user_reply, data);
+	credentials = e_credentials_new_args (
+		E_CREDENTIALS_KEY_USERNAME, user,
+		E_CREDENTIALS_KEY_PASSWORD, passwd,
+		E_CREDENTIALS_KEY_AUTH_METHOD, auth_method,
+		NULL);
+
+	credentials_strv = e_credentials_to_strv (credentials);
+
+	e_gdbus_book_call_authenticate_user (book->priv->gdbus_book, (const gchar * const *) credentials_strv, NULL, authenticate_user_reply, data);
 
-	g_free (gdbus_user);
-	g_free (gdbus_passwd);
-	g_free (gdbus_auth_method);
+	g_strfreev (credentials_strv);
+	e_credentials_free (credentials);
 
 	return TRUE;
 }
@@ -1260,6 +1297,8 @@ e_book_async_authenticate_user (EBook *book,
  * Returns: %FALSE if successful, %TRUE otherwise.
  *
  * Since: 2.32
+ *
+ * Deprecated: 3.2: Connect to EClient::authenticate signal instead.
  **/
 gboolean
 e_book_authenticate_user_async (EBook *book,
@@ -1270,7 +1309,8 @@ e_book_authenticate_user_async (EBook *book,
                                 gpointer closure)
 {
 	AsyncData *data;
-	gchar *gdbus_user = NULL, *gdbus_passwd = NULL, *gdbus_auth_method = NULL;
+	ECredentials *credentials;
+	gchar **credentials_strv;
 
 	g_return_val_if_fail (E_IS_BOOK (book), FALSE);
 	g_return_val_if_fail (user != NULL, FALSE);
@@ -1285,14 +1325,18 @@ e_book_authenticate_user_async (EBook *book,
 	data->excallback = cb;
 	data->closure = closure;
 
-	e_gdbus_book_call_authenticate_user (book->priv->gdbus_book,
-		e_util_ensure_gdbus_string (user, &gdbus_user),
-		e_util_ensure_gdbus_string (passwd, &gdbus_passwd),
-		e_util_ensure_gdbus_string (auth_method, &gdbus_auth_method), NULL, authenticate_user_reply, data);
+	credentials = e_credentials_new_args (
+		E_CREDENTIALS_KEY_USERNAME, user,
+		E_CREDENTIALS_KEY_PASSWORD, passwd,
+		E_CREDENTIALS_KEY_AUTH_METHOD, auth_method,
+		NULL);
+
+	credentials_strv = e_credentials_to_strv (credentials);
+
+	e_gdbus_book_call_authenticate_user (book->priv->gdbus_book, (const gchar * const *) credentials_strv, NULL, authenticate_user_reply, data);
 
-	g_free (gdbus_user);
-	g_free (gdbus_passwd);
-	g_free (gdbus_auth_method);
+	g_strfreev (credentials_strv);
+	e_credentials_free (credentials);
 
 	return TRUE;
 }
@@ -1308,6 +1352,8 @@ e_book_authenticate_user_async (EBook *book,
  * corresponding to @id.
  *
  * Returns: %TRUE if successful, %FALSE otherwise
+ *
+ * Deprecated: 3.2: Use e_book_client_get_contact_sync() instead.
  **/
 gboolean
 e_book_get_contact (EBook *book,
@@ -1346,7 +1392,7 @@ get_contact_reply (GObject *gdbus_book, GAsyncResult *res, gpointer user_data)
 	EBookContactCallback cb = data->callback;
 	#endif
 
-	e_gdbus_book_call_get_contact_finish (E_GDBUS_BOOK (gdbus_book), &vcard, res, &error);
+	e_gdbus_book_call_get_contact_finish (G_DBUS_PROXY (gdbus_book), res, &vcard, &error);
 
 	unwrap_gerror (error, &err);
 
@@ -1423,6 +1469,8 @@ e_book_async_get_contact (EBook *book,
  * Returns: %FALSE if successful, %TRUE otherwise
  *
  * Since: 2.32
+ *
+ * Deprecated: 3.2: Use e_book_client_get_contact() and e_book_client_get_contact_finish() instead.
  **/
 gboolean
 e_book_get_contact_async (EBook *book,
@@ -1460,6 +1508,8 @@ e_book_get_contact_async (EBook *book,
  * Removes the contact with id @id from @book.
  *
  * Returns: %TRUE if successful, %FALSE otherwise
+ *
+ * Deprecated: 3.2: Use e_book_client_remove_contact_by_uid_sync() or e_book_client_remove_contact_sync() instead.
  **/
 gboolean
 e_book_remove_contact (EBook *book,
@@ -1495,7 +1545,7 @@ remove_contact_reply (GObject *gdbus_book, GAsyncResult *res, gpointer user_data
 	EBookCallback cb = data->callback;
 	#endif
 
-	e_gdbus_book_call_remove_contacts_finish (E_GDBUS_BOOK (gdbus_book), res, &error);
+	e_gdbus_book_call_remove_contacts_finish (G_DBUS_PROXY (gdbus_book), res, &error);
 
 	unwrap_gerror (error, &err);
 
@@ -1525,6 +1575,8 @@ remove_contact_reply (GObject *gdbus_book, GAsyncResult *res, gpointer user_data
  * as a batch request.
  *
  * Returns: %TRUE if successful, %FALSE otherwise
+ *
+ * Deprecated: 3.2: Use e_book_client_remove_contacts_sync() instead.
  **/
 gboolean
 e_book_remove_contacts (EBook *book,
@@ -1606,6 +1658,8 @@ e_book_async_remove_contact (EBook *book,
  * Returns: %TRUE if successful, %FALSE otherwise
  *
  * Since: 2.32
+ *
+ * Deprecated: 3.2: Use e_book_client_remove_contact() and e_book_client_remove_contact_finish() instead.
  **/
 gboolean
 e_book_remove_contact_async (EBook *book,
@@ -1647,7 +1701,7 @@ remove_contact_by_id_reply (GObject *gdbus_book, GAsyncResult *res, gpointer use
 	EBookCallback cb = data->callback;
 	#endif
 
-	e_gdbus_book_call_remove_contacts_finish (E_GDBUS_BOOK (gdbus_book), res, &error);
+	e_gdbus_book_call_remove_contacts_finish (G_DBUS_PROXY (gdbus_book), res, &error);
 
 	unwrap_gerror (error, &err);
 
@@ -1722,6 +1776,8 @@ e_book_async_remove_contact_by_id (EBook *book,
  * Returns: %TRUE if successful, %FALSE otherwise
  *
  * Since: 2.32
+ *
+ * Deprecated: 3.2: Use e_book_client_remove_contact_by_uid() and e_book_client_remove_contact_by_uid_finish() instead.
  **/
 gboolean
 e_book_remove_contact_by_id_async (EBook *book,
@@ -1763,7 +1819,7 @@ remove_contacts_reply (GObject *gdbus_book, GAsyncResult *res, gpointer user_dat
 	EBookCallback cb = data->callback;
 	#endif
 
-	e_gdbus_book_call_remove_contacts_finish (E_GDBUS_BOOK (gdbus_book), res, &error);
+	e_gdbus_book_call_remove_contacts_finish (G_DBUS_PROXY (gdbus_book), res, &error);
 
 	unwrap_gerror (error, &err);
 
@@ -1848,6 +1904,8 @@ e_book_async_remove_contacts (EBook *book,
  * Returns: %TRUE if successful, %FALSE otherwise
  *
  * Since: 2.32
+ *
+ * Deprecated: 3.2: Use e_book_client_remove_contacts() and e_book_client_remove_contacts_finish() instead.
  **/
 gboolean
 e_book_remove_contacts_async (EBook *book,
@@ -1897,6 +1955,8 @@ e_book_remove_contacts_async (EBook *book,
  * error, @error is set and %FALSE returned.
  *
  * Returns: %TRUE if successful, %FALSE otherwise
+ *
+ * Deprecated: 3.2: Use e_book_client_get_view_sync() instead.
  **/
 gboolean
 e_book_get_book_view (EBook       *book,
@@ -1918,7 +1978,7 @@ e_book_get_book_view (EBook       *book,
 
 	sexp = e_book_query_to_string (query);
 
-	if (!e_gdbus_book_call_get_book_view_sync (book->priv->gdbus_book, e_util_ensure_gdbus_string (sexp, &gdbus_sexp), max_results, &view_path, NULL, &err)) {
+	if (!e_gdbus_book_call_get_view_sync (book->priv->gdbus_book, e_util_ensure_gdbus_string (sexp, &gdbus_sexp), &view_path, NULL, &err)) {
 		*book_view = NULL;
 		g_free (sexp);
 		g_free (gdbus_sexp);
@@ -1934,7 +1994,7 @@ e_book_get_book_view (EBook       *book,
 							error);
 
 	if (gdbus_bookview) {
-		*book_view = _e_book_view_new (book, gdbus_bookview);
+		*book_view = _e_book_view_new_with_book (book, gdbus_bookview);
 	} else {
 		*book_view = NULL;
 		g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_DBUS_EXCEPTION,
@@ -1962,7 +2022,7 @@ get_book_view_reply (GObject *gdbus_book, GAsyncResult *res, gpointer user_data)
 	#endif
 	EGdbusBookView *gdbus_bookview;
 
-	e_gdbus_book_call_get_book_view_finish (E_GDBUS_BOOK (gdbus_book), &view_path, res, &error);
+	e_gdbus_book_call_get_view_finish (G_DBUS_PROXY (gdbus_book), res, &view_path, &error);
 
 	if (view_path) {
 		gdbus_bookview = e_gdbus_book_view_proxy_new_sync (g_dbus_proxy_get_connection (G_DBUS_PROXY (book_factory_proxy)),
@@ -1972,7 +2032,7 @@ get_book_view_reply (GObject *gdbus_book, GAsyncResult *res, gpointer user_data)
 							NULL,
 							&error);
 		if (gdbus_bookview) {
-			view = _e_book_view_new (data->book, gdbus_bookview);
+			view = _e_book_view_new_with_book (data->book, gdbus_bookview);
 		}
 	}
 
@@ -2033,7 +2093,7 @@ e_book_async_get_book_view (EBook *book,
 
 	sexp = e_book_query_to_string (query);
 
-	e_gdbus_book_call_get_book_view (book->priv->gdbus_book, e_util_ensure_gdbus_string (sexp, &gdbus_sexp), max_results, NULL, get_book_view_reply, data);
+	e_gdbus_book_call_get_view (book->priv->gdbus_book, e_util_ensure_gdbus_string (sexp, &gdbus_sexp), NULL, get_book_view_reply, data);
 
 	g_free (sexp);
 	g_free (gdbus_sexp);
@@ -2057,6 +2117,8 @@ e_book_async_get_book_view (EBook *book,
  * Returns: %FALSE if successful, %TRUE otherwise
  *
  * Since: 2.32
+ *
+ * Deprecated: 3.2: Use e_book_client_get_view() and e_book_client_get_view_finish() instead.
  **/
 gboolean
 e_book_get_book_view_async (EBook *book,
@@ -2082,7 +2144,7 @@ e_book_get_book_view_async (EBook *book,
 
 	sexp = e_book_query_to_string (query);
 
-	e_gdbus_book_call_get_book_view (book->priv->gdbus_book, e_util_ensure_gdbus_string (sexp, &gdbus_sexp), max_results, NULL, get_book_view_reply, data);
+	e_gdbus_book_call_get_view (book->priv->gdbus_book, e_util_ensure_gdbus_string (sexp, &gdbus_sexp), NULL, get_book_view_reply, data);
 
 	g_free (sexp);
 	g_free (gdbus_sexp);
@@ -2101,6 +2163,8 @@ e_book_get_book_view_async (EBook *book,
  * matched. On failed, @error will be set and %FALSE returned.
  *
  * Returns: %TRUE on success, %FALSE otherwise
+ *
+ * Deprecated: 3.2: Use e_book_client_get_contacts_sync() instead.
  **/
 gboolean
 e_book_get_contacts (EBook       *book,
@@ -2150,7 +2214,7 @@ get_contacts_reply (GObject *gdbus_book, GAsyncResult *res, gpointer user_data)
 	EBookListCallback cb = data->callback;
 	#endif
 
-	e_gdbus_book_call_get_contact_list_finish (E_GDBUS_BOOK (gdbus_book), &vcards, res, &error);
+	e_gdbus_book_call_get_contact_list_finish (G_DBUS_PROXY (gdbus_book), res, &vcards, &error);
 
 	unwrap_gerror (error, &err);
 
@@ -2238,6 +2302,8 @@ e_book_async_get_contacts (EBook *book,
  * Returns: %FALSE on success, %TRUE otherwise
  *
  * Since: 2.32
+ *
+ * Deprecated: 3.2: Use e_book_client_get_contacts() and e_book_client_get_contacts_finish() instead.
  **/
 gboolean
 e_book_get_contacts_async (EBook *book,
@@ -2311,6 +2377,8 @@ parse_changes_array (GVariant *var_changes)
  * for a given change ID.
  *
  * Returns: %TRUE on success, %FALSE otherwise
+ *
+ * Deprecated: 3.2: This function has been dropped completely.
  */
 gboolean
 e_book_get_changes (EBook       *book,
@@ -2327,7 +2395,7 @@ e_book_get_changes (EBook       *book,
 	e_return_error_if_fail (
 		book->priv->gdbus_book, E_BOOK_ERROR_REPOSITORY_OFFLINE);
 
-	e_gdbus_book_call_get_changes_sync (book->priv->gdbus_book, e_util_ensure_gdbus_string (changeid, &gdbus_changeid), &var_changes, NULL, &err);
+	/*e_gdbus_book_call_get_changes_sync (book->priv->gdbus_book, e_util_ensure_gdbus_string (changeid, &gdbus_changeid), &var_changes, NULL, &err);*/
 
 	g_free (gdbus_changeid);
 
@@ -2342,42 +2410,6 @@ e_book_get_changes (EBook       *book,
 	}
 }
 
-static void
-get_changes_reply (GObject *gdbus_book, GAsyncResult *res, gpointer user_data)
-{
-	GVariant *var_changes = NULL;
-	GError *err = NULL, *error = NULL;
-	AsyncData *data = user_data;
-	EBookListAsyncCallback excb = data->excallback;
-	#ifndef E_BOOK_DISABLE_DEPRECATED
-	EBookListCallback cb = data->callback;
-	#endif
-	GList *list = NULL;
-
-	e_gdbus_book_call_get_changes_finish (E_GDBUS_BOOK (gdbus_book), &var_changes, res, &error);
-
-	unwrap_gerror (error, &err);
-
-	if (var_changes) {
-		list = parse_changes_array (var_changes);
-		g_variant_unref (var_changes);
-	}
-
-	#ifndef E_BOOK_DISABLE_DEPRECATED
-	if (cb)
-		cb (data->book, err ? err->code : E_BOOK_ERROR_OK, list, data->closure);
-	#endif
-
-	if (excb)
-		excb (data->book, err, list, data->closure);
-
-	if (err)
-		g_error_free (err);
-
-	g_object_unref (data->book);
-	g_slice_free (AsyncData, data);
-}
-
 #ifndef E_BOOK_DISABLE_DEPRECATED
 /**
  * e_book_async_get_changes:
@@ -2399,22 +2431,12 @@ e_book_async_get_changes (EBook *book,
                           EBookListCallback cb,
                           gpointer closure)
 {
-	AsyncData *data;
-	gchar *gdbus_changeid = NULL;
-
 	g_return_val_if_fail (E_IS_BOOK (book), FALSE);
 
 	e_return_async_error_val_if_fail (
 		book->priv->gdbus_book, E_BOOK_ERROR_REPOSITORY_OFFLINE);
 
-	data = g_slice_new0 (AsyncData);
-	data->book = g_object_ref (book);
-	data->callback = cb;
-	data->closure = closure;
-
-	e_gdbus_book_call_get_changes (book->priv->gdbus_book, e_util_ensure_gdbus_string (changeid, &gdbus_changeid), NULL, get_changes_reply, data);
-
-	g_free (gdbus_changeid);
+	cb (book, E_BOOK_ERROR_NOT_SUPPORTED, NULL, closure);
 
 	return TRUE;
 }
@@ -2433,6 +2455,8 @@ e_book_async_get_changes (EBook *book,
  * Returns: %TRUE on success, %FALSE otherwise
  *
  * Since: 2.32
+ *
+ * Deprecated: 3.2: This function has been dropped completely.
  */
 gboolean
 e_book_get_changes_async (EBook *book,
@@ -2440,22 +2464,16 @@ e_book_get_changes_async (EBook *book,
                           EBookListAsyncCallback cb,
                           gpointer closure)
 {
-	AsyncData *data;
-	gchar *gdbus_changeid = NULL;
+	GError *error;
 
 	g_return_val_if_fail (E_IS_BOOK (book), FALSE);
 
 	e_return_ex_async_error_val_if_fail (
 		book->priv->gdbus_book, E_BOOK_ERROR_REPOSITORY_OFFLINE);
 
-	data = g_slice_new0 (AsyncData);
-	data->book = g_object_ref (book);
-	data->excallback = cb;
-	data->closure = closure;
-
-	e_gdbus_book_call_get_changes (book->priv->gdbus_book, e_util_ensure_gdbus_string (changeid, &gdbus_changeid), NULL, get_changes_reply, data);
-
-	g_free (gdbus_changeid);
+	error = g_error_new (E_BOOK_ERROR, E_BOOK_ERROR_NOT_SUPPORTED, "Not supported");
+	cb (book, error, NULL, closure);
+	g_error_free (error);
 
 	return TRUE;
 }
@@ -2465,6 +2483,8 @@ e_book_get_changes_async (EBook *book,
  * @change_list: a #GList of #EBookChange items
  *
  * Free the contents of #change_list, and the list itself.
+ *
+ * Deprecated: 3.2: Related function has been dropped completely.
  */
 void
 e_book_free_change_list (GList *change_list)
@@ -2496,6 +2516,8 @@ e_book_free_change_list (GList *change_list)
  * return with a status of E_BOOK_STATUS_CANCELLED.
  *
  * Returns: %TRUE on success, %FALSE otherwise
+ *
+ * Deprecated: 3.2: Use e_client_cancel_all() or e_client_cancel_op() on an #EBookClient object instead.
  **/
 gboolean
 e_book_cancel (EBook   *book,
@@ -2506,7 +2528,7 @@ e_book_cancel (EBook   *book,
 	e_return_error_if_fail (
 		book->priv->gdbus_book, E_BOOK_ERROR_REPOSITORY_OFFLINE);
 
-	return e_gdbus_book_call_cancel_operation_sync (book->priv->gdbus_book, NULL, error);
+	return e_gdbus_book_call_cancel_all_sync (book->priv->gdbus_book, NULL, error);
 }
 
 /**
@@ -2516,6 +2538,8 @@ e_book_cancel (EBook   *book,
  * asynchronous operation.
  *
  * Since: 2.24
+ *
+ * Deprecated: 3.2: Use e_client_cancel_all() or e_client_cancel_op() on an #EBookClient object instead.
  **/
 gboolean
 e_book_cancel_async_op (EBook *book, GError **error)
@@ -2525,7 +2549,7 @@ e_book_cancel_async_op (EBook *book, GError **error)
 	e_return_error_if_fail (
 		book->priv->gdbus_book, E_BOOK_ERROR_REPOSITORY_OFFLINE);
 
-	return e_gdbus_book_call_cancel_operation_sync (book->priv->gdbus_book, NULL, error);
+	return e_gdbus_book_call_cancel_all_sync (book->priv->gdbus_book, NULL, error);
 }
 
 /**
@@ -2537,6 +2561,8 @@ e_book_cancel_async_op (EBook *book, GError **error)
  * Opens the addressbook, making it ready for queries and other operations.
  *
  * Returns: %TRUE if the book was successfully opened, %FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_client_open_sync() on an #EBookClient object instead.
  */
 gboolean
 e_book_open (EBook     *book,
@@ -2573,7 +2599,7 @@ open_reply (GObject *gdbus_book, GAsyncResult *res, gpointer user_data)
 	EBookCallback cb = data->callback;
 	#endif
 
-	e_gdbus_book_call_open_finish (E_GDBUS_BOOK (gdbus_book), res, &error);
+	e_gdbus_book_call_open_finish (G_DBUS_PROXY (gdbus_book), res, &error);
 
 	unwrap_gerror (error, &err);
 
@@ -2645,6 +2671,8 @@ e_book_async_open (EBook *book,
  * Returns: %FALSE if successful, %TRUE otherwise.
  *
  * Since: 2.32
+ *
+ * Deprecated: 3.2: Use e_client_open() and e_client_open_finish() on an #EBookClient object instead.
  **/
 gboolean
 e_book_open_async (EBook *book,
@@ -2678,6 +2706,8 @@ e_book_open_async (EBook *book,
  * deletes the database file. You cannot get it back!
  *
  * Returns: %TRUE on success, %FALSE on failure.
+ *
+ * Deprecated: 3.2: Use e_client_remove_sync() on an #EBookClient object instead.
  */
 gboolean
 e_book_remove (EBook   *book,
@@ -2705,7 +2735,7 @@ remove_reply (GObject *gdbus_book, GAsyncResult *res, gpointer user_data)
 	EBookCallback cb = data->callback;
 	#endif
 
-	e_gdbus_book_call_remove_finish (E_GDBUS_BOOK (gdbus_book), res, &error);
+	e_gdbus_book_call_remove_finish (G_DBUS_PROXY (gdbus_book), res, &error);
 
 	unwrap_gerror (error, &err);
 
@@ -2772,6 +2802,8 @@ e_book_async_remove (EBook *book,
  * Returns: %FALSE if successful, %TRUE otherwise.
  *
  * Since: 2.32
+ *
+ * Deprecated: 3.2: Use e_client_remove() and e_client_remove_finish() on an #EBookClient object instead.
  **/
 gboolean
 e_book_remove_async (EBook *book,
@@ -2802,6 +2834,8 @@ e_book_remove_async (EBook *book,
  * Get the URI that this book has loaded. This string should not be freed.
  *
  * Returns: The URI.
+ *
+ * Deprecated: 3.2: Use e_client_get_uri() on an #EBookClient object instead.
  */
 const gchar *
 e_book_get_uri (EBook *book)
@@ -2818,6 +2852,8 @@ e_book_get_uri (EBook *book)
  * Get the #ESource that this book has loaded.
  *
  * Returns: The source.
+ *
+ * Deprecated: 3.2: Use e_client_get_source() on an #EBookClient object instead.
  */
 ESource *
 e_book_get_source (EBook *book)
@@ -2836,6 +2872,8 @@ e_book_get_source (EBook *book)
  * supports. This string should not be freed.
  *
  * Returns: The capabilities list
+ *
+ * Deprecated: 3.2: Use e_client_get_capabilities() or e_book_client_get_capabilities_sync() on an #EBookClient object instead.
  */
 const gchar *
 e_book_get_static_capabilities (EBook *book,
@@ -2849,7 +2887,7 @@ e_book_get_static_capabilities (EBook *book,
 	if (!book->priv->cap_queried) {
 		gchar *cap = NULL;
 
-		if (!e_gdbus_book_call_get_static_capabilities_sync (book->priv->gdbus_book, &cap, NULL, error)) {
+		if (!e_gdbus_book_call_get_capabilities_sync (book->priv->gdbus_book, &cap, NULL, error)) {
 			return NULL;
 		}
 
@@ -2869,6 +2907,8 @@ e_book_get_static_capabilities (EBook *book,
  * @cap.
  *
  * Returns: %TRUE if the backend supports @cap, %FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_client_check_capability() on an #EBookClient object instead.
  */
 gboolean
 e_book_check_static_capability (EBook *book,
@@ -2894,6 +2934,8 @@ e_book_check_static_capability (EBook *book,
  * Check if this book has been opened.
  *
  * Returns: %TRUE if this book has been opened, otherwise %FALSE.
+ *
+ * Deprecated: 3.2: Use e_client_is_opened() on an #EBookClient object instead.
  */
 gboolean
 e_book_is_opened (EBook *book)
@@ -2910,6 +2952,8 @@ e_book_is_opened (EBook *book)
  * Check if this book is writable.
  *
  * Returns: %TRUE if this book is writable, otherwise %FALSE.
+ *
+ * Deprecated: 3.2: Use e_client_is_readonly() on an #EBookClient object instead.
  */
 gboolean
 e_book_is_writable (EBook *book)
@@ -2926,6 +2970,8 @@ e_book_is_writable (EBook *book)
  * Check if this book is connected.
  *
  * Returns: %TRUE if this book is connected, otherwise %FALSE.
+ *
+ * Deprecated: 3.2: Use e_client_is_online() on an #EBookClient object instead.
  **/
 gboolean
 e_book_is_online (EBook *book)
@@ -2984,6 +3030,8 @@ make_me_card (void)
  * and set it in @contact and @book.
  *
  * Returns: %TRUE if successful, otherwise %FALSE.
+ *
+ * Deprecated: 3.2: Use e_book_client_get_self() instead.
  **/
 gboolean
 e_book_get_self (EContact **contact, EBook **book, GError **error)
@@ -3051,6 +3099,8 @@ e_book_get_self (EContact **contact, EBook **book, GError **error)
  * refers to the user of the address book.
  *
  * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_book_client_set_self() instead.
  **/
 gboolean
 e_book_set_self (EBook *book, EContact *contact, GError **error)
@@ -3074,6 +3124,8 @@ e_book_set_self (EBook *book, EContact *contact, GError **error)
  * Check if @contact is the user of the address book.
  *
  * Returns: %TRUE if @contact is the user, %FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_book_client_is_self() instead.
  **/
 gboolean
 e_book_is_self (EContact *contact)
@@ -3106,6 +3158,8 @@ e_book_is_self (EContact *contact)
  * that will be loaded in the e_book_get_default_addressbook call.
  *
  * Returns: %TRUE if the setting was stored in libebook's ESourceList, otherwise %FALSE.
+ *
+ * Deprecated: 3.2: Use e_book_client_set_default_addressbook() instead.
  */
 gboolean
 e_book_set_default_addressbook (EBook *book, GError **error)
@@ -3132,6 +3186,8 @@ e_book_set_default_addressbook (EBook *book, GError **error)
  * will be loaded in the e_book_get_default_addressbook call.
  *
  * Returns: %TRUE if the setting was stored in libebook's ESourceList, otherwise %FALSE.
+ *
+ * Deprecated: 3.2: Use e_book_client_set_default_source() instead.
  */
 gboolean
 e_book_set_default_source (ESource *source, GError **error)
@@ -3197,6 +3253,8 @@ e_book_set_default_source (ESource *source, GError **error)
  * added to Evolution.
  *
  * Returns: %TRUE if @addressbook_sources was set, otherwise %FALSE.
+ *
+ * Deprecated: 3.2: Use e_book_client_get_sources() instead.
  */
 gboolean
 e_book_get_addressbooks (ESourceList **addressbook_sources, GError **error)
@@ -3222,6 +3280,8 @@ e_book_get_addressbooks (ESourceList **addressbook_sources, GError **error)
  * e_book_open(), and e_book_remove().
  *
  * Returns: a new but unopened #EBook.
+ *
+ * Deprecated: 3.2: Use e_book_client_new() instead.
  */
 EBook *
 e_book_new (ESource *source, GError **error)
@@ -3248,7 +3308,7 @@ e_book_new (ESource *source, GError **error)
 
 	xml = e_source_to_standalone_xml (source);
 
-	if (!e_gdbus_book_factory_call_get_book_sync (book_factory_proxy, e_util_ensure_gdbus_string (xml, &gdbus_xml), &path, NULL, &err)) {
+	if (!e_gdbus_book_factory_call_get_book_sync (G_DBUS_PROXY (book_factory_proxy), e_util_ensure_gdbus_string (xml, &gdbus_xml), &path, NULL, &err)) {
 		unwrap_gerror (err, &err);
 		g_free (xml);
 		g_free (gdbus_xml);
@@ -3262,12 +3322,12 @@ e_book_new (ESource *source, GError **error)
 	g_free (xml);
 	g_free (gdbus_xml);
 
-	book->priv->gdbus_book = e_gdbus_book_proxy_new_sync (g_dbus_proxy_get_connection (G_DBUS_PROXY (book_factory_proxy)),
+	book->priv->gdbus_book = G_DBUS_PROXY (e_gdbus_book_proxy_new_sync (g_dbus_proxy_get_connection (G_DBUS_PROXY (book_factory_proxy)),
 						      G_DBUS_PROXY_FLAGS_NONE,
 						      ADDRESS_BOOK_DBUS_SERVICE_NAME,
 						      path,
 						      NULL,
-						      &err);
+						      &err));
 
 	if (!book->priv->gdbus_book) {
 		g_free (path);
@@ -3292,8 +3352,8 @@ e_book_new (ESource *source, GError **error)
 		gdbus_book_connection_gone_cb, book, NULL);
 	g_signal_connect (connection, "closed", G_CALLBACK (gdbus_book_closed_cb), book);
 
-	g_signal_connect (book->priv->gdbus_book, "writable", G_CALLBACK (writable_cb), book);
-	g_signal_connect (book->priv->gdbus_book, "connection", G_CALLBACK (connection_cb), book);
+	g_signal_connect (book->priv->gdbus_book, "readonly", G_CALLBACK (readonly_cb), book);
+	g_signal_connect (book->priv->gdbus_book, "online", G_CALLBACK (online_cb), book);
 	g_signal_connect (book->priv->gdbus_book, "auth-required", G_CALLBACK (auth_required_cb), book);
 
 	return book;
@@ -3376,6 +3436,8 @@ check_uri (ESource *source, gpointer uri)
  * documentation for e_book_new for further information.
  *
  * Returns: a new but unopened #EBook.
+ *
+ * Deprecated: 3.2: Use e_book_client_new_from_uri() instead.
  */
 EBook *
 e_book_new_from_uri (const gchar *uri, GError **error)
@@ -3445,6 +3507,8 @@ check_system (ESource *source, gpointer data)
  * information.
  *
  * Returns: a new but unopened #EBook.
+ *
+ * Deprecated: 3.2: Use e_book_client_new_system_addressbook() instead.
  */
 EBook *
 e_book_new_system_addressbook (GError **error)
@@ -3498,6 +3562,8 @@ e_book_new_system_addressbook (GError **error)
  * further information.
  *
  * Returns: a new but unopened #EBook
+ *
+ * Deprecated: 3.2: Use e_book_client_new_default_addressbook() instead.
  */
 EBook *
 e_book_new_default_addressbook (GError **error)
@@ -3668,3 +3734,5 @@ array_to_elist (gchar **list)
 
 	return elst;
 }
+
+#endif /* E_BOOK_DISABLE_DEPRECATED */
diff --git a/addressbook/libebook/e-book.h b/addressbook/libebook/e-book.h
index 17a10a2..4bdfc0e 100644
--- a/addressbook/libebook/e-book.h
+++ b/addressbook/libebook/e-book.h
@@ -11,6 +11,9 @@
 #ifndef __E_BOOK_H__
 #define __E_BOOK_H__
 
+/* e-book deprecated since 3.2, use e-book-client instead */
+#ifndef E_BOOK_DISABLE_DEPRECATED
+
 #include <glib.h>
 #include <glib-object.h>
 
@@ -411,4 +414,6 @@ GType        e_book_get_type                  (void);
 
 G_END_DECLS
 
+#endif /* E_BOOK_DISABLE_DEPRECATED */
+
 #endif /* __E_BOOK_H__ */
diff --git a/addressbook/libedata-book/Makefile.am b/addressbook/libedata-book/Makefile.am
index 5975f8d..584151c 100644
--- a/addressbook/libedata-book/Makefile.am
+++ b/addressbook/libedata-book/Makefile.am
@@ -31,7 +31,6 @@ libedata_book_1_2_la_SOURCES =				\
 	e-data-book-view.c				\
 	e-data-book.c					\
 	ximian-vcard.h					\
-	opid.c opid.h					\
 	$(ENUM_GENERATED)
 
 libedata_book_1_2_la_LIBADD =					\
diff --git a/addressbook/libedata-book/e-book-backend-sync.c b/addressbook/libedata-book/e-book-backend-sync.c
index 4492441..0ff670a 100644
--- a/addressbook/libedata-book/e-book-backend-sync.c
+++ b/addressbook/libedata-book/e-book-backend-sync.c
@@ -15,7 +15,7 @@
 G_DEFINE_TYPE (EBookBackendSync, e_book_backend_sync, E_TYPE_BOOK_BACKEND)
 
 struct _EBookBackendSyncPrivate {
-  gint mumble;
+	gint mumble;
 };
 
 static GObjectClass *parent_class;
@@ -35,10 +35,34 @@ e_book_backend_sync_construct (EBookBackendSync *backend)
 }
 
 /**
+ * e_book_backend_sync_open:
+ * @backend: an #EBookBackendSync
+ * @book: an #EDataBook
+ * @cancellable: a #GCancellable for the operation
+ * @only_if_exists: whether open only if exists
+ * @error: #GError to set, when something fails
+ *
+ * Opens @backend, which can involve connecting it to a remote server.
+ **/
+void
+e_book_backend_sync_open (EBookBackendSync *backend,
+			  EDataBook *book,
+			  GCancellable *cancellable,
+			  gboolean only_if_exists,
+			  GError **error)
+{
+	e_return_data_book_error_if_fail (E_IS_BOOK_BACKEND_SYNC (backend), E_DATA_BOOK_STATUS_INVALID_ARG);
+	e_return_data_book_error_if_fail (E_IS_DATA_BOOK (book), E_DATA_BOOK_STATUS_INVALID_ARG);
+	e_return_data_book_error_if_fail (E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->open_sync, E_DATA_BOOK_STATUS_NOT_SUPPORTED);
+
+	(* E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->open_sync) (backend, book, cancellable, only_if_exists, error);
+}
+
+/**
  * e_book_backend_sync_create_contact:
  * @backend: an #EBookBackendSync
  * @book: an #EDataBook
- * @opid: the unique ID of the operation
+ * @cancellable: a #GCancellable for the operation
  * @vcard: a VCard representation of a contact
  * @contact: a pointer to a location to store the resulting #EContact
  * @error: #GError to set, when something fails
@@ -48,7 +72,7 @@ e_book_backend_sync_construct (EBookBackendSync *backend)
 void
 e_book_backend_sync_create_contact (EBookBackendSync *backend,
 				    EDataBook *book,
-				    guint32 opid,
+				    GCancellable *cancellable,
 				    const gchar *vcard,
 				    EContact **contact,
 				    GError **error)
@@ -57,17 +81,16 @@ e_book_backend_sync_create_contact (EBookBackendSync *backend,
 	e_return_data_book_error_if_fail (E_IS_DATA_BOOK (book), E_DATA_BOOK_STATUS_INVALID_ARG);
 	e_return_data_book_error_if_fail (vcard, E_DATA_BOOK_STATUS_INVALID_ARG);
 	e_return_data_book_error_if_fail (contact, E_DATA_BOOK_STATUS_INVALID_ARG);
+	e_return_data_book_error_if_fail (E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->create_contact_sync, E_DATA_BOOK_STATUS_NOT_SUPPORTED);
 
-	g_assert (E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->create_contact_sync);
-
-	(* E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->create_contact_sync) (backend, book, opid, vcard, contact, error);
+	(* E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->create_contact_sync) (backend, book, cancellable, vcard, contact, error);
 }
 
 /**
  * e_book_backend_sync_remove:
  * @backend: an #EBookBackendSync
  * @book: an #EDataBook
- * @opid: the unique ID of the operation
+ * @cancellable: a #GCancellable for the operation
  * @error: #GError to set, when something fails
  *
  * Remove @book's database and storage overhead from the storage
@@ -76,23 +99,48 @@ e_book_backend_sync_create_contact (EBookBackendSync *backend,
 void
 e_book_backend_sync_remove (EBookBackendSync *backend,
 			    EDataBook *book,
-			    guint32 opid,
+			    GCancellable *cancellable,
 			    GError **error)
 {
 	e_return_data_book_error_if_fail (E_IS_BOOK_BACKEND_SYNC (backend), E_DATA_BOOK_STATUS_INVALID_ARG);
 	e_return_data_book_error_if_fail (E_IS_DATA_BOOK (book), E_DATA_BOOK_STATUS_INVALID_ARG);
+	e_return_data_book_error_if_fail (E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->remove_sync, E_DATA_BOOK_STATUS_NOT_SUPPORTED);
+
+	(* E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->remove_sync) (backend, book, cancellable, error);
+}
 
-	g_assert (E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->remove_sync);
+/**
+ * e_book_backend_sync_get_capabilities:
+ * @backend: an #EBookBackendSync
+ * @book: an #EDataBook
+ * @cancellable: a #GCancellable for the operation
+ * @capabilities: a string of comma-separated capabilities for this backend
+ * @removed_ids: a pointer to a location to store a list of the contacts actually removed
+ * @error: #GError to set, when something fails
+ *
+ * Queries for @capabilities of the @backend.
+ **/
+void
+e_book_backend_sync_get_capabilities (EBookBackendSync *backend,
+				      EDataBook *book,
+				      GCancellable *cancellable,
+				      gchar **capabilities,
+				      GError **error)
+{
+	e_return_data_book_error_if_fail (E_IS_BOOK_BACKEND_SYNC (backend), E_DATA_BOOK_STATUS_INVALID_ARG);
+	e_return_data_book_error_if_fail (E_IS_DATA_BOOK (book), E_DATA_BOOK_STATUS_INVALID_ARG);
+	e_return_data_book_error_if_fail (capabilities, E_DATA_BOOK_STATUS_INVALID_ARG);
+	e_return_data_book_error_if_fail (E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->get_capabilities_sync, E_DATA_BOOK_STATUS_NOT_SUPPORTED);
 
-	(* E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->remove_sync) (backend, book, opid, error);
+	(* E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->get_capabilities_sync) (backend, book, cancellable, capabilities, error);
 }
 
 /**
  * e_book_backend_sync_remove_contacts:
  * @backend: an #EBookBackendSync
  * @book: an #EDataBook
- * @opid: the unique ID of the operation
- * @id_list: a #GList of pointers to unique contact ID strings
+ * @cancellable: a #GCancellable for the operation
+ * @id_list: a #GSList of pointers to unique contact ID strings
  * @removed_ids: a pointer to a location to store a list of the contacts actually removed
  * @error: #GError to set, when something fails
  *
@@ -103,26 +151,25 @@ e_book_backend_sync_remove (EBookBackendSync *backend,
 void
 e_book_backend_sync_remove_contacts (EBookBackendSync *backend,
 				     EDataBook *book,
-				     guint32 opid,
-				     GList *id_list,
-				     GList **removed_ids,
+				     GCancellable *cancellable,
+				     const GSList *id_list,
+				     GSList **removed_ids,
 				     GError **error)
 {
 	e_return_data_book_error_if_fail (E_IS_BOOK_BACKEND_SYNC (backend), E_DATA_BOOK_STATUS_INVALID_ARG);
 	e_return_data_book_error_if_fail (E_IS_DATA_BOOK (book), E_DATA_BOOK_STATUS_INVALID_ARG);
 	e_return_data_book_error_if_fail (id_list, E_DATA_BOOK_STATUS_INVALID_ARG);
 	e_return_data_book_error_if_fail (removed_ids, E_DATA_BOOK_STATUS_INVALID_ARG);
+	e_return_data_book_error_if_fail (E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->remove_contacts_sync, E_DATA_BOOK_STATUS_NOT_SUPPORTED);
 
-	g_assert (E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->remove_contacts_sync);
-
-	(* E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->remove_contacts_sync) (backend, book, opid, id_list, removed_ids, error);
+	(* E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->remove_contacts_sync) (backend, book, cancellable, id_list, removed_ids, error);
 }
 
 /**
  * e_book_backend_sync_modify_contact:
  * @backend: an #EBookBackendSync
  * @book: an #EDataBook
- * @opid: the unique ID of the operation
+ * @cancellable: a #GCancellable for the operation
  * @vcard: the string representation of a contact
  * @contact: a pointer to a location to store the resulting #EContact
  * @error: #GError to set, when something fails
@@ -133,7 +180,7 @@ e_book_backend_sync_remove_contacts (EBookBackendSync *backend,
 void
 e_book_backend_sync_modify_contact (EBookBackendSync *backend,
 				    EDataBook *book,
-				    guint32 opid,
+				    GCancellable *cancellable,
 				    const gchar *vcard,
 				    EContact **contact,
 				    GError **error)
@@ -142,17 +189,16 @@ e_book_backend_sync_modify_contact (EBookBackendSync *backend,
 	e_return_data_book_error_if_fail (E_IS_DATA_BOOK (book), E_DATA_BOOK_STATUS_INVALID_ARG);
 	e_return_data_book_error_if_fail (vcard, E_DATA_BOOK_STATUS_INVALID_ARG);
 	e_return_data_book_error_if_fail (contact, E_DATA_BOOK_STATUS_INVALID_ARG);
+	e_return_data_book_error_if_fail (E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->modify_contact_sync, E_DATA_BOOK_STATUS_NOT_SUPPORTED);
 
-	g_assert (E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->modify_contact_sync);
-
-	(* E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->modify_contact_sync) (backend, book, opid, vcard, contact, error);
+	(* E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->modify_contact_sync) (backend, book, cancellable, vcard, contact, error);
 }
 
 /**
  * e_book_backend_sync_get_contact:
  * @backend: an #EBookBackendSync
  * @book: an #EDataBook
- * @opid: the unique ID of the operation
+ * @cancellable: a #GCancellable for the operation
  * @id: a unique contact ID
  * @vcard: a pointer to a location to store the resulting VCard string
  *
@@ -161,7 +207,7 @@ e_book_backend_sync_modify_contact (EBookBackendSync *backend,
 void
 e_book_backend_sync_get_contact (EBookBackendSync *backend,
 				 EDataBook *book,
-				 guint32 opid,
+				 GCancellable *cancellable,
 				 const gchar *id,
 				 gchar **vcard,
 				 GError **error)
@@ -170,17 +216,16 @@ e_book_backend_sync_get_contact (EBookBackendSync *backend,
 	e_return_data_book_error_if_fail (E_IS_DATA_BOOK (book), E_DATA_BOOK_STATUS_INVALID_ARG);
 	e_return_data_book_error_if_fail (id, E_DATA_BOOK_STATUS_INVALID_ARG);
 	e_return_data_book_error_if_fail (vcard, E_DATA_BOOK_STATUS_INVALID_ARG);
+	e_return_data_book_error_if_fail (E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->get_contact_sync, E_DATA_BOOK_STATUS_NOT_SUPPORTED);
 
-	g_assert (E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->get_contact_sync);
-
-	(* E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->get_contact_sync) (backend, book, opid, id, vcard, error);
+	(* E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->get_contact_sync) (backend, book, cancellable, id, vcard, error);
 }
 
 /**
  * e_book_backend_sync_get_contact_list:
  * @backend: an #EBookBackendSync
  * @book: an #EDataBook
- * @opid: the unique ID of the operation
+ * @cancellable: a #GCancellable for the operation
  * @query: an s-expression of the query to perform
  * @contacts: a pointer to a location to store the resulting list of VCard strings
  * @error: #GError to set, when something fails
@@ -191,87 +236,50 @@ e_book_backend_sync_get_contact (EBookBackendSync *backend,
 void
 e_book_backend_sync_get_contact_list (EBookBackendSync *backend,
 				      EDataBook *book,
-				      guint32 opid,
+				      GCancellable *cancellable,
 				      const gchar *query,
-				      GList **contacts,
+				      GSList **contacts,
 				      GError **error)
 {
 	e_return_data_book_error_if_fail (E_IS_BOOK_BACKEND_SYNC (backend), E_DATA_BOOK_STATUS_INVALID_ARG);
 	e_return_data_book_error_if_fail (E_IS_DATA_BOOK (book), E_DATA_BOOK_STATUS_INVALID_ARG);
 	e_return_data_book_error_if_fail (query, E_DATA_BOOK_STATUS_INVALID_ARG);
 	e_return_data_book_error_if_fail (contacts, E_DATA_BOOK_STATUS_INVALID_ARG);
+	e_return_data_book_error_if_fail (E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->get_contact_list_sync, E_DATA_BOOK_STATUS_NOT_SUPPORTED);
 
-	g_assert (E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->get_contact_list_sync);
-
-	(* E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->get_contact_list_sync) (backend, book, opid, query, contacts, error);
-}
-
-/**
- * e_book_backend_sync_get_changes:
- * @backend: an #EBookBackendSync
- * @book: an #EDataBook
- * @opid: the unique ID of the operation
- * @change_id: a unique changes ID
- * @changes: a pointer to a location to store the resulting list of changes
- * @error: #GError to set, when something fails
- *
- * Gets the changes made to @book since the last call to this function.
- * The returned list will contain items of CORBA type
- * #EDataBookChange.
- **/
-void
-e_book_backend_sync_get_changes (EBookBackendSync *backend,
-				 EDataBook *book,
-				 guint32 opid,
-				 const gchar *change_id,
-				 GList **changes,
-				 GError **error)
-{
-	e_return_data_book_error_if_fail (E_IS_BOOK_BACKEND_SYNC (backend), E_DATA_BOOK_STATUS_INVALID_ARG);
-	e_return_data_book_error_if_fail (E_IS_DATA_BOOK (book), E_DATA_BOOK_STATUS_INVALID_ARG);
-	e_return_data_book_error_if_fail (change_id, E_DATA_BOOK_STATUS_INVALID_ARG);
-	e_return_data_book_error_if_fail (changes, E_DATA_BOOK_STATUS_INVALID_ARG);
-
-	g_assert (E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->get_changes_sync);
-
-	(* E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->get_changes_sync) (backend, book, opid, change_id, changes, error);
+	(* E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->get_contact_list_sync) (backend, book, cancellable, query, contacts, error);
 }
 
 /**
  * e_book_backend_sync_authenticate_user:
  * @backend: an #EBookBackendSync
  * @book: an #EDataBook
- * @opid: the unique ID of the operation
- * @user: the user's name
- * @passwd: the user's password
- * @auth_method: the authentication method desired
+ * @cancellable: a #GCancellable for the operation
+ * @credentials: an #ECredentials to authenticate with
  * @error: #GError to set, when something fails
  *
- * Authenticates @user against @book.
+ * Authenticates @backend with given @credentials.
  **/
 void
 e_book_backend_sync_authenticate_user (EBookBackendSync *backend,
 				       EDataBook *book,
-				       guint32 opid,
-				       const gchar *user,
-				       const gchar *passwd,
-				       const gchar *auth_method,
+				       GCancellable *cancellable,
+				       ECredentials *credentials,
 				       GError **error)
 {
 	e_return_data_book_error_if_fail (E_IS_BOOK_BACKEND_SYNC (backend), E_DATA_BOOK_STATUS_INVALID_ARG);
 	e_return_data_book_error_if_fail (E_IS_DATA_BOOK (book), E_DATA_BOOK_STATUS_INVALID_ARG);
-	e_return_data_book_error_if_fail (user && passwd && auth_method, E_DATA_BOOK_STATUS_INVALID_ARG);
-
-	g_assert (E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->authenticate_user_sync);
+	e_return_data_book_error_if_fail (credentials, E_DATA_BOOK_STATUS_INVALID_ARG);
+	e_return_data_book_error_if_fail (E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->authenticate_user_sync, E_DATA_BOOK_STATUS_NOT_SUPPORTED);
 
-	(* E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->authenticate_user_sync) (backend, book, opid, user, passwd, auth_method, error);
+	(* E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->authenticate_user_sync) (backend, book, cancellable, credentials, error);
 }
 
 /**
  * e_book_backend_sync_get_required_fields:
  * @backend: an #EBookBackendSync
  * @book: an #EDataBook
- * @opid: the unique ID of the operation
+ * @cancellable: a #GCancellable for the operation
  * @fields: a pointer to a location to store the fields
  * @error: #GError to set, when something fails
  *
@@ -281,25 +289,24 @@ e_book_backend_sync_authenticate_user (EBookBackendSync *backend,
  **/
 void
 e_book_backend_sync_get_required_fields (EBookBackendSync *backend,
-					  EDataBook *book,
-					  guint32 opid,
-					  GList **fields,
-					  GError **error)
+					 EDataBook *book,
+					 GCancellable *cancellable,
+					 GSList **fields,
+					 GError **error)
 {
 	e_return_data_book_error_if_fail (E_IS_BOOK_BACKEND_SYNC (backend), E_DATA_BOOK_STATUS_INVALID_ARG);
 	e_return_data_book_error_if_fail (E_IS_DATA_BOOK (book), E_DATA_BOOK_STATUS_INVALID_ARG);
 	e_return_data_book_error_if_fail (fields, E_DATA_BOOK_STATUS_INVALID_ARG);
+	e_return_data_book_error_if_fail (E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->get_required_fields_sync, E_DATA_BOOK_STATUS_NOT_SUPPORTED);
 
-	g_assert (E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->get_required_fields_sync);
-
-	(* E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->get_required_fields_sync) (backend, book, opid, fields, error);
+	(* E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->get_required_fields_sync) (backend, book, cancellable, fields, error);
 }
 
 /**
  * e_book_backend_sync_get_supported_fields:
  * @backend: an #EBookBackendSync
  * @book: an #EDataBook
- * @opid: the unique ID of the operation
+ * @cancellable: a #GCancellable for the operation
  * @fields: a pointer to a location to store the fields
  * @error: #GError to set, when something fails
  *
@@ -310,24 +317,23 @@ e_book_backend_sync_get_required_fields (EBookBackendSync *backend,
 void
 e_book_backend_sync_get_supported_fields (EBookBackendSync *backend,
 					  EDataBook *book,
-					  guint32 opid,
-					  GList **fields,
+					  GCancellable *cancellable,
+					  GSList **fields,
 					  GError **error)
 {
 	e_return_data_book_error_if_fail (E_IS_BOOK_BACKEND_SYNC (backend), E_DATA_BOOK_STATUS_INVALID_ARG);
 	e_return_data_book_error_if_fail (E_IS_DATA_BOOK (book), E_DATA_BOOK_STATUS_INVALID_ARG);
 	e_return_data_book_error_if_fail (fields, E_DATA_BOOK_STATUS_INVALID_ARG);
+	e_return_data_book_error_if_fail (E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->get_supported_fields_sync, E_DATA_BOOK_STATUS_NOT_SUPPORTED);
 
-	g_assert (E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->get_supported_fields_sync);
-
-	(* E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->get_supported_fields_sync) (backend, book, opid, fields, error);
+	(* E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->get_supported_fields_sync) (backend, book, cancellable, fields, error);
 }
 
 /**
  * e_book_backend_sync_get_supported_auth_methods:
  * @backend: an #EBookBackendSync
  * @book: an #EDataBook
- * @opid: the unique ID of the operation
+ * @cancellable: a #GCancellable for the operation
  * @methods: a pointer to a location to store the methods
  * @error: #GError to set, when something fails
  *
@@ -338,41 +344,72 @@ e_book_backend_sync_get_supported_fields (EBookBackendSync *backend,
 void
 e_book_backend_sync_get_supported_auth_methods (EBookBackendSync *backend,
 						EDataBook *book,
-						guint32 opid,
-						GList **methods,
+						GCancellable *cancellable,
+						GSList **methods,
 						GError **error)
 {
 	e_return_data_book_error_if_fail (E_IS_BOOK_BACKEND_SYNC (backend), E_DATA_BOOK_STATUS_INVALID_ARG);
 	e_return_data_book_error_if_fail (E_IS_DATA_BOOK (book), E_DATA_BOOK_STATUS_INVALID_ARG);
 	e_return_data_book_error_if_fail (methods, E_DATA_BOOK_STATUS_INVALID_ARG);
+	e_return_data_book_error_if_fail (E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->get_supported_auth_methods_sync, E_DATA_BOOK_STATUS_NOT_SUPPORTED);
+
+	(* E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->get_supported_auth_methods_sync) (backend, book, cancellable, methods, error);
+}
+
+static void
+_e_book_backend_open (EBookBackend *backend,
+		      EDataBook    *book,
+		      guint32       opid,
+		      GCancellable *cancellable,
+		      gboolean only_if_exists)
+{
+	GError *error = NULL;
 
-	g_assert (E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->get_supported_auth_methods_sync);
+	e_book_backend_sync_open (E_BOOK_BACKEND_SYNC (backend), book, cancellable, only_if_exists, &error);
 
-	(* E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->get_supported_auth_methods_sync) (backend, book, opid, methods, error);
+	e_data_book_respond_open (book, opid, error);
 }
 
 static void
 _e_book_backend_remove (EBookBackend *backend,
 			EDataBook    *book,
-			guint32       opid)
+			guint32       opid,
+			GCancellable *cancellable)
 {
-	GError *error = NULL;;
+	GError *error = NULL;
 
-	e_book_backend_sync_remove (E_BOOK_BACKEND_SYNC (backend), book, opid, &error);
+	e_book_backend_sync_remove (E_BOOK_BACKEND_SYNC (backend), book, cancellable, &error);
 
 	e_data_book_respond_remove (book, opid, error);
 }
 
 static void
+_e_book_backend_get_capabilities (EBookBackend *backend,
+				  EDataBook    *book,
+				  guint32       opid,
+				  GCancellable *cancellable)
+{
+	GError *error = NULL;
+	gchar *capabilities = NULL;
+
+	e_book_backend_sync_get_capabilities (E_BOOK_BACKEND_SYNC (backend), book, cancellable, &capabilities, &error);
+
+	e_data_book_respond_get_capabilities (book, opid, error, capabilities);
+
+	g_free (capabilities);
+}
+
+static void
 _e_book_backend_create_contact (EBookBackend *backend,
 				EDataBook    *book,
 				guint32       opid,
+				GCancellable *cancellable,
 				const gchar   *vcard)
 {
 	GError *error = NULL;
 	EContact *contact = NULL;
 
-	e_book_backend_sync_create_contact (E_BOOK_BACKEND_SYNC (backend), book, opid, vcard, &contact, &error);
+	e_book_backend_sync_create_contact (E_BOOK_BACKEND_SYNC (backend), book, cancellable, vcard, &contact, &error);
 
 	e_data_book_respond_create (book, opid, error, contact);
 
@@ -384,29 +421,33 @@ static void
 _e_book_backend_remove_contacts (EBookBackend *backend,
 				 EDataBook    *book,
 				 guint32       opid,
-				 GList        *id_list)
+				 GCancellable *cancellable,
+				 const GSList *id_list)
 {
 	GError *error = NULL;
-	GList *ids = NULL;
+	GSList *ids = NULL;
 
-	e_book_backend_sync_remove_contacts (E_BOOK_BACKEND_SYNC (backend), book, opid, id_list, &ids, &error);
+	e_book_backend_sync_remove_contacts (E_BOOK_BACKEND_SYNC (backend), book, cancellable, id_list, &ids, &error);
 
 	e_data_book_respond_remove_contacts (book, opid, error, ids);
 
-	if (ids)
-		g_list_free (ids);
+	if (ids) {
+		g_slist_foreach (ids, (GFunc) g_free, NULL);
+		g_slist_free (ids);
+	}
 }
 
 static void
 _e_book_backend_modify_contact (EBookBackend *backend,
 				EDataBook    *book,
 				guint32       opid,
+				GCancellable *cancellable,
 				const gchar   *vcard)
 {
 	GError *error = NULL;
 	EContact *contact = NULL;
 
-	e_book_backend_sync_modify_contact (E_BOOK_BACKEND_SYNC (backend), book, opid, vcard, &contact, &error);
+	e_book_backend_sync_modify_contact (E_BOOK_BACKEND_SYNC (backend), book, cancellable, vcard, &contact, &error);
 
 	e_data_book_respond_modify (book, opid, error, contact);
 
@@ -418,12 +459,13 @@ static void
 _e_book_backend_get_contact (EBookBackend *backend,
 			     EDataBook    *book,
 			     guint32       opid,
+			     GCancellable *cancellable,
 			     const gchar   *id)
 {
 	GError *error = NULL;
 	gchar *vcard = NULL;
 
-	e_book_backend_sync_get_contact (E_BOOK_BACKEND_SYNC (backend), book, opid, id, &vcard, &error);
+	e_book_backend_sync_get_contact (E_BOOK_BACKEND_SYNC (backend), book, cancellable, id, &vcard, &error);
 
 	e_data_book_respond_get_contact (book, opid, error, vcard);
 
@@ -435,96 +477,88 @@ static void
 _e_book_backend_get_contact_list (EBookBackend *backend,
 				  EDataBook    *book,
 				  guint32       opid,
+				  GCancellable *cancellable,
 				  const gchar   *query)
 {
 	GError *error = NULL;
-	GList *cards = NULL;
+	GSList *cards = NULL;
 
-	e_book_backend_sync_get_contact_list (E_BOOK_BACKEND_SYNC (backend), book, opid, query, &cards, &error);
+	e_book_backend_sync_get_contact_list (E_BOOK_BACKEND_SYNC (backend), book, cancellable, query, &cards, &error);
 
 	e_data_book_respond_get_contact_list (book, opid, error, cards);
-}
 
-static void
-_e_book_backend_get_changes (EBookBackend *backend,
-			     EDataBook    *book,
-			     guint32       opid,
-			     const gchar   *change_id)
-{
-	GError *error = NULL;
-	GList *changes = NULL;
-
-	e_book_backend_sync_get_changes (E_BOOK_BACKEND_SYNC (backend), book, opid, change_id, &changes, &error);
-
-	e_data_book_respond_get_changes (book, opid, error, changes);
+	g_slist_foreach (cards, (GFunc) g_free, NULL);
+	g_slist_free (cards);
 }
 
 static void
 _e_book_backend_authenticate_user (EBookBackend *backend,
 				   EDataBook    *book,
 				   guint32       opid,
-				   const gchar   *user,
-				   const gchar   *passwd,
-				   const gchar   *auth_method)
+				   GCancellable *cancellable,
+				   ECredentials *credentials)
 {
 	GError *error = NULL;
 
-	e_book_backend_sync_authenticate_user (E_BOOK_BACKEND_SYNC (backend), book, opid, user, passwd, auth_method, &error);
+	e_book_backend_sync_authenticate_user (E_BOOK_BACKEND_SYNC (backend), book, cancellable, credentials, &error);
 
 	e_data_book_respond_authenticate_user (book, opid, error);
 }
 
 static void
 _e_book_backend_get_required_fields (EBookBackend *backend,
-				      EDataBook    *book,
-				      guint32       opid)
+				     EDataBook    *book,
+				     guint32       opid,
+				     GCancellable *cancellable)
 {
 	GError *error = NULL;
-	GList *fields = NULL;
+	GSList *fields = NULL;
 
-	e_book_backend_sync_get_required_fields (E_BOOK_BACKEND_SYNC (backend), book, opid, &fields, &error);
+	e_book_backend_sync_get_required_fields (E_BOOK_BACKEND_SYNC (backend), book, cancellable, &fields, &error);
 
 	e_data_book_respond_get_required_fields (book, opid, error, fields);
 
 	if (fields) {
-		g_list_foreach (fields, (GFunc)g_free, NULL);
-		g_list_free (fields);
+		g_slist_foreach (fields, (GFunc) g_free, NULL);
+		g_slist_free (fields);
 	}
 }
 
 static void
 _e_book_backend_get_supported_fields (EBookBackend *backend,
 				      EDataBook    *book,
-				      guint32       opid)
+				      guint32       opid,
+				      GCancellable *cancellable)
 {
 	GError *error = NULL;
-	GList *fields = NULL;
+	GSList *fields = NULL;
 
-	e_book_backend_sync_get_supported_fields (E_BOOK_BACKEND_SYNC (backend), book, opid, &fields, &error);
+	e_book_backend_sync_get_supported_fields (E_BOOK_BACKEND_SYNC (backend), book, cancellable, &fields, &error);
 
 	e_data_book_respond_get_supported_fields (book, opid, error, fields);
 
 	if (fields) {
-		g_list_foreach (fields, (GFunc)g_free, NULL);
-		g_list_free (fields);
+		g_slist_foreach (fields, (GFunc) g_free, NULL);
+		g_slist_free (fields);
 	}
 }
 
 static void
 _e_book_backend_get_supported_auth_methods (EBookBackend *backend,
 					    EDataBook    *book,
-					    guint32       opid)
+					    guint32       opid,
+					    GCancellable *cancellable)
 {
 	GError *error = NULL;
-	GList *methods = NULL;
+	GSList *methods = NULL;
 
-	e_book_backend_sync_get_supported_auth_methods (E_BOOK_BACKEND_SYNC (backend), book, opid, &methods, &error);
+	e_book_backend_sync_get_supported_auth_methods (E_BOOK_BACKEND_SYNC (backend), book, cancellable, &methods, &error);
 
 	e_data_book_respond_get_supported_auth_methods (book, opid, error, methods);
 
 	if (methods) {
-		g_list_foreach (methods, (GFunc)g_free, NULL);
-		g_list_free (methods);
+		g_slist_foreach (methods, (GFunc) g_free, NULL);
+		g_slist_free (methods);
 	}
 }
 
@@ -564,14 +598,15 @@ e_book_backend_sync_class_init (EBookBackendSyncClass *klass)
 
 	object_class = (GObjectClass *) klass;
 
+	backend_class->open = _e_book_backend_open;
+	backend_class->authenticate_user = _e_book_backend_authenticate_user;
 	backend_class->remove = _e_book_backend_remove;
+	backend_class->get_capabilities = _e_book_backend_get_capabilities;
 	backend_class->create_contact = _e_book_backend_create_contact;
 	backend_class->remove_contacts = _e_book_backend_remove_contacts;
 	backend_class->modify_contact = _e_book_backend_modify_contact;
 	backend_class->get_contact = _e_book_backend_get_contact;
 	backend_class->get_contact_list = _e_book_backend_get_contact_list;
-	backend_class->get_changes = _e_book_backend_get_changes;
-	backend_class->authenticate_user = _e_book_backend_authenticate_user;
 	backend_class->get_required_fields = _e_book_backend_get_required_fields;
 	backend_class->get_supported_fields = _e_book_backend_get_supported_fields;
 	backend_class->get_supported_auth_methods = _e_book_backend_get_supported_auth_methods;
diff --git a/addressbook/libedata-book/e-book-backend-sync.h b/addressbook/libedata-book/e-book-backend-sync.h
index 16fb4fb..38d80bf 100644
--- a/addressbook/libedata-book/e-book-backend-sync.h
+++ b/addressbook/libedata-book/e-book-backend-sync.h
@@ -29,67 +29,38 @@ struct _EBookBackendSyncClass {
 	EBookBackendClass parent_class;
 
 	/* Virtual methods */
-	void (*remove_sync) (EBookBackendSync *backend, EDataBook *book, guint32 opid, GError **perror);
-	void (*create_contact_sync)  (EBookBackendSync *backend, EDataBook *book,
-							guint32 opid,
-							const gchar *vcard, EContact **contact, GError **perror);
-	void (*remove_contacts_sync) (EBookBackendSync *backend, EDataBook *book,
-							guint32 opid,
-							GList *id_list, GList **removed_ids, GError **perror);
-	void (*modify_contact_sync)  (EBookBackendSync *backend, EDataBook *book,
-							guint32 opid,
-							const gchar *vcard, EContact **contact, GError **perror);
-	void (*get_contact_sync) (EBookBackendSync *backend, EDataBook *book,
-						    guint32 opid,
-						    const gchar *id, gchar **vcard, GError **perror);
-	void (*get_contact_list_sync) (EBookBackendSync *backend, EDataBook *book,
-							 guint32 opid,
-							 const gchar *query, GList **contacts, GError **perror);
-	void (*get_changes_sync) (EBookBackendSync *backend, EDataBook *book,
-						    guint32 opid,
-						    const gchar *change_id, GList **changes, GError **perror);
-	void (*authenticate_user_sync) (EBookBackendSync *backend, EDataBook *book,
-							  guint32 opid,
-							  const gchar *user,
-							  const gchar *passwd,
-							  const gchar *auth_method, GError **perror);
-
-	void (*get_required_fields_sync) (EBookBackendSync *backend, EDataBook *book,
-							     guint32 opid,
-							     GList **fields, GError **perror);
-
-	void (*get_supported_fields_sync) (EBookBackendSync *backend, EDataBook *book,
-							     guint32 opid,
-							     GList **fields, GError **perror);
-	void (*get_supported_auth_methods_sync) (EBookBackendSync *backend, EDataBook *book,
-								   guint32 opid,
-								   GList **methods, GError **perror);
-
-	/* Padding for future expansion */
-	void (*_pas_reserved0) (void);
-	void (*_pas_reserved1) (void);
-	void (*_pas_reserved2) (void);
-	void (*_pas_reserved3) (void);
-	void (*_pas_reserved4) (void);
-
+	void (*open_sync)			(EBookBackendSync *backend, EDataBook *book, GCancellable *cancellable, gboolean only_if_exists, GError **error);
+	void (*authenticate_user_sync)		(EBookBackendSync *backend, EDataBook *book, GCancellable *cancellable, ECredentials *credentials, GError **error);
+	void (*remove_sync)			(EBookBackendSync *backend, EDataBook *book, GCancellable *cancellable, GError **error);
+	void (*get_capabilities_sync)		(EBookBackendSync *backend, EDataBook *book, GCancellable *cancellable, gchar **capabilities, GError **error);
+	void (*create_contact_sync)		(EBookBackendSync *backend, EDataBook *book, GCancellable *cancellable, const gchar *vcard, EContact **contact, GError **error);
+	void (*remove_contacts_sync)		(EBookBackendSync *backend, EDataBook *book, GCancellable *cancellable, const GSList *id_list, GSList **removed_ids, GError **error);
+	void (*modify_contact_sync)		(EBookBackendSync *backend, EDataBook *book, GCancellable *cancellable, const gchar *vcard, EContact **contact, GError **error);
+	void (*get_contact_sync)		(EBookBackendSync *backend, EDataBook *book, GCancellable *cancellable, const gchar *id, gchar **vcard, GError **error);
+	void (*get_contact_list_sync)		(EBookBackendSync *backend, EDataBook *book, GCancellable *cancellable, const gchar *query, GSList **contacts, GError **error);
+
+	void (*get_required_fields_sync)	(EBookBackendSync *backend, EDataBook *book, GCancellable *cancellable, GSList **fields, GError **error);
+	void (*get_supported_fields_sync)	(EBookBackendSync *backend, EDataBook *book, GCancellable *cancellable, GSList **fields, GError **error);
+	void (*get_supported_auth_methods_sync)	(EBookBackendSync *backend, EDataBook *book, GCancellable *cancellable, GSList **methods, GError **error);
 };
 
-gboolean    e_book_backend_sync_construct                (EBookBackendSync             *backend);
+GType		e_book_backend_sync_get_type		(void);
 
-GType       e_book_backend_sync_get_type                 (void);
+gboolean	e_book_backend_sync_construct		(EBookBackendSync *backend);
 
-void e_book_backend_sync_remove  (EBookBackendSync *backend, EDataBook *book, guint32 opid, GError **perror);
-void e_book_backend_sync_create_contact  (EBookBackendSync *backend, EDataBook *book, guint32 opid, const gchar *vcard, EContact **contact, GError **perror);
-void e_book_backend_sync_remove_contacts (EBookBackendSync *backend, EDataBook *book, guint32 opid, GList *id_list, GList **removed_ids, GError **perror);
-void e_book_backend_sync_modify_contact  (EBookBackendSync *backend, EDataBook *book, guint32 opid, const gchar *vcard, EContact **contact, GError **perror);
-void e_book_backend_sync_get_contact (EBookBackendSync *backend, EDataBook *book, guint32 opid, const gchar *id, gchar **vcard, GError **perror);
-void e_book_backend_sync_get_contact_list (EBookBackendSync *backend, EDataBook *book, guint32 opid, const gchar *query, GList **contacts, GError **perror);
-void e_book_backend_sync_get_changes (EBookBackendSync *backend, EDataBook *book, guint32 opid, const gchar *change_id, GList **changes, GError **perror);
-void e_book_backend_sync_authenticate_user (EBookBackendSync *backend, EDataBook *book, guint32 opid, const gchar *user, const gchar *passwd, const gchar *auth_method, GError **perror);
+void		e_book_backend_sync_open		(EBookBackendSync *backend, EDataBook *book, GCancellable *cancellable, gboolean only_if_exists, GError **error);
+void		e_book_backend_sync_authenticate_user	(EBookBackendSync *backend, EDataBook *book, GCancellable *cancellable, ECredentials *credentials, GError **error);
+void		e_book_backend_sync_remove		(EBookBackendSync *backend, EDataBook *book, GCancellable *cancellable, GError **error);
+void		e_book_backend_sync_get_capabilities	(EBookBackendSync *backend, EDataBook *book, GCancellable *cancellable, gchar **capabilities, GError **error);
+void		e_book_backend_sync_create_contact	(EBookBackendSync *backend, EDataBook *book, GCancellable *cancellable, const gchar *vcard, EContact **contact, GError **error);
+void		e_book_backend_sync_remove_contacts	(EBookBackendSync *backend, EDataBook *book, GCancellable *cancellable, const GSList *id_list, GSList **removed_ids, GError **error);
+void		e_book_backend_sync_modify_contact	(EBookBackendSync *backend, EDataBook *book, GCancellable *cancellable, const gchar *vcard, EContact **contact, GError **error);
+void		e_book_backend_sync_get_contact		(EBookBackendSync *backend, EDataBook *book, GCancellable *cancellable, const gchar *id, gchar **vcard, GError **error);
+void		e_book_backend_sync_get_contact_list	(EBookBackendSync *backend, EDataBook *book, GCancellable *cancellable, const gchar *query, GSList **contacts, GError **error);
 
-void e_book_backend_sync_get_required_fields (EBookBackendSync *backend, EDataBook *book, guint32 opid, GList **fields, GError **perror);
-void e_book_backend_sync_get_supported_fields (EBookBackendSync *backend, EDataBook *book, guint32 opid, GList **fields, GError **perror);
-void e_book_backend_sync_get_supported_auth_methods (EBookBackendSync *backend, EDataBook *book, guint32 opid, GList **methods, GError **perror);
+void		e_book_backend_sync_get_required_fields	(EBookBackendSync *backend, EDataBook *book, GCancellable *cancellable, GSList **fields, GError **error);
+void		e_book_backend_sync_get_supported_fields(EBookBackendSync *backend, EDataBook *book, GCancellable *cancellable, GSList **fields, GError **error);
+void		e_book_backend_sync_get_supported_auth_methods (EBookBackendSync *backend, EDataBook *book, GCancellable *cancellable, GSList **methods, GError **error);
 
 G_END_DECLS
 
diff --git a/addressbook/libedata-book/e-book-backend.c b/addressbook/libedata-book/e-book-backend.c
index 88228ac..6e8a031 100644
--- a/addressbook/libedata-book/e-book-backend.c
+++ b/addressbook/libedata-book/e-book-backend.c
@@ -15,16 +15,14 @@
 #include "e-book-backend.h"
 
 struct _EBookBackendPrivate {
-	GMutex *open_mutex;
-
 	GMutex *clients_mutex;
-	GList *clients;
+	GSList *clients;
 
 	ESource *source;
-	gboolean loaded, writable, removed, online;
+	gboolean loaded, readonly, removed, online;
 
 	GMutex *views_mutex;
-	EList *views;
+	GSList *views;
 
 	gchar *cache_dir;
 };
@@ -111,7 +109,7 @@ book_backend_dispose (GObject *object)
 	priv = E_BOOK_BACKEND (object)->priv;
 
 	if (priv->views != NULL) {
-		g_object_unref (priv->views);
+		g_slist_free (priv->views);
 		priv->views = NULL;
 	}
 
@@ -131,9 +129,8 @@ book_backend_finalize (GObject *object)
 
 	priv = E_BOOK_BACKEND (object)->priv;
 
-	g_list_free (priv->clients);
+	g_slist_free (priv->clients);
 
-	g_mutex_free (priv->open_mutex);
 	g_mutex_free (priv->clients_mutex);
 	g_mutex_free (priv->views_mutex);
 
@@ -182,11 +179,10 @@ e_book_backend_init (EBookBackend *backend)
 	backend->priv = G_TYPE_INSTANCE_GET_PRIVATE (
 		backend, E_TYPE_BOOK_BACKEND, EBookBackendPrivate);
 
-	backend->priv->views = e_list_new (
-		(EListCopyFunc) NULL, (EListFreeFunc) NULL, NULL);
-
-	backend->priv->open_mutex = g_mutex_new ();
+	backend->priv->clients = NULL;
 	backend->priv->clients_mutex = g_mutex_new ();
+
+	backend->priv->views = NULL;
 	backend->priv->views_mutex = g_mutex_new ();
 }
 
@@ -216,7 +212,7 @@ e_book_backend_get_cache_dir (EBookBackend *backend)
  * Sets the cache directory for the given backend.
  *
  * Note that #EBookBackend is initialized with a usable default based on
- * the #ESource given to e_book_backend_load_source().  Backends should
+ * the #ESource given to e_book_backend_open().  Backends should
  * not override the default without good reason.
  *
  * Since: 2.32
@@ -235,48 +231,6 @@ e_book_backend_set_cache_dir (EBookBackend *backend,
 }
 
 /**
- * e_book_backend_load_source:
- * @backend: an #EBookBackend
- * @source: an #ESource to load
- * @only_if_exists: %TRUE to prevent the creation of a new book
- * @error: #GError to set, when something fails
- *
- * Loads @source into @backend.
- **/
-void
-e_book_backend_load_source (EBookBackend           *backend,
-			    ESource                *source,
-			    gboolean                only_if_exists,
-			    GError		  **error)
-{
-	GError *local_error = NULL;
-
-	e_return_data_book_error_if_fail (E_IS_BOOK_BACKEND (backend), E_DATA_BOOK_STATUS_INVALID_ARG);
-	e_return_data_book_error_if_fail (source, E_DATA_BOOK_STATUS_INVALID_ARG);
-	e_return_data_book_error_if_fail (backend->priv->loaded == FALSE, E_DATA_BOOK_STATUS_INVALID_ARG);
-
-	/* Subclasses may need to call e_book_backend_get_cache_dir() in
-	 * their load_source() methods, so get the "cache-dir" property
-	 * initialized before we call the method. */
-	backend->priv->source = g_object_ref (source);
-	book_backend_set_default_cache_dir (backend);
-
-	g_assert (E_BOOK_BACKEND_GET_CLASS (backend)->load_source);
-
-	g_object_ref (backend);
-
-	(* E_BOOK_BACKEND_GET_CLASS (backend)->load_source) (backend, source, only_if_exists, &local_error);
-
-	g_object_unref (backend);
-
-	if (g_error_matches (local_error, E_DATA_BOOK_ERROR,
-		E_DATA_BOOK_STATUS_INVALID_SERVER_VERSION))
-		g_error_free (local_error);
-	else if (local_error != NULL)
-		g_propagate_error (error, local_error);
-}
-
-/**
  * e_book_backend_get_source:
  * @backend: An addressbook backend.
  *
@@ -297,47 +251,50 @@ e_book_backend_get_source (EBookBackend *backend)
  * @backend: an #EBookBackend
  * @book: an #EDataBook
  * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
  * @only_if_exists: %TRUE to prevent the creation of a new book
  *
  * Executes an 'open' request specified by @opid on @book
- * using @backend.
+ * using @backend. This might be finished with e_data_book_respond_open().
  **/
 void
 e_book_backend_open (EBookBackend *backend,
 		     EDataBook    *book,
 		     guint32       opid,
+		     GCancellable *cancellable,
 		     gboolean      only_if_exists)
 {
 	g_return_if_fail (E_IS_BOOK_BACKEND (backend));
 	g_return_if_fail (E_IS_DATA_BOOK (book));
 
-	g_mutex_lock (backend->priv->open_mutex);
-
 	if (backend->priv->loaded) {
-		e_data_book_report_writable (book, backend->priv->writable);
-		e_data_book_report_connection_status (book, backend->priv->online);
+		e_data_book_report_readonly (book, backend->priv->readonly);
+		e_data_book_report_online (book, backend->priv->online);
 
 		e_data_book_respond_open (book, opid, NULL);
 	} else {
-		GError *error = NULL;
+		ESource *source = e_data_book_get_source (book);
 
-		e_book_backend_load_source (backend, e_data_book_get_source (book), only_if_exists, &error);
+		g_return_if_fail (E_IS_BOOK_BACKEND (backend));
+		g_return_if_fail (source != NULL);
 
-		if (!error || g_error_matches (error, E_DATA_BOOK_ERROR, E_DATA_BOOK_STATUS_INVALID_SERVER_VERSION)) {
-			e_data_book_report_writable (book, backend->priv->writable);
-			e_data_book_report_connection_status (book, backend->priv->online);
-		}
+		/* Subclasses may need to call e_book_backend_get_cache_dir() in
+		 * their open() methods, so get the "cache-dir" property
+		 * initialized before we call the method. */
+		backend->priv->source = g_object_ref (source);
+		book_backend_set_default_cache_dir (backend);
 
-		e_data_book_respond_open (book, opid, error);
-	}
+		g_return_if_fail (E_BOOK_BACKEND_GET_CLASS (backend)->open != NULL);
 
-	g_mutex_unlock (backend->priv->open_mutex);
+		(* E_BOOK_BACKEND_GET_CLASS (backend)->open) (backend, book, opid, cancellable, only_if_exists);
+	}
 }
 
 /**
  * e_book_backend_remove:
  * @backend: an #EBookBackend
  * @book: an #EDataBook
+ * @cancellable: a #GCancellable for the operation
  * @opid: the ID to use for this operation
  *
  * Executes a 'remove' request to remove all of @backend's data,
@@ -346,18 +303,14 @@ e_book_backend_open (EBookBackend *backend,
 void
 e_book_backend_remove (EBookBackend *backend,
 		       EDataBook    *book,
-		       guint32       opid)
+		       guint32       opid,
+		       GCancellable *cancellable)
 {
 	g_return_if_fail (E_IS_BOOK_BACKEND (backend));
 	g_return_if_fail (E_IS_DATA_BOOK (book));
+	g_return_if_fail (E_BOOK_BACKEND_GET_CLASS (backend)->remove);
 
-	g_assert (E_BOOK_BACKEND_GET_CLASS (backend)->remove);
-
-	g_object_ref (backend);
-
-	(* E_BOOK_BACKEND_GET_CLASS (backend)->remove) (backend, book, opid);
-
-	g_object_unref (backend);
+	(* E_BOOK_BACKEND_GET_CLASS (backend)->remove) (backend, book, opid, cancellable);
 }
 
 /**
@@ -365,6 +318,7 @@ e_book_backend_remove (EBookBackend *backend,
  * @backend: an #EBookBackend
  * @book: an #EDataBook
  * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
  * @vcard: the VCard to add
  *
  * Executes a 'create contact' request specified by @opid on @book
@@ -374,19 +328,15 @@ void
 e_book_backend_create_contact (EBookBackend *backend,
 			       EDataBook    *book,
 			       guint32       opid,
+			       GCancellable *cancellable,
 			       const gchar   *vcard)
 {
 	g_return_if_fail (E_IS_BOOK_BACKEND (backend));
 	g_return_if_fail (E_IS_DATA_BOOK (book));
 	g_return_if_fail (vcard);
+	g_return_if_fail (E_BOOK_BACKEND_GET_CLASS (backend)->create_contact);
 
-	g_assert (E_BOOK_BACKEND_GET_CLASS (backend)->create_contact);
-
-	g_object_ref (backend);
-
-	(* E_BOOK_BACKEND_GET_CLASS (backend)->create_contact) (backend, book, opid, vcard);
-
-	g_object_unref (backend);
+	(* E_BOOK_BACKEND_GET_CLASS (backend)->create_contact) (backend, book, opid, cancellable, vcard);
 }
 
 /**
@@ -394,6 +344,7 @@ e_book_backend_create_contact (EBookBackend *backend,
  * @backend: an #EBookBackend
  * @book: an #EDataBook
  * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
  * @id_list: list of string IDs to remove
  *
  * Executes a 'remove contacts' request specified by @opid on @book
@@ -403,19 +354,15 @@ void
 e_book_backend_remove_contacts (EBookBackend *backend,
 				EDataBook    *book,
 				guint32       opid,
-				GList        *id_list)
+			        GCancellable *cancellable,
+				const GSList *id_list)
 {
 	g_return_if_fail (E_IS_BOOK_BACKEND (backend));
 	g_return_if_fail (E_IS_DATA_BOOK (book));
 	g_return_if_fail (id_list);
+	g_return_if_fail (E_BOOK_BACKEND_GET_CLASS (backend)->remove_contacts);
 
-	g_assert (E_BOOK_BACKEND_GET_CLASS (backend)->remove_contacts);
-
-	g_object_ref (backend);
-
-	(* E_BOOK_BACKEND_GET_CLASS (backend)->remove_contacts) (backend, book, opid, id_list);
-
-	g_object_unref (backend);
+	(* E_BOOK_BACKEND_GET_CLASS (backend)->remove_contacts) (backend, book, opid, cancellable, id_list);
 }
 
 /**
@@ -423,6 +370,7 @@ e_book_backend_remove_contacts (EBookBackend *backend,
  * @backend: an #EBookBackend
  * @book: an #EDataBook
  * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
  * @vcard: the VCard to update
  *
  * Executes a 'modify contact' request specified by @opid on @book
@@ -432,19 +380,15 @@ void
 e_book_backend_modify_contact (EBookBackend *backend,
 			       EDataBook    *book,
 			       guint32       opid,
+			       GCancellable *cancellable,
 			       const gchar   *vcard)
 {
 	g_return_if_fail (E_IS_BOOK_BACKEND (backend));
 	g_return_if_fail (E_IS_DATA_BOOK (book));
 	g_return_if_fail (vcard);
+	g_return_if_fail (E_BOOK_BACKEND_GET_CLASS (backend)->modify_contact);
 
-	g_assert (E_BOOK_BACKEND_GET_CLASS (backend)->modify_contact);
-
-	g_object_ref (backend);
-
-	(* E_BOOK_BACKEND_GET_CLASS (backend)->modify_contact) (backend, book, opid, vcard);
-
-	g_object_unref (backend);
+	(* E_BOOK_BACKEND_GET_CLASS (backend)->modify_contact) (backend, book, opid, cancellable, vcard);
 }
 
 /**
@@ -452,6 +396,7 @@ e_book_backend_modify_contact (EBookBackend *backend,
  * @backend: an #EBookBackend
  * @book: an #EDataBook
  * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
  * @id: the ID of the contact to get
  *
  * Executes a 'get contact' request specified by @opid on @book
@@ -461,19 +406,15 @@ void
 e_book_backend_get_contact (EBookBackend *backend,
 			    EDataBook    *book,
 			    guint32       opid,
+			    GCancellable *cancellable,
 			    const gchar   *id)
 {
 	g_return_if_fail (E_IS_BOOK_BACKEND (backend));
 	g_return_if_fail (E_IS_DATA_BOOK (book));
 	g_return_if_fail (id);
+	g_return_if_fail (E_BOOK_BACKEND_GET_CLASS (backend)->get_contact);
 
-	g_assert (E_BOOK_BACKEND_GET_CLASS (backend)->get_contact);
-
-	g_object_ref (backend);
-
-	(* E_BOOK_BACKEND_GET_CLASS (backend)->get_contact) (backend, book, opid, id);
-
-	g_object_unref (backend);
+	(* E_BOOK_BACKEND_GET_CLASS (backend)->get_contact) (backend, book, opid, cancellable, id);
 }
 
 /**
@@ -481,6 +422,7 @@ e_book_backend_get_contact (EBookBackend *backend,
  * @backend: an #EBookBackend
  * @book: an #EDataBook
  * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
  * @query: the s-expression to match
  *
  * Executes a 'get contact list' request specified by @opid on @book
@@ -490,19 +432,15 @@ void
 e_book_backend_get_contact_list (EBookBackend *backend,
 				 EDataBook    *book,
 				 guint32       opid,
+				 GCancellable *cancellable,
 				 const gchar   *query)
 {
 	g_return_if_fail (E_IS_BOOK_BACKEND (backend));
 	g_return_if_fail (E_IS_DATA_BOOK (book));
 	g_return_if_fail (query);
+	g_return_if_fail (E_BOOK_BACKEND_GET_CLASS (backend)->get_contact_list);
 
-	g_assert (E_BOOK_BACKEND_GET_CLASS (backend)->get_contact_list);
-
-	g_object_ref (backend);
-
-	(* E_BOOK_BACKEND_GET_CLASS (backend)->get_contact_list) (backend, book, opid, query);
-
-	g_object_unref (backend);
+	(* E_BOOK_BACKEND_GET_CLASS (backend)->get_contact_list) (backend, book, opid, cancellable, query);
 }
 
 /**
@@ -519,14 +457,9 @@ e_book_backend_start_book_view (EBookBackend  *backend,
 {
 	g_return_if_fail (E_IS_BOOK_BACKEND (backend));
 	g_return_if_fail (E_IS_DATA_BOOK_VIEW (book_view));
-
-	g_assert (E_BOOK_BACKEND_GET_CLASS (backend)->start_book_view);
-
-	g_object_ref (backend);
+	g_return_if_fail (E_BOOK_BACKEND_GET_CLASS (backend)->start_book_view);
 
 	(* E_BOOK_BACKEND_GET_CLASS (backend)->start_book_view) (backend, book_view);
-
-	g_object_unref (backend);
 }
 
 /**
@@ -543,43 +476,9 @@ e_book_backend_stop_book_view (EBookBackend  *backend,
 {
 	g_return_if_fail (E_IS_BOOK_BACKEND (backend));
 	g_return_if_fail (E_IS_DATA_BOOK_VIEW (book_view));
-
-	g_assert (E_BOOK_BACKEND_GET_CLASS (backend)->stop_book_view);
-
-	g_object_ref (backend);
+	g_return_if_fail (E_BOOK_BACKEND_GET_CLASS (backend)->stop_book_view);
 
 	(* E_BOOK_BACKEND_GET_CLASS (backend)->stop_book_view) (backend, book_view);
-
-	g_object_unref (backend);
-}
-
-/**
- * e_book_backend_get_changes:
- * @backend: an #EBookBackend
- * @book: an #EDataBook
- * @opid: the ID to use for this operation
- * @change_id: the ID of the changeset
- *
- * Executes a 'get changes' request specified by @opid on @book
- * using @backend.
- **/
-void
-e_book_backend_get_changes (EBookBackend *backend,
-			    EDataBook    *book,
-			    guint32       opid,
-			    const gchar   *change_id)
-{
-	g_return_if_fail (E_IS_BOOK_BACKEND (backend));
-	g_return_if_fail (E_IS_DATA_BOOK (book));
-	g_return_if_fail (change_id);
-
-	g_assert (E_BOOK_BACKEND_GET_CLASS (backend)->get_changes);
-
-	g_object_ref (backend);
-
-	(* E_BOOK_BACKEND_GET_CLASS (backend)->get_changes) (backend, book, opid, change_id);
-
-	g_object_unref (backend);
 }
 
 /**
@@ -587,9 +486,8 @@ e_book_backend_get_changes (EBookBackend *backend,
  * @backend: an #EBookBackend
  * @book: an #EDataBook
  * @opid: the ID to use for this operation
- * @user: the name of the user account
- * @passwd: the user's password
- * @auth_method: the authentication method to use
+ * @cancellable: a #GCancellable for the operation
+ * @credentials: #ECredentials to use for authentication
  *
  * Executes an 'authenticate' request specified by @opid on @book
  * using @backend.
@@ -598,27 +496,22 @@ void
 e_book_backend_authenticate_user (EBookBackend *backend,
 				  EDataBook    *book,
 				  guint32       opid,
-				  const gchar   *user,
-				  const gchar   *passwd,
-				  const gchar   *auth_method)
+				  GCancellable *cancellable,
+				  ECredentials *credentials)
 {
 	g_return_if_fail (E_IS_BOOK_BACKEND (backend));
 	g_return_if_fail (E_IS_DATA_BOOK (book));
-	g_return_if_fail (user && passwd && auth_method);
-
-	g_assert (E_BOOK_BACKEND_GET_CLASS (backend)->authenticate_user);
-
-	g_object_ref (backend);
+	g_return_if_fail (credentials != NULL);
+	g_return_if_fail (E_BOOK_BACKEND_GET_CLASS (backend)->authenticate_user);
 
-	(* E_BOOK_BACKEND_GET_CLASS (backend)->authenticate_user) (backend, book, opid, user, passwd, auth_method);
-
-	g_object_unref (backend);
+	(* E_BOOK_BACKEND_GET_CLASS (backend)->authenticate_user) (backend, book, opid, cancellable, credentials);
 }
 
 /**
  * e_book_backend_get_required_fields:
  * @backend: an #EBookBackend
  * @book: an #EDataBook
+ * @cancellable: a #GCancellable for the operation
  * @opid: the ID to use for this operation
  *
  * Executes a 'get required fields' request specified by @opid on @book
@@ -627,19 +520,14 @@ e_book_backend_authenticate_user (EBookBackend *backend,
 void
 e_book_backend_get_required_fields (EBookBackend *backend,
 				     EDataBook    *book,
-				     guint32       opid)
-
+				     guint32       opid,
+				     GCancellable *cancellable)
 {
 	g_return_if_fail (E_IS_BOOK_BACKEND (backend));
 	g_return_if_fail (E_IS_DATA_BOOK (book));
+	g_return_if_fail (E_BOOK_BACKEND_GET_CLASS (backend)->get_required_fields);
 
-	g_assert (E_BOOK_BACKEND_GET_CLASS (backend)->get_required_fields);
-
-	g_object_ref (backend);
-
-	(* E_BOOK_BACKEND_GET_CLASS (backend)->get_required_fields) (backend, book, opid);
-
-	g_object_unref (backend);
+	(* E_BOOK_BACKEND_GET_CLASS (backend)->get_required_fields) (backend, book, opid, cancellable);
 }
 
 /**
@@ -647,6 +535,7 @@ e_book_backend_get_required_fields (EBookBackend *backend,
  * @backend: an #EBookBackend
  * @book: an #EDataBook
  * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
  *
  * Executes a 'get supported fields' request specified by @opid on @book
  * using @backend.
@@ -654,19 +543,14 @@ e_book_backend_get_required_fields (EBookBackend *backend,
 void
 e_book_backend_get_supported_fields (EBookBackend *backend,
 				     EDataBook    *book,
-				     guint32       opid)
-
+				     guint32       opid,
+				     GCancellable *cancellable)
 {
 	g_return_if_fail (E_IS_BOOK_BACKEND (backend));
 	g_return_if_fail (E_IS_DATA_BOOK (book));
+	g_return_if_fail (E_BOOK_BACKEND_GET_CLASS (backend)->get_supported_fields);
 
-	g_assert (E_BOOK_BACKEND_GET_CLASS (backend)->get_supported_fields);
-
-	g_object_ref (backend);
-
-	(* E_BOOK_BACKEND_GET_CLASS (backend)->get_supported_fields) (backend, book, opid);
-
-	g_object_unref (backend);
+	(* E_BOOK_BACKEND_GET_CLASS (backend)->get_supported_fields) (backend, book, opid, cancellable);
 }
 
 /**
@@ -674,6 +558,7 @@ e_book_backend_get_supported_fields (EBookBackend *backend,
  * @backend: an #EBookBackend
  * @book: an #EDataBook
  * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
  *
  * Executes a 'get supported auth methods' request specified by @opid on @book
  * using @backend.
@@ -681,43 +566,14 @@ e_book_backend_get_supported_fields (EBookBackend *backend,
 void
 e_book_backend_get_supported_auth_methods (EBookBackend *backend,
 					   EDataBook    *book,
-					   guint32       opid)
+					   guint32       opid,
+					   GCancellable *cancellable)
 {
 	g_return_if_fail (E_IS_BOOK_BACKEND (backend));
 	g_return_if_fail (E_IS_DATA_BOOK (book));
+	g_return_if_fail (E_BOOK_BACKEND_GET_CLASS (backend)->get_supported_auth_methods);
 
-	g_assert (E_BOOK_BACKEND_GET_CLASS (backend)->get_supported_auth_methods);
-
-	g_object_ref (backend);
-
-	(* E_BOOK_BACKEND_GET_CLASS (backend)->get_supported_auth_methods) (backend, book, opid);
-
-	g_object_unref (backend);
-}
-
-/**
- * e_book_backend_cancel_operation:
- * @backend: an #EBookBackend
- * @book: an #EDataBook whose operation should be cancelled
- * @error: #GError to set, when something fails
- *
- * Cancel @book's running operation on @backend.
- **/
-void
-e_book_backend_cancel_operation (EBookBackend *backend,
-				 EDataBook    *book,
-				 GError      **error)
-{
-	e_return_data_book_error_if_fail (E_IS_BOOK_BACKEND (backend), E_DATA_BOOK_STATUS_INVALID_ARG);
-	e_return_data_book_error_if_fail (E_IS_DATA_BOOK (book), E_DATA_BOOK_STATUS_INVALID_ARG);
-
-	g_assert (E_BOOK_BACKEND_GET_CLASS (backend)->cancel_operation);
-
-	g_object_ref (backend);
-
-	(* E_BOOK_BACKEND_GET_CLASS (backend)->cancel_operation) (backend, book, error);
-
-	g_object_unref (backend);
+	(* E_BOOK_BACKEND_GET_CLASS (backend)->get_supported_auth_methods) (backend, book, opid, cancellable);
 }
 
 static void
@@ -727,22 +583,6 @@ last_client_gone (EBookBackend *backend)
 }
 
 /**
- * e_book_backend_get_book_views:
- * @backend: an #EBookBackend
- *
- * Gets the list of #EDataBookView views running on this backend.
- *
- * Returns: An #EList of #EDataBookView objects.
- **/
-EList*
-e_book_backend_get_book_views (EBookBackend *backend)
-{
-	g_return_val_if_fail (E_IS_BOOK_BACKEND (backend), NULL);
-
-	return g_object_ref (backend->priv->views);
-}
-
-/**
  * e_book_backend_add_book_view:
  * @backend: an #EBookBackend
  * @view: an #EDataBookView
@@ -757,7 +597,7 @@ e_book_backend_add_book_view (EBookBackend *backend,
 
 	g_mutex_lock (backend->priv->views_mutex);
 
-	e_list_append (backend->priv->views, view);
+	backend->priv->views = g_slist_append (backend->priv->views, view);
 
 	g_mutex_unlock (backend->priv->views_mutex);
 }
@@ -777,7 +617,7 @@ e_book_backend_remove_book_view (EBookBackend *backend,
 
 	g_mutex_lock (backend->priv->views_mutex);
 
-	e_list_remove (backend->priv->views, view);
+	backend->priv->views = g_slist_remove (backend->priv->views, view);
 
 	g_mutex_unlock (backend->priv->views_mutex);
 }
@@ -799,7 +639,7 @@ e_book_backend_add_client (EBookBackend      *backend,
 	g_return_val_if_fail (E_IS_DATA_BOOK (book), FALSE);
 
 	g_mutex_lock (backend->priv->clients_mutex);
-	backend->priv->clients = g_list_prepend (backend->priv->clients, book);
+	backend->priv->clients = g_slist_prepend (backend->priv->clients, book);
 	g_mutex_unlock (backend->priv->clients_mutex);
 
 	return TRUE;
@@ -826,7 +666,7 @@ e_book_backend_remove_client (EBookBackend *backend,
 
 	/* Disconnect */
 	g_mutex_lock (backend->priv->clients_mutex);
-	backend->priv->clients = g_list_remove (backend->priv->clients, book);
+	backend->priv->clients = g_slist_remove (backend->priv->clients, book);
 
 	/* When all clients go away, notify the parent factory about it so that
 	 * it may decide whether to kill the backend or not.
@@ -840,43 +680,53 @@ e_book_backend_remove_client (EBookBackend *backend,
 }
 
 /**
- * e_book_backend_has_out_of_proc_clients:
+ * e_book_backend_foreach_view:
  * @backend: an #EBookBackend
+ * @callback: callback to call
+ * @user_data: user_data passed into the @callback
  *
- * Checks if @backend has clients running in other system processes.
- *
- * Returns: %TRUE if there are clients in other processes, %FALSE otherwise.
+ * Calls @callback for each known book view of this @backend.
+ * @callback returns %FALSE to stop further processing.
  **/
-gboolean
-e_book_backend_has_out_of_proc_clients (EBookBackend *backend)
+void
+e_book_backend_foreach_view (EBookBackend *backend, gboolean (* callback) (EDataBookView *view, gpointer user_data), gpointer user_data)
 {
-	return TRUE;
+	const GSList *views;
+	EDataBookView *view;
+	gboolean stop = FALSE;
+
+	g_return_if_fail (backend != NULL);
+	g_return_if_fail (callback != NULL);
+
+	g_mutex_lock (backend->priv->views_mutex);
+
+	for (views = backend->priv->views; views && !stop; views = views->next) {
+		view = E_DATA_BOOK_VIEW (views->data);
+
+		e_data_book_view_ref (view);
+		stop = !callback (view, user_data);
+		e_data_book_view_unref (view);
+	}
+
+	g_mutex_unlock (backend->priv->views_mutex);
 }
 
 /**
- * e_book_backend_get_static_capabilities:
+ * e_book_backend_get_capabilities:
  * @backend: an #EBookBackend
+ * @book: an #EDataBook
+ * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
  *
  * Gets the capabilities offered by this @backend.
- *
- * Returns: A string listing the capabilities.
  **/
-gchar *
-e_book_backend_get_static_capabilities (EBookBackend *backend)
+void
+e_book_backend_get_capabilities (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable)
 {
-	gchar *capabilities;
-
-	g_return_val_if_fail (E_IS_BOOK_BACKEND (backend), NULL);
-
-	g_assert (E_BOOK_BACKEND_GET_CLASS (backend)->get_static_capabilities);
-
-	g_object_ref (backend);
-
-	capabilities = E_BOOK_BACKEND_GET_CLASS (backend)->get_static_capabilities (backend);
-
-	g_object_unref (backend);
+	g_return_if_fail (E_IS_BOOK_BACKEND (backend));
+	g_return_if_fail (E_BOOK_BACKEND_GET_CLASS (backend)->get_capabilities);
 
-	return capabilities;
+	E_BOOK_BACKEND_GET_CLASS (backend)->get_capabilities (backend, book, opid, cancellable);
 }
 
 /**
@@ -913,7 +763,7 @@ e_book_backend_set_is_loaded (EBookBackend *backend, gboolean is_loaded)
 }
 
 /**
- * e_book_backend_is_writable:
+ * e_book_backend_is_readonly:
  * @backend: an #EBookBackend
  *
  * Checks if we can write to @backend.
@@ -921,27 +771,27 @@ e_book_backend_set_is_loaded (EBookBackend *backend, gboolean is_loaded)
  * Returns: %TRUE if writeable, %FALSE if not.
  **/
 gboolean
-e_book_backend_is_writable (EBookBackend *backend)
+e_book_backend_is_readonly (EBookBackend *backend)
 {
 	g_return_val_if_fail (E_IS_BOOK_BACKEND (backend), FALSE);
 
-	return backend->priv->writable;
+	return backend->priv->readonly;
 }
 
 /**
- * e_book_backend_set_is_writable:
+ * e_book_backend_set_is_readonly:
  * @backend: an #EBookBackend
- * @is_writable: A flag indicating whether the backend is writeable
+ * @is_readonly: A flag indicating whether the backend is readonly
  *
- * Sets the flag indicating whether @backend is writeable to @is_writeable.
+ * Sets the flag indicating whether @backend is readonly to @is_readonly.
  * Meant to be used by backend implementations.
  **/
 void
-e_book_backend_set_is_writable (EBookBackend *backend, gboolean is_writable)
+e_book_backend_set_is_readonly (EBookBackend *backend, gboolean is_readonly)
 {
 	g_return_if_fail (E_IS_BOOK_BACKEND (backend));
 
-	backend->priv->writable = is_writable;
+	backend->priv->readonly = is_readonly;
 }
 
 /**
@@ -977,26 +827,19 @@ e_book_backend_set_is_removed (EBookBackend *backend, gboolean is_removed)
 }
 
 /**
- * e_book_backend_set_mode:
+ * e_book_backend_set_online:
  * @backend: an #EBookbackend
- * @mode: a mode indicating the online/offline status of the backend
+ * @is_online: a mode indicating the online/offline status of the backend
  *
- * Sets @backend's online/offline mode to @mode. Mode can be 1 for offline
- * or 2 indicating that it is connected and online.
+ * Sets @backend's online/offline mode to @is_online.
  **/
 void
-e_book_backend_set_mode (EBookBackend *backend,
-			 EDataBookMode mode)
+e_book_backend_set_online (EBookBackend *backend, gboolean is_online)
 {
 	g_return_if_fail (E_IS_BOOK_BACKEND (backend));
+	g_return_if_fail (E_BOOK_BACKEND_GET_CLASS (backend)->set_online);
 
-	g_assert (E_BOOK_BACKEND_GET_CLASS (backend)->set_mode);
-
-	g_object_ref (backend);
-
-	(* E_BOOK_BACKEND_GET_CLASS (backend)->set_mode) (backend,  mode);
-
-	g_object_unref (backend);
+	(* E_BOOK_BACKEND_GET_CLASS (backend)->set_online) (backend,  is_online);
 }
 
 /**
@@ -1022,98 +865,14 @@ e_book_backend_sync (EBookBackend *backend)
 	g_object_unref (backend);
 }
 
-/**
- * e_book_backend_change_add_new:
- * @vcard: a VCard string
- *
- * Creates a new change item indicating @vcard was added.
- * Meant to be used by backend implementations.
- *
- * Returns: A new #EDataBookChange.
- **/
-EDataBookChange *
-e_book_backend_change_add_new     (const gchar *vcard)
-{
-  EDataBookChange *new_change = g_new (EDataBookChange, 1);
-
-	new_change->change_type = E_DATA_BOOK_BACKEND_CHANGE_ADDED;
-	new_change->vcard = g_strdup (vcard);
-
-	return new_change;
-}
-
-/**
- * e_book_backend_change_modify_new:
- * @vcard: a VCard string
- *
- * Creates a new change item indicating @vcard was modified.
- * Meant to be used by backend implementations.
- *
- * Returns: A new #EDataBookChange.
- **/
-EDataBookChange *
-e_book_backend_change_modify_new  (const gchar *vcard)
-{
-  EDataBookChange *new_change = g_new (EDataBookChange, 1);
-
-	new_change->change_type = E_DATA_BOOK_BACKEND_CHANGE_MODIFIED;
-	new_change->vcard = g_strdup (vcard);
-
-	return new_change;
-}
-
-/**
- * e_book_backend_change_delete_new:
- * @vcard: a VCard string
- *
- * Creates a new change item indicating @vcard was deleted.
- * Meant to be used by backend implementations.
- *
- * Returns: A new #EDataBookChange.
- **/
-EDataBookChange *
-e_book_backend_change_delete_new  (const gchar *vcard)
-{
-  EDataBookChange *new_change = g_new (EDataBookChange, 1);
-
-	new_change->change_type = E_DATA_BOOK_BACKEND_CHANGE_DELETED;
-	new_change->vcard = g_strdup (vcard);
-
-	return new_change;
-}
-
 
 
-static void
-e_book_backend_foreach_view (EBookBackend *backend,
-			     void (*callback) (EDataBookView *, gpointer),
-			     gpointer user_data)
-{
-	EList *views;
-	EDataBookView *view;
-	EIterator *iter;
-
-	views = e_book_backend_get_book_views (backend);
-	iter = e_list_get_iterator (views);
-
-	while (e_iterator_is_valid (iter)) {
-		view = (EDataBookView*)e_iterator_get (iter);
-
-		e_data_book_view_ref (view);
-		callback (view, user_data);
-		e_data_book_view_unref (view);
-
-		e_iterator_next (iter);
-	}
-
-	g_object_unref (iter);
-	g_object_unref (views);
-}
-
-static void
+static gboolean
 view_notify_update (EDataBookView *view, gpointer contact)
 {
 	e_data_book_view_notify_update (view, contact);
+
+	return TRUE;
 }
 
 /**
@@ -1129,15 +888,17 @@ view_notify_update (EDataBookView *view, gpointer contact)
  * contacts are created or modified by another (non-PAS-using) client.
  **/
 void
-e_book_backend_notify_update (EBookBackend *backend, EContact *contact)
+e_book_backend_notify_update (EBookBackend *backend, const EContact *contact)
 {
-	e_book_backend_foreach_view (backend, view_notify_update, contact);
+	e_book_backend_foreach_view (backend, view_notify_update, (gpointer) contact);
 }
 
-static void
+static gboolean
 view_notify_remove (EDataBookView *view, gpointer id)
 {
 	e_data_book_view_notify_remove (view, id);
+
+	return TRUE;
 }
 
 /**
@@ -1155,13 +916,15 @@ view_notify_remove (EDataBookView *view, gpointer id)
 void
 e_book_backend_notify_remove (EBookBackend *backend, const gchar *id)
 {
-	e_book_backend_foreach_view (backend, view_notify_remove, (gpointer)id);
+	e_book_backend_foreach_view (backend, view_notify_remove, (gpointer) id);
 }
 
-static void
+static gboolean
 view_notify_complete (EDataBookView *view, gpointer unused)
 {
 	e_data_book_view_notify_complete (view, NULL /* SUCCESS */);
+
+	return TRUE;
 }
 
 /**
@@ -1180,31 +943,56 @@ e_book_backend_notify_complete (EBookBackend *backend)
 
 
 /**
- * e_book_backend_notify_writable:
+ * e_book_backend_notify_error:
  * @backend: an #EBookBackend
- * @is_writable: flag indicating writable status
+ * @message: an error message
  *
- * Notifies all backends clients about the current writable state.
+ * Notifies each backend listener about an error. This is meant to be used
+ * for cases where is no GError return possibility, to notify user about
+ * an issue.
  **/
 void
-e_book_backend_notify_writable (EBookBackend *backend, gboolean is_writable)
+e_book_backend_notify_error (EBookBackend *backend, const gchar *message)
 {
 	EBookBackendPrivate *priv;
-	GList *clients;
+	GSList *clients;
 
 	priv = backend->priv;
-	priv->writable = is_writable;
+
 	g_mutex_lock (priv->clients_mutex);
 
-	for (clients = priv->clients; clients != NULL; clients = g_list_next (clients))
-		e_data_book_report_writable (E_DATA_BOOK (clients->data), is_writable);
+	for (clients = priv->clients; clients != NULL; clients = g_slist_next (clients))
+		e_data_book_report_error (E_DATA_BOOK (clients->data), message);
+
+	g_mutex_unlock (priv->clients_mutex);
+}
+
+/**
+ * e_book_backend_notify_readonly:
+ * @backend: an #EBookBackend
+ * @is_readonly: flag indicating readonly status
+ *
+ * Notifies all backend's clients about the current readonly state.
+ **/
+void
+e_book_backend_notify_readonly (EBookBackend *backend, gboolean is_readonly)
+{
+	EBookBackendPrivate *priv;
+	GSList *clients;
+
+	priv = backend->priv;
+	priv->readonly = is_readonly;
+	g_mutex_lock (priv->clients_mutex);
+
+	for (clients = priv->clients; clients != NULL; clients = g_slist_next (clients))
+		e_data_book_report_readonly (E_DATA_BOOK (clients->data), is_readonly);
 
 	g_mutex_unlock (priv->clients_mutex);
 
 }
 
 /**
- * e_book_backend_notify_connection_status:
+ * e_book_backend_notify_online:
  * @backend: an #EBookBackend
  * @is_online: flag indicating whether @backend is connected and online
  *
@@ -1212,17 +1000,17 @@ e_book_backend_notify_writable (EBookBackend *backend, gboolean is_writable)
  * Meant to be used by backend implementations.
  **/
 void
-e_book_backend_notify_connection_status (EBookBackend *backend, gboolean is_online)
+e_book_backend_notify_online (EBookBackend *backend, gboolean is_online)
 {
 	EBookBackendPrivate *priv;
-	GList *clients;
+	GSList *clients;
 
 	priv = backend->priv;
 	priv->online = is_online;
 	g_mutex_lock (priv->clients_mutex);
 
-	for (clients = priv->clients; clients != NULL; clients = g_list_next (clients))
-		e_data_book_report_connection_status (E_DATA_BOOK (clients->data), is_online);
+	for (clients = priv->clients; clients != NULL; clients = g_slist_next (clients))
+		e_data_book_report_online (E_DATA_BOOK (clients->data), is_online);
 
 	g_mutex_unlock (priv->clients_mutex);
 }
@@ -1230,21 +1018,23 @@ e_book_backend_notify_connection_status (EBookBackend *backend, gboolean is_onli
 /**
  * e_book_backend_notify_auth_required:
  * @backend: an #EBookBackend
+ * @credentials: an #ECredentials that contains extra information for
+ *    a source for which authentication is requested.
+ *    This parameter can be NULL to indicate "for this book".
  *
  * Notifies clients that @backend requires authentication in order to
  * connect. Means to be used by backend implementations.
  **/
 void
-e_book_backend_notify_auth_required (EBookBackend *backend)
+e_book_backend_notify_auth_required (EBookBackend *backend, const ECredentials *credentials)
 {
 	EBookBackendPrivate *priv;
-	GList *clients;
+	GSList *clients;
 
 	priv = backend->priv;
 	g_mutex_lock (priv->clients_mutex);
 
-	for (clients = priv->clients; clients != NULL; clients = g_list_next (clients))
-		e_data_book_report_auth_required (E_DATA_BOOK (clients->data));
+	for (clients = priv->clients; clients != NULL; clients = g_slist_next (clients))
+		e_data_book_report_auth_required (E_DATA_BOOK (clients->data), credentials);
 	g_mutex_unlock (priv->clients_mutex);
 }
-
diff --git a/addressbook/libedata-book/e-book-backend.h b/addressbook/libedata-book/e-book-backend.h
index 6d96b1a..93d0399 100644
--- a/addressbook/libedata-book/e-book-backend.h
+++ b/addressbook/libedata-book/e-book-backend.h
@@ -24,11 +24,13 @@
 
 #include <glib.h>
 #include <glib-object.h>
+#include <gio/gio.h>
+
 #include <libebook/e-contact.h>
 #include <libedata-book/e-data-book-types.h>
 #include <libedata-book/e-data-book.h>
-#include <libedataserver/e-list.h>
 #include <libedataserver/e-source.h>
+#include <libedataserver/e-credentials.h>
 
 G_BEGIN_DECLS
 
@@ -50,151 +52,78 @@ struct _EBookBackendClass {
 	GObjectClass parent_class;
 
 	/* Virtual methods */
-	void (*load_source) (EBookBackend *backend, ESource *source, gboolean only_if_exists, GError **error);
-	void (*remove) (EBookBackend *backend, EDataBook *book, guint32 opid);
-        gchar *(*get_static_capabilities) (EBookBackend *backend);
-
-	void (*create_contact)  (EBookBackend *backend, EDataBook *book, guint32 opid, const gchar *vcard);
-	void (*remove_contacts) (EBookBackend *backend, EDataBook *book, guint32 opid, GList *id_list);
-	void (*modify_contact)  (EBookBackend *backend, EDataBook *book, guint32 opid, const gchar *vcard);
-	void (*get_contact) (EBookBackend *backend, EDataBook *book, guint32 opid, const gchar *id);
-	void (*get_contact_list) (EBookBackend *backend, EDataBook *book, guint32 opid, const gchar *query);
-	void (*start_book_view) (EBookBackend *backend, EDataBookView *book_view);
-	void (*stop_book_view) (EBookBackend *backend, EDataBookView *book_view);
-	void (*get_changes) (EBookBackend *backend, EDataBook *book, guint32 opid, const gchar *change_id);
-	void (*authenticate_user) (EBookBackend *backend, EDataBook *book, guint32 opid, const gchar *user, const gchar *passwd, const gchar *auth_method);
-	void (*get_required_fields) (EBookBackend *backend, EDataBook *bokk, guint32 opid);
-	void (*get_supported_fields) (EBookBackend *backend, EDataBook *book, guint32 opid);
-	void (*get_supported_auth_methods) (EBookBackend *backend, EDataBook *book, guint32 opid);
-	void (*cancel_operation) (EBookBackend *backend, EDataBook *book, GError **error);
-	void (*set_mode) (EBookBackend *backend, EDataBookMode mode);
+	void	(* open)			(EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, gboolean only_if_exists);
+	void	(* authenticate_user)		(EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, ECredentials *credentials);
+	void	(* remove)			(EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable);
+        void	(* get_capabilities)		(EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable);
+	void	(* set_online)			(EBookBackend *backend, gboolean is_online);
+
+	void	(* create_contact)		(EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, const gchar *vcard);
+	void	(* remove_contacts)		(EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, const GSList *id_list);
+	void	(* modify_contact)		(EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, const gchar *vcard);
+	void	(* get_contact)			(EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, const gchar *id);
+	void	(* get_contact_list)		(EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, const gchar *query);
+	void	(* get_required_fields)		(EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable);
+	void	(* get_supported_fields)	(EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable);
+	void	(* get_supported_auth_methods)	(EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable);
+
+	void	(* start_book_view)		(EBookBackend *backend, EDataBookView *book_view);
+	void	(* stop_book_view)		(EBookBackend *backend, EDataBookView *book_view);
 
 	/* Notification signals */
-	void (* last_client_gone) (EBookBackend *backend);
+	void	(* last_client_gone)		(EBookBackend *backend);
+	void	(* sync)			(EBookBackend *backend);
+};
 
-	void (*sync) (EBookBackend *backend);
+GType		e_book_backend_get_type		(void);
 
-	/* Padding for future expansion */
-	void (*_pas_reserved1) (void);
-	void (*_pas_reserved2) (void);
-	void (*_pas_reserved3) (void);
-	void (*_pas_reserved4) (void);
-};
+const gchar *	e_book_backend_get_cache_dir	(EBookBackend *backend);
+void		e_book_backend_set_cache_dir	(EBookBackend *backend, const gchar *cache_dir);
+
+ESource *	e_book_backend_get_source	(EBookBackend *backend);
+
+gboolean	e_book_backend_add_client	(EBookBackend *backend, EDataBook *book);
+void		e_book_backend_remove_client	(EBookBackend *backend, EDataBook *book);
+
+gboolean	e_book_backend_is_loaded	(EBookBackend *backend);
+gboolean	e_book_backend_is_readonly	(EBookBackend *backend);
+gboolean	e_book_backend_is_removed	(EBookBackend *backend);
+void		e_book_backend_set_online	(EBookBackend *backend, gboolean is_online);
+
+void		e_book_backend_open		(EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, gboolean only_if_exists);
+void		e_book_backend_authenticate_user(EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, ECredentials *credentials);
+void		e_book_backend_remove		(EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable);
+void		e_book_backend_get_capabilities (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable);
+void		e_book_backend_create_contact	(EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, const gchar *vcard);
+void		e_book_backend_remove_contacts	(EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, const GSList *id_list);
+void		e_book_backend_modify_contact	(EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, const gchar *vcard);
+void		e_book_backend_get_contact	(EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, const gchar *id);
+void		e_book_backend_get_contact_list	(EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, const gchar *query);
+void		e_book_backend_get_supported_fields (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable);
+void		e_book_backend_get_required_fields  (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable);
+void		e_book_backend_get_supported_auth_methods (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable);
+
+void		e_book_backend_start_book_view	(EBookBackend *backend, EDataBookView *view);
+void		e_book_backend_stop_book_view	(EBookBackend *backend, EDataBookView *view);
+void		e_book_backend_add_book_view	(EBookBackend *backend, EDataBookView *view);
+void		e_book_backend_remove_book_view	(EBookBackend *backend, EDataBookView *view);
+void		e_book_backend_foreach_view	(EBookBackend *backend, gboolean (* callback) (EDataBookView *view, gpointer user_data), gpointer user_data);
+
+void		e_book_backend_notify_update	(EBookBackend *backend, const EContact *contact);
+void		e_book_backend_notify_remove	(EBookBackend *backend, const gchar *id);
+void		e_book_backend_notify_complete	(EBookBackend *backend);
+
+void		e_book_backend_notify_error	(EBookBackend *backend, const gchar *message);
+void		e_book_backend_notify_readonly	(EBookBackend *backend, gboolean is_readonly);
+void		e_book_backend_notify_online	(EBookBackend *backend, gboolean is_online);
+void		e_book_backend_notify_auth_required (EBookBackend *backend, const ECredentials *credentials);
 
-const gchar *e_book_backend_get_cache_dir           (EBookBackend             *backend);
-void        e_book_backend_set_cache_dir            (EBookBackend             *backend,
-                                                     const gchar              *cache_dir);
-
-void        e_book_backend_load_source              (EBookBackend             *backend,
-						     ESource                  *source,
-						     gboolean                  only_if_exists,
-						     GError		     **error);
-ESource    *e_book_backend_get_source               (EBookBackend             *backend);
-
-gboolean    e_book_backend_add_client               (EBookBackend             *backend,
-						     EDataBook                *book);
-void        e_book_backend_remove_client            (EBookBackend             *backend,
-						     EDataBook                *book);
-gboolean    e_book_backend_has_out_of_proc_clients (EBookBackend *backend);
-gchar       *e_book_backend_get_static_capabilities  (EBookBackend             *backend);
-
-gboolean    e_book_backend_is_loaded                (EBookBackend             *backend);
-
-gboolean    e_book_backend_is_writable              (EBookBackend             *backend);
-
-gboolean    e_book_backend_is_removed               (EBookBackend             *backend);
-
-void        e_book_backend_open                     (EBookBackend             *backend,
-						     EDataBook                *book,
-						     guint32                   opid,
-						     gboolean                  only_if_exists);
-void        e_book_backend_remove                   (EBookBackend             *backend,
-						     EDataBook                *book,
-						     guint32                   opid);
-void        e_book_backend_create_contact           (EBookBackend             *backend,
-						     EDataBook                *book,
-						     guint32                   opid,
-						     const gchar               *vcard);
-void        e_book_backend_remove_contacts          (EBookBackend             *backend,
-						     EDataBook                *book,
-						     guint32                   opid,
-						     GList                    *id_list);
-void        e_book_backend_modify_contact           (EBookBackend             *backend,
-						     EDataBook                *book,
-						     guint32                   opid,
-						     const gchar               *vcard);
-void        e_book_backend_get_contact              (EBookBackend             *backend,
-						     EDataBook                *book,
-						     guint32                   opid,
-						     const gchar               *id);
-void        e_book_backend_get_contact_list         (EBookBackend             *backend,
-						     EDataBook                *book,
-						     guint32                   opid,
-						     const gchar               *query);
-void        e_book_backend_get_changes              (EBookBackend             *backend,
-						     EDataBook                *book,
-						     guint32                   opid,
-						     const gchar               *change_id);
-void        e_book_backend_authenticate_user        (EBookBackend             *backend,
-						     EDataBook                *book,
-						     guint32                   opid,
-						     const gchar               *user,
-						     const gchar               *passwd,
-						     const gchar               *auth_method);
-void        e_book_backend_get_supported_fields     (EBookBackend             *backend,
-						     EDataBook                *book,
-						     guint32                   opid);
-
-void        e_book_backend_get_required_fields      (EBookBackend             *backend,
-						     EDataBook                *book,
-						     guint32                   opid);
-
-void        e_book_backend_get_supported_auth_methods (EBookBackend           *backend,
-						       EDataBook              *book,
-						       guint32                 opid);
-void		e_book_backend_cancel_operation (EBookBackend           *backend,
-						 EDataBook              *book,
-						 GError **error);
-void        e_book_backend_set_mode (EBookBackend           *backend,
-				     EDataBookMode           mode);
-
-void        e_book_backend_start_book_view            (EBookBackend           *backend,
-						       EDataBookView          *view);
-void        e_book_backend_stop_book_view             (EBookBackend           *backend,
-						       EDataBookView          *view);
-
-void        e_book_backend_add_book_view              (EBookBackend           *backend,
-						       EDataBookView          *view);
-
-void        e_book_backend_remove_book_view           (EBookBackend           *backend,
-						       EDataBookView          *view);
-
-EList      *e_book_backend_get_book_views             (EBookBackend           *backend);
-
-void        e_book_backend_notify_update              (EBookBackend           *backend,
-						       EContact               *contact);
-void        e_book_backend_notify_remove              (EBookBackend           *backend,
-						       const gchar             *id);
-void        e_book_backend_notify_complete            (EBookBackend           *backend);
-void        e_book_backend_notify_writable            (EBookBackend *backend, gboolean is_writable);
-void        e_book_backend_notify_connection_status   (EBookBackend *backend, gboolean is_online);
-void        e_book_backend_notify_auth_required       (EBookBackend *backend);
-void        e_book_backend_sync                       (EBookBackend *backend);
-
-GType       e_book_backend_get_type                 (void);
+void		e_book_backend_sync		(EBookBackend *backend);
 
 /* protected functions for subclasses */
-void        e_book_backend_set_is_loaded            (EBookBackend             *backend,
-						     gboolean                  is_loaded);
-void        e_book_backend_set_is_writable          (EBookBackend             *backend,
-						     gboolean                  is_writable);
-void        e_book_backend_set_is_removed           (EBookBackend             *backend,
-						     gboolean                  is_removed);
-
-/* useful for implementing _get_changes in backends */
-EDataBookChange* e_book_backend_change_add_new     (const gchar *vcard);
-EDataBookChange* e_book_backend_change_modify_new  (const gchar *vcard);
-EDataBookChange* e_book_backend_change_delete_new  (const gchar *id);
+void		e_book_backend_set_is_loaded	(EBookBackend *backend, gboolean is_loaded);
+void		e_book_backend_set_is_readonly	(EBookBackend *backend, gboolean is_readonly);
+void		e_book_backend_set_is_removed	(EBookBackend *backend, gboolean is_removed);
 
 G_END_DECLS
 
diff --git a/addressbook/libedata-book/e-data-book-factory.c b/addressbook/libedata-book/e-data-book-factory.c
index b8aa145..f70a586 100644
--- a/addressbook/libedata-book/e-data-book-factory.c
+++ b/addressbook/libedata-book/e-data-book-factory.c
@@ -33,7 +33,7 @@
 #include "e-data-book.h"
 #include "e-book-backend.h"
 
-#include "e-gdbus-egdbusbookfactory.h"
+#include "e-gdbus-book-factory.h"
 
 #ifdef G_OS_WIN32
 #include <windows.h>
@@ -84,7 +84,8 @@ struct _EDataBookFactoryPrivate {
 
 	guint exit_timeout;
 
-        gint mode;
+	/* whether should be online */
+        gboolean is_online;
 };
 
 /* Forward Declarations */
@@ -161,28 +162,27 @@ set_backend_online_status (gpointer key, gpointer value, gpointer data)
 
 	g_return_if_fail (backend != NULL);
 
-	e_book_backend_set_mode (backend,  GPOINTER_TO_INT (data));
+	e_book_backend_set_online (backend,  GPOINTER_TO_INT (data));
 }
 
 /**
- * e_data_book_factory_set_backend_mode:
+ * e_data_book_factory_set_backend_online:
  * @factory: A bookendar factory.
- * @mode: Online mode to set.
+ * @is_online: Online mode to set.
  *
  * Sets the online mode for all backends created by the given factory.
  */
 void
-e_data_book_factory_set_backend_mode (EDataBookFactory *factory,
-                                      gint mode)
+e_data_book_factory_set_backend_online (EDataBookFactory *factory, gboolean is_online)
 {
 	g_return_if_fail (E_IS_DATA_BOOK_FACTORY (factory));
 
-	factory->priv->mode = mode;
+	factory->priv->is_online = is_online;
 	g_mutex_lock (factory->priv->backends_lock);
 	g_hash_table_foreach (
 		factory->priv->backends,
 		set_backend_online_status,
-		GINT_TO_POINTER (factory->priv->mode));
+		GINT_TO_POINTER (factory->priv->is_online));
 	g_mutex_unlock (factory->priv->backends_lock);
 }
 
@@ -285,6 +285,14 @@ backend_gone_cb (EDataBookFactory *factory, GObject *dead)
 	g_mutex_unlock (priv->backends_lock);
 }
 
+static void
+last_client_gone_cb (EBookBackend *backend, EDataBookFactory *factory)
+{
+	backend_gone_cb (factory, (GObject *) backend);
+	g_object_weak_unref (G_OBJECT (backend), (GWeakNotify) backend_gone_cb, factory);
+	g_object_unref (backend);
+}
+
 static gboolean
 impl_BookFactory_getBook (EGdbusBookFactory *object, GDBusMethodInvocation *invocation, const gchar *in_source, EDataBookFactory *factory)
 {
@@ -355,8 +363,8 @@ impl_BookFactory_getBook (EGdbusBookFactory *object, GDBusMethodInvocation *invo
 			g_hash_table_insert (
 				priv->backends, uri_key, backend);
 			g_object_weak_ref (G_OBJECT (backend), (GWeakNotify) backend_gone_cb, factory);
-			g_signal_connect (backend, "last-client-gone", G_CALLBACK (g_object_unref), NULL);
-			e_book_backend_set_mode (backend, priv->mode);
+			g_signal_connect (backend, "last-client-gone", G_CALLBACK (last_client_gone_cb), factory);
+			e_book_backend_set_online (backend, priv->is_online);
 		}
 	}
 
@@ -397,11 +405,10 @@ impl_BookFactory_getBook (EGdbusBookFactory *object, GDBusMethodInvocation *invo
 	g_object_unref (source);
 	g_free (uri);
 
-	if (error) {
-		g_dbus_method_invocation_return_gerror (invocation, error);
+	e_gdbus_book_factory_complete_get_book (object, invocation, path, error);
+
+	if (error)
 		g_error_free (error);
-	} else
-		e_gdbus_book_factory_complete_get_book (object, invocation, path);
 
 	g_free (path);
 
@@ -517,9 +524,7 @@ offline_state_changed_cb (EOfflineListener *eol, EDataBookFactory *factory)
 
 	g_return_if_fail (state == EOL_STATE_ONLINE || state == EOL_STATE_OFFLINE);
 
-	e_data_book_factory_set_backend_mode (
-		factory, state == EOL_STATE_ONLINE ?
-		E_DATA_BOOK_MODE_REMOTE : E_DATA_BOOK_MODE_LOCAL);
+	e_data_book_factory_set_backend_online (factory, state == EOL_STATE_ONLINE);
 }
 
 static void
diff --git a/addressbook/libedata-book/e-data-book-factory.h b/addressbook/libedata-book/e-data-book-factory.h
index 636ee53..90c68c6 100644
--- a/addressbook/libedata-book/e-data-book-factory.h
+++ b/addressbook/libedata-book/e-data-book-factory.h
@@ -52,7 +52,7 @@ GQuark e_data_book_factory_error_quark (void);
 
 GType e_data_book_factory_get_type (void);
 
-void e_data_book_factory_set_backend_mode (EDataBookFactory *factory, gint mode);
+void e_data_book_factory_set_backend_online (EDataBookFactory *factory, gboolean is_online);
 
 G_END_DECLS
 
diff --git a/addressbook/libedata-book/e-data-book-types.h b/addressbook/libedata-book/e-data-book-types.h
index c6cdfaa..cf608dc 100644
--- a/addressbook/libedata-book/e-data-book-types.h
+++ b/addressbook/libedata-book/e-data-book-types.h
@@ -70,23 +70,6 @@ typedef enum {
 	E_DATA_BOOK_STATUS_NOT_SUPPORTED
 } EDataBookStatus;
 
-typedef enum {
-	E_DATA_BOOK_MODE_LOCAL,
-	E_DATA_BOOK_MODE_REMOTE,
-	E_DATA_BOOK_MODE_ANY,
-} EDataBookMode;
-
-typedef enum {
-	E_DATA_BOOK_BACKEND_CHANGE_ADDED,
-	E_DATA_BOOK_BACKEND_CHANGE_DELETED,
-	E_DATA_BOOK_BACKEND_CHANGE_MODIFIED
-} EDataBookChangeType;
-
-typedef struct {
-	EDataBookChangeType change_type;
-	gchar *vcard;
-} EDataBookChange;
-
 G_END_DECLS
 
 #endif /* __E_DATA_BOOK_TYPES_H__ */
diff --git a/addressbook/libedata-book/e-data-book-view.c b/addressbook/libedata-book/e-data-book-view.c
index 2ecfbc5..f375875 100644
--- a/addressbook/libedata-book/e-data-book-view.c
+++ b/addressbook/libedata-book/e-data-book-view.c
@@ -29,7 +29,7 @@
 #include "libedataserver/e-data-server-util.h"
 #include "e-data-book-view.h"
 
-#include "e-gdbus-egdbusbookview.h"
+#include "e-gdbus-book-view.h"
 
 static void reset_array (GArray *array);
 static void ensure_pending_flush_timeout (EDataBookView *view);
@@ -47,7 +47,6 @@ struct _EDataBookViewPrivate {
 
 	gchar * card_query;
 	EBookBackendSExp *card_sexp;
-	gint max_results;
 
 	gboolean running;
 	GMutex *pending_mutex;
@@ -117,7 +116,7 @@ send_pending_adds (EDataBookView *view)
 	if (priv->adds->len == 0)
 		return;
 
-	e_gdbus_book_view_emit_contacts_added (view->priv->gdbus_object, (const gchar * const *) priv->adds->data);
+	e_gdbus_book_view_emit_objects_added (view->priv->gdbus_object, (const gchar * const *) priv->adds->data);
 	reset_array (priv->adds);
 }
 
@@ -129,7 +128,7 @@ send_pending_changes (EDataBookView *view)
 	if (priv->changes->len == 0)
 		return;
 
-	e_gdbus_book_view_emit_contacts_changed (view->priv->gdbus_object, (const gchar * const *) priv->changes->data);
+	e_gdbus_book_view_emit_objects_changed (view->priv->gdbus_object, (const gchar * const *) priv->changes->data);
 	reset_array (priv->changes);
 }
 
@@ -141,7 +140,7 @@ send_pending_removes (EDataBookView *view)
 	if (priv->removes->len == 0)
 		return;
 
-	e_gdbus_book_view_emit_contacts_removed (view->priv->gdbus_object, (const gchar * const *) priv->removes->data);
+	e_gdbus_book_view_emit_objects_removed (view->priv->gdbus_object, (const gchar * const *) priv->removes->data);
 	reset_array (priv->removes);
 }
 
@@ -288,8 +287,7 @@ id_is_in_view (EDataBookView *book_view, const gchar *id)
  * by @book_view.
  **/
 void
-e_data_book_view_notify_update (EDataBookView *book_view,
-                                EContact      *contact)
+e_data_book_view_notify_update (EDataBookView *book_view, const EContact *contact)
 {
 	EDataBookViewPrivate *priv = book_view->priv;
 	gboolean currently_in_view, want_in_view;
@@ -301,11 +299,11 @@ e_data_book_view_notify_update (EDataBookView *book_view,
 
 	g_mutex_lock (priv->pending_mutex);
 
-	id = e_contact_get_const (contact, E_CONTACT_UID);
+	id = e_contact_get_const ((EContact *) contact, E_CONTACT_UID);
 
 	currently_in_view = id_is_in_view (book_view, id);
 	want_in_view =
-		e_book_backend_sexp_match_contact (priv->card_sexp, contact);
+		e_book_backend_sexp_match_contact (priv->card_sexp, (EContact *) contact);
 
 	if (want_in_view) {
 		vcard = e_vcard_to_string (E_VCARD (contact),
@@ -481,8 +479,9 @@ e_data_book_view_notify_complete (EDataBookView *book_view, const GError *error)
 }
 
 /**
- * e_data_book_view_notify_status_message:
+ * e_data_book_view_notify_progress:
  * @book_view: an #EDataBookView
+ * @percent: percent done; use -1 when not available
  * @message: a text message
  *
  * Provides listeners with a human-readable text describing the
@@ -490,7 +489,7 @@ e_data_book_view_notify_complete (EDataBookView *book_view, const GError *error)
  * reporting.
  **/
 void
-e_data_book_view_notify_status_message (EDataBookView *book_view, const gchar *message)
+e_data_book_view_notify_progress (EDataBookView *book_view, guint percent, const gchar *message)
 {
 	EDataBookViewPrivate *priv = book_view->priv;
 	gchar *gdbus_message = NULL;
@@ -498,7 +497,7 @@ e_data_book_view_notify_status_message (EDataBookView *book_view, const gchar *m
 	if (!priv->running)
 		return;
 
-	e_gdbus_book_view_emit_status_message (priv->gdbus_object, e_util_ensure_gdbus_string (message, &gdbus_message));
+	e_gdbus_book_view_emit_progress (priv->gdbus_object, percent, e_util_ensure_gdbus_string (message, &gdbus_message));
 
 	g_free (gdbus_message);
 }
@@ -508,13 +507,12 @@ e_data_book_view_notify_status_message (EDataBookView *book_view, const gchar *m
  * @book: The #EDataBook to search
  * @card_query: The query as a string
  * @card_sexp: The query as an #EBookBackendSExp
- * @max_results: The maximum number of results to return
  *
  * Create a new #EDataBookView for the given #EBook, filtering on #card_sexp,
  * and place it on DBus at the object path #path.
  */
 EDataBookView *
-e_data_book_view_new (EDataBook *book, const gchar *card_query, EBookBackendSExp *card_sexp, gint max_results)
+e_data_book_view_new (EDataBook *book, const gchar *card_query, EBookBackendSExp *card_sexp)
 {
 	EDataBookView *view;
 	EDataBookViewPrivate *priv;
@@ -528,7 +526,6 @@ e_data_book_view_new (EDataBook *book, const gchar *card_query, EBookBackendSExp
 	priv->backend = g_object_ref (e_data_book_get_backend (book));
 	priv->card_query = e_util_utf8_make_valid (card_query);
 	priv->card_sexp = card_sexp;
-	priv->max_results = max_results;
 
 	return view;
 }
@@ -551,7 +548,7 @@ impl_DataBookView_start (EGdbusBookView *object, GDBusMethodInvocation *invocati
 {
 	book_view->priv->idle_id = g_idle_add (bookview_idle_start, book_view);
 
-	e_gdbus_book_view_complete_start (object, invocation);
+	e_gdbus_book_view_complete_start (object, invocation, NULL);
 
 	return TRUE;
 }
@@ -577,7 +574,7 @@ impl_DataBookView_stop (EGdbusBookView *object, GDBusMethodInvocation *invocatio
 
 	book_view->priv->idle_id = g_idle_add (bookview_idle_stop, book_view);
 
-	e_gdbus_book_view_complete_stop (object, invocation);
+	e_gdbus_book_view_complete_stop (object, invocation, NULL);
 
 	return TRUE;
 }
@@ -585,7 +582,7 @@ impl_DataBookView_stop (EGdbusBookView *object, GDBusMethodInvocation *invocatio
 static gboolean
 impl_DataBookView_dispose (EGdbusBookView *object, GDBusMethodInvocation *invocation, EDataBookView *book_view)
 {
-	e_gdbus_book_view_complete_dispose (object, invocation);
+	e_gdbus_book_view_complete_dispose (object, invocation, NULL);
 
 	g_object_unref (book_view);
 
@@ -669,7 +666,6 @@ e_data_book_view_finalize (GObject *object)
 	g_array_free (priv->adds, TRUE);
 	g_array_free (priv->changes, TRUE);
 	g_array_free (priv->removes, TRUE);
-
 	g_free (priv->card_query);
 
 	g_mutex_free (priv->pending_mutex);
@@ -679,16 +675,6 @@ e_data_book_view_finalize (GObject *object)
 	G_OBJECT_CLASS (e_data_book_view_parent_class)->finalize (object);
 }
 
-void
-e_data_book_view_set_thresholds (EDataBookView *book_view,
-                                 gint minimum_grouping_threshold,
-                                 gint maximum_grouping_threshold)
-{
-	g_return_if_fail (E_IS_DATA_BOOK_VIEW (book_view));
-
-	g_debug ("e_data_book_view_set_thresholds does nothing in eds-dbus");
-}
-
 /**
  * e_data_book_view_get_card_query:
  * @book_view: an #EDataBookView
@@ -724,23 +710,6 @@ e_data_book_view_get_card_sexp (EDataBookView *book_view)
 }
 
 /**
- * e_data_book_view_get_max_results:
- * @book_view: an #EDataBookView
- *
- * Gets the maximum number of results returned by
- * @book_view's query.
- *
- * Returns: The maximum number of results returned.
- **/
-gint
-e_data_book_view_get_max_results (EDataBookView *book_view)
-{
-	g_return_val_if_fail (E_IS_DATA_BOOK_VIEW (book_view), 0);
-
-	return book_view->priv->max_results;
-}
-
-/**
  * e_data_book_view_get_backend:
  * @book_view: an #EDataBookView
  *
diff --git a/addressbook/libedata-book/e-data-book-view.h b/addressbook/libedata-book/e-data-book-view.h
index 1f856b9..71895ae 100644
--- a/addressbook/libedata-book/e-data-book-view.h
+++ b/addressbook/libedata-book/e-data-book-view.h
@@ -52,40 +52,23 @@ struct _EDataBookViewClass {
 	GObjectClass parent;
 };
 
-EDataBookView *e_data_book_view_new                  (EDataBook        *book,
-						      const gchar      *card_query,
-						      EBookBackendSExp *card_sexp,
-						      gint              max_results);
-
-guint e_data_book_view_register_gdbus_object (EDataBookView *query, GDBusConnection *connection, const gchar *object_path, GError **error);
-
-void              e_data_book_view_set_thresholds    (EDataBookView *book_view,
-						      gint minimum_grouping_threshold,
-						      gint maximum_grouping_threshold);
-
-const gchar *       e_data_book_view_get_card_query    (EDataBookView                *book_view);
-EBookBackendSExp* e_data_book_view_get_card_sexp     (EDataBookView                *book_view);
-gint               e_data_book_view_get_max_results   (EDataBookView                *book_view);
-EBookBackend*     e_data_book_view_get_backend       (EDataBookView                *book_view);
-void         e_data_book_view_notify_update          (EDataBookView                *book_view,
-						      EContact                     *contact);
-
-void         e_data_book_view_notify_update_vcard    (EDataBookView                *book_view,
-						      gchar                         *vcard);
-void         e_data_book_view_notify_update_prefiltered_vcard (EDataBookView       *book_view,
-                                                               const gchar          *id,
-                                                               gchar                *vcard);
-
-void         e_data_book_view_notify_remove          (EDataBookView                *book_view,
-						      const gchar                   *id);
-void         e_data_book_view_notify_complete        (EDataBookView                *book_view,
-						      const GError                 *error);
-void         e_data_book_view_notify_status_message  (EDataBookView                *book_view,
-						      const gchar                   *message);
-void         e_data_book_view_ref                    (EDataBookView                *book_view);
-void         e_data_book_view_unref                  (EDataBookView                *book_view);
-
-GType        e_data_book_view_get_type               (void);
+GType			e_data_book_view_get_type		(void);
+EDataBookView *		e_data_book_view_new			(EDataBook *book, const gchar *card_query, EBookBackendSExp *card_sexp);
+guint			e_data_book_view_register_gdbus_object	(EDataBookView *query, GDBusConnection *connection, const gchar *object_path, GError **error);
+
+const gchar *		e_data_book_view_get_card_query		(EDataBookView *book_view);
+EBookBackendSExp *	e_data_book_view_get_card_sexp		(EDataBookView *book_view);
+EBookBackend *		e_data_book_view_get_backend		(EDataBookView *book_view);
+void			e_data_book_view_notify_update		(EDataBookView *book_view, const EContact *contact);
+
+void			e_data_book_view_notify_update_vcard	(EDataBookView *book_view, gchar *vcard);
+void			e_data_book_view_notify_update_prefiltered_vcard (EDataBookView *book_view, const gchar *id, gchar *vcard);
+
+void			e_data_book_view_notify_remove		(EDataBookView *book_view, const gchar *id);
+void			e_data_book_view_notify_complete	(EDataBookView *book_view, const GError *error);
+void			e_data_book_view_notify_progress        (EDataBookView *book_view, guint percent, const gchar *message);
+void			e_data_book_view_ref			(EDataBookView *book_view);
+void			e_data_book_view_unref			(EDataBookView *book_view);
 
 G_END_DECLS
 
diff --git a/addressbook/libedata-book/e-data-book.c b/addressbook/libedata-book/e-data-book.c
index 5495f1e..cd486df 100644
--- a/addressbook/libedata-book/e-data-book.c
+++ b/addressbook/libedata-book/e-data-book.c
@@ -26,16 +26,17 @@
 #include <glib-object.h>
 #include <gio/gio.h>
 
-#include "libedataserver/e-data-server-util.h"
+#include <libedataserver/e-credentials.h>
+#include <libedataserver/e-data-server-util.h>
+#include <libedataserver/e-operation-pool.h>
 
 #include "e-data-book-enumtypes.h"
 #include "e-data-book-factory.h"
 #include "e-data-book.h"
 #include "e-data-book-view.h"
 #include "e-book-backend-sexp.h"
-#include "opid.h"
 
-#include "e-gdbus-egdbusbook.h"
+#include "e-gdbus-book.h"
 
 G_DEFINE_TYPE (EDataBook, e_data_book, G_TYPE_OBJECT)
 
@@ -45,53 +46,84 @@ struct _EDataBookPrivate
 
 	EBookBackend *backend;
 	ESource *source;
-};
 
-static void return_error_and_list (EGdbusBook *gdbus_object, void (* complete_func) (EGdbusBook *object, GDBusMethodInvocation *invocation, const gchar * const *out_array), guint32 opid, GError *error, const gchar *error_fmt, GList *list, gboolean free_data);
-static void data_book_return_error (GDBusMethodInvocation *invocation, const GError *error, const gchar *error_fmt);
+	GStaticRecMutex pending_ops_lock;
+	GHashTable *pending_ops; /* opid to GCancellable for still running operations */
+};
 
-static GThreadPool *op_pool = NULL;
+static EOperationPool *ops_pool = NULL;
 
 typedef enum {
 	OP_OPEN,
-	OP_AUTHENTICATE,
-	OP_ADD_CONTACT,
+	OP_REMOVE,
 	OP_GET_CONTACT,
 	OP_GET_CONTACTS,
-	OP_MODIFY_CONTACT,
+	OP_AUTHENTICATE,
+	OP_ADD_CONTACT,
 	OP_REMOVE_CONTACTS,
-	OP_GET_CHANGES,
+	OP_MODIFY_CONTACT,
+	OP_GET_CAPABILITIES,
+	OP_GET_REQUIRED_FIELDS,
+	OP_GET_SUPPORTED_FIELDS,
+	OP_GET_SUPPORTED_AUTH_METHODS,
+	OP_GET_BOOK_VIEW,
+	OP_CANCEL_OPERATION,
+	OP_CANCEL_ALL,
+	OP_CLOSE
 } OperationID;
 
 typedef struct {
 	OperationID op;
 	guint32 id; /* operation id */
 	EDataBook *book; /* book */
+	GCancellable *cancellable;
+
 	union {
 		/* OP_OPEN */
 		gboolean only_if_exists;
+		/* OP_GET_CONTACT */
+		gchar *uid;
 		/* OP_AUTHENTICATE */
-		struct {
-			gchar *username;
-			gchar *password;
-			gchar *method;
-		} auth;
+		ECredentials *credentials;
+		/* OP_REMOVE_CONTACTS */
+		GSList *ids;
 		/* OP_ADD_CONTACT */
 		/* OP_MODIFY_CONTACT */
 		gchar *vcard;
-		/* OP_GET_CONTACT */
-		gchar *uid;
+		/* OP_GET_BOOK_VIEW */
 		/* OP_GET_CONTACTS */
 		gchar *query;
-		/* OP_MODIFY_CONTACT */
-		gchar **vcards;
-		/* OP_REMOVE_CONTACTS */
-		GList *ids;
-		/* OP_GET_CHANGES */
-		gchar *change_id;
+		/* OP_CANCEL_OPERATION */
+		guint opid;
+
+		/* - OP_REMOVE */
+		/* - OP_GET_CAPABILITIES */
+		/* - OP_GET_REQUIRED_FIELDS */
+		/* - OP_GET_SUPPORTED_FIELDS */
+		/* - OP_GET_SUPPORTED_AUTH_METHODS */
+		/* - OP_CANCEL_ALL */
+		/* - OP_CLOSE */
 	} d;
 } OperationData;
 
+static gchar *
+construct_bookview_path (void)
+{
+	static volatile guint counter = 1;
+
+	return g_strdup_printf ("/org/gnome/evolution/dataserver/AddressBookView/%d/%d",
+				getpid (),
+				g_atomic_int_exchange_and_add ((int*)&counter, 1));
+}
+
+static void
+cancel_ops_cb (gpointer opid, gpointer cancellable, gpointer user_data)
+{
+	g_return_if_fail (cancellable != NULL);
+
+	g_cancellable_cancel (cancellable);
+}
+
 static void
 operation_thread (gpointer data, gpointer user_data)
 {
@@ -102,61 +134,145 @@ operation_thread (gpointer data, gpointer user_data)
 
 	switch (op->op) {
 	case OP_OPEN:
-		e_book_backend_open (backend, op->book, op->id, op->d.only_if_exists);
+		e_book_backend_open (backend, op->book, op->id, op->cancellable, op->d.only_if_exists);
 		break;
 	case OP_AUTHENTICATE:
-		e_book_backend_authenticate_user (backend, op->book, op->id,
-						  op->d.auth.username,
-						  op->d.auth.password,
-						  op->d.auth.method);
-		g_free (op->d.auth.username);
-		g_free (op->d.auth.password);
-		g_free (op->d.auth.method);
+		e_book_backend_authenticate_user (backend, op->book, op->id, op->cancellable, op->d.credentials);
+		e_credentials_free (op->d.credentials);
 		break;
 	case OP_ADD_CONTACT:
-		e_book_backend_create_contact (backend, op->book, op->id, op->d.vcard);
+		e_book_backend_create_contact (backend, op->book, op->id, op->cancellable, op->d.vcard);
 		g_free (op->d.vcard);
 		break;
 	case OP_GET_CONTACT:
-		e_book_backend_get_contact (backend, op->book, op->id, op->d.uid);
+		e_book_backend_get_contact (backend, op->book, op->id, op->cancellable, op->d.uid);
 		g_free (op->d.uid);
 		break;
 	case OP_GET_CONTACTS:
-		e_book_backend_get_contact_list (backend, op->book, op->id, op->d.query);
+		e_book_backend_get_contact_list (backend, op->book, op->id, op->cancellable, op->d.query);
 		g_free (op->d.query);
 		break;
 	case OP_MODIFY_CONTACT:
-		e_book_backend_modify_contact (backend, op->book, op->id, op->d.vcard);
+		e_book_backend_modify_contact (backend, op->book, op->id, op->cancellable, op->d.vcard);
 		g_free (op->d.vcard);
 		break;
 	case OP_REMOVE_CONTACTS:
-		e_book_backend_remove_contacts (backend, op->book, op->id, op->d.ids);
-		g_list_foreach (op->d.ids, (GFunc)g_free, NULL);
-		g_list_free (op->d.ids);
+		e_book_backend_remove_contacts (backend, op->book, op->id, op->cancellable, op->d.ids);
+		g_slist_foreach (op->d.ids, (GFunc)g_free, NULL);
+		g_slist_free (op->d.ids);
+		break;
+	case OP_REMOVE:
+		e_book_backend_remove (backend, op->book, op->id, op->cancellable);
+		break;
+	case OP_GET_CAPABILITIES:
+		e_book_backend_get_capabilities (backend, op->book, op->id, op->cancellable);
+		break;
+	case OP_GET_REQUIRED_FIELDS:
+		e_book_backend_get_required_fields (backend, op->book, op->id, op->cancellable);
+		break;
+	case OP_GET_SUPPORTED_FIELDS:
+		e_book_backend_get_supported_fields (backend, op->book, op->id, op->cancellable);
+		break;
+	case OP_GET_SUPPORTED_AUTH_METHODS:
+		e_book_backend_get_supported_auth_methods (backend, op->book, op->id, op->cancellable);
+		break;
+	case OP_GET_BOOK_VIEW:
+		if (op->d.query) {
+			EBookBackendSExp *card_sexp;
+			EDataBookView *book_view;
+			gchar *path;
+			GError *error = NULL;
+
+			card_sexp = e_book_backend_sexp_new (op->d.query);
+			if (!card_sexp) {
+				error = e_data_book_create_error (E_DATA_BOOK_STATUS_INVALID_QUERY, NULL);
+				/* Translators: This is prefix to a detailed error message */
+				g_prefix_error (&error, "%s", _("Invalid query: "));
+				e_gdbus_book_emit_get_view_done (op->book->priv->gdbus_object, op->id, error, NULL);
+				g_error_free (error);
+				break;
+			}
+
+			path = construct_bookview_path ();
+			
+			book_view = e_data_book_view_new (op->book, op->d.query, card_sexp);
+			e_data_book_view_register_gdbus_object (book_view, e_gdbus_book_stub_get_connection (op->book->priv->gdbus_object), path, &error);
+
+			if (error) {
+				/* Translators: This is prefix to a detailed error message */
+				g_prefix_error (&error, "%s", _("Invalid query: "));
+				e_gdbus_book_emit_get_view_done (op->book->priv->gdbus_object, op->id, error, NULL);
+				g_error_free (error);
+				g_object_unref (book_view);
+				g_free (path);
+
+				break;
+			}
+
+			e_book_backend_add_book_view (backend, book_view);
+
+			e_gdbus_book_emit_get_view_done (op->book->priv->gdbus_object, op->id, NULL, path);
+
+			g_free (path);
+		}
+		g_free (op->d.query);
+		break;
+	case OP_CANCEL_OPERATION:
+		g_static_rec_mutex_lock (&op->book->priv->pending_ops_lock);
+
+		if (g_hash_table_lookup (op->book->priv->pending_ops, GUINT_TO_POINTER (op->d.opid))) {
+			GCancellable *cancellable = g_hash_table_lookup (op->book->priv->pending_ops, GUINT_TO_POINTER (op->d.opid));
+
+			g_cancellable_cancel (cancellable);
+		}
+
+		g_static_rec_mutex_unlock (&op->book->priv->pending_ops_lock);
 		break;
-	case OP_GET_CHANGES:
-		e_book_backend_get_changes (backend, op->book, op->id, op->d.change_id);
-		g_free (op->d.change_id);
+	case OP_CLOSE:
+		/* close just cancels all pending ops and frees data book */
+		e_book_backend_remove_client (backend, op->book);
+	case OP_CANCEL_ALL:
+		g_static_rec_mutex_lock (&op->book->priv->pending_ops_lock);
+		g_hash_table_foreach (op->book->priv->pending_ops, cancel_ops_cb, NULL);
+		g_static_rec_mutex_unlock (&op->book->priv->pending_ops_lock);
 		break;
 	}
 
 	g_object_unref (op->book);
+	g_object_unref (op->cancellable);
 	g_slice_free (OperationData, op);
 }
 
 static OperationData *
-op_new (OperationID op, EDataBook *book, GDBusMethodInvocation *invocation)
+op_new (OperationID op, EDataBook *book)
 {
 	OperationData *data;
 
 	data = g_slice_new0 (OperationData);
 	data->op = op;
 	data->book = g_object_ref (book);
-	data->id = opid_store (invocation);
+	data->id = e_operation_pool_reserve_opid (ops_pool);
+	data->cancellable = g_cancellable_new ();
+
+	g_static_rec_mutex_lock (&book->priv->pending_ops_lock);
+	g_hash_table_insert (book->priv->pending_ops, GUINT_TO_POINTER (data->id), g_object_ref (data->cancellable));
+	g_static_rec_mutex_unlock (&book->priv->pending_ops_lock);
 
 	return data;
 }
 
+static void
+op_complete (EDataBook *book, guint32 opid)
+{
+	g_return_if_fail (book != NULL);
+
+	e_operation_pool_release_opid (ops_pool, opid);
+
+	g_static_rec_mutex_lock (&book->priv->pending_ops_lock);
+	g_hash_table_remove (book->priv->pending_ops, GUINT_TO_POINTER (opid));
+	g_static_rec_mutex_unlock (&book->priv->pending_ops_lock);
+}
+
 /**
  * e_data_book_status_to_string:
  *
@@ -303,527 +419,541 @@ e_data_book_get_backend (EDataBook *book)
 	return book->priv->backend;
 }
 
-static gboolean
-impl_Book_open (EGdbusBook *object, GDBusMethodInvocation *invocation, gboolean only_if_exists, EDataBook *book)
+static void
+data_book_return_error (GDBusMethodInvocation *invocation, const GError *perror, const gchar *error_prefix)
 {
-	OperationData *op;
+	GError *error;
 
-	op = op_new (OP_OPEN, book, invocation);
-	op->d.only_if_exists = only_if_exists;
-	g_thread_pool_push (op_pool, op, NULL);
+	if (perror == NULL)
+		error = g_error_new (E_DATA_BOOK_ERROR, E_DATA_BOOK_STATUS_OTHER_ERROR, "%s", _("Unknown error"));
+	else
+		error = g_error_new (E_DATA_BOOK_ERROR, perror->code, "%s", perror->message);
 
-	return TRUE;
+	g_prefix_error (&error, "%s", error_prefix);
+
+	g_dbus_method_invocation_return_gerror (invocation, error);
+
+	g_error_free (error);
 }
 
-void
-e_data_book_respond_open (EDataBook *book, guint opid, GError *error)
+
+static void
+return_error_and_list (EGdbusBook *gdbus_object, void (* complete_func) (EGdbusBook *object, guint opid, const GError *error, const gchar * const *out_array), guint32 opid, GError *error, const gchar *error_prefix, const GSList *list)
 {
-	GDBusMethodInvocation *invocation = opid_fetch (opid);
+	g_return_if_fail (error_prefix != NULL);
+	g_return_if_fail (complete_func != NULL);
 
 	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_book_return_error (invocation, error, _("Cannot open book: %s"));
+		g_prefix_error (&error, "%s", error_prefix);
+		complete_func (gdbus_object, opid, error, NULL);
 		g_error_free (error);
 	} else {
-		e_gdbus_book_complete_open (book->priv->gdbus_object, invocation);
+		gchar **array;
+		const GSList *l;
+		gint i = 0;
+
+		array = g_new0 (gchar *, g_slist_length ((GSList *) list) + 1);
+		for (l = list; l != NULL; l = l->next) {
+			array[i++] = e_util_utf8_make_valid (l->data);
+		}
+
+		complete_func (gdbus_object, opid, NULL, (const gchar * const *) array);
+
+		g_strfreev (array);
 	}
 }
 
 static gboolean
-impl_Book_remove (EGdbusBook *object, GDBusMethodInvocation *invocation, EDataBook *book)
+impl_Book_open (EGdbusBook *object, GDBusMethodInvocation *invocation, gboolean only_if_exists, EDataBook *book)
 {
-	e_book_backend_remove (book->priv->backend, book, opid_store (invocation));
+	OperationData *op;
+
+	op = op_new (OP_OPEN, book);
+	op->d.only_if_exists = only_if_exists;
+
+	e_gdbus_book_complete_open (book->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
-void
-e_data_book_respond_remove (EDataBook *book, guint opid, GError *error)
+static gboolean
+impl_Book_remove (EGdbusBook *object, GDBusMethodInvocation *invocation, EDataBook *book)
 {
-	GDBusMethodInvocation *invocation = opid_fetch (opid);
+	OperationData *op;
 
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_book_return_error (invocation, error, _("Cannot remove book: %s"));
-		g_error_free (error);
-	} else {
-		e_gdbus_book_complete_remove (book->priv->gdbus_object, invocation);
-	}
+	op = op_new (OP_REMOVE, book);
+
+	e_gdbus_book_complete_remove (book->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
+
+	return TRUE;
 }
 
 static gboolean
-impl_Book_getContact (EGdbusBook *object, GDBusMethodInvocation *invocation, const gchar *IN_uid, EDataBook *book)
+impl_Book_getContact (EGdbusBook *object, GDBusMethodInvocation *invocation, const gchar *in_uid, EDataBook *book)
 {
 	OperationData *op;
 
-	if (IN_uid == NULL) {
+	if (in_uid == NULL) {
 		GError *error;
 
 		error = e_data_book_create_error (E_DATA_BOOK_STATUS_CONTACT_NOT_FOUND, NULL);
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_book_return_error (invocation, error, _("Cannot get contact: %s"));
+		/* Translators: This is prefix to a detailed error message */
+		data_book_return_error (invocation, error, _("Cannot get contact: "));
 		g_error_free (error);
 		return TRUE;
 	}
 
-	op = op_new (OP_GET_CONTACT, book, invocation);
-	op->d.uid = g_strdup (IN_uid);
-	g_thread_pool_push (op_pool, op, NULL);
+	op = op_new (OP_GET_CONTACT, book);
+	op->d.uid = g_strdup (in_uid);
+
+	e_gdbus_book_complete_get_contact (book->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
-void
-e_data_book_respond_get_contact (EDataBook *book, guint32 opid, GError *error, const gchar *vcard)
+static gboolean
+impl_Book_getContactList (EGdbusBook *object, GDBusMethodInvocation *invocation, const gchar *in_query, EDataBook *book)
 {
-	GDBusMethodInvocation *invocation = opid_fetch (opid);
+	OperationData *op;
 
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_book_return_error  (invocation, error, _("Cannot get contact: %s"));
+	if (in_query == NULL || !*in_query) {
+		GError *error = e_data_book_create_error (E_DATA_BOOK_STATUS_INVALID_QUERY, NULL);
+		/* Translators: This is prefix to a detailed error message */
+		data_book_return_error (invocation, error, _("Empty query: "));
 		g_error_free (error);
-	} else {
-		gchar *gdbus_vcard = NULL;
+		return TRUE;
+	}
 
-		e_gdbus_book_complete_get_contact (book->priv->gdbus_object, invocation, e_util_ensure_gdbus_string (vcard, &gdbus_vcard));
+	op = op_new (OP_GET_CONTACTS, book);
+	op->d.query = g_strdup (in_query);
 
-		g_free (gdbus_vcard);
-	}
+	e_gdbus_book_complete_get_contact_list (book->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
+
+	return TRUE;
 }
 
 static gboolean
-impl_Book_getContactList (EGdbusBook *object, GDBusMethodInvocation *invocation, const gchar *query, EDataBook *book)
+impl_Book_authenticateUser (EGdbusBook *object, GDBusMethodInvocation *invocation, const gchar * const *in_credentials, EDataBook *book)
 {
 	OperationData *op;
 
-	if (query == NULL || query[0] == '\0') {
-		GError *error = e_data_book_create_error (E_DATA_BOOK_STATUS_INVALID_QUERY, NULL);
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_book_return_error (invocation, error, _("Empty query: %s"));
+	if (in_credentials == NULL) {
+		GError *error = e_data_book_create_error (E_DATA_BOOK_STATUS_INVALID_ARG, NULL);
+		/* Translators: This is prefix to a detailed error message */
+		data_book_return_error (invocation, error, _("Cannot authenticate user: "));
 		g_error_free (error);
 		return TRUE;
 	}
 
-	op = op_new (OP_GET_CONTACTS, book, invocation);
-	op->d.query = g_strdup (query);
-	g_thread_pool_push (op_pool, op, NULL);
+	op = op_new (OP_AUTHENTICATE, book);
+	op->d.credentials = e_credentials_new_strv (in_credentials);
 
-	return TRUE;
-}
+	e_gdbus_book_complete_authenticate_user (book->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
-void
-e_data_book_respond_get_contact_list (EDataBook *book, guint32 opid, GError *error, GList *cards)
-{
-	/* Translators: The '%s' is replaced with a detailed error message */
-	return_error_and_list (book->priv->gdbus_object, e_gdbus_book_complete_get_contact_list, opid, error, _("Cannot get contact list: %s"), cards, TRUE);
+	return TRUE;
 }
 
 static gboolean
-impl_Book_authenticateUser (EGdbusBook *object, GDBusMethodInvocation *invocation, const gchar *IN_user, const gchar *IN_passwd, const gchar *IN_auth_method, EDataBook *book)
+impl_Book_addContact (EGdbusBook *object, GDBusMethodInvocation *invocation, const gchar *in_vcard, EDataBook *book)
 {
 	OperationData *op;
 
-	op = op_new (OP_AUTHENTICATE, book, invocation);
-	op->d.auth.username = g_strdup (IN_user);
-	op->d.auth.password = g_strdup (IN_passwd);
-	op->d.auth.method = g_strdup (IN_auth_method);
-	g_thread_pool_push (op_pool, op, NULL);
+	if (in_vcard == NULL || !*in_vcard) {
+		GError *error = e_data_book_create_error (E_DATA_BOOK_STATUS_INVALID_QUERY, NULL);
+		/* Translators: This is prefix to a detailed error message */
+		data_book_return_error (invocation, error, _("Cannot add contact: "));
+		g_error_free (error);
+		return TRUE;
+	}
+
+	op = op_new (OP_ADD_CONTACT, book);
+	op->d.vcard = g_strdup (in_vcard);
+
+	e_gdbus_book_complete_add_contact (book->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
-static void
-data_book_return_error (GDBusMethodInvocation *invocation, const GError *perror, const gchar *error_fmt)
+static gboolean
+impl_Book_modifyContact (EGdbusBook *object, GDBusMethodInvocation *invocation, const gchar *in_vcard, EDataBook *book)
 {
-	GError *error;
+	OperationData *op;
 
-	if (perror == NULL)
-		error = g_error_new (E_DATA_BOOK_ERROR, E_DATA_BOOK_STATUS_OTHER_ERROR, error_fmt, _("Unknown error"));
-	else
-		error = g_error_new (E_DATA_BOOK_ERROR, perror->code, error_fmt, perror->message);
+	if (in_vcard == NULL) {
+		GError *error = e_data_book_create_error (E_DATA_BOOK_STATUS_INVALID_QUERY, NULL);
+		/* Translators: This is prefix to a detailed error message */
+		data_book_return_error (invocation, error, _("Cannot modify contact: "));
+		g_error_free (error);
+		return TRUE;
+	}
 
-	g_dbus_method_invocation_return_gerror (invocation, error);
+	op = op_new (OP_MODIFY_CONTACT, book);
+	op->d.vcard = g_strdup (in_vcard);
 
-	g_error_free (error);
+	e_gdbus_book_complete_modify_contact (book->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
+
+	return TRUE;
 }
 
-void
-e_data_book_respond_authenticate_user (EDataBook *book, guint32 opid, GError *error)
+static gboolean
+impl_Book_removeContacts (EGdbusBook *object, GDBusMethodInvocation *invocation, const gchar * const *in_uids, EDataBook *book)
 {
-	GDBusMethodInvocation *invocation = opid_fetch (opid);
+	OperationData *op;
 
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_book_return_error (invocation, error, _("Cannot authenticate user: %s"));
-		g_error_free (error);
-	} else {
-		e_gdbus_book_complete_authenticate_user (book->priv->gdbus_object, invocation);
+	op = op_new (OP_REMOVE_CONTACTS, book);
+
+	/* Allow an empty array to be removed */
+	for (; in_uids && *in_uids; in_uids++) {
+		op->d.ids = g_slist_prepend (op->d.ids, g_strdup (*in_uids));
 	}
+
+	e_gdbus_book_complete_remove_contacts (book->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
+
+	return TRUE;
 }
 
 static gboolean
-impl_Book_addContact (EGdbusBook *object, GDBusMethodInvocation *invocation, const gchar *IN_vcard, EDataBook *book)
+impl_Book_getCapabilities (EGdbusBook *object, GDBusMethodInvocation *invocation, EDataBook *book)
 {
 	OperationData *op;
 
-	if (IN_vcard == NULL || IN_vcard[0] == '\0') {
-		GError *error = e_data_book_create_error (E_DATA_BOOK_STATUS_INVALID_QUERY, NULL);
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_book_return_error (invocation, error, _("Cannot add contact: %s"));
-		g_error_free (error);
-		return TRUE;
-	}
+	op = op_new (OP_GET_CAPABILITIES, book);
 
-	op = op_new (OP_ADD_CONTACT, book, invocation);
-	op->d.vcard = g_strdup (IN_vcard);
-	g_thread_pool_push (op_pool, op, NULL);
+	e_gdbus_book_complete_get_capabilities (book->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
-void
-e_data_book_respond_create (EDataBook *book, guint32 opid, GError *error, EContact *contact)
+static gboolean
+impl_Book_getSupportedFields (EGdbusBook *object, GDBusMethodInvocation *invocation, EDataBook *book)
 {
-	GDBusMethodInvocation *invocation = opid_fetch (opid);
-
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_book_return_error (invocation, error, _("Cannot add contact: %s"));
-		g_error_free (error);
-	} else {
-		gchar *gdbus_uid = NULL;
+	OperationData *op;
 
-		e_book_backend_notify_update (e_data_book_get_backend (book), contact);
-		e_book_backend_notify_complete (e_data_book_get_backend (book));
+	op = op_new (OP_GET_SUPPORTED_FIELDS, book);
 
-		e_gdbus_book_complete_add_contact (book->priv->gdbus_object, invocation, e_util_ensure_gdbus_string (e_contact_get_const (contact, E_CONTACT_UID), &gdbus_uid));
+	e_gdbus_book_complete_get_supported_fields (book->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
-		g_free (gdbus_uid);
-	}
+	return TRUE;
 }
 
 static gboolean
-impl_Book_modifyContact (EGdbusBook *object, GDBusMethodInvocation *invocation, const gchar *IN_vcard, EDataBook *book)
+impl_Book_getRequiredFields (EGdbusBook *object, GDBusMethodInvocation *invocation, EDataBook *book)
 {
 	OperationData *op;
 
-	if (IN_vcard == NULL) {
-		GError *error = e_data_book_create_error (E_DATA_BOOK_STATUS_INVALID_QUERY, NULL);
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_book_return_error (invocation, error, _("Cannot modify contact: %s"));
-		g_error_free (error);
-		return TRUE;
-	}
+	op = op_new (OP_GET_REQUIRED_FIELDS, book);
 
-	op = op_new (OP_MODIFY_CONTACT, book, invocation);
-	op->d.vcard = g_strdup (IN_vcard);
-	g_thread_pool_push (op_pool, op, NULL);
+	e_gdbus_book_complete_get_required_fields (book->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
-void
-e_data_book_respond_modify (EDataBook *book, guint32 opid, GError *error, EContact *contact)
+static gboolean
+impl_Book_getSupportedAuthMethods (EGdbusBook *object, GDBusMethodInvocation *invocation, EDataBook *book)
 {
-	GDBusMethodInvocation *invocation = opid_fetch (opid);
+	OperationData *op;
 
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_book_return_error (invocation, error, _("Cannot modify contact: %s"));
-		g_error_free (error);
-	} else {
-		e_book_backend_notify_update (e_data_book_get_backend (book), contact);
-		e_book_backend_notify_complete (e_data_book_get_backend (book));
+	op = op_new (OP_GET_SUPPORTED_AUTH_METHODS, book);
 
-		e_gdbus_book_complete_modify_contact (book->priv->gdbus_object, invocation);
-	}
+	e_gdbus_book_complete_get_supported_auth_methods (book->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
+
+	return TRUE;
 }
 
 static gboolean
-impl_Book_removeContacts (EGdbusBook *object, GDBusMethodInvocation *invocation, const gchar * const *IN_uids, EDataBook *book)
+impl_Book_getBookView (EGdbusBook *object, GDBusMethodInvocation *invocation, const gchar *in_query, EDataBook *book)
 {
 	OperationData *op;
 
-	/* Allow an empty array to be removed */
-	if (IN_uids == NULL) {
-		e_gdbus_book_complete_remove_contacts (object, invocation);
-		return TRUE;
-	}
+	if (!in_query || !*in_query) {
+		GError *error;
 
-	op = op_new (OP_REMOVE_CONTACTS, book, invocation);
+		error = e_data_book_create_error (E_DATA_BOOK_STATUS_INVALID_QUERY, NULL);
+		/* Translators: This is prefix to a detailed error message */
+		data_book_return_error (invocation, error, _("Invalid query: "));
+		g_error_free (error);
 
-	for (; *IN_uids; IN_uids++) {
-		op->d.ids = g_list_prepend (op->d.ids, g_strdup (*IN_uids));
+		return TRUE;
 	}
 
-	g_thread_pool_push (op_pool, op, NULL);
+	op = op_new (OP_GET_BOOK_VIEW, book);
+	op->d.query = g_strdup (in_query);
+
+	e_gdbus_book_complete_get_view (book->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
-void
-e_data_book_respond_remove_contacts (EDataBook *book, guint32 opid, GError *error, GList *ids)
+static gboolean
+impl_Book_cancelOperation (EGdbusBook *object, GDBusMethodInvocation *invocation, guint in_opid, EDataBook *book)
 {
-	GDBusMethodInvocation *invocation = opid_fetch (opid);
+	OperationData *op;
 
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_book_return_error (invocation, error, _("Cannot remove contacts: %s"));
-		g_error_free (error);
-	} else {
-		GList *i;
+	op = op_new (OP_CANCEL_OPERATION, book);
+	op->d.opid = in_opid;
 
-		for (i = ids; i; i = i->next)
-			e_book_backend_notify_remove (e_data_book_get_backend (book), i->data);
-		e_book_backend_notify_complete (e_data_book_get_backend (book));
+	e_gdbus_book_complete_cancel_operation (book->priv->gdbus_object, invocation, NULL);
+	e_operation_pool_push (ops_pool, op);
 
-		e_gdbus_book_complete_remove_contacts (book->priv->gdbus_object, invocation);
-	}
+	return TRUE;
 }
 
 static gboolean
-impl_Book_getStaticCapabilities (EGdbusBook *object, GDBusMethodInvocation *invocation, EDataBook *book)
+impl_Book_cancelAll (EGdbusBook *object, GDBusMethodInvocation *invocation, EDataBook *book)
 {
-	gchar *capabilities = e_book_backend_get_static_capabilities (e_data_book_get_backend (book));
-	gchar *gdbus_capabilities = NULL;
+	OperationData *op;
 
-	e_gdbus_book_complete_get_static_capabilities (object, invocation, e_util_ensure_gdbus_string (capabilities, &gdbus_capabilities));
+	op = op_new (OP_CANCEL_ALL, book);
 
-	g_free (capabilities);
-	g_free (gdbus_capabilities);
+	e_gdbus_book_complete_cancel_all (book->priv->gdbus_object, invocation, NULL);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
 static gboolean
-impl_Book_getSupportedFields (EGdbusBook *object, GDBusMethodInvocation *invocation, EDataBook *book)
+impl_Book_close (EGdbusBook *object, GDBusMethodInvocation *invocation, EDataBook *book)
 {
-	e_book_backend_get_supported_fields (e_data_book_get_backend (book), book, opid_store (invocation));
+	OperationData *op;
+
+	op = op_new (OP_CLOSE, book);
+
+	e_gdbus_book_complete_close (book->priv->gdbus_object, invocation, NULL);
+	e_operation_pool_push (ops_pool, op);
+
+	g_object_unref (book);
 
 	return TRUE;
 }
 
 void
-e_data_book_respond_get_supported_fields (EDataBook *book, guint32 opid, GError *error, GList *fields)
+e_data_book_respond_open (EDataBook *book, guint opid, GError *error)
 {
-	/* Translators: The '%s' is replaced with a detailed error message */
-	return_error_and_list (book->priv->gdbus_object, e_gdbus_book_complete_get_supported_fields, opid, error, _("Cannot get supported fields: %s"), fields, FALSE);
-}
+	op_complete (book, opid);
 
-static gboolean
-impl_Book_getRequiredFields (EGdbusBook *object, GDBusMethodInvocation *invocation, EDataBook *book)
-{
-	e_book_backend_get_required_fields (e_data_book_get_backend (book), book, opid_store (invocation));
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Cannot open book: "));
 
-	return TRUE;
+	e_gdbus_book_emit_open_done (book->priv->gdbus_object, opid, error);
+
+	if (error)
+		g_error_free (error);
 }
 
 void
-e_data_book_respond_get_required_fields (EDataBook *book, guint32 opid, GError *error, GList *fields)
+e_data_book_respond_remove (EDataBook *book, guint opid, GError *error)
 {
-	/* Translators: The '%s' is replaced with a detailed error message */
-	return_error_and_list (book->priv->gdbus_object, e_gdbus_book_complete_get_required_fields, opid, error, _("Cannot get required fields: %s"), fields, FALSE);
-}
+	op_complete (book, opid);
 
-static gboolean
-impl_Book_getSupportedAuthMethods (EGdbusBook *object, GDBusMethodInvocation *invocation, EDataBook *book)
-{
-	e_book_backend_get_supported_auth_methods (e_data_book_get_backend (book), book, opid_store (invocation));
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Cannot remove book: "));
 
-	return TRUE;
+	e_gdbus_book_emit_remove_done (book->priv->gdbus_object, opid, error);
+
+	if (error)
+		g_error_free (error);
+	else
+		e_book_backend_set_is_removed (book->priv->backend, TRUE);
 }
 
 void
-e_data_book_respond_get_supported_auth_methods (EDataBook *book, guint32 opid, GError *error, GList *auth_methods)
+e_data_book_respond_get_capabilities (EDataBook *book, guint32 opid, GError *error, const gchar *capabilities)
 {
-	/* Translators: The '%s' is replaced with a detailed error message */
-	return_error_and_list (book->priv->gdbus_object, e_gdbus_book_complete_get_supported_auth_methods, opid, error, _("Cannot get supported authentication methods: %s"), auth_methods, FALSE);
-}
+	gchar *gdbus_capabilities = NULL;
 
-static gchar *
-construct_bookview_path (void)
-{
-	static volatile guint counter = 1;
+	op_complete (book, opid);
 
-	return g_strdup_printf ("/org/gnome/evolution/dataserver/AddressBookView/%d/%d",
-				getpid (),
-				g_atomic_int_exchange_and_add ((int*)&counter, 1));
-}
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Cannot get capabilities: "));
 
-static gboolean
-impl_Book_getBookView (EGdbusBook *object, GDBusMethodInvocation *invocation, const gchar *search, const guint max_results, EDataBook *book)
-{
-	EBookBackend *backend = e_data_book_get_backend (book);
-	EBookBackendSExp *card_sexp;
-	EDataBookView *book_view;
-	gchar *path;
-	GError *error = NULL;
+	e_gdbus_book_emit_get_capabilities_done (book->priv->gdbus_object, opid, error, e_util_ensure_gdbus_string (capabilities, &gdbus_capabilities));
 
-	card_sexp = e_book_backend_sexp_new (search);
-	if (!card_sexp) {
-		error = e_data_book_create_error (E_DATA_BOOK_STATUS_INVALID_QUERY, NULL);
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_book_return_error (invocation, error, _("Invalid query: %s"));
+	if (error)
 		g_error_free (error);
-		return TRUE;
-	}
 
-	path = construct_bookview_path ();
-	book_view = e_data_book_view_new (book, search, card_sexp, max_results);
-	e_data_book_view_register_gdbus_object (book_view, g_dbus_method_invocation_get_connection (invocation), path, &error);
+	g_free (gdbus_capabilities);
+}
 
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_book_return_error (invocation, error, _("Invalid query: %s"));
-		g_error_free (error);
-		g_object_unref (book_view);
-		g_free (path);
+void
+e_data_book_respond_get_contact (EDataBook *book, guint32 opid, GError *error, const gchar *vcard)
+{
+	gchar *gdbus_vcard = NULL;
 
-		return TRUE;
-	}
+	op_complete (book, opid);
 
-	e_book_backend_add_book_view (backend, book_view);
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Cannot get contact: "));
 
-	e_gdbus_book_complete_get_book_view (object, invocation, path);
+	e_gdbus_book_emit_get_contact_done (book->priv->gdbus_object, opid, error, e_util_ensure_gdbus_string (vcard, &gdbus_vcard));
 
-	g_free (path);
+	if (error)
+		g_error_free (error);
 
-	return TRUE;
+	g_free (gdbus_vcard);
 }
 
-static gboolean
-impl_Book_getChanges (EGdbusBook *object, GDBusMethodInvocation *invocation, const gchar *IN_change_id, EDataBook *book)
+void
+e_data_book_respond_get_contact_list (EDataBook *book, guint32 opid, GError *error, const GSList *cards)
 {
-	OperationData *op;
-
-	op = op_new (OP_GET_CHANGES, book, invocation);
-	op->d.change_id = g_strdup (IN_change_id);
-	g_thread_pool_push (op_pool, op, NULL);
-
-	return TRUE;
+	/* Translators: This is prefix to a detailed error message */
+	return_error_and_list (book->priv->gdbus_object, e_gdbus_book_emit_get_contact_list_done, opid, error, _("Cannot get contact list: %s"), cards);
 }
 
 void
-e_data_book_respond_get_changes (EDataBook *book, guint32 opid, GError *error, GList *changes)
+e_data_book_respond_authenticate_user (EDataBook *book, guint32 opid, GError *error)
 {
-	GDBusMethodInvocation *invocation = opid_fetch (opid);
+	op_complete (book, opid);
 
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_book_return_error (invocation, error, _("Cannot get changes: %s"));
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Cannot authenticate user: "));
+
+	e_gdbus_book_emit_authenticate_user_done (book->priv->gdbus_object, opid, error);
+
+	if (error)
 		g_error_free (error);
-	} else {
-		GVariantBuilder *builder;
-		GVariant *variant;
+}
 
-		builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
+void
+e_data_book_respond_create (EDataBook *book, guint32 opid, GError *error, const EContact *contact)
+{
+	gchar *gdbus_uid = NULL;
 
-		while (changes != NULL) {
-			EDataBookChange *change = (EDataBookChange *) changes->data;
-			gchar *gdbus_vcard = NULL;
+	op_complete (book, opid);
 
-			g_variant_builder_add (builder, "(us)", change->change_type, e_util_ensure_gdbus_string (change->vcard, &gdbus_vcard));
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Cannot add contact: "));
 
-			g_free (gdbus_vcard);
-			g_free (change->vcard);
-			g_free (change);
+	e_gdbus_book_emit_add_contact_done (book->priv->gdbus_object, opid, error, e_util_ensure_gdbus_string (e_contact_get_const ((EContact *) contact, E_CONTACT_UID), &gdbus_uid));
 
-			changes = g_list_remove (changes, change);
-		}
+	g_free (gdbus_uid);
+	if (error) {
+		g_error_free (error);
+	} else {
+		e_book_backend_notify_update (e_data_book_get_backend (book), contact);
+		e_book_backend_notify_complete (e_data_book_get_backend (book));
+	}
+}
 
-		/* always add one empty value */
-		g_variant_builder_add (builder, "(us)", -1, "");
+void
+e_data_book_respond_modify (EDataBook *book, guint32 opid, GError *error, const EContact *contact)
+{
+	op_complete (book, opid);
 
-		variant = g_variant_builder_end (builder);
-		g_variant_builder_unref (builder);
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Cannot modify contact: "));
 
-		e_gdbus_book_complete_get_changes (book->priv->gdbus_object, invocation, variant);
+	e_gdbus_book_emit_modify_contact_done (book->priv->gdbus_object, opid, error);
 
-		g_variant_unref (variant);
+	if (error) {
+		g_error_free (error);
+	} else {
+		e_book_backend_notify_update (e_data_book_get_backend (book), contact);
+		e_book_backend_notify_complete (e_data_book_get_backend (book));
 	}
 }
 
-static gboolean
-impl_Book_cancelOperation (EGdbusBook *object, GDBusMethodInvocation *invocation, EDataBook *book)
+void
+e_data_book_respond_remove_contacts (EDataBook *book, guint32 opid, GError *error, const GSList *ids)
 {
-	GError *error = NULL;
+	op_complete (book, opid);
+
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Cannot remove contacts: "));
 
-	e_book_backend_cancel_operation (e_data_book_get_backend (book), book, &error);
+	e_gdbus_book_emit_remove_contacts_done (book->priv->gdbus_object, opid, error);
 
 	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_book_return_error (invocation, error, _("Cancel operation failed: %s"));
 		g_error_free (error);
 	} else {
-		e_gdbus_book_complete_cancel_operation (object, invocation);
+		const GSList *ii;
+
+		for (ii = ids; ii; ii = ii->next)
+			e_book_backend_notify_remove (e_data_book_get_backend (book), ii->data);
+
+		e_book_backend_notify_complete (e_data_book_get_backend (book));
 	}
 
-	return TRUE;
 }
 
-static gboolean
-impl_Book_close (EGdbusBook *object, GDBusMethodInvocation *invocation, EDataBook *book)
+void
+e_data_book_respond_get_supported_fields (EDataBook *book, guint32 opid, GError *error, const GSList *fields)
 {
-	e_book_backend_cancel_operation (e_data_book_get_backend (book), book, NULL);
-	e_book_backend_remove_client (e_data_book_get_backend (book), book);
+	/* Translators: This is prefix to a detailed error message */
+	return_error_and_list (book->priv->gdbus_object, e_gdbus_book_emit_get_supported_fields_done, opid, error, _("Cannot get supported fields: %s"), fields);
+}
 
-	e_gdbus_book_complete_close (object, invocation);
-	g_object_unref (book);
+void
+e_data_book_respond_get_required_fields (EDataBook *book, guint32 opid, GError *error, const GSList *fields)
+{
+	/* Translators: This is prefix to a detailed error message */
+	return_error_and_list (book->priv->gdbus_object, e_gdbus_book_emit_get_required_fields_done, opid, error, _("Cannot get required fields: %s"), fields);
+}
 
-	return TRUE;
+void
+e_data_book_respond_get_supported_auth_methods (EDataBook *book, guint32 opid, GError *error, const GSList *auth_methods)
+{
+	/* Translators: This is prefix to a detailed error message */
+	return_error_and_list (book->priv->gdbus_object, e_gdbus_book_emit_get_supported_auth_methods_done, opid, error, _("Cannot get supported authentication methods: %s"), auth_methods);
 }
 
 void
-e_data_book_report_writable (EDataBook *book, gboolean writable)
+e_data_book_report_error (EDataBook *book, const gchar *message)
 {
 	g_return_if_fail (book != NULL);
+	g_return_if_fail (message != NULL);
 
-	e_gdbus_book_emit_writable (book->priv->gdbus_object, writable);
+	e_gdbus_book_emit_backend_error (book->priv->gdbus_object, message);
 }
 
 void
-e_data_book_report_connection_status (EDataBook *book, gboolean connected)
+e_data_book_report_readonly (EDataBook *book, gboolean readonly)
 {
 	g_return_if_fail (book != NULL);
 
-	e_gdbus_book_emit_connection (book->priv->gdbus_object, connected);
+	e_gdbus_book_emit_readonly (book->priv->gdbus_object, readonly);
 }
 
 void
-e_data_book_report_auth_required (EDataBook *book)
+e_data_book_report_online (EDataBook *book, gboolean is_online)
 {
 	g_return_if_fail (book != NULL);
 
-	e_gdbus_book_emit_auth_required (book->priv->gdbus_object);
+	e_gdbus_book_emit_online (book->priv->gdbus_object, is_online);
 }
 
-static void
-return_error_and_list (EGdbusBook *gdbus_object, void (* complete_func) (EGdbusBook *object, GDBusMethodInvocation *invocation, const gchar * const *out_array), guint32 opid, GError *error, const gchar *error_fmt, GList *list, gboolean free_data)
+/* credentilas contains extra information for a source for which authentication is requested.
+   This parameter can be NULL to indicate "for this book".
+*/
+void
+e_data_book_report_auth_required (EDataBook *book, const ECredentials *credentials)
 {
-	GDBusMethodInvocation *invocation = opid_fetch (opid);
+	gchar *empty_strv[2];
+	gchar **strv = NULL;
 
-	g_return_if_fail (error_fmt != NULL);
-	g_return_if_fail (complete_func != NULL);
+	g_return_if_fail (book != NULL);
 
-	if (error) {
-		data_book_return_error (invocation, error, error_fmt);
-		g_error_free (error);
-	} else {
-		gchar **array;
-		GList *l;
-		gint i = 0;
+	empty_strv[0] = NULL;
+	empty_strv[1] = NULL;
 
-		array = g_new0 (gchar *, g_list_length (list) + 1);
-		for (l = list; l != NULL; l = l->next) {
-			array[i++] = e_util_utf8_make_valid (l->data);
-			if (free_data)
-				g_free (l->data);
-		}
+	if (credentials)
+		strv = e_credentials_to_strv (credentials);
 
-		complete_func (gdbus_object, invocation, (const gchar * const *) array);
+	e_gdbus_book_emit_auth_required (book->priv->gdbus_object, (const gchar * const *) (strv ? strv : empty_strv));
 
-		g_strfreev (array);
-	}
+	g_strfreev (strv);
 }
 
 /**
@@ -854,6 +984,8 @@ e_data_book_init (EDataBook *ebook)
 		ebook, E_TYPE_DATA_BOOK, EDataBookPrivate);
 
 	ebook->priv->gdbus_object = e_gdbus_book_stub_new ();
+	ebook->priv->pending_ops = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_object_unref);
+	g_static_rec_mutex_init (&ebook->priv->pending_ops_lock);
 
 	gdbus_object = ebook->priv->gdbus_object;
 	g_signal_connect (gdbus_object, "handle-open", G_CALLBACK (impl_Book_open), ebook);
@@ -864,18 +996,18 @@ e_data_book_init (EDataBook *ebook)
 	g_signal_connect (gdbus_object, "handle-add-contact", G_CALLBACK (impl_Book_addContact), ebook);
 	g_signal_connect (gdbus_object, "handle-remove-contacts", G_CALLBACK (impl_Book_removeContacts), ebook);
 	g_signal_connect (gdbus_object, "handle-modify-contact", G_CALLBACK (impl_Book_modifyContact), ebook);
-	g_signal_connect (gdbus_object, "handle-get-static-capabilities", G_CALLBACK (impl_Book_getStaticCapabilities), ebook);
+	g_signal_connect (gdbus_object, "handle-get-capabilities", G_CALLBACK (impl_Book_getCapabilities), ebook);
 	g_signal_connect (gdbus_object, "handle-get-required-fields", G_CALLBACK (impl_Book_getRequiredFields), ebook);
 	g_signal_connect (gdbus_object, "handle-get-supported-fields", G_CALLBACK (impl_Book_getSupportedFields), ebook);
 	g_signal_connect (gdbus_object, "handle-get-supported-auth-methods", G_CALLBACK (impl_Book_getSupportedAuthMethods), ebook);
-	g_signal_connect (gdbus_object, "handle-get-book-view", G_CALLBACK (impl_Book_getBookView), ebook);
-	g_signal_connect (gdbus_object, "handle-get-changes", G_CALLBACK (impl_Book_getChanges), ebook);
+	g_signal_connect (gdbus_object, "handle-get-view", G_CALLBACK (impl_Book_getBookView), ebook);
 	g_signal_connect (gdbus_object, "handle-cancel-operation", G_CALLBACK (impl_Book_cancelOperation), ebook);
+	g_signal_connect (gdbus_object, "handle-cancel-all", G_CALLBACK (impl_Book_cancelAll), ebook);
 	g_signal_connect (gdbus_object, "handle-close", G_CALLBACK (impl_Book_close), ebook);
 }
 
 static void
-e_data_book_dispose (GObject *object)
+data_book_dispose (GObject *object)
 {
 	EDataBook *book = E_DATA_BOOK (object);
 
@@ -893,20 +1025,37 @@ e_data_book_dispose (GObject *object)
 }
 
 static void
+data_book_finalize (GObject *object)
+{
+	EDataBook *book = E_DATA_BOOK (object);
+
+	if (book->priv->pending_ops) {
+		g_hash_table_destroy (book->priv->pending_ops);
+		book->priv->pending_ops = NULL;
+	}
+
+	g_static_rec_mutex_free (&book->priv->pending_ops_lock);
+
+	if (book->priv->gdbus_object) {
+		g_object_unref (book->priv->gdbus_object);
+		book->priv->gdbus_object = NULL;
+	}
+
+	G_OBJECT_CLASS (e_data_book_parent_class)->finalize (object);
+}
+
+static void
 e_data_book_class_init (EDataBookClass *klass)
 {
 	GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
 	g_type_class_add_private (klass, sizeof (EDataBookPrivate));
 
-	object_class->dispose = e_data_book_dispose;
+	object_class->dispose = data_book_dispose;
+	object_class->finalize = data_book_finalize;
 
-	if (!op_pool) {
-		op_pool = g_thread_pool_new (operation_thread, NULL, 10, FALSE, NULL);
-
-		/* Kill threads which don't do anything for 10 seconds */
-		g_thread_pool_set_max_idle_time (10 * 1000);
-	}
+	if (!ops_pool)
+		ops_pool = e_operation_pool_new (10, operation_thread, NULL);
 }
 
 EDataBook *
diff --git a/addressbook/libedata-book/e-data-book.h b/addressbook/libedata-book/e-data-book.h
index 5ea18a0..8768579 100644
--- a/addressbook/libedata-book/e-data-book.h
+++ b/addressbook/libedata-book/e-data-book.h
@@ -25,7 +25,10 @@
 
 #include <glib-object.h>
 #include <gio/gio.h>
+
+#include <libedataserver/e-credentials.h>
 #include <libedataserver/e-source.h>
+
 #include "e-book-backend.h"
 #include "e-data-book-types.h"
 
@@ -101,68 +104,30 @@ const gchar *e_data_book_status_to_string (EDataBookStatus status);
 		}								\
 	} G_STMT_END
 
-EDataBook		*e_data_book_new                    (EBookBackend *backend, ESource *source);
-
-guint			e_data_book_register_gdbus_object (EDataBook *cal, GDBusConnection *connection, const gchar *object_path, GError **error);
-
-EBookBackend		*e_data_book_get_backend            (EDataBook *book);
-ESource			*e_data_book_get_source             (EDataBook *book);
-
-void                    e_data_book_respond_open           (EDataBook *book,
-							    guint32 opid,
-							    GError *error);
-void                    e_data_book_respond_remove         (EDataBook *book,
-							    guint32 opid,
-							    GError *error);
-void                    e_data_book_respond_create         (EDataBook *book,
-							    guint32 opid,
-							    GError *error,
-							    EContact *contact);
-void                    e_data_book_respond_remove_contacts (EDataBook *book,
-							     guint32 opid,
-							     GError *error,
-							     GList *ids);
-void                    e_data_book_respond_modify         (EDataBook *book,
-							    guint32 opid,
-							    GError *error,
-							    EContact *contact);
-void                    e_data_book_respond_authenticate_user (EDataBook *book,
-							       guint32 opid,
-							       GError *error);
-void                    e_data_book_respond_get_supported_fields (EDataBook *book,
-								  guint32 opid,
-								  GError *error,
-								  GList *fields);
-void                    e_data_book_respond_get_required_fields (EDataBook *book,
-								  guint32 opid,
-								  GError *error,
-								  GList *fields);
-void                    e_data_book_respond_get_supported_auth_methods (EDataBook *book,
-									guint32 opid,
-									GError *error,
-									GList *fields);
-
-void                    e_data_book_respond_get_contact (EDataBook *book,
-							    guint32 opid,
-							    GError *error,
-							    const gchar *vcard);
-void                    e_data_book_respond_get_contact_list (EDataBook *book,
-							      guint32 opid,
-							      GError *error,
-							      GList *cards);
-void                    e_data_book_respond_get_changes    (EDataBook *book,
-							    guint32 opid,
-							    GError *error,
-							    GList *changes);
-
-void                    e_data_book_report_writable        (EDataBook                         *book,
-							    gboolean                           writable);
-void                    e_data_book_report_connection_status (EDataBook                        *book,
-							      gboolean                         is_online);
-
-void                    e_data_book_report_auth_required     (EDataBook                       *book);
-
-GType                   e_data_book_get_type               (void);
+GType		e_data_book_get_type				(void);
+EDataBook *	e_data_book_new					(EBookBackend *backend, ESource *source);
+EBookBackend *	e_data_book_get_backend				(EDataBook *book);
+ESource *	e_data_book_get_source				(EDataBook *book);
+
+guint		e_data_book_register_gdbus_object		(EDataBook *cal, GDBusConnection *connection, const gchar *object_path, GError **error);
+
+void		e_data_book_respond_open			(EDataBook *book, guint32 opid, GError *error);
+void		e_data_book_respond_remove			(EDataBook *book, guint32 opid, GError *error);
+void		e_data_book_respond_get_capabilities		(EDataBook *book, guint32 opid, GError *error, const gchar *capabilities);
+void		e_data_book_respond_create			(EDataBook *book, guint32 opid, GError *error, const EContact *contact);
+void		e_data_book_respond_remove_contacts		(EDataBook *book, guint32 opid, GError *error, const GSList *ids);
+void		e_data_book_respond_modify			(EDataBook *book, guint32 opid, GError *error, const EContact *contact);
+void		e_data_book_respond_authenticate_user		(EDataBook *book, guint32 opid, GError *error);
+void		e_data_book_respond_get_supported_fields	(EDataBook *book, guint32 opid, GError *error, const GSList *fields);
+void		e_data_book_respond_get_required_fields		(EDataBook *book, guint32 opid, GError *error, const GSList *fields);
+void		e_data_book_respond_get_supported_auth_methods	(EDataBook *book, guint32 opid, GError *error, const GSList *fields);
+void		e_data_book_respond_get_contact			(EDataBook *book, guint32 opid, GError *error, const gchar *vcard);
+void		e_data_book_respond_get_contact_list		(EDataBook *book, guint32 opid, GError *error, const GSList *cards);
+
+void		e_data_book_report_error			(EDataBook *book, const gchar *message);
+void		e_data_book_report_readonly			(EDataBook *book, gboolean readonly);
+void		e_data_book_report_online			(EDataBook *book, gboolean is_online);
+void		e_data_book_report_auth_required		(EDataBook *book, const ECredentials *credentials);
 
 G_END_DECLS
 
diff --git a/addressbook/libegdbus/Makefile.am b/addressbook/libegdbus/Makefile.am
index 41644a3..f564535 100644
--- a/addressbook/libegdbus/Makefile.am
+++ b/addressbook/libegdbus/Makefile.am
@@ -1,13 +1,3 @@
-GDBUS_XML_FILES =					\
-	../libedata-book/e-data-book-factory.xml	\
-	../libedata-book/e-data-book-view.xml		\
-	../libedata-book/e-data-book.xml
-
-gdbus-files: $(GDBUS_XML_FILES)
-	gdbus-codegen --namespace=EGdbus --strip-prefix=org.gnome.evolution.dataserver.addressbook --output-prefix=e-gdbus $(GDBUS_XML_FILES)
-	rm e-gdbus-bindings.h
-	rm e-gdbus-bindings.stamp
-
 # The library
 noinst_LTLIBRARIES = libegdbus-book.la
 
@@ -19,21 +9,17 @@ libegdbus_book_la_CPPFLAGS =			\
 	$(E_DATA_SERVER_CFLAGS)
 
 libegdbus_book_la_SOURCES =			\
-	e-gdbus-egdbusbook.h			\
-	e-gdbus-egdbusbook.c			\
-	e-gdbus-egdbusbookfactory.h		\
-	e-gdbus-egdbusbookfactory.c		\
-	e-gdbus-egdbusbookview.h		\
-	e-gdbus-egdbusbookview.c		\
-	e-gdbus-marshallers.h			\
-	e-gdbus-marshallers.c			\
-	e-gdbus-typemappers.h
+	e-gdbus-book.h				\
+	e-gdbus-book.c				\
+	e-gdbus-book-factory.h			\
+	e-gdbus-book-factory.c			\
+	e-gdbus-book-view.h			\
+	e-gdbus-book-view.c
 
 libegdbus_book_la_LIBADD =			\
+	$(top_builddir)/libedataserver/libedataserver-1.2.la	\
 	$(E_DATA_SERVER_LIBS)
 
 libegdbus_book_la_LDFLAGS = $(NO_UNDEFINED)
 
-EXTRA_DIST = e-gdbus-marshallers.list
-
 -include $(top_srcdir)/git.mk
diff --git a/addressbook/libegdbus/e-gdbus-book-factory.c b/addressbook/libegdbus/e-gdbus-book-factory.c
new file mode 100644
index 0000000..3536f59
--- /dev/null
+++ b/addressbook/libegdbus/e-gdbus-book-factory.c
@@ -0,0 +1,551 @@
+/*
+ * e-gdbus-book-factory.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#include <stdio.h>
+#include <gio/gio.h>
+
+#include <libedataserver/e-data-server-util.h>
+#include <libedataserver/e-gdbus-marshallers.h>
+
+#include "e-gdbus-book-factory.h"
+
+#define GDBUS_BOOK_FACTORY_INTERFACE_NAME "org.gnome.evolution.dataserver.AddressBookFactory"
+
+typedef EGdbusBookFactoryIface EGdbusBookFactoryInterface;
+G_DEFINE_INTERFACE (EGdbusBookFactory, e_gdbus_book_factory, G_TYPE_OBJECT);
+
+enum
+{
+	_0_SIGNAL,
+	__GET_BOOK_METHOD,
+	__LAST_SIGNAL
+};
+
+static guint signals[__LAST_SIGNAL] = {0};
+
+/* ------------------------------------------------------------------------- */
+
+/* Various lookup tables */
+
+static GHashTable *_method_name_to_id = NULL;
+static GHashTable *_method_name_to_type = NULL;
+
+static guint
+lookup_method_id_from_method_name (const gchar *method_name)
+{
+	return GPOINTER_TO_UINT (g_hash_table_lookup (_method_name_to_id, method_name));
+}
+
+static guint
+lookup_method_type_from_method_name (const gchar *method_name)
+{
+	return GPOINTER_TO_UINT (g_hash_table_lookup (_method_name_to_type, method_name));
+}
+
+/* ------------------------------------------------------------------------- */
+
+static void
+e_gdbus_book_factory_default_init (EGdbusBookFactoryIface *iface)
+{
+	/* Build lookup structures */
+	_method_name_to_id = g_hash_table_new (g_str_hash, g_str_equal);
+	_method_name_to_type = g_hash_table_new (g_str_hash, g_str_equal);
+
+	E_INIT_GDBUS_METHOD_STRING (EGdbusBookFactoryIface, "getBook", get_book, __GET_BOOK_METHOD)
+}
+
+void
+e_gdbus_book_factory_call_get_book (GDBusProxy *proxy, const gchar *in_source, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_method_call_string ("getBook", proxy, in_source, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_book_factory_call_get_book_finish (GDBusProxy *proxy, GAsyncResult *result, gchar **out_path, GError **error)
+{
+	return e_gdbus_proxy_method_call_finish_string (proxy, result, out_path, error);
+}
+
+gboolean
+e_gdbus_book_factory_call_get_book_sync (GDBusProxy *proxy, const gchar *in_source, gchar **out_path, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_method_call_sync_string__string ("getBook", proxy, in_source, out_path, cancellable, error);
+}
+
+void
+e_gdbus_book_factory_complete_get_book (EGdbusBookFactory *object, GDBusMethodInvocation *invocation, const gchar *out_path, const GError *error)
+{
+	e_gdbus_complete_sync_method_string (object, invocation, out_path, error);
+}
+
+E_DECLARE_GDBUS_SYNC_METHOD_1_WITH_RETURN (book_factory, getBook, source, "s", path, "s")
+
+static const GDBusMethodInfo * const e_gdbus_book_factory_method_info_pointers[] =
+{
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (book_factory, getBook),
+	NULL
+};
+
+static const GDBusInterfaceInfo _e_gdbus_book_factory_interface_info =
+{
+	-1,
+	(gchar *) GDBUS_BOOK_FACTORY_INTERFACE_NAME,
+	(GDBusMethodInfo **) &e_gdbus_book_factory_method_info_pointers,
+	(GDBusSignalInfo **) NULL,
+	(GDBusPropertyInfo **) NULL
+};
+
+static void
+handle_method_call (GDBusConnection       *connection,
+                    const gchar           *sender,
+                    const gchar           *object_path,
+                    const gchar           *interface_name,
+                    const gchar           *method_name,
+                    GVariant              *parameters,
+                    GDBusMethodInvocation *invocation,
+                    gpointer               user_data)
+{
+	guint method_id, method_type;
+
+	method_id = lookup_method_id_from_method_name (method_name);
+	method_type = lookup_method_type_from_method_name (method_name);
+
+	g_return_if_fail (method_id != 0);
+	g_return_if_fail (method_type != 0);
+
+	e_gdbus_stub_handle_method_call (user_data, invocation, parameters, method_name, signals[method_id], method_type);
+}
+
+static GVariant *
+get_property (GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GError **error, gpointer user_data)
+{
+	g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "This implementation does not support property `%s'", property_name);
+	return NULL;
+}
+
+static gboolean
+set_property (GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GVariant *value, GError **error, gpointer user_data)
+{
+	g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "This implementation does not support property `%s'", property_name);
+	return FALSE;
+}
+
+static const GDBusInterfaceVTable e_gdbus_book_factory_interface_vtable =
+{
+	handle_method_call,
+	get_property,
+	set_property
+};
+
+static gboolean
+emit_notifications_in_idle (gpointer user_data)
+{
+	GObject *object = G_OBJECT (user_data);
+	GDBusConnection *connection;
+	const gchar *path;
+	GHashTable *notification_queue;
+	GHashTableIter iter;
+	const gchar *property_name;
+	GVariant *value;
+	GVariantBuilder *builder;
+	GVariantBuilder *invalidated_builder;
+	GHashTable *pvc;
+	gboolean has_changes;
+
+	notification_queue = g_object_get_data (object, "gdbus-codegen-notification-queue");
+	path = g_object_get_data (object, "gdbus-codegen-path");
+	connection = g_object_get_data (object, "gdbus-codegen-connection");
+	pvc = g_object_get_data (object, "gdbus-codegen-pvc");
+	g_assert (notification_queue != NULL && path != NULL && connection != NULL && pvc != NULL);
+
+	builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
+	invalidated_builder = g_variant_builder_new (G_VARIANT_TYPE ("as"));
+	g_hash_table_iter_init (&iter, notification_queue);
+	has_changes = FALSE;
+	while (g_hash_table_iter_next (&iter, (gpointer) &property_name, (gpointer) &value)) {
+		GVariant *cached_value;
+		cached_value = g_hash_table_lookup (pvc, property_name);
+		if (cached_value == NULL || !g_variant_equal (cached_value, value)) {
+			g_hash_table_insert (pvc, (gpointer) property_name, (gpointer) g_variant_ref (value));
+			g_variant_builder_add (builder, "{sv}", property_name, value);
+			has_changes = TRUE;
+		}
+	}
+
+	if (has_changes) {
+		g_dbus_connection_emit_signal (connection,
+						NULL,
+						path,
+						"org.freedesktop.DBus.Properties",
+						"PropertiesChanged",
+						g_variant_new ("(sa{sv}as)",
+							GDBUS_BOOK_FACTORY_INTERFACE_NAME,
+							builder,
+							invalidated_builder),
+						NULL);
+	} else {
+		g_variant_builder_unref (builder);
+		g_variant_builder_unref (invalidated_builder);
+	}
+
+	g_hash_table_remove_all (notification_queue);
+	g_object_set_data (object, "gdbus-codegen-notification-idle-id", GUINT_TO_POINTER (0));
+	return FALSE;
+}
+
+/**
+ * e_gdbus_book_factory_drain_notify:
+ * @object: A #EGdbusBookFactory that is exported.
+ *
+ * If @object has queued notifications, empty the queue forcing
+ * the <literal>PropertiesChanged</literal> signal to be emitted.
+ * See <xref linkend="EGdbusBookFactory.description"/> for more background information.
+ */
+void
+e_gdbus_book_factory_drain_notify (EGdbusBookFactory *object)
+{
+	gint idle_id;
+	idle_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (object), "gdbus-codegen-notification-idle-id"));
+	if (idle_id > 0) {
+		emit_notifications_in_idle (object);
+		g_source_remove (idle_id);
+	}
+}
+
+static void
+on_object_unregistered (GObject *object)
+{
+	gint idle_id;
+	idle_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (object), "gdbus-codegen-notification-idle-id"));
+	if (idle_id > 0) {
+		g_source_remove (idle_id);
+	}
+	g_object_set_data (G_OBJECT (object), "gdbus-codegen-path", NULL);
+	g_object_set_data (G_OBJECT (object), "gdbus-codegen-connection", NULL);
+}
+
+/**
+ * e_gdbus_book_factory_register_object:
+ * @object: An instance of a #GObject<!-- -->-derived type implementing the #EGdbusBookFactory interface.
+ * @connection: A #GDBusConnection.
+ * @object_path: The object to register the object at.
+ * @error: Return location for error or %NULL.
+ *
+ * Registers @object at @object_path on @connection.
+ *
+ * See <xref linkend="EGdbusBookFactory.description"/>
+ * for how properties, methods and signals are handled.
+ *
+ * Returns: 0 if @error is set, otherwise a registration id (never 0) that can be used with g_dbus_connection_unregister_object().
+ */
+guint
+e_gdbus_book_factory_register_object (EGdbusBookFactory *object, GDBusConnection *connection, const gchar *object_path, GError **error)
+{
+	GHashTable *pvc;
+
+	pvc = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify) g_variant_unref);
+
+	g_object_set_data_full (G_OBJECT (object), "gdbus-codegen-path", (gpointer) g_strdup (object_path), g_free);
+	g_object_set_data (G_OBJECT (object), "gdbus-codegen-connection", (gpointer) connection);
+	g_object_set_data_full (G_OBJECT (object), "gdbus-codegen-pvc", (gpointer) pvc, (GDestroyNotify) g_hash_table_unref);
+
+	return g_dbus_connection_register_object (connection,
+			object_path,
+			(GDBusInterfaceInfo *) &_e_gdbus_book_factory_interface_info,
+			&e_gdbus_book_factory_interface_vtable,
+			object,
+			(GDestroyNotify) on_object_unregistered,
+			error);
+}
+
+/**
+ * e_gdbus_book_factory_interface_info:
+ *
+ * Gets interface description for the <literal>org.gnome.evolution.dataserver.AddressBookFactory</literal> D-Bus interface.
+ *
+ * Returns: A #GDBusInterfaceInfo. Do not free, the object is statically allocated.
+ */
+const GDBusInterfaceInfo *
+e_gdbus_book_factory_interface_info (void)
+{
+	return &_e_gdbus_book_factory_interface_info;
+}
+
+/* ---------------------------------------------------------------------- */
+
+static void proxy_iface_init (EGdbusBookFactoryIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (EGdbusBookFactoryProxy, e_gdbus_book_factory_proxy, G_TYPE_DBUS_PROXY,
+                         G_IMPLEMENT_INTERFACE (E_TYPE_GDBUS_BOOK_FACTORY, proxy_iface_init));
+
+static void
+e_gdbus_book_factory_proxy_init (EGdbusBookFactoryProxy *proxy)
+{
+	g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), (GDBusInterfaceInfo *) &_e_gdbus_book_factory_interface_info);
+}
+
+static void
+g_signal (GDBusProxy *proxy, const gchar *sender_name, const gchar *signal_name, GVariant *parameters)
+{
+	/*
+	guint signal_id, signal_type;
+
+	signal_id = lookup_signal_id_from_signal_name (signal_name);
+	signal_type = lookup_signal_type_from_signal_name (signal_name);
+
+	g_return_if_fail (signal_id != 0);
+	g_return_if_fail (signal_type != 0);
+
+	e_gdbus_proxy_emit_signal (proxy, parameters, signals[signal_id], signal_type);
+	*/
+}
+
+static void
+e_gdbus_book_factory_proxy_class_init (EGdbusBookFactoryProxyClass *klass)
+{
+	GDBusProxyClass *proxy_class;
+
+	proxy_class = G_DBUS_PROXY_CLASS (klass);
+	proxy_class->g_signal = g_signal;
+}
+
+static void
+proxy_iface_init (EGdbusBookFactoryIface *iface)
+{
+}
+
+/**
+ * e_gdbus_book_factory_proxy_new:
+ * @connection: A #GDBusConnection.
+ * @flags: Flags used when constructing the proxy.
+ * @name: A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
+ * @object_path: An object path.
+ * @cancellable: A #GCancellable or %NULL.
+ * @callback: Callback function to invoke when the proxy is ready.
+ * @user_data: User data to pass to @callback.
+ *
+ * Like g_dbus_proxy_new() but returns a #EGdbusBookFactoryProxy.
+ *
+ * This is a failable asynchronous constructor - when the proxy is ready, callback will be invoked and you can use e_gdbus_book_factory_proxy_new_finish() to get the result.
+ */
+void
+e_gdbus_book_factory_proxy_new (GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	g_async_initable_new_async (E_TYPE_GDBUS_BOOK_FACTORY_PROXY,
+				G_PRIORITY_DEFAULT,
+				cancellable,
+				callback,
+				user_data,
+				"g-flags", flags,
+				"g-name", name,
+				"g-connection", connection,
+				"g-object-path", object_path,
+				"g-interface-name", GDBUS_BOOK_FACTORY_INTERFACE_NAME,
+				NULL);
+}
+
+/**
+ * e_gdbus_book_factory_proxy_new_finish:
+ * @result: A #GAsyncResult obtained from the #GAsyncReadyCallback function passed to e_gdbus_book_factory_proxy_new().
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes creating a #EGdbusBookFactoryProxy.
+ *
+ * Returns: A #EGdbusBookFactoryProxy or %NULL if @error is set. Free with g_object_unref().
+ */
+EGdbusBookFactory *
+e_gdbus_book_factory_proxy_new_finish (GAsyncResult  *result, GError **error)
+{
+	GObject *object;
+	GObject *source_object;
+	source_object = g_async_result_get_source_object (result);
+	g_assert (source_object != NULL);
+	object = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), result, error);
+	g_object_unref (source_object);
+	if (object != NULL)
+		return E_GDBUS_BOOK_FACTORY (object);
+	else
+		return NULL;
+}
+
+/**
+ * e_gdbus_book_factory_proxy_new_sync:
+ * @connection: A #GDBusConnection.
+ * @flags: Flags used when constructing the proxy.
+ * @name: A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
+ * @object_path: An object path.
+ * @cancellable: A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Like g_dbus_proxy_new_sync() but returns a #EGdbusBookFactoryProxy.
+ *
+ * This is a synchronous failable constructor. See e_gdbus_book_factory_proxy_new() and e_gdbus_book_factory_proxy_new_finish() for the asynchronous version.
+ *
+ * Returns: A #EGdbusBookFactoryProxy or %NULL if error is set. Free with g_object_unref().
+ */
+EGdbusBookFactory *
+e_gdbus_book_factory_proxy_new_sync (GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error)
+{
+	GInitable *initable;
+	initable = g_initable_new (E_TYPE_GDBUS_BOOK_FACTORY_PROXY,
+				cancellable,
+				error,
+				"g-flags", flags,
+				"g-name", name,
+				"g-connection", connection,
+				"g-object-path", object_path,
+				"g-interface-name", GDBUS_BOOK_FACTORY_INTERFACE_NAME,
+				NULL);
+	if (initable != NULL)
+		return E_GDBUS_BOOK_FACTORY (initable);
+	else
+		return NULL;
+}
+
+/**
+ * e_gdbus_book_factory_proxy_new_for_bus:
+ * @bus_type: A #GBusType.
+ * @flags: Flags used when constructing the proxy.
+ * @name: A bus name (well-known or unique).
+ * @object_path: An object path.
+ * @cancellable: A #GCancellable or %NULL.
+ * @callback: Callback function to invoke when the proxy is ready.
+ * @user_data: User data to pass to @callback.
+ *
+ * Like g_dbus_proxy_new_for_bus() but returns a #EGdbusBookFactoryProxy.
+ *
+ * This is a failable asynchronous constructor - when the proxy is ready, callback will be invoked and you can use e_gdbus_book_factory_proxy_new_for_bus_finish() to get the result.
+ */
+void
+e_gdbus_book_factory_proxy_new_for_bus (GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	g_async_initable_new_async (E_TYPE_GDBUS_BOOK_FACTORY_PROXY,
+				G_PRIORITY_DEFAULT,
+				cancellable,
+				callback,
+				user_data,
+				"g-flags", flags,
+				"g-name", name,
+				"g-bus-type", bus_type,
+				"g-object-path", object_path,
+				"g-interface-name", GDBUS_BOOK_FACTORY_INTERFACE_NAME,
+				NULL);
+}
+
+/**
+ * e_gdbus_book_factory_proxy_new_for_bus_finish:
+ * @result: A #GAsyncResult obtained from the #GAsyncReadyCallback function passed to e_gdbus_book_factory_proxy_new_for_bus().
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes creating a #EGdbusBookFactoryProxy.
+ *
+ * Returns: A #EGdbusBookFactoryProxy or %NULL if @error is set. Free with g_object_unref().
+ */
+EGdbusBookFactory *
+e_gdbus_book_factory_proxy_new_for_bus_finish (GAsyncResult *result, GError **error)
+{
+	GObject *object;
+	GObject *source_object;
+	source_object = g_async_result_get_source_object (result);
+	g_assert (source_object != NULL);
+	object = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), result, error);
+	g_object_unref (source_object);
+	if (object != NULL)
+		return E_GDBUS_BOOK_FACTORY (object);
+	else
+		return NULL;
+}
+
+/**
+ * e_gdbus_book_factory_proxy_new_for_bus_sync:
+ * @bus_type: A #GBusType.
+ * @flags: Flags used when constructing the proxy.
+ * @name: A bus name (well-known or unique).
+ * @object_path: An object path.
+ * @cancellable: A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Like g_dbus_proxy_new_for_bus_sync() but returns a #EGdbusBookFactoryProxy.
+ *
+ * This is a synchronous failable constructor. See e_gdbus_book_factory_proxy_new_for_bus() and e_gdbus_book_factory_proxy_new_for_bus_finish() for the asynchronous version.
+ *
+ * Returns: A #EGdbusBookFactoryProxy or %NULL if error is set. Free with g_object_unref().
+ */
+EGdbusBookFactory *
+e_gdbus_book_factory_proxy_new_for_bus_sync (GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error)
+{
+	GInitable *initable;
+	initable = g_initable_new (E_TYPE_GDBUS_BOOK_FACTORY_PROXY,
+				cancellable,
+				error,
+				"g-flags", flags,
+				"g-name", name,
+				"g-bus-type", bus_type,
+				"g-object-path", object_path,
+				"g-interface-name", GDBUS_BOOK_FACTORY_INTERFACE_NAME,
+				NULL);
+	if (initable != NULL)
+		return E_GDBUS_BOOK_FACTORY (initable);
+	else
+		return NULL;
+}
+
+/* ---------------------------------------------------------------------- */
+
+struct _EGdbusBookFactoryStubPrivate
+{
+	gint foo;
+};
+
+static void stub_iface_init (EGdbusBookFactoryIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (EGdbusBookFactoryStub, e_gdbus_book_factory_stub, G_TYPE_OBJECT,
+                         G_IMPLEMENT_INTERFACE (E_TYPE_GDBUS_BOOK_FACTORY, stub_iface_init));
+
+static void
+e_gdbus_book_factory_stub_init (EGdbusBookFactoryStub *stub)
+{
+	stub->priv = G_TYPE_INSTANCE_GET_PRIVATE (stub, E_TYPE_GDBUS_BOOK_FACTORY_STUB, EGdbusBookFactoryStubPrivate);
+}
+
+static void
+e_gdbus_book_factory_stub_class_init (EGdbusBookFactoryStubClass *klass)
+{
+	g_type_class_add_private (klass, sizeof (EGdbusBookFactoryStubPrivate));
+}
+
+static void
+stub_iface_init (EGdbusBookFactoryIface *iface)
+{
+}
+
+/**
+ * e_gdbus_book_factory_stub_new:
+ *
+ * Creates a new stub object that can be exported via e_gdbus_book_factory_register_object().
+ *
+ * Returns: A #EGdbusBookFactoryStub instance. Free with g_object_unref().
+ */
+EGdbusBookFactory *
+e_gdbus_book_factory_stub_new (void)
+{
+	return E_GDBUS_BOOK_FACTORY (g_object_new (E_TYPE_GDBUS_BOOK_FACTORY_STUB, NULL));
+}
diff --git a/addressbook/libegdbus/e-gdbus-book-factory.h b/addressbook/libegdbus/e-gdbus-book-factory.h
new file mode 100644
index 0000000..588de6c
--- /dev/null
+++ b/addressbook/libegdbus/e-gdbus-book-factory.h
@@ -0,0 +1,120 @@
+/*
+ * e-gdbus-book-factory.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#ifndef E_GDBUS_BOOK_FACTORY_H
+#define E_GDBUS_BOOK_FACTORY_H
+
+#include <gio/gio.h>
+
+#include <libedataserver/e-gdbus-templates.h>
+
+G_BEGIN_DECLS
+
+#define E_TYPE_GDBUS_BOOK_FACTORY         (e_gdbus_book_factory_get_type ())
+#define E_GDBUS_BOOK_FACTORY(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_GDBUS_BOOK_FACTORY, EGdbusBookFactory))
+#define E_IS_GDBUS_BOOK_FACTORY(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_GDBUS_BOOK_FACTORY))
+#define E_GDBUS_BOOK_FACTORY_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE((o), E_TYPE_GDBUS_BOOK_FACTORY, EGdbusBookFactoryIface))
+
+/**
+ * EGdbusBookFactory:
+ *
+ * Opaque type representing a proxy or an exported object.
+ */
+typedef struct _EGdbusBookFactory EGdbusBookFactory; /* Dummy typedef */
+typedef struct _EGdbusBookFactoryIface EGdbusBookFactoryIface;
+
+GType e_gdbus_book_factory_get_type (void) G_GNUC_CONST;
+
+/* ---------------------------------------------------------------------- */
+
+typedef struct _EGdbusBookFactoryProxy EGdbusBookFactoryProxy;
+typedef struct _EGdbusBookFactoryProxyClass EGdbusBookFactoryProxyClass;
+typedef struct _EGdbusBookFactoryProxyPrivate EGdbusBookFactoryProxyPrivate;
+
+struct _EGdbusBookFactoryProxy
+{
+	GDBusProxy parent_instance;
+	EGdbusBookFactoryProxyPrivate *priv;
+};
+
+struct _EGdbusBookFactoryProxyClass
+{
+	GDBusProxyClass parent_class;
+};
+
+#define E_TYPE_GDBUS_BOOK_FACTORY_PROXY (e_gdbus_book_factory_proxy_get_type ())
+GType e_gdbus_book_factory_proxy_get_type (void) G_GNUC_CONST;
+
+void			e_gdbus_book_factory_proxy_new (GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+EGdbusBookFactory *	e_gdbus_book_factory_proxy_new_finish (GAsyncResult *result, GError **error);
+EGdbusBookFactory *	e_gdbus_book_factory_proxy_new_sync (GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error);
+
+void			e_gdbus_book_factory_proxy_new_for_bus (GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+EGdbusBookFactory *	e_gdbus_book_factory_proxy_new_for_bus_finish (GAsyncResult *result, GError **error);
+EGdbusBookFactory *	e_gdbus_book_factory_proxy_new_for_bus_sync (GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error);
+
+/* ---------------------------------------------------------------------- */
+
+typedef struct _EGdbusBookFactoryStub EGdbusBookFactoryStub;
+typedef struct _EGdbusBookFactoryStubClass EGdbusBookFactoryStubClass;
+typedef struct _EGdbusBookFactoryStubPrivate EGdbusBookFactoryStubPrivate;
+
+struct _EGdbusBookFactoryStub
+{
+	GObject parent_instance;
+	EGdbusBookFactoryStubPrivate *priv;
+};
+
+struct _EGdbusBookFactoryStubClass
+{
+	GObjectClass parent_class;
+};
+
+#define E_TYPE_GDBUS_BOOK_FACTORY_STUB (e_gdbus_book_factory_stub_get_type ())
+GType e_gdbus_book_factory_stub_get_type (void) G_GNUC_CONST;
+
+EGdbusBookFactory *e_gdbus_book_factory_stub_new (void);
+
+guint e_gdbus_book_factory_register_object (EGdbusBookFactory *object, GDBusConnection *connection, const gchar *object_path, GError **error);
+
+void e_gdbus_book_factory_drain_notify (EGdbusBookFactory *object);
+
+const GDBusInterfaceInfo *e_gdbus_book_factory_interface_info (void) G_GNUC_CONST;
+
+struct _EGdbusBookFactoryIface
+{
+	GTypeInterface parent_iface;
+
+	/* Signal handlers for handling D-Bus method calls: */
+	gboolean (*handle_get_book) (EGdbusBookFactory *object, GDBusMethodInvocation *invocation, const gchar *in_source);
+};
+
+/* D-Bus Methods */
+void		e_gdbus_book_factory_call_get_book		(GDBusProxy *proxy, const gchar *in_source, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_book_factory_call_get_book_finish	(GDBusProxy *proxy, GAsyncResult *result, gchar **out_path, GError **error);
+gboolean	e_gdbus_book_factory_call_get_book_sync		(GDBusProxy *proxy, const gchar *in_source, gchar **out_path, GCancellable *cancellable, GError **error);
+
+/* D-Bus Methods Completion Helpers */
+void e_gdbus_book_factory_complete_get_book (EGdbusBookFactory *object, GDBusMethodInvocation *invocation, const gchar *out_path, const GError *error);
+
+G_END_DECLS
+
+#endif /* E_GDBUS_BOOK_FACTORY_H */
diff --git a/addressbook/libegdbus/e-gdbus-book-view.c b/addressbook/libegdbus/e-gdbus-book-view.c
new file mode 100644
index 0000000..633efe6
--- /dev/null
+++ b/addressbook/libegdbus/e-gdbus-book-view.c
@@ -0,0 +1,668 @@
+/*
+ * e-gdbus-book-view.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#include <stdio.h>
+#include <gio/gio.h>
+
+#include <libedataserver/e-data-server-util.h>
+#include <libedataserver/e-gdbus-marshallers.h>
+
+#include "e-gdbus-book-view.h"
+
+#define GDBUS_BOOK_VIEW_INTERFACE_NAME "org.gnome.evolution.dataserver.AddressBookView"
+
+typedef EGdbusBookViewIface EGdbusBookViewInterface;
+G_DEFINE_INTERFACE (EGdbusBookView, e_gdbus_book_view, G_TYPE_OBJECT);
+
+enum
+{
+	_0_SIGNAL,
+	__OBJECTS_ADDED_SIGNAL,
+	__OBJECTS_CHANGED_SIGNAL,
+	__OBJECTS_REMOVED_SIGNAL,
+	__PROGRESS_SIGNAL,
+	__COMPLETE_SIGNAL,
+	__START_METHOD,
+	__STOP_METHOD,
+	__DISPOSE_METHOD,
+	__LAST_SIGNAL
+};
+
+static guint signals[__LAST_SIGNAL] = {0};
+
+/* ------------------------------------------------------------------------- */
+
+/* Various lookup tables */
+
+static GHashTable *_method_name_to_id = NULL;
+static GHashTable *_method_name_to_type = NULL;
+static GHashTable *_signal_name_to_id = NULL;
+static GHashTable *_signal_name_to_type = NULL;
+
+static guint
+lookup_method_id_from_method_name (const gchar *method_name)
+{
+	return GPOINTER_TO_UINT (g_hash_table_lookup (_method_name_to_id, method_name));
+}
+
+static guint
+lookup_method_type_from_method_name (const gchar *method_name)
+{
+	return GPOINTER_TO_UINT (g_hash_table_lookup (_method_name_to_type, method_name));
+}
+
+static guint
+lookup_signal_id_from_signal_name (const gchar *signal_name)
+{
+	return GPOINTER_TO_UINT (g_hash_table_lookup (_signal_name_to_id, signal_name));
+}
+
+static guint
+lookup_signal_type_from_signal_name (const gchar *signal_name)
+{
+	return GPOINTER_TO_UINT (g_hash_table_lookup (_signal_name_to_type, signal_name));
+}
+
+/* ------------------------------------------------------------------------- */
+
+E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_STRV	 (GDBUS_BOOK_VIEW_INTERFACE_NAME, objects_added)
+E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_STRV	 (GDBUS_BOOK_VIEW_INTERFACE_NAME, objects_changed)
+E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_STRV	 (GDBUS_BOOK_VIEW_INTERFACE_NAME, objects_removed)
+E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_UINT_STRING (GDBUS_BOOK_VIEW_INTERFACE_NAME, progress)
+E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_UINT_STRING (GDBUS_BOOK_VIEW_INTERFACE_NAME, complete)
+
+static void
+e_gdbus_book_view_default_init (EGdbusBookViewIface *iface)
+{
+	/* Build lookup structures */
+	_method_name_to_id = g_hash_table_new (g_str_hash, g_str_equal);
+	_method_name_to_type = g_hash_table_new (g_str_hash, g_str_equal);
+	_signal_name_to_id = g_hash_table_new (g_str_hash, g_str_equal);
+	_signal_name_to_type = g_hash_table_new (g_str_hash, g_str_equal);
+
+	
+	/* GObject signals definitions for D-Bus signals: */
+	E_INIT_GDBUS_SIGNAL_STRV	(EGdbusBookViewIface, "ObjectsAdded",	objects_added, __OBJECTS_ADDED_SIGNAL)
+	E_INIT_GDBUS_SIGNAL_STRV	(EGdbusBookViewIface, "ObjectsChanged",	objects_changed, __OBJECTS_CHANGED_SIGNAL)
+	E_INIT_GDBUS_SIGNAL_STRV	(EGdbusBookViewIface, "ObjectsRemoved",	objects_removed, __OBJECTS_REMOVED_SIGNAL)
+	E_INIT_GDBUS_SIGNAL_UINT_STRING	(EGdbusBookViewIface, "Progress",	progress, __PROGRESS_SIGNAL)
+	E_INIT_GDBUS_SIGNAL_UINT_STRING	(EGdbusBookViewIface, "Complete",	complete, __COMPLETE_SIGNAL)
+
+	/* GObject signals definitions for D-Bus methods: */
+	E_INIT_GDBUS_METHOD_VOID	(EGdbusBookViewIface, "start",		start, __START_METHOD)
+	E_INIT_GDBUS_METHOD_VOID	(EGdbusBookViewIface, "stop",		stop, __STOP_METHOD)
+	E_INIT_GDBUS_METHOD_VOID	(EGdbusBookViewIface, "dispose",	dispose, __DISPOSE_METHOD)
+}
+
+void
+e_gdbus_book_view_call_start (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_method_call_void ("start", proxy, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_book_view_call_start_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return e_gdbus_proxy_method_call_finish_void (proxy, result, error);
+}
+
+gboolean
+e_gdbus_book_view_call_start_sync (GDBusProxy *proxy, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_method_call_sync_void__void ("start", proxy, cancellable, error);
+}
+
+void
+e_gdbus_book_view_call_stop (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_method_call_void ("stop", proxy, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_book_view_call_stop_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return e_gdbus_proxy_method_call_finish_void (proxy, result, error);
+}
+
+gboolean
+e_gdbus_book_view_call_stop_sync (GDBusProxy *proxy, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_method_call_sync_void__void ("stop", proxy, cancellable, error);
+}
+
+void
+e_gdbus_book_view_call_dispose (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_method_call_void ("dispose", proxy, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_book_view_call_dispose_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return e_gdbus_proxy_method_call_finish_void (proxy, result, error);
+}
+
+gboolean
+e_gdbus_book_view_call_dispose_sync (GDBusProxy *proxy, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_method_call_sync_void__void ("dispose", proxy, cancellable, error);
+}
+
+void
+e_gdbus_book_view_emit_objects_added (EGdbusBookView *object, const gchar * const *arg_objects)
+{
+	g_signal_emit (object, signals[__OBJECTS_ADDED_SIGNAL], 0, arg_objects);
+}
+
+void
+e_gdbus_book_view_emit_objects_changed (EGdbusBookView *object, const gchar * const *arg_objects)
+{
+	g_signal_emit (object, signals[__OBJECTS_CHANGED_SIGNAL], 0, arg_objects);
+}
+
+void
+e_gdbus_book_view_emit_objects_removed (EGdbusBookView *object, const gchar * const *arg_uids)
+{
+	g_signal_emit (object, signals[__OBJECTS_REMOVED_SIGNAL], 0, arg_uids);
+}
+
+void
+e_gdbus_book_view_emit_progress (EGdbusBookView *object, guint arg_percent, const gchar *arg_message)
+{
+	g_signal_emit (object, signals[__PROGRESS_SIGNAL], 0, arg_percent, arg_message);
+}
+
+void
+e_gdbus_book_view_emit_complete (EGdbusBookView *object, guint arg_status, const gchar *arg_message)
+{
+	g_signal_emit (object, signals[__COMPLETE_SIGNAL], 0, arg_status, arg_message);
+}
+
+E_DECLARE_GDBUS_NOTIFY_SIGNAL_1 (book_view, ObjectsAdded, objects, "as")
+E_DECLARE_GDBUS_NOTIFY_SIGNAL_1 (book_view, ObjectsChanged, objects, "as")
+E_DECLARE_GDBUS_NOTIFY_SIGNAL_1 (book_view, ObjectsRemoved, uids, "as")
+E_DECLARE_GDBUS_NOTIFY_SIGNAL_2 (book_view, Progress, percent, "u", message, "s")
+E_DECLARE_GDBUS_NOTIFY_SIGNAL_2 (book_view, Complete, status, "u", message, "s")
+
+E_DECLARE_GDBUS_SYNC_METHOD_0	(book_view, start)
+E_DECLARE_GDBUS_SYNC_METHOD_0	(book_view, stop)
+E_DECLARE_GDBUS_SYNC_METHOD_0	(book_view, dispose)
+
+static const GDBusMethodInfo * const e_gdbus_book_view_method_info_pointers[] =
+{
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (book_view, start),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (book_view, stop),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (book_view, dispose),
+	NULL
+};
+
+static const GDBusSignalInfo * const e_gdbus_book_view_signal_info_pointers[] =
+{
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (book_view, ObjectsAdded),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (book_view, ObjectsChanged),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (book_view, ObjectsRemoved),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (book_view, Progress),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (book_view, Complete),
+	NULL
+};
+
+static const GDBusInterfaceInfo _e_gdbus_book_view_interface_info =
+{
+	-1,
+	(gchar *) GDBUS_BOOK_VIEW_INTERFACE_NAME,
+	(GDBusMethodInfo **) &e_gdbus_book_view_method_info_pointers,
+	(GDBusSignalInfo **) &e_gdbus_book_view_signal_info_pointers,
+	(GDBusPropertyInfo **) NULL
+};
+
+static void
+handle_method_call (GDBusConnection       *connection,
+                    const gchar           *sender,
+                    const gchar           *object_path,
+                    const gchar           *interface_name,
+                    const gchar           *method_name,
+                    GVariant              *parameters,
+                    GDBusMethodInvocation *invocation,
+                    gpointer               user_data)
+{
+	guint method_id, method_type;
+
+	method_id = lookup_method_id_from_method_name (method_name);
+	method_type = lookup_method_type_from_method_name (method_name);
+
+	g_return_if_fail (method_id != 0);
+	g_return_if_fail (method_type != 0);
+
+	e_gdbus_stub_handle_method_call (user_data, invocation, parameters, method_name, signals[method_id], method_type);
+}
+
+static GVariant *
+get_property (GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GError **error, gpointer user_data)
+{
+	g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "This implementation does not support property `%s'", property_name);
+	return NULL;
+}
+
+static gboolean
+set_property (GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GVariant *value, GError **error, gpointer user_data)
+{
+	g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "This implementation does not support property `%s'", property_name);
+	return FALSE;
+}
+
+static const GDBusInterfaceVTable e_gdbus_book_view_interface_vtable =
+{
+  handle_method_call,
+  get_property,
+  set_property
+};
+
+static gboolean
+emit_notifications_in_idle (gpointer user_data)
+{
+	GObject *object = G_OBJECT (user_data);
+	GDBusConnection *connection;
+	const gchar *path;
+	GHashTable *notification_queue;
+	GHashTableIter iter;
+	const gchar *property_name;
+	GVariant *value;
+	GVariantBuilder *builder;
+	GVariantBuilder *invalidated_builder;
+	GHashTable *pvc;
+	gboolean has_changes;
+
+	notification_queue = g_object_get_data (object, "gdbus-codegen-notification-queue");
+	path = g_object_get_data (object, "gdbus-codegen-path");
+	connection = g_object_get_data (object, "gdbus-codegen-connection");
+	pvc = g_object_get_data (object, "gdbus-codegen-pvc");
+	g_assert (notification_queue != NULL && path != NULL && connection != NULL && pvc != NULL);
+
+	builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
+	invalidated_builder = g_variant_builder_new (G_VARIANT_TYPE ("as"));
+	g_hash_table_iter_init (&iter, notification_queue);
+	has_changes = FALSE;
+	while (g_hash_table_iter_next (&iter, (gpointer) &property_name, (gpointer) &value)) {
+		GVariant *cached_value;
+		cached_value = g_hash_table_lookup (pvc, property_name);
+		if (cached_value == NULL || !g_variant_equal (cached_value, value)) {
+			g_hash_table_insert (pvc, (gpointer) property_name, (gpointer) g_variant_ref (value));
+			g_variant_builder_add (builder, "{sv}", property_name, value);
+			has_changes = TRUE;
+		}
+	}
+
+	if (has_changes) {
+		g_dbus_connection_emit_signal (connection,
+					NULL,
+					path,
+					"org.freedesktop.DBus.Properties",
+					"PropertiesChanged",
+					g_variant_new ("(sa{sv}as)",
+							GDBUS_BOOK_VIEW_INTERFACE_NAME,
+							builder,
+							invalidated_builder),
+					NULL);
+	} else {
+		g_variant_builder_unref (builder);
+		g_variant_builder_unref (invalidated_builder);
+	}
+
+	g_hash_table_remove_all (notification_queue);
+	g_object_set_data (object, "gdbus-codegen-notification-idle-id", GUINT_TO_POINTER (0));
+	return FALSE;
+}
+
+/**
+ * e_gdbus_book_view_drain_notify:
+ * @object: A #EGdbusBookView that is exported.
+ *
+ * If @object has queued notifications, empty the queue forcing
+ * the <literal>PropertiesChanged</literal> signal to be emitted.
+ * See <xref linkend="EGdbusBookView.description"/> for more background information.
+ */
+void
+e_gdbus_book_view_drain_notify (EGdbusBookView *object)
+{
+	gint idle_id;
+	idle_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (object), "gdbus-codegen-notification-idle-id"));
+	if (idle_id > 0) {
+		emit_notifications_in_idle (object);
+		g_source_remove (idle_id);
+	}
+}
+
+static void
+on_object_unregistered (GObject *object)
+{
+	gint idle_id;
+	idle_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (object), "gdbus-codegen-notification-idle-id"));
+	if (idle_id > 0) {
+		g_source_remove (idle_id);
+	}
+	g_object_set_data (G_OBJECT (object), "gdbus-codegen-path", NULL);
+	g_object_set_data (G_OBJECT (object), "gdbus-codegen-connection", NULL);
+}
+
+/**
+ * e_gdbus_book_view_register_object:
+ * @object: An instance of a #GObject<!-- -->-derived type implementing the #EGdbusBookView interface.
+ * @connection: A #GDBusConnection.
+ * @object_path: The object to register the object at.
+ * @error: Return location for error or %NULL.
+ *
+ * Registers @object at @object_path on @connection.
+ *
+ * See <xref linkend="EGdbusBookView.description"/>
+ * for how properties, methods and signals are handled.
+ *
+ * Returns: 0 if @error is set, otherwise a registration id (never 0) that can be used with g_dbus_connection_unregister_object().
+ */
+guint
+e_gdbus_book_view_register_object (EGdbusBookView *object, GDBusConnection *connection, const gchar *object_path, GError **error)
+{
+	GHashTable *pvc;
+
+	pvc = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify) g_variant_unref);
+
+	g_object_set_data_full (G_OBJECT (object), "gdbus-codegen-path", (gpointer) g_strdup (object_path), g_free);
+	g_object_set_data (G_OBJECT (object), "gdbus-codegen-connection", (gpointer) connection);
+	g_object_set_data_full (G_OBJECT (object), "gdbus-codegen-pvc", (gpointer) pvc, (GDestroyNotify) g_hash_table_unref);
+	return g_dbus_connection_register_object (connection,
+			object_path,
+			(GDBusInterfaceInfo *) &_e_gdbus_book_view_interface_info,
+			&e_gdbus_book_view_interface_vtable,
+			object,
+			(GDestroyNotify) on_object_unregistered,
+			error);
+}
+
+/**
+ * e_gdbus_book_view_interface_info:
+ *
+ * Gets interface description for the <literal>org.gnome.evolution.dataserver.AddressBookView</literal> D-Bus interface.
+ *
+ * Returns: A #GDBusInterfaceInfo. Do not free, the object is statically allocated.
+ */
+const GDBusInterfaceInfo *
+e_gdbus_book_view_interface_info (void)
+{
+	return &_e_gdbus_book_view_interface_info;
+}
+
+/* ---------------------------------------------------------------------- */
+
+static void proxy_iface_init (EGdbusBookViewIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (EGdbusBookViewProxy, e_gdbus_book_view_proxy, G_TYPE_DBUS_PROXY,
+                         G_IMPLEMENT_INTERFACE (E_TYPE_GDBUS_BOOK_VIEW, proxy_iface_init));
+
+static void
+e_gdbus_book_view_proxy_init (EGdbusBookViewProxy *proxy)
+{
+	g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), (GDBusInterfaceInfo *) &_e_gdbus_book_view_interface_info);
+}
+
+static void
+g_signal (GDBusProxy *proxy, const gchar *sender_name, const gchar *signal_name, GVariant *parameters)
+{
+	guint signal_id, signal_type;
+
+	signal_id = lookup_signal_id_from_signal_name (signal_name);
+	signal_type = lookup_signal_type_from_signal_name (signal_name);
+
+	g_return_if_fail (signal_id != 0);
+	g_return_if_fail (signal_type != 0);
+
+	e_gdbus_proxy_emit_signal (proxy, parameters, signals[signal_id], signal_type);
+}
+
+static void
+e_gdbus_book_view_proxy_class_init (EGdbusBookViewProxyClass *klass)
+{
+	GDBusProxyClass *proxy_class;
+
+	proxy_class = G_DBUS_PROXY_CLASS (klass);
+	proxy_class->g_signal = g_signal;
+}
+
+static void
+proxy_iface_init (EGdbusBookViewIface *iface)
+{
+}
+
+/**
+ * e_gdbus_book_view_proxy_new:
+ * @connection: A #GDBusConnection.
+ * @flags: Flags used when constructing the proxy.
+ * @name: A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
+ * @object_path: An object path.
+ * @cancellable: A #GCancellable or %NULL.
+ * @callback: Callback function to invoke when the proxy is ready.
+ * @user_data: User data to pass to @callback.
+ *
+ * Like g_dbus_proxy_new() but returns a #EGdbusBookViewProxy.
+ *
+ * This is a failable asynchronous constructor - when the proxy is ready, callback will be invoked and you can use e_gdbus_book_view_proxy_new_finish() to get the result.
+ */
+void
+e_gdbus_book_view_proxy_new (GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	g_async_initable_new_async (E_TYPE_GDBUS_BOOK_VIEW_PROXY,
+				G_PRIORITY_DEFAULT,
+				cancellable,
+				callback,
+				user_data,
+				"g-flags", flags,
+				"g-name", name,
+				"g-connection", connection,
+				"g-object-path", object_path,
+				"g-interface-name", GDBUS_BOOK_VIEW_INTERFACE_NAME,
+				NULL);
+}
+
+/**
+ * e_gdbus_book_view_proxy_new_finish:
+ * @result: A #GAsyncResult obtained from the #GAsyncReadyCallback function passed to e_gdbus_book_view_proxy_new().
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes creating a #EGdbusBookViewProxy.
+ *
+ * Returns: A #EGdbusBookViewProxy or %NULL if @error is set. Free with g_object_unref().
+ */
+EGdbusBookView *
+e_gdbus_book_view_proxy_new_finish (GAsyncResult  *result, GError **error)
+{
+	GObject *object;
+	GObject *source_object;
+	source_object = g_async_result_get_source_object (result);
+	g_assert (source_object != NULL);
+	object = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), result, error);
+	g_object_unref (source_object);
+	if (object != NULL)
+		return E_GDBUS_BOOK_VIEW (object);
+	else
+		return NULL;
+}
+
+/**
+ * e_gdbus_book_view_proxy_new_sync:
+ * @connection: A #GDBusConnection.
+ * @flags: Flags used when constructing the proxy.
+ * @name: A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
+ * @object_path: An object path.
+ * @cancellable: A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Like g_dbus_proxy_new_sync() but returns a #EGdbusBookViewProxy.
+ *
+ * This is a synchronous failable constructor. See e_gdbus_book_view_proxy_new() and e_gdbus_book_view_proxy_new_finish() for the asynchronous version.
+ *
+ * Returns: A #EGdbusBookViewProxy or %NULL if error is set. Free with g_object_unref().
+ */
+EGdbusBookView *
+e_gdbus_book_view_proxy_new_sync (GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error)
+{
+	GInitable *initable;
+	initable = g_initable_new (E_TYPE_GDBUS_BOOK_VIEW_PROXY,
+				cancellable,
+				error,
+				"g-flags", flags,
+				"g-name", name,
+				"g-connection", connection,
+				"g-object-path", object_path,
+				"g-interface-name", GDBUS_BOOK_VIEW_INTERFACE_NAME,
+				NULL);
+	if (initable != NULL)
+		return E_GDBUS_BOOK_VIEW (initable);
+	else
+		return NULL;
+}
+
+/**
+ * e_gdbus_book_view_proxy_new_for_bus:
+ * @bus_type: A #GBusType.
+ * @flags: Flags used when constructing the proxy.
+ * @name: A bus name (well-known or unique).
+ * @object_path: An object path.
+ * @cancellable: A #GCancellable or %NULL.
+ * @callback: Callback function to invoke when the proxy is ready.
+ * @user_data: User data to pass to @callback.
+ *
+ * Like g_dbus_proxy_new_for_bus() but returns a #EGdbusBookViewProxy.
+ *
+ * This is a failable asynchronous constructor - when the proxy is ready, callback will be invoked and you can use e_gdbus_book_view_proxy_new_for_bus_finish() to get the result.
+ */
+void
+e_gdbus_book_view_proxy_new_for_bus (GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	g_async_initable_new_async (E_TYPE_GDBUS_BOOK_VIEW_PROXY,
+				G_PRIORITY_DEFAULT,
+				cancellable,
+				callback,
+				user_data,
+				"g-flags", flags,
+				"g-name", name,
+				"g-bus-type", bus_type,
+				"g-object-path", object_path,
+				"g-interface-name", GDBUS_BOOK_VIEW_INTERFACE_NAME,
+				NULL);
+}
+
+/**
+ * e_gdbus_book_view_proxy_new_for_bus_finish:
+ * @result: A #GAsyncResult obtained from the #GAsyncReadyCallback function passed to e_gdbus_book_view_proxy_new_for_bus().
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes creating a #EGdbusBookViewProxy.
+ *
+ * Returns: A #EGdbusBookViewProxy or %NULL if @error is set. Free with g_object_unref().
+ */
+EGdbusBookView *
+e_gdbus_book_view_proxy_new_for_bus_finish (GAsyncResult *result, GError **error)
+{
+	GObject *object;
+	GObject *source_object;
+	source_object = g_async_result_get_source_object (result);
+	g_assert (source_object != NULL);
+	object = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), result, error);
+	g_object_unref (source_object);
+	if (object != NULL)
+		return E_GDBUS_BOOK_VIEW (object);
+	else
+		return NULL;
+}
+
+/**
+ * e_gdbus_book_view_proxy_new_for_bus_sync:
+ * @bus_type: A #GBusType.
+ * @flags: Flags used when constructing the proxy.
+ * @name: A bus name (well-known or unique).
+ * @object_path: An object path.
+ * @cancellable: A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Like g_dbus_proxy_new_for_bus_sync() but returns a #EGdbusBookViewProxy.
+ *
+ * This is a synchronous failable constructor. See e_gdbus_book_view_proxy_new_for_bus() and e_gdbus_book_view_proxy_new_for_bus_finish() for the asynchronous version.
+ *
+ * Returns: A #EGdbusBookViewProxy or %NULL if error is set. Free with g_object_unref().
+ */
+EGdbusBookView *
+e_gdbus_book_view_proxy_new_for_bus_sync (GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error)
+{
+	GInitable *initable;
+	initable = g_initable_new (E_TYPE_GDBUS_BOOK_VIEW_PROXY,
+				cancellable,
+				error,
+				"g-flags", flags,
+				"g-name", name,
+				"g-bus-type", bus_type,
+				"g-object-path", object_path,
+				"g-interface-name", GDBUS_BOOK_VIEW_INTERFACE_NAME,
+				NULL);
+	if (initable != NULL)
+		return E_GDBUS_BOOK_VIEW (initable);
+	else
+		return NULL;
+}
+
+/* ---------------------------------------------------------------------- */
+
+struct _EGdbusBookViewStubPrivate
+{
+	gint foo;
+};
+
+static void stub_iface_init (EGdbusBookViewIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (EGdbusBookViewStub, e_gdbus_book_view_stub, G_TYPE_OBJECT,
+                         G_IMPLEMENT_INTERFACE (E_TYPE_GDBUS_BOOK_VIEW, stub_iface_init));
+
+static void
+e_gdbus_book_view_stub_init (EGdbusBookViewStub *stub)
+{
+	stub->priv = G_TYPE_INSTANCE_GET_PRIVATE (stub, E_TYPE_GDBUS_BOOK_VIEW_STUB, EGdbusBookViewStubPrivate);
+}
+
+static void
+e_gdbus_book_view_stub_class_init (EGdbusBookViewStubClass *klass)
+{
+	g_type_class_add_private (klass, sizeof (EGdbusBookViewStubPrivate));
+}
+
+static void
+stub_iface_init (EGdbusBookViewIface *iface)
+{
+}
+
+/**
+ * e_gdbus_book_view_stub_new:
+ *
+ * Creates a new stub object that can be exported via e_gdbus_book_view_register_object().
+ *
+ * Returns: A #EGdbusBookViewStub instance. Free with g_object_unref().
+ */
+EGdbusBookView *
+e_gdbus_book_view_stub_new (void)
+{
+	return E_GDBUS_BOOK_VIEW (g_object_new (E_TYPE_GDBUS_BOOK_VIEW_STUB, NULL));
+}
diff --git a/addressbook/libegdbus/e-gdbus-book-view.h b/addressbook/libegdbus/e-gdbus-book-view.h
new file mode 100644
index 0000000..ab2cf3c
--- /dev/null
+++ b/addressbook/libegdbus/e-gdbus-book-view.h
@@ -0,0 +1,148 @@
+/*
+ * e-gdbus-book-view.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#ifndef E_GDBUS_BOOK_VIEW_H
+#define E_GDBUS_BOOK_VIEW_H
+
+#include <gio/gio.h>
+
+#include <libedataserver/e-gdbus-templates.h>
+
+G_BEGIN_DECLS
+
+#define E_TYPE_GDBUS_BOOK_VIEW         (e_gdbus_book_view_get_type ())
+#define E_GDBUS_BOOK_VIEW(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_GDBUS_BOOK_VIEW, EGdbusBookView))
+#define E_IS_GDBUS_BOOK_VIEW(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_GDBUS_BOOK_VIEW))
+#define E_GDBUS_BOOK_VIEW_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE((o), E_TYPE_GDBUS_BOOK_VIEW, EGdbusBookViewIface))
+
+/**
+ * EGdbusBookView:
+ *
+ * Opaque type representing a proxy or an exported object.
+ */
+typedef struct _EGdbusBookView EGdbusBookView; /* Dummy typedef */
+typedef struct _EGdbusBookViewIface EGdbusBookViewIface;
+
+GType e_gdbus_book_view_get_type (void) G_GNUC_CONST;
+
+/* ---------------------------------------------------------------------- */
+
+typedef struct _EGdbusBookViewProxy EGdbusBookViewProxy;
+typedef struct _EGdbusBookViewProxyClass EGdbusBookViewProxyClass;
+typedef struct _EGdbusBookViewProxyPrivate EGdbusBookViewProxyPrivate;
+
+struct _EGdbusBookViewProxy
+{
+	GDBusProxy parent_instance;
+	EGdbusBookViewProxyPrivate *priv;
+};
+
+struct _EGdbusBookViewProxyClass
+{
+	GDBusProxyClass parent_class;
+};
+
+#define E_TYPE_GDBUS_BOOK_VIEW_PROXY (e_gdbus_book_view_proxy_get_type ())
+GType e_gdbus_book_view_proxy_get_type (void) G_GNUC_CONST;
+
+void		e_gdbus_book_view_proxy_new (GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+EGdbusBookView *e_gdbus_book_view_proxy_new_finish (GAsyncResult  *result, GError **error);
+EGdbusBookView *e_gdbus_book_view_proxy_new_sync (GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_book_view_proxy_new_for_bus (GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+EGdbusBookView *e_gdbus_book_view_proxy_new_for_bus_finish (GAsyncResult  *result, GError **error);
+EGdbusBookView *e_gdbus_book_view_proxy_new_for_bus_sync (GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error);
+
+/* ---------------------------------------------------------------------- */
+
+typedef struct _EGdbusBookViewStub EGdbusBookViewStub;
+typedef struct _EGdbusBookViewStubClass EGdbusBookViewStubClass;
+typedef struct _EGdbusBookViewStubPrivate EGdbusBookViewStubPrivate;
+
+struct _EGdbusBookViewStub
+{
+	GObject parent_instance;
+	EGdbusBookViewStubPrivate *priv;
+};
+
+struct _EGdbusBookViewStubClass
+{
+	GObjectClass parent_class;
+};
+
+#define E_TYPE_GDBUS_BOOK_VIEW_STUB (e_gdbus_book_view_stub_get_type ())
+GType e_gdbus_book_view_stub_get_type (void) G_GNUC_CONST;
+
+EGdbusBookView *e_gdbus_book_view_stub_new (void);
+
+guint e_gdbus_book_view_register_object (EGdbusBookView *object, GDBusConnection *connection, const gchar *object_path, GError **error);
+
+void e_gdbus_book_view_drain_notify (EGdbusBookView *object);
+
+const GDBusInterfaceInfo *e_gdbus_book_view_interface_info (void) G_GNUC_CONST;
+
+struct _EGdbusBookViewIface
+{
+	GTypeInterface parent_iface;
+
+	/* Signal handlers for receiving D-Bus signals: */
+	void (*objects_added)		(EGdbusBookView *object, const gchar * const *arg_objects);
+	void (*objects_changed)		(EGdbusBookView *object, const gchar * const *arg_objects);
+	void (*objects_removed)		(EGdbusBookView *object, const gchar * const *arg_uids);
+  
+	void (*progress)		(EGdbusBookView *object, guint arg_percent, const gchar *arg_message);
+	void (*complete)		(EGdbusBookView *object, guint arg_status, const gchar *arg_message);
+
+	/* Signal handlers for handling D-Bus method calls: */
+	gboolean (*handle_start)	(EGdbusBookView *object, GDBusMethodInvocation *invocation);
+	gboolean (*handle_stop)		(EGdbusBookView *object, GDBusMethodInvocation *invocation);
+	gboolean (*handle_dispose)	(EGdbusBookView *object, GDBusMethodInvocation *invocation);
+};
+
+/* D-Bus Methods */
+void		e_gdbus_book_view_call_start		(GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_book_view_call_start_finish	(GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean	e_gdbus_book_view_call_start_sync	(GDBusProxy *proxy, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_book_view_call_stop		(GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_book_view_call_stop_finish	(GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean	e_gdbus_book_view_call_stop_sync	(GDBusProxy *proxy, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_book_view_call_dispose		(GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_book_view_call_dispose_finish	(GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean	e_gdbus_book_view_call_dispose_sync	(GDBusProxy *proxy, GCancellable *cancellable, GError **error);
+
+/* D-Bus Methods Completion Helpers */
+#define e_gdbus_book_view_complete_start	e_gdbus_complete_sync_method_void
+#define e_gdbus_book_view_complete_stop		e_gdbus_complete_sync_method_void
+#define e_gdbus_book_view_complete_dispose	e_gdbus_complete_sync_method_void
+
+/* D-Bus Signal Emission Helpers */
+void	e_gdbus_book_view_emit_objects_added	(EGdbusBookView *object, const gchar * const *arg_objects);
+void	e_gdbus_book_view_emit_objects_changed	(EGdbusBookView *object, const gchar * const *arg_objects);
+void	e_gdbus_book_view_emit_objects_removed	(EGdbusBookView *object, const gchar * const *arg_uids);
+
+void	e_gdbus_book_view_emit_progress		(EGdbusBookView *object, guint arg_percent, const gchar *arg_message);
+void	e_gdbus_book_view_emit_complete		(EGdbusBookView *object, guint arg_status, const gchar *arg_message);
+
+G_END_DECLS
+
+#endif /* E_GDBUS_BOOK_VIEW_H */
diff --git a/addressbook/libegdbus/e-gdbus-book.c b/addressbook/libegdbus/e-gdbus-book.c
new file mode 100644
index 0000000..c2b3357
--- /dev/null
+++ b/addressbook/libegdbus/e-gdbus-book.c
@@ -0,0 +1,1120 @@
+/*
+ * e-gdbus-book.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#include <stdio.h>
+#include <gio/gio.h>
+
+#include <libedataserver/e-data-server-util.h>
+#include <libedataserver/e-gdbus-marshallers.h>
+
+#include "e-gdbus-book.h"
+
+#define GDBUS_BOOK_INTERFACE_NAME "org.gnome.evolution.dataserver.AddressBook"
+
+typedef EGdbusBookIface EGdbusBookInterface;
+G_DEFINE_INTERFACE (EGdbusBook, e_gdbus_book, G_TYPE_OBJECT);
+
+enum
+{
+	_0_SIGNAL,
+	__BACKEND_ERROR_SIGNAL,
+	__READONLY_SIGNAL,
+	__ONLINE_SIGNAL,
+	__AUTH_REQUIRED_SIGNAL,
+	__OPEN_METHOD,
+	__OPEN_DONE_SIGNAL,
+	__AUTHENTICATE_USER_METHOD,
+	__AUTHENTICATE_USER_DONE_SIGNAL,
+	__REMOVE_METHOD,
+	__REMOVE_DONE_SIGNAL,
+	__GET_CONTACT_METHOD,
+	__GET_CONTACT_DONE_SIGNAL,
+	__GET_CONTACT_LIST_METHOD,
+	__GET_CONTACT_LIST_DONE_SIGNAL,
+	__ADD_CONTACT_METHOD,
+	__ADD_CONTACT_DONE_SIGNAL,
+	__REMOVE_CONTACTS_METHOD,
+	__REMOVE_CONTACTS_DONE_SIGNAL,
+	__MODIFY_CONTACT_METHOD,
+	__MODIFY_CONTACT_DONE_SIGNAL,
+	__GET_CAPABILITIES_METHOD,
+	__GET_CAPABILITIES_DONE_SIGNAL,
+	__GET_REQUIRED_FIELDS_METHOD,
+	__GET_REQUIRED_FIELDS_DONE_SIGNAL,
+	__GET_SUPPORTED_FIELDS_METHOD,
+	__GET_SUPPORTED_FIELDS_DONE_SIGNAL,
+	__GET_SUPPORTED_AUTH_METHODS_METHOD,
+	__GET_SUPPORTED_AUTH_METHODS_DONE_SIGNAL,
+	__GET_VIEW_METHOD,
+	__GET_VIEW_DONE_SIGNAL,
+	__CANCEL_OPERATION_METHOD,
+	__CANCEL_ALL_METHOD,
+	__CLOSE_METHOD,
+	__LAST_SIGNAL
+};
+
+static guint signals[__LAST_SIGNAL] = {0};
+
+struct _EGdbusBookProxyPrivate
+{
+	GHashTable *pending_ops;
+};
+
+/* ------------------------------------------------------------------------- */
+
+/* Various lookup tables */
+
+static GHashTable *_method_name_to_id = NULL;
+static GHashTable *_method_name_to_type = NULL;
+static GHashTable *_signal_name_to_id = NULL;
+static GHashTable *_signal_name_to_type = NULL;
+
+static guint
+lookup_method_id_from_method_name (const gchar *method_name)
+{
+	return GPOINTER_TO_UINT (g_hash_table_lookup (_method_name_to_id, method_name));
+}
+
+static guint
+lookup_method_type_from_method_name (const gchar *method_name)
+{
+	return GPOINTER_TO_UINT (g_hash_table_lookup (_method_name_to_type, method_name));
+}
+
+static guint
+lookup_signal_id_from_signal_name (const gchar *signal_name)
+{
+	return GPOINTER_TO_UINT (g_hash_table_lookup (_signal_name_to_id, signal_name));
+}
+
+static guint
+lookup_signal_type_from_signal_name (const gchar *signal_name)
+{
+	return GPOINTER_TO_UINT (g_hash_table_lookup (_signal_name_to_type, signal_name));
+}
+
+/* ------------------------------------------------------------------------- */
+
+E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_STRING  (GDBUS_BOOK_INTERFACE_NAME, backend_error)
+E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_BOOLEAN (GDBUS_BOOK_INTERFACE_NAME, readonly)
+E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_BOOLEAN (GDBUS_BOOK_INTERFACE_NAME, online)
+E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_STRV    (GDBUS_BOOK_INTERFACE_NAME, auth_required)
+
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_VOID	(GDBUS_BOOK_INTERFACE_NAME, open)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_VOID	(GDBUS_BOOK_INTERFACE_NAME, authenticate_user)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_VOID	(GDBUS_BOOK_INTERFACE_NAME, remove)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRING	(GDBUS_BOOK_INTERFACE_NAME, get_contact)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRV	(GDBUS_BOOK_INTERFACE_NAME, get_contact_list)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRING	(GDBUS_BOOK_INTERFACE_NAME, add_contact)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_VOID	(GDBUS_BOOK_INTERFACE_NAME, remove_contacts)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_VOID	(GDBUS_BOOK_INTERFACE_NAME, modify_contact)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRING	(GDBUS_BOOK_INTERFACE_NAME, get_capabilities)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRV	(GDBUS_BOOK_INTERFACE_NAME, get_required_fields)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRV	(GDBUS_BOOK_INTERFACE_NAME, get_supported_fields)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRV	(GDBUS_BOOK_INTERFACE_NAME, get_supported_auth_methods)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRING	(GDBUS_BOOK_INTERFACE_NAME, get_view)
+
+static void
+e_gdbus_book_default_init (EGdbusBookIface *iface)
+{
+	/* Build lookup structures */
+	_method_name_to_id = g_hash_table_new (g_str_hash, g_str_equal);
+	_method_name_to_type = g_hash_table_new (g_str_hash, g_str_equal);
+	_signal_name_to_id = g_hash_table_new (g_str_hash, g_str_equal);
+	_signal_name_to_type = g_hash_table_new (g_str_hash, g_str_equal);
+
+	/* GObject signals definitions for D-Bus signals: */
+	E_INIT_GDBUS_SIGNAL_STRING		(EGdbusBookIface, "backend_error",	backend_error,	__BACKEND_ERROR_SIGNAL)
+	E_INIT_GDBUS_SIGNAL_BOOLEAN		(EGdbusBookIface, "readonly",		readonly,	__READONLY_SIGNAL)
+	E_INIT_GDBUS_SIGNAL_BOOLEAN		(EGdbusBookIface, "online",		online,		__ONLINE_SIGNAL)
+	E_INIT_GDBUS_SIGNAL_STRV   		(EGdbusBookIface, "auth_required", 	auth_required,	__AUTH_REQUIRED_SIGNAL)
+
+	/* GObject signals definitions for D-Bus methods: */
+	E_INIT_GDBUS_METHOD_ASYNC_BOOLEAN__VOID	(EGdbusBookIface, "open",			open, __OPEN_METHOD, __OPEN_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_STRV__VOID	(EGdbusBookIface, "authenticateUser",		authenticate_user, __AUTHENTICATE_USER_METHOD, __AUTHENTICATE_USER_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_VOID__VOID	(EGdbusBookIface, "remove",			remove, __REMOVE_METHOD, __REMOVE_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_STRING__STRING(EGdbusBookIface, "getContact",			get_contact, __GET_CONTACT_METHOD, __GET_CONTACT_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_STRING__STRV	(EGdbusBookIface, "getContactList",		get_contact_list, __GET_CONTACT_LIST_METHOD, __GET_CONTACT_LIST_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_STRING__STRING(EGdbusBookIface, "addContact",			add_contact, __ADD_CONTACT_METHOD, __ADD_CONTACT_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_STRV__VOID	(EGdbusBookIface, "removeContacts",		remove_contacts, __REMOVE_CONTACTS_METHOD, __REMOVE_CONTACTS_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_STRING__VOID	(EGdbusBookIface, "modifyContact",		modify_contact, __MODIFY_CONTACT_METHOD, __MODIFY_CONTACT_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_VOID__STRING	(EGdbusBookIface, "getCapabilities",		get_capabilities, __GET_CAPABILITIES_METHOD, __GET_CAPABILITIES_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_VOID__STRV	(EGdbusBookIface, "getRequiredFields",		get_required_fields, __GET_REQUIRED_FIELDS_METHOD, __GET_REQUIRED_FIELDS_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_VOID__STRV	(EGdbusBookIface, "getSupportedFields",		get_supported_fields, __GET_SUPPORTED_FIELDS_METHOD, __GET_SUPPORTED_FIELDS_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_VOID__STRV	(EGdbusBookIface, "getSupportedAuthMethods",	get_supported_auth_methods, __GET_SUPPORTED_AUTH_METHODS_METHOD, __GET_SUPPORTED_AUTH_METHODS_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_STRING__STRING(EGdbusBookIface, "getView",			get_view, __GET_VIEW_METHOD, __GET_VIEW_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_UINT		(EGdbusBookIface, "cancelOperation",		cancel_operation, __CANCEL_OPERATION_METHOD)
+	E_INIT_GDBUS_METHOD_VOID		(EGdbusBookIface, "cancelAll",			cancel_all, __CANCEL_ALL_METHOD)
+	E_INIT_GDBUS_METHOD_VOID		(EGdbusBookIface, "close",			close, __CLOSE_METHOD)
+}
+
+void
+e_gdbus_book_call_open (GDBusProxy *proxy, gboolean in_only_if_exists, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_boolean ("open", e_gdbus_book_call_open, E_GDBUS_ASYNC_OP_KEEPER (proxy), in_only_if_exists, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_book_call_open_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return e_gdbus_proxy_finish_call_void (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, error, e_gdbus_book_call_open);
+}
+
+gboolean
+e_gdbus_book_call_open_sync (GDBusProxy *proxy, gboolean in_only_if_exists, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_boolean__void (proxy, in_only_if_exists, cancellable, error,
+		e_gdbus_book_call_open,
+		e_gdbus_book_call_open_finish);
+}
+
+void
+e_gdbus_book_call_authenticate_user (GDBusProxy *proxy, const gchar * const *in_credentials, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_strv ("authenticateUser", e_gdbus_book_call_authenticate_user, E_GDBUS_ASYNC_OP_KEEPER (proxy), in_credentials, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_book_call_authenticate_user_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return e_gdbus_proxy_finish_call_void (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, error, e_gdbus_book_call_authenticate_user);
+}
+
+gboolean
+e_gdbus_book_call_authenticate_user_sync (GDBusProxy *proxy, const gchar * const *in_credentials, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_strv__void (proxy, in_credentials, cancellable, error,
+		e_gdbus_book_call_authenticate_user,
+		e_gdbus_book_call_authenticate_user_finish);
+}
+
+void
+e_gdbus_book_call_remove (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_void ("remove", e_gdbus_book_call_remove, E_GDBUS_ASYNC_OP_KEEPER (proxy), cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_book_call_remove_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return e_gdbus_proxy_finish_call_void (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, error, e_gdbus_book_call_remove);
+}
+
+gboolean
+e_gdbus_book_call_remove_sync (GDBusProxy *proxy, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_void__void (proxy, cancellable, error,
+		e_gdbus_book_call_remove,
+		e_gdbus_book_call_remove_finish);
+}
+
+void
+e_gdbus_book_call_get_contact (GDBusProxy *proxy, const gchar *in_uid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_string ("getContact", e_gdbus_book_call_get_contact, E_GDBUS_ASYNC_OP_KEEPER (proxy), in_uid, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_book_call_get_contact_finish (GDBusProxy *proxy, GAsyncResult *result, gchar **out_vcard, GError **error)
+{
+	return e_gdbus_proxy_finish_call_string (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, out_vcard, error, e_gdbus_book_call_get_contact);
+}
+
+gboolean
+e_gdbus_book_call_get_contact_sync (GDBusProxy *proxy, const gchar *in_uid, gchar **out_vcard, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_string__string (proxy, in_uid, out_vcard, cancellable, error,
+		e_gdbus_book_call_get_contact,
+		e_gdbus_book_call_get_contact_finish);
+}
+
+void
+e_gdbus_book_call_get_contact_list (GDBusProxy *proxy, const gchar *in_query, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_string ("getContactList", e_gdbus_book_call_get_contact_list, E_GDBUS_ASYNC_OP_KEEPER (proxy), in_query, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_book_call_get_contact_list_finish (GDBusProxy *proxy, GAsyncResult *result, gchar ***out_vcards, GError **error)
+{
+	return e_gdbus_proxy_finish_call_strv (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, out_vcards, error, e_gdbus_book_call_get_contact_list);
+}
+
+gboolean
+e_gdbus_book_call_get_contact_list_sync (GDBusProxy *proxy, const gchar *in_query, gchar ***out_vcards, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_string__strv (proxy, in_query, out_vcards, cancellable, error,
+		e_gdbus_book_call_get_contact_list,
+		e_gdbus_book_call_get_contact_list_finish);
+}
+
+void
+e_gdbus_book_call_add_contact (GDBusProxy *proxy, const gchar *in_vcard, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_string ("addContact", e_gdbus_book_call_add_contact, E_GDBUS_ASYNC_OP_KEEPER (proxy), in_vcard, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_book_call_add_contact_finish (GDBusProxy *proxy, GAsyncResult *result, gchar **out_uid, GError **error)
+{
+	return e_gdbus_proxy_finish_call_string (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, out_uid, error, e_gdbus_book_call_add_contact);
+}
+
+gboolean
+e_gdbus_book_call_add_contact_sync (GDBusProxy *proxy, const gchar *in_vcard, gchar **out_uid, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_string__string (proxy, in_vcard, out_uid, cancellable, error,
+		e_gdbus_book_call_add_contact,
+		e_gdbus_book_call_add_contact_finish);
+}
+
+void
+e_gdbus_book_call_remove_contacts (GDBusProxy *proxy, const gchar * const *in_list, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_strv ("removeContacts", e_gdbus_book_call_remove_contacts, E_GDBUS_ASYNC_OP_KEEPER (proxy), in_list, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_book_call_remove_contacts_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return e_gdbus_proxy_finish_call_void (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, error, e_gdbus_book_call_remove_contacts);
+}
+
+gboolean
+e_gdbus_book_call_remove_contacts_sync (GDBusProxy *proxy, const gchar * const *in_list, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_strv__void (proxy, in_list, cancellable, error,
+		e_gdbus_book_call_remove_contacts,
+		e_gdbus_book_call_remove_contacts_finish);
+}
+
+void
+e_gdbus_book_call_modify_contact (GDBusProxy *proxy, const gchar *in_vcard, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_string ("modifyContact", e_gdbus_book_call_modify_contact, E_GDBUS_ASYNC_OP_KEEPER (proxy), in_vcard, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_book_call_modify_contact_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return e_gdbus_proxy_finish_call_void (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, error, e_gdbus_book_call_modify_contact);
+}
+
+gboolean
+e_gdbus_book_call_modify_contact_sync (GDBusProxy *proxy, const gchar *in_vcard, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_string__void (proxy, in_vcard, cancellable, error,
+		e_gdbus_book_call_modify_contact,
+		e_gdbus_book_call_modify_contact_finish);
+}
+
+void
+e_gdbus_book_call_get_capabilities (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_void ("getCapabilities", e_gdbus_book_call_get_capabilities, E_GDBUS_ASYNC_OP_KEEPER (proxy), cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_book_call_get_capabilities_finish (GDBusProxy *proxy, GAsyncResult *result, gchar **out_capabilities, GError **error)
+{
+	return e_gdbus_proxy_finish_call_string (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, out_capabilities, error, e_gdbus_book_call_get_capabilities);
+}
+
+gboolean
+e_gdbus_book_call_get_capabilities_sync (GDBusProxy *proxy, gchar **out_capabilities, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_void__string (proxy, out_capabilities, cancellable, error,
+		e_gdbus_book_call_get_capabilities,
+		e_gdbus_book_call_get_capabilities_finish);
+}
+
+void
+e_gdbus_book_call_get_required_fields (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_void ("getRequiredFields", e_gdbus_book_call_get_required_fields, E_GDBUS_ASYNC_OP_KEEPER (proxy), cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_book_call_get_required_fields_finish (GDBusProxy *proxy, GAsyncResult *result, gchar ***out_fields, GError **error)
+{
+	return e_gdbus_proxy_finish_call_strv (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, out_fields, error, e_gdbus_book_call_get_required_fields);
+}
+
+gboolean
+e_gdbus_book_call_get_required_fields_sync (GDBusProxy *proxy, gchar ***out_fields, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_void__strv (proxy, out_fields, cancellable, error,
+		e_gdbus_book_call_get_required_fields,
+		e_gdbus_book_call_get_required_fields_finish);
+}
+
+void
+e_gdbus_book_call_get_supported_fields (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_void ("getSupportedFields", e_gdbus_book_call_get_supported_fields, E_GDBUS_ASYNC_OP_KEEPER (proxy), cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_book_call_get_supported_fields_finish (GDBusProxy *proxy, GAsyncResult *result, gchar ***out_fields, GError **error)
+{
+	return e_gdbus_proxy_finish_call_strv (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, out_fields, error, e_gdbus_book_call_get_supported_fields);
+}
+
+gboolean
+e_gdbus_book_call_get_supported_fields_sync (GDBusProxy *proxy, gchar ***out_fields, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_void__strv (proxy, out_fields, cancellable, error,
+		e_gdbus_book_call_get_supported_fields,
+		e_gdbus_book_call_get_supported_fields_finish);
+}
+
+void
+e_gdbus_book_call_get_supported_auth_methods (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_void ("getSupportedAuthMethods", e_gdbus_book_call_get_supported_auth_methods, E_GDBUS_ASYNC_OP_KEEPER (proxy), cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_book_call_get_supported_auth_methods_finish (GDBusProxy *proxy, GAsyncResult *result, gchar ***out_auth_methods, GError **error)
+{
+	return e_gdbus_proxy_finish_call_strv (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, out_auth_methods, error, e_gdbus_book_call_get_supported_auth_methods);
+}
+
+gboolean
+e_gdbus_book_call_get_supported_auth_methods_sync (GDBusProxy *proxy, gchar ***out_auth_methods, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_void__strv (proxy, out_auth_methods, cancellable, error,
+		e_gdbus_book_call_get_supported_auth_methods,
+		e_gdbus_book_call_get_supported_auth_methods_finish);
+}
+
+void
+e_gdbus_book_call_get_view (GDBusProxy *proxy, const gchar *in_query, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_string ("getView", e_gdbus_book_call_get_view, E_GDBUS_ASYNC_OP_KEEPER (proxy), in_query, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_book_call_get_view_finish (GDBusProxy *proxy, GAsyncResult *result, gchar **out_view_path, GError **error)
+{
+	return e_gdbus_proxy_finish_call_string (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, out_view_path, error, e_gdbus_book_call_get_view);
+}
+
+gboolean
+e_gdbus_book_call_get_view_sync (GDBusProxy *proxy, const gchar *in_query, gchar **out_view_path, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_string__string (proxy, in_query, out_view_path, cancellable, error,
+		e_gdbus_book_call_get_view,
+		e_gdbus_book_call_get_view_finish);
+}
+
+void
+e_gdbus_book_call_cancel_operation (GDBusProxy *proxy, guint in_opid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_method_call_uint ("cancelOperation", proxy, in_opid, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_book_call_cancel_operation_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return e_gdbus_proxy_method_call_finish_void (proxy, result, error);
+}
+
+gboolean
+e_gdbus_book_call_cancel_operation_sync (GDBusProxy *proxy, guint in_opid, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_method_call_sync_uint__void ("cancelOperation", proxy, in_opid, cancellable, error);
+}
+
+void
+e_gdbus_book_call_cancel_all (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_method_call_void ("cancelAll", proxy, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_book_call_cancel_all_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return e_gdbus_proxy_method_call_finish_void (proxy, result, error);
+}
+
+gboolean
+e_gdbus_book_call_cancel_all_sync (GDBusProxy *proxy, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_method_call_sync_void__void ("cancelAll", proxy, cancellable, error);
+}
+
+void
+e_gdbus_book_call_close (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_method_call_void ("close", proxy, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_book_call_close_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return e_gdbus_proxy_method_call_finish_void (proxy, result, error);
+}
+
+gboolean
+e_gdbus_book_call_close_sync (GDBusProxy *proxy, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_method_call_sync_void__void ("close", proxy, cancellable, error);
+}
+
+#define DECLARE_EMIT_DONE_SIGNAL_0(_mname, _sig_id)									\
+void															\
+e_gdbus_book_emit_ ## _mname ## _done (EGdbusBook *object, guint arg_opid, const GError *arg_error)			\
+{															\
+	g_signal_emit (object, signals[_sig_id], 0, arg_opid, arg_error);						\
+}
+
+#define DECLARE_EMIT_DONE_SIGNAL_1(_mname, _sig_id, _par_type)								\
+void															\
+e_gdbus_book_emit_ ## _mname ## _done (EGdbusBook *object, guint arg_opid, const GError *arg_error, _par_type out_par)	\
+{															\
+	g_signal_emit (object, signals[_sig_id], 0, arg_opid, arg_error, out_par);					\
+}
+
+DECLARE_EMIT_DONE_SIGNAL_0 (open,			__OPEN_DONE_SIGNAL)
+DECLARE_EMIT_DONE_SIGNAL_0 (authenticate_user,		__AUTHENTICATE_USER_DONE_SIGNAL)
+DECLARE_EMIT_DONE_SIGNAL_0 (remove,			__REMOVE_DONE_SIGNAL)
+DECLARE_EMIT_DONE_SIGNAL_1 (get_contact,		__GET_CONTACT_DONE_SIGNAL, const gchar *)
+DECLARE_EMIT_DONE_SIGNAL_1 (get_contact_list,		__GET_CONTACT_LIST_DONE_SIGNAL, const gchar * const *)
+DECLARE_EMIT_DONE_SIGNAL_1 (add_contact,		__ADD_CONTACT_DONE_SIGNAL, const gchar *)
+DECLARE_EMIT_DONE_SIGNAL_0 (remove_contacts,		__REMOVE_CONTACTS_DONE_SIGNAL)
+DECLARE_EMIT_DONE_SIGNAL_0 (modify_contact,		__MODIFY_CONTACT_DONE_SIGNAL)
+DECLARE_EMIT_DONE_SIGNAL_1 (get_capabilities,		__GET_CAPABILITIES_DONE_SIGNAL, const gchar *)
+DECLARE_EMIT_DONE_SIGNAL_1 (get_required_fields,	__GET_REQUIRED_FIELDS_DONE_SIGNAL, const gchar * const *)
+DECLARE_EMIT_DONE_SIGNAL_1 (get_supported_fields,	__GET_SUPPORTED_FIELDS_DONE_SIGNAL, const gchar * const *)
+DECLARE_EMIT_DONE_SIGNAL_1 (get_supported_auth_methods,	__GET_SUPPORTED_AUTH_METHODS_DONE_SIGNAL, const gchar * const *)
+DECLARE_EMIT_DONE_SIGNAL_1 (get_view,			__GET_VIEW_DONE_SIGNAL, const gchar *)
+
+void
+e_gdbus_book_emit_backend_error (EGdbusBook *object, const gchar *arg_message)
+{
+	g_return_if_fail (object != NULL);
+	g_return_if_fail (arg_message != NULL);
+
+	g_signal_emit (object, signals[__BACKEND_ERROR_SIGNAL], 0, arg_message);
+}
+
+void
+e_gdbus_book_emit_readonly (EGdbusBook *object, gboolean arg_is_readonly)
+{
+	g_signal_emit (object, signals[__READONLY_SIGNAL], 0, arg_is_readonly);
+}
+
+void
+e_gdbus_book_emit_online (EGdbusBook *object, gboolean arg_is_online)
+{
+	g_signal_emit (object, signals[__ONLINE_SIGNAL], 0, arg_is_online);
+}
+
+void
+e_gdbus_book_emit_auth_required (EGdbusBook *object, const gchar * const *arg_credentials)
+{
+	g_signal_emit (object, signals[__AUTH_REQUIRED_SIGNAL], 0, arg_credentials);
+}
+
+E_DECLARE_GDBUS_NOTIFY_SIGNAL_1 (book, backend_error, message, "s")
+E_DECLARE_GDBUS_NOTIFY_SIGNAL_1 (book, readonly, is_readonly, "b")
+E_DECLARE_GDBUS_NOTIFY_SIGNAL_1 (book, online, is_online, "b")
+E_DECLARE_GDBUS_NOTIFY_SIGNAL_1 (book, auth_required, credentials, "as")
+
+E_DECLARE_GDBUS_ASYNC_METHOD_1			(book, open, only_if_exists, "b")
+E_DECLARE_GDBUS_ASYNC_METHOD_1			(book, authenticateUser, credentials, "as")
+E_DECLARE_GDBUS_ASYNC_METHOD_0			(book, remove)
+E_DECLARE_GDBUS_ASYNC_METHOD_1_WITH_RETURN	(book, getContact, uid, "s", vcard, "s")
+E_DECLARE_GDBUS_ASYNC_METHOD_1_WITH_RETURN	(book, getContactList, query, "s", vcards, "as")
+E_DECLARE_GDBUS_ASYNC_METHOD_1_WITH_RETURN	(book, addContact, vcard, "s", uid, "s")
+E_DECLARE_GDBUS_ASYNC_METHOD_1			(book, removeContacts, list, "as")
+E_DECLARE_GDBUS_ASYNC_METHOD_1			(book, modifyContact, vcard, "s")
+E_DECLARE_GDBUS_ASYNC_METHOD_0_WITH_RETURN	(book, getCapabilities, capabilities, "s")
+E_DECLARE_GDBUS_ASYNC_METHOD_0_WITH_RETURN	(book, getRequiredFields, fields, "as")
+E_DECLARE_GDBUS_ASYNC_METHOD_0_WITH_RETURN	(book, getSupportedFields, fields, "as")
+E_DECLARE_GDBUS_ASYNC_METHOD_0_WITH_RETURN	(book, getSupportedAuthMethods, auth_methods, "as")
+E_DECLARE_GDBUS_ASYNC_METHOD_1_WITH_RETURN	(book, getView, query, "s", view, "s")
+
+E_DECLARE_GDBUS_SYNC_METHOD_1			(book, cancelOperation, opid, "u")
+E_DECLARE_GDBUS_SYNC_METHOD_0			(book, cancelAll)
+E_DECLARE_GDBUS_SYNC_METHOD_0			(book, close)
+
+static const GDBusMethodInfo * const e_gdbus_book_method_info_pointers[] =
+{
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (book, open),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (book, authenticateUser),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (book, remove),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (book, getContact),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (book, getContactList),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (book, addContact),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (book, removeContacts),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (book, modifyContact),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (book, getCapabilities),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (book, getRequiredFields),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (book, getSupportedFields),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (book, getSupportedAuthMethods),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (book, getView),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (book, cancelOperation),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (book, cancelAll),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (book, close),
+	NULL
+};
+
+static const GDBusSignalInfo * const e_gdbus_book_signal_info_pointers[] =
+{
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (book, backend_error),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (book, readonly),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (book, online),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (book, auth_required),
+
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (book, open_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (book, authenticateUser_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (book, remove_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (book, getContact_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (book, getContactList_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (book, addContact_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (book, removeContacts_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (book, modifyContact_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (book, getCapabilities_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (book, getRequiredFields_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (book, getSupportedFields_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (book, getSupportedAuthMethods_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (book, getView_done),
+	NULL
+};
+
+static const GDBusInterfaceInfo _e_gdbus_book_interface_info =
+{
+	-1,
+	(gchar *) GDBUS_BOOK_INTERFACE_NAME,
+	(GDBusMethodInfo **) &e_gdbus_book_method_info_pointers,
+	(GDBusSignalInfo **) &e_gdbus_book_signal_info_pointers,
+	(GDBusPropertyInfo **) NULL
+};
+
+static void
+handle_method_call (GDBusConnection       *connection,
+                    const gchar           *sender,
+                    const gchar           *object_path,
+                    const gchar           *interface_name,
+                    const gchar           *method_name,
+                    GVariant              *parameters,
+                    GDBusMethodInvocation *invocation,
+                    gpointer               user_data)
+{
+	guint method_id, method_type;
+
+	method_id = lookup_method_id_from_method_name (method_name);
+	method_type = lookup_method_type_from_method_name (method_name);
+
+	g_return_if_fail (method_id != 0);
+	g_return_if_fail (method_type != 0);
+
+	e_gdbus_stub_handle_method_call (user_data, invocation, parameters, method_name, signals[method_id], method_type);
+}
+
+static GVariant *
+get_property (GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GError **error, gpointer user_data)
+{
+	g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "This implementation does not support property `%s'", property_name);
+	return NULL;
+}
+
+static gboolean
+set_property (GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GVariant *value, GError **error, gpointer user_data)
+{
+	g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "This implementation does not support property `%s'", property_name);
+	return FALSE;
+}
+
+static const GDBusInterfaceVTable e_gdbus_book_interface_vtable =
+{
+	handle_method_call,
+	get_property,
+	set_property
+};
+
+static gboolean
+emit_notifications_in_idle (gpointer user_data)
+{
+	GObject *object = G_OBJECT (user_data);
+	GDBusConnection *connection;
+	const gchar *path;
+	GHashTable *notification_queue;
+	GHashTableIter iter;
+	const gchar *property_name;
+	GVariant *value;
+	GVariantBuilder *builder;
+	GVariantBuilder *invalidated_builder;
+	GHashTable *pvc;
+	gboolean has_changes;
+
+	notification_queue = g_object_get_data (object, "gdbus-codegen-notification-queue");
+	path = g_object_get_data (object, "gdbus-codegen-path");
+	connection = g_object_get_data (object, "gdbus-codegen-connection");
+	pvc = g_object_get_data (object, "gdbus-codegen-pvc");
+	g_assert (notification_queue != NULL && path != NULL && connection != NULL && pvc != NULL);
+
+	builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
+	invalidated_builder = g_variant_builder_new (G_VARIANT_TYPE ("as"));
+	g_hash_table_iter_init (&iter, notification_queue);
+	has_changes = FALSE;
+	while (g_hash_table_iter_next (&iter, (gpointer) &property_name, (gpointer) &value)) {
+		GVariant *cached_value;
+		cached_value = g_hash_table_lookup (pvc, property_name);
+		if (cached_value == NULL || !g_variant_equal (cached_value, value)) {
+			g_hash_table_insert (pvc, (gpointer) property_name, (gpointer) g_variant_ref (value));
+			g_variant_builder_add (builder, "{sv}", property_name, value);
+			has_changes = TRUE;
+		}
+	}
+
+	if (has_changes) {
+		g_dbus_connection_emit_signal (connection, NULL, path, "org.freedesktop.DBus.Properties", "PropertiesChanged",
+			g_variant_new ("(sa{sv}as)", GDBUS_BOOK_INTERFACE_NAME, builder, invalidated_builder),
+			NULL);
+	} else {
+		g_variant_builder_unref (builder);
+		g_variant_builder_unref (invalidated_builder);
+	}
+
+	g_hash_table_remove_all (notification_queue);
+	g_object_set_data (object, "gdbus-codegen-notification-idle-id", GUINT_TO_POINTER (0));
+
+	return FALSE;
+}
+
+/**
+ * e_gdbus_book_drain_notify:
+ * @object: A #EGdbusBook that is exported.
+ *
+ * If @object has queued notifications, empty the queue forcing
+ * the <literal>PropertiesChanged</literal> signal to be emitted.
+ * See <xref linkend="EGdbusBook.description"/> for more background information.
+ */
+void
+e_gdbus_book_drain_notify (EGdbusBook *object)
+{
+	gint idle_id;
+	idle_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (object), "gdbus-codegen-notification-idle-id"));
+	if (idle_id > 0) {
+		emit_notifications_in_idle (object);
+		g_source_remove (idle_id);
+	}
+}
+
+static void
+on_object_unregistered (GObject *object)
+{
+	gint idle_id;
+	idle_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (object), "gdbus-codegen-notification-idle-id"));
+	if (idle_id > 0) {
+		g_source_remove (idle_id);
+	}
+	g_object_set_data (G_OBJECT (object), "gdbus-codegen-path", NULL);
+	g_object_set_data (G_OBJECT (object), "gdbus-codegen-connection", NULL);
+}
+
+/**
+ * e_gdbus_book_register_object:
+ * @object: An instance of a #GObject<!-- -->-derived type implementing the #EGdbusBook interface.
+ * @connection: A #GDBusConnection.
+ * @object_path: The object to register the object at.
+ * @error: Return location for error or %NULL.
+ *
+ * Registers @object at @object_path on @connection.
+ *
+ * See <xref linkend="EGdbusBook.description"/>
+ * for how properties, methods and signals are handled.
+ *
+ * Returns: 0 if @error is set, otherwise a registration id (never 0) that can be used with g_dbus_connection_unregister_object().
+ */
+guint
+e_gdbus_book_register_object (EGdbusBook *object, GDBusConnection *connection, const gchar *object_path, GError **error)
+{
+	GHashTable *pvc;
+
+	pvc = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify) g_variant_unref);
+
+	g_object_set_data_full (G_OBJECT (object), "gdbus-codegen-path", (gpointer) g_strdup (object_path), g_free);
+	g_object_set_data (G_OBJECT (object), "gdbus-codegen-connection", (gpointer) connection);
+	g_object_set_data_full (G_OBJECT (object), "gdbus-codegen-pvc", (gpointer) pvc, (GDestroyNotify) g_hash_table_unref);
+	
+	return g_dbus_connection_register_object (connection, object_path, (GDBusInterfaceInfo *) &_e_gdbus_book_interface_info,
+			&e_gdbus_book_interface_vtable, object, (GDestroyNotify) on_object_unregistered, error);
+}
+
+/**
+ * e_gdbus_book_interface_info:
+ *
+ * Gets interface description for the <literal>org.gnome.evolution.dataserver.AddressBook</literal> D-Bus interface.
+ *
+ * Returns: A #GDBusInterfaceInfo. Do not free, the object is statically allocated.
+ */
+const GDBusInterfaceInfo *
+e_gdbus_book_interface_info (void)
+{
+	return &_e_gdbus_book_interface_info;
+}
+
+/* ---------------------------------------------------------------------- */
+
+static void proxy_iface_init (EGdbusBookIface *iface);
+static void async_op_keeper_iface_init (EGdbusAsyncOpKeeperInterface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (EGdbusBookProxy, e_gdbus_book_proxy, G_TYPE_DBUS_PROXY,
+                         G_IMPLEMENT_INTERFACE (E_TYPE_GDBUS_BOOK, proxy_iface_init)
+			 G_IMPLEMENT_INTERFACE (E_TYPE_GDBUS_ASYNC_OP_KEEPER, async_op_keeper_iface_init));
+
+static void
+e_gdbus_book_proxy_init (EGdbusBookProxy *proxy)
+{
+	g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), (GDBusInterfaceInfo *) &_e_gdbus_book_interface_info);
+
+	proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, E_TYPE_GDBUS_BOOK_PROXY, EGdbusBookProxyPrivate);
+	proxy->priv->pending_ops = e_gdbus_async_op_keeper_create_pending_ops (E_GDBUS_ASYNC_OP_KEEPER (proxy));
+
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_VOID   (open);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_VOID   (authenticate_user);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_VOID   (remove);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRING (get_contact);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRV   (get_contact_list);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRING (add_contact);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_VOID   (remove_contacts);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_VOID   (modify_contact);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRING (get_capabilities);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRV   (get_required_fields);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRV   (get_supported_fields);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRV   (get_supported_auth_methods);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRING (get_view);
+}
+
+static void
+g_signal (GDBusProxy *proxy, const gchar *sender_name, const gchar *signal_name, GVariant *parameters)
+{
+	guint signal_id, signal_type;
+
+	signal_id = lookup_signal_id_from_signal_name (signal_name);
+	signal_type = lookup_signal_type_from_signal_name (signal_name);
+
+	g_return_if_fail (signal_id != 0);
+	g_return_if_fail (signal_type != 0);
+
+	e_gdbus_proxy_emit_signal (proxy, parameters, signals[signal_id], signal_type);
+}
+
+static void
+gdbus_book_proxy_finalize (GObject *object)
+{
+	EGdbusBookProxy *proxy = E_GDBUS_BOOK_PROXY (object);
+
+	g_return_if_fail (proxy != NULL);
+	g_return_if_fail (proxy->priv != NULL);
+
+	if (g_hash_table_size (proxy->priv->pending_ops))
+		g_debug ("%s: Kept %d items in pending_ops", G_STRFUNC, g_hash_table_size (proxy->priv->pending_ops));
+
+	g_hash_table_destroy (proxy->priv->pending_ops);
+
+	G_OBJECT_CLASS (e_gdbus_book_proxy_parent_class)->finalize (object);
+}
+
+static void
+e_gdbus_book_proxy_class_init (EGdbusBookProxyClass *klass)
+{
+	GObjectClass *object_class;
+	GDBusProxyClass *proxy_class;
+
+	g_type_class_add_private (klass, sizeof (EGdbusBookProxyPrivate));
+
+	object_class = G_OBJECT_CLASS (klass);
+	object_class->finalize = gdbus_book_proxy_finalize;
+
+	proxy_class = G_DBUS_PROXY_CLASS (klass);
+	proxy_class->g_signal = g_signal;
+}
+
+static void
+proxy_iface_init (EGdbusBookIface *iface)
+{
+}
+
+static GHashTable *
+gdbus_book_get_pending_ops (EGdbusAsyncOpKeeper *object)
+{
+	EGdbusBookProxy *proxy;
+
+	g_return_val_if_fail (object != NULL, NULL);
+	g_return_val_if_fail (E_IS_GDBUS_BOOK_PROXY (object), NULL);
+
+	proxy = E_GDBUS_BOOK_PROXY (object);
+	g_return_val_if_fail (proxy != NULL, NULL);
+	g_return_val_if_fail (proxy->priv != NULL, NULL);
+
+	return proxy->priv->pending_ops;
+}
+
+static gboolean
+gdbus_book_call_cancel_operation_sync (EGdbusAsyncOpKeeper *object, guint in_opid, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_book_call_cancel_operation_sync (G_DBUS_PROXY (object), in_opid, cancellable, error);
+}
+
+static void
+async_op_keeper_iface_init (EGdbusAsyncOpKeeperInterface *iface)
+{
+	g_return_if_fail (iface != NULL);
+
+	iface->get_pending_ops = gdbus_book_get_pending_ops;
+	iface->cancel_op_sync = gdbus_book_call_cancel_operation_sync;
+}
+
+/**
+ * e_gdbus_book_proxy_new:
+ * @connection: A #GDBusConnection.
+ * @flags: Flags used when constructing the proxy.
+ * @name: A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
+ * @object_path: An object path.
+ * @cancellable: A #GCancellable or %NULL.
+ * @callback: Callback function to invoke when the proxy is ready.
+ * @user_data: User data to pass to @callback.
+ *
+ * Like g_dbus_proxy_new() but returns a #EGdbusBookProxy.
+ *
+ * This is a failable asynchronous constructor - when the proxy is ready, callback will be invoked and you can use e_gdbus_book_proxy_new_finish() to get the result.
+ */
+void
+e_gdbus_book_proxy_new (GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	g_async_initable_new_async (E_TYPE_GDBUS_BOOK_PROXY,
+				G_PRIORITY_DEFAULT,
+				cancellable,
+				callback,
+				user_data,
+				"g-flags", flags,
+				"g-name", name,
+				"g-connection", connection,
+				"g-object-path", object_path,
+				"g-interface-name", GDBUS_BOOK_INTERFACE_NAME,
+				NULL);
+}
+
+/**
+ * e_gdbus_book_proxy_new_finish:
+ * @result: A #GAsyncResult obtained from the #GAsyncReadyCallback function passed to e_gdbus_book_proxy_new().
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes creating a #EGdbusBookProxy.
+ *
+ * Returns: A #EGdbusBookProxy or %NULL if @error is set. Free with g_object_unref().
+ */
+EGdbusBook *
+e_gdbus_book_proxy_new_finish (GAsyncResult *result, GError **error)
+{
+	GObject *object;
+	GObject *source_object;
+	source_object = g_async_result_get_source_object (result);
+	g_assert (source_object != NULL);
+	object = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), result, error);
+	g_object_unref (source_object);
+
+	if (object != NULL)
+		return E_GDBUS_BOOK (object);
+	else
+		return NULL;
+}
+
+/**
+ * e_gdbus_book_proxy_new_sync:
+ * @connection: A #GDBusConnection.
+ * @flags: Flags used when constructing the proxy.
+ * @name: A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
+ * @object_path: An object path.
+ * @cancellable: A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Like g_dbus_proxy_new_sync() but returns a #EGdbusBookProxy.
+ *
+ * This is a synchronous failable constructor. See e_gdbus_book_proxy_new() and e_gdbus_book_proxy_new_finish() for the asynchronous version.
+ *
+ * Returns: A #EGdbusBookProxy or %NULL if error is set. Free with g_object_unref().
+ */
+EGdbusBook *
+e_gdbus_book_proxy_new_sync (GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error)
+{
+	GInitable *initable;
+	initable = g_initable_new (E_TYPE_GDBUS_BOOK_PROXY,
+				cancellable,
+				error,
+				"g-flags", flags,
+				"g-name", name,
+				"g-connection", connection,
+				"g-object-path", object_path,
+				"g-interface-name", GDBUS_BOOK_INTERFACE_NAME,
+				NULL);
+	if (initable != NULL)
+		return E_GDBUS_BOOK (initable);
+	else
+		return NULL;
+}
+
+/**
+ * e_gdbus_book_proxy_new_for_bus:
+ * @bus_type: A #GBusType.
+ * @flags: Flags used when constructing the proxy.
+ * @name: A bus name (well-known or unique).
+ * @object_path: An object path.
+ * @cancellable: A #GCancellable or %NULL.
+ * @callback: Callback function to invoke when the proxy is ready.
+ * @user_data: User data to pass to @callback.
+ *
+ * Like g_dbus_proxy_new_for_bus() but returns a #EGdbusBookProxy.
+ *
+ * This is a failable asynchronous constructor - when the proxy is ready, callback will be invoked and you can use e_gdbus_book_proxy_new_for_bus_finish() to get the result.
+ */
+void
+e_gdbus_book_proxy_new_for_bus (GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	g_async_initable_new_async (E_TYPE_GDBUS_BOOK_PROXY,
+				G_PRIORITY_DEFAULT,
+				cancellable,
+				callback,
+				user_data,
+				"g-flags", flags,
+				"g-name", name,
+				"g-bus-type", bus_type,
+				"g-object-path", object_path,
+				"g-interface-name", GDBUS_BOOK_INTERFACE_NAME,
+				NULL);
+}
+
+/**
+ * e_gdbus_book_proxy_new_for_bus_finish:
+ * @result: A #GAsyncResult obtained from the #GAsyncReadyCallback function passed to e_gdbus_book_proxy_new_for_bus().
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes creating a #EGdbusBookProxy.
+ *
+ * Returns: A #EGdbusBookProxy or %NULL if @error is set. Free with g_object_unref().
+ */
+EGdbusBook *
+e_gdbus_book_proxy_new_for_bus_finish (GAsyncResult *result, GError **error)
+{
+	GObject *object;
+	GObject *source_object;
+	source_object = g_async_result_get_source_object (result);
+	g_assert (source_object != NULL);
+	object = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), result, error);
+	g_object_unref (source_object);
+
+	if (object != NULL)
+		return E_GDBUS_BOOK (object);
+	else
+		return NULL;
+}
+
+/**
+ * e_gdbus_book_proxy_new_for_bus_sync:
+ * @bus_type: A #GBusType.
+ * @flags: Flags used when constructing the proxy.
+ * @name: A bus name (well-known or unique).
+ * @object_path: An object path.
+ * @cancellable: A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Like g_dbus_proxy_new_for_bus_sync() but returns a #EGdbusBookProxy.
+ *
+ * This is a synchronous failable constructor. See e_gdbus_book_proxy_new_for_bus() and e_gdbus_book_proxy_new_for_bus_finish() for the asynchronous version.
+ *
+ * Returns: A #EGdbusBookProxy or %NULL if error is set. Free with g_object_unref().
+ */
+EGdbusBook *
+e_gdbus_book_proxy_new_for_bus_sync (GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error)
+{
+	GInitable *initable;
+
+	initable = g_initable_new (E_TYPE_GDBUS_BOOK_PROXY,
+				cancellable,
+				error,
+				"g-flags", flags,
+				"g-name", name,
+				"g-bus-type", bus_type,
+				"g-object-path", object_path,
+				"g-interface-name", GDBUS_BOOK_INTERFACE_NAME,
+				NULL);
+	if (initable != NULL)
+		return E_GDBUS_BOOK (initable);
+	else
+		return NULL;
+}
+
+/* ---------------------------------------------------------------------- */
+
+struct _EGdbusBookStubPrivate
+{
+	gint foo;
+};
+
+static void stub_iface_init (EGdbusBookIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (EGdbusBookStub, e_gdbus_book_stub, G_TYPE_OBJECT,
+                         G_IMPLEMENT_INTERFACE (E_TYPE_GDBUS_BOOK, stub_iface_init));
+
+static void
+e_gdbus_book_stub_init (EGdbusBookStub *stub)
+{
+	stub->priv = G_TYPE_INSTANCE_GET_PRIVATE (stub, E_TYPE_GDBUS_BOOK_STUB, EGdbusBookStubPrivate);
+}
+
+static void
+e_gdbus_book_stub_class_init (EGdbusBookStubClass *klass)
+{
+	g_type_class_add_private (klass, sizeof (EGdbusBookStubPrivate));
+}
+
+static void
+stub_iface_init (EGdbusBookIface *iface)
+{
+}
+
+/**
+ * e_gdbus_book_stub_new:
+ *
+ * Creates a new stub object that can be exported via e_gdbus_book_register_object().
+ *
+ * Returns: A #EGdbusBookStub instance. Free with g_object_unref().
+ */
+EGdbusBook *
+e_gdbus_book_stub_new (void)
+{
+	return E_GDBUS_BOOK (g_object_new (E_TYPE_GDBUS_BOOK_STUB, NULL));
+}
+
+/* Returns GDBus connection associated with the stub object */
+GDBusConnection *
+e_gdbus_book_stub_get_connection (EGdbusBook *stub)
+{
+	g_return_val_if_fail (stub != NULL, NULL);
+	g_return_val_if_fail (E_IS_GDBUS_BOOK_STUB (stub), NULL);
+
+	return g_object_get_data (G_OBJECT (stub), "gdbus-codegen-connection");
+}
diff --git a/addressbook/libegdbus/e-gdbus-book.h b/addressbook/libegdbus/e-gdbus-book.h
new file mode 100644
index 0000000..98d6da4
--- /dev/null
+++ b/addressbook/libegdbus/e-gdbus-book.h
@@ -0,0 +1,273 @@
+/*
+ * e-gdbus-book.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#ifndef E_GDBUS_BOOK_H
+#define E_GDBUS_BOOK_H
+
+#include <gio/gio.h>
+
+#include <libedataserver/e-gdbus-templates.h>
+
+G_BEGIN_DECLS
+
+#define E_TYPE_GDBUS_BOOK         (e_gdbus_book_get_type ())
+#define E_GDBUS_BOOK(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_GDBUS_BOOK, EGdbusBook))
+#define E_IS_GDBUS_BOOK(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_GDBUS_BOOK))
+#define E_GDBUS_BOOK_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE((o), E_TYPE_GDBUS_BOOK, EGdbusBookIface))
+
+/**
+ * EGdbusBook:
+ *
+ * Opaque type representing a proxy or an exported object.
+ */
+typedef struct _EGdbusBook EGdbusBook; /* Dummy typedef */
+
+typedef struct _EGdbusBookIface EGdbusBookIface;
+
+GType e_gdbus_book_get_type (void) G_GNUC_CONST;
+
+/* ---------------------------------------------------------------------- */
+
+#define E_TYPE_GDBUS_BOOK_PROXY         (e_gdbus_book_proxy_get_type ())
+#define E_GDBUS_BOOK_PROXY(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_GDBUS_BOOK_PROXY, EGdbusBookProxy))
+#define E_IS_GDBUS_BOOK_PROXY(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_GDBUS_BOOK_PROXY))
+
+typedef struct _EGdbusBookProxy EGdbusBookProxy;
+typedef struct _EGdbusBookProxyClass EGdbusBookProxyClass;
+typedef struct _EGdbusBookProxyPrivate EGdbusBookProxyPrivate;
+
+struct _EGdbusBookProxy
+{
+	GDBusProxy parent_instance;
+	EGdbusBookProxyPrivate *priv;
+};
+
+struct _EGdbusBookProxyClass
+{
+	GDBusProxyClass parent_class;
+};
+
+GType e_gdbus_book_proxy_get_type (void) G_GNUC_CONST;
+
+void e_gdbus_book_proxy_new (GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+EGdbusBook *e_gdbus_book_proxy_new_finish (GAsyncResult *result, GError **error);
+EGdbusBook *e_gdbus_book_proxy_new_sync (GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error);
+
+void e_gdbus_book_proxy_new_for_bus (GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+EGdbusBook *e_gdbus_book_proxy_new_for_bus_finish (GAsyncResult *result, GError **error);
+EGdbusBook *e_gdbus_book_proxy_new_for_bus_sync (GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error);
+
+/* ---------------------------------------------------------------------- */
+
+typedef struct _EGdbusBookStub EGdbusBookStub;
+typedef struct _EGdbusBookStubClass EGdbusBookStubClass;
+typedef struct _EGdbusBookStubPrivate EGdbusBookStubPrivate;
+
+struct _EGdbusBookStub
+{
+	GObject parent_instance;
+	EGdbusBookStubPrivate *priv;
+};
+
+struct _EGdbusBookStubClass
+{
+	GObjectClass parent_class;
+};
+
+#define E_TYPE_GDBUS_BOOK_STUB	(e_gdbus_book_stub_get_type ())
+#define E_GDBUS_BOOK_STUB(o)	(G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_GDBUS_BOOK_STUB, EGdbusBookStub))
+#define E_IS_GDBUS_BOOK_STUB(o)	(G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_GDBUS_BOOK_STUB))
+
+GType e_gdbus_book_stub_get_type (void) G_GNUC_CONST;
+
+EGdbusBook *e_gdbus_book_stub_new (void);
+GDBusConnection *e_gdbus_book_stub_get_connection (EGdbusBook *stub);
+
+guint e_gdbus_book_register_object (EGdbusBook *object, GDBusConnection *connection, const gchar *object_path, GError **error);
+
+void e_gdbus_book_drain_notify (EGdbusBook *object);
+
+const GDBusInterfaceInfo *e_gdbus_book_interface_info (void) G_GNUC_CONST;
+
+struct _EGdbusBookIface
+{
+	GTypeInterface parent_iface;
+
+	/* Signal handlers for receiving D-Bus signals: */
+	void	(*backend_error)		(EGdbusBook *object, const gchar *arg_message);
+	void	(*readonly)			(EGdbusBook *object, gboolean arg_is_readonly);
+	void	(*online)			(EGdbusBook *object, gboolean arg_is_online);
+	void	(*auth_required)		(EGdbusBook *object, const gchar * const *arg_credentials);
+
+	/* Signal handlers for handling D-Bus method calls: */
+	gboolean (*handle_open)			(EGdbusBook *object, GDBusMethodInvocation *invocation, gboolean in_only_if_exists);
+	void	 (*open_done)			(EGdbusBook *object, guint arg_opid, const GError *arg_error);
+
+	gboolean (*handle_authenticate_user)	(EGdbusBook *object, GDBusMethodInvocation *invocation, const gchar * const *in_credentials);
+	void	 (*authenticate_user_done)	(EGdbusBook *object, guint arg_opid, const GError *arg_error);
+
+	gboolean (*handle_remove)		(EGdbusBook *object, GDBusMethodInvocation *invocation);
+	void	 (*remove_done)			(EGdbusBook *object, guint arg_opid, const GError *arg_error);
+
+	gboolean (*handle_get_contact)		(EGdbusBook *object, GDBusMethodInvocation *invocation, const gchar *in_uid);
+	void	 (*get_contact_done)		(EGdbusBook *object, guint arg_opid, const GError *arg_error, gchar **out_vcard);
+
+	gboolean (*handle_get_contact_list)	(EGdbusBook *object, GDBusMethodInvocation *invocation, const gchar *in_query);
+	void	 (*get_contact_list_done)	(EGdbusBook *object, guint arg_opid, const GError *arg_error, gchar ***out_vcards);
+
+	gboolean (*handle_add_contact)		(EGdbusBook *object, GDBusMethodInvocation *invocation, const gchar *in_vcard);
+	void	 (*add_contact_done)		(EGdbusBook *object, guint arg_opid, const GError *arg_error, gchar **out_uid);
+
+	gboolean (*handle_remove_contacts)	(EGdbusBook *object, GDBusMethodInvocation *invocation, const gchar * const *in_list);
+	void	 (*remove_contacts_done)	(EGdbusBook *object, guint arg_opid, const GError *arg_error);
+
+	gboolean (*handle_modify_contact)	(EGdbusBook *object, GDBusMethodInvocation *invocation, const gchar *in_vcard);
+	void	 (*modify_contact_done)		(EGdbusBook *object, guint arg_opid, const GError *arg_error);
+
+	gboolean (*handle_get_capabilities)	(EGdbusBook *object, GDBusMethodInvocation *invocation);
+	void	 (*get_capabilities_done)	(EGdbusBook *object, guint arg_opid, const GError *arg_error, gchar **out_capabilities);
+
+	gboolean (*handle_get_required_fields)	(EGdbusBook *object, GDBusMethodInvocation *invocation);
+	void	 (*get_required_fields_done)	(EGdbusBook *object, guint arg_opid, const GError *arg_error, gchar ***out_fields);
+
+	gboolean (*handle_get_supported_fields)	(EGdbusBook *object, GDBusMethodInvocation *invocation);
+	void	 (*get_supported_fields_done)	(EGdbusBook *object, guint arg_opid, const GError *arg_error, gchar ***out_fields);
+
+	gboolean (*handle_get_supported_auth_methods) (EGdbusBook *object, GDBusMethodInvocation *invocation);
+	void	 (*get_supported_auth_methods_done) (EGdbusBook *object, guint arg_opid, const GError *arg_error, gchar ***out_auth_methods);
+
+	gboolean (*handle_get_view)		(EGdbusBook *object, GDBusMethodInvocation *invocation, const gchar *in_query);
+	void	 (*get_view_done)		(EGdbusBook *object, guint arg_opid, const GError *arg_error, gchar **out_view);
+
+	gboolean (*handle_cancel_operation)	(EGdbusBook *object, GDBusMethodInvocation *invocation, guint in_opid);
+	gboolean (*handle_cancel_all)		(EGdbusBook *object, GDBusMethodInvocation *invocation);
+	gboolean (*handle_close)		(EGdbusBook *object, GDBusMethodInvocation *invocation);
+
+};
+
+/* C Bindings for properties */
+
+/* D-Bus Methods */
+void		e_gdbus_book_call_open (GDBusProxy *proxy, gboolean in_only_if_exists, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_book_call_open_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean	e_gdbus_book_call_open_sync (GDBusProxy *proxy, gboolean in_only_if_exists, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_book_call_authenticate_user (GDBusProxy *proxy, const gchar * const *in_credentials, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_book_call_authenticate_user_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean	e_gdbus_book_call_authenticate_user_sync (GDBusProxy *proxy, const gchar * const *in_credentials, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_book_call_remove (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_book_call_remove_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean	e_gdbus_book_call_remove_sync (GDBusProxy *proxy, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_book_call_get_contact (GDBusProxy *proxy, const gchar *in_uid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_book_call_get_contact_finish (GDBusProxy *proxy, GAsyncResult *result, gchar **out_vcard, GError **error);
+gboolean	e_gdbus_book_call_get_contact_sync (GDBusProxy *proxy, const gchar *in_uid, gchar **out_vcard, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_book_call_get_contact_list (GDBusProxy *proxy, const gchar *in_query, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_book_call_get_contact_list_finish (GDBusProxy *proxy, GAsyncResult *result, gchar ***out_vcards, GError **error);
+gboolean	e_gdbus_book_call_get_contact_list_sync (GDBusProxy *proxy, const gchar *in_query, gchar ***out_vcards, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_book_call_add_contact (GDBusProxy *proxy, const gchar *in_vcard, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_book_call_add_contact_finish (GDBusProxy *proxy, GAsyncResult *result, gchar **out_uid, GError **error);
+gboolean	e_gdbus_book_call_add_contact_sync (GDBusProxy *proxy, const gchar *in_vcard, gchar **out_uid, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_book_call_remove_contacts (GDBusProxy *proxy, const gchar * const *in_list, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_book_call_remove_contacts_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean	e_gdbus_book_call_remove_contacts_sync (GDBusProxy *proxy, const gchar * const *in_list, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_book_call_modify_contact (GDBusProxy *proxy, const gchar *in_vcard, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_book_call_modify_contact_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean	e_gdbus_book_call_modify_contact_sync (GDBusProxy *proxy, const gchar *in_vcard, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_book_call_get_capabilities (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_book_call_get_capabilities_finish (GDBusProxy *proxy, GAsyncResult *result, gchar **out_capabilities, GError **error);
+gboolean	e_gdbus_book_call_get_capabilities_sync (GDBusProxy *proxy, gchar **out_capabilities, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_book_call_get_required_fields (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_book_call_get_required_fields_finish (GDBusProxy *proxy, GAsyncResult *result, gchar ***out_fields, GError **error);
+gboolean	e_gdbus_book_call_get_required_fields_sync (GDBusProxy *proxy, gchar ***out_fields, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_book_call_get_supported_fields (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_book_call_get_supported_fields_finish (GDBusProxy *proxy, GAsyncResult *result, gchar ***out_fields, GError **error);
+gboolean	e_gdbus_book_call_get_supported_fields_sync (GDBusProxy *proxy, gchar ***out_fields, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_book_call_get_supported_auth_methods (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_book_call_get_supported_auth_methods_finish (GDBusProxy *proxy, GAsyncResult *result, gchar ***out_auth_methods, GError **error);
+gboolean	e_gdbus_book_call_get_supported_auth_methods_sync (GDBusProxy *proxy, gchar ***out_auth_methods, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_book_call_get_view (GDBusProxy *proxy, const gchar *in_query, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_book_call_get_view_finish (GDBusProxy *proxy, GAsyncResult *result, gchar **out_view_path, GError **error);
+gboolean	e_gdbus_book_call_get_view_sync (GDBusProxy *proxy, const gchar *in_query, gchar **out_view_path, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_book_call_cancel_operation (GDBusProxy *proxy, guint in_opid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_book_call_cancel_operation_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean	e_gdbus_book_call_cancel_operation_sync (GDBusProxy *proxy, guint in_opid, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_book_call_cancel_all (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_book_call_cancel_all_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean	e_gdbus_book_call_cancel_all_sync (GDBusProxy *proxy, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_book_call_close (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_book_call_close_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean	e_gdbus_book_call_close_sync (GDBusProxy *proxy, GCancellable *cancellable, GError **error);
+
+/* D-Bus Methods Completion Helpers */
+#define e_gdbus_book_complete_open				e_gdbus_complete_async_method
+#define e_gdbus_book_complete_authenticate_user			e_gdbus_complete_async_method
+#define e_gdbus_book_complete_remove				e_gdbus_complete_async_method
+#define e_gdbus_book_complete_get_contact			e_gdbus_complete_async_method
+#define e_gdbus_book_complete_get_contact_list			e_gdbus_complete_async_method
+#define e_gdbus_book_complete_add_contact			e_gdbus_complete_async_method
+#define e_gdbus_book_complete_remove_contacts			e_gdbus_complete_async_method
+#define e_gdbus_book_complete_modify_contact			e_gdbus_complete_async_method
+#define e_gdbus_book_complete_get_capabilities			e_gdbus_complete_async_method
+#define e_gdbus_book_complete_get_required_fields		e_gdbus_complete_async_method
+#define e_gdbus_book_complete_get_supported_fields		e_gdbus_complete_async_method
+#define e_gdbus_book_complete_get_supported_auth_methods	e_gdbus_complete_async_method
+#define e_gdbus_book_complete_get_view				e_gdbus_complete_async_method
+#define e_gdbus_book_complete_cancel_operation			e_gdbus_complete_sync_method_void
+#define e_gdbus_book_complete_cancel_all			e_gdbus_complete_sync_method_void
+#define e_gdbus_book_complete_close				e_gdbus_complete_sync_method_void
+
+void e_gdbus_book_emit_open_done			(EGdbusBook *object, guint arg_opid, const GError *arg_error);
+void e_gdbus_book_emit_authenticate_user_done		(EGdbusBook *object, guint arg_opid, const GError *arg_error);
+void e_gdbus_book_emit_remove_done			(EGdbusBook *object, guint arg_opid, const GError *arg_error);
+void e_gdbus_book_emit_get_contact_done			(EGdbusBook *object, guint arg_opid, const GError *arg_error, const gchar *out_vcard);
+void e_gdbus_book_emit_get_contact_list_done		(EGdbusBook *object, guint arg_opid, const GError *arg_error, const gchar * const *out_vcards);
+void e_gdbus_book_emit_add_contact_done			(EGdbusBook *object, guint arg_opid, const GError *arg_error, const gchar *out_uid);
+void e_gdbus_book_emit_remove_contacts_done		(EGdbusBook *object, guint arg_opid, const GError *arg_error);
+void e_gdbus_book_emit_modify_contact_done		(EGdbusBook *object, guint arg_opid, const GError *arg_error);
+void e_gdbus_book_emit_get_capabilities_done		(EGdbusBook *object, guint arg_opid, const GError *arg_error, const gchar *out_capabilities);
+void e_gdbus_book_emit_get_required_fields_done		(EGdbusBook *object, guint arg_opid, const GError *arg_error, const gchar * const *out_fields);
+void e_gdbus_book_emit_get_supported_fields_done	(EGdbusBook *object, guint arg_opid, const GError *arg_error, const gchar * const *out_fields);
+void e_gdbus_book_emit_get_supported_auth_methods_done	(EGdbusBook *object, guint arg_opid, const GError *arg_error, const gchar * const *out_auth_methods);
+void e_gdbus_book_emit_get_view_done			(EGdbusBook *object, guint arg_opid, const GError *arg_error, const gchar *out_view);
+
+/* D-Bus Signal Emission Helpers */
+void e_gdbus_book_emit_backend_error	(EGdbusBook *object, const gchar *arg_message);
+void e_gdbus_book_emit_readonly		(EGdbusBook *object, gboolean arg_is_readonly);
+void e_gdbus_book_emit_online		(EGdbusBook *object, gboolean arg_is_online);
+void e_gdbus_book_emit_auth_required	(EGdbusBook *object, const gchar * const *arg_credentials);
+
+G_END_DECLS
+
+#endif /* E_GDBUS_BOOK_H */
diff --git a/calendar/backends/caldav/e-cal-backend-caldav.c b/calendar/backends/caldav/e-cal-backend-caldav.c
index 63f5259..8403242 100644
--- a/calendar/backends/caldav/e-cal-backend-caldav.c
+++ b/calendar/backends/caldav/e-cal-backend-caldav.c
@@ -74,7 +74,7 @@ typedef enum {
 struct _ECalBackendCalDAVPrivate {
 
 	/* online/offline */
-	CalMode mode;
+	gboolean is_online;
 
 	/* The local disk cache */
 	ECalBackendStore *store;
@@ -113,15 +113,12 @@ struct _ECalBackendCalDAVPrivate {
 	gchar *uri;
 
 	/* Authentication info */
-	gchar *username;
-	gchar *password;
+	ECredentials *credentials;
 	gboolean need_auth;
 
 	/* object cleanup */
 	gboolean disposed;
 
-	icaltimezone *default_zone;
-
 	/* support for 'getctag' extension */
 	gboolean ctag_supported;
 	gchar *ctag_to_store;
@@ -302,7 +299,6 @@ put_component_to_store (ECalBackendCalDAV *cbdav,
 
 static ECalBackendSyncClass *parent_class = NULL;
 
-static icaltimezone *caldav_internal_get_default_timezone (ECalBackend *backend);
 static icaltimezone *caldav_internal_get_timezone (ECalBackend *backend, const gchar *tzid);
 static void caldav_source_changed_cb (ESource *source, ECalBackendCalDAV *cbdav);
 
@@ -571,7 +567,7 @@ check_state (ECalBackendCalDAV *cbdav, gboolean *online, GError **perror)
 		return FALSE;
 	}
 
-	if (priv->mode == CAL_MODE_LOCAL) {
+	if (!priv->is_online) {
 
 		if (!priv->do_offline) {
 			g_propagate_error (perror, EDC_ERROR (RepositoryOffline));
@@ -906,8 +902,10 @@ soup_authenticate (SoupSession  *session,
 	priv = cbdav->priv;
 
 	/* do not send same password twice, but keep it for later use */
-	if (!retrying)
-		soup_auth_authenticate (auth, priv->username, priv->password);
+	if (!retrying && priv->credentials && e_credentials_has_key (priv->credentials, E_CREDENTIALS_KEY_USERNAME)) {
+		soup_auth_authenticate (auth, e_credentials_peek (priv->credentials, E_CREDENTIALS_KEY_USERNAME), e_credentials_peek (priv->credentials, E_CREDENTIALS_KEY_PASSWORD));
+		e_credentials_clear_peek (priv->credentials);
+	}
 }
 
 /* ************************************************************************* */
@@ -2106,6 +2104,7 @@ caldav_synch_slave_loop (gpointer data)
 			}
 
 			e_cal_backend_notify_readonly (E_CAL_BACKEND (cbdav), priv->read_only);
+			e_cal_backend_notify_online (E_CAL_BACKEND (cbdav), priv->is_online);
 		}
 
 		if (priv->opened) {
@@ -2187,8 +2186,8 @@ get_usermail (ECalBackend *backend)
 	cbdav = E_CAL_BACKEND_CALDAV (backend);
 	priv  = cbdav->priv;
 
-	if (priv && priv->is_google && priv->username) {
-		res = maybe_append_email_domain (priv->username, "@gmail.com");
+	if (priv && priv->is_google && priv->credentials) {
+		res = maybe_append_email_domain (e_credentials_peek (priv->credentials, E_CREDENTIALS_KEY_USERNAME), "@gmail.com");
 	}
 
 	return res;
@@ -2198,57 +2197,19 @@ get_usermail (ECalBackend *backend)
 /* ********** ECalBackendSync virtual function implementation *************  */
 
 static void
-caldav_is_read_only (ECalBackendSync *backend,
-		     EDataCal        *cal,
-		     gboolean        *read_only,
-		     GError         **perror)
-{
-	ECalBackendCalDAV        *cbdav;
-	ECalBackendCalDAVPrivate *priv;
-
-	cbdav = E_CAL_BACKEND_CALDAV (backend);
-	priv  = cbdav->priv;
-
-	/* no write support in offline mode yet! */
-	if (priv->mode == CAL_MODE_LOCAL) {
-		*read_only = TRUE;
-	} else {
-		*read_only = priv->read_only;
-	}
-}
-
-static void
-caldav_get_cal_address (ECalBackendSync  *backend,
-			EDataCal         *cal,
-			gchar           **address,
-			GError          **perror)
+caldav_get_cal_email_address (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **address, GError **perror)
 {
 	*address = get_usermail (E_CAL_BACKEND (backend));
 }
 
 static void
-caldav_get_alarm_email_address (ECalBackendSync  *backend,
-				EDataCal         *cal,
-				gchar           **address,
-				GError          **perror)
+caldav_get_alarm_email_address (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **address, GError **perror)
 {
 	*address = get_usermail (E_CAL_BACKEND (backend));
 }
 
 static void
-caldav_get_ldap_attribute (ECalBackendSync  *backend,
-			   EDataCal         *cal,
-			   gchar           **attribute,
-			   GError          **perror)
-{
-	*attribute = NULL;
-}
-
-static void
-caldav_get_static_capabilities (ECalBackendSync  *backend,
-				EDataCal         *cal,
-				gchar           **capabilities,
-				GError          **perror)
+caldav_get_capabilities (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **capabilities, GError **perror)
 {
 	ESource *source;
 	GString *caps;
@@ -2431,12 +2392,40 @@ proxy_settings_changed (EProxy *proxy, gpointer user_data)
 }
 
 static void
-caldav_do_open (ECalBackendSync *backend,
-		EDataCal        *cal,
-		gboolean         only_if_exists,
-		const gchar      *username,
-		const gchar      *password,
-		GError          **perror)
+open_calendar (ECalBackendCalDAV *cbdav, GError **error)
+{
+	gboolean server_unreachable = FALSE;
+	ECalBackendCalDAVPrivate *priv;
+	GError *local_error = NULL;
+
+	g_return_if_fail (cbdav != NULL);
+
+	priv  = cbdav->priv;
+
+	/* set forward proxy */
+	proxy_settings_changed (priv->proxy, priv);
+
+	if (caldav_server_open_calendar (cbdav, &server_unreachable, &local_error)) {
+		priv->slave_cmd = SLAVE_SHOULD_WORK;
+		g_cond_signal (priv->cond);
+
+		priv->is_google = is_google_uri (priv->uri);
+	} else if (server_unreachable) {
+		priv->opened = FALSE;
+		priv->read_only = TRUE;
+		if (local_error) {
+			gchar *msg = g_strdup_printf (_("Server is unreachable, calendar is opened in read-only mode.\nError message: %s"), local_error->message);
+			e_cal_backend_notify_error (E_CAL_BACKEND (cbdav), msg);
+			g_free (msg);
+			g_clear_error (&local_error);
+		}
+	} else if (local_error) {
+		g_propagate_error (error, local_error);
+	}
+}
+
+static void
+caldav_do_open (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gboolean only_if_exists, GError **perror)
 {
 	ECalBackendCalDAV        *cbdav;
 	ECalBackendCalDAVPrivate *priv;
@@ -2454,20 +2443,7 @@ caldav_do_open (ECalBackendSync *backend,
 		return;
 	}
 
-	if (priv->need_auth) {
-		if ((username == NULL || password == NULL)) {
-			g_mutex_unlock (priv->busy_lock);
-			g_propagate_error (perror, EDC_ERROR (AuthenticationRequired));
-			return;
-		}
-
-		g_free (priv->username);
-		priv->username = g_strdup (username);
-		g_free (priv->password);
-		priv->password = g_strdup (password);
-	}
-
-	if (!priv->do_offline && priv->mode == CAL_MODE_LOCAL) {
+	if (!priv->do_offline && !priv->is_online) {
 		g_mutex_unlock (priv->busy_lock);
 		g_propagate_error (perror, EDC_ERROR (RepositoryOffline));
 		return;
@@ -2477,39 +2453,58 @@ caldav_do_open (ECalBackendSync *backend,
 	priv->opened = TRUE;
 	priv->is_google = FALSE;
 
-	if (priv->mode == CAL_MODE_REMOTE) {
-		gboolean server_unreachable = FALSE;
+	if (priv->is_online) {
 		GError *local_error = NULL;
 
-		/* set forward proxy */
-		proxy_settings_changed (priv->proxy, priv);
+		open_calendar (cbdav, &local_error);
 
-		if (caldav_server_open_calendar (cbdav, &server_unreachable, &local_error)) {
-			priv->slave_cmd = SLAVE_SHOULD_WORK;
-			g_cond_signal (priv->cond);
+		if (g_error_matches (local_error, E_DATA_CAL_ERROR, AuthenticationRequired) || g_error_matches (local_error, E_DATA_CAL_ERROR, AuthenticationFailed)) {
+			g_clear_error (&local_error);
+			e_cal_backend_notify_auth_required (E_CAL_BACKEND (cbdav), priv->credentials);
+		}
 
-			priv->is_google = is_google_uri (priv->uri);
-		} else if (server_unreachable) {
-			priv->opened = FALSE;
-			priv->read_only = TRUE;
-			if (local_error) {
-				gchar *msg = g_strdup_printf (_("Server is unreachable, calendar is opened in read-only mode.\nError message: %s"), local_error->message);
-				e_cal_backend_notify_error (E_CAL_BACKEND (backend), msg);
-				g_free (msg);
-				g_clear_error (&local_error);
-			}
-		} else {
+		if (local_error)
 			g_propagate_error (perror, local_error);
-		}
 	} else {
 		priv->read_only = TRUE;
 	}
 
+	e_cal_backend_set_is_loaded (E_CAL_BACKEND (backend), priv->loaded);
+	e_cal_backend_notify_readonly (E_CAL_BACKEND (backend), priv->read_only);
+	e_cal_backend_notify_online (E_CAL_BACKEND (backend), priv->is_online);
+
+	g_mutex_unlock (priv->busy_lock);
+}
+
+static void
+caldav_authenticate_user (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, ECredentials *credentials, GError **error)
+{
+	ECalBackendCalDAV        *cbdav;
+	ECalBackendCalDAVPrivate *priv;
+
+	cbdav = E_CAL_BACKEND_CALDAV (backend);
+	priv  = cbdav->priv;
+
+	g_mutex_lock (priv->busy_lock);
+
+	e_credentials_free (priv->credentials);
+	priv->credentials = NULL;
+
+	if (!credentials || !e_credentials_has_key (credentials, E_CREDENTIALS_KEY_USERNAME)) {
+		g_mutex_unlock (priv->busy_lock);
+		g_propagate_error (error, EDC_ERROR (AuthenticationFailed));
+		return;
+	}
+
+	priv->credentials = e_credentials_new_clone (credentials);
+
+	open_calendar (cbdav, error);
+
 	g_mutex_unlock (priv->busy_lock);
 }
 
 static void
-caldav_refresh (ECalBackendSync *backend, EDataCal *cal, GError **perror)
+caldav_refresh (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, GError **perror)
 {
 	ECalBackendCalDAV        *cbdav;
 	ECalBackendCalDAVPrivate *priv;
@@ -2536,9 +2531,7 @@ caldav_refresh (ECalBackendSync *backend, EDataCal *cal, GError **perror)
 }
 
 static void
-caldav_remove (ECalBackendSync *backend,
-	       EDataCal        *cal,
-	       GError         **perror)
+caldav_remove (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, GError **perror)
 {
 	ECalBackendCalDAV        *cbdav;
 	ECalBackendCalDAVPrivate *priv;
@@ -2574,6 +2567,8 @@ caldav_remove (ECalBackendSync *backend,
 		g_cond_wait (priv->slave_gone_cond, priv->busy_lock);
 	}
 
+	e_cal_backend_set_is_loaded (E_CAL_BACKEND (backend), priv->loaded);
+
 	g_mutex_unlock (priv->busy_lock);
 }
 
@@ -3133,7 +3128,7 @@ static void
 sanitize_component (ECalBackend *cb, ECalComponent *comp)
 {
 	ECalComponentDateTime dt;
-	icaltimezone *zone, *default_zone;
+	icaltimezone *zone;
 
 	/* Check dtstart, dtend and due's timezone, and convert it to local
 	 * default timezone if the timezone is not in our builtin timezone
@@ -3142,9 +3137,8 @@ sanitize_component (ECalBackend *cb, ECalComponent *comp)
 	if (dt.value && dt.tzid) {
 		zone = caldav_internal_get_timezone (cb, dt.tzid);
 		if (!zone) {
-			default_zone = caldav_internal_get_default_timezone (cb);
-			g_free ((gchar *)dt.tzid);
-			dt.tzid = g_strdup (icaltimezone_get_tzid (default_zone));
+			g_free ((gchar *) dt.tzid);
+			dt.tzid = g_strdup ("UTC");
 			e_cal_component_set_dtstart (comp, &dt);
 		}
 	}
@@ -3154,9 +3148,8 @@ sanitize_component (ECalBackend *cb, ECalComponent *comp)
 	if (dt.value && dt.tzid) {
 		zone = caldav_internal_get_timezone (cb, dt.tzid);
 		if (!zone) {
-			default_zone = caldav_internal_get_default_timezone (cb);
-			g_free ((gchar *)dt.tzid);
-			dt.tzid = g_strdup (icaltimezone_get_tzid (default_zone));
+			g_free ((gchar *) dt.tzid);
+			dt.tzid = g_strdup ("UTC");
 			e_cal_component_set_dtend (comp, &dt);
 		}
 	}
@@ -3166,9 +3159,8 @@ sanitize_component (ECalBackend *cb, ECalComponent *comp)
 	if (dt.value && dt.tzid) {
 		zone = caldav_internal_get_timezone (cb, dt.tzid);
 		if (!zone) {
-			default_zone = caldav_internal_get_default_timezone (cb);
-			g_free ((gchar *)dt.tzid);
-			dt.tzid = g_strdup (icaltimezone_get_tzid (default_zone));
+			g_free ((gchar *) dt.tzid);
+			dt.tzid = g_strdup ("UTC");
 			e_cal_component_set_due (comp, &dt);
 		}
 	}
@@ -3312,7 +3304,7 @@ replace_master (ECalBackendCalDAV *cbdav, icalcomponent *old_comp, icalcomponent
 
 /* a busy_lock is supposed to be locked already, when calling this function */
 static void
-do_create_object (ECalBackendCalDAV *cbdav, gchar **calobj, gchar **uid, GError **perror)
+do_create_object (ECalBackendCalDAV *cbdav, const gchar *in_calobj, gchar **uid, gchar **new_calobj, GError **perror)
 {
 	ECalComponent            *comp;
 	gboolean                  online, did_put = FALSE;
@@ -3323,7 +3315,7 @@ do_create_object (ECalBackendCalDAV *cbdav, gchar **calobj, gchar **uid, GError
 	if (!check_state (cbdav, &online, perror))
 		return;
 
-	comp = e_cal_component_new_from_string (*calobj);
+	comp = e_cal_component_new_from_string (in_calobj);
 
 	if (comp == NULL) {
 		g_propagate_error (perror, EDC_ERROR (InvalidObject));
@@ -3394,13 +3386,13 @@ do_create_object (ECalBackendCalDAV *cbdav, gchar **calobj, gchar **uid, GError
 			icalcomponent *master = get_master_comp (cbdav, icalcomp);
 
 			if (!master)
-				*calobj = e_cal_component_get_as_string (comp);
+				*new_calobj = e_cal_component_get_as_string (comp);
 			else
-				*calobj = icalcomponent_as_ical_string_r (master);
+				*new_calobj = icalcomponent_as_ical_string_r (master);
 
 			icalcomponent_free (icalcomp);
 		} else {
-			*calobj = e_cal_component_get_as_string (comp);
+			*new_calobj = e_cal_component_get_as_string (comp);
 		}
 	}
 
@@ -3677,7 +3669,7 @@ do_remove_object (ECalBackendCalDAV *cbdav, const gchar *uid, const gchar *rid,
 static void
 extract_objects (icalcomponent       *icomp,
 		 icalcomponent_kind   ekind,
-		 GList              **objects,
+		 GSList             **objects,
 		 GError             **error)
 {
 	icalcomponent         *scomp;
@@ -3689,7 +3681,7 @@ extract_objects (icalcomponent       *icomp,
 	kind = icalcomponent_isa (icomp);
 
 	if (kind == ekind) {
-		*objects = g_list_prepend (NULL, icomp);
+		*objects = g_slist_prepend (NULL, icomp);
 		return;
 	}
 
@@ -3704,7 +3696,7 @@ extract_objects (icalcomponent       *icomp,
 
 	while (scomp) {
 		/* Remove components from toplevel here */
-		*objects = g_list_prepend (*objects, scomp);
+		*objects = g_slist_prepend (*objects, scomp);
 		icalcomponent_remove_component (icomp, scomp);
 
 		scomp = icalcomponent_get_next_component (icomp, ekind);
@@ -3715,7 +3707,7 @@ static gboolean
 extract_timezones (ECalBackendCalDAV *cbdav, icalcomponent *icomp)
 {
 	ECalBackendCalDAVPrivate *priv;
-	GList *timezones = NULL, *iter;
+	GSList *timezones = NULL, *iter;
 	icaltimezone *zone;
 	GError *err = NULL;
 
@@ -3740,7 +3732,7 @@ extract_timezones (ECalBackendCalDAV *cbdav, icalcomponent *icomp)
 	}
 
 	icaltimezone_free (zone, TRUE);
-	g_list_free (timezones);
+	g_slist_free (timezones);
 
 	return TRUE;
 }
@@ -3812,7 +3804,7 @@ process_object (ECalBackendCalDAV   *cbdav,
 		} else if (!is_declined) {
 			gchar *new_object = new_obj_str;
 
-			do_create_object (cbdav, &new_object, NULL, &err);
+			do_create_object (cbdav, new_object, NULL, &new_object, &err);
 			if (!err) {
 				e_cal_backend_notify_object_created (backend, new_object);
 			}
@@ -3854,15 +3846,14 @@ process_object (ECalBackendCalDAV   *cbdav,
 }
 
 static void
-do_receive_objects (ECalBackendSync *backend, EDataCal *cal, const gchar *calobj, GError **perror)
+do_receive_objects (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, GError **perror)
 {
 	ECalBackendCalDAV        *cbdav;
 	icalcomponent            *icomp;
 	icalcomponent_kind        kind;
 	icalproperty_method       tmethod;
 	gboolean                  online;
-	GList                    *objects;
-	GList                    *iter;
+	GSList                   *objects, *iter;
 	GError *err = NULL;
 
 	cbdav = E_CAL_BACKEND_CALDAV (backend);
@@ -3913,7 +3904,7 @@ do_receive_objects (ECalBackendSync *backend, EDataCal *cal, const gchar *calobj
 		g_object_unref (ecomp);
 	}
 
-	g_list_free (objects);
+	g_slist_free (objects);
 
 	icalcomponent_free (icomp);
 
@@ -3954,35 +3945,30 @@ _func_name _params							\
 }
 
 caldav_busy_stub (
-	caldav_create_object, (ECalBackendSync *backend, EDataCal *cal, gchar **calobj, gchar **uid, GError **perror),
-	do_create_object, (cbdav, calobj, uid, perror))
+	caldav_create_object, (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *in_calobj, gchar **uid, gchar **new_calobj, GError **perror),
+	do_create_object, (cbdav, in_calobj, uid, new_calobj, perror))
 
 caldav_busy_stub (
-	caldav_modify_object, (ECalBackendSync *backend, EDataCal *cal, const gchar *calobj, CalObjModType mod, gchar **old_object, gchar **new_object, GError **perror),
+	caldav_modify_object, (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, CalObjModType mod, gchar **old_object, gchar **new_object, GError **perror),
 	do_modify_object, (cbdav, calobj, mod, old_object, new_object, perror))
 
 caldav_busy_stub (
-	caldav_remove_object, (ECalBackendSync *backend, EDataCal *cal, const gchar *uid, const gchar *rid, CalObjModType mod, gchar **old_object, gchar **object, GError **perror),
+	caldav_remove_object, (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, CalObjModType mod, gchar **old_object, gchar **object, GError **perror),
 	do_remove_object, (cbdav, uid, rid, mod, old_object, object, perror))
 
 caldav_busy_stub (
-	caldav_receive_objects, (ECalBackendSync *backend, EDataCal *cal, const gchar *calobj, GError **perror),
-	do_receive_objects, (backend, cal, calobj, perror))
-
-static void
-caldav_discard_alarm (ECalBackendSync *backend, EDataCal *cal, const gchar *uid, const gchar *auid, GError **perror)
-{
-}
+	caldav_receive_objects, (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, GError **perror),
+	do_receive_objects, (backend, cal, cancellable, calobj, perror))
 
 static void
-caldav_send_objects (ECalBackendSync *backend, EDataCal *cal, const gchar *calobj, GList **users, gchar **modified_calobj, GError **perror)
+caldav_send_objects (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, GSList **users, gchar **modified_calobj, GError **perror)
 {
 	*users = NULL;
 	*modified_calobj = g_strdup (calobj);
 }
 
 static void
-caldav_get_default_object (ECalBackendSync *backend, EDataCal *cal, gchar **object, GError **perror)
+caldav_get_default_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **object, GError **perror)
 {
 	ECalComponent *comp;
 
@@ -4009,7 +3995,7 @@ caldav_get_default_object (ECalBackendSync *backend, EDataCal *cal, gchar **obje
 }
 
 static void
-caldav_get_object (ECalBackendSync *backend, EDataCal *cal, const gchar *uid, const gchar *rid, gchar **object, GError **perror)
+caldav_get_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, gchar **object, GError **perror)
 {
 	ECalBackendCalDAV        *cbdav;
 	icalcomponent            *icalcomp;
@@ -4029,10 +4015,7 @@ caldav_get_object (ECalBackendSync *backend, EDataCal *cal, const gchar *uid, co
 }
 
 static void
-caldav_add_timezone (ECalBackendSync *backend,
-		     EDataCal        *cal,
-		     const gchar      *tzobj,
-		     GError **error)
+caldav_add_timezone (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *tzobj, GError **error)
 {
 	icalcomponent *tz_comp;
 	ECalBackendCalDAV *cbdav;
@@ -4066,44 +4049,7 @@ caldav_add_timezone (ECalBackendSync *backend,
 }
 
 static void
-caldav_set_default_zone (ECalBackendSync *backend,
-			     EDataCal        *cal,
-			     const gchar      *tzobj,
-			     GError **error)
-{
-	icalcomponent *tz_comp;
-	ECalBackendCalDAV *cbdav;
-	ECalBackendCalDAVPrivate *priv;
-	icaltimezone *zone;
-
-	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_CALDAV (backend), InvalidArg);
-	e_return_data_cal_error_if_fail (tzobj != NULL, InvalidArg);
-
-	cbdav = E_CAL_BACKEND_CALDAV (backend);
-	priv  = cbdav->priv;
-
-	tz_comp = icalparser_parse_string (tzobj);
-	if (!tz_comp) {
-		g_propagate_error (error, EDC_ERROR (InvalidObject));
-		return;
-	}
-
-	zone = icaltimezone_new ();
-	icaltimezone_set_component (zone, tz_comp);
-
-	if (priv->default_zone != icaltimezone_get_utc_timezone ())
-		icaltimezone_free (priv->default_zone, 1);
-
-	/* Set the default timezone to it. */
-	priv->default_zone = zone;
-}
-
-static void
-caldav_get_object_list (ECalBackendSync  *backend,
-			EDataCal         *cal,
-			const gchar       *sexp_string,
-			GList           **objects,
-			GError **perror)
+caldav_get_object_list (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *sexp_string, GSList **objects, GError **perror)
 {
 	ECalBackendCalDAV        *cbdav;
 	ECalBackendCalDAVPrivate *priv;
@@ -4132,9 +4078,7 @@ caldav_get_object_list (ECalBackendSync  *backend,
 
 	*objects = NULL;
 
-	prunning_by_time = e_cal_backend_sexp_evaluate_occur_times (sexp,
-									    &occur_start,
-									    &occur_end);
+	prunning_by_time = e_cal_backend_sexp_evaluate_occur_times (sexp, &occur_start, &occur_end);
 
 	bkend = E_CAL_BACKEND (backend);
 
@@ -4149,7 +4093,7 @@ caldav_get_object_list (ECalBackendSync  *backend,
 
 		if (!do_search ||
 		    e_cal_backend_sexp_match_comp (sexp, comp, bkend)) {
-			*objects = g_list_prepend (*objects, e_cal_component_get_as_string (comp));
+			*objects = g_slist_prepend (*objects, e_cal_component_get_as_string (comp));
 		}
 
 		g_object_unref (comp);
@@ -4160,8 +4104,7 @@ caldav_get_object_list (ECalBackendSync  *backend,
 }
 
 static void
-caldav_start_query (ECalBackend  *backend,
-		    EDataCalView *query)
+caldav_start_view (ECalBackend *backend, EDataCalView *query)
 {
 	ECalBackendCalDAV        *cbdav;
 	ECalBackendCalDAVPrivate *priv;
@@ -4211,17 +4154,11 @@ caldav_start_query (ECalBackend  *backend,
 	g_object_unref (sexp);
 	g_slist_free (list);
 
-	e_data_cal_view_notify_done (query, NULL /* Success */);
+	e_data_cal_view_notify_complete (query, NULL /* Success */);
 }
 
 static void
-caldav_get_free_busy (ECalBackendSync  *backend,
-		      EDataCal         *cal,
-		      GList            *users,
-		      time_t            start,
-		      time_t            end,
-		      GList           **freebusy,
-		      GError **error)
+caldav_get_free_busy (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const GSList *users, time_t start, time_t end, GSList **freebusy, GError **error)
 {
 	ECalBackendCalDAV *cbdav;
 	ECalBackendCalDAVPrivate *priv;
@@ -4231,7 +4168,7 @@ caldav_get_free_busy (ECalBackendSync  *backend,
 	struct icaltimetype dtvalue;
 	icaltimezone *utc;
 	gchar *str, *usermail;
-	GList *u;
+	const GSList *u;
 	GSList *attendees = NULL, *to_free = NULL;
 	GError *err = NULL;
 
@@ -4283,10 +4220,10 @@ caldav_get_free_busy (ECalBackendSync  *backend,
 		usermail = NULL;
 	}
 
-	if (priv->username || usermail) {
+	if ((priv->credentials && e_credentials_has_key (priv->credentials, E_CREDENTIALS_KEY_USERNAME)) || usermail) {
 		ECalComponentOrganizer organizer = {NULL};
 
-		organizer.value = usermail ? usermail : priv->username;
+		organizer.value = usermail ? usermail : e_credentials_peek (priv->credentials, E_CREDENTIALS_KEY_USERNAME);
 		organizer.value = g_strconcat ("mailto:";, organizer.value, NULL);
 
 		e_cal_component_set_organizer (comp, &organizer);
@@ -4361,7 +4298,7 @@ caldav_get_free_busy (ECalBackendSync  *backend,
 
 					tmp = xp_object_get_string (xpath_eval (xpctx, "string(/C:schedule-response/C:response[%d]/C:calendar-data)", i + 1));
 					if (tmp && *tmp) {
-						GList *objects = NULL, *o;
+						GSList *objects = NULL, *o;
 
 						icalcomp = icalparser_parse_string (tmp);
 						if (icalcomp)
@@ -4371,14 +4308,14 @@ caldav_get_free_busy (ECalBackendSync  *backend,
 								gchar *obj_str = icalcomponent_as_ical_string_r (o->data);
 
 								if (obj_str && *obj_str)
-									*freebusy = g_list_append (*freebusy, obj_str);
+									*freebusy = g_slist_append (*freebusy, obj_str);
 								else
 									g_free (obj_str);
 							}
 						}
 
-						g_list_foreach (objects, (GFunc)icalcomponent_free, NULL);
-						g_list_free (objects);
+						g_slist_foreach (objects, (GFunc) icalcomponent_free, NULL);
+						g_slist_free (objects);
 
 						if (icalcomp)
 							icalcomponent_free (icalcomp);
@@ -4405,44 +4342,7 @@ caldav_get_free_busy (ECalBackendSync  *backend,
 }
 
 static void
-caldav_get_changes (ECalBackendSync  *backend,
-		    EDataCal         *cal,
-		    const gchar       *change_id,
-		    GList           **adds,
-		    GList           **modifies,
-		    GList **deletes,
-		    GError **perror)
-{
-	/* FIXME: implement me! */
-	g_propagate_error (perror, EDC_ERROR (NotSupported));
-}
-
-static gboolean
-caldav_is_loaded (ECalBackend *backend)
-{
-	ECalBackendCalDAV        *cbdav;
-	ECalBackendCalDAVPrivate *priv;
-
-	cbdav = E_CAL_BACKEND_CALDAV (backend);
-	priv  = cbdav->priv;
-
-	return priv->loaded;
-}
-
-static CalMode
-caldav_get_mode (ECalBackend *backend)
-{
-	ECalBackendCalDAV        *cbdav;
-	ECalBackendCalDAVPrivate *priv;
-
-	cbdav = E_CAL_BACKEND_CALDAV (backend);
-	priv  = cbdav->priv;
-
-	return priv->mode;
-}
-
-static void
-caldav_set_mode (ECalBackend *backend, CalMode mode)
+caldav_set_online (ECalBackend *backend, gboolean is_online)
 {
 	ECalBackendCalDAV        *cbdav;
 	ECalBackendCalDAVPrivate *priv;
@@ -4452,28 +4352,16 @@ caldav_set_mode (ECalBackend *backend, CalMode mode)
 
 	/*g_mutex_lock (priv->busy_lock);*/
 
-	/* We only support online and offline */
-	if (mode != CAL_MODE_REMOTE &&
-	    mode != CAL_MODE_LOCAL) {
-		e_cal_backend_notify_mode (backend,
-					   ModeNotSupported,
-					   cal_mode_to_corba (mode));
-		/*g_mutex_unlock (priv->busy_lock);*/
-		return;
-	}
-
-	if (priv->mode == mode || !priv->loaded) {
-		priv->mode = mode;
-		e_cal_backend_notify_mode (backend,
-					   ModeSet,
-					   cal_mode_to_corba (mode));
+	if ((priv->is_online ? 1: 0) == (is_online ? 1 : 0) || !priv->loaded) {
+		priv->is_online = is_online;
+		e_cal_backend_notify_online (backend, is_online);
 		/*g_mutex_unlock (priv->busy_lock);*/
 		return;
 	}
 
-	priv->mode = mode;
+	priv->is_online = is_online;
 
-	if (mode == CAL_MODE_REMOTE) {
+	if (is_online) {
 		/* Wake up the slave thread */
 		priv->slave_cmd = SLAVE_SHOULD_WORK;
 		g_cond_signal (priv->cond);
@@ -4482,30 +4370,12 @@ caldav_set_mode (ECalBackend *backend, CalMode mode)
 		priv->slave_cmd = SLAVE_SHOULD_SLEEP;
 	}
 
-	e_cal_backend_notify_mode (backend,
-				   ModeSet,
-				   cal_mode_to_corba (mode));
+	e_cal_backend_notify_online (backend, is_online);
 
 	/*g_mutex_unlock (priv->busy_lock);*/
 }
 
 static icaltimezone *
-caldav_internal_get_default_timezone (ECalBackend *backend)
-{
-	ECalBackendCalDAV *cbdav;
-	ECalBackendCalDAVPrivate *priv;
-
-	g_return_val_if_fail (E_IS_CAL_BACKEND_CALDAV (backend), NULL);
-
-	cbdav = E_CAL_BACKEND_CALDAV (backend);
-	priv  = cbdav->priv;
-
-	g_return_val_if_fail (priv->default_zone != NULL, NULL);
-
-	return priv->default_zone;
-}
-
-static icaltimezone *
 caldav_internal_get_timezone (ECalBackend *backend,
 			      const gchar *tzid)
 {
@@ -4598,8 +4468,9 @@ e_cal_backend_caldav_dispose (GObject *object)
 	g_object_unref (priv->session);
 	g_object_unref (priv->proxy);
 
-	g_free (priv->username);
-	g_free (priv->password);
+	e_credentials_free (priv->credentials);
+	priv->credentials = NULL;
+
 	g_free (priv->uri);
 	g_free (priv->schedule_outbox_url);
 
@@ -4627,11 +4498,6 @@ e_cal_backend_caldav_finalize (GObject *object)
 	g_cond_free (priv->cond);
 	g_cond_free (priv->slave_gone_cond);
 
-	if (priv->default_zone && priv->default_zone != icaltimezone_get_utc_timezone ()) {
-		icaltimezone_free (priv->default_zone, 1);
-	}
-	priv->default_zone = NULL;
-
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (parent_class)->finalize (object);
 }
@@ -4652,8 +4518,6 @@ e_cal_backend_caldav_init (ECalBackendCalDAV *cbdav)
 	if (G_UNLIKELY (caldav_debug_show (DEBUG_MESSAGE)))
 		caldav_debug_setup (cbdav->priv->session);
 
-	cbdav->priv->default_zone = icaltimezone_get_utc_timezone ();
-
 	cbdav->priv->disposed = FALSE;
 	cbdav->priv->loaded   = FALSE;
 	cbdav->priv->opened = FALSE;
@@ -4701,13 +4565,12 @@ e_cal_backend_caldav_class_init (ECalBackendCalDAVClass *class)
 	object_class->dispose  = e_cal_backend_caldav_dispose;
 	object_class->finalize = e_cal_backend_caldav_finalize;
 
-	sync_class->is_read_only_sync            = caldav_is_read_only;
-	sync_class->get_cal_address_sync         = caldav_get_cal_address;
+	sync_class->get_cal_email_address_sync   = caldav_get_cal_email_address;
 	sync_class->get_alarm_email_address_sync = caldav_get_alarm_email_address;
-	sync_class->get_ldap_attribute_sync      = caldav_get_ldap_attribute;
-	sync_class->get_static_capabilities_sync = caldav_get_static_capabilities;
+	sync_class->get_capabilities_sync	 = caldav_get_capabilities;
 
 	sync_class->open_sync                    = caldav_do_open;
+	sync_class->authenticate_user_sync	 = caldav_authenticate_user;
 	sync_class->refresh_sync                 = caldav_refresh;
 	sync_class->remove_sync                  = caldav_remove;
 
@@ -4715,22 +4578,16 @@ e_cal_backend_caldav_class_init (ECalBackendCalDAVClass *class)
 	sync_class->modify_object_sync = caldav_modify_object;
 	sync_class->remove_object_sync = caldav_remove_object;
 
-	sync_class->discard_alarm_sync        = caldav_discard_alarm;
 	sync_class->receive_objects_sync      = caldav_receive_objects;
 	sync_class->send_objects_sync         = caldav_send_objects;
 	sync_class->get_default_object_sync   = caldav_get_default_object;
 	sync_class->get_object_sync           = caldav_get_object;
 	sync_class->get_object_list_sync      = caldav_get_object_list;
 	sync_class->add_timezone_sync         = caldav_add_timezone;
-	sync_class->set_default_zone_sync = caldav_set_default_zone;
-	sync_class->get_freebusy_sync         = caldav_get_free_busy;
-	sync_class->get_changes_sync          = caldav_get_changes;
+	sync_class->get_free_busy_sync        = caldav_get_free_busy;
 
-	backend_class->is_loaded   = caldav_is_loaded;
-	backend_class->start_query = caldav_start_query;
-	backend_class->get_mode    = caldav_get_mode;
-	backend_class->set_mode    = caldav_set_mode;
+	backend_class->start_view = caldav_start_view;
+	backend_class->set_online = caldav_set_online;
 
-	backend_class->internal_get_default_timezone = caldav_internal_get_default_timezone;
-	backend_class->internal_get_timezone         = caldav_internal_get_timezone;
+	backend_class->internal_get_timezone  = caldav_internal_get_timezone;
 }
diff --git a/calendar/backends/contacts/e-cal-backend-contacts.c b/calendar/backends/contacts/e-cal-backend-contacts.c
index e8cf1cb..825c73c 100644
--- a/calendar/backends/contacts/e-cal-backend-contacts.c
+++ b/calendar/backends/contacts/e-cal-backend-contacts.c
@@ -67,7 +67,6 @@ struct _ECalBackendContactsPrivate {
         GHashTable   *tracked_contacts;   /* UID -> ContactRecord */
 
 	GHashTable *zones;
-	icaltimezone *default_zone;
 
 	EFlag   *init_done_flag; /* is set, when the init thread gone */
 
@@ -106,7 +105,7 @@ static ECalComponent * create_anniversary (ECalBackendContacts *cbc, EContact *c
 static void contacts_changed_cb (EBookView *book_view, const GList *contacts, gpointer user_data);
 static void contacts_added_cb   (EBookView *book_view, const GList *contacts, gpointer user_data);
 static void contacts_removed_cb (EBookView *book_view, const GList *contact_ids, gpointer user_data);
-static void e_cal_backend_contacts_add_timezone (ECalBackendSync *backend, EDataCal *cal, const gchar *tzobj, GError **perror);
+static void e_cal_backend_contacts_add_timezone (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *tzobj, GError **perror);
 static void setup_alarm (ECalBackendContacts *cbc, ECalComponent *comp);
 
 /* BookRecord methods */
@@ -258,7 +257,7 @@ contact_record_free (ContactRecord *cr)
 typedef struct _ContactRecordCB {
         ECalBackendContacts *cbc;
         ECalBackendSExp     *sexp;
-        GList               *result;
+        GSList              *result;
 } ContactRecordCB;
 
 static ContactRecordCB *
@@ -276,8 +275,8 @@ contact_record_cb_new (ECalBackendContacts *cbc, ECalBackendSExp *sexp)
 static void
 contact_record_cb_free (ContactRecordCB *cb_data)
 {
-	g_list_foreach (cb_data->result, (GFunc) g_free, NULL);
-	g_list_free (cb_data->result);
+	g_slist_foreach (cb_data->result, (GFunc) g_free, NULL);
+	g_slist_free (cb_data->result);
 
 	g_free (cb_data);
 }
@@ -290,12 +289,12 @@ contact_record_cb (gpointer key, gpointer value, gpointer user_data)
 
 	if (record->comp_birthday && e_cal_backend_sexp_match_comp (cb_data->sexp, record->comp_birthday, E_CAL_BACKEND (cb_data->cbc))) {
 		gchar * comp_str = e_cal_component_get_as_string (record->comp_birthday);
-		cb_data->result = g_list_append (cb_data->result, comp_str);
+		cb_data->result = g_slist_append (cb_data->result, comp_str);
 	}
 
 	if (record->comp_anniversary && e_cal_backend_sexp_match_comp (cb_data->sexp, record->comp_anniversary, E_CAL_BACKEND (cb_data->cbc))) {
 		gchar * comp_str = e_cal_component_get_as_string (record->comp_anniversary);
-		cb_data->result = g_list_append (cb_data->result, comp_str);
+		cb_data->result = g_slist_append (cb_data->result, comp_str);
 	}
 }
 
@@ -792,8 +791,7 @@ create_anniversary (ECalBackendContacts *cbc, EContact *contact)
 /* First the empty stubs */
 
 static void
-e_cal_backend_contacts_get_cal_address (ECalBackendSync *backend, EDataCal *cal,
-					gchar **address, GError **perror)
+e_cal_backend_contacts_get_cal_email_address (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **address, GError **perror)
 {
 	/* A contact backend has no particular email address associated
 	 * with it (although that would be a useful feature some day).
@@ -802,14 +800,7 @@ e_cal_backend_contacts_get_cal_address (ECalBackendSync *backend, EDataCal *cal,
 }
 
 static void
-e_cal_backend_contacts_get_ldap_attribute (ECalBackendSync *backend, EDataCal *cal,
-					   gchar **attribute, GError **perror)
-{
-	*attribute = NULL;
-}
-
-static void
-e_cal_backend_contacts_get_alarm_email_address (ECalBackendSync *backend, EDataCal *cal,
+e_cal_backend_contacts_get_alarm_email_address (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable,
 						gchar **address, GError **perror)
 {
 	/* A contact backend has no particular email address associated
@@ -819,28 +810,28 @@ e_cal_backend_contacts_get_alarm_email_address (ECalBackendSync *backend, EDataC
 }
 
 static void
-e_cal_backend_contacts_get_static_capabilities (ECalBackendSync *backend, EDataCal *cal,
-						gchar **capabilities, GError **perror)
+e_cal_backend_contacts_get_capabilities (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable,
+					gchar **capabilities, GError **perror)
 {
 	*capabilities = NULL;
 }
 
 static void
-e_cal_backend_contacts_remove (ECalBackendSync *backend, EDataCal *cal, GError **perror)
+e_cal_backend_contacts_remove (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, GError **perror)
 {
 	/* WRITE ME */
 	g_propagate_error (perror, EDC_ERROR (PermissionDenied));
 }
 
 static void
-e_cal_backend_contacts_get_default_object (ECalBackendSync *backend, EDataCal *cal,
+e_cal_backend_contacts_get_default_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable,
 					   gchar **object, GError **perror)
 {
 	g_propagate_error (perror, EDC_ERROR (UnsupportedMethod));
 }
 
 static void
-e_cal_backend_contacts_get_object (ECalBackendSync *backend, EDataCal *cal,
+e_cal_backend_contacts_get_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable,
 				   const gchar *uid, const gchar *rid,
 				   gchar **object, GError **perror)
 {
@@ -889,9 +880,9 @@ e_cal_backend_contacts_get_object (ECalBackendSync *backend, EDataCal *cal,
 }
 
 static void
-e_cal_backend_contacts_get_free_busy (ECalBackendSync *backend, EDataCal *cal,
-				      GList *users, time_t start, time_t end,
-				      GList **freebusy, GError **perror)
+e_cal_backend_contacts_get_free_busy (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, 
+				      const GSList *users, time_t start, time_t end,
+				      GSList **freebusy, GError **perror)
 {
 	/* Birthdays/anniversaries don't count as busy time */
 
@@ -916,7 +907,7 @@ e_cal_backend_contacts_get_free_busy (ECalBackendSync *backend, EDataCal *cal,
 	icalcomponent_set_dtend (vfb, icaltime_from_timet_with_zone (end, FALSE, utc_zone));
 
 	calobj = icalcomponent_as_ical_string_r (vfb);
-	*freebusy = g_list_append (NULL, calobj);
+	*freebusy = g_slist_append (NULL, calobj);
 	icalcomponent_free (vfb);
 
 	/* WRITE ME */
@@ -924,30 +915,15 @@ e_cal_backend_contacts_get_free_busy (ECalBackendSync *backend, EDataCal *cal,
 }
 
 static void
-e_cal_backend_contacts_get_changes (ECalBackendSync *backend, EDataCal *cal,
-				    const gchar *change_id,
-				    GList **adds, GList **modifies, GList **deletes, GError **perror)
-{
-	/* WRITE ME */
-}
-
-static void
-e_cal_backend_contacts_discard_alarm (ECalBackendSync *backend, EDataCal *cal,
-				      const gchar *uid, const gchar *auid, GError **perror)
-{
-	/* WRITE ME */
-}
-
-static void
-e_cal_backend_contacts_receive_objects (ECalBackendSync *backend, EDataCal *cal,
+e_cal_backend_contacts_receive_objects (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable,
 					const gchar *calobj, GError **perror)
 {
 	g_propagate_error (perror, EDC_ERROR (PermissionDenied));
 }
 
 static void
-e_cal_backend_contacts_send_objects (ECalBackendSync *backend, EDataCal *cal,
-				     const gchar *calobj, GList **users, gchar **modified_calobj, GError **perror)
+e_cal_backend_contacts_send_objects (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable,
+				     const gchar *calobj, GSList **users, gchar **modified_calobj, GError **perror)
 {
 	*users = NULL;
 	*modified_calobj = NULL;
@@ -957,23 +933,11 @@ e_cal_backend_contacts_send_objects (ECalBackendSync *backend, EDataCal *cal,
 
 /* Then the real implementations */
 
-static CalMode
-e_cal_backend_contacts_get_mode (ECalBackend *backend)
-{
-	return CAL_MODE_LOCAL;
-}
-
 static void
-e_cal_backend_contacts_set_mode (ECalBackend *backend, CalMode mode)
+e_cal_backend_contacts_set_online (ECalBackend *backend, gboolean is_online)
 {
-	e_cal_backend_notify_mode (backend, ModeNotSupported, Local);
-}
-
-static void
-e_cal_backend_contacts_is_read_only (ECalBackendSync *backend, EDataCal *cal,
-				     gboolean *read_only, GError **perror)
-{
-	*read_only = TRUE;
+	e_cal_backend_notify_online (backend, is_online);
+	e_cal_backend_notify_readonly (backend, TRUE);
 }
 
 static gpointer
@@ -1004,9 +968,8 @@ init_sources_cb (ECalBackendContacts *cbc)
 }
 
 static void
-e_cal_backend_contacts_open (ECalBackendSync *backend, EDataCal *cal,
-			     gboolean only_if_exists,
-			     const gchar *username, const gchar *password, GError **perror)
+e_cal_backend_contacts_open (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable,
+			     gboolean only_if_exists, GError **perror)
 {
 	ECalBackendContacts *cbc = E_CAL_BACKEND_CONTACTS (backend);
 	ECalBackendContactsPrivate *priv = cbc->priv;
@@ -1015,15 +978,6 @@ e_cal_backend_contacts_open (ECalBackendSync *backend, EDataCal *cal,
 	if (priv->addressbook_loaded)
 		return;
 
-	if (priv->default_zone && priv->default_zone != icaltimezone_get_utc_timezone ()) {
-		icalcomponent *icalcomp = icaltimezone_get_component (priv->default_zone);
-		icaltimezone *zone = icaltimezone_new ();
-
-		icaltimezone_set_component (zone, icalcomponent_new_clone (icalcomp));
-
-		g_hash_table_insert (priv->zones, g_strdup (icaltimezone_get_tzid (zone)), zone);
-	}
-
 	/* initialize addressbook sources in new thread to make this function quick as much as possible */
 	if (!g_thread_create ((GThreadFunc)init_sources_cb, cbc, FALSE, &error)) {
 		e_flag_set (priv->init_done_flag);
@@ -1036,20 +990,14 @@ e_cal_backend_contacts_open (ECalBackendSync *backend, EDataCal *cal,
 	}
 
 	priv->addressbook_loaded = TRUE;
-}
-
-static gboolean
-e_cal_backend_contacts_is_loaded (ECalBackend *backend)
-{
-	ECalBackendContacts *cbc = E_CAL_BACKEND_CONTACTS (backend);
-	ECalBackendContactsPrivate *priv = cbc->priv;
-
-	return priv->addressbook_loaded;
+	e_cal_backend_set_is_loaded (E_CAL_BACKEND (backend), TRUE);
+	e_cal_backend_notify_readonly (E_CAL_BACKEND (backend), TRUE);
+	e_cal_backend_notify_online (E_CAL_BACKEND (backend), TRUE);
 }
 
 /* Add_timezone handler for the file backend */
 static void
-e_cal_backend_contacts_add_timezone (ECalBackendSync *backend, EDataCal *cal, const gchar *tzobj, GError **error)
+e_cal_backend_contacts_add_timezone (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *tzobj, GError **error)
 {
 	ECalBackendContacts *cbcontacts;
 	ECalBackendContactsPrivate *priv;
@@ -1087,39 +1035,8 @@ e_cal_backend_contacts_add_timezone (ECalBackendSync *backend, EDataCal *cal, co
 }
 
 static void
-e_cal_backend_contacts_set_default_zone (ECalBackendSync *backend, EDataCal *cal, const gchar *tzobj, GError **error)
-{
-	icalcomponent *tz_comp;
-	ECalBackendContacts *cbcontacts;
-	ECalBackendContactsPrivate *priv;
-	icaltimezone *zone;
-
-	cbcontacts = (ECalBackendContacts *) backend;
-
-	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_CONTACTS (cbcontacts), InvalidArg);
-	e_return_data_cal_error_if_fail (tzobj != NULL, InvalidArg);
-
-	priv = cbcontacts->priv;
-
-	tz_comp = icalparser_parse_string (tzobj);
-	if (!tz_comp) {
-		g_propagate_error (error, EDC_ERROR (InvalidObject));
-		return;
-	}
-
-	zone = icaltimezone_new ();
-	icaltimezone_set_component (zone, tz_comp);
-
-	if (priv->default_zone && priv->default_zone != icaltimezone_get_utc_timezone ())
-		icaltimezone_free (priv->default_zone, 1);
-
-	/* Set the default timezone to it. */
-	priv->default_zone = zone;
-}
-
-static void
-e_cal_backend_contacts_get_object_list (ECalBackendSync *backend, EDataCal *cal,
-					const gchar *sexp_string, GList **objects, GError **perror)
+e_cal_backend_contacts_get_object_list (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable,
+					const gchar *sexp_string, GSList **objects, GError **perror)
 {
 	ECalBackendContacts *cbc = E_CAL_BACKEND_CONTACTS (backend);
 	ECalBackendContactsPrivate *priv = cbc->priv;
@@ -1141,7 +1058,7 @@ e_cal_backend_contacts_get_object_list (ECalBackendSync *backend, EDataCal *cal,
 }
 
 static void
-e_cal_backend_contacts_start_query (ECalBackend *backend, EDataCalView *query)
+e_cal_backend_contacts_start_view (ECalBackend *backend, EDataCalView *query)
 {
 	ECalBackendContacts *cbc = E_CAL_BACKEND_CONTACTS (backend);
 	ECalBackendContactsPrivate *priv = cbc->priv;
@@ -1151,7 +1068,7 @@ e_cal_backend_contacts_start_query (ECalBackend *backend, EDataCalView *query)
 	sexp = e_data_cal_view_get_object_sexp (query);
 	if (!sexp) {
 		GError *error = EDC_ERROR (InvalidQuery);
-		e_data_cal_view_notify_done (query, error);
+		e_data_cal_view_notify_complete (query, error);
 		g_error_free (error);
 		return;
 	}
@@ -1163,15 +1080,7 @@ e_cal_backend_contacts_start_query (ECalBackend *backend, EDataCalView *query)
 
 	contact_record_cb_free (cb_data);
 
-	e_data_cal_view_notify_done (query, NULL /* Success */);
-}
-
-static icaltimezone *
-e_cal_backend_contacts_internal_get_default_timezone (ECalBackend *backend)
-{
-	ECalBackendContacts *cbc = E_CAL_BACKEND_CONTACTS (backend);
-
-	return cbc->priv->default_zone;
+	e_data_cal_view_notify_complete (query, NULL /* Success */);
 }
 
 static icaltimezone *
@@ -1179,7 +1088,7 @@ e_cal_backend_contacts_internal_get_timezone (ECalBackend *backend, const gchar
 {
 	ECalBackendContacts *cbc = E_CAL_BACKEND_CONTACTS (backend);
 
-	return cbc->priv->default_zone;
+	return g_hash_table_lookup (cbc->priv->zones, tzid ? tzid : "");
 }
 
 /***********************************************************************************
@@ -1215,11 +1124,6 @@ e_cal_backend_contacts_finalize (GObject *object)
 		priv->update_alarms_id = 0;
 	}
 
-	if (priv->default_zone && priv->default_zone != icaltimezone_get_utc_timezone ()) {
-		icaltimezone_free (priv->default_zone, 1);
-	}
-
-	priv->default_zone = NULL;
 	g_object_unref (priv->addressbook_sources);
 	g_hash_table_destroy (priv->addressbooks);
 	g_hash_table_destroy (priv->tracked_contacts);
@@ -1256,7 +1160,6 @@ e_cal_backend_contacts_init (ECalBackendContacts *cbc)
 							g_free, (GDestroyNotify)contact_record_free);
 
 	priv->zones = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, free_zone);
-	priv->default_zone = icaltimezone_get_utc_timezone ();
 	priv->init_done_flag = e_flag_new ();
 	priv->conf_client = gconf_client_get_default ();
 	priv->notifyid1 = 0;
@@ -1273,7 +1176,7 @@ e_cal_backend_contacts_init (ECalBackendContacts *cbc)
 }
 
 static void
-e_cal_backend_contacts_create_object (ECalBackendSync *backend, EDataCal *cal, gchar **calobj, gchar **uid, GError **perror)
+e_cal_backend_contacts_create_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, gchar **uid, gchar **new_calobj, GError **perror)
 {
 	g_propagate_error (perror, EDC_ERROR (PermissionDenied));
 }
@@ -1294,29 +1197,22 @@ e_cal_backend_contacts_class_init (ECalBackendContactsClass *class)
 
 	object_class->finalize = e_cal_backend_contacts_finalize;
 
-	sync_class->is_read_only_sync = e_cal_backend_contacts_is_read_only;
-	sync_class->get_cal_address_sync = e_cal_backend_contacts_get_cal_address;
+	sync_class->get_cal_email_address_sync = e_cal_backend_contacts_get_cal_email_address;
 	sync_class->get_alarm_email_address_sync = e_cal_backend_contacts_get_alarm_email_address;
-	sync_class->get_ldap_attribute_sync = e_cal_backend_contacts_get_ldap_attribute;
-	sync_class->get_static_capabilities_sync = e_cal_backend_contacts_get_static_capabilities;
+	sync_class->get_capabilities_sync = e_cal_backend_contacts_get_capabilities;
 	sync_class->open_sync = e_cal_backend_contacts_open;
 	sync_class->remove_sync = e_cal_backend_contacts_remove;
 	sync_class->create_object_sync = e_cal_backend_contacts_create_object;
-	sync_class->discard_alarm_sync = e_cal_backend_contacts_discard_alarm;
 	sync_class->receive_objects_sync = e_cal_backend_contacts_receive_objects;
 	sync_class->send_objects_sync = e_cal_backend_contacts_send_objects;
 	sync_class->get_default_object_sync = e_cal_backend_contacts_get_default_object;
 	sync_class->get_object_sync = e_cal_backend_contacts_get_object;
 	sync_class->get_object_list_sync = e_cal_backend_contacts_get_object_list;
 	sync_class->add_timezone_sync = e_cal_backend_contacts_add_timezone;
-	sync_class->set_default_zone_sync = e_cal_backend_contacts_set_default_zone;
-	sync_class->get_freebusy_sync = e_cal_backend_contacts_get_free_busy;
-	sync_class->get_changes_sync = e_cal_backend_contacts_get_changes;
-	backend_class->is_loaded = e_cal_backend_contacts_is_loaded;
-	backend_class->start_query = e_cal_backend_contacts_start_query;
-	backend_class->get_mode = e_cal_backend_contacts_get_mode;
-	backend_class->set_mode = e_cal_backend_contacts_set_mode;
-
-	backend_class->internal_get_default_timezone = e_cal_backend_contacts_internal_get_default_timezone;
+	sync_class->get_free_busy_sync = e_cal_backend_contacts_get_free_busy;
+
+	backend_class->start_view = e_cal_backend_contacts_start_view;
+	backend_class->set_online = e_cal_backend_contacts_set_online;
+
 	backend_class->internal_get_timezone = e_cal_backend_contacts_internal_get_timezone;
 }
diff --git a/calendar/backends/file/e-cal-backend-file.c b/calendar/backends/file/e-cal-backend-file.c
index 7aff3f6..270ae11 100644
--- a/calendar/backends/file/e-cal-backend-file.c
+++ b/calendar/backends/file/e-cal-backend-file.c
@@ -93,10 +93,6 @@ struct _ECalBackendFilePrivate {
 
 	GList *comp;
 
-	/* The calendar's default timezone, used for resolving DATE and
-	   floating DATE-TIME values. */
-	icaltimezone *default_zone;
-
 	/* a custom filename opened */
 	gchar *custom_file;
 
@@ -127,17 +123,11 @@ static void e_cal_backend_file_finalize (GObject *object);
 
 static ECalBackendSyncClass *parent_class;
 
-static void
-e_cal_backend_file_add_timezone (ECalBackendSync *backend, EDataCal *cal, const gchar *tzobj, GError **perror);
-
 static void free_refresh_data (ECalBackendFile *cbfile);
 
 static icaltimezone *
 e_cal_backend_file_internal_get_timezone (ECalBackend *backend, const gchar *tzid);
 
-static icaltimezone *
-e_cal_backend_file_internal_get_default_timezone (ECalBackend *backend);
-
 /* g_hash_table_foreach() callback to destroy a ECalBackendFileObject */
 static void
 free_object_data (gpointer data)
@@ -371,11 +361,6 @@ e_cal_backend_file_finalize (GObject *object)
 	g_free (priv->custom_file);
 	priv->custom_file = NULL;
 
-	if (priv->default_zone && priv->default_zone != icaltimezone_get_utc_timezone ()) {
-		icaltimezone_free (priv->default_zone, 1);
-	}
-	priv->default_zone = NULL;
-
 	if (priv->file_name) {
 		g_free (priv->file_name);
 		priv->file_name = NULL;
@@ -406,18 +391,9 @@ lookup_component (ECalBackendFile *cbfile, const gchar *uid)
 
 /* Calendar backend methods */
 
-/* Is_read_only handler for the file backend */
-static void
-e_cal_backend_file_is_read_only (ECalBackendSync *backend, EDataCal *cal, gboolean *read_only, GError **perror)
-{
-	ECalBackendFile *cbfile = (ECalBackendFile *) backend;
-
-	*read_only = cbfile->priv->read_only;
-}
-
 /* Get_email_address handler for the file backend */
 static void
-e_cal_backend_file_get_cal_address (ECalBackendSync *backend, EDataCal *cal, gchar **address, GError **perror)
+e_cal_backend_file_get_cal_email_address (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **address, GError **perror)
 {
 	/* A file backend has no particular email address associated
 	 * with it (although that would be a useful feature some day).
@@ -426,13 +402,7 @@ e_cal_backend_file_get_cal_address (ECalBackendSync *backend, EDataCal *cal, gch
 }
 
 static void
-e_cal_backend_file_get_ldap_attribute (ECalBackendSync *backend, EDataCal *cal, gchar **attribute, GError **perror)
-{
-	*attribute = NULL;
-}
-
-static void
-e_cal_backend_file_get_alarm_email_address (ECalBackendSync *backend, EDataCal *cal, gchar **address, GError **perror)
+e_cal_backend_file_get_alarm_email_address (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **address, GError **perror)
 {
 	/* A file backend has no particular email address associated
 	 * with it (although that would be a useful feature some day).
@@ -441,7 +411,7 @@ e_cal_backend_file_get_alarm_email_address (ECalBackendSync *backend, EDataCal *
 }
 
 static void
-e_cal_backend_file_get_static_capabilities (ECalBackendSync *backend, EDataCal *cal, gchar **capabilities, GError **perror)
+e_cal_backend_file_get_capabilities (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **capabilities, GError **perror)
 {
 	*capabilities = g_strdup (CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS ","
 				  CAL_STATIC_CAPABILITY_NO_THISANDFUTURE ","
@@ -533,7 +503,7 @@ add_component_to_intervaltree (ECalBackendFile *cbfile, ECalComponent *comp)
 	priv = cbfile->priv;
 
 	e_cal_util_get_component_occur_times (comp, &time_start, &time_end,
-				   resolve_tzid, priv->icalcomp, priv->default_zone,
+				   resolve_tzid, priv->icalcomp, icaltimezone_get_utc_timezone (),
 				   e_cal_backend_get_kind (E_CAL_BACKEND (cbfile)));
 
 	if (time_end != -1 && time_start > time_end)
@@ -991,6 +961,8 @@ open_cal (ECalBackendFile *cbfile, const gchar *uristr, GError **perror)
 	scan_vcalendar (cbfile);
 
 	prepare_refresh_data (cbfile);
+
+	e_cal_backend_set_is_loaded (E_CAL_BACKEND (cbfile), TRUE);
 }
 
 typedef struct
@@ -1147,6 +1119,8 @@ reload_cal (ECalBackendFile *cbfile, const gchar *uristr, GError **perror)
 	/* Free old data */
 
 	free_calendar_components (comp_uid_hash_old, icalcomp_old);
+
+	e_cal_backend_set_is_loaded (E_CAL_BACKEND (cbfile), TRUE);
 }
 
 static void
@@ -1183,6 +1157,8 @@ create_cal (ECalBackendFile *cbfile, const gchar *uristr, GError **perror)
 	g_free (priv->custom_file);
 	priv->custom_file = g_strdup (uristr);
 	prepare_refresh_data (cbfile);
+
+	e_cal_backend_set_is_loaded (E_CAL_BACKEND (cbfile), TRUE);
 }
 
 static gchar *
@@ -1197,104 +1173,6 @@ get_uri_string (ECalBackend *backend)
 	return full_uri;
 }
 
-static gboolean
-add_timezone (icalcomponent *icalcomp, icaltimezone *tzone)
-{
-	GSList *to_remove = NULL, *r;
-	icalcomponent *subcomp;
-	icaltimezone *zone;
-	gboolean add = TRUE, have_same = FALSE;
-	const gchar *tzid;
-	gchar *cmp;
-
-	g_return_val_if_fail (icalcomp != NULL, FALSE);
-
-	/* it's fine to have passed in NULL tzcomp; for example UTC timezone does this */
-	if (!tzone || !icaltimezone_get_component (tzone))
-		return FALSE;
-
-	tzid = icaltimezone_get_tzid (tzone);
-	if (!tzid)
-		return FALSE;
-
-	cmp = icalcomponent_as_ical_string_r (icaltimezone_get_component (tzone));
-	zone = icaltimezone_new ();
-
-	for (subcomp = icalcomponent_get_first_component (icalcomp, ICAL_VTIMEZONE_COMPONENT);
-	     subcomp;
-	     subcomp = icalcomponent_get_next_component (icalcomp, ICAL_VTIMEZONE_COMPONENT)) {
-		if (!icaltimezone_set_component (zone, icalcomponent_new_clone (subcomp))) {
-			to_remove = g_slist_prepend (to_remove, subcomp);
-		} else if (icaltimezone_get_tzid (zone) && g_str_equal (tzid, icaltimezone_get_tzid (zone))) {
-			/* there is a timezone component with the same tzid already */
-			if (have_same) {
-				to_remove = g_slist_prepend (to_remove, subcomp);
-			} else {
-				gchar *str = icalcomponent_as_ical_string_r (subcomp);
-
-				/* not the best way how to compare two components, but don't have better */
-				if (str && g_str_equal (cmp, str)) {
-					have_same = TRUE;
-					add = FALSE;
-				} else {
-					to_remove = g_slist_prepend (to_remove, subcomp);
-				}
-
-				g_free (str);
-			}
-		}
-	}
-
-	g_free (cmp);
-
-	for (r = to_remove; r; r = r->next) {
-		icalcomponent_remove_component (icalcomp, r->data);
-	}
-
-	if (g_slist_length (to_remove) > 1) {
-		/* there were more than once tzid as this,
-		   thus check for duplicities for all of timezones there */
-		GHashTable *known = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
-		GSList *rem2 = NULL;
-
-		for (subcomp = icalcomponent_get_first_component (icalcomp, ICAL_VTIMEZONE_COMPONENT);
-		     subcomp;
-		     subcomp = icalcomponent_get_next_component (icalcomp, ICAL_VTIMEZONE_COMPONENT)) {
-			if (!icaltimezone_set_component (zone, icalcomponent_new_clone (subcomp))) {
-				rem2 = g_slist_prepend (rem2, subcomp);
-			} else {
-				const gchar *tzid2 = icaltimezone_get_tzid (zone);
-
-				/* check all but not the one which was checked above */
-				if (tzid2 && !g_str_equal (tzid, tzid2)) {
-					if (g_hash_table_lookup (known, tzid2) == NULL) {
-						/* the first component of this tzid, keep it */
-						g_hash_table_insert (known, g_strdup (tzid2), GINT_TO_POINTER (1));
-					} else {
-						/* it's there already, remove it */
-						rem2 = g_slist_prepend (rem2, subcomp);
-					}
-				}
-			}
-		}
-
-		for (r = rem2; r; r = r->next) {
-			icalcomponent_remove_component (icalcomp, r->data);
-		}
-
-		g_slist_free (rem2);
-		g_hash_table_unref (known);
-	}
-
-	icaltimezone_free (zone, TRUE);
-	g_slist_free (to_remove);
-
-	if (add)
-		icalcomponent_add_component (icalcomp, icalcomponent_new_clone (icaltimezone_get_component (tzone)));
-
-	return add || to_remove != NULL;
-}
-
 static void
 source_changed_cb (ESource *source, ECalBackend *backend)
 {
@@ -1334,8 +1212,7 @@ source_changed_cb (ESource *source, ECalBackend *backend)
 
 /* Open handler for the file backend */
 static void
-e_cal_backend_file_open (ECalBackendSync *backend, EDataCal *cal, gboolean only_if_exists,
-			 const gchar *username, const gchar *password, GError **perror)
+e_cal_backend_file_open (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gboolean only_if_exists, GError **perror)
 {
 	ECalBackendFile *cbfile;
 	ECalBackendFilePrivate *priv;
@@ -1381,23 +1258,21 @@ e_cal_backend_file_open (ECalBackendSync *backend, EDataCal *cal, gboolean only_
 					priv->read_only = TRUE;
 			}
 		}
-
-		if (priv->default_zone && add_timezone (priv->icalcomp, priv->default_zone)) {
-			save (cbfile);
-		}
 	}
 
 	g_free (str_uri);
 
   done:
 	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+	e_cal_backend_notify_readonly (E_CAL_BACKEND (backend), priv->read_only);
+	e_cal_backend_notify_online (E_CAL_BACKEND (backend), TRUE);
 
 	if (err)
 		g_propagate_error (perror, err);
 }
 
 static void
-e_cal_backend_file_remove (ECalBackendSync *backend, EDataCal *cal, GError **perror)
+e_cal_backend_file_remove (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, GError **perror)
 {
 	ECalBackendFile *cbfile;
 	ECalBackendFilePrivate *priv;
@@ -1441,6 +1316,11 @@ e_cal_backend_file_remove (ECalBackendSync *backend, EDataCal *cal, GError **per
 		full_path = NULL;
 	}
 
+	if (dir) {
+		g_dir_close (dir);
+		dir = NULL;
+	}
+
 	/* remove the directory itself */
 	if (g_rmdir (dirname) != 0) {
 		err = EDC_ERROR (OtherError);
@@ -1448,54 +1328,35 @@ e_cal_backend_file_remove (ECalBackendSync *backend, EDataCal *cal, GError **per
 
   done:
 	if (dir) {
-	    g_dir_close (dir);
+		g_dir_close (dir);
+		dir = NULL;
 	}
-	g_free (str_uri);
-	g_free (dirname);
-	g_free (full_path);
-
-	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
 
 	/* lie here a bit, but otherwise the calendar will not be removed, even it should */
 	if (err) {
-		g_print (G_STRLOC ": %s", err->message);
+		g_print (G_STRLOC ": %s on dir '%s' from uri '%s'\n", err->message, dirname, str_uri);
 		g_error_free (err);
 	}
 
-	if (error)
-		g_error_free (error);
-}
-
-/* is_loaded handler for the file backend */
-static gboolean
-e_cal_backend_file_is_loaded (ECalBackend *backend)
-{
-	ECalBackendFile *cbfile;
-	ECalBackendFilePrivate *priv;
-
-	cbfile = E_CAL_BACKEND_FILE (backend);
-	priv = cbfile->priv;
+	g_free (str_uri);
+	g_free (dirname);
+	g_free (full_path);
 
-	return (priv->icalcomp != NULL);
-}
+	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
 
-/* is_remote handler for the file backend */
-static CalMode
-e_cal_backend_file_get_mode (ECalBackend *backend)
-{
-	return CAL_MODE_LOCAL;
+	if (error)
+		g_error_free (error);
 }
 
 /* Set_mode handler for the file backend */
 static void
-e_cal_backend_file_set_mode (ECalBackend *backend, CalMode mode)
+e_cal_backend_file_set_online (ECalBackend *backend, gboolean is_online)
 {
-	e_cal_backend_notify_mode (backend, ModeNotSupported, Local);
-
+	e_cal_backend_notify_online (backend, TRUE);
 }
 
 static void
-e_cal_backend_file_get_default_object (ECalBackendSync *backend, EDataCal *cal, gchar **object, GError **perror)
+e_cal_backend_file_get_default_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **object, GError **perror)
 {
 	ECalComponent *comp;
 
@@ -1534,7 +1395,7 @@ add_detached_recur_to_vcalendar (gpointer key, gpointer value, gpointer user_dat
 
 /* Get_object_component handler for the file backend */
 static void
-e_cal_backend_file_get_object (ECalBackendSync *backend, EDataCal *cal, const gchar *uid, const gchar *rid, gchar **object, GError **error)
+e_cal_backend_file_get_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, gchar **object, GError **error)
 {
 	ECalBackendFile *cbfile;
 	ECalBackendFilePrivate *priv;
@@ -1614,7 +1475,7 @@ e_cal_backend_file_get_object (ECalBackendSync *backend, EDataCal *cal, const gc
 
 /* Add_timezone handler for the file backend */
 static void
-e_cal_backend_file_add_timezone (ECalBackendSync *backend, EDataCal *cal, const gchar *tzobj, GError **error)
+e_cal_backend_file_add_timezone (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *tzobj, GError **error)
 {
 	icalcomponent *tz_comp;
 	ECalBackendFile *cbfile;
@@ -1651,46 +1512,12 @@ e_cal_backend_file_add_timezone (ECalBackendSync *backend, EDataCal *cal, const
 	}
 }
 
-static void
-e_cal_backend_file_set_default_zone (ECalBackendSync *backend, EDataCal *cal, const gchar *tzobj, GError **error)
-{
-	icalcomponent *tz_comp;
-	ECalBackendFile *cbfile;
-	ECalBackendFilePrivate *priv;
-	icaltimezone *zone;
-
-	cbfile = (ECalBackendFile *) backend;
-
-	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_FILE (cbfile), InvalidArg);
-	e_return_data_cal_error_if_fail (tzobj != NULL, InvalidArg);
-
-	priv = cbfile->priv;
-
-	tz_comp = icalparser_parse_string (tzobj);
-	if (!tz_comp) {
-		g_propagate_error (error, EDC_ERROR (InvalidObject));
-		return;
-	}
-
-	zone = icaltimezone_new ();
-	icaltimezone_set_component (zone, tz_comp);
-
-	g_static_rec_mutex_lock (&priv->idle_save_rmutex);
-	if (priv->default_zone != icaltimezone_get_utc_timezone ())
-		icaltimezone_free (priv->default_zone, 1);
-
-	/* Set the default timezone to it. */
-	priv->default_zone = zone;
-	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
-}
-
 typedef struct {
-	GList *obj_list;
+	GSList *obj_list;
 	gboolean search_needed;
 	const gchar *query;
 	ECalBackendSExp *obj_sexp;
 	ECalBackend *backend;
-	icaltimezone *default_zone;
 } MatchObjectData;
 
 static void
@@ -1715,8 +1542,7 @@ match_object_sexp_to_component (gpointer value, gpointer data)
 
 	if ((!match_data->search_needed) ||
 	    (e_cal_backend_sexp_match_comp (match_data->obj_sexp, comp, match_data->backend))) {
-		match_data->obj_list = g_list_append (match_data->obj_list,
-						      e_cal_component_get_as_string (comp));
+		match_data->obj_list = g_slist_append (match_data->obj_list, e_cal_component_get_as_string (comp));
 	}
 }
 
@@ -1728,8 +1554,7 @@ match_recurrence_sexp (gpointer key, gpointer value, gpointer data)
 
 	if ((!match_data->search_needed) ||
 	    (e_cal_backend_sexp_match_comp (match_data->obj_sexp, comp, match_data->backend))) {
-		match_data->obj_list = g_list_append (match_data->obj_list,
-						      e_cal_component_get_as_string (comp));
+		match_data->obj_list = g_slist_append (match_data->obj_list, e_cal_component_get_as_string (comp));
 	}
 }
 
@@ -1742,8 +1567,7 @@ match_object_sexp (gpointer key, gpointer value, gpointer data)
 	if (obj_data->full_object) {
 		if ((!match_data->search_needed) ||
 		    (e_cal_backend_sexp_match_comp (match_data->obj_sexp, obj_data->full_object, match_data->backend))) {
-			match_data->obj_list = g_list_append (match_data->obj_list,
-							      e_cal_component_get_as_string (obj_data->full_object));
+			match_data->obj_list = g_slist_append (match_data->obj_list, e_cal_component_get_as_string (obj_data->full_object));
 		}
 	}
 
@@ -1755,7 +1579,7 @@ match_object_sexp (gpointer key, gpointer value, gpointer data)
 
 /* Get_objects_in_range handler for the file backend */
 static void
-e_cal_backend_file_get_object_list (ECalBackendSync *backend, EDataCal *cal, const gchar *sexp, GList **objects, GError **perror)
+e_cal_backend_file_get_object_list (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *sexp, GSList **objects, GError **perror)
 {
 	ECalBackendFile *cbfile;
 	ECalBackendFilePrivate *priv;
@@ -1772,7 +1596,6 @@ e_cal_backend_file_get_object_list (ECalBackendSync *backend, EDataCal *cal, con
 	match_data.query = sexp;
 	match_data.obj_list = NULL;
 	match_data.backend = E_CAL_BACKEND (backend);
-	match_data.default_zone = priv->default_zone;
 
 	if (!strcmp (sexp, "#t"))
 		match_data.search_needed = FALSE;
@@ -1814,17 +1637,124 @@ e_cal_backend_file_get_object_list (ECalBackendSync *backend, EDataCal *cal, con
 	g_object_unref (match_data.obj_sexp);
 }
 
+static void
+add_attach_uris (GSList **attachment_uris, icalcomponent *icalcomp)
+{
+	icalproperty *prop;
+
+	g_return_if_fail (attachment_uris != NULL);
+	g_return_if_fail (icalcomp != NULL);
+
+	for (prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTACH_PROPERTY);
+	     prop;
+	     prop = icalcomponent_get_next_property (icalcomp, ICAL_ATTACH_PROPERTY)) {
+		icalattach *attach = icalproperty_get_attach (prop);
+
+		if (attach && icalattach_get_is_url (attach)) {
+			const gchar *url;
+
+			url = icalattach_get_url (attach);
+			if (url) {
+				gsize buf_size;
+				gchar *buf;
+
+				buf_size = strlen (url);
+				buf = g_malloc0 (buf_size + 1);
+
+				icalvalue_decode_ical_string (url, buf, buf_size);
+
+				*attachment_uris = g_slist_prepend (*attachment_uris, g_strdup (buf));
+
+				g_free (buf);
+			}
+		}
+	}
+}
+
+static void
+add_detached_recur_attach_uris (gpointer key, gpointer value, gpointer user_data)
+{
+	ECalComponent *recurrence = value;
+	GSList **attachment_uris = user_data;
+
+	add_attach_uris (attachment_uris, e_cal_component_get_icalcomponent (recurrence));
+}
+
 /* Gets the list of attachments */
 static void
-e_cal_backend_file_get_attachment_list (ECalBackendSync *backend, EDataCal *cal, const gchar *uid, const gchar *rid, GSList **list, GError **perror)
+e_cal_backend_file_get_attachment_uris (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, GSList **attachment_uris, GError **error)
 {
+	ECalBackendFile *cbfile;
+	ECalBackendFilePrivate *priv;
+	ECalBackendFileObject *obj_data;
 
-	/* TODO implement the function */
+	cbfile = E_CAL_BACKEND_FILE (backend);
+	priv = cbfile->priv;
+
+	e_return_data_cal_error_if_fail (priv->icalcomp != NULL, InvalidObject);
+	e_return_data_cal_error_if_fail (uid != NULL, ObjectNotFound);
+	e_return_data_cal_error_if_fail (attachment_uris != NULL, InvalidArg);
+	g_assert (priv->comp_uid_hash != NULL);
+
+	g_static_rec_mutex_lock (&priv->idle_save_rmutex);
+
+	obj_data = g_hash_table_lookup (priv->comp_uid_hash, uid);
+	if (!obj_data) {
+		g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+		g_propagate_error (error, EDC_ERROR (ObjectNotFound));
+		return;
+	}
+
+	if (rid && *rid) {
+		ECalComponent *comp;
+
+		comp = g_hash_table_lookup (obj_data->recurrences, rid);
+		if (comp) {
+			add_attach_uris (attachment_uris, e_cal_component_get_icalcomponent (comp));
+		} else {
+			icalcomponent *icalcomp;
+			struct icaltimetype itt;
+
+			if (!obj_data->full_object) {
+				g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+				g_propagate_error (error, EDC_ERROR (ObjectNotFound));
+				return;
+			}
+
+			itt = icaltime_from_string (rid);
+			icalcomp = e_cal_util_construct_instance (
+				e_cal_component_get_icalcomponent (obj_data->full_object),
+				itt);
+			if (!icalcomp) {
+				g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+				g_propagate_error (error, EDC_ERROR (ObjectNotFound));
+				return;
+			}
+
+			add_attach_uris (attachment_uris, icalcomp);
+
+			icalcomponent_free (icalcomp);
+		}
+	} else {
+		if (g_hash_table_size (obj_data->recurrences) > 0) {
+			/* detached recurrences don't have full_object */
+			if (obj_data->full_object)
+				add_attach_uris (attachment_uris, e_cal_component_get_icalcomponent (obj_data->full_object));
+
+			/* add all detached recurrences */
+			g_hash_table_foreach (obj_data->recurrences, add_detached_recur_attach_uris, attachment_uris);
+		} else if (obj_data->full_object)
+			add_attach_uris (attachment_uris, e_cal_component_get_icalcomponent (obj_data->full_object));
+	}
+
+	*attachment_uris = g_slist_reverse (*attachment_uris);
+
+	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
 }
 
 /* get_query handler for the file backend */
 static void
-e_cal_backend_file_start_query (ECalBackend *backend, EDataCalView *query)
+e_cal_backend_file_start_view (ECalBackend *backend, EDataCalView *query)
 {
 	ECalBackendFile *cbfile;
 	ECalBackendFilePrivate *priv;
@@ -1842,7 +1772,6 @@ e_cal_backend_file_start_query (ECalBackend *backend, EDataCalView *query)
 	match_data.query = e_data_cal_view_get_text (query);
 	match_data.obj_list = NULL;
 	match_data.backend = backend;
-	match_data.default_zone = priv->default_zone;
 	match_data.obj_sexp = e_data_cal_view_get_object_sexp (query);
 
 	if (!strcmp (match_data.query, "#t"))
@@ -1850,7 +1779,7 @@ e_cal_backend_file_start_query (ECalBackend *backend, EDataCalView *query)
 
 	if (!match_data.obj_sexp) {
 		GError *error = EDC_ERROR (InvalidQuery);
-		e_data_cal_view_notify_done (query, error);
+		e_data_cal_view_notify_complete (query, error);
 		g_error_free (error);
 		return;
 	}
@@ -1887,11 +1816,11 @@ e_cal_backend_file_start_query (ECalBackend *backend, EDataCalView *query)
 
 	/* notify listeners of all objects */
 	if (match_data.obj_list) {
-		e_data_cal_view_notify_objects_added (query, (const GList *) match_data.obj_list);
+		e_data_cal_view_notify_objects_added (query, match_data.obj_list);
 
 		/* free memory */
-		g_list_foreach (match_data.obj_list, (GFunc) g_free, NULL);
-		g_list_free (match_data.obj_list);
+		g_slist_foreach (match_data.obj_list, (GFunc) g_free, NULL);
+		g_slist_free (match_data.obj_list);
 	}
 
 	if (objs_occuring_in_tw) {
@@ -1900,7 +1829,7 @@ e_cal_backend_file_start_query (ECalBackend *backend, EDataCalView *query)
 	}
 	g_object_unref (match_data.obj_sexp);
 
-	e_data_cal_view_notify_done (query, NULL /* Success */);
+	e_data_cal_view_notify_complete (query, NULL /* Success */);
 }
 
 static gboolean
@@ -2005,7 +1934,7 @@ create_user_free_busy (ECalBackendFile *cbfile, const gchar *address, const gcha
 						vfb,
 						resolve_tzid,
 						vcalendar_comp,
-						priv->default_zone);
+						icaltimezone_get_utc_timezone ());
 	}
 	g_object_unref (obj_sexp);
 
@@ -2014,15 +1943,15 @@ create_user_free_busy (ECalBackendFile *cbfile, const gchar *address, const gcha
 
 /* Get_free_busy handler for the file backend */
 static void
-e_cal_backend_file_get_free_busy (ECalBackendSync *backend, EDataCal *cal, GList *users,
-				time_t start, time_t end, GList **freebusy, GError **error)
+e_cal_backend_file_get_free_busy (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const GSList *users,
+				time_t start, time_t end, GSList **freebusy, GError **error)
 {
 	ECalBackendFile *cbfile;
 	ECalBackendFilePrivate *priv;
 	gchar *address, *name;
 	icalcomponent *vfb;
 	gchar *calobj;
-	GList *l;
+	const GSList *l;
 
 	cbfile = E_CAL_BACKEND_FILE (backend);
 	priv = cbfile->priv;
@@ -2039,7 +1968,7 @@ e_cal_backend_file_get_free_busy (ECalBackendSync *backend, EDataCal *cal, GList
 		if (e_cal_backend_mail_account_get_default (&address, &name)) {
 			vfb = create_user_free_busy (cbfile, address, name, start, end);
 			calobj = icalcomponent_as_ical_string_r (vfb);
-			*freebusy = g_list_append (*freebusy, calobj);
+			*freebusy = g_slist_append (*freebusy, calobj);
 			icalcomponent_free (vfb);
 			g_free (address);
 			g_free (name);
@@ -2050,7 +1979,7 @@ e_cal_backend_file_get_free_busy (ECalBackendSync *backend, EDataCal *cal, GList
 			if (e_cal_backend_mail_account_is_valid (address, &name)) {
 				vfb = create_user_free_busy (cbfile, address, name, start, end);
 				calobj = icalcomponent_as_ical_string_r (vfb);
-				*freebusy = g_list_append (*freebusy, calobj);
+				*freebusy = g_slist_append (*freebusy, calobj);
 				icalcomponent_free (vfb);
 				g_free (name);
 			}
@@ -2060,145 +1989,6 @@ e_cal_backend_file_get_free_busy (ECalBackendSync *backend, EDataCal *cal, GList
 	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
 }
 
-typedef struct
-{
-	ECalBackendFile *backend;
-	icalcomponent_kind kind;
-	GList *deletes;
-	EXmlHash *ehash;
-} ECalBackendFileComputeChangesData;
-
-static gboolean
-e_cal_backend_file_compute_changes_foreach_key (const gchar *key, gpointer value, gpointer data)
-{
-	ECalBackendFileComputeChangesData *be_data = data;
-
-	if (!lookup_component (be_data->backend, key)) {
-		ECalComponent *comp;
-
-		comp = e_cal_component_new ();
-		if (be_data->kind == ICAL_VTODO_COMPONENT)
-			e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_TODO);
-		else
-			e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_EVENT);
-
-		e_cal_component_set_uid (comp, key);
-		be_data->deletes = g_list_prepend (be_data->deletes, e_cal_component_get_as_string (comp));
-
-		g_object_unref (comp);
-		return TRUE;
-	}
-	return FALSE;
-}
-
-static void
-e_cal_backend_file_compute_changes (ECalBackendFile *cbfile, const gchar *change_id,
-				    GList **adds, GList **modifies, GList **deletes, GError **perror)
-{
-	ECalBackendFilePrivate *priv;
-	gchar    *filename;
-	EXmlHash *ehash;
-	ECalBackendFileComputeChangesData be_data;
-	GList *i;
-	gchar *unescaped_uri;
-
-	priv = cbfile->priv;
-
-	/* FIXME Will this always work? */
-	unescaped_uri = g_uri_unescape_string (priv->path, "");
-	filename = g_strdup_printf ("%s-%s.db", unescaped_uri, change_id);
-	g_free (unescaped_uri);
-	if (!(ehash = e_xmlhash_new (filename))) {
-		g_free (filename);
-		g_propagate_error (perror, EDC_ERROR (OtherError));
-		return;
-	}
-
-	g_free (filename);
-
-	g_static_rec_mutex_lock (&priv->idle_save_rmutex);
-
-	/* Calculate adds and modifies */
-	for (i = priv->comp; i != NULL; i = i->next) {
-		const gchar *uid;
-		gchar *calobj;
-
-		e_cal_component_get_uid (i->data, &uid);
-		calobj = e_cal_component_get_as_string (i->data);
-
-		g_assert (calobj != NULL);
-
-		/* check what type of change has occurred, if any */
-		switch (e_xmlhash_compare (ehash, uid, calobj)) {
-		case E_XMLHASH_STATUS_SAME:
-			break;
-		case E_XMLHASH_STATUS_NOT_FOUND:
-			*adds = g_list_prepend (*adds, g_strdup (calobj));
-			e_xmlhash_add (ehash, uid, calobj);
-			break;
-		case E_XMLHASH_STATUS_DIFFERENT:
-			*modifies = g_list_prepend (*modifies, g_strdup (calobj));
-			e_xmlhash_add (ehash, uid, calobj);
-			break;
-		}
-
-		g_free (calobj);
-	}
-
-	/* Calculate deletions */
-	be_data.backend = cbfile;
-	be_data.kind = e_cal_backend_get_kind (E_CAL_BACKEND (cbfile));
-	be_data.deletes = NULL;
-	be_data.ehash = ehash;
-
-	e_xmlhash_foreach_key_remove (ehash, (EXmlHashRemoveFunc)e_cal_backend_file_compute_changes_foreach_key, &be_data);
-
-	*deletes = be_data.deletes;
-
-	e_xmlhash_write (ehash);
-	e_xmlhash_destroy (ehash);
-
-	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
-}
-
-/* Get_changes handler for the file backend */
-static void
-e_cal_backend_file_get_changes (ECalBackendSync *backend, EDataCal *cal, const gchar *change_id,
-			      GList **adds, GList **modifies, GList **deletes, GError **error)
-{
-	ECalBackendFile *cbfile;
-	ECalBackendFilePrivate *priv;
-
-	cbfile = E_CAL_BACKEND_FILE (backend);
-	priv = cbfile->priv;
-
-	e_return_data_cal_error_if_fail (priv->icalcomp != NULL, NoSuchCal);
-	e_return_data_cal_error_if_fail (change_id != NULL, ObjectNotFound);
-
-	e_cal_backend_file_compute_changes (cbfile, change_id, adds, modifies, deletes, error);
-}
-
-/* Discard_alarm handler for the file backend */
-static void
-e_cal_backend_file_discard_alarm (ECalBackendSync *backend, EDataCal *cal, const gchar *uid, const gchar *auid, GError **perror)
-{
-	/* we just do nothing with the alarm */
-}
-
-static icaltimezone *
-e_cal_backend_file_internal_get_default_timezone (ECalBackend *backend)
-{
-	ECalBackendFile *cbfile;
-	ECalBackendFilePrivate *priv;
-
-	cbfile = E_CAL_BACKEND_FILE (backend);
-	priv = cbfile->priv;
-
-	g_return_val_if_fail (priv->icalcomp != NULL, NULL);
-
-	return priv->default_zone;
-}
-
 static icaltimezone *
 e_cal_backend_file_internal_get_timezone (ECalBackend *backend, const gchar *tzid)
 {
@@ -2230,7 +2020,7 @@ static void
 sanitize_component (ECalBackendFile *cbfile, ECalComponent *comp)
 {
 	ECalComponentDateTime dt;
-	icaltimezone *zone, *default_zone;
+	icaltimezone *zone;
 
 	/* Check dtstart, dtend and due's timezone, and convert it to local
 	 * default timezone if the timezone is not in our builtin timezone
@@ -2239,9 +2029,7 @@ sanitize_component (ECalBackendFile *cbfile, ECalComponent *comp)
 	if (dt.value && dt.tzid) {
 		zone = e_cal_backend_file_internal_get_timezone ((ECalBackend *)cbfile, dt.tzid);
 		if (!zone) {
-			default_zone = e_cal_backend_file_internal_get_default_timezone ((ECalBackend *)cbfile);
-			g_free ((gchar *)dt.tzid);
-			dt.tzid = g_strdup (icaltimezone_get_tzid (default_zone));
+			dt.tzid = g_strdup ("UTC");
 			e_cal_component_set_dtstart (comp, &dt);
 		}
 	}
@@ -2251,9 +2039,7 @@ sanitize_component (ECalBackendFile *cbfile, ECalComponent *comp)
 	if (dt.value && dt.tzid) {
 		zone = e_cal_backend_file_internal_get_timezone ((ECalBackend *)cbfile, dt.tzid);
 		if (!zone) {
-			default_zone = e_cal_backend_file_internal_get_default_timezone ((ECalBackend *)cbfile);
-			g_free ((gchar *)dt.tzid);
-			dt.tzid = g_strdup (icaltimezone_get_tzid (default_zone));
+			dt.tzid = g_strdup ("UTC");
 			e_cal_component_set_dtend (comp, &dt);
 		}
 	}
@@ -2263,9 +2049,7 @@ sanitize_component (ECalBackendFile *cbfile, ECalComponent *comp)
 	if (dt.value && dt.tzid) {
 		zone = e_cal_backend_file_internal_get_timezone ((ECalBackend *)cbfile, dt.tzid);
 		if (!zone) {
-			default_zone = e_cal_backend_file_internal_get_default_timezone ((ECalBackend *)cbfile);
-			g_free ((gchar *)dt.tzid);
-			dt.tzid = g_strdup (icaltimezone_get_tzid (default_zone));
+			dt.tzid = g_strdup ("UTC");
 			e_cal_component_set_due (comp, &dt);
 		}
 	}
@@ -2275,7 +2059,7 @@ sanitize_component (ECalBackendFile *cbfile, ECalComponent *comp)
 }
 
 static void
-e_cal_backend_file_create_object (ECalBackendSync *backend, EDataCal *cal, gchar **calobj, gchar **uid, GError **error)
+e_cal_backend_file_create_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *in_calobj, gchar **uid, gchar **new_object, GError **error)
 {
 	ECalBackendFile *cbfile;
 	ECalBackendFilePrivate *priv;
@@ -2288,10 +2072,11 @@ e_cal_backend_file_create_object (ECalBackendSync *backend, EDataCal *cal, gchar
 	priv = cbfile->priv;
 
 	e_return_data_cal_error_if_fail (priv->icalcomp != NULL, NoSuchCal);
-	e_return_data_cal_error_if_fail (*calobj != NULL, ObjectNotFound);
+	e_return_data_cal_error_if_fail (in_calobj != NULL, ObjectNotFound);
+	e_return_data_cal_error_if_fail (new_object != NULL, ObjectNotFound);
 
 	/* Parse the icalendar text */
-	icalcomp = icalparser_parse_string (*calobj);
+	icalcomp = icalparser_parse_string (in_calobj);
 	if (!icalcomp) {
 		g_propagate_error (error, EDC_ERROR (InvalidObject));
 		return;
@@ -2354,7 +2139,7 @@ e_cal_backend_file_create_object (ECalBackendSync *backend, EDataCal *cal, gchar
 	/* Return the UID and the modified component */
 	if (uid)
 		*uid = g_strdup (comp_uid);
-	*calobj = e_cal_component_get_as_string (comp);
+	*new_object = e_cal_component_get_as_string (comp);
 
 	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
 }
@@ -2394,7 +2179,7 @@ remove_object_instance_cb (gpointer key, gpointer value, gpointer user_data)
 }
 
 static void
-e_cal_backend_file_modify_object (ECalBackendSync *backend, EDataCal *cal, const gchar *calobj,
+e_cal_backend_file_modify_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj,
 				  CalObjModType mod, gchar **old_object, gchar **new_object, GError **error)
 {
 	RemoveRecurrenceData rrdata;
@@ -2692,7 +2477,7 @@ get_object_string_from_fileobject (ECalBackendFileObject *obj_data, const gchar
 
 /* Remove_object handler for the file backend */
 static void
-e_cal_backend_file_remove_object (ECalBackendSync *backend, EDataCal *cal,
+e_cal_backend_file_remove_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable,
 				  const gchar *uid, const gchar *rid,
 				  CalObjModType mod, gchar **old_object,
 				  gchar **object, GError **error)
@@ -2921,7 +2706,7 @@ fetch_attachments (ECalBackendSync *backend, ECalComponent *comp)
 
 /* Update_objects handler for the file backend. */
 static void
-e_cal_backend_file_receive_objects (ECalBackendSync *backend, EDataCal *cal, const gchar *calobj, GError **error)
+e_cal_backend_file_receive_objects (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, GError **error)
 {
 	ECalBackendFile *cbfile;
 	ECalBackendFilePrivate *priv;
@@ -3185,7 +2970,7 @@ e_cal_backend_file_receive_objects (ECalBackendSync *backend, EDataCal *cal, con
 }
 
 static void
-e_cal_backend_file_send_objects (ECalBackendSync *backend, EDataCal *cal, const gchar *calobj, GList **users,
+e_cal_backend_file_send_objects (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, GSList **users,
 				 gchar **modified_calobj, GError **perror)
 {
 	*users = NULL;
@@ -3214,9 +2999,6 @@ e_cal_backend_file_init (ECalBackendFile *cbfile)
 	priv->custom_file = NULL;
 	priv->refresh_lock = g_mutex_new ();
 
-	/* The timezone defaults to UTC. */
-	priv->default_zone = icaltimezone_get_utc_timezone ();
-
         /*
          * data access is serialized via idle_save_rmutex, so locking at the
          * backend method level is not needed
@@ -3297,34 +3079,26 @@ e_cal_backend_file_class_init (ECalBackendFileClass *class)
 	object_class->finalize = e_cal_backend_file_finalize;
 	object_class->constructed = cal_backend_file_constructed;
 
-	sync_class->is_read_only_sync = e_cal_backend_file_is_read_only;
-	sync_class->get_cal_address_sync = e_cal_backend_file_get_cal_address;
+	sync_class->get_cal_email_address_sync = e_cal_backend_file_get_cal_email_address;
 	sync_class->get_alarm_email_address_sync = e_cal_backend_file_get_alarm_email_address;
-	sync_class->get_ldap_attribute_sync = e_cal_backend_file_get_ldap_attribute;
-	sync_class->get_static_capabilities_sync = e_cal_backend_file_get_static_capabilities;
+	sync_class->get_capabilities_sync = e_cal_backend_file_get_capabilities;
 	sync_class->open_sync = e_cal_backend_file_open;
 	sync_class->remove_sync = e_cal_backend_file_remove;
 	sync_class->create_object_sync = e_cal_backend_file_create_object;
 	sync_class->modify_object_sync = e_cal_backend_file_modify_object;
 	sync_class->remove_object_sync = e_cal_backend_file_remove_object;
-	sync_class->discard_alarm_sync = e_cal_backend_file_discard_alarm;
 	sync_class->receive_objects_sync = e_cal_backend_file_receive_objects;
 	sync_class->send_objects_sync = e_cal_backend_file_send_objects;
 	sync_class->get_default_object_sync = e_cal_backend_file_get_default_object;
 	sync_class->get_object_sync = e_cal_backend_file_get_object;
 	sync_class->get_object_list_sync = e_cal_backend_file_get_object_list;
-	sync_class->get_attachment_list_sync = e_cal_backend_file_get_attachment_list;
+	sync_class->get_attachment_uris_sync = e_cal_backend_file_get_attachment_uris;
 	sync_class->add_timezone_sync = e_cal_backend_file_add_timezone;
-	sync_class->set_default_zone_sync = e_cal_backend_file_set_default_zone;
-	sync_class->get_freebusy_sync = e_cal_backend_file_get_free_busy;
-	sync_class->get_changes_sync = e_cal_backend_file_get_changes;
+	sync_class->get_free_busy_sync = e_cal_backend_file_get_free_busy;
 
-	backend_class->is_loaded = e_cal_backend_file_is_loaded;
-	backend_class->start_query = e_cal_backend_file_start_query;
-	backend_class->get_mode = e_cal_backend_file_get_mode;
-	backend_class->set_mode = e_cal_backend_file_set_mode;
+	backend_class->start_view = e_cal_backend_file_start_view;
+	backend_class->set_online = e_cal_backend_file_set_online;
 
-	backend_class->internal_get_default_timezone = e_cal_backend_file_internal_get_default_timezone;
 	backend_class->internal_get_timezone = e_cal_backend_file_internal_get_timezone;
 }
 
@@ -3395,6 +3169,7 @@ e_cal_backend_file_reload (ECalBackendFile *cbfile, GError **perror)
 	}
   done:
 	g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
+	e_cal_backend_notify_readonly (E_CAL_BACKEND (cbfile), cbfile->priv->read_only);
 
 	if (err)
 		g_propagate_error (perror, err);
@@ -3404,7 +3179,7 @@ e_cal_backend_file_reload (ECalBackendFile *cbfile, GError **perror)
 #include <glib.h>
 
 static void
-test_query_by_scanning_all_objects (ECalBackendFile* cbfile, const gchar *sexp, GList **objects)
+test_query_by_scanning_all_objects (ECalBackendFile* cbfile, const gchar *sexp, GSList **objects)
 {
 	MatchObjectData match_data;
 	ECalBackendFilePrivate *priv;
@@ -3414,7 +3189,6 @@ test_query_by_scanning_all_objects (ECalBackendFile* cbfile, const gchar *sexp,
 	match_data.search_needed = TRUE;
 	match_data.query = sexp;
 	match_data.obj_list = NULL;
-	match_data.default_zone = priv->default_zone;
 	match_data.backend = E_CAL_BACKEND (cbfile);
 
 	if (!strcmp (sexp, "#t"))
@@ -3443,9 +3217,9 @@ test_query_by_scanning_all_objects (ECalBackendFile* cbfile, const gchar *sexp,
 }
 
 static void
-write_list (GList* list)
+write_list (GSList* list)
 {
-	GList *l;
+	GSList *l;
 
 	for (l = list; l; l = l->next)
 	{
@@ -3458,9 +3232,9 @@ write_list (GList* list)
 }
 
 static void
-get_difference_of_lists (ECalBackendFile* cbfile, GList* smaller, GList* bigger)
+get_difference_of_lists (ECalBackendFile* cbfile, GSList* smaller, GSList* bigger)
 {
-	GList *l, *lsmaller;
+	GSList *l, *lsmaller;
 
 	for (l = bigger; l; l = l->next) {
 		gchar *str = l->data;
@@ -3488,7 +3262,7 @@ get_difference_of_lists (ECalBackendFile* cbfile, GList* smaller, GList* bigger)
 
 			e_cal_util_get_component_occur_times (comp, &time_start, &time_end,
 						   resolve_tzid, cbfile->priv->icalcomp,
-						   cbfile->priv->default_zone,
+						   icaltimezone_get_utc_timezone (),
 						   e_cal_backend_get_kind (E_CAL_BACKEND (cbfile)));
 
 			d (printf ("start %s\n", asctime(gmtime(&time_start))));
@@ -3502,27 +3276,27 @@ get_difference_of_lists (ECalBackendFile* cbfile, GList* smaller, GList* bigger)
 static void
 test_query (ECalBackendFile* cbfile, const gchar * query)
 {
-	GList *objects = NULL, *all_objects = NULL;
+	GSList *objects = NULL, *all_objects = NULL;
 
 	g_return_if_fail (query != NULL);
 
 	d (g_print ("Query %s\n", query));
 
 	test_query_by_scanning_all_objects (cbfile, query, &all_objects);
-	e_cal_backend_file_get_object_list (E_CAL_BACKEND_SYNC (cbfile), NULL, query, &objects, NULL);
+	e_cal_backend_file_get_object_list (E_CAL_BACKEND_SYNC (cbfile), NULL, NULL, query, &objects, NULL);
 	if (objects == NULL)
 	{
 		g_message (G_STRLOC " failed to get objects\n");
 		exit (0);
 	}
 
-	if (g_list_length (objects) < g_list_length (all_objects) )
+	if (g_slist_length (objects) < g_slist_length (all_objects) )
 	{
 		g_print ("ERROR\n");
 		get_difference_of_lists (cbfile, objects, all_objects);
 		exit (-1);
 	}
-	else if (g_list_length (objects) > g_list_length (all_objects) )
+	else if (g_slist_length (objects) > g_slist_length (all_objects) )
 	{
 		g_print ("ERROR\n");
 		write_list (all_objects);
@@ -3530,29 +3304,29 @@ test_query (ECalBackendFile* cbfile, const gchar * query)
 		exit (-1);
 	}
 
-	g_list_foreach (objects, (GFunc) g_free, NULL);
-	g_list_free (objects);
-	g_list_foreach (all_objects, (GFunc) g_free, NULL);
-	g_list_free (all_objects);
+	g_slist_foreach (objects, (GFunc) g_free, NULL);
+	g_slist_free (objects);
+	g_slist_foreach (all_objects, (GFunc) g_free, NULL);
+	g_slist_free (all_objects);
 }
 
 static void
 execute_query (ECalBackendFile* cbfile, const gchar * query)
 {
-	GList *objects = NULL;
+	GSList *objects = NULL;
 
 	g_return_if_fail (query != NULL);
 
 	d (g_print ("Query %s\n", query));
-	e_cal_backend_file_get_object_list (E_CAL_BACKEND_SYNC (cbfile), NULL, query, &objects, NULL);
+	e_cal_backend_file_get_object_list (E_CAL_BACKEND_SYNC (cbfile), NULL, NULL, query, &objects, NULL);
 	if (objects == NULL)
 	{
 		g_message (G_STRLOC " failed to get objects\n");
 		exit (0);
 	}
 
-	g_list_foreach (objects, (GFunc) g_free, NULL);
-	g_list_free (objects);
+	g_slist_foreach (objects, (GFunc) g_free, NULL);
+	g_slist_free (objects);
 }
 
 static gchar *fname = NULL;
@@ -3700,4 +3474,3 @@ err0:
 	return 0;
 }
 #endif
-
diff --git a/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c b/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c
index 23984bd..d2f2556 100644
--- a/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c
+++ b/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c
@@ -490,7 +490,7 @@ get_actual_count (ECalComponent *comp, ECalBackendGroupwise *cbgw)
 	gint count = 0;
 	icaltimezone *dzone, *utc;
 
-	dzone = e_cal_backend_groupwise_get_default_zone (cbgw);
+	dzone = NULL;
 	utc = icaltimezone_get_utc_timezone ();
 
 	if (dzone)
@@ -565,8 +565,8 @@ set_rrule_from_comp (ECalComponent *comp, EGwItem *item, ECalBackendGroupwise *c
 			struct icaltimetype itt_utc;
 
 			e_cal_component_get_exdate_list (comp, &exdate_list);
-			default_zone = e_cal_backend_groupwise_get_default_zone (cbgw);
 			utc = icaltimezone_get_utc_timezone ();
+			default_zone = utc;
 			for (l = exdate_list; l; l = l->next) {
 				ECalComponentDateTime *dt = (ECalComponentDateTime *) l->data;
 				if (dt->value) {
@@ -598,8 +598,8 @@ set_properties_from_cal_component (EGwItem *item, ECalComponent *comp, ECalBacke
 	struct icaltimetype itt_utc;
 	gboolean dtstart_has_timezone;
 
-	default_zone = e_cal_backend_groupwise_get_default_zone (cbgw);
 	utc = icaltimezone_get_utc_timezone ();
+	default_zone = utc;
 
 	/* first set specific properties */
 	switch (e_cal_component_get_vtype (comp)) {
@@ -845,7 +845,7 @@ e_gw_item_new_for_delegate_from_cal (ECalBackendGroupwise *cbgw, ECalComponent *
 	const gchar *user_email;
 
 	g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), NULL);
-	default_zone = e_cal_backend_groupwise_get_default_zone (cbgw);
+	default_zone = icaltimezone_get_utc_timezone ();
 	item = e_gw_item_new_empty ();
 	e_gw_item_set_id (item, e_cal_component_get_gw_id (comp));
 	user_email = e_gw_connection_get_user_email (e_cal_backend_groupwise_get_connection (cbgw));
@@ -1087,7 +1087,7 @@ e_gw_item_to_cal_component (EGwItem *item, ECalBackendGroupwise *cbgw)
 
 	e_cal_backend_groupwise_priv_lock (cbgw);
 
-	default_zone = e_cal_backend_groupwise_get_default_zone (cbgw);
+	default_zone = icaltimezone_get_utc_timezone ();
 	categories_by_id = e_cal_backend_groupwise_get_categories_by_id (cbgw);
 
 	comp = e_cal_component_new ();
@@ -1674,14 +1674,14 @@ e_gw_connection_create_appointment (EGwConnection *cnc, const gchar *container,
 }
 
 static EGwConnectionStatus
-start_freebusy_session (EGwConnection *cnc, GList *users,
+start_freebusy_session (EGwConnection *cnc, const GSList *users,
                time_t start, time_t end, gchar **session)
 {
 	SoupSoapMessage *msg;
 	SoupSoapResponse *response;
 	EGwConnectionStatus status;
 	SoupSoapParameter *param;
-	GList *l;
+	const GSList *l;
 	icaltimetype icaltime;
 	icaltimezone *utc;
 	gchar *start_date, *end_date;
@@ -1697,7 +1697,7 @@ start_freebusy_session (EGwConnection *cnc, GList *users,
          * email id apart from the name*/
 
         soup_soap_message_start_element (msg, "users", NULL, NULL);
-	for ( l = users; l != NULL; l = g_list_next (l)) {
+	for ( l = users; l != NULL; l = g_slist_next (l)) {
 		soup_soap_message_start_element (msg, "user", NULL, NULL);
                 e_gw_message_write_string_parameter (msg, "email", NULL, l->data);
 		soup_soap_message_end_element (msg);
@@ -1779,7 +1779,7 @@ close_freebusy_session (EGwConnection *cnc, const gchar *session)
 }
 
 EGwConnectionStatus
-e_gw_connection_get_freebusy_info (ECalBackendGroupwise *cbgw, GList *users, time_t start, time_t end, GList **freebusy)
+e_gw_connection_get_freebusy_info (ECalBackendGroupwise *cbgw, const GSList *users, time_t start, time_t end, GSList **freebusy)
 {
 	SoupSoapMessage *msg;
 	SoupSoapResponse *response;
@@ -1792,7 +1792,7 @@ e_gw_connection_get_freebusy_info (ECalBackendGroupwise *cbgw, GList *users, tim
 	gint request_iteration = 0;
 	icaltimezone *default_zone;
 
-	default_zone = e_cal_backend_groupwise_get_default_zone (cbgw);
+	default_zone = icaltimezone_get_utc_timezone ();
 	cnc = e_cal_backend_groupwise_get_connection (cbgw);
 
 	g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_CONNECTION);
@@ -1991,7 +1991,7 @@ e_gw_connection_get_freebusy_info (ECalBackendGroupwise *cbgw, GList *users, tim
 		}
 
 		e_cal_component_commit_sequence (comp);
-		*freebusy = g_list_append (*freebusy, e_cal_component_get_as_string (comp));
+		*freebusy = g_slist_append (*freebusy, e_cal_component_get_as_string (comp));
 		g_object_unref (comp);
 		e_cal_backend_groupwise_priv_unlock (cbgw);
 	}
diff --git a/calendar/backends/groupwise/e-cal-backend-groupwise-utils.h b/calendar/backends/groupwise/e-cal-backend-groupwise-utils.h
index 838f846..5905e79 100644
--- a/calendar/backends/groupwise/e-cal-backend-groupwise-utils.h
+++ b/calendar/backends/groupwise/e-cal-backend-groupwise-utils.h
@@ -52,7 +52,7 @@ void          e_gw_item_set_changes (EGwItem *item, EGwItem *cached_item);
  */
 EGwConnectionStatus e_gw_connection_create_appointment (EGwConnection *cnc, const gchar *container, ECalBackendGroupwise *cbgw, ECalComponent *comp, GSList **id_list);
 EGwConnectionStatus e_gw_connection_send_appointment (ECalBackendGroupwise *cbgw, const gchar *container, ECalComponent *comp, icalproperty_method method, gboolean all_instances, ECalComponent **created_comp, icalparameter_partstat *pstatus);
-EGwConnectionStatus e_gw_connection_get_freebusy_info (ECalBackendGroupwise *cbgw, GList *users, time_t start, time_t end, GList **freebusy);
+EGwConnectionStatus e_gw_connection_get_freebusy_info (ECalBackendGroupwise *cbgw, const GSList *users, time_t start, time_t end, GSList **freebusy);
 gboolean e_cal_backend_groupwise_store_settings (GwSettings *hold);
 gboolean e_cal_backend_groupwise_utils_check_delegate (ECalComponent *comp, const gchar *email);
 
diff --git a/calendar/backends/groupwise/e-cal-backend-groupwise.c b/calendar/backends/groupwise/e-cal-backend-groupwise.c
index 11d717c..f72e2f2 100644
--- a/calendar/backends/groupwise/e-cal-backend-groupwise.c
+++ b/calendar/backends/groupwise/e-cal-backend-groupwise.c
@@ -80,11 +80,10 @@ struct _ECalBackendGroupwisePrivate {
 	ECalBackendStore *store;
 	gboolean read_only;
 	gchar *uri;
-	gchar *username;
-	gchar *password;
+	ECredentials *credentials;
 	gchar *container_id;
-	CalMode mode;
-	gboolean mode_changed;
+	gboolean is_online;
+	gboolean is_online_changed;
 	GHashTable *categories_by_id;
 	GHashTable *categories_by_name;
 
@@ -101,7 +100,6 @@ struct _ECalBackendGroupwisePrivate {
 
 	/* A mutex to control access to the private structure for the following */
 	GStaticRecMutex rec_mutex;
-	icaltimezone *default_zone;
 	guint timeout_id;
 	GThread *dthread;
 	SyncDelta *dlock;
@@ -111,7 +109,7 @@ struct _ECalBackendGroupwisePrivate {
 #define PRIV_UNLOCK(p) (g_static_rec_mutex_unlock (&(p)->rec_mutex))
 
 static void e_cal_backend_groupwise_finalize (GObject *object);
-static void e_cal_backend_groupwise_add_timezone (ECalBackendSync *backend, EDataCal *cal, const gchar *tzobj, GError **perror);
+static void e_cal_backend_groupwise_add_timezone (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *tzobj, GError **perror);
 static const gchar * get_gw_item_id (icalcomponent *icalcomp);
 static void get_retract_data (ECalComponent *comp, const gchar **retract_comment, gboolean *all_instances);
 static const gchar * get_element_type (icalcomponent_kind kind);
@@ -150,14 +148,6 @@ e_cal_backend_groupwise_get_categories_by_name (ECalBackendGroupwise *cbgw) {
 	return cbgw->priv->categories_by_name;
 }
 
-icaltimezone *
-e_cal_backend_groupwise_get_default_zone (ECalBackendGroupwise *cbgw) {
-
-	g_return_val_if_fail (E_IS_CAL_BACKEND_GROUPWISE (cbgw), NULL);
-
-	return cbgw->priv->default_zone;
-}
-
 const gchar *
 e_cal_backend_groupwise_get_container_id (ECalBackendGroupwise *cbgw)
 {
@@ -219,12 +209,48 @@ put_component_to_store (ECalBackendGroupwise *cbgw,
 	priv = cbgw->priv;
 
 	e_cal_util_get_component_occur_times (comp, &time_start, &time_end,
-				   resolve_tzid, cbgw, priv->default_zone,
+				   resolve_tzid, cbgw, icaltimezone_get_utc_timezone (),
 				   e_cal_backend_get_kind (E_CAL_BACKEND (cbgw)));
 
 	e_cal_backend_store_put_component_with_time_range (priv->store, comp, time_start, time_end);
 }
 
+struct progressData
+{
+	gint percent;
+	const gchar *message;
+};
+
+static gboolean
+update_progress_cb (EDataCalView *view, gpointer user_data)
+{
+	struct progressData *pd = user_data;
+
+	g_return_val_if_fail (view != NULL, FALSE);
+	g_return_val_if_fail (user_data != NULL, FALSE);
+
+	if ((!pd->message || !*pd->message) && (pd->percent >= 100 || pd->percent < 0)) {
+		e_data_cal_view_notify_complete (view, NULL);
+	} else {
+		e_data_cal_view_notify_progress (view, pd->percent, pd->message);
+	}
+
+	return TRUE;
+}
+
+static void
+notify_view_progress (ECalBackend *backend, gint percent, const gchar *message)
+{
+	struct progressData pd;
+
+	g_return_if_fail (backend != NULL);
+
+	pd.percent = percent;
+	pd.message = message;
+
+	e_cal_backend_foreach_view (backend, update_progress_cb, &pd);
+}
+
 /* Initialy populate the cache from the server */
 static EGwConnectionStatus
 populate_cache (ECalBackendGroupwise *cbgw)
@@ -299,8 +325,6 @@ populate_cache (ECalBackendGroupwise *cbgw)
 			forward = FALSE;
 		}
 
-		e_cal_backend_notify_view_progress_start (E_CAL_BACKEND (cbgw));
-
 		while (!done) {
 
 			status = e_gw_connection_read_cursor (priv->cnc, priv->container_id, cursor, forward, CURSOR_ITEM_LIMIT, position, &list);
@@ -326,13 +350,13 @@ populate_cache (ECalBackendGroupwise *cbgw)
 					percent = 99;
 
 				if (g_str_equal (type, "Appointment"))
-					e_cal_backend_notify_view_progress (E_CAL_BACKEND (cbgw), _("Loading Appointment items"), percent);
+					notify_view_progress (E_CAL_BACKEND (cbgw), percent, _("Loading Appointment items"));
 				else if (g_str_equal (type, "Task"))
-					e_cal_backend_notify_view_progress (E_CAL_BACKEND (cbgw), _("Loading Task items"), percent);
+					notify_view_progress (E_CAL_BACKEND (cbgw), percent, _("Loading Task items"));
 				else if (g_str_equal (type, "Note"))
-					e_cal_backend_notify_view_progress (E_CAL_BACKEND (cbgw), _("Loading Note items"), percent);
+					notify_view_progress (E_CAL_BACKEND (cbgw), percent, _("Loading Note items"));
 				else
-					e_cal_backend_notify_view_progress (E_CAL_BACKEND (cbgw), _("Loading items"), percent);
+					notify_view_progress (E_CAL_BACKEND (cbgw), percent, _("Loading items"));
 
 				if (E_IS_CAL_COMPONENT (comp)) {
 					gchar *comp_str;
@@ -355,7 +379,7 @@ populate_cache (ECalBackendGroupwise *cbgw)
 		e_gw_connection_destroy_cursor (priv->cnc, priv->container_id, cursor);
 		g_object_unref (filter[i]);
 	}
-	e_cal_backend_notify_view_progress (E_CAL_BACKEND (cbgw), "", 100);
+	notify_view_progress (E_CAL_BACKEND (cbgw), 100, "");
 
 	return E_GW_CONNECTION_STATUS_OK;
 }
@@ -424,7 +448,7 @@ get_deltas (gpointer handle)
 
 	cbgw = (ECalBackendGroupwise *) handle;
 	priv = cbgw->priv;
-	if (priv->mode == CAL_MODE_LOCAL)
+	if (!priv->is_online)
 		return FALSE;
 
 	kind = e_cal_backend_get_kind (E_CAL_BACKEND (cbgw));
@@ -824,7 +848,7 @@ e_cal_backend_groupwise_refresh_calendar (ECalBackendGroupwise *cbgw)
 	ECalBackendGroupwisePrivate *priv = cbgw->priv;
 	gboolean delta_started = FALSE;
 
-	if (priv->mode == CAL_MODE_LOCAL)
+	if (!priv->is_online)
 		return;
 
 	PRIV_LOCK (priv);
@@ -897,7 +921,7 @@ cache_init (ECalBackendGroupwise *cbgw)
 		g_warning (G_STRLOC ": Could not get the categories from the server");
 	}
 
-	priv->mode = CAL_MODE_REMOTE;
+	priv->is_online = TRUE;
 
 	/* We poke the cache for a default timezone. Its
 	 * absence indicates that the cache file has not been
@@ -1002,8 +1026,14 @@ connect_to_server (ECalBackendGroupwise *cbgw, GError **perror)
 	gchar *parent_user = NULL;
 	icalcomponent_kind kind;
 	EGwConnectionErrors errors;
+
 	priv = cbgw->priv;
 
+	if (!priv->credentials) {
+		g_propagate_error (perror, EDC_ERROR (AuthenticationRequired));
+		return;
+	}
+
 	source = e_cal_backend_get_source (E_CAL_BACKEND (cbgw));
 	real_uri = NULL;
 	if (source)
@@ -1025,10 +1055,10 @@ connect_to_server (ECalBackendGroupwise *cbgw, GError **perror)
 	if (parent_user) {
 		EGwConnection *cnc;
 		/* create connection to server */
-		cnc = e_gw_connection_new (real_uri, parent_user, priv->password);
+		cnc = e_gw_connection_new (real_uri, parent_user, e_credentials_peek (priv->credentials, E_CREDENTIALS_KEY_PASSWORD));
 		if (!E_IS_GW_CONNECTION(cnc) && use_ssl && g_str_equal (use_ssl, "when-possible")) {
 			http_uri = g_strconcat ("http://";, real_uri + 8, NULL);
-			cnc = e_gw_connection_new (http_uri, parent_user, priv->password);
+			cnc = e_gw_connection_new (http_uri, parent_user, e_credentials_peek (priv->credentials, E_CREDENTIALS_KEY_PASSWORD));
 			g_free (http_uri);
 		}
 
@@ -1037,7 +1067,7 @@ connect_to_server (ECalBackendGroupwise *cbgw, GError **perror)
 			return;
 		}
 
-		priv->cnc = e_gw_connection_get_proxy_connection (cnc, parent_user, priv->password, priv->username, &permissions);
+		priv->cnc = e_gw_connection_get_proxy_connection (cnc, parent_user, e_credentials_peek (priv->credentials, E_CREDENTIALS_KEY_PASSWORD), e_credentials_peek (priv->credentials, E_CREDENTIALS_KEY_USERNAME), &permissions);
 
 		g_object_unref (cnc);
 
@@ -1057,22 +1087,25 @@ connect_to_server (ECalBackendGroupwise *cbgw, GError **perror)
 
 	} else {
 
-		priv->cnc = e_gw_connection_new_with_error_handler ( real_uri, priv->username, priv->password, &errors);
+		priv->cnc = e_gw_connection_new_with_error_handler ( real_uri, e_credentials_peek (priv->credentials, E_CREDENTIALS_KEY_USERNAME), e_credentials_peek (priv->credentials, E_CREDENTIALS_KEY_PASSWORD), &errors);
 
 		if (!E_IS_GW_CONNECTION(priv->cnc) && use_ssl && g_str_equal (use_ssl, "when-possible")) {
 			http_uri = g_strconcat ("http://";, real_uri + 8, NULL);
-			priv->cnc = e_gw_connection_new_with_error_handler (http_uri, priv->username, priv->password, &errors);
+			priv->cnc = e_gw_connection_new_with_error_handler (http_uri, e_credentials_peek (priv->credentials, E_CREDENTIALS_KEY_USERNAME), e_credentials_peek (priv->credentials, E_CREDENTIALS_KEY_PASSWORD), &errors);
 			g_free (http_uri);
 		}
 		cbgw->priv->read_only = FALSE;
 	}
 	g_free (real_uri);
 
+	e_cal_backend_notify_readonly (E_CAL_BACKEND (cbgw), cbgw->priv->read_only);
+	e_cal_backend_notify_online (E_CAL_BACKEND (cbgw), priv->is_online);
+
 	if (priv->cnc ) {
 		if (priv->store && priv->container_id) {
-			priv->mode = CAL_MODE_REMOTE;
-			if (priv->mode_changed && !priv->dthread) {
-				priv->mode_changed = FALSE;
+			priv->is_online = TRUE;
+			if (priv->is_online_changed && !priv->dthread) {
+				priv->is_online_changed = FALSE;
 				fetch_deltas (cbgw);
 			}
 
@@ -1092,7 +1125,7 @@ connect_to_server (ECalBackendGroupwise *cbgw, GError **perror)
 			g_free (errors.description);
 		return;
 	}
-	priv->mode_changed = FALSE;
+	priv->is_online_changed = FALSE;
 
 	if (E_IS_GW_CONNECTION (priv->cnc)) {
 		ECalBackend *backend;
@@ -1117,6 +1150,7 @@ connect_to_server (ECalBackendGroupwise *cbgw, GError **perror)
 		}
 
 		e_cal_backend_store_load (priv->store);
+		e_cal_backend_set_is_loaded (E_CAL_BACKEND (backend), TRUE);
 
 		/* spawn a new thread for opening the calendar */
 		thread = g_thread_create ((GThreadFunc) cache_init, cbgw, FALSE, &error);
@@ -1186,15 +1220,8 @@ e_cal_backend_groupwise_finalize (GObject *object)
 		priv->store = NULL;
 	}
 
-	if (priv->username) {
-		g_free (priv->username);
-		priv->username = NULL;
-	}
-
-	if (priv->password) {
-		g_free (priv->password);
-		priv->password = NULL;
-	}
+	e_credentials_free (priv->credentials);
+	priv->credentials = NULL;
 
 	if (priv->container_id) {
 		g_free (priv->container_id);
@@ -1211,11 +1238,6 @@ e_cal_backend_groupwise_finalize (GObject *object)
 		priv->sendoptions_sync_timeout = 0;
 	}
 
-	if (priv->default_zone) {
-		icaltimezone_free (priv->default_zone, 1);
-		priv->default_zone = NULL;
-	}
-
 	g_free (priv);
 	cbgw->priv = NULL;
 
@@ -1225,19 +1247,9 @@ e_cal_backend_groupwise_finalize (GObject *object)
 
 /* Calendar backend methods */
 
-/* Is_read_only handler for the file backend */
-static void
-e_cal_backend_groupwise_is_read_only (ECalBackendSync *backend, EDataCal *cal, gboolean *read_only, GError **perror)
-{
-	ECalBackendGroupwise *cbgw;
-
-	cbgw = E_CAL_BACKEND_GROUPWISE (backend);
-	*read_only = cbgw->priv->read_only;
-}
-
 /* return email address of the person who opened the calendar */
 static void
-e_cal_backend_groupwise_get_cal_address (ECalBackendSync *backend, EDataCal *cal, gchar **address, GError **perror)
+e_cal_backend_groupwise_get_cal_email_address (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **address, GError **perror)
 {
 	ECalBackendGroupwise *cbgw;
 	ECalBackendGroupwisePrivate *priv;
@@ -1245,7 +1257,7 @@ e_cal_backend_groupwise_get_cal_address (ECalBackendSync *backend, EDataCal *cal
 	cbgw = E_CAL_BACKEND_GROUPWISE (backend);
 	priv = cbgw->priv;
 
-	if (priv->mode == CAL_MODE_REMOTE) {
+	if (priv->is_online) {
 		if (priv->user_email)
 			g_free (priv->user_email);
 
@@ -1256,16 +1268,7 @@ e_cal_backend_groupwise_get_cal_address (ECalBackendSync *backend, EDataCal *cal
 }
 
 static void
-e_cal_backend_groupwise_get_ldap_attribute (ECalBackendSync *backend, EDataCal *cal, gchar **attribute, GError **perror)
-{
-	/* ldap attribute is specific to Sun ONE connector to get free busy information*/
-	/* retun NULL here as group wise backend know how to get free busy information */
-
-	*attribute = NULL;
-}
-
-static void
-e_cal_backend_groupwise_get_alarm_email_address (ECalBackendSync *backend, EDataCal *cal, gchar **address, GError **perror)
+e_cal_backend_groupwise_get_alarm_email_address (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **address, GError **perror)
 {
 	/*group wise does not support email based alarms */
 
@@ -1273,7 +1276,7 @@ e_cal_backend_groupwise_get_alarm_email_address (ECalBackendSync *backend, EData
 }
 
 static void
-e_cal_backend_groupwise_get_static_capabilities (ECalBackendSync *backend, EDataCal *cal, gchar **capabilities, GError **perror)
+e_cal_backend_groupwise_get_capabilities (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **capabilities, GError **perror)
 {
 	*capabilities = g_strdup (CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS ","
 				  CAL_STATIC_CAPABILITY_ONE_ALARM_ONLY ","
@@ -1298,7 +1301,10 @@ in_offline (ECalBackendGroupwise *cbgw) {
 	ECalBackendGroupwisePrivate *priv;
 
 	priv= cbgw->priv;
-	priv->read_only = TRUE;
+	if (!priv->read_only) {
+		priv->read_only = TRUE;
+		e_cal_backend_notify_readonly (E_CAL_BACKEND (cbgw), priv->read_only);
+	}
 
 	if (priv->dlock) {
 		g_mutex_lock (priv->dlock->mutex);
@@ -1317,13 +1323,11 @@ in_offline (ECalBackendGroupwise *cbgw) {
 		g_object_unref (priv->cnc);
 		priv->cnc = NULL;
 	}
-
 }
 
 /* Open handler for the file backend */
 static void
-e_cal_backend_groupwise_open (ECalBackendSync *backend, EDataCal *cal, gboolean only_if_exists,
-			      const gchar *username, const gchar *password, GError **perror)
+e_cal_backend_groupwise_open (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gboolean only_if_exists, GError **perror)
 {
 	ECalBackendGroupwise *cbgw;
 	ECalBackendGroupwisePrivate *priv;
@@ -1337,12 +1341,15 @@ e_cal_backend_groupwise_open (ECalBackendSync *backend, EDataCal *cal, gboolean
 	PRIV_LOCK (priv);
 
 	cbgw->priv->read_only = FALSE;
+	e_cal_backend_notify_online (E_CAL_BACKEND (backend), priv->is_online);
 
-	if (priv->mode == CAL_MODE_LOCAL) {
+	if (!priv->is_online) {
 		ESource *esource;
 		const gchar *display_contents = NULL;
 
 		cbgw->priv->read_only = TRUE;
+		e_cal_backend_notify_readonly (E_CAL_BACKEND (cbgw), cbgw->priv->read_only);
+
 		esource = e_cal_backend_get_source (E_CAL_BACKEND (cbgw));
 		display_contents = e_source_get_property (esource, "offline_sync");
 
@@ -1364,53 +1371,48 @@ e_cal_backend_groupwise_open (ECalBackendSync *backend, EDataCal *cal, gboolean
 		}
 
 		e_cal_backend_store_load (priv->store);
+		e_cal_backend_set_is_loaded (E_CAL_BACKEND (backend), TRUE);
 		PRIV_UNLOCK (priv);
 		return;
 	}
 
-	priv->username = g_strdup (username);
-	priv->password = g_strdup (password);
-
-	/* FIXME: no need to set it online here when we implement the online/offline stuff correctly */
-	connect_to_server (cbgw, perror);
+	if (priv->credentials)
+		connect_to_server (cbgw, perror);
+	else
+		e_cal_backend_notify_auth_required (E_CAL_BACKEND (cbgw), priv->credentials);
 
 	PRIV_UNLOCK (priv);
 }
 
 static void
-e_cal_backend_groupwise_remove (ECalBackendSync *backend, EDataCal *cal, GError **perror)
+e_cal_backend_groupwise_authenticate_user (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, ECredentials *credentials, GError **error)
 {
-	ECalBackendGroupwise *cbgw;
+	ECalBackendGroupwise        *cbgw;
 	ECalBackendGroupwisePrivate *priv;
 
 	cbgw = E_CAL_BACKEND_GROUPWISE (backend);
-	priv = cbgw->priv;
+	priv  = cbgw->priv;
 
 	PRIV_LOCK (priv);
 
-	/* remove the cache */
-	if (priv->store)
-		e_cal_backend_store_remove (priv->store);
+	e_credentials_free (priv->credentials);
+	priv->credentials = NULL;
 
-	PRIV_UNLOCK (priv);
-}
+	if (!credentials || !e_credentials_has_key (credentials, E_CREDENTIALS_KEY_USERNAME)) {
+		PRIV_UNLOCK (priv);
+		g_propagate_error (error, EDC_ERROR (AuthenticationFailed));
+		return;
+	}
 
-/* is_loaded handler for the file backend */
-static gboolean
-e_cal_backend_groupwise_is_loaded (ECalBackend *backend)
-{
-	ECalBackendGroupwise *cbgw;
-	ECalBackendGroupwisePrivate *priv;
+	priv->credentials = e_credentials_new_clone (credentials);
 
-	cbgw = E_CAL_BACKEND_GROUPWISE (backend);
-	priv = cbgw->priv;
+	connect_to_server (cbgw, error);
 
-	return priv->store ? TRUE : FALSE;
+	PRIV_UNLOCK (priv);
 }
 
-/* is_remote handler for the file backend */
-static CalMode
-e_cal_backend_groupwise_get_mode (ECalBackend *backend)
+static void
+e_cal_backend_groupwise_remove (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, GError **perror)
 {
 	ECalBackendGroupwise *cbgw;
 	ECalBackendGroupwisePrivate *priv;
@@ -1418,12 +1420,18 @@ e_cal_backend_groupwise_get_mode (ECalBackend *backend)
 	cbgw = E_CAL_BACKEND_GROUPWISE (backend);
 	priv = cbgw->priv;
 
-	return priv->mode;
+	PRIV_LOCK (priv);
+
+	/* remove the cache */
+	if (priv->store)
+		e_cal_backend_store_remove (priv->store);
+
+	PRIV_UNLOCK (priv);
 }
 
 /* Set_mode handler for the file backend */
 static void
-e_cal_backend_groupwise_set_mode (ECalBackend *backend, CalMode mode)
+e_cal_backend_groupwise_set_online (ECalBackend *backend, gboolean is_online)
 {
 	ECalBackendGroupwise *cbgw;
 	ECalBackendGroupwisePrivate *priv;
@@ -1431,43 +1439,33 @@ e_cal_backend_groupwise_set_mode (ECalBackend *backend, CalMode mode)
 	cbgw = E_CAL_BACKEND_GROUPWISE (backend);
 	priv = cbgw->priv;
 
-	if (priv->mode == mode) {
-		e_cal_backend_notify_mode (backend, ModeSet,
-					   cal_mode_to_corba (mode));
+	if ((priv->is_online ? 1 : 0) == (is_online ? 1 : 0)) {
+		e_cal_backend_notify_online (backend, priv->is_online);
 		return;
 	}
 
 	PRIV_LOCK (priv);
 
-	priv->mode_changed = TRUE;
-	switch (mode) {
-	case CAL_MODE_REMOTE :/* go online */
-		priv->mode = CAL_MODE_REMOTE;
+	priv->is_online = is_online;
+	priv->is_online_changed = TRUE;
+	if (is_online) {
 		priv->read_only = FALSE;
-		e_cal_backend_notify_mode (backend, ModeSet, Remote);
+		e_cal_backend_notify_online (backend, priv->is_online);
 		e_cal_backend_notify_readonly (backend, priv->read_only);
-		if (e_cal_backend_groupwise_is_loaded (backend))
-			      e_cal_backend_notify_auth_required (backend);
-		break;
-
-	case CAL_MODE_LOCAL : /* go offline */
+		if (e_cal_backend_is_loaded (backend))
+			e_cal_backend_notify_auth_required (backend, priv->credentials);
+	} else {
 		/* FIXME: make sure we update the cache before closing the connection */
-		priv->mode = CAL_MODE_LOCAL;
 		in_offline (cbgw);
 		e_cal_backend_notify_readonly (backend, priv->read_only);
-		e_cal_backend_notify_mode (backend, ModeSet, Local);
-
-		break;
-	default :
-		e_cal_backend_notify_mode (backend, ModeNotSupported,
-					   cal_mode_to_corba (mode));
+		e_cal_backend_notify_online (backend, priv->is_online);
 	}
 
 	PRIV_UNLOCK (priv);
 }
 
 static void
-e_cal_backend_groupwise_get_default_object (ECalBackendSync *backend, EDataCal *cal, gchar **object, GError **perror)
+e_cal_backend_groupwise_get_default_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **object, GError **perror)
 {
 
 	ECalComponent *comp;
@@ -1493,7 +1491,7 @@ e_cal_backend_groupwise_get_default_object (ECalBackendSync *backend, EDataCal *
 
 /* Get_object_component handler for the groupwise backend */
 static void
-e_cal_backend_groupwise_get_object (ECalBackendSync *backend, EDataCal *cal, const gchar *uid, const gchar *rid, gchar **object, GError **error)
+e_cal_backend_groupwise_get_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, gchar **object, GError **error)
 {
 	ECalComponent *comp;
 	ECalBackendGroupwisePrivate *priv;
@@ -1530,7 +1528,7 @@ e_cal_backend_groupwise_get_object (ECalBackendSync *backend, EDataCal *cal, con
 
 /* Add_timezone handler for the groupwise backend */
 static void
-e_cal_backend_groupwise_add_timezone (ECalBackendSync *backend, EDataCal *cal, const gchar *tzobj, GError **error)
+e_cal_backend_groupwise_add_timezone (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *tzobj, GError **error)
 {
 	icalcomponent *tz_comp;
 	ECalBackendGroupwise *cbgw;
@@ -1563,51 +1561,16 @@ e_cal_backend_groupwise_add_timezone (ECalBackendSync *backend, EDataCal *cal, c
 	}
 }
 
-static void
-e_cal_backend_groupwise_set_default_zone (ECalBackendSync *backend, EDataCal *cal, const gchar *tzobj, GError **error)
-{
-	icalcomponent *tz_comp;
-	ECalBackendGroupwise *cbgw;
-	ECalBackendGroupwisePrivate *priv;
-	icaltimezone *zone;
-
-	cbgw = (ECalBackendGroupwise *) backend;
-
-	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_GROUPWISE (cbgw), InvalidArg);
-	e_return_data_cal_error_if_fail (tzobj != NULL, InvalidArg);
-
-	priv = cbgw->priv;
-
-	tz_comp = icalparser_parse_string (tzobj);
-	if (!tz_comp) {
-		g_propagate_error (error, EDC_ERROR (InvalidObject));
-		return;
-	}
-
-	zone = icaltimezone_new ();
-	icaltimezone_set_component (zone, tz_comp);
-
-	PRIV_LOCK (priv);
-
-	if (priv->default_zone)
-		icaltimezone_free (priv->default_zone, 1);
-
-	/* Set the default timezone to it. */
-	priv->default_zone = zone;
-
-	PRIV_UNLOCK (priv);
-}
-
 /* Gets the list of attachments */
 static void
-e_cal_backend_groupwise_get_attachment_list (ECalBackendSync *backend, EDataCal *cal, const gchar *uid, const gchar *rid, GSList **list, GError **perror)
+e_cal_backend_groupwise_get_attachment_uris (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, GSList **list, GError **perror)
 {
 	/* TODO implement the function */
 }
 
 /* Get_objects_in_range handler for the groupwise backend */
 static void
-e_cal_backend_groupwise_get_object_list (ECalBackendSync *backend, EDataCal *cal, const gchar *sexp, GList **objects, GError **perror)
+e_cal_backend_groupwise_get_object_list (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *sexp, GSList **objects, GError **perror)
 {
 	ECalBackendGroupwise *cbgw;
 	ECalBackendGroupwisePrivate *priv;
@@ -1645,7 +1608,7 @@ e_cal_backend_groupwise_get_object_list (ECalBackendSync *backend, EDataCal *cal
 		    icalcomponent_isa (e_cal_component_get_icalcomponent (comp))) {
 			if ((!search_needed) ||
 			    (e_cal_backend_sexp_match_comp (cbsexp, comp, E_CAL_BACKEND (backend)))) {
-				*objects = g_list_append (*objects, e_cal_component_get_as_string (comp));
+				*objects = g_slist_append (*objects, e_cal_component_get_as_string (comp));
 			}
 		}
 	}
@@ -1657,42 +1620,42 @@ e_cal_backend_groupwise_get_object_list (ECalBackendSync *backend, EDataCal *cal
 
 /* get_query handler for the groupwise backend */
 static void
-e_cal_backend_groupwise_start_query (ECalBackend *backend, EDataCalView *query)
+e_cal_backend_groupwise_start_view (ECalBackend *backend, EDataCalView *query)
 {
-	GList *objects = NULL;
+	GSList *objects = NULL;
 	GError *err = NULL;
 
-	e_cal_backend_groupwise_get_object_list (E_CAL_BACKEND_SYNC (backend), NULL,
+	e_cal_backend_groupwise_get_object_list (E_CAL_BACKEND_SYNC (backend), NULL, NULL,
 							  e_data_cal_view_get_text (query), &objects, &err);
 	if (err) {
-		e_data_cal_view_notify_done (query, err);
+		e_data_cal_view_notify_complete (query, err);
 		g_error_free (err);
 		return;
 	}
 
 	/* notify listeners of all objects */
 	if (objects) {
-		e_data_cal_view_notify_objects_added (query, (const GList *) objects);
+		e_data_cal_view_notify_objects_added (query, objects);
 
 		/* free memory */
-		g_list_foreach (objects, (GFunc) g_free, NULL);
-		g_list_free (objects);
+		g_slist_foreach (objects, (GFunc) g_free, NULL);
+		g_slist_free (objects);
 	}
 
-	e_data_cal_view_notify_done (query, NULL);
+	e_data_cal_view_notify_complete (query, NULL);
 }
 
 /* Get_free_busy handler for the file backend */
 static void
-e_cal_backend_groupwise_get_free_busy (ECalBackendSync *backend, EDataCal *cal, GList *users,
-				       time_t start, time_t end, GList **freebusy, GError **perror)
+e_cal_backend_groupwise_get_free_busy (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const GSList *users,
+				       time_t start, time_t end, GSList **freebusy, GError **perror)
 {
 	EGwConnectionStatus status;
 	ECalBackendGroupwise *cbgw;
 
 	cbgw = E_CAL_BACKEND_GROUPWISE (backend);
 
-	if (cbgw->priv->mode == CAL_MODE_LOCAL) {
+	if (!cbgw->priv->is_online) {
 		in_offline (cbgw);
 		g_propagate_error (perror, EDC_ERROR (RepositoryOffline));
 		return;
@@ -1707,132 +1670,6 @@ e_cal_backend_groupwise_get_free_busy (ECalBackendSync *backend, EDataCal *cal,
 		g_propagate_error (perror, EDC_ERROR_FAILED_STATUS (OtherError, status));
 }
 
-typedef struct {
-	ECalBackendGroupwise *backend;
-	icalcomponent_kind kind;
-	GList *deletes;
-	EXmlHash *ehash;
-} ECalBackendGroupwiseComputeChangesData;
-
-static void
-e_cal_backend_groupwise_compute_changes_foreach_key (const gchar *key, const gchar *value, gpointer data)
-{
-	ECalBackendGroupwiseComputeChangesData *be_data = data;
-
-	if (!e_cal_backend_store_get_component (be_data->backend->priv->store, key, NULL)) {
-		ECalComponent *comp;
-
-		comp = e_cal_component_new ();
-		if (be_data->kind == ICAL_VTODO_COMPONENT)
-			e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_TODO);
-		else
-			e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_EVENT);
-
-		e_cal_component_set_uid (comp, key);
-		be_data->deletes = g_list_prepend (be_data->deletes, e_cal_component_get_as_string (comp));
-
-		e_xmlhash_remove (be_data->ehash, key);
-		g_object_unref (comp);
-	}
-}
-
-static void
-e_cal_backend_groupwise_compute_changes (ECalBackendGroupwise *cbgw, const gchar *change_id,
-					 GList **adds, GList **modifies, GList **deletes, GError **perror)
-{
-	gchar    *filename;
-	EXmlHash *ehash;
-	ECalBackendGroupwiseComputeChangesData be_data;
-	GList *i, *list = NULL;
-	gchar *unescaped_uri;
-	GError *err = NULL;
-
-	/* FIXME Will this always work? */
-	unescaped_uri = g_uri_unescape_string (cbgw->priv->uri, "");
-	filename = g_strdup_printf ("%s-%s.db", unescaped_uri, change_id);
-	ehash = e_xmlhash_new (filename);
-	g_free (filename);
-	g_free (unescaped_uri);
-
-        e_cal_backend_groupwise_get_object_list (E_CAL_BACKEND_SYNC (cbgw), NULL, "#t", &list, &err);
-	if (err) {
-		g_propagate_error (perror, err);
-		return;
-	}
-
-        /* Calculate adds and modifies */
-	for (i = list; i != NULL; i = g_list_next (i)) {
-		const gchar *uid;
-		gchar *calobj;
-		ECalComponent *comp;
-
-		comp = e_cal_component_new_from_string (i->data);
-		e_cal_component_get_uid (comp, &uid);
-		calobj = i->data;
-
-		g_assert (calobj != NULL);
-
-		/* check what type of change has occurred, if any */
-		switch (e_xmlhash_compare (ehash, uid, calobj)) {
-		case E_XMLHASH_STATUS_SAME:
-			break;
-		case E_XMLHASH_STATUS_NOT_FOUND:
-			*adds = g_list_prepend (*adds, g_strdup (calobj));
-			e_xmlhash_add (ehash, uid, calobj);
-			break;
-		case E_XMLHASH_STATUS_DIFFERENT:
-			*modifies = g_list_prepend (*modifies, g_strdup (calobj));
-			e_xmlhash_add (ehash, uid, calobj);
-			break;
-		}
-
-		g_free (calobj);
-		g_object_unref (comp);
-	}
-	g_list_free (list);
-
-	/* Calculate deletions */
-	be_data.backend = cbgw;
-	be_data.kind = e_cal_backend_get_kind (E_CAL_BACKEND (cbgw));
-	be_data.deletes = NULL;
-	be_data.ehash = ehash;
-	e_xmlhash_foreach_key (ehash, (EXmlHashFunc)e_cal_backend_groupwise_compute_changes_foreach_key, &be_data);
-
-	*deletes = be_data.deletes;
-
-	e_xmlhash_write (ehash);
-	e_xmlhash_destroy (ehash);
-}
-
-/* Get_changes handler for the groupwise backend */
-static void
-e_cal_backend_groupwise_get_changes (ECalBackendSync *backend, EDataCal *cal, const gchar *change_id,
-				     GList **adds, GList **modifies, GList **deletes, GError **error)
-{
-	ECalBackendGroupwise *cbgw;
-	cbgw = E_CAL_BACKEND_GROUPWISE (backend);
-
-	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_GROUPWISE (cbgw), InvalidArg);
-	e_return_data_cal_error_if_fail (change_id != NULL, InvalidArg);
-
-	e_cal_backend_groupwise_compute_changes (cbgw, change_id, adds, modifies, deletes, error);
-}
-
-/* Discard_alarm handler for the file backend */
-static void
-e_cal_backend_groupwise_discard_alarm (ECalBackendSync *backend, EDataCal *cal, const gchar *uid, const gchar *auid, GError **perror)
-{
-	g_propagate_error (perror, EDC_ERROR (NotSupported));
-}
-
-static icaltimezone *
-e_cal_backend_groupwise_internal_get_default_timezone (ECalBackend *backend)
-{
-	ECalBackendGroupwise *cbgw = E_CAL_BACKEND_GROUPWISE (backend);
-
-	return cbgw->priv->default_zone;
-}
-
 static icaltimezone *
 e_cal_backend_groupwise_internal_get_timezone (ECalBackend *backend, const gchar *tzid)
 {
@@ -1909,7 +1746,7 @@ update_from_server (ECalBackendGroupwise *cbgw, GSList *uid_list, gchar **calobj
 }
 
 static void
-e_cal_backend_groupwise_create_object (ECalBackendSync *backend, EDataCal *cal, gchar **calobj, gchar **uid, GError **error)
+e_cal_backend_groupwise_create_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *in_calobj, gchar **uid, gchar **new_calobj, GError **error)
 {
 	ECalBackendGroupwise *cbgw;
 	ECalBackendGroupwisePrivate *priv;
@@ -1922,16 +1759,17 @@ e_cal_backend_groupwise_create_object (ECalBackendSync *backend, EDataCal *cal,
 	priv = cbgw->priv;
 
 	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_GROUPWISE (cbgw), InvalidArg);
-	e_return_data_cal_error_if_fail (calobj != NULL && *calobj != NULL, InvalidArg);
+	e_return_data_cal_error_if_fail (in_calobj != NULL, InvalidArg);
+	e_return_data_cal_error_if_fail (new_calobj != NULL, InvalidArg);
 
-	if (priv->mode == CAL_MODE_LOCAL) {
+	if (!priv->is_online) {
 		in_offline (cbgw);
 		g_propagate_error (error, EDC_ERROR (RepositoryOffline));
 		return;
 	}
 
 	/* check the component for validity */
-	icalcomp = icalparser_parse_string (*calobj);
+	icalcomp = icalparser_parse_string (in_calobj);
 	if (!icalcomp) {
 		g_propagate_error (error, EDC_ERROR (InvalidObject));
 		return;
@@ -1947,9 +1785,7 @@ e_cal_backend_groupwise_create_object (ECalBackendSync *backend, EDataCal *cal,
 	e_cal_component_set_icalcomponent (comp, icalcomp);
 
 	/* check if the object exists */
-	switch (priv->mode) {
-	case CAL_MODE_ANY :
-	case CAL_MODE_REMOTE :
+	if (priv->is_online) {
 		/* when online, send the item to the server */
 		status = e_gw_connection_create_appointment (priv->cnc, priv->container_id, cbgw, comp, &uid_list);
 
@@ -1978,15 +1814,11 @@ e_cal_backend_groupwise_create_object (ECalBackendSync *backend, EDataCal *cal,
 		}
 
 		/* Get the item back from server to update the last-modified time */
-		status = update_from_server (cbgw, uid_list, calobj, comp);
+		status = update_from_server (cbgw, uid_list, new_calobj, comp);
 		if (status != E_GW_CONNECTION_STATUS_OK) {
 			g_propagate_error (error, EDC_ERROR_FAILED_STATUS (OtherError, status));
 			return;
 		}
-
-		break;
-	default :
-		break;
 	}
 
 	g_object_unref (comp);
@@ -2031,7 +1863,7 @@ get_retract_data (ECalComponent *comp, const gchar **retract_comment, gboolean *
 }
 
 static void
-e_cal_backend_groupwise_modify_object (ECalBackendSync *backend, EDataCal *cal, const gchar *calobj,
+e_cal_backend_groupwise_modify_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj,
 				       CalObjModType mod, gchar **old_object, gchar **new_object, GError **error)
 {
 	ECalBackendGroupwise *cbgw;
@@ -2050,7 +1882,7 @@ e_cal_backend_groupwise_modify_object (ECalBackendSync *backend, EDataCal *cal,
 	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_GROUPWISE (cbgw), InvalidArg);
 	e_return_data_cal_error_if_fail (calobj != NULL, InvalidArg);
 
-	if (priv->mode == CAL_MODE_LOCAL) {
+	if (!priv->is_online) {
 		in_offline (cbgw);
 		g_propagate_error (error, EDC_ERROR (RepositoryOffline));
 		return;
@@ -2068,101 +1900,98 @@ e_cal_backend_groupwise_modify_object (ECalBackendSync *backend, EDataCal *cal,
 	rid = e_cal_component_get_recurid_as_string (comp);
 
 	/* check if the object exists */
-	switch (priv->mode) {
-	case CAL_MODE_ANY :
-	case CAL_MODE_REMOTE :
-		/* when online, send the item to the server */
-		cache_comp = e_cal_backend_store_get_component (priv->store, uid, rid);
-		if (!cache_comp) {
-			g_critical ("Could not find the object in cache");
-			g_free (rid);
-			g_propagate_error (error, EDC_ERROR (ObjectNotFound));
-			return;
-		}
-
-		if (e_cal_component_has_attendees (comp) &&
-				e_cal_backend_groupwise_utils_check_delegate (comp, e_gw_connection_get_user_email (priv->cnc))) {
-			const gchar *id = NULL, *recur_key = NULL;
-
-			item = e_gw_item_new_for_delegate_from_cal (cbgw, comp);
-
-			if (mod == CALOBJ_MOD_ALL && e_cal_component_is_instance (comp)) {
-				recur_key = uid;
-			}
-			id = e_gw_item_get_id (item);
-
-			status = e_gw_connection_delegate_request (priv->cnc, item, id, NULL, NULL, recur_key);
-
-			if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-				status = e_gw_connection_delegate_request (priv->cnc, item, id, NULL, NULL, recur_key);
-			if (status != E_GW_CONNECTION_STATUS_OK) {
-				g_object_unref (comp);
-				g_object_unref (cache_comp);
+	if (priv->is_online) {
+		while (1) {
+			/* when online, send the item to the server */
+			cache_comp = e_cal_backend_store_get_component (priv->store, uid, rid);
+			if (!cache_comp) {
+				g_critical ("Could not find the object in cache");
 				g_free (rid);
-				g_propagate_error (error, EDC_ERROR_FAILED_STATUS (OtherError, status));
+				g_propagate_error (error, EDC_ERROR (ObjectNotFound));
 				return;
 			}
 
-			put_component_to_store (cbgw, comp);
-			*new_object = e_cal_component_get_as_string (comp);
-			break;
-		}
+			if (e_cal_component_has_attendees (comp) &&
+					e_cal_backend_groupwise_utils_check_delegate (comp, e_gw_connection_get_user_email (priv->cnc))) {
+				const gchar *id = NULL, *recur_key = NULL;
 
-		item = e_gw_item_new_from_cal_component (priv->container_id, cbgw, comp);
-		cache_item =  e_gw_item_new_from_cal_component (priv->container_id, cbgw, cache_comp);
-		if ( e_gw_item_get_item_type (item) == E_GW_ITEM_TYPE_TASK) {
-			gboolean completed, cache_completed;
+				item = e_gw_item_new_for_delegate_from_cal (cbgw, comp);
 
-			completed = e_gw_item_get_completed (item);
-			cache_completed = e_gw_item_get_completed (cache_item);
-			if (completed && !cache_completed) {
-				/*FIXME  return values. */
-				status = e_gw_connection_complete_request (priv->cnc, e_gw_item_get_id (item));
+				if (mod == CALOBJ_MOD_ALL && e_cal_component_is_instance (comp)) {
+					recur_key = uid;
+				}
+				id = e_gw_item_get_id (item);
 
-				if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-					status = e_gw_connection_complete_request (priv->cnc, e_gw_item_get_id (item));
+				status = e_gw_connection_delegate_request (priv->cnc, item, id, NULL, NULL, recur_key);
 
+				if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
+					status = e_gw_connection_delegate_request (priv->cnc, item, id, NULL, NULL, recur_key);
 				if (status != E_GW_CONNECTION_STATUS_OK) {
 					g_object_unref (comp);
 					g_object_unref (cache_comp);
 					g_free (rid);
-
-					if (status == E_GW_CONNECTION_STATUS_OVER_QUOTA) {
-						g_propagate_error (error, EDC_ERROR (PermissionDenied));
-						return;
-					}
-
 					g_propagate_error (error, EDC_ERROR_FAILED_STATUS (OtherError, status));
 					return;
 				}
+
 				put_component_to_store (cbgw, comp);
+				*new_object = e_cal_component_get_as_string (comp);
 				break;
 			}
-		}
 
-		e_gw_item_set_changes (item, cache_item);
+			item = e_gw_item_new_from_cal_component (priv->container_id, cbgw, comp);
+			cache_item =  e_gw_item_new_from_cal_component (priv->container_id, cbgw, cache_comp);
+			if ( e_gw_item_get_item_type (item) == E_GW_ITEM_TYPE_TASK) {
+				gboolean completed, cache_completed;
+
+				completed = e_gw_item_get_completed (item);
+				cache_completed = e_gw_item_get_completed (cache_item);
+				if (completed && !cache_completed) {
+					/*FIXME  return values. */
+					status = e_gw_connection_complete_request (priv->cnc, e_gw_item_get_id (item));
 
-		/* the second argument is redundant */
-		status = e_gw_connection_modify_item (priv->cnc, e_gw_item_get_id (item), item);
+					if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
+						status = e_gw_connection_complete_request (priv->cnc, e_gw_item_get_id (item));
 
-		if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
+					if (status != E_GW_CONNECTION_STATUS_OK) {
+						g_object_unref (comp);
+						g_object_unref (cache_comp);
+						g_free (rid);
+
+						if (status == E_GW_CONNECTION_STATUS_OVER_QUOTA) {
+							g_propagate_error (error, EDC_ERROR (PermissionDenied));
+							return;
+						}
+
+						g_propagate_error (error, EDC_ERROR_FAILED_STATUS (OtherError, status));
+						return;
+					}
+					put_component_to_store (cbgw, comp);
+					break;
+				}
+			}
+
+			e_gw_item_set_changes (item, cache_item);
+
+			/* the second argument is redundant */
 			status = e_gw_connection_modify_item (priv->cnc, e_gw_item_get_id (item), item);
 
-		if (status != E_GW_CONNECTION_STATUS_OK) {
-			g_object_unref (comp);
-			g_object_unref (cache_comp);
-			g_free (rid);
-			g_propagate_error (error, EDC_ERROR_FAILED_STATUS (OtherError, status));
-			return;
+			if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
+				status = e_gw_connection_modify_item (priv->cnc, e_gw_item_get_id (item), item);
+
+			if (status != E_GW_CONNECTION_STATUS_OK) {
+				g_object_unref (comp);
+				g_object_unref (cache_comp);
+				g_free (rid);
+				g_propagate_error (error, EDC_ERROR_FAILED_STATUS (OtherError, status));
+				return;
+			}
+			break;
 		}
 		/* if successful, update the cache */
-
-	case CAL_MODE_LOCAL :
+	} else {
 		/* in offline mode, we just update the cache */
 		put_component_to_store (cbgw, comp);
-		break;
-	default :
-		break;
 	}
 
 	*old_object = e_cal_component_get_as_string (cache_comp);
@@ -2194,7 +2023,7 @@ get_gw_item_id (icalcomponent *icalcomp)
 
 /* Remove_object handler for the file backend */
 static void
-e_cal_backend_groupwise_remove_object (ECalBackendSync *backend, EDataCal *cal,
+e_cal_backend_groupwise_remove_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable,
 				       const gchar *uid, const gchar *rid,
 				       CalObjModType mod, gchar **old_object,
 				       gchar **object, GError **perror)
@@ -2211,11 +2040,11 @@ e_cal_backend_groupwise_remove_object (ECalBackendSync *backend, EDataCal *cal,
 	*old_object = *object = NULL;
 
 	/* if online, remove the item from the server */
-	if (priv->mode == CAL_MODE_REMOTE) {
+	if (priv->is_online) {
 		const gchar *id_to_remove = NULL;
 		icalcomponent *icalcomp;
 
-		e_cal_backend_groupwise_get_object (backend, cal, uid, rid, &calobj, &err);
+		e_cal_backend_groupwise_get_object (backend, cal, NULL, uid, rid, &calobj, &err);
 		if (err) {
 			g_propagate_error (perror, err);
 			return;
@@ -2318,13 +2147,9 @@ e_cal_backend_groupwise_remove_object (ECalBackendSync *backend, EDataCal *cal,
 			g_propagate_error (perror, EDC_ERROR (UnsupportedMethod));
 			return;
 		}
-	} else if (priv->mode == CAL_MODE_LOCAL) {
+	} else {
 		in_offline (cbgw);
 		g_propagate_error (perror, EDC_ERROR (RepositoryOffline));
-		return;
-	} else {
-		g_propagate_error (perror, EDC_ERROR_EX (OtherError, "Incorrect online mode set"));
-		return;
 	}
 }
 
@@ -2566,7 +2391,7 @@ receive_object (ECalBackendGroupwise *cbgw, EDataCal *cal, icalcomponent *icalco
 
 /* Update_objects handler for the file backend. */
 static void
-e_cal_backend_groupwise_receive_objects (ECalBackendSync *backend, EDataCal *cal, const gchar *calobj, GError **perror)
+e_cal_backend_groupwise_receive_objects (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, GError **perror)
 {
 	ECalBackendGroupwise *cbgw;
 	ECalBackendGroupwisePrivate *priv;
@@ -2577,7 +2402,7 @@ e_cal_backend_groupwise_receive_objects (ECalBackendSync *backend, EDataCal *cal
 	cbgw = E_CAL_BACKEND_GROUPWISE (backend);
 	priv = cbgw->priv;
 
-	if (priv->mode == CAL_MODE_LOCAL) {
+	if (!priv->is_online) {
 		in_offline (cbgw);
 		g_propagate_error (perror, EDC_ERROR (RepositoryOffline));
 		return;
@@ -2637,9 +2462,7 @@ send_object (ECalBackendGroupwise *cbgw, EDataCal *cal, icalcomponent *icalcomp,
 		return;
 	}
 
-	switch (priv->mode) {
-	case CAL_MODE_ANY :
-	case CAL_MODE_REMOTE :
+	if (priv->is_online) {
 		if (method == ICAL_METHOD_CANCEL) {
 			const gchar *retract_comment = NULL;
 			gboolean all_instances = FALSE;
@@ -2658,14 +2481,9 @@ send_object (ECalBackendGroupwise *cbgw, EDataCal *cal, icalcomponent *icalcomp,
 			if (status != E_GW_CONNECTION_STATUS_OK)
 				g_propagate_error (perror, EDC_ERROR_FAILED_STATUS (OtherError, status));
 		}
-		break;
-	case CAL_MODE_LOCAL :
+	} else {
 		/* in offline mode, we just update the cache */
 		g_propagate_error (perror, EDC_ERROR (RepositoryOffline));
-		break;
-	default:
-		g_propagate_error (perror, EDC_ERROR (OtherError));
-		break;
 	}
 
 	g_object_unref (comp);
@@ -2673,7 +2491,7 @@ send_object (ECalBackendGroupwise *cbgw, EDataCal *cal, icalcomponent *icalcomp,
 }
 
 static void
-e_cal_backend_groupwise_send_objects (ECalBackendSync *backend, EDataCal *cal, const gchar *calobj, GList **users,
+e_cal_backend_groupwise_send_objects (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, GSList **users,
 				      gchar **modified_calobj, GError **perror)
 {
 	icalcomponent *icalcomp, *subcomp;
@@ -2689,7 +2507,7 @@ e_cal_backend_groupwise_send_objects (ECalBackendSync *backend, EDataCal *cal, c
 	cbgw = E_CAL_BACKEND_GROUPWISE (backend);
 	priv = cbgw->priv;
 
-	if (priv->mode == CAL_MODE_LOCAL) {
+	if (!priv->is_online) {
 		in_offline (cbgw);
 		g_propagate_error (perror, EDC_ERROR (RepositoryOffline));
 		return;
@@ -2728,7 +2546,7 @@ e_cal_backend_groupwise_send_objects (ECalBackendSync *backend, EDataCal *cal, c
 		if (e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp))) {
 			GSList *attendee_list = NULL, *tmp;
 			e_cal_component_get_attendee_list (comp, &attendee_list);
-			/* convert this into GList */
+
 			for (tmp = attendee_list; tmp; tmp = g_slist_next (tmp)) {
 				ECalComponentAttendee *attendee = NULL;
 				const gchar *email_id = NULL;
@@ -2737,7 +2555,7 @@ e_cal_backend_groupwise_send_objects (ECalBackendSync *backend, EDataCal *cal, c
 					email_id = attendee->value;
 					if (!g_ascii_strncasecmp (email_id, "mailto:";, 7))
 						email_id += 7;
-					*users = g_list_append (*users, g_strdup (email_id));
+					*users = g_slist_append (*users, g_strdup (email_id));
 				}
 			}
 
@@ -2787,33 +2605,26 @@ e_cal_backend_groupwise_class_init (ECalBackendGroupwiseClass *class)
 
 	object_class->finalize = e_cal_backend_groupwise_finalize;
 
-	sync_class->is_read_only_sync = e_cal_backend_groupwise_is_read_only;
-	sync_class->get_cal_address_sync = e_cal_backend_groupwise_get_cal_address;
+	sync_class->get_cal_email_address_sync = e_cal_backend_groupwise_get_cal_email_address;
 	sync_class->get_alarm_email_address_sync = e_cal_backend_groupwise_get_alarm_email_address;
-	sync_class->get_ldap_attribute_sync = e_cal_backend_groupwise_get_ldap_attribute;
-	sync_class->get_static_capabilities_sync = e_cal_backend_groupwise_get_static_capabilities;
+	sync_class->get_capabilities_sync = e_cal_backend_groupwise_get_capabilities;
 	sync_class->open_sync = e_cal_backend_groupwise_open;
+	sync_class->authenticate_user_sync = e_cal_backend_groupwise_authenticate_user;
 	sync_class->remove_sync = e_cal_backend_groupwise_remove;
 	sync_class->create_object_sync = e_cal_backend_groupwise_create_object;
 	sync_class->modify_object_sync = e_cal_backend_groupwise_modify_object;
 	sync_class->remove_object_sync = e_cal_backend_groupwise_remove_object;
-	sync_class->discard_alarm_sync = e_cal_backend_groupwise_discard_alarm;
 	sync_class->receive_objects_sync = e_cal_backend_groupwise_receive_objects;
 	sync_class->send_objects_sync = e_cal_backend_groupwise_send_objects;
 	sync_class->get_default_object_sync = e_cal_backend_groupwise_get_default_object;
 	sync_class->get_object_sync = e_cal_backend_groupwise_get_object;
 	sync_class->get_object_list_sync = e_cal_backend_groupwise_get_object_list;
-	sync_class->get_attachment_list_sync = e_cal_backend_groupwise_get_attachment_list;
+	sync_class->get_attachment_uris_sync = e_cal_backend_groupwise_get_attachment_uris;
 	sync_class->add_timezone_sync = e_cal_backend_groupwise_add_timezone;
-	sync_class->set_default_zone_sync = e_cal_backend_groupwise_set_default_zone;
-	sync_class->get_freebusy_sync = e_cal_backend_groupwise_get_free_busy;
-	sync_class->get_changes_sync = e_cal_backend_groupwise_get_changes;
-
-	backend_class->is_loaded = e_cal_backend_groupwise_is_loaded;
-	backend_class->start_query = e_cal_backend_groupwise_start_query;
-	backend_class->get_mode = e_cal_backend_groupwise_get_mode;
-	backend_class->set_mode = e_cal_backend_groupwise_set_mode;
-	backend_class->internal_get_default_timezone = e_cal_backend_groupwise_internal_get_default_timezone;
+	sync_class->get_free_busy_sync = e_cal_backend_groupwise_get_free_busy;
+
+	backend_class->start_view = e_cal_backend_groupwise_start_view;
+	backend_class->set_online = e_cal_backend_groupwise_set_online;
 	backend_class->internal_get_timezone = e_cal_backend_groupwise_internal_get_timezone;
 }
 
diff --git a/calendar/backends/http/e-cal-backend-http.c b/calendar/backends/http/e-cal-backend-http.c
index dfcc56a..44d9016 100644
--- a/calendar/backends/http/e-cal-backend-http.c
+++ b/calendar/backends/http/e-cal-backend-http.c
@@ -54,18 +54,11 @@ struct _ECalBackendHttpPrivate {
 	gchar *uri;
 
 	/* Local/remote mode */
-	CalMode mode;
+	gboolean is_online;
 
 	/* The file cache */
 	ECalBackendStore *store;
 
-	/* The calendar's default timezone, used for resolving DATE and
-	   floating DATE-TIME values. */
-	icaltimezone *default_zone;
-
-	/* The list of live queries */
-	GList *queries;
-
 	/* Soup handles for remote file */
 	SoupSession *soup_session;
 
@@ -75,9 +68,9 @@ struct _ECalBackendHttpPrivate {
 
 	/* Flags */
 	gboolean opened;
+	gboolean requires_auth;
 
-	gchar *username;
-	gchar *password;
+	ECredentials *credentials;
 };
 
 
@@ -87,7 +80,7 @@ struct _ECalBackendHttpPrivate {
 static void e_cal_backend_http_dispose (GObject *object);
 static void e_cal_backend_http_finalize (GObject *object);
 static gboolean begin_retrieval_cb (ECalBackendHttp *cbhttp);
-static void e_cal_backend_http_add_timezone (ECalBackendSync *backend, EDataCal *cal, const gchar *tzobj, GError **perror);
+static void e_cal_backend_http_add_timezone (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *tzobj, GError **perror);
 
 static ECalBackendSyncClass *parent_class;
 
@@ -103,10 +96,8 @@ e_cal_backend_http_dispose (GObject *object)
 	cbhttp = E_CAL_BACKEND_HTTP (object);
 	priv = cbhttp->priv;
 
-	g_free (priv->username);
-	g_free (priv->password);
-	priv->username = NULL;
-	priv->password = NULL;
+	e_credentials_free (priv->credentials);
+	priv->credentials = NULL;
 
 	if (priv->source_changed_id) {
 		g_signal_handler_disconnect (e_cal_backend_get_source (E_CAL_BACKEND (cbhttp)), priv->source_changed_id);
@@ -142,11 +133,6 @@ e_cal_backend_http_finalize (GObject *object)
 		priv->uri = NULL;
 	}
 
-	if (priv->default_zone) {
-		icaltimezone_free (priv->default_zone, 1);
-		priv->default_zone = NULL;
-	}
-
 	if (priv->soup_session) {
 		soup_session_abort (priv->soup_session);
 		g_object_unref (priv->soup_session);
@@ -169,16 +155,8 @@ e_cal_backend_http_finalize (GObject *object)
 
 /* Calendar backend methods */
 
-/* Is_read_only handler for the file backend */
-static void
-e_cal_backend_http_is_read_only (ECalBackendSync *backend, EDataCal *cal, gboolean *read_only, GError **perror)
-{
-	*read_only = TRUE;
-}
-
-/* Get_email_address handler for the file backend */
 static void
-e_cal_backend_http_get_cal_address (ECalBackendSync *backend, EDataCal *cal, gchar **address, GError **perror)
+e_cal_backend_http_get_cal_email_address (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **address, GError **perror)
 {
 	/* A HTTP backend has no particular email address associated
 	 * with it (although that would be a useful feature some day).
@@ -187,13 +165,7 @@ e_cal_backend_http_get_cal_address (ECalBackendSync *backend, EDataCal *cal, gch
 }
 
 static void
-e_cal_backend_http_get_ldap_attribute (ECalBackendSync *backend, EDataCal *cal, gchar **attribute, GError **perror)
-{
-	*attribute = NULL;
-}
-
-static void
-e_cal_backend_http_get_alarm_email_address (ECalBackendSync *backend, EDataCal *cal, gchar **address, GError **perror)
+e_cal_backend_http_get_alarm_email_address (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **address, GError **perror)
 {
 	/* A HTTP backend has no particular email address associated
 	 * with it (although that would be a useful feature some day).
@@ -202,7 +174,7 @@ e_cal_backend_http_get_alarm_email_address (ECalBackendSync *backend, EDataCal *
 }
 
 static void
-e_cal_backend_http_get_static_capabilities (ECalBackendSync *backend, EDataCal *cal, gchar **capabilities, GError **perror)
+e_cal_backend_http_get_capabilities (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **capabilities, GError **perror)
 {
 	*capabilities = g_strdup (
 		CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS ","
@@ -346,6 +318,11 @@ put_component_to_store (ECalBackendHttp *cb,
 				changed = (sequence1 != NULL && sequence2 == NULL) ||
 					  (sequence1 == NULL && sequence2 != NULL) ||
 					  (sequence1 != NULL && sequence2 != NULL && *sequence1 != *sequence2);
+
+				if (sequence1)
+					e_cal_component_free_sequence (sequence1);
+				if (sequence2)
+					e_cal_component_free_sequence (sequence2);
 			}
 		}
 
@@ -356,7 +333,7 @@ put_component_to_store (ECalBackendHttp *cb,
 	}
 
 	e_cal_util_get_component_occur_times (comp, &time_start, &time_end,
-				   resolve_tzid, cb, priv->default_zone,
+				   resolve_tzid, cb, icaltimezone_get_utc_timezone (),
 				   e_cal_backend_get_kind (E_CAL_BACKEND (cb)));
 
 	e_cal_backend_store_put_component_with_time_range (priv->store, comp, time_start, time_end);
@@ -430,9 +407,14 @@ retrieval_done (SoupSession *session, SoupMessage *msg, ECalBackendHttp *cbhttp)
 	/* check status code */
 	if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) {
 		if (!priv->opened) {
-			e_cal_backend_notify_error (E_CAL_BACKEND (cbhttp),
-				msg->reason_phrase && *msg->reason_phrase ? msg->reason_phrase :
-				(soup_status_get_phrase (msg->status_code) ? soup_status_get_phrase (msg->status_code) : _("Unknown error")));
+			if (msg->status_code == 401 || msg->status_code == 403) {
+				priv->requires_auth = TRUE;
+				e_cal_backend_notify_auth_required (E_CAL_BACKEND (cbhttp), priv->credentials);
+				return;
+			} else
+				e_cal_backend_notify_error (E_CAL_BACKEND (cbhttp),
+					msg->reason_phrase && *msg->reason_phrase ? msg->reason_phrase :
+					(soup_status_get_phrase (msg->status_code) ? soup_status_get_phrase (msg->status_code) : _("Unknown error")));
 		}
 
 		empty_cache (cbhttp);
@@ -564,11 +546,10 @@ soup_authenticate (SoupSession  *session,
 	cbhttp = E_CAL_BACKEND_HTTP (data);
 	priv =  cbhttp->priv;
 
-	soup_auth_authenticate (auth, priv->username, priv->password);
-
-	priv->username = NULL;
-	priv->password = NULL;
-
+	if (!retrying && priv->credentials && e_credentials_has_key (priv->credentials, E_CREDENTIALS_KEY_USERNAME)) {
+		soup_auth_authenticate (auth, e_credentials_peek (priv->credentials, E_CREDENTIALS_KEY_USERNAME), e_credentials_peek (priv->credentials, E_CREDENTIALS_KEY_PASSWORD));
+		e_credentials_clear_peek (priv->credentials);
+	}
 }
 
 static gboolean reload_cb                  (ECalBackendHttp *cbhttp);
@@ -582,7 +563,7 @@ begin_retrieval_cb (ECalBackendHttp *cbhttp)
 
 	priv = cbhttp->priv;
 
-	if (priv->mode != CAL_MODE_REMOTE)
+	if (!priv->is_online)
 		return FALSE;
 
 	maybe_start_reload_timeout (cbhttp);
@@ -733,8 +714,7 @@ source_changed_cb (ESource *source, ECalBackendHttp *cbhttp)
 
 /* Open handler for the file backend */
 static void
-e_cal_backend_http_open (ECalBackendSync *backend, EDataCal *cal, gboolean only_if_exists,
-			 const gchar *username, const gchar *password, GError **perror)
+e_cal_backend_http_open (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gboolean only_if_exists, GError **perror)
 {
 	ECalBackendHttp *cbhttp;
 	ECalBackendHttpPrivate *priv;
@@ -759,16 +739,6 @@ e_cal_backend_http_open (ECalBackendSync *backend, EDataCal *cal, gboolean only_
 	priv->uri = NULL;
 	g_free (tmp);
 
-	if (e_source_get_property (source, "auth") != NULL) {
-		if ((username == NULL || password == NULL)) {
-			g_propagate_error (perror, EDC_ERROR (AuthenticationRequired));
-			return;
-		}
-
-		priv->username = g_strdup (username);
-		priv->password = g_strdup (password);
-	}
-
 	if (!priv->store) {
 		const gchar *cache_dir;
 
@@ -783,18 +753,51 @@ e_cal_backend_http_open (ECalBackendSync *backend, EDataCal *cal, gboolean only_
 			g_propagate_error (perror, EDC_ERROR_EX (OtherError, _("Could not create cache file")));
 			return;
 		}
+	}
 
-		if (priv->default_zone) {
-			e_cal_backend_store_set_default_timezone (priv->store, priv->default_zone);
-		}
+	e_cal_backend_set_is_loaded (E_CAL_BACKEND (backend), TRUE);
+	e_cal_backend_notify_readonly (E_CAL_BACKEND (backend), TRUE);
+	e_cal_backend_notify_online (E_CAL_BACKEND (backend), priv->is_online);
+
+	if (priv->is_online) {
+		if (e_source_get_property (source, "auth"))
+			e_cal_backend_notify_auth_required (E_CAL_BACKEND (cbhttp), priv->credentials);
+		else if (priv->requires_auth && perror && !*perror)
+			g_propagate_error (perror, EDC_ERROR (AuthenticationRequired));
+		else
+			g_idle_add ((GSourceFunc) begin_retrieval_cb, cbhttp);
 	}
+}
 
-	if (priv->mode != CAL_MODE_LOCAL)
-		g_idle_add ((GSourceFunc) begin_retrieval_cb, cbhttp);
+static void
+e_cal_backend_http_authenticate_user (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, ECredentials *credentials, GError **error)
+{
+	ECalBackendHttp        *cbhttp;
+	ECalBackendHttpPrivate *priv;
+
+	cbhttp = E_CAL_BACKEND_HTTP (backend);
+	priv  = cbhttp->priv;
+
+	if (priv->credentials && credentials && e_credentials_equal_keys (priv->credentials, credentials, E_CREDENTIALS_KEY_USERNAME, E_CREDENTIALS_KEY_PASSWORD, NULL)) {
+		g_propagate_error (error, EDC_ERROR (AuthenticationFailed));
+		return;
+	}
+
+	e_credentials_free (priv->credentials);
+	priv->credentials = NULL;
+
+	if (!credentials || !e_credentials_has_key (credentials, E_CREDENTIALS_KEY_USERNAME)) {
+		g_propagate_error (error, EDC_ERROR (AuthenticationFailed));
+		return;
+	}
+
+	priv->credentials = e_credentials_new_clone (credentials);
+
+	g_idle_add ((GSourceFunc) begin_retrieval_cb, cbhttp);
 }
 
 static void
-e_cal_backend_http_refresh (ECalBackendSync *backend, EDataCal *cal, GError **perror)
+e_cal_backend_http_refresh (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, GError **perror)
 {
 	ECalBackendHttp *cbhttp;
 	ECalBackendHttpPrivate *priv;
@@ -815,7 +818,7 @@ e_cal_backend_http_refresh (ECalBackendSync *backend, EDataCal *cal, GError **pe
 }
 
 static void
-e_cal_backend_http_remove (ECalBackendSync *backend, EDataCal *cal, GError **perror)
+e_cal_backend_http_remove (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, GError **perror)
 {
 	ECalBackendHttp *cbhttp;
 	ECalBackendHttpPrivate *priv;
@@ -829,93 +832,38 @@ e_cal_backend_http_remove (ECalBackendSync *backend, EDataCal *cal, GError **per
 	e_cal_backend_store_remove (priv->store);
 }
 
-/* is_loaded handler for the file backend */
-static gboolean
-e_cal_backend_http_is_loaded (ECalBackend *backend)
-{
-	ECalBackendHttp *cbhttp;
-	ECalBackendHttpPrivate *priv;
-
-	cbhttp = E_CAL_BACKEND_HTTP (backend);
-	priv = cbhttp->priv;
-
-	if (!priv->store)
-		return FALSE;
-
-	return TRUE;
-}
-
-/* is_remote handler for the http backend */
-static CalMode
-e_cal_backend_http_get_mode (ECalBackend *backend)
-{
-	ECalBackendHttp *cbhttp;
-	ECalBackendHttpPrivate *priv;
-
-	cbhttp = E_CAL_BACKEND_HTTP (backend);
-	priv = cbhttp->priv;
-
-	return priv->mode;
-}
-
 /* Set_mode handler for the http backend */
 static void
-e_cal_backend_http_set_mode (ECalBackend *backend, CalMode mode)
+e_cal_backend_http_set_online (ECalBackend *backend, gboolean is_online)
 {
 	ECalBackendHttp *cbhttp;
 	ECalBackendHttpPrivate *priv;
-	EDataCalMode set_mode;
 	gboolean loaded;
 
 	cbhttp = E_CAL_BACKEND_HTTP (backend);
 	priv = cbhttp->priv;
 
-	loaded = e_cal_backend_http_is_loaded (backend);
+	loaded = e_cal_backend_is_loaded (backend);
 
-	if (priv->mode != mode) {
-		switch (mode) {
-			case CAL_MODE_LOCAL:
-				priv->mode = mode;
-				set_mode = cal_mode_to_corba (mode);
-				if (loaded && priv->reload_timeout_id) {
-					g_source_remove (priv->reload_timeout_id);
-					priv->reload_timeout_id = 0;
-				}
-				break;
-			case CAL_MODE_REMOTE:
-			case CAL_MODE_ANY:
-				priv->mode = mode;
-				set_mode = cal_mode_to_corba (mode);
-				if (loaded)
-					g_idle_add ((GSourceFunc) begin_retrieval_cb, backend);
-				break;
-
-				priv->mode = CAL_MODE_REMOTE;
-				set_mode = Remote;
-				break;
-			default:
-				set_mode = AnyMode;
-				break;
+	if ((priv->is_online ? 1 : 0) != (is_online ? 1 : 0)) {
+		priv->is_online = is_online;
+		if (!priv->is_online) {
+			if (loaded && priv->reload_timeout_id) {
+				g_source_remove (priv->reload_timeout_id);
+				priv->reload_timeout_id = 0;
+			}
+		} else {
+			if (loaded)
+				g_idle_add ((GSourceFunc) begin_retrieval_cb, backend);
 		}
-	} else {
-		set_mode = cal_mode_to_corba (priv->mode);
 	}
 
-	if (loaded) {
-
-		if (set_mode == AnyMode)
-			e_cal_backend_notify_mode (backend,
-						   ModeNotSupported,
-						   cal_mode_to_corba (priv->mode));
-		else
-			e_cal_backend_notify_mode (backend,
-						   ModeSet,
-						   set_mode);
-	}
+	if (loaded)
+		e_cal_backend_notify_online (backend, priv->is_online);
 }
 
 static void
-e_cal_backend_http_get_default_object (ECalBackendSync *backend, EDataCal *cal, gchar **object, GError **perror)
+e_cal_backend_http_get_default_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **object, GError **perror)
 {
 	icalcomponent *icalcomp;
 	icalcomponent_kind kind;
@@ -928,7 +876,7 @@ e_cal_backend_http_get_default_object (ECalBackendSync *backend, EDataCal *cal,
 
 /* Get_object_component handler for the http backend */
 static void
-e_cal_backend_http_get_object (ECalBackendSync *backend, EDataCal *cal, const gchar *uid, const gchar *rid, gchar **object, GError **error)
+e_cal_backend_http_get_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, gchar **object, GError **error)
 {
 	ECalBackendHttp *cbhttp;
 	ECalBackendHttpPrivate *priv;
@@ -956,7 +904,7 @@ e_cal_backend_http_get_object (ECalBackendSync *backend, EDataCal *cal, const gc
 
 /* Add_timezone handler for the file backend */
 static void
-e_cal_backend_http_add_timezone (ECalBackendSync *backend, EDataCal *cal, const gchar *tzobj, GError **error)
+e_cal_backend_http_add_timezone (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *tzobj, GError **error)
 {
 	ECalBackendHttp *cbhttp;
 	ECalBackendHttpPrivate *priv;
@@ -987,40 +935,9 @@ e_cal_backend_http_add_timezone (ECalBackendSync *backend, EDataCal *cal, const
 	e_cal_backend_store_put_timezone (priv->store, zone);
 }
 
-static void
-e_cal_backend_http_set_default_zone (ECalBackendSync *backend, EDataCal *cal, const gchar *tzobj, GError **error)
-{
-	icalcomponent *tz_comp;
-	ECalBackendHttp *cbhttp;
-	ECalBackendHttpPrivate *priv;
-	icaltimezone *zone;
-
-	cbhttp = (ECalBackendHttp *) backend;
-
-	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_HTTP (cbhttp), InvalidArg);
-	e_return_data_cal_error_if_fail (tzobj != NULL, InvalidArg);
-
-	priv = cbhttp->priv;
-
-	tz_comp = icalparser_parse_string (tzobj);
-	if (!tz_comp) {
-		g_propagate_error (error, EDC_ERROR (InvalidObject));
-		return;
-	}
-
-	zone = icaltimezone_new ();
-	icaltimezone_set_component (zone, tz_comp);
-
-	if (priv->default_zone)
-		icaltimezone_free (priv->default_zone, 1);
-
-	/* Set the default timezone to it. */
-	priv->default_zone = zone;
-}
-
 /* Get_objects_in_range handler for the file backend */
 static void
-e_cal_backend_http_get_object_list (ECalBackendSync *backend, EDataCal *cal, const gchar *sexp, GList **objects, GError **perror)
+e_cal_backend_http_get_object_list (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *sexp, GSList **objects, GError **perror)
 {
 	ECalBackendHttp *cbhttp;
 	ECalBackendHttpPrivate *priv;
@@ -1051,7 +968,7 @@ e_cal_backend_http_get_object_list (ECalBackendSync *backend, EDataCal *cal, con
 
 	for (l = components; l != NULL; l = g_slist_next (l)) {
 		if (e_cal_backend_sexp_match_comp (cbsexp, E_CAL_COMPONENT (l->data), E_CAL_BACKEND (backend))) {
-			*objects = g_list_append (*objects, e_cal_component_get_as_string (l->data));
+			*objects = g_slist_append (*objects, e_cal_component_get_as_string (l->data));
 		}
 	}
 
@@ -1060,14 +977,13 @@ e_cal_backend_http_get_object_list (ECalBackendSync *backend, EDataCal *cal, con
 	g_object_unref (cbsexp);
 }
 
-/* get_query handler for the file backend */
 static void
-e_cal_backend_http_start_query (ECalBackend *backend, EDataCalView *query)
+e_cal_backend_http_start_view (ECalBackend *backend, EDataCalView *query)
 {
 	ECalBackendHttp *cbhttp;
 	ECalBackendHttpPrivate *priv;
 	GSList *components, *l;
-	GList *objects = NULL;
+	GSList *objects = NULL;
 	ECalBackendSExp *cbsexp;
 	time_t occur_start = -1, occur_end = -1;
 	gboolean prunning_by_time;
@@ -1079,7 +995,7 @@ e_cal_backend_http_start_query (ECalBackend *backend, EDataCalView *query)
 
 	if (!priv->store) {
 		GError *error = EDC_ERROR (NoSuchCal);
-		e_data_cal_view_notify_done (query, error);
+		e_data_cal_view_notify_complete (query, error);
 		g_error_free (error);
 		return;
 	}
@@ -1098,19 +1014,19 @@ e_cal_backend_http_start_query (ECalBackend *backend, EDataCalView *query)
 
 	for (l = components; l != NULL; l = g_slist_next (l)) {
 		if (e_cal_backend_sexp_match_comp (cbsexp, E_CAL_COMPONENT (l->data), E_CAL_BACKEND (backend))) {
-			objects = g_list_append (objects, e_cal_component_get_as_string (l->data));
+			objects = g_slist_append (objects, e_cal_component_get_as_string (l->data));
 		}
 	}
 
-	e_data_cal_view_notify_objects_added (query, (const GList *) objects);
+	e_data_cal_view_notify_objects_added (query, objects);
 
 	g_slist_foreach (components, (GFunc) g_object_unref, NULL);
 	g_slist_free (components);
-	g_list_foreach (objects, (GFunc) g_free, NULL);
-	g_list_free (objects);
+	g_slist_foreach (objects, (GFunc) g_free, NULL);
+	g_slist_free (objects);
 	g_object_unref (cbsexp);
 
-	e_data_cal_view_notify_done (query, NULL /* Success */);
+	e_data_cal_view_notify_complete (query, NULL /* Success */);
 }
 
 /***** static icaltimezone *
@@ -1236,17 +1152,16 @@ create_user_free_busy (ECalBackendHttp *cbhttp, const gchar *address, const gcha
 						vfb,
 						resolve_tzid,
 						vcalendar_comp,
-						(icaltimezone *)e_cal_backend_store_get_default_timezone (store));
+						icaltimezone_get_utc_timezone ());
 	}
 	g_object_unref (obj_sexp);
 
 	return vfb;
 }
 
-/* Get_free_busy handler for the file backend */
 static void
-e_cal_backend_http_get_free_busy (ECalBackendSync *backend, EDataCal *cal, GList *users,
-				time_t start, time_t end, GList **freebusy, GError **error)
+e_cal_backend_http_get_free_busy (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const GSList *users,
+				time_t start, time_t end, GSList **freebusy, GError **error)
 {
 	ECalBackendHttp *cbhttp;
 	ECalBackendHttpPrivate *priv;
@@ -1269,19 +1184,19 @@ e_cal_backend_http_get_free_busy (ECalBackendSync *backend, EDataCal *cal, GList
 		if (e_cal_backend_mail_account_get_default (&address, &name)) {
 			vfb = create_user_free_busy (cbhttp, address, name, start, end);
 			calobj = icalcomponent_as_ical_string_r (vfb);
-                        *freebusy = g_list_append (*freebusy, calobj);
+                        *freebusy = g_slist_append (*freebusy, calobj);
 			icalcomponent_free (vfb);
 			g_free (address);
 			g_free (name);
 		}
 	} else {
-		GList *l;
+		const GSList *l;
 		for (l = users; l != NULL; l = l->next ) {
 			address = l->data;
 			if (e_cal_backend_mail_account_is_valid (address, &name)) {
 				vfb = create_user_free_busy (cbhttp, address, name, start, end);
 				calobj = icalcomponent_as_ical_string_r (vfb);
-                                *freebusy = g_list_append (*freebusy, calobj);
+                                *freebusy = g_slist_append (*freebusy, calobj);
 				icalcomponent_free (vfb);
 				g_free (name);
 			}
@@ -1289,29 +1204,14 @@ e_cal_backend_http_get_free_busy (ECalBackendSync *backend, EDataCal *cal, GList
 	}
 }
 
-/* Get_changes handler for the file backend */
-static void
-e_cal_backend_http_get_changes (ECalBackendSync *backend, EDataCal *cal, const gchar *change_id,
-				GList **adds, GList **modifies, GList **deletes, GError **perror)
-{
-	g_propagate_error (perror, EDC_ERROR (NotSupported));
-}
-
-/* Discard_alarm handler for the file backend */
-static void
-e_cal_backend_http_discard_alarm (ECalBackendSync *backend, EDataCal *cal, const gchar *uid, const gchar *auid, GError **perror)
-{
-	/* FIXME */
-}
-
 static void
-e_cal_backend_http_create_object (ECalBackendSync *backend, EDataCal *cal, gchar **calobj, gchar **uid, GError **perror)
+e_cal_backend_http_create_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, gchar **uid, gchar **new_calobj, GError **perror)
 {
 	g_propagate_error (perror, EDC_ERROR (PermissionDenied));
 }
 
 static void
-e_cal_backend_http_modify_object (ECalBackendSync *backend, EDataCal *cal, const gchar *calobj,
+e_cal_backend_http_modify_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj,
 				CalObjModType mod, gchar **old_object, gchar **new_object, GError **perror)
 {
 	g_propagate_error (perror, EDC_ERROR (PermissionDenied));
@@ -1319,7 +1219,7 @@ e_cal_backend_http_modify_object (ECalBackendSync *backend, EDataCal *cal, const
 
 /* Remove_object handler for the file backend */
 static void
-e_cal_backend_http_remove_object (ECalBackendSync *backend, EDataCal *cal,
+e_cal_backend_http_remove_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable,
 				const gchar *uid, const gchar *rid,
 				CalObjModType mod, gchar **old_object,
 				gchar **object, GError **perror)
@@ -1331,13 +1231,13 @@ e_cal_backend_http_remove_object (ECalBackendSync *backend, EDataCal *cal,
 
 /* Update_objects handler for the file backend. */
 static void
-e_cal_backend_http_receive_objects (ECalBackendSync *backend, EDataCal *cal, const gchar *calobj, GError **perror)
+e_cal_backend_http_receive_objects (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, GError **perror)
 {
 	g_propagate_error (perror, EDC_ERROR (PermissionDenied));
 }
 
 static void
-e_cal_backend_http_send_objects (ECalBackendSync *backend, EDataCal *cal, const gchar *calobj, GList **users,
+e_cal_backend_http_send_objects (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, GSList **users,
 				 gchar **modified_calobj, GError **perror)
 {
 	*users = NULL;
@@ -1347,21 +1247,6 @@ e_cal_backend_http_send_objects (ECalBackendSync *backend, EDataCal *cal, const
 }
 
 static icaltimezone *
-e_cal_backend_http_internal_get_default_timezone (ECalBackend *backend)
-{
-	ECalBackendHttp *cbhttp;
-	ECalBackendHttpPrivate *priv;
-
-	cbhttp = E_CAL_BACKEND_HTTP (backend);
-	priv = cbhttp->priv;
-
-	if (!priv->store)
-		return NULL;
-
-	return NULL;
-}
-
-static icaltimezone *
 e_cal_backend_http_internal_get_timezone (ECalBackend *backend, const gchar *tzid)
 {
 	ECalBackendHttp *cbhttp;
@@ -1419,33 +1304,26 @@ e_cal_backend_http_class_init (ECalBackendHttpClass *class)
 	object_class->dispose = e_cal_backend_http_dispose;
 	object_class->finalize = e_cal_backend_http_finalize;
 
-	sync_class->is_read_only_sync = e_cal_backend_http_is_read_only;
-	sync_class->get_cal_address_sync = e_cal_backend_http_get_cal_address;
+	sync_class->get_cal_email_address_sync = e_cal_backend_http_get_cal_email_address;
 	sync_class->get_alarm_email_address_sync = e_cal_backend_http_get_alarm_email_address;
-	sync_class->get_ldap_attribute_sync = e_cal_backend_http_get_ldap_attribute;
-	sync_class->get_static_capabilities_sync = e_cal_backend_http_get_static_capabilities;
+	sync_class->get_capabilities_sync = e_cal_backend_http_get_capabilities;
 	sync_class->open_sync = e_cal_backend_http_open;
+	sync_class->authenticate_user_sync = e_cal_backend_http_authenticate_user;
 	sync_class->refresh_sync = e_cal_backend_http_refresh;
 	sync_class->remove_sync = e_cal_backend_http_remove;
 	sync_class->create_object_sync = e_cal_backend_http_create_object;
 	sync_class->modify_object_sync = e_cal_backend_http_modify_object;
 	sync_class->remove_object_sync = e_cal_backend_http_remove_object;
-	sync_class->discard_alarm_sync = e_cal_backend_http_discard_alarm;
 	sync_class->receive_objects_sync = e_cal_backend_http_receive_objects;
 	sync_class->send_objects_sync = e_cal_backend_http_send_objects;
 	sync_class->get_default_object_sync = e_cal_backend_http_get_default_object;
 	sync_class->get_object_sync = e_cal_backend_http_get_object;
 	sync_class->get_object_list_sync = e_cal_backend_http_get_object_list;
 	sync_class->add_timezone_sync = e_cal_backend_http_add_timezone;
-	sync_class->set_default_zone_sync = e_cal_backend_http_set_default_zone;
-	sync_class->get_freebusy_sync = e_cal_backend_http_get_free_busy;
-	sync_class->get_changes_sync = e_cal_backend_http_get_changes;
+	sync_class->get_free_busy_sync = e_cal_backend_http_get_free_busy;
 
-	backend_class->is_loaded = e_cal_backend_http_is_loaded;
-	backend_class->start_query = e_cal_backend_http_start_query;
-	backend_class->get_mode = e_cal_backend_http_get_mode;
-	backend_class->set_mode = e_cal_backend_http_set_mode;
+	backend_class->start_view = e_cal_backend_http_start_view;
+	backend_class->set_online = e_cal_backend_http_set_online;
 
-	backend_class->internal_get_default_timezone = e_cal_backend_http_internal_get_default_timezone;
 	backend_class->internal_get_timezone = e_cal_backend_http_internal_get_timezone;
 }
diff --git a/calendar/backends/weather/e-cal-backend-weather.c b/calendar/backends/weather/e-cal-backend-weather.c
index 6e62126..6fe42fc 100644
--- a/calendar/backends/weather/e-cal-backend-weather.c
+++ b/calendar/backends/weather/e-cal-backend-weather.c
@@ -42,7 +42,7 @@ G_DEFINE_TYPE (ECalBackendWeather, e_cal_backend_weather, E_TYPE_CAL_BACKEND_SYN
 static gboolean reload_cb (ECalBackendWeather *cbw);
 static gboolean begin_retrieval_cb (ECalBackendWeather *cbw);
 static ECalComponent* create_weather (ECalBackendWeather *cbw, WeatherInfo *report, gboolean is_forecast);
-static void e_cal_backend_weather_add_timezone (ECalBackendSync *backend, EDataCal *cal, const gchar *tzobj, GError **perror);
+static void e_cal_backend_weather_add_timezone (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *tzobj, GError **perror);
 
 /* Private part of the ECalBackendWeather structure */
 struct _ECalBackendWeatherPrivate {
@@ -50,14 +50,11 @@ struct _ECalBackendWeatherPrivate {
 	gchar *uri;
 
 	/* Local/remote mode */
-	CalMode mode;
+	gboolean is_online;
 
 	/* The file cache */
 	ECalBackendStore *store;
 
-	/* The calendar's default timezone, used for resolving DATE and
-	   floating DATE-TIME values. */
-	icaltimezone *default_zone;
 	GHashTable *zones;
 
 	/* Reload */
@@ -165,7 +162,7 @@ put_component_to_store (ECalBackendWeather *cb,
 	priv = cb->priv;
 
 	e_cal_util_get_component_occur_times (comp, &time_start, &time_end,
-				   resolve_tzid, cb, priv->default_zone,
+				   resolve_tzid, cb, icaltimezone_get_utc_timezone (),
 				   e_cal_backend_get_kind (E_CAL_BACKEND (cb)));
 
 	e_cal_backend_store_put_component_with_time_range (priv->store, comp, time_start, time_end);
@@ -253,7 +250,7 @@ begin_retrieval_cb (ECalBackendWeather *cbw)
 	ECalBackendWeatherPrivate *priv = cbw->priv;
 	GSource *source;
 
-	if (priv->mode != CAL_MODE_REMOTE)
+	if (!priv->is_online)
 		return TRUE;
 
 	maybe_start_reload_timeout (cbw);
@@ -369,7 +366,7 @@ create_weather (ECalBackendWeather *cbw, WeatherInfo *report, gboolean is_foreca
 		update_zone = icaltimezone_get_builtin_timezone (location->tz_hint);
 
 	if (!update_zone)
-		update_zone = priv->default_zone;
+		update_zone = icaltimezone_get_utc_timezone ();
 
 	/* Set all-day event's date from forecast data - cannot set is_date,
 	   because in that case no timezone conversion is done */
@@ -456,33 +453,21 @@ create_weather (ECalBackendWeather *cbw, WeatherInfo *report, gboolean is_foreca
 }
 
 static void
-e_cal_backend_weather_is_read_only (ECalBackendSync *backend, EDataCal *cal, gboolean *read_only, GError **perror)
-{
-	*read_only = TRUE;
-}
-
-static void
-e_cal_backend_weather_get_cal_address (ECalBackendSync *backend, EDataCal *cal, gchar **address, GError **perror)
+e_cal_backend_weather_get_cal_email_address (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **address, GError **perror)
 {
 	/* Weather has no particular email addresses associated with it */
 	*address = NULL;
 }
 
 static void
-e_cal_backend_weather_get_alarm_email_address (ECalBackendSync *backend, EDataCal *cal, gchar **address, GError **perror)
+e_cal_backend_weather_get_alarm_email_address (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **address, GError **perror)
 {
 	/* Weather has no particular email addresses associated with it */
 	*address = NULL;
 }
 
 static void
-e_cal_backend_weather_get_ldap_attribute (ECalBackendSync *backend, EDataCal *cal, gchar **attribute, GError **perror)
-{
-	*attribute = NULL;
-}
-
-static void
-e_cal_backend_weather_get_static_capabilities (ECalBackendSync *backend, EDataCal *cal, gchar **capabilities, GError **perror)
+e_cal_backend_weather_get_capabilities (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **capabilities, GError **perror)
 {
 	*capabilities = g_strdup (CAL_STATIC_CAPABILITY_NO_ALARM_REPEAT ","
 				  CAL_STATIC_CAPABILITY_NO_AUDIO_ALARMS  ","
@@ -495,7 +480,7 @@ e_cal_backend_weather_get_static_capabilities (ECalBackendSync *backend, EDataCa
 }
 
 static void
-e_cal_backend_weather_open (ECalBackendSync *backend, EDataCal *cal, gboolean only_if_exists, const gchar *username, const gchar *password, GError **perror)
+e_cal_backend_weather_open (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gboolean only_if_exists, GError **perror)
 {
 	ECalBackendWeather *cbw;
 	ECalBackendWeatherPrivate *priv;
@@ -512,6 +497,9 @@ e_cal_backend_weather_open (ECalBackendSync *backend, EDataCal *cal, gboolean on
 		g_free (priv->city);
 	priv->city = g_strdup (strrchr (uri, '/') + 1);
 
+	e_cal_backend_notify_readonly (E_CAL_BACKEND (backend), TRUE);
+	e_cal_backend_notify_online (E_CAL_BACKEND (backend), priv->is_online);
+
 	if (!priv->store) {
 		e_cal_backend_cache_remove (cache_dir, "cache.xml");
 		priv->store = e_cal_backend_file_store_new (cache_dir);
@@ -520,28 +508,23 @@ e_cal_backend_weather_open (ECalBackendSync *backend, EDataCal *cal, gboolean on
 			g_propagate_error (perror, EDC_ERROR_EX (OtherError, _("Could not create cache file")));
 			return;
 		}
-	/* do we require to load this new store*/	
-		e_cal_backend_store_load (priv->store);
 
-		if (priv->default_zone) {
-			icalcomponent *icalcomp = icaltimezone_get_component (priv->default_zone);
-			icaltimezone *zone = icaltimezone_new ();
-
-			icaltimezone_set_component (zone, icalcomponent_new_clone (icalcomp));
-
-			g_hash_table_insert (priv->zones, g_strdup (icaltimezone_get_tzid (zone)), zone);
-		}
+		/* do we require to load this new store */
+		e_cal_backend_store_load (priv->store);
+		e_cal_backend_set_is_loaded (E_CAL_BACKEND (backend), TRUE);
 
-		if (priv->mode == CAL_MODE_LOCAL)
+		if (!priv->is_online)
 			return;
 
 		if (!priv->begin_retrival_id)
 			priv->begin_retrival_id = g_idle_add ((GSourceFunc) begin_retrieval_cb, cbw);
 	}
+
+	e_cal_backend_set_is_loaded (E_CAL_BACKEND (backend), TRUE);
 }
 
 static void
-e_cal_backend_weather_refresh (ECalBackendSync *backend, EDataCal *cal, GError **perror)
+e_cal_backend_weather_refresh (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, GError **perror)
 {
 	ECalBackendWeather *cbw;
 	ECalBackendWeatherPrivate *priv;
@@ -562,7 +545,7 @@ e_cal_backend_weather_refresh (ECalBackendSync *backend, EDataCal *cal, GError *
 }
 
 static void
-e_cal_backend_weather_remove (ECalBackendSync *backend, EDataCal *cal, GError **perror)
+e_cal_backend_weather_remove (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, GError **perror)
 {
 	ECalBackendWeather *cbw;
 	ECalBackendWeatherPrivate *priv;
@@ -580,24 +563,19 @@ e_cal_backend_weather_remove (ECalBackendSync *backend, EDataCal *cal, GError **
 }
 
 static void
-e_cal_backend_weather_discard_alarm (ECalBackendSync *backend, EDataCal *cal, const gchar *uid, const gchar *auid, GError **perror)
-{
-}
-
-static void
-e_cal_backend_weather_receive_objects (ECalBackendSync *backend, EDataCal *cal, const gchar *calobj, GError **perror)
+e_cal_backend_weather_receive_objects (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, GError **perror)
 {
 	g_propagate_error (perror, EDC_ERROR (PermissionDenied));
 }
 
 static void
-e_cal_backend_weather_get_default_object (ECalBackendSync *backend, EDataCal *cal, gchar **object, GError **perror)
+e_cal_backend_weather_get_default_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **object, GError **perror)
 {
 	g_propagate_error (perror, EDC_ERROR (UnsupportedMethod));
 }
 
 static void
-e_cal_backend_weather_get_object (ECalBackendSync *backend, EDataCal *cal, const gchar *uid, const gchar *rid, gchar **object, GError **error)
+e_cal_backend_weather_get_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, gchar **object, GError **error)
 {
 	ECalBackendWeather *cbw = E_CAL_BACKEND_WEATHER (backend);
 	ECalBackendWeatherPrivate *priv = cbw->priv;
@@ -617,7 +595,7 @@ e_cal_backend_weather_get_object (ECalBackendSync *backend, EDataCal *cal, const
 }
 
 static void
-e_cal_backend_weather_get_object_list (ECalBackendSync *backend, EDataCal *cal, const gchar *sexp_string, GList **objects, GError **perror)
+e_cal_backend_weather_get_object_list (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *sexp_string, GSList **objects, GError **perror)
 {
 	ECalBackendWeather *cbw = E_CAL_BACKEND_WEATHER (backend);
 	ECalBackendWeatherPrivate *priv = cbw->priv;
@@ -643,7 +621,7 @@ e_cal_backend_weather_get_object_list (ECalBackendSync *backend, EDataCal *cal,
 
 	for (l = components; l != NULL; l = g_slist_next (l)) {
 		if (e_cal_backend_sexp_match_comp (sexp, E_CAL_COMPONENT (l->data), E_CAL_BACKEND (backend)))
-			*objects = g_list_append (*objects, e_cal_component_get_as_string (l->data));
+			*objects = g_slist_append (*objects, e_cal_component_get_as_string (l->data));
 	}
 
 	g_slist_foreach (components, (GFunc) g_object_unref, NULL);
@@ -652,7 +630,7 @@ e_cal_backend_weather_get_object_list (ECalBackendSync *backend, EDataCal *cal,
 }
 
 static void
-e_cal_backend_weather_add_timezone (ECalBackendSync *backend, EDataCal *cal, const gchar *tzobj, GError **error)
+e_cal_backend_weather_add_timezone (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *tzobj, GError **error)
 {
 	ECalBackendWeather *cbw;
 	ECalBackendWeatherPrivate *priv;
@@ -687,38 +665,7 @@ e_cal_backend_weather_add_timezone (ECalBackendSync *backend, EDataCal *cal, con
 }
 
 static void
-e_cal_backend_weather_set_default_zone (ECalBackendSync *backend, EDataCal *cal, const gchar *tzobj, GError **error)
-{
-	icalcomponent *tz_comp;
-	ECalBackendWeather *cbw;
-	ECalBackendWeatherPrivate *priv;
-	icaltimezone *zone;
-
-	cbw = (ECalBackendWeather *) backend;
-
-	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_WEATHER (cbw), InvalidArg);
-	e_return_data_cal_error_if_fail (tzobj != NULL, InvalidArg);
-
-	priv = cbw->priv;
-
-	tz_comp = icalparser_parse_string (tzobj);
-	if (!tz_comp) {
-		g_propagate_error (error, EDC_ERROR (InvalidObject));
-		return;
-	}
-
-	zone = icaltimezone_new ();
-	icaltimezone_set_component (zone, tz_comp);
-
-	if (priv->default_zone)
-		icaltimezone_free (priv->default_zone, 1);
-
-	/* Set the default timezone to it. */
-	priv->default_zone = zone;
-}
-
-static void
-e_cal_backend_weather_get_free_busy (ECalBackendSync *backend, EDataCal *cal, GList *users, time_t start, time_t end, GList **freebusy, GError **perror)
+e_cal_backend_weather_get_free_busy (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const GSList *users, time_t start, time_t end, GSList **freebusy, GError **perror)
 {
 	/* Weather doesn't count as busy time */
 	icalcomponent *vfb = icalcomponent_new_vfreebusy ();
@@ -729,37 +676,18 @@ e_cal_backend_weather_get_free_busy (ECalBackendSync *backend, EDataCal *cal, GL
 	icalcomponent_set_dtend (vfb, icaltime_from_timet_with_zone (end, FALSE, utc_zone));
 
 	calobj = icalcomponent_as_ical_string_r (vfb);
-	*freebusy = g_list_append (NULL, calobj);
+	*freebusy = g_slist_append (NULL, calobj);
 	icalcomponent_free (vfb);
 }
 
 static void
-e_cal_backend_weather_get_changes (ECalBackendSync *backend, EDataCal *cal, const gchar *change_id, GList **adds, GList **modifies, GList **deletes, GError **perror)
-{
-}
-
-static gboolean
-e_cal_backend_weather_is_loaded (ECalBackend *backend)
-{
-	ECalBackendWeather *cbw;
-	ECalBackendWeatherPrivate *priv;
-
-	cbw = E_CAL_BACKEND_WEATHER (backend);
-	priv = cbw->priv;
-
-	if (!priv->store)
-		return FALSE;
-
-	return TRUE;
-}
-
-static void e_cal_backend_weather_start_query (ECalBackend *backend, EDataCalView *query)
+e_cal_backend_weather_start_view (ECalBackend *backend, EDataCalView *query)
 {
 	ECalBackendWeather *cbw;
 	ECalBackendWeatherPrivate *priv;
 	ECalBackendSExp *sexp;
 	GSList *components, *l;
-	GList *objects;
+	GSList *objects;
 	GError *error;
 	time_t occur_start = -1, occur_end = -1;
 	gboolean prunning_by_time;
@@ -769,7 +697,7 @@ static void e_cal_backend_weather_start_query (ECalBackend *backend, EDataCalVie
 
 	if (!priv->store) {
 		error = EDC_ERROR (NoSuchCal);
-		e_data_cal_view_notify_done (query, error);
+		e_data_cal_view_notify_complete (query, error);
 		g_error_free (error);
 		return;
 	}
@@ -777,7 +705,7 @@ static void e_cal_backend_weather_start_query (ECalBackend *backend, EDataCalVie
 	sexp = e_data_cal_view_get_object_sexp (query);
 	if (!sexp) {
 		error = EDC_ERROR (InvalidQuery);
-		e_data_cal_view_notify_done (query, error);
+		e_data_cal_view_notify_complete (query, error);
 		g_error_free (error);
 		return;
 	}
@@ -790,92 +718,48 @@ static void e_cal_backend_weather_start_query (ECalBackend *backend, EDataCalVie
 
 	for (l = components; l != NULL; l = g_slist_next (l)) {
 		if (e_cal_backend_sexp_match_comp (sexp, E_CAL_COMPONENT (l->data), backend))
-			objects = g_list_append (objects, e_cal_component_get_as_string (l->data));
+			objects = g_slist_append (objects, e_cal_component_get_as_string (l->data));
 	}
 
 	if (objects)
-		e_data_cal_view_notify_objects_added (query, (const GList *) objects);
+		e_data_cal_view_notify_objects_added (query, objects);
 
 	g_slist_foreach (components, (GFunc) g_object_unref, NULL);
 	g_slist_free (components);
-	g_list_foreach (objects, (GFunc) g_free, NULL);
-	g_list_free (objects);
+	g_slist_foreach (objects, (GFunc) g_free, NULL);
+	g_slist_free (objects);
 	g_object_unref (sexp);
 
-	e_data_cal_view_notify_done (query, NULL /* Success */);
-}
-
-static CalMode
-e_cal_backend_weather_get_mode (ECalBackend *backend)
-{
-	ECalBackendWeather *cbw;
-	ECalBackendWeatherPrivate *priv;
-
-	cbw = E_CAL_BACKEND_WEATHER (backend);
-	priv = cbw->priv;
-
-	return priv->mode;
+	e_data_cal_view_notify_complete (query, NULL /* Success */);
 }
 
 static void
-e_cal_backend_weather_set_mode (ECalBackend *backend, CalMode mode)
+e_cal_backend_weather_set_online (ECalBackend *backend, gboolean is_online)
 {
 	ECalBackendWeather *cbw;
 	ECalBackendWeatherPrivate *priv;
-	EDataCalMode set_mode;
 	gboolean loaded;
 
 	cbw = E_CAL_BACKEND_WEATHER (backend);
 	priv = cbw->priv;
 
-	loaded = e_cal_backend_weather_is_loaded (backend);
-
-	if (priv->mode != mode) {
-		switch (mode) {
-			case CAL_MODE_LOCAL:
-			case CAL_MODE_REMOTE:
-				priv->mode = mode;
-				set_mode = cal_mode_to_corba (mode);
-				if (loaded && priv->reload_timeout_id) {
-					g_source_remove (priv->reload_timeout_id);
-					priv->reload_timeout_id = 0;
-				}
-				break;
-			case CAL_MODE_ANY:
-				priv->mode = mode;
-				set_mode = cal_mode_to_corba (mode);
-				if (loaded && !priv->begin_retrival_id)
-					priv->begin_retrival_id = g_idle_add ((GSourceFunc) begin_retrieval_cb, backend);
-				break;
-			default:
-				set_mode = AnyMode;
-				break;
+	loaded = e_cal_backend_is_loaded (backend);
+
+	if ((priv->is_online ? 1: 0) != (is_online ? 1 : 0)) {
+		priv->is_online = is_online;
+		if (loaded && priv->reload_timeout_id) {
+			g_source_remove (priv->reload_timeout_id);
+			priv->reload_timeout_id = 0;
 		}
-	} else {
-		set_mode = cal_mode_to_corba (priv->mode);
 	}
 
 	if (loaded) {
-		if (set_mode == AnyMode)
-			e_cal_backend_notify_mode (backend,
-						   ModeNotSupported,
-						   cal_mode_to_corba (priv->mode));
-		else
-			e_cal_backend_notify_mode (backend,
-						   ModeSet,
-						   set_mode);
+		e_cal_backend_notify_online (backend, priv->is_online);
+		e_cal_backend_notify_readonly (backend, TRUE);
 	}
 }
 
 static icaltimezone *
-e_cal_backend_weather_internal_get_default_timezone (ECalBackend *backend)
-{
-	ECalBackendWeather *cbw = E_CAL_BACKEND_WEATHER (backend);
-
-	return cbw->priv->default_zone;
-}
-
-static icaltimezone *
 e_cal_backend_weather_internal_get_timezone (ECalBackend *backend, const gchar *tzid)
 {
 	icaltimezone *zone;
@@ -940,11 +824,6 @@ e_cal_backend_weather_finalize (GObject *object)
 		priv->city = NULL;
 	}
 
-	if (priv->default_zone) {
-		icaltimezone_free (priv->default_zone, 1);
-		priv->default_zone = NULL;
-	}
-
 	g_free (priv);
 	cbw->priv = NULL;
 
@@ -991,28 +870,20 @@ e_cal_backend_weather_class_init (ECalBackendWeatherClass *class)
 
 	object_class->finalize = e_cal_backend_weather_finalize;
 
-	sync_class->is_read_only_sync = e_cal_backend_weather_is_read_only;
-	sync_class->get_cal_address_sync = e_cal_backend_weather_get_cal_address;
+	sync_class->get_cal_email_address_sync = e_cal_backend_weather_get_cal_email_address;
 	sync_class->get_alarm_email_address_sync = e_cal_backend_weather_get_alarm_email_address;
-	sync_class->get_ldap_attribute_sync = e_cal_backend_weather_get_ldap_attribute;
-	sync_class->get_static_capabilities_sync = e_cal_backend_weather_get_static_capabilities;
+	sync_class->get_capabilities_sync = e_cal_backend_weather_get_capabilities;
 	sync_class->open_sync = e_cal_backend_weather_open;
 	sync_class->refresh_sync = e_cal_backend_weather_refresh;
 	sync_class->remove_sync = e_cal_backend_weather_remove;
-	sync_class->discard_alarm_sync = e_cal_backend_weather_discard_alarm;
 	sync_class->receive_objects_sync = e_cal_backend_weather_receive_objects;
 	sync_class->get_default_object_sync = e_cal_backend_weather_get_default_object;
 	sync_class->get_object_sync = e_cal_backend_weather_get_object;
 	sync_class->get_object_list_sync = e_cal_backend_weather_get_object_list;
 	sync_class->add_timezone_sync = e_cal_backend_weather_add_timezone;
-	sync_class->set_default_zone_sync = e_cal_backend_weather_set_default_zone;
-	sync_class->get_freebusy_sync = e_cal_backend_weather_get_free_busy;
-	sync_class->get_changes_sync = e_cal_backend_weather_get_changes;
-	backend_class->is_loaded = e_cal_backend_weather_is_loaded;
-	backend_class->start_query = e_cal_backend_weather_start_query;
-	backend_class->get_mode = e_cal_backend_weather_get_mode;
-	backend_class->set_mode = e_cal_backend_weather_set_mode;
-
-	backend_class->internal_get_default_timezone = e_cal_backend_weather_internal_get_default_timezone;
+	sync_class->get_free_busy_sync = e_cal_backend_weather_get_free_busy;
+	backend_class->start_view = e_cal_backend_weather_start_view;
+	backend_class->set_online = e_cal_backend_weather_set_online;
+
 	backend_class->internal_get_timezone = e_cal_backend_weather_internal_get_timezone;
 }
diff --git a/calendar/libecal/Makefile.am b/calendar/libecal/Makefile.am
index 215c4bf..1e3d679 100644
--- a/calendar/libecal/Makefile.am
+++ b/calendar/libecal/Makefile.am
@@ -23,6 +23,7 @@ libecal_1_2_la_CPPFLAGS =			\
 libecal_1_2_la_SOURCES =			\
 	$(MARSHAL_GENERATED)			\
 	e-cal.c					\
+	e-cal-client.c				\
 	e-cal-component.c			\
 	e-cal-recur.c				\
 	e-cal-time-util.c			\
@@ -46,6 +47,7 @@ libecalincludedir = $(privincludedir)/libecal
 
 libecalinclude_HEADERS =	\
 	e-cal.h			\
+	e-cal-client.h		\
 	e-cal-component.h	\
 	e-cal-recur.h		\
 	e-cal-time-util.h	\
diff --git a/calendar/libecal/e-cal-client.c b/calendar/libecal/e-cal-client.c
new file mode 100644
index 0000000..5fe0ec4
--- /dev/null
+++ b/calendar/libecal/e-cal-client.c
@@ -0,0 +1,4393 @@
+/*
+ * e-cal-client.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+#include <glib/gi18n-lib.h>
+#include <gio/gio.h>
+
+#include "libedataserver/e-data-server-util.h"
+
+#include "libedata-cal/e-data-cal-types.h"
+
+#include "e-cal-client.h"
+#include "e-cal-component.h"
+#include "e-cal-view-private.h"
+#include "e-cal-check-timezones.h"
+#include "e-cal-time-util.h"
+
+#include "e-gdbus-cal.h"
+#include "e-gdbus-cal-factory.h"
+#include "e-gdbus-cal-view.h"
+
+struct _ECalClientPrivate
+{
+	/* GDBus data */
+	GDBusProxy *gdbus_cal;
+	guint gone_signal_id;
+
+	ECalClientSourceType source_type;
+	icaltimezone *default_zone;
+	gchar *cache_dir;
+
+	GMutex *zone_cache_lock;
+	GHashTable *zone_cache;
+};
+
+G_DEFINE_TYPE (ECalClient, e_cal_client, E_TYPE_CLIENT)
+
+/**
+ * e_cal_client_source_type_enum_get_type:
+ *
+ * Registers the #ECalClientSourceTypeEnum type with glib.
+ *
+ * Returns: the ID of the #ECalClientSourceTypeEnum type.
+ */
+GType
+e_cal_client_source_type_enum_get_type (void)
+{
+	static volatile gsize enum_type__volatile = 0;
+
+	if (g_once_init_enter (&enum_type__volatile)) {
+		GType enum_type;
+		static GEnumValue values[] = {
+			{ E_CAL_CLIENT_SOURCE_TYPE_EVENT, "Event", "Event"},
+			{ E_CAL_CLIENT_SOURCE_TYPE_TODO, "ToDo", "ToDo"},
+			{ E_CAL_CLIENT_SOURCE_TYPE_JOURNAL, "Journal", "Journal"},
+			{ E_CAL_CLIENT_SOURCE_TYPE_LAST, "Invalid", "Invalid"},
+			{ -1, NULL, NULL}
+		};
+
+		enum_type = g_enum_register_static ("ECalClientSourceTypeEnum", values);
+		g_once_init_leave (&enum_type__volatile, enum_type);
+	}
+
+	return enum_type__volatile;
+}
+
+GQuark
+e_cal_client_error_quark (void)
+{
+	static GQuark q = 0;
+	if (q == 0)
+		q = g_quark_from_static_string ("e-cal-client-error-quark");
+
+	return q;
+}
+
+const gchar *
+e_cal_client_error_to_string (ECalClientError code)
+{
+	switch (code) {
+	case E_CAL_CLIENT_ERROR_SUCCESS:
+		return C_("CalClientError", "Success");
+	case E_CAL_CLIENT_ERROR_INVALID_ARG:
+		return C_("CalClientError", "Invalid argument");
+	case E_CAL_CLIENT_ERROR_BUSY:
+		return C_("CalClientError", "Backend is busy");
+	case E_CAL_CLIENT_ERROR_REPOSITORY_OFFLINE:
+		return C_("CalClientError", "Repository offline");
+	case E_CAL_CLIENT_ERROR_NO_SUCH_CALENDAR:
+		return C_("CalClientError", "No such calendar");
+	case E_CAL_CLIENT_ERROR_OBJECT_NOT_FOUND:
+		return C_("CalClientError", "Object not found");
+	case E_CAL_CLIENT_ERROR_INVALID_OBJECT:
+		return C_("CalClientError", "Invalid object");
+	case E_CAL_CLIENT_ERROR_SOURCE_NOT_LOADED:
+		return C_("CalClientError", "Source not loaded");
+	case E_CAL_CLIENT_ERROR_SOURCE_ALREADY_LOADED:
+		return C_("CalClientError", "Source already loaded");
+	case E_CAL_CLIENT_ERROR_PERMISSION_DENIED:
+		return C_("CalClientError", "Permission denied");
+	case E_CAL_CLIENT_ERROR_UNKNOWN_USER:
+		return C_("CalClientError", "Unknown user");
+	case E_CAL_CLIENT_ERROR_OBJECT_ID_ALREADY_EXISTS:
+		return C_("CalClientError", "Object ID already exists");
+	case E_CAL_CLIENT_ERROR_PROTOCOL_NOT_SUPPORTED:
+		return C_("CalClientError", "Protocol not supported");
+	case E_CAL_CLIENT_ERROR_CANCELLED:
+		return C_("CalClientError", "Cancelled");
+	case E_CAL_CLIENT_ERROR_COULD_NOT_CANCEL:
+		return C_("CalClientError", "Could not cancel");
+	case E_CAL_CLIENT_ERROR_AUTHENTICATION_FAILED:
+		return C_("CalClientError", "Authentication failed");
+	case E_CAL_CLIENT_ERROR_AUTHENTICATION_REQUIRED:
+		return C_("CalClientError", "Authentication required");
+	case E_CAL_CLIENT_ERROR_INVALID_SERVER_VERSION:
+		return C_("CalClientError", "Invalid server version");
+	case E_CAL_CLIENT_ERROR_DBUS_ERROR:
+		return C_("CalClientError", "D-Bus error");
+	case E_CAL_CLIENT_ERROR_OTHER_ERROR:
+		return C_("CalClientError", "Other error");
+	case E_CAL_CLIENT_ERROR_NOT_SUPPORTED:
+		return C_("CalClientError", "Not supported");
+	}
+
+	return C_("CalClientError", "Unknown error");
+}
+
+/**
+ * If the GError is a remote error, extract the ECalClientError embedded inside.
+ * Otherwise return DBUS_ERROR.
+ */
+static ECalClientError
+get_client_error_from_gerror (GError *error)
+{
+	#define err(a,b) "org.gnome.evolution.dataserver.Calendar." a, b
+	static struct {
+		const gchar *name;
+		ECalClientError err_code;
+	} errors[] = {
+		{ err ("Success",				E_CAL_CLIENT_ERROR_SUCCESS) },
+		{ err ("RepositoryOffline",			E_CAL_CLIENT_ERROR_REPOSITORY_OFFLINE) },
+		{ err ("PermissionDenied",			E_CAL_CLIENT_ERROR_PERMISSION_DENIED) },
+		{ err ("InvalidRange",				E_CAL_CLIENT_ERROR_OTHER_ERROR) },
+		{ err ("ObjectNotFound",			E_CAL_CLIENT_ERROR_OBJECT_NOT_FOUND) },
+		{ err ("InvalidObject",				E_CAL_CLIENT_ERROR_INVALID_OBJECT) },
+		{ err ("ObjectIdAlreadyExists",			E_CAL_CLIENT_ERROR_OBJECT_ID_ALREADY_EXISTS) },
+		{ err ("AuthenticationFailed",			E_CAL_CLIENT_ERROR_AUTHENTICATION_FAILED) },
+		{ err ("AuthenticationRequired",		E_CAL_CLIENT_ERROR_AUTHENTICATION_REQUIRED) },
+		{ err ("UnsupportedField",			E_CAL_CLIENT_ERROR_OTHER_ERROR) },
+		{ err ("UnsupportedMethod",			E_CAL_CLIENT_ERROR_OTHER_ERROR) },
+		{ err ("UnsupportedAuthenticationMethod",	E_CAL_CLIENT_ERROR_OTHER_ERROR) },
+		{ err ("TLSNotAvailable",			E_CAL_CLIENT_ERROR_OTHER_ERROR) },
+		{ err ("NoSuchCal",				E_CAL_CLIENT_ERROR_NO_SUCH_CALENDAR) },
+		{ err ("UnknownUser",				E_CAL_CLIENT_ERROR_UNKNOWN_USER) },
+		{ err ("OfflineUnavailable",			E_CAL_CLIENT_ERROR_OTHER_ERROR) },
+		{ err ("SearchSizeLimitExceeded",		E_CAL_CLIENT_ERROR_OTHER_ERROR) },
+		{ err ("SearchTimeLimitExceeded",		E_CAL_CLIENT_ERROR_OTHER_ERROR) },
+		{ err ("InvalidQuery",				E_CAL_CLIENT_ERROR_OTHER_ERROR) },
+		{ err ("QueryRefused",				E_CAL_CLIENT_ERROR_OTHER_ERROR) },
+		{ err ("CouldNotCancel",			E_CAL_CLIENT_ERROR_COULD_NOT_CANCEL) },
+		{ err ("OtherError",				E_CAL_CLIENT_ERROR_OTHER_ERROR) },
+		{ err ("InvalidServerVersion",			E_CAL_CLIENT_ERROR_INVALID_SERVER_VERSION) },
+		{ err ("InvalidArg",				E_CAL_CLIENT_ERROR_INVALID_ARG) },
+		{ err ("NotSupported",				E_CAL_CLIENT_ERROR_NOT_SUPPORTED) }
+	};
+	#undef err
+
+	if G_LIKELY (error == NULL)
+		return E_CAL_CLIENT_ERROR_SUCCESS;
+
+	if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_DBUS_ERROR)) {
+		gchar *name;
+		gint i;
+
+		name = g_dbus_error_get_remote_error (error);
+
+		for (i = 0; i < G_N_ELEMENTS (errors); i++) {
+			if (g_ascii_strcasecmp (errors[i].name, name) == 0) {
+				g_free (name);
+				return errors[i].err_code;
+			}
+		}
+
+		g_warning (G_STRLOC ": Unmatched error name %s", name);
+		g_free (name);
+
+		return E_CAL_CLIENT_ERROR_OTHER_ERROR;
+	} else if (error->domain == E_CAL_CLIENT_ERROR) {
+		return error->code;
+	} else {
+		/* In this case the error was caused by DBus. Dump the message to the
+		   console as otherwise we have no idea what the problem is. */
+		g_debug ("DBus error: %s", error->message);
+		return E_CAL_CLIENT_ERROR_DBUS_ERROR;
+	}
+}
+
+/**
+ * If the specified GError is a remote error, then create a new error
+ * representing the remote error.  If the error is anything else, then
+ * leave it alone.
+ */
+static gboolean
+unwrap_dbus_error (GError *error, GError **client_error)
+{
+	if (error == NULL)
+		return TRUE;
+
+	if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_DBUS_ERROR)) {
+		if (client_error) {
+			gint code;
+
+			code = get_client_error_from_gerror (error);
+			g_dbus_error_strip_remote_error (error);
+
+			*client_error = g_error_new_literal (E_CAL_CLIENT_ERROR, code, error->message);
+		}
+
+		g_error_free (error);
+	} else {
+		if (client_error) {
+			if (error->domain == G_DBUS_ERROR)
+				g_dbus_error_strip_remote_error (error);
+			*client_error = error;
+		} else {
+			g_error_free (error);
+		}
+	}
+
+	return FALSE;
+}
+
+static guint active_cal_clients = 0, cal_connection_closed_id = 0;
+static EGdbusCalFactory *cal_factory_proxy = NULL;
+static GStaticRecMutex cal_factory_proxy_lock = G_STATIC_REC_MUTEX_INIT;
+#define LOCK_FACTORY()   g_static_rec_mutex_lock (&cal_factory_proxy_lock)
+#define UNLOCK_FACTORY() g_static_rec_mutex_unlock (&cal_factory_proxy_lock)
+
+static void gdbus_cal_factory_proxy_closed_cb (GDBusConnection *connection, gboolean remote_peer_vanished, GError *error, gpointer user_data);
+
+static void
+gdbus_cal_factory_proxy_disconnect (GDBusConnection *connection)
+{
+	LOCK_FACTORY ();
+
+	if (!connection && cal_factory_proxy)
+		connection = g_dbus_proxy_get_connection (G_DBUS_PROXY (cal_factory_proxy));
+
+	if (connection && cal_connection_closed_id) {
+		g_dbus_connection_signal_unsubscribe (connection, cal_connection_closed_id);
+		g_signal_handlers_disconnect_by_func (connection, gdbus_cal_factory_proxy_closed_cb, NULL);
+	}
+
+	if (cal_factory_proxy)
+		g_object_unref (cal_factory_proxy);
+
+	cal_connection_closed_id = 0;
+	cal_factory_proxy = NULL;
+
+	UNLOCK_FACTORY ();
+}
+
+static void
+gdbus_cal_factory_proxy_closed_cb (GDBusConnection *connection, gboolean remote_peer_vanished, GError *error, gpointer user_data)
+{
+	GError *err = NULL;
+
+	LOCK_FACTORY ();
+
+	gdbus_cal_factory_proxy_disconnect (connection);
+
+	if (error)
+		unwrap_dbus_error (g_error_copy (error), &err);
+
+	if (err) {
+		g_debug ("GDBus connection is closed%s: %s", remote_peer_vanished ? ", remote peer vanished" : "", err->message);
+		g_error_free (err);
+	} else if (active_cal_clients) {
+		g_debug ("GDBus connection is closed%s", remote_peer_vanished ? ", remote peer vanished" : "");
+	}
+
+	UNLOCK_FACTORY ();
+}
+
+static void
+gdbus_cal_factory_connection_gone_cb (GDBusConnection *connection, const gchar *sender_name, const gchar *object_path, const gchar *interface_name, const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+	/* signal subscription takes care of correct parameters,
+	   thus just do what is to be done here */
+	gdbus_cal_factory_proxy_closed_cb (connection, TRUE, NULL, user_data);
+}
+
+static gboolean
+gdbus_cal_factory_activate (GError **error)
+{
+	GDBusConnection *connection;
+
+	LOCK_FACTORY ();
+
+	if (G_LIKELY (cal_factory_proxy)) {
+		UNLOCK_FACTORY ();
+		return TRUE;
+	}
+
+	cal_factory_proxy = e_gdbus_cal_factory_proxy_new_for_bus_sync (
+		G_BUS_TYPE_SESSION,
+		G_DBUS_PROXY_FLAGS_NONE,
+		CALENDAR_DBUS_SERVICE_NAME,
+		"/org/gnome/evolution/dataserver/CalendarFactory",
+		NULL,
+		error);
+
+	if (!cal_factory_proxy) {
+		UNLOCK_FACTORY ();
+		return FALSE;
+	}
+
+	connection = g_dbus_proxy_get_connection (G_DBUS_PROXY (cal_factory_proxy));
+	cal_connection_closed_id = g_dbus_connection_signal_subscribe (connection,
+		NULL,						/* sender */
+		"org.freedesktop.DBus",				/* interface */
+		"NameOwnerChanged",				/* member */
+		"/org/freedesktop/DBus",			/* object_path */
+		"org.gnome.evolution.dataserver.Calendar",	/* arg0 */
+		G_DBUS_SIGNAL_FLAGS_NONE,
+		gdbus_cal_factory_connection_gone_cb, NULL, NULL);
+
+	g_signal_connect (connection, "closed", G_CALLBACK (gdbus_cal_factory_proxy_closed_cb), NULL);
+
+	UNLOCK_FACTORY ();
+
+	return TRUE;
+}
+
+static void gdbus_cal_client_disconnect (ECalClient *client);
+
+/*
+ * Called when the calendar server dies.
+ */
+static void
+gdbus_cal_client_closed_cb (GDBusConnection *connection, gboolean remote_peer_vanished, GError *error, ECalClient *client)
+{
+	GError *err = NULL;
+
+	g_assert (E_IS_CAL_CLIENT (client));
+
+	if (error)
+		unwrap_dbus_error (g_error_copy (error), &err);
+
+	if (err) {
+		g_debug (G_STRLOC ": ECalClient GDBus connection is closed%s: %s", remote_peer_vanished ? ", remote peer vanished" : "", err->message);
+		g_error_free (err);
+	} else {
+		g_debug (G_STRLOC ": ECalClient GDBus connection is closed%s", remote_peer_vanished ? ", remote peer vanished" : "");
+	}
+
+	gdbus_cal_client_disconnect (client);
+
+	e_client_emit_backend_died (E_CLIENT (client));
+}
+
+static void
+gdbus_cal_client_connection_gone_cb (GDBusConnection *connection, const gchar *sender_name, const gchar *object_path, const gchar *interface_name, const gchar *signal_name, GVariant *parameters, gpointer user_data)
+{
+	/* signal subscription takes care of correct parameters,
+	   thus just do what is to be done here */
+	gdbus_cal_client_closed_cb (connection, TRUE, NULL, user_data);
+}
+
+static void
+gdbus_cal_client_disconnect (ECalClient *client)
+{
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (E_IS_CAL_CLIENT (client));
+	g_return_if_fail (client->priv != NULL);
+
+	/* Ensure that everything relevant is NULL */
+	LOCK_FACTORY ();
+
+	if (client->priv->gdbus_cal) {
+		GDBusConnection *connection = g_dbus_proxy_get_connection (G_DBUS_PROXY (client->priv->gdbus_cal));
+
+		g_signal_handlers_disconnect_by_func (connection, gdbus_cal_client_closed_cb, client);
+		g_dbus_connection_signal_unsubscribe (connection, client->priv->gone_signal_id);
+		client->priv->gone_signal_id = 0;
+
+		e_gdbus_cal_call_close_sync (client->priv->gdbus_cal, NULL, NULL);
+		g_object_unref (client->priv->gdbus_cal);
+		client->priv->gdbus_cal = NULL;
+	}
+
+	UNLOCK_FACTORY ();
+}
+
+static void
+backend_error_cb (EGdbusCal *object, const gchar *message, ECalClient *client)
+{
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (E_IS_CAL_CLIENT (client));
+	g_return_if_fail (message != NULL);
+
+	e_client_emit_backend_error (E_CLIENT (client), message);
+}
+
+static void
+readonly_cb (EGdbusCal *object, gboolean readonly, ECalClient *client)
+{
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (E_IS_CAL_CLIENT (client));
+
+	e_client_set_readonly (E_CLIENT (client), readonly);
+}
+
+static void
+online_cb (EGdbusCal *object, gboolean is_online, ECalClient *client)
+{
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (E_IS_CAL_CLIENT (client));
+
+	e_client_set_online (E_CLIENT (client), is_online);
+}
+
+static void
+auth_required_cb (EGdbusCal *object, const gchar * const *credentials_strv, ECalClient *client)
+{
+	ECredentials *credentials;
+
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (E_IS_CAL_CLIENT (client));
+
+	if (credentials_strv)
+		credentials = e_credentials_new_strv (credentials_strv);
+	else
+		credentials = e_credentials_new ();
+
+	e_client_process_authentication (E_CLIENT (client), credentials);
+
+	e_credentials_free (credentials);
+}
+
+static EDataCalObjType
+convert_type (ECalClientSourceType type)
+{
+	switch (type) {
+	case E_CAL_CLIENT_SOURCE_TYPE_EVENT:
+		return Event;
+	case E_CAL_CLIENT_SOURCE_TYPE_TODO:
+		return Todo;
+	case E_CAL_CLIENT_SOURCE_TYPE_JOURNAL:
+		return Journal;
+	default:
+		return AnyType;
+	}
+
+	return AnyType;
+}
+
+/**
+ * e_cal_client_new:
+ * @source: An #ESource pointer
+ * @source_type: source type of the calendar
+ * @error: A #GError pointer
+ *
+ * Creates a new #ECalClient corresponding to the given source.  There are
+ * only two operations that are valid on this calendar at this point:
+ * e_client_open(), and e_client_remove().
+ *
+ * Returns: a new but unopened #ECalClient.
+ *
+ * Since: 3.2
+ **/
+ECalClient *
+e_cal_client_new (ESource *source, ECalClientSourceType source_type, GError **error)
+{
+	ECalClient *client;
+	GError *err = NULL;
+	GDBusConnection *connection;
+	gchar *xml, **strv;
+	gchar *path = NULL;
+
+	g_return_val_if_fail (source != NULL, NULL);
+	g_return_val_if_fail (E_IS_SOURCE (source), NULL);
+	g_return_val_if_fail (source_type == E_CAL_CLIENT_SOURCE_TYPE_EVENT || source_type == E_CAL_CLIENT_SOURCE_TYPE_TODO || source_type == E_CAL_CLIENT_SOURCE_TYPE_JOURNAL, NULL);
+
+	if (!gdbus_cal_factory_activate (&err)) {
+		if (err) {
+			unwrap_dbus_error (err, &err);
+			g_warning ("%s: Failed to run calendar factory: %s", G_STRFUNC, err->message);
+			g_propagate_error (error, err);
+		} else {
+			g_warning ("%s: Failed to run calendar factory: Unknown error", G_STRFUNC);
+			g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_DBUS_ERROR, _("Failed to run calendar factory"));
+		}
+
+		return NULL;
+	}
+
+	xml = e_source_to_standalone_xml (source);
+	if (!xml || !*xml) {
+		g_free (xml);
+		g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_INVALID_ARG, _("Invalid source"));
+		return NULL;
+	}
+
+	strv = e_gdbus_cal_factory_encode_get_cal (xml, convert_type (source_type));
+	if (!strv) {
+		g_free (xml);
+		g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_OTHER_ERROR, _("Other error"));
+		return NULL;
+	}
+
+	client = g_object_new (E_TYPE_CAL_CLIENT, "source", source, NULL);
+	client->priv->source_type = source_type;
+
+	if (!e_gdbus_cal_factory_call_get_cal_sync (G_DBUS_PROXY (cal_factory_proxy), (const gchar * const *) strv, &path, NULL, &err)) {
+		unwrap_dbus_error (err, &err);
+		g_free (xml);
+		g_strfreev (strv);
+		g_warning ("%s: Cannot get calendar from factory: %s", G_STRFUNC, err ? err->message : "[no error]");
+		if (err)
+			g_propagate_error (error, err);
+		g_object_unref (client);
+
+		return NULL;
+	}
+
+	g_free (xml);
+	g_strfreev (strv);
+
+	client->priv->gdbus_cal = G_DBUS_PROXY (e_gdbus_cal_proxy_new_sync (g_dbus_proxy_get_connection (G_DBUS_PROXY (cal_factory_proxy)),
+						      G_DBUS_PROXY_FLAGS_NONE,
+						      CALENDAR_DBUS_SERVICE_NAME,
+						      path,
+						      NULL,
+						      &err));
+
+	if (!client->priv->gdbus_cal) {
+		g_free (path);
+		unwrap_dbus_error (err, &err);
+		g_warning ("%s: Cannot create calendar proxy: %s", G_STRFUNC, err ? err->message : "Unknown error");
+		if (err)
+			g_propagate_error (error, err);
+
+		g_object_unref (client);
+
+		return NULL;
+	}
+
+	g_free (path);
+
+	connection = g_dbus_proxy_get_connection (G_DBUS_PROXY (client->priv->gdbus_cal));
+	client->priv->gone_signal_id = g_dbus_connection_signal_subscribe (connection,
+		"org.freedesktop.DBus",				/* sender */
+		"org.freedesktop.DBus",				/* interface */
+		"NameOwnerChanged",				/* member */
+		"/org/freedesktop/DBus",			/* object_path */
+		"org.gnome.evolution.dataserver.Calendar",	/* arg0 */
+		G_DBUS_SIGNAL_FLAGS_NONE,
+		gdbus_cal_client_connection_gone_cb, client, NULL);
+
+	g_signal_connect (connection, "closed", G_CALLBACK (gdbus_cal_client_closed_cb), client);
+
+	g_signal_connect (client->priv->gdbus_cal, "backend_error", G_CALLBACK (backend_error_cb), client);
+	g_signal_connect (client->priv->gdbus_cal, "readonly", G_CALLBACK (readonly_cb), client);
+	g_signal_connect (client->priv->gdbus_cal, "online", G_CALLBACK (online_cb), client);
+	g_signal_connect (client->priv->gdbus_cal, "auth-required", G_CALLBACK (auth_required_cb), client);
+
+	return client;
+}
+
+/**
+ * e_cal_client_new_from_uri:
+ * @uri: the URI to load
+ * @source_type: source type of the calendar
+ * @error: A #GError pointer
+ *
+ * Creates a new #ECalClient corresponding to the given uri.  See the
+ * documentation for e_cal_client_new() for further information.
+ *
+ * Returns: a new but unopened #ECalClient.
+ *
+ * Since: 3.2
+ **/
+ECalClient *
+e_cal_client_new_from_uri (const gchar *uri, ECalClientSourceType source_type, GError **error)
+{
+	ESourceList *source_list = NULL;
+	ESource *source;
+	ECalClient *client;
+
+	g_return_val_if_fail (uri != NULL, NULL);
+
+	if (!e_cal_client_get_sources (&source_list, source_type, error))
+		return NULL;
+
+	source = e_client_util_get_source_for_uri (source_list, uri);
+	if (!source && g_str_has_prefix (uri, "file://")) {
+		gchar *local_uri;
+
+		local_uri = g_strconcat ("local://", uri + 7, NULL);
+		source = e_client_util_get_source_for_uri (source_list, uri);
+
+		g_free (local_uri);
+	}
+
+	if (!source) {
+		g_object_unref (source_list);
+		g_set_error (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_INVALID_ARG, _("Incorrect uri '%s'"), uri);
+
+		return NULL;
+	}
+
+	client = e_cal_client_new (source, source_type, error);
+
+	g_object_unref (source);
+	g_object_unref (source_list);
+
+	return client;
+}
+
+/**
+ * e_cal_client_new_system:
+ * @source_type: source type of the calendar
+ * @error: A #GError pointer
+ *
+ * Creates a new #ECalClient corresponding to the user's system
+ * calendar.  See the documentation for e_cal_client_new() for further
+ * information.
+ *
+ * Returns: a new but unopened #ECalClient.
+ *
+ * Since: 3.2
+ **/
+ECalClient *
+e_cal_client_new_system (ECalClientSourceType source_type, GError **error)
+{
+	ESourceList *source_list = NULL;
+	ESource *source;
+	ECalClient *client;
+
+	if (!e_cal_client_get_sources (&source_list, source_type, error))
+		return NULL;
+
+	source = e_client_util_get_system_source (source_list);
+	if (!source) {
+		g_object_unref (source_list);
+		g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_NO_SUCH_CALENDAR, _("Failed to find system calendar"));
+
+		return NULL;
+	}
+
+	client = e_cal_client_new (source, source_type, error);
+
+	g_object_unref (source);
+	g_object_unref (source_list);
+
+	return client;
+}
+
+/**
+ * e_cal_client_new_default:
+ * @source_type: source type of the calendar
+ * @error: return location for a #GError, or %NULL
+ *
+ * Creates a new #ECalClient corresponding to the user's default
+ * calendar.  See the documentation for e_cal_client_new() for
+ * further information.
+ *
+ * Returns: a new but unopened #ECalClient
+ *
+ * Since: 3.2
+ **/
+ECalClient *
+e_cal_client_new_default (ECalClientSourceType source_type, GError **error)
+{
+	ESourceList *source_list = NULL;
+	ESource *source;
+	ECalClient *client;
+
+	if (!e_cal_client_get_sources (&source_list, source_type, error))
+		return NULL;
+
+	source = e_source_list_peek_default_source (source_list);
+	if (!source) {
+		g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_NO_SUCH_CALENDAR, _("Calendar does not exist"));
+		g_object_unref (source_list);
+
+		return NULL;
+	}
+
+	client = e_cal_client_new (source, source_type, error);
+
+	g_object_unref (source_list);
+
+	return client;
+}
+
+/**
+ * e_cal_client_set_default:
+ * @client: An #ECalClient pointer
+ * @error: A #GError pointer
+ *
+ * Sets the #ESource of the #ECalClient as the "default" calendar.  This is the source
+ * that will be loaded in the e_cal_client_get_default_calendar() call.
+ *
+ * Returns: %TRUE if the setting was stored in libecal's ESourceList, otherwise %FALSE.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_set_default (ECalClient *client, GError **error)
+{
+	ESource *source;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+
+	source = e_client_get_source (E_CLIENT (client));
+	g_return_val_if_fail (source != NULL, FALSE);
+
+	return e_cal_client_set_default_source (source, e_cal_client_get_source_type (client), error);
+}
+
+/**
+ * e_cal_client_set_default_source:
+ * @source: An #ESource pointer
+ * @source_type: source type of the calendar
+ * @error: A #GError pointer
+ *
+ * Sets @source as the "default" calendar.  This is the source that
+ * will be loaded in the e_cal_client_get_default_calendar() call.
+ *
+ * Returns: %TRUE if the setting was stored in libecal's ESourceList, otherwise %FALSE.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_set_default_source (ESource *source, ECalClientSourceType source_type, GError **error)
+{
+	ESourceList *source_list = NULL;
+	gboolean res = FALSE;
+
+	g_return_val_if_fail (source != NULL, FALSE);
+	g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
+
+	if (!e_cal_client_get_sources (&source_list, source_type, error))
+		return FALSE;
+
+	res = e_client_util_set_default (source_list, source);
+
+	if (res)
+		res = e_source_list_sync (source_list, error);
+	else
+		g_set_error (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_INVALID_ARG,
+			_("There was no source for UID '%s' stored in a source list."), e_source_peek_uid (source));
+
+	g_object_unref (source_list);
+
+	return res;
+}
+
+/**
+ * e_cal_client_get_sources:
+ * @sources: (out): A pointer to an #ESourceList to set
+ * @source_type: source type of calendars
+ * @error: A pointer to a GError to set on error
+ *
+ * Populate @*sources with the list of all sources which have been
+ * added to Evolution.
+ *
+ * Returns: %TRUE if @sources was set, otherwise %FALSE.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_get_sources (ESourceList **sources, ECalClientSourceType source_type, GError **error)
+{
+	GConfClient *gconf;
+	const gchar *key = NULL;
+
+	g_return_val_if_fail (sources != NULL, FALSE);
+
+	switch (source_type) {
+	case E_CAL_CLIENT_SOURCE_TYPE_EVENT:
+		key = "/apps/evolution/calendar/sources";
+		break;
+	case E_CAL_CLIENT_SOURCE_TYPE_TODO:
+		key = "/apps/evolution/tasks/sources";
+		break;
+	case E_CAL_CLIENT_SOURCE_TYPE_JOURNAL:
+		key = "/apps/evolution/memos/sources";
+		break;
+	default:
+		g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_INVALID_ARG, _("Invalid source type"));
+		return FALSE;
+	}
+
+	g_return_val_if_fail (key != NULL, FALSE);
+
+	gconf = gconf_client_get_default ();
+	*sources = e_source_list_new_for_gconf (gconf, key);
+	g_object_unref (gconf);
+
+	return TRUE;
+}
+
+/**
+ * e_cal_client_get_source_type:
+ * @client: A calendar client.
+ *
+ * Gets the source type of the calendar client.
+ *
+ * Returns: an #ECalClientSourceType value corresponding
+ * to the source type of the calendar client.
+ *
+ * Since: 3.2
+ **/
+ECalClientSourceType
+e_cal_client_get_source_type (ECalClient *client)
+{
+	g_return_val_if_fail (client != NULL, E_CAL_CLIENT_SOURCE_TYPE_LAST);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), E_CAL_CLIENT_SOURCE_TYPE_LAST);
+	g_return_val_if_fail (client->priv != NULL, E_CAL_CLIENT_SOURCE_TYPE_LAST);
+
+	return client->priv->source_type;
+}
+
+/**
+ * e_cal_client_get_local_attachment_store
+ * @client: A calendar client.
+ *
+ * Queries the URL where the calendar attachments are
+ * serialized in the local filesystem. This enable clients
+ * to operate with the reference to attachments rather than the data itself
+ * unless it specifically uses the attachments for open/sending
+ * operations.
+ *
+ * Returns: The URL where the attachments are serialized in the
+ * local filesystem.
+ *
+ * Since: 3.2
+ **/
+const gchar *
+e_cal_client_get_local_attachment_store (ECalClient *client)
+{
+	gchar *cache_dir = NULL;
+	GError *error = NULL;
+
+	g_return_val_if_fail (client != NULL, NULL);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), NULL);
+	g_return_val_if_fail (client->priv != NULL, NULL);
+
+	if (client->priv->cache_dir || !client->priv->gdbus_cal)
+		return client->priv->cache_dir;
+
+	e_gdbus_cal_call_get_cache_dir_sync (client->priv->gdbus_cal, &cache_dir, NULL, &error);
+
+	if (error == NULL) {
+		client->priv->cache_dir = cache_dir;
+	} else {
+		unwrap_dbus_error (error, &error);
+		g_warning ("%s", error->message);
+		g_error_free (error);
+	}
+
+	return client->priv->cache_dir;
+}
+
+/**
+ * e_cal_client_set_default_timezone:
+ * @client: A calendar client.
+ * @zone: A timezone object.
+ *
+ * Sets the default timezone to use to resolve DATE and floating DATE-TIME
+ * values. This will typically be from the user's timezone setting. Call this
+ * before using any other object fetching functions.
+ *
+ * Since: 3.2
+ **/
+void
+e_cal_client_set_default_timezone (ECalClient *client, const icaltimezone *zone)
+{
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (E_IS_CAL_CLIENT (client));
+	g_return_if_fail (client->priv != NULL);
+	g_return_if_fail (zone != NULL);
+
+	icaltimezone_free (client->priv->default_zone, 1);
+	client->priv->default_zone = icaltimezone_copy ((icaltimezone *) zone);
+}
+
+/**
+ * e_cal_client_get_default_timezone:
+ * @client: A calendar client.
+ *
+ * Returns: Default timezone previously set with e_cal_client_set_default_timezone().
+ * Returned pointer is owned by the @client.
+ *
+ * Since: 3.2
+ **/
+const icaltimezone *
+e_cal_client_get_default_timezone (ECalClient *client)
+{
+	g_return_val_if_fail (client != NULL, NULL);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), NULL);
+	g_return_val_if_fail (client->priv != NULL, NULL);
+
+	return client->priv->default_zone;
+}
+
+/**
+ * e_cal_client_check_one_alarm_only:
+ * @client: A calendar client.
+ *
+ * Checks if a calendar supports only one alarm per component.
+ *
+ * Returns: TRUE if the calendar allows only one alarm, FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_check_one_alarm_only (ECalClient *client)
+{
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+
+	return e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_ONE_ALARM_ONLY);
+}
+
+/**
+ * e_cal_client_check_save_schedules:
+ * @client: A calendar client.
+ *
+ * Checks whether the calendar saves schedules.
+ *
+ * Returns: TRUE if it saves schedules, FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_check_save_schedules (ECalClient *client)
+{
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+
+	return e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_SAVE_SCHEDULES);
+}
+
+/**
+ * e_cal_client_check_refresh_supported:
+ * @client: A calendar client.
+ *
+ * Checks whether a calendar supports explicit refreshing (see e_cal_client_refresh()).
+ *
+ * Returns: TRUE if the calendar supports refreshing, FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_check_refresh_supported (ECalClient *client)
+{
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+
+	return e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_REFRESH_SUPPORTED);
+}
+
+/**
+ * e_cal_client_check_organizer_must_attend:
+ * @client: A calendar client.
+ *
+ * Checks if a calendar forces organizers of meetings to be also attendees.
+ *
+ * Returns: TRUE if the calendar forces organizers to attend meetings,
+ * FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_check_organizer_must_attend (ECalClient *client)
+{
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+
+	return e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_ORGANIZER_MUST_ATTEND);
+}
+
+/**
+ * e_cal_get_organizer_must_accept:
+ * @client: A calendar client.
+ *
+ * Checks whether a calendar requires organizer to accept their attendance to
+ * meetings.
+ *
+ * Returns: TRUE if the calendar requires organizers to accept, FALSE
+ * otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_check_organizer_must_accept (ECalClient *client)
+{
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+
+	return e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_ORGANIZER_MUST_ACCEPT);
+}
+
+/**
+ * e_cal_client_check_recurrences_no_master:
+ * @client: A calendar client.
+ *
+ * Checks if the calendar has a master object for recurrences.
+ *
+ * Returns: TRUE if the calendar has a master object for recurrences,
+ * FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_check_recurrences_no_master (ECalClient *client)
+{
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+
+	return e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_RECURRENCES_NO_MASTER);
+}
+
+/**
+ * e_cal_client_free_icalcomp_slist:
+ * @icalcomps: slist of icalcomponent objects
+ *
+ * Frees each element of @icalcomps list and the list itself.
+ * Each element is an object of icalcomponent type.
+ *
+ * Since: 3.2
+ **/
+void
+e_cal_client_free_icalcomp_slist (GSList *icalcomps)
+{
+	g_slist_foreach (icalcomps, (GFunc) icalcomponent_free, NULL);
+	g_slist_free (icalcomps);
+}
+
+/**
+ * e_cal_client_free_ecalcomp_slist:
+ * @ecalcomps: list of ECalComponent objects
+ *
+ * Frees each element of @ecalcomps list and the list itself.
+ * Each element is an object of ECalComponent type.
+ *
+ * Since: 3.2
+ **/
+void
+e_cal_client_free_ecalcomp_slist (GSList *ecalcomps)
+{
+	g_slist_foreach (ecalcomps, (GFunc) g_object_unref, NULL);
+	g_slist_free (ecalcomps);
+}
+
+/**
+ * e_cal_client_resolve_tzid_cb:
+ * @tzid: ID of the timezone to resolve.
+ * @data: Closure data for the callback, in this case #ECalClient.
+ *
+ * Resolves TZIDs for the recurrence generator.
+ *
+ * Returns: The timezone identified by the @tzid argument, or %NULL if
+ * it could not be found.
+ */
+icaltimezone *
+e_cal_client_resolve_tzid_cb (const gchar *tzid, gpointer data)
+{
+	ECalClient *client = data;
+	icaltimezone *zone = NULL;
+	GError *error = NULL;
+
+	g_return_val_if_fail (client != NULL, NULL);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), NULL);
+
+	e_cal_client_get_timezone_sync (client, tzid, &zone, NULL, &error);
+
+	if (error) {
+		g_debug ("%s: Failed to find '%s' timezone: %s", G_STRFUNC, tzid, error->message);
+		g_error_free (error);
+	}
+
+	return zone;
+}
+
+struct comp_instance {
+	ECalComponent *comp;
+	time_t start;
+	time_t end;
+};
+
+struct instances_info {
+	GSList **instances;
+	icaltimezone *start_zone;
+};
+
+/* Called from cal_recur_generate_instances(); adds an instance to the list */
+static gboolean
+add_instance (ECalComponent *comp, time_t start, time_t end, gpointer data)
+{
+	GSList **list;
+	struct comp_instance *ci;
+	struct icaltimetype itt;
+	icalcomponent *icalcomp;
+	struct instances_info *instances_hold;
+
+	instances_hold = data;
+	list = instances_hold->instances;
+
+	ci = g_new (struct comp_instance, 1);
+
+	icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent (comp));
+
+	/* add the instance to the list */
+	ci->comp = e_cal_component_new ();
+	e_cal_component_set_icalcomponent (ci->comp, icalcomp);
+
+	/* set the RECUR-ID for the instance */
+	if (e_cal_util_component_has_recurrences (icalcomp)) {
+		if (!(icalcomponent_get_first_property (icalcomp, ICAL_RECURRENCEID_PROPERTY))) {
+			ECalComponentRange *range;
+			ECalComponentDateTime datetime;
+
+			e_cal_component_get_dtstart (comp, &datetime);
+
+			if (instances_hold->start_zone)
+				itt = icaltime_from_timet_with_zone (start, datetime.value->is_date, instances_hold->start_zone);
+			else {
+				itt = icaltime_from_timet (start, datetime.value->is_date);
+
+				if (datetime.tzid) {
+					g_free ((gchar *) datetime.tzid);
+					datetime.tzid = NULL;
+				}
+			}
+
+			g_free (datetime.value);
+			datetime.value = &itt;
+
+			range = g_new0 (ECalComponentRange, 1);
+			range->type = E_CAL_COMPONENT_RANGE_SINGLE;
+			range->datetime = datetime;
+
+			e_cal_component_set_recurid (ci->comp, range);
+
+			if (datetime.tzid)
+				g_free ((gchar *) datetime.tzid);
+			g_free (range);
+		}
+	}
+
+	ci->start = start;
+	ci->end = end;
+
+	*list = g_slist_prepend (*list, ci);
+
+	return TRUE;
+}
+
+/* Used from g_slist_sort(); compares two struct comp_instance structures */
+static gint
+compare_comp_instance (gconstpointer a, gconstpointer b)
+{
+	const struct comp_instance *cia, *cib;
+	time_t diff;
+
+	cia = a;
+	cib = b;
+
+	diff = cia->start - cib->start;
+	return (diff < 0) ? -1 : (diff > 0) ? 1 : 0;
+}
+
+static GSList *
+process_detached_instances (GSList *instances, GSList *detached_instances)
+{
+	struct comp_instance *ci, *cid;
+	GSList *dl, *unprocessed_instances = NULL;
+
+	for (dl = detached_instances; dl != NULL; dl = dl->next) {
+		GSList *il;
+		const gchar *uid;
+		gboolean processed;
+		ECalComponentRange recur_id, instance_recur_id;
+
+		processed = FALSE;
+
+		cid = dl->data;
+		e_cal_component_get_uid (cid->comp, &uid);
+		e_cal_component_get_recurid (cid->comp, &recur_id);
+
+		/* search for coincident instances already expanded */
+		for (il = instances; il != NULL; il = il->next) {
+			const gchar *instance_uid;
+			gint cmp;
+
+			ci = il->data;
+			e_cal_component_get_uid (ci->comp, &instance_uid);
+			e_cal_component_get_recurid (ci->comp, &instance_recur_id);
+			if (strcmp (uid, instance_uid) == 0) {
+				gchar *i_rid = NULL, *d_rid = NULL;
+
+				i_rid = e_cal_component_get_recurid_as_string (ci->comp);
+				d_rid = e_cal_component_get_recurid_as_string (cid->comp);
+
+				if (i_rid && d_rid && strcmp (i_rid, d_rid) == 0) {
+					g_object_unref (ci->comp);
+					ci->comp = g_object_ref (cid->comp);
+					ci->start = cid->start;
+					ci->end = cid->end;
+
+					processed = TRUE;
+				} else {
+					if (!instance_recur_id.datetime.value ||
+					    !recur_id.datetime.value) {
+						/*
+						 * Prevent obvious segfault by ignoring missing
+						 * recurrency ids. Real problem might be elsewhere,
+						 * but anything is better than crashing...
+						 */
+						g_log (G_LOG_DOMAIN,
+						       G_LOG_LEVEL_CRITICAL,
+						       "UID %s: instance RECURRENCE-ID %s + detached instance RECURRENCE-ID %s: cannot compare",
+						       uid,
+						       i_rid,
+						       d_rid);
+
+						e_cal_component_free_datetime (&instance_recur_id.datetime);
+						g_free (i_rid);
+						g_free (d_rid);
+						continue;
+					}
+					cmp = icaltime_compare (*instance_recur_id.datetime.value,
+								*recur_id.datetime.value);
+					if ((recur_id.type == E_CAL_COMPONENT_RANGE_THISPRIOR && cmp <= 0) ||
+					    (recur_id.type == E_CAL_COMPONENT_RANGE_THISFUTURE && cmp >= 0)) {
+						ECalComponent *comp;
+
+						comp = e_cal_component_new ();
+						e_cal_component_set_icalcomponent (
+							comp,
+							icalcomponent_new_clone (e_cal_component_get_icalcomponent (cid->comp)));
+						e_cal_component_set_recurid (comp, &instance_recur_id);
+
+						/* replace the generated instances */
+						g_object_unref (ci->comp);
+						ci->comp = comp;
+					}
+				}
+				g_free (i_rid);
+				g_free (d_rid);
+			}
+			e_cal_component_free_datetime (&instance_recur_id.datetime);
+		}
+
+		e_cal_component_free_datetime (&recur_id.datetime);
+
+		if (!processed)
+			unprocessed_instances = g_slist_prepend (unprocessed_instances, cid);
+	}
+
+	/* add the unprocessed instances (ie, detached instances with no master object */
+	while (unprocessed_instances != NULL) {
+		cid = unprocessed_instances->data;
+		ci = g_new0 (struct comp_instance, 1);
+		ci->comp = g_object_ref (cid->comp);
+		ci->start = cid->start;
+		ci->end = cid->end;
+		instances = g_slist_append (instances, ci);
+
+		unprocessed_instances = g_slist_remove (unprocessed_instances, cid);
+	}
+
+	return instances;
+}
+
+static void
+generate_instances (ECalClient *client, time_t start, time_t end, const gchar *uid,
+		    ECalRecurInstanceFn cb, gpointer cb_data)
+{
+	GSList *objects = NULL;
+	GSList *instances, *detached_instances = NULL;
+	GSList *l;
+	gchar *query;
+	gchar *iso_start, *iso_end;
+	ECalClientPrivate *priv;
+
+	priv = client->priv;
+
+	/* Generate objects */
+	if (uid && *uid) {
+		GError *error = NULL;
+		gint tries = 0;
+
+ try_again:
+		if (!e_cal_client_get_objects_for_uid_sync (client, uid, &objects, NULL, &error)) {
+			if (error->code == E_CALENDAR_STATUS_BUSY && tries >= 10) {
+				tries++;
+				g_usleep (500);
+				g_clear_error (&error);
+
+				goto try_again;
+			}
+
+			unwrap_dbus_error (error, &error);
+			g_message ("Failed to get recurrence objects for uid %s \n", error ? error->message : "Unknown error");
+			g_clear_error (&error);
+			return;
+		}
+	} else {
+		iso_start = isodate_from_time_t (start);
+		if (!iso_start)
+			return;
+
+		iso_end = isodate_from_time_t (end);
+		if (!iso_end) {
+			g_free (iso_start);
+			return;
+		}
+
+		query = g_strdup_printf ("(occur-in-time-range? (make-time \"%s\") (make-time \"%s\"))",
+					 iso_start, iso_end);
+		g_free (iso_start);
+		g_free (iso_end);
+		if (!e_cal_client_get_object_list_as_comps_sync (client, query, &objects, NULL, NULL)) {
+			g_free (query);
+			return;
+		}
+		g_free (query);
+	}
+
+	instances = NULL;
+
+	for (l = objects; l; l = l->next) {
+		ECalComponent *comp;
+		icaltimezone *default_zone;
+
+		if (priv->default_zone)
+			default_zone = priv->default_zone;
+		else
+			default_zone = icaltimezone_get_utc_timezone ();
+
+		comp = l->data;
+		if (e_cal_component_is_instance (comp)) {
+			struct comp_instance *ci;
+			ECalComponentDateTime dtstart, dtend;
+			icaltimezone *start_zone = NULL, *end_zone = NULL;
+
+			/* keep the detached instances apart */
+			ci = g_new0 (struct comp_instance, 1);
+			ci->comp = comp;
+
+			e_cal_component_get_dtstart (comp, &dtstart);
+			e_cal_component_get_dtend (comp, &dtend);
+
+			/* For DATE-TIME values with a TZID, we use
+			e_cal_resolve_tzid_cb to resolve the TZID.
+			For DATE values and DATE-TIME values without a
+			TZID (i.e. floating times) we use the default
+			timezone. */
+			if (dtstart.tzid && !dtstart.value->is_date) {
+				start_zone = e_cal_client_resolve_tzid_cb (dtstart.tzid, client);
+				if (!start_zone)
+					start_zone = default_zone;
+			} else {
+				start_zone = default_zone;
+			}
+
+			if (dtend.tzid && !dtend.value->is_date) {
+				end_zone = e_cal_client_resolve_tzid_cb (dtend.tzid, client);
+				if (!end_zone)
+					end_zone = default_zone;
+			} else {
+				end_zone = default_zone;
+			}
+
+			ci->start = icaltime_as_timet_with_zone (*dtstart.value, start_zone);
+
+			if (dtend.value)
+				ci->end = icaltime_as_timet_with_zone (*dtend.value, end_zone);
+			else if (icaltime_is_date (*dtstart.value))
+				ci->end = time_day_end (ci->start);
+			else
+				ci->end = ci->start;
+
+			e_cal_component_free_datetime (&dtstart);
+			e_cal_component_free_datetime (&dtend);
+
+			if (ci->start <= end && ci->end >= start) {
+				detached_instances = g_slist_prepend (detached_instances, ci);
+			} else {
+				/* it doesn't fit to our time range, thus skip it */
+				g_object_unref (G_OBJECT (ci->comp));
+				g_free (ci);
+			}
+		} else {
+			ECalComponentDateTime datetime;
+			icaltimezone *start_zone;
+			struct instances_info *instances_hold;
+
+			/* Get the start timezone */
+			e_cal_component_get_dtstart (comp, &datetime);
+			e_cal_client_get_timezone_sync (client, datetime.tzid, &start_zone, NULL, NULL);
+			e_cal_component_free_datetime (&datetime);
+
+			instances_hold = g_new0 (struct instances_info, 1);
+			instances_hold->instances = &instances;
+			instances_hold->start_zone = start_zone;
+
+			e_cal_recur_generate_instances (comp, start, end, add_instance, instances_hold,
+							e_cal_client_resolve_tzid_cb, client,
+							default_zone);
+
+			g_free (instances_hold);
+			g_object_unref (comp);
+		}
+	}
+
+	g_slist_free (objects);
+
+	/* Generate instances and spew them out */
+
+	instances = g_slist_sort (instances, compare_comp_instance);
+	instances = process_detached_instances (instances, detached_instances);
+
+	for (l = instances; l; l = l->next) {
+		struct comp_instance *ci;
+		gboolean result;
+
+		ci = l->data;
+
+		result = (* cb) (ci->comp, ci->start, ci->end, cb_data);
+
+		if (!result)
+			break;
+	}
+
+	/* Clean up */
+
+	for (l = instances; l; l = l->next) {
+		struct comp_instance *ci;
+
+		ci = l->data;
+		g_object_unref (G_OBJECT (ci->comp));
+		g_free (ci);
+	}
+
+	g_slist_free (instances);
+
+	for (l = detached_instances; l; l = l->next) {
+		struct comp_instance *ci;
+
+		ci = l->data;
+		g_object_unref (G_OBJECT (ci->comp));
+		g_free (ci);
+	}
+
+	g_slist_free (detached_instances);
+}
+
+/**
+ * e_cal_generate_instances:
+ * @client: A calendar client.
+ * @start: Start time for query.
+ * @end: End time for query.
+ * @cb: Callback for each generated instance.
+ * @cb_data: Closure data for the callback.
+ *
+ * Does a combination of #e_cal_client_get_object_list () and
+ * #e_cal_client_recur_generate_instances().
+ *
+ * The callback function should do a g_object_ref() of the calendar component
+ * it gets passed if it intends to keep it around, since it will be unref'ed
+ * as soon as the callback returns.
+ **/
+void
+e_cal_client_generate_instances (ECalClient *client, time_t start, time_t end, ECalRecurInstanceFn cb, gpointer cb_data)
+{
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (E_IS_CAL_CLIENT (client));
+	g_return_if_fail (e_client_is_opened (E_CLIENT (client)));
+
+	g_return_if_fail (start >= 0);
+	g_return_if_fail (end >= 0);
+	g_return_if_fail (cb != NULL);
+
+	generate_instances (client, start, end, NULL, cb, cb_data);
+}
+
+/**
+ * e_cal_client_generate_instances_for_object:
+ * @client: A calendar client.
+ * @icalcomp: Object to generate instances from.
+ * @start: Start time for query.
+ * @end: End time for query.
+ * @cb: Callback for each generated instance.
+ * @cb_data: Closure data for the callback.
+ *
+ * Does a combination of #e_cal_client_get_object_list () and
+ * #e_cal_client_recur_generate_instances(), like #e_cal_client_generate_instances(), but
+ * for a single object.
+ *
+ * The callback function should do a g_object_ref() of the calendar component
+ * it gets passed if it intends to keep it around, since it will be unref'ed
+ * as soon as the callback returns.
+ **/
+void
+e_cal_client_generate_instances_for_object (ECalClient *client, icalcomponent *icalcomp, time_t start, time_t end, ECalRecurInstanceFn cb, gpointer cb_data)
+{
+	ECalComponent *comp;
+	const gchar *uid;
+	gchar *rid;
+	gboolean result;
+	GSList *instances = NULL;
+	ECalComponentDateTime datetime;
+	icaltimezone *start_zone;
+	struct instances_info *instances_hold;
+	gboolean is_single_instance = FALSE;
+
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (E_IS_CAL_CLIENT (client));
+	g_return_if_fail (e_client_is_opened (E_CLIENT (client)));
+
+	g_return_if_fail (start >= 0);
+	g_return_if_fail (end >= 0);
+	g_return_if_fail (cb != NULL);
+
+	comp = e_cal_component_new ();
+	e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
+
+	if (!e_cal_component_has_recurrences (comp))
+		is_single_instance = TRUE;
+
+	/* If the backend stores it as individual instances and does not
+	 * have a master object - do not expand */
+	if (is_single_instance || e_client_check_capability (E_CLIENT (client), CAL_STATIC_CAPABILITY_RECURRENCES_NO_MASTER)) {
+		/* return the same instance */
+		result = (* cb)  (comp, icaltime_as_timet_with_zone (icalcomponent_get_dtstart (icalcomp), client->priv->default_zone),
+				icaltime_as_timet_with_zone (icalcomponent_get_dtend (icalcomp), client->priv->default_zone), cb_data);
+		g_object_unref (comp);
+		return;
+	}
+
+	e_cal_component_get_uid (comp, &uid);
+	rid = e_cal_component_get_recurid_as_string (comp);
+
+	/* Get the start timezone */
+	e_cal_component_get_dtstart (comp, &datetime);
+	e_cal_client_get_timezone_sync (client, datetime.tzid, &start_zone, NULL, NULL);
+	e_cal_component_free_datetime (&datetime);
+
+	instances_hold = g_new0 (struct instances_info, 1);
+	instances_hold->instances = &instances;
+	instances_hold->start_zone = start_zone;
+
+	/* generate all instances in the given time range */
+	generate_instances (client, start, end, uid, add_instance, instances_hold);
+
+	instances = *(instances_hold->instances);
+	/* now only return back the instances for the given object */
+	result = TRUE;
+	while (instances != NULL) {
+		struct comp_instance *ci;
+		gchar *instance_rid = NULL;
+
+		ci = instances->data;
+
+		if (result) {
+			instance_rid = e_cal_component_get_recurid_as_string (ci->comp);
+
+			if (rid && *rid) {
+				if (instance_rid && *instance_rid && strcmp (rid, instance_rid) == 0)
+					result = (* cb) (ci->comp, ci->start, ci->end, cb_data);
+			} else
+				result = (* cb)  (ci->comp, ci->start, ci->end, cb_data);
+		}
+
+		/* remove instance from list */
+		instances = g_slist_remove (instances, ci);
+		g_object_unref (ci->comp);
+		g_free (ci);
+		g_free (instance_rid);
+	}
+
+	/* clean up */
+	g_object_unref (comp);
+	g_free (instances_hold);
+	g_free (rid);
+}
+
+typedef struct _ForeachTZIDCallbackData ForeachTZIDCallbackData;
+struct _ForeachTZIDCallbackData {
+	ECalClient *client;
+	GHashTable *timezone_hash;
+	gboolean success;
+};
+
+/* This adds the VTIMEZONE given by the TZID parameter to the GHashTable in
+   data. */
+static void
+foreach_tzid_callback (icalparameter *param, gpointer cbdata)
+{
+	ForeachTZIDCallbackData *data = cbdata;
+	ECalClientPrivate *priv;
+	const gchar *tzid;
+	icaltimezone *zone = NULL;
+	icalcomponent *vtimezone_comp;
+	gchar *vtimezone_as_string;
+
+	priv = data->client->priv;
+
+	/* Get the TZID string from the parameter. */
+	tzid = icalparameter_get_tzid (param);
+	if (!tzid)
+		return;
+
+	/* Check if we've already added it to the GHashTable. */
+	if (g_hash_table_lookup (data->timezone_hash, tzid))
+		return;
+
+	if (!e_cal_client_get_timezone_sync (data->client, tzid, &zone, NULL, NULL) || !zone) {
+		data->success = FALSE;
+		return;
+	}
+
+	/* Convert it to a string and add it to the hash. */
+	vtimezone_comp = icaltimezone_get_component (zone);
+	if (!vtimezone_comp)
+		return;
+
+	vtimezone_as_string = icalcomponent_as_ical_string_r (vtimezone_comp);
+
+	g_hash_table_insert (data->timezone_hash, (gchar *) tzid, vtimezone_as_string);
+}
+
+/* This appends the value string to the GString given in data. */
+static void
+append_timezone_string (gpointer key, gpointer value, gpointer data)
+{
+	GString *vcal_string = data;
+
+	g_string_append (vcal_string, value);
+	g_free (value);
+}
+
+/* This simply frees the hash values. */
+static void
+free_timezone_string (gpointer key, gpointer value, gpointer data)
+{
+	g_free (value);
+}
+
+/**
+ * e_cal_client_get_component_as_string:
+ * @client: A calendar client.
+ * @icalcomp: A calendar component object.
+ *
+ * Gets a calendar component as an iCalendar string, with a toplevel
+ * VCALENDAR component and all VTIMEZONEs needed for the component.
+ *
+ * Returns: the component as a complete iCalendar string, or NULL on
+ * failure. The string should be freed with g_free().
+ *
+ * Since: 3.2
+ **/
+gchar *
+e_cal_client_get_component_as_string (ECalClient *client, icalcomponent *icalcomp)
+{
+	GHashTable *timezone_hash;
+	GString *vcal_string;
+	ForeachTZIDCallbackData cbdata;
+	gchar *obj_string;
+
+	g_return_val_if_fail (client != NULL, NULL);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), NULL);
+	g_return_val_if_fail (client->priv != NULL, NULL);
+	g_return_val_if_fail (icalcomp != NULL, NULL);
+
+	timezone_hash = g_hash_table_new (g_str_hash, g_str_equal);
+
+	/* Add any timezones needed to the hash. We use a hash since we only
+	   want to add each timezone once at most. */
+	cbdata.client = client;
+	cbdata.timezone_hash = timezone_hash;
+	cbdata.success = TRUE;
+	icalcomponent_foreach_tzid (icalcomp, foreach_tzid_callback, &cbdata);
+	if (!cbdata.success) {
+		g_hash_table_foreach (timezone_hash, free_timezone_string, NULL);
+		return NULL;
+	}
+
+	/* Create the start of a VCALENDAR, to add the VTIMEZONES to,
+	   and remember its length so we know if any VTIMEZONEs get added. */
+	vcal_string = g_string_new (NULL);
+	g_string_append (vcal_string,
+			 "BEGIN:VCALENDAR\n"
+			 "PRODID:-//Ximian//NONSGML Evolution Calendar//EN\n"
+			 "VERSION:2.0\n"
+			 "METHOD:PUBLISH\n");
+
+	/* Now concatenate all the timezone strings. This also frees the
+	   timezone strings as it goes. */
+	g_hash_table_foreach (timezone_hash, append_timezone_string, vcal_string);
+
+	/* Get the string for the VEVENT/VTODO. */
+	obj_string = icalcomponent_as_ical_string_r (icalcomp);
+
+	/* If there were any timezones to send, create a complete VCALENDAR,
+	   else just send the VEVENT/VTODO string. */
+	g_string_append (vcal_string, obj_string);
+	g_string_append (vcal_string, "END:VCALENDAR\n");
+	g_free (obj_string);
+
+	obj_string = g_string_free (vcal_string, FALSE);
+
+	g_hash_table_destroy (timezone_hash);
+
+	return obj_string;
+}
+
+static guint32
+cal_client_open (EClient *client, gboolean only_if_exists, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	return e_client_proxy_call_boolean (client, only_if_exists, cancellable, callback, user_data, cal_client_open,
+			e_gdbus_cal_call_open,
+			e_gdbus_cal_call_open_finish, NULL, NULL, NULL, NULL);
+}
+
+static gboolean
+cal_client_open_finish (EClient *client, GAsyncResult *result, GError **error)
+{
+	return e_client_proxy_call_finish_void (client, result, error, cal_client_open);
+}
+
+static gboolean
+cal_client_open_sync (EClient *client, gboolean only_if_exists, GCancellable *cancellable, GError **error)
+{
+	ECalClient *cal_client;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+
+	cal_client = E_CAL_CLIENT (client);
+	g_return_val_if_fail (cal_client != NULL, FALSE);
+	g_return_val_if_fail (cal_client->priv != NULL, FALSE);
+
+	if (!cal_client->priv->gdbus_cal) {
+		g_set_error (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_DBUS_ERROR, _("D-Bus calendar proxy gone"));
+		return FALSE;
+	}
+
+	return e_client_proxy_call_sync_boolean__void (client, only_if_exists, cancellable, error, e_gdbus_cal_call_open_sync);
+}
+
+static guint32
+cal_client_remove (EClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	return e_client_proxy_call_void (client, cancellable, callback, user_data, cal_client_remove,
+			e_gdbus_cal_call_remove,
+			e_gdbus_cal_call_remove_finish, NULL, NULL, NULL, NULL);
+}
+
+static gboolean
+cal_client_remove_finish (EClient *client, GAsyncResult *result, GError **error)
+{
+	return e_client_proxy_call_finish_void (client, result, error, cal_client_remove);
+}
+
+static gboolean
+cal_client_remove_sync (EClient *client, GCancellable *cancellable, GError **error)
+{
+	ECalClient *cal_client;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+
+	cal_client = E_CAL_CLIENT (client);
+	g_return_val_if_fail (cal_client != NULL, FALSE);
+	g_return_val_if_fail (cal_client->priv != NULL, FALSE);
+
+	if (!cal_client->priv->gdbus_cal) {
+		g_set_error (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_DBUS_ERROR, _("D-Bus calendar proxy gone"));
+		return FALSE;
+	}
+
+	return e_client_proxy_call_sync_void__void (client, cancellable, error, e_gdbus_cal_call_remove_sync);
+}
+
+
+/**
+ * e_cal_client_get_capabilities:
+ * @client: an #ECalClient
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Starts retrieval of the list of capabilities which the backend for this calendar
+ * supports. The call is finished by e_cal_client_get_capabilities_finish() from
+ * the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Note: Usually is sufficient to use e_client_get_capabilities() or e_client_check_capability(),
+ * which caches capabilities of a backend on the client side.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_cal_client_get_capabilities (ECalClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	return e_client_proxy_call_void (E_CLIENT (client), cancellable, callback, user_data, e_cal_client_get_capabilities,
+			e_gdbus_cal_call_get_capabilities,
+			NULL, NULL, e_gdbus_cal_call_get_capabilities_finish, NULL, NULL);
+}
+
+/**
+ * e_cal_client_get_capabilities_finish:
+ * @client: an #ECalClient
+ * @result: a #GAsyncResult
+ * @capabilities: (out): list of strings with capabilities
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_cal_client_get_capabilities() and
+ * sets @capabilities to a list of strings of backend capabilities.
+ * This list should be freed with e_client_util_free_string_slist().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_get_capabilities_finish (ECalClient *client, GAsyncResult *result, GSList **capabilities, GError **error)
+{
+	gboolean res;
+	gchar *out_string = NULL;
+
+	g_return_val_if_fail (capabilities != NULL, FALSE);
+
+	res = e_client_proxy_call_finish_string (E_CLIENT (client), result, &out_string, error, e_cal_client_get_capabilities);
+
+	if (res && out_string)
+		*capabilities = e_client_util_parse_capabilities (out_string);
+	else
+		*capabilities = NULL;
+
+	g_free (out_string);
+
+	return res;
+}
+
+/**
+ * e_cal_client_get_capabilities_sync:
+ * @client: an #ECalClient
+ * @capabilities: (out): list of strings with capabilities
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Retrieves a list of capabilities which the backend for this calendar
+ * supports and sets @capabilities to that list.
+ * This list should be freed with e_client_util_free_string_slist().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Note: Usually is sufficient to use e_client_get_capabilities() or e_client_check_capability(),
+ * which caches capabilities of a backend on the client side.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_get_capabilities_sync (ECalClient *client, GSList **capabilities, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar *out_string = NULL;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (capabilities != NULL, FALSE);
+
+	if (!client->priv->gdbus_cal) {
+		g_set_error (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_DBUS_ERROR, _("D-Bus calendar proxy gone"));
+		return FALSE;
+	}
+
+	res = e_client_proxy_call_sync_void__string (E_CLIENT (client), &out_string, cancellable, error, e_gdbus_cal_call_get_capabilities_sync);
+
+	if (res && out_string)
+		*capabilities = e_client_util_parse_capabilities (out_string);
+	else
+		*capabilities = NULL;
+
+	g_free (out_string);
+
+	return res;
+}
+
+static gboolean
+complete_string_exchange (gboolean res, gchar *out_string, gchar **result, GError **error)
+{
+	g_return_val_if_fail (result != NULL, FALSE);
+
+	if (res && out_string) {
+		if (*out_string) {
+			*result = out_string;
+		} else {
+			/* empty string is returned as NULL */
+			*result = NULL;
+			g_free (out_string);
+		}
+	} else {
+		*result = NULL;
+		g_free (out_string);
+		res = FALSE;
+
+		if (error && !*error)
+			g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_INVALID_ARG, e_cal_client_error_to_string (E_CAL_CLIENT_ERROR_INVALID_ARG));
+	}
+
+	return res;
+}
+
+/**
+ * e_cal_client_get_cal_email_address:
+ * @client: an #ECalClient
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Queries the calendar address associated with a calendar client.
+ * The call is finished by e_cal_client_get_cal_email_address_finish() from
+ * the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_cal_client_get_cal_email_address (ECalClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	return e_client_proxy_call_void (E_CLIENT (client), cancellable, callback, user_data, e_cal_client_get_cal_email_address,
+			e_gdbus_cal_call_get_cal_email_address,
+			NULL, NULL, e_gdbus_cal_call_get_cal_email_address_finish, NULL, NULL);
+}
+
+/**
+ * e_cal_client_get_cal_email_address_finish:
+ * @client: an #ECalClient
+ * @result: a #GAsyncResult
+ * @address: (out): Calendar's e-mail address
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_cal_client_get_cal_email_address() and
+ * sets @address the calendar address associated with a calendar client.
+ * This address should be freed with g_free().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_get_cal_email_address_finish (ECalClient *client, GAsyncResult *result, gchar **address, GError **error)
+{
+	gboolean res;
+	gchar *out_string = NULL;
+
+	g_return_val_if_fail (address != NULL, FALSE);
+
+	res = e_client_proxy_call_finish_string (E_CLIENT (client), result, &out_string, error, e_cal_client_get_cal_email_address);
+
+	return complete_string_exchange (res, out_string, address, error);
+}
+
+/**
+ * e_cal_client_get_cal_email_address_sync:
+ * @client: an #ECalClient
+ * @address: (out): Calendar's e-mail address
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Queries the calendar address associated with a calendar client.
+ * This address should be freed with g_free().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_get_cal_email_address_sync (ECalClient *client, gchar **address, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar *out_string = NULL;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (address != NULL, FALSE);
+
+	if (!client->priv->gdbus_cal) {
+		g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_DBUS_ERROR, _("D-Bus calendar proxy gone"));
+		return FALSE;
+	}
+
+	res = e_client_proxy_call_sync_void__string (E_CLIENT (client), &out_string, cancellable, error, e_gdbus_cal_call_get_cal_email_address_sync);
+
+	return complete_string_exchange (res, out_string, address, error);
+}
+
+/**
+ * e_cal_client_get_alarm_email_address:
+ * @client: an #ECalClient
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Queries the address to be used for alarms in a calendar client.
+ * The call is finished by e_cal_client_get_alarm_email_address_finish() from
+ * the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_cal_client_get_alarm_email_address (ECalClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	return e_client_proxy_call_void (E_CLIENT (client), cancellable, callback, user_data, e_cal_client_get_alarm_email_address,
+			e_gdbus_cal_call_get_alarm_email_address,
+			NULL, NULL, e_gdbus_cal_call_get_alarm_email_address_finish, NULL, NULL);
+}
+
+/**
+ * e_cal_client_get_alarm_email_address_finish:
+ * @client: an #ECalClient
+ * @result: a #GAsyncResult
+ * @address: (out): Calendar's e-mail address for alarms
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_cal_client_get_alarm_email_address() and
+ * sets @addressto the address to be used for alarms in a calendar client.
+ * This address should be freed with g_free().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_get_alarm_email_address_finish (ECalClient *client, GAsyncResult *result, gchar **address, GError **error)
+{
+	gboolean res;
+	gchar *out_string = NULL;
+
+	g_return_val_if_fail (address != NULL, FALSE);
+
+	res = e_client_proxy_call_finish_string (E_CLIENT (client), result, &out_string, error, e_cal_client_get_alarm_email_address);
+
+	return complete_string_exchange (res, out_string, address, error);
+}
+
+/**
+ * e_cal_client_get_alarm_email_address_sync:
+ * @client: an #ECalClient
+ * @address: (out): Calendar's e-mail address for alarms
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Queries the address to be used for alarms in a calendar client.
+ * This address should be freed with g_free().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_get_alarm_email_address_sync (ECalClient *client, gchar **address, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar *out_string = NULL;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (address != NULL, FALSE);
+
+	if (!client->priv->gdbus_cal) {
+		g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_DBUS_ERROR, _("D-Bus calendar proxy gone"));
+		return FALSE;
+	}
+
+	res = e_client_proxy_call_sync_void__string (E_CLIENT (client), &out_string, cancellable, error, e_gdbus_cal_call_get_alarm_email_address_sync);
+
+	return complete_string_exchange (res, out_string, address, error);
+}
+
+/**
+ * e_cal_client_get_default_object:
+ * @client: an #ECalClient
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Retrives an #icalcomponent from the backend that contains the default
+ * values for properties needed. The call is finished
+ * by e_cal_client_get_default_object_finish() from the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_cal_client_get_default_object (ECalClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	return e_client_proxy_call_void (E_CLIENT (client), cancellable, callback, user_data, e_cal_client_get_default_object,
+			e_gdbus_cal_call_get_default_object,
+			NULL, NULL, e_gdbus_cal_call_get_default_object_finish, NULL, NULL);
+}
+
+static gboolean
+complete_get_object (gboolean res, gchar *out_string, icalcomponent **icalcomp, GError **error)
+{
+	g_return_val_if_fail (icalcomp != NULL, FALSE);
+
+	if (res && out_string) {
+		*icalcomp = icalparser_parse_string (out_string);
+		if (!*icalcomp) {
+			g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_INVALID_OBJECT, e_cal_client_error_to_string (E_CAL_CLIENT_ERROR_INVALID_OBJECT));
+			res = FALSE;
+		}
+	} else {
+		*icalcomp = NULL;
+		res = FALSE;
+	}
+
+	g_free (out_string);
+
+	return res;
+}
+
+/**
+ * e_cal_client_get_default_object_finish:
+ * @client: an #ECalClient
+ * @result: a #GAsyncResult
+ * @icalcomp: (out): Return value for the default calendar object.
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_cal_client_get_default_object() and
+ * sets @icalcomp to an #icalcomponent from the backend that contains
+ * the default values for properties needed. This @icalcomp should be
+ * freed with icalcomponent_free().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_get_default_object_finish (ECalClient *client, GAsyncResult *result, icalcomponent **icalcomp, GError **error)
+{
+	gboolean res;
+	gchar *out_string = NULL;
+
+	g_return_val_if_fail (icalcomp != NULL, FALSE);
+
+	res = e_client_proxy_call_finish_string (E_CLIENT (client), result, &out_string, error, e_cal_client_get_default_object);
+
+	return complete_get_object (res, out_string, icalcomp, error);
+}
+
+/**
+ * e_cal_client_get_default_object_sync:
+ * @client: an #ECalClient
+ * @icalcomp: (out): Return value for the default calendar object.
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Retrives an #icalcomponent from the backend that contains the default
+ * values for properties needed. This @icalcomp should be freed with
+ * icalcomponent_free().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_get_default_object_sync (ECalClient *client, icalcomponent **icalcomp, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar *out_string = NULL;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (icalcomp != NULL, FALSE);
+
+	if (!client->priv->gdbus_cal) {
+		g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_DBUS_ERROR, _("D-Bus calendar proxy gone"));
+		return FALSE;
+	}
+
+	res = e_client_proxy_call_sync_void__string (E_CLIENT (client), &out_string, cancellable, error, e_gdbus_cal_call_get_default_object_sync);
+
+	return complete_get_object (res, out_string, icalcomp, error);
+}
+
+/**
+ * e_cal_client_refresh:
+ * @client: an #ECalClient
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Invokes refresh on a calendar. See @e_cal_client_get_refresh_supported().
+ * The call is finished by e_cal_client_refresh_finish() from
+ * the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_cal_client_refresh (ECalClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	return e_client_proxy_call_void (E_CLIENT (client), cancellable, callback, user_data, e_cal_client_refresh,
+			e_gdbus_cal_call_refresh,
+			e_gdbus_cal_call_refresh_finish, NULL, NULL, NULL, NULL);
+}
+
+/**
+ * e_cal_client_refresh_finish:
+ * @client: an #ECalClient
+ * @result: a #GAsyncResult
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_cal_client_refresh().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_refresh_finish (ECalClient *client, GAsyncResult *result, GError **error)
+{
+	return e_client_proxy_call_finish_void (E_CLIENT (client), result, error, e_cal_client_refresh);
+}
+
+/**
+ * e_cal_client_refresh_sync:
+ * @client: an #ECalClient
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Invokes refresh on a calendar. See @e_cal_client_get_refresh_supported().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_refresh_sync (ECalClient *client, GCancellable *cancellable, GError **error)
+{
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+
+	if (!client->priv->gdbus_cal) {
+		g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_DBUS_ERROR, _("D-Bus calendar proxy gone"));
+		return FALSE;
+	}
+
+	return e_client_proxy_call_sync_void__void (E_CLIENT (client), cancellable, error, e_gdbus_cal_call_refresh_sync);
+}
+
+/**
+ * e_cal_client_get_object:
+ * @client: an #ECalClient
+ * @uid: Unique identifier for a calendar component.
+ * @rid: Recurrence identifier.
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Queries a calendar for a calendar component object based on its unique
+ * identifier. The call is finished by e_cal_client_get_object_finish()
+ * from the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_cal_client_get_object (ECalClient *client, const gchar *uid, const gchar *rid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	guint32 opid;
+	gchar **strv;
+
+	g_return_val_if_fail (uid != NULL, 0);
+
+	strv = e_gdbus_cal_encode_get_object (uid, rid);
+
+	opid = e_client_proxy_call_strv (E_CLIENT (client), (const gchar * const *) strv, cancellable, callback, user_data, e_cal_client_get_object,
+			e_gdbus_cal_call_get_object,
+			NULL, NULL, e_gdbus_cal_call_get_object_finish, NULL, NULL);
+
+	g_strfreev (strv);
+
+	return opid;
+}
+
+/**
+ * e_cal_client_get_object_finish:
+ * @client: an #ECalClient
+ * @result: a #GAsyncResult
+ * @icalcomp: (out): Return value for the calendar component object.
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_cal_client_get_object() and
+ * sets @icalcomp to queried component.
+ * This component should be freed with icalcomponent_free().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_get_object_finish (ECalClient *client, GAsyncResult *result, icalcomponent **icalcomp, GError **error)
+{
+	gboolean res;
+	gchar *out_string = NULL;
+
+	g_return_val_if_fail (icalcomp != NULL, FALSE);
+
+	res = e_client_proxy_call_finish_string (E_CLIENT (client), result, &out_string, error, e_cal_client_get_object);
+
+	return complete_get_object (res, out_string, icalcomp, error);;
+}
+
+/**
+ * e_cal_client_get_object_sync:
+ * @client: an #ECalClient
+ * @uid: Unique identifier for a calendar component.
+ * @rid: Recurrence identifier.
+ * @icalcomp: (out): Return value for the calendar component object.
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Queries a calendar for a calendar component object based
+ * on its unique identifier.
+ * This component should be freed with icalcomponent_free().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_get_object_sync (ECalClient *client, const gchar *uid, const gchar *rid, icalcomponent **icalcomp, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar *out_string = NULL, **strv;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (uid != NULL, FALSE);
+	g_return_val_if_fail (icalcomp != NULL, FALSE);
+
+	if (!client->priv->gdbus_cal) {
+		g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_DBUS_ERROR, _("D-Bus calendar proxy gone"));
+		return FALSE;
+	}
+
+	strv = e_gdbus_cal_encode_get_object (uid, rid);
+	res = e_client_proxy_call_sync_strv__string (E_CLIENT (client), (const gchar * const *) strv, &out_string, cancellable, error, e_gdbus_cal_call_get_object_sync);
+	g_strfreev (strv);
+
+	return complete_get_object (res, out_string, icalcomp, error);
+}
+
+/**
+ * e_cal_client_get_objects_for_uid:
+ * @client: an #ECalClient
+ * @uid: Unique identifier for a calendar component
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Queries a calendar for all calendar components with the given unique
+ * ID. This will return any recurring event and all its detached recurrences.
+ * For non-recurring events, it will just return the object with that ID.
+ * The call is finished by e_cal_client_get_objects_for_uid_finish() from
+ * the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_cal_client_get_objects_for_uid (ECalClient *client, const gchar *uid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	guint32 opid;
+	gchar **strv;
+
+	g_return_val_if_fail (uid != NULL, 0);
+
+	strv = e_gdbus_cal_encode_get_object (uid, "");
+
+	opid = e_client_proxy_call_strv (E_CLIENT (client), (const gchar * const *) strv, cancellable, callback, user_data, e_cal_client_get_objects_for_uid,
+			e_gdbus_cal_call_get_object,
+			NULL, NULL, e_gdbus_cal_call_get_object_finish, NULL, NULL);
+
+	g_strfreev (strv);
+
+	return opid;
+}
+
+static gboolean
+complete_get_objects_for_uid (ECalClientSourceType source_type, gboolean res, gchar *out_string, GSList **ecalcomps, GError **error)
+{
+	icalcomponent *icalcomp = NULL;
+	icalcomponent_kind kind;
+	ECalComponent *comp;
+
+	res = complete_get_object (res, out_string, &icalcomp, error);
+	if (!res || !icalcomp)
+		return FALSE;
+
+	kind = icalcomponent_isa (icalcomp);
+	if ((kind == ICAL_VEVENT_COMPONENT && source_type == E_CAL_CLIENT_SOURCE_TYPE_EVENT) ||
+	    (kind == ICAL_VTODO_COMPONENT && source_type == E_CAL_CLIENT_SOURCE_TYPE_TODO) ||
+	    (kind == ICAL_VJOURNAL_COMPONENT && source_type == E_CAL_CLIENT_SOURCE_TYPE_JOURNAL)) {
+		comp = e_cal_component_new ();
+		e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
+		*ecalcomps = g_slist_append (NULL, comp);
+	} else if (kind == ICAL_VCALENDAR_COMPONENT) {
+		icalcomponent *subcomp;
+		icalcomponent_kind kind_to_find;
+
+		switch (source_type) {
+		case E_CAL_CLIENT_SOURCE_TYPE_TODO :
+			kind_to_find = ICAL_VTODO_COMPONENT;
+			break;
+		case E_CAL_CLIENT_SOURCE_TYPE_JOURNAL :
+			kind_to_find = ICAL_VJOURNAL_COMPONENT;
+			break;
+		case E_CAL_CLIENT_SOURCE_TYPE_EVENT :
+		default:
+			kind_to_find = ICAL_VEVENT_COMPONENT;
+			break;
+		}
+
+		*ecalcomps = NULL;
+		subcomp = icalcomponent_get_first_component (icalcomp, kind_to_find);
+		while (subcomp) {
+			comp = e_cal_component_new ();
+			e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (subcomp));
+			*ecalcomps = g_slist_prepend (*ecalcomps, comp);
+			subcomp = icalcomponent_get_next_component (icalcomp, kind_to_find);
+		}
+
+		*ecalcomps = g_slist_reverse (*ecalcomps);
+	}
+
+	icalcomponent_free (icalcomp);
+
+	return TRUE;
+}
+
+/**
+ * e_cal_client_get_objects_for_uid_finish:
+ * @client: an #ECalClient
+ * @result: a #GAsyncResult
+ * @ecalcomps: (out): Return value for the list of objects obtained from the backend
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_cal_client_get_objects_for_uid() and
+ * sets @ecalcomps to a list of #ECalComponent-s corresponding to
+ * found components for a given uid of the same type as this client.
+ * This list should be freed with e_cal_client_free_ecalcomp_slist().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_get_objects_for_uid_finish (ECalClient *client, GAsyncResult *result, GSList **ecalcomps, GError **error)
+{
+	gboolean res;
+	gchar *out_string = NULL;
+
+	g_return_val_if_fail (ecalcomps != NULL, FALSE);
+
+	res = e_client_proxy_call_finish_string (E_CLIENT (client), result, &out_string, error, e_cal_client_get_objects_for_uid);
+
+	return complete_get_objects_for_uid (e_cal_client_get_source_type (client), res, out_string, ecalcomps, error);
+}
+
+/**
+ * e_cal_client_get_objects_for_uid_sync:
+ * @client: an #ECalClient
+ * @uid: Unique identifier for a calendar component
+ * @ecalcomps: (out): Return value for the list of objects obtained from the backend
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Queries a calendar for all calendar components with the given unique
+ * ID. This will return any recurring event and all its detached recurrences.
+ * For non-recurring events, it will just return the object with that ID.
+ * This list should be freed with e_cal_client_free_ecalcomp_slist().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_get_objects_for_uid_sync (ECalClient *client, const gchar *uid, GSList **ecalcomps, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar *out_string = NULL, **strv = NULL;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (uid != NULL, FALSE);
+	g_return_val_if_fail (ecalcomps != NULL, FALSE);
+
+	if (!client->priv->gdbus_cal) {
+		g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_DBUS_ERROR, _("D-Bus calendar proxy gone"));
+		return FALSE;
+	}
+
+	strv = e_gdbus_cal_encode_get_object (uid, "");
+	res = e_client_proxy_call_sync_strv__string (E_CLIENT (client), (const gchar * const *) strv, &out_string, cancellable, error, e_gdbus_cal_call_get_object_sync);
+	g_strfreev (strv);
+
+	return complete_get_objects_for_uid (e_cal_client_get_source_type (client), res, out_string, ecalcomps, error);
+}
+
+/**
+ * e_cal_client_get_object_list:
+ * @client: an #ECalClient
+ * @sexp: an S-expression representing the query
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Gets a list of objects from the calendar that match the query specified
+ * by the @sexp argument, returning matching objects as a list of #icalcomponent-s.
+ * The call is finished by e_cal_client_get_object_list_finish() from
+ * the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_cal_client_get_object_list (ECalClient *client, const gchar *sexp, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	gchar *gdbus_sexp = NULL;
+	guint32 opid;
+
+	g_return_val_if_fail (sexp != NULL, 0);
+
+	opid = e_client_proxy_call_string (E_CLIENT (client), e_util_ensure_gdbus_string (sexp, &gdbus_sexp), cancellable, callback, user_data, e_cal_client_get_object_list,
+			e_gdbus_cal_call_get_object_list,
+			NULL, NULL, NULL, e_gdbus_cal_call_get_object_list_finish, NULL);
+
+	g_free (gdbus_sexp);
+
+	return opid;
+}
+
+static gboolean
+complete_get_object_list (gboolean res, gchar **out_strv, GSList **icalcomps, GError **error)
+{
+	g_return_val_if_fail (icalcomps != NULL, FALSE);
+
+	*icalcomps = NULL;
+
+	if (res && out_strv) {
+		gint ii;
+		icalcomponent *icalcomp;
+
+		for (ii = 0; out_strv[ii]; ii++) {
+			icalcomp = icalcomponent_new_from_string (out_strv[ii]);
+
+			if (!icalcomp)
+				continue;
+
+			*icalcomps = g_slist_prepend (*icalcomps, icalcomp);
+		}
+
+		*icalcomps = g_slist_reverse (*icalcomps);
+	} else {
+		res = FALSE;
+	}
+
+	g_strfreev (out_strv);
+
+	return res;
+}
+
+/**
+ * e_cal_client_get_object_list_finish:
+ * @client: an #ECalClient
+ * @result: a #GAsyncResult
+ * @icalcomps: (out): list of matching #icalcomponent-s
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_cal_client_get_object_list() and
+ * sets @icalcomps to a matching list of #icalcomponent-s.
+ * This list should be freed with #e_cal_client_free_icalcomp_slist().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_get_object_list_finish (ECalClient *client, GAsyncResult *result, GSList **icalcomps, GError **error)
+{
+	gboolean res;
+	gchar **out_strv = NULL;
+
+	g_return_val_if_fail (icalcomps != NULL, FALSE);
+
+	res = e_client_proxy_call_finish_strv (E_CLIENT (client), result, &out_strv, error, e_cal_client_get_object_list);
+
+	return complete_get_object_list (res, out_strv, icalcomps, error);
+}
+
+/**
+ * e_cal_client_get_object_list_sync:
+ * @client: an #ECalClient
+ * @sexp: an S-expression representing the query
+ * @icalcomps: (out): list of matching #icalcomponent-s
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Gets a list of objects from the calendar that match the query specified
+ * by the @sexp argument. The objects will be returned in the @icalcomps
+ * argument, which is a list of #icalcomponent.
+ * This list should be freed with #e_cal_client_free_icalcomp_slist().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_get_object_list_sync (ECalClient *client, const gchar *sexp, GSList **icalcomps, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar **out_strv = NULL, *gdbus_sexp = NULL;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (sexp != NULL, FALSE);
+	g_return_val_if_fail (icalcomps != NULL, FALSE);
+
+	if (!client->priv->gdbus_cal) {
+		g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_DBUS_ERROR, _("D-Bus calendar proxy gone"));
+		return FALSE;
+	}
+
+	res = e_client_proxy_call_sync_string__strv (E_CLIENT (client), e_util_ensure_gdbus_string (sexp, &gdbus_sexp), &out_strv, cancellable, error, e_gdbus_cal_call_get_object_list_sync);
+	g_free (gdbus_sexp);
+
+	return complete_get_object_list (res, out_strv, icalcomps, error);
+}
+
+/**
+ * e_cal_client_get_object_list_as_comps:
+ * @client: an #ECalClient
+ * @sexp: an S-expression representing the query
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Gets a list of objects from the calendar that match the query specified
+ * by the @sexp argument, returning matching objects as a list of #ECalComponent-s.
+ * The call is finished by e_cal_client_get_object_list_as_comps_finish() from
+ * the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_cal_client_get_object_list_as_comps (ECalClient *client, const gchar *sexp, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	guint32 opid;
+	gchar *gdbus_sexp = NULL;
+
+	g_return_val_if_fail (sexp != NULL, 0);
+
+	opid = e_client_proxy_call_string (E_CLIENT (client), e_util_ensure_gdbus_string (sexp, &gdbus_sexp), cancellable, callback, user_data, e_cal_client_get_object_list_as_comps,
+			e_gdbus_cal_call_get_object_list,
+			NULL, NULL, NULL, e_gdbus_cal_call_get_object_list_finish, NULL);
+
+	g_free (gdbus_sexp);
+
+	return opid;
+}
+
+static gboolean
+complete_get_object_list_as_comps (gboolean res, gchar **out_strv, GSList **ecalcomps, GError **error)
+{
+	GSList *icalcomps = NULL;
+
+	g_return_val_if_fail (ecalcomps != NULL, FALSE);
+
+	*ecalcomps = NULL;
+
+	res = complete_get_object_list (res, out_strv, &icalcomps, error);
+
+	if (res) {
+		GSList *iter;
+
+		for (iter = icalcomps; iter; iter = iter->next) {
+			ECalComponent *comp;
+
+			comp = e_cal_component_new ();
+			/* takes ownership of the icalcomp, thus free only the list at the end */
+			if (e_cal_component_set_icalcomponent (comp, iter->data))
+				*ecalcomps = g_slist_prepend (*ecalcomps, comp);
+			else
+				icalcomponent_free (iter->data);
+		}
+
+		g_slist_free (icalcomps);
+
+		*ecalcomps = g_slist_reverse (*ecalcomps);
+	} else {
+		e_cal_client_free_icalcomp_slist (icalcomps);
+	}
+
+	return res;
+}
+
+/**
+ * e_cal_client_get_object_list_as_comps_finish:
+ * @client: an #ECalClient
+ * @result: a #GAsyncResult
+ * @ecalcomps: (out): list of matching #ECalComponent-s
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_cal_client_get_object_list_as_comps() and
+ * sets @ecalcomps to a matching list of #ECalComponent-s.
+ * This list should be freed with #e_cal_client_free_ecalcomp_slist().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_get_object_list_as_comps_finish (ECalClient *client, GAsyncResult *result, GSList **ecalcomps, GError **error)
+{
+	gboolean res;
+	gchar **out_strv = NULL;
+
+	g_return_val_if_fail (ecalcomps != NULL, FALSE);
+
+	res = e_client_proxy_call_finish_strv (E_CLIENT (client), result, &out_strv, error, e_cal_client_get_object_list_as_comps);
+
+	return complete_get_object_list_as_comps (res, out_strv, ecalcomps, error);
+}
+
+/**
+ * e_cal_client_get_object_list_as_comps_sync:
+ * @client: an #ECalClient
+ * @sexp: an S-expression representing the query
+ * @ecalcomps: (out): list of matching #ECalComponent-s
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Gets a list of objects from the calendar that match the query specified
+ * by the @sexp argument. The objects will be returned in the @ecalcomps
+ * argument, which is a list of #ECalComponent.
+ * This list should be freed with #e_cal_client_free_ecalcomp_slist().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_get_object_list_as_comps_sync (ECalClient *client, const gchar *sexp, GSList **ecalcomps, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar **out_strv = NULL, *gdbus_sexp = NULL;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (sexp != NULL, FALSE);
+	g_return_val_if_fail (ecalcomps != NULL, FALSE);
+
+	if (!client->priv->gdbus_cal) {
+		g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_DBUS_ERROR, _("D-Bus calendar proxy gone"));
+		return FALSE;
+	}
+
+	res = e_client_proxy_call_sync_string__strv (E_CLIENT (client), e_util_ensure_gdbus_string (sexp, &gdbus_sexp), &out_strv, cancellable, error, e_gdbus_cal_call_get_object_list_sync);
+	g_free (gdbus_sexp);
+
+	return complete_get_object_list_as_comps (res, out_strv, ecalcomps, error);
+}
+
+/**
+ * e_cal_client_get_free_busy:
+ * @client: an #ECalClient
+ * @start: Start time for query
+ * @end: End time for query
+ * @users: List of users to retrieve free/busy information for
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Gets free/busy information from the calendar server
+ * as a list of #ECalComponent-s.
+ * The call is finished by e_cal_client_get_free_busy_finish() from
+ * the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_cal_client_get_free_busy (ECalClient *client, time_t start, time_t end, const GSList *users, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	gchar **strv;
+	guint32 opid;
+
+	g_return_val_if_fail (start > 0, 0);
+	g_return_val_if_fail (end > 0, 0);
+	g_return_val_if_fail (users != NULL, 0);
+
+	strv = e_gdbus_cal_encode_get_free_busy (start, end, users);
+
+	opid = e_client_proxy_call_strv (E_CLIENT (client), (const gchar * const *) strv, cancellable, callback, user_data, e_cal_client_get_free_busy,
+			e_gdbus_cal_call_get_free_busy,
+			NULL, NULL, NULL, e_gdbus_cal_call_get_free_busy_finish, NULL);
+
+	g_strfreev (strv);
+
+	return opid;
+}
+
+static gboolean
+complete_get_free_busy (gboolean res, gchar **out_strv, GSList **ecalcomps, GError **error)
+{
+	g_return_val_if_fail (ecalcomps != NULL, FALSE);
+
+	*ecalcomps = NULL;
+
+	if (res && out_strv) {
+		gint ii;
+
+		for (ii = 0; out_strv[ii]; ii++) {
+			ECalComponent *comp;
+			icalcomponent *icalcomp;
+			icalcomponent_kind kind;
+
+			icalcomp = icalcomponent_new_from_string (out_strv[ii]);
+			if (!icalcomp)
+				continue;
+
+			kind = icalcomponent_isa (icalcomp);
+			if (kind == ICAL_VFREEBUSY_COMPONENT) {
+				comp = e_cal_component_new ();
+				if (!e_cal_component_set_icalcomponent (comp, icalcomp)) {
+					icalcomponent_free (icalcomp);
+					g_object_unref (G_OBJECT (comp));
+					continue;
+				}
+
+				*ecalcomps = g_slist_prepend (*ecalcomps, comp);
+			} else {
+				icalcomponent_free (icalcomp);
+			}
+		}
+
+		*ecalcomps = g_slist_reverse (*ecalcomps);
+	} else {
+		res = FALSE;
+	}
+
+	g_strfreev (out_strv);
+
+	return res;
+}
+
+/**
+ * e_cal_client_get_free_busy_finish:
+ * @client: an #ECalClient
+ * @result: a #GAsyncResult
+ * @ecalcomps: (out): Return value for VFREEBUSY #ECalComponent objects.
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_cal_client_get_free_busy() and sets @ecalcomps
+ * with fetched free/busy information from the calendar server.
+ * The @ecalcomps is a list of #ECalComponent.
+ * This list should be freed with #e_cal_client_free_ecalcomp_slist().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_get_free_busy_finish (ECalClient *client, GAsyncResult *result, GSList **ecalcomps, GError **error)
+{
+	gboolean res;
+	gchar **out_strv = NULL;
+
+	g_return_val_if_fail (ecalcomps != NULL, FALSE);
+
+	res = e_client_proxy_call_finish_strv (E_CLIENT (client), result, &out_strv, error, e_cal_client_get_free_busy);
+
+	return complete_get_free_busy (res, out_strv, ecalcomps, error);
+}
+
+/**
+ * e_cal_client_get_free_busy_sync:
+ * @client: an #ECalClient
+ * @start: Start time for query
+ * @end: End time for query
+ * @users: List of users to retrieve free/busy information for
+ * @ecalcomps: (out): Return value for VFREEBUSY #ECalComponent objects.
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Gets free/busy information from the calendar server. The objects will
+ * be returned in the @ecalcomps argument, which is a list of #ECalComponent.
+ * This list should be freed with #e_cal_client_free_ecalcomp_slist().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_get_free_busy_sync (ECalClient *client, time_t start, time_t end, const GSList *users, GSList **ecalcomps, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar **strv, **out_strv = NULL;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (users != NULL, FALSE);
+	g_return_val_if_fail (ecalcomps != NULL, FALSE);
+
+	if (!client->priv->gdbus_cal) {
+		g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_DBUS_ERROR, _("D-Bus calendar proxy gone"));
+		return FALSE;
+	}
+
+	strv = e_gdbus_cal_encode_get_free_busy (start, end, users);
+	res = e_client_proxy_call_sync_strv__strv (E_CLIENT (client), (const gchar * const *) strv, &out_strv, cancellable, error, e_gdbus_cal_call_get_free_busy_sync);
+	g_strfreev (strv);
+
+	return complete_get_free_busy (res, out_strv, ecalcomps, error);
+}
+
+/**
+ * e_cal_client_create_object:
+ * @client: an #ECalClient
+ * @icalcomp: The component to create
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Requests the calendar backend to create the object specified by the @icalcomp
+ * argument. Some backends would assign a specific UID to the newly created object,
+ * but this function does not modify the original @icalcomp if its UID changes.
+ * The call is finished by e_cal_client_create_object_finish() from
+ * the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_cal_client_create_object (ECalClient *client, const icalcomponent *icalcomp, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	guint32 opid;
+	gchar *comp_str, *gdbus_comp = NULL;
+
+	g_return_val_if_fail (icalcomp != NULL, 0);
+
+	comp_str = icalcomponent_as_ical_string_r ((icalcomponent *) icalcomp);
+
+	opid = e_client_proxy_call_string (E_CLIENT (client), e_util_ensure_gdbus_string (comp_str, &gdbus_comp), cancellable, callback, user_data, e_cal_client_create_object,
+			e_gdbus_cal_call_create_object,
+			NULL, NULL, e_gdbus_cal_call_create_object_finish, NULL, NULL);
+
+	g_free (comp_str);
+	g_free (gdbus_comp);
+
+	return opid;
+}
+
+/**
+ * e_cal_client_create_object_finish:
+ * @client: an #ECalClient
+ * @result: a #GAsyncResult
+ * @uid: (out): Return value for the UID assigned to the new component by the calendar backend
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_cal_client_create_object() and
+ * sets @uid to newly assigned UID for the created object.
+ * This @uid should be freed with g_free().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_create_object_finish (ECalClient *client, GAsyncResult *result, gchar **uid, GError **error)
+{
+	gboolean res;
+	gchar *out_string = NULL;
+
+	g_return_val_if_fail (uid != NULL, FALSE);
+
+	res = e_client_proxy_call_finish_string (E_CLIENT (client), result, &out_string, error, e_cal_client_create_object);
+
+	return complete_string_exchange (res, out_string, uid, error);
+}
+
+/**
+ * e_cal_client_create_object_sync:
+ * @client: an #ECalClient
+ * @icalcomp: The component to create
+ * @uid: (out): Return value for the UID assigned to the new component by the calendar backend
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Requests the calendar backend to create the object specified by the @icalcomp
+ * argument. Some backends would assign a specific UID to the newly created object,
+ * in those cases that UID would be returned in the @uid argument. This function
+ * does not modify the original @icalcomp if its UID changes.
+ * Returned @uid should be freed with g_free().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_create_object_sync (ECalClient *client, const icalcomponent *icalcomp, gchar **uid, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar *comp_str, *gdbus_comp = NULL;
+	gchar *out_string = NULL;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (icalcomp != NULL, FALSE);
+	g_return_val_if_fail (uid != NULL, FALSE);
+
+	if (!client->priv->gdbus_cal) {
+		g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_DBUS_ERROR, _("D-Bus calendar proxy gone"));
+		return FALSE;
+	}
+
+	comp_str = icalcomponent_as_ical_string_r ((icalcomponent *) icalcomp);
+
+	res = e_client_proxy_call_sync_string__string (E_CLIENT (client), e_util_ensure_gdbus_string (comp_str, &gdbus_comp), &out_string, cancellable, error, e_gdbus_cal_call_create_object_sync);
+
+	g_free (comp_str);
+	g_free (gdbus_comp);
+
+	return complete_string_exchange (res, out_string, uid, error);
+}
+
+/**
+ * e_cal_client_modify_object:
+ * @client: an #ECalClient
+ * @icalcomp: Component to modify
+ * @mod: Type of modification
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Requests the calendar backend to modify an existing object. If the object
+ * does not exist on the calendar, an error will be returned.
+ *
+ * For recurrent appointments, the @mod argument specifies what to modify,
+ * if all instances (CALOBJ_MOD_ALL), a single instance (CALOBJ_MOD_THIS),
+ * or a specific set of instances (CALOBJ_MOD_THISNADPRIOR and
+ * CALOBJ_MOD_THISANDFUTURE).
+ *
+ * The call is finished by e_cal_client_modify_object_finish() from
+ * the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_cal_client_modify_object (ECalClient *client, const icalcomponent *icalcomp, CalObjModType mod, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	guint32 opid;
+	gchar *comp_str, **strv;
+
+	g_return_val_if_fail (icalcomp != NULL, 0);
+
+	comp_str = icalcomponent_as_ical_string_r ((icalcomponent *) icalcomp);
+	strv = e_gdbus_cal_encode_modify_object (comp_str, mod);
+
+	opid = e_client_proxy_call_strv (E_CLIENT (client), (const gchar * const *) strv, cancellable, callback, user_data, e_cal_client_modify_object,
+			e_gdbus_cal_call_modify_object,
+			e_gdbus_cal_call_modify_object_finish, NULL, NULL, NULL, NULL);
+
+	g_strfreev (strv);
+	g_free (comp_str);
+
+	return opid;
+}
+
+/**
+ * e_cal_client_modify_object_finish:
+ * @client: an #ECalClient
+ * @result: a #GAsyncResult
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_cal_client_modify_object().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_modify_object_finish (ECalClient *client, GAsyncResult *result, GError **error)
+{
+	return e_client_proxy_call_finish_void (E_CLIENT (client), result, error, e_cal_client_modify_object);
+}
+
+/**
+ * e_cal_client_modify_object_sync:
+ * @client: an #ECalClient
+ * @icalcomp: Component to modify
+ * @mod: Type of modification
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Requests the calendar backend to modify an existing object. If the object
+ * does not exist on the calendar, an error will be returned.
+ *
+ * For recurrent appointments, the @mod argument specifies what to modify,
+ * if all instances (CALOBJ_MOD_ALL), a single instance (CALOBJ_MOD_THIS),
+ * or a specific set of instances (CALOBJ_MOD_THISNADPRIOR and
+ * CALOBJ_MOD_THISANDFUTURE).
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_modify_object_sync (ECalClient *client, const icalcomponent *icalcomp, CalObjModType mod, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar *comp_str, **strv;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (icalcomp != NULL, FALSE);
+
+	if (!client->priv->gdbus_cal) {
+		g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_DBUS_ERROR, _("D-Bus calendar proxy gone"));
+		return FALSE;
+	}
+
+	comp_str = icalcomponent_as_ical_string_r ((icalcomponent *) icalcomp);
+	strv = e_gdbus_cal_encode_modify_object (comp_str, mod);
+
+	res = e_client_proxy_call_sync_strv__void (E_CLIENT (client), (const gchar * const *) strv, cancellable, error, e_gdbus_cal_call_modify_object_sync);
+
+	g_strfreev (strv);
+	g_free (comp_str);
+
+	return res;
+}
+
+/**
+ * e_cal_client_remove_object:
+ * @client: an #ECalClient
+ * @uid: UID of the object to remove
+ * @rid: Recurrence ID of the specific recurrence to remove
+ * @mod: Type of the removal
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * This function allows the removal of instances of a recurrent
+ * appointment. By using a combination of the @uid, @rid and @mod
+ * arguments, you can remove specific instances. If what you want
+ * is to remove all instances, use #NULL @rid and CALOBJ_MODE_THIS
+ * for the @mod.
+ *
+ * The call is finished by e_cal_client_remove_object_finish() from
+ * the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_cal_client_remove_object (ECalClient *client, const gchar *uid, const gchar *rid, CalObjModType mod, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	guint32 opid;
+	gchar **strv;
+
+	g_return_val_if_fail (uid != NULL, 0);
+
+	strv = e_gdbus_cal_encode_remove_object (uid, rid, mod);
+
+	opid = e_client_proxy_call_strv (E_CLIENT (client), (const gchar * const *) strv, cancellable, callback, user_data, e_cal_client_remove_object,
+			e_gdbus_cal_call_remove_object,
+			e_gdbus_cal_call_remove_object_finish, NULL, NULL, NULL, NULL);
+
+	g_strfreev (strv);
+
+	return opid;
+}
+
+/**
+ * e_cal_client_remove_object_finish:
+ * @client: an #ECalClient
+ * @result: a #GAsyncResult
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_cal_client_remove_object().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_remove_object_finish (ECalClient *client, GAsyncResult *result, GError **error)
+{
+	return e_client_proxy_call_finish_void (E_CLIENT (client), result, error, e_cal_client_remove_object);
+}
+
+/**
+ * e_cal_client_remove_object_sync:
+ * @client: an #ECalClient
+ * @uid: UID of the object to remove
+ * @rid: Recurrence ID of the specific recurrence to remove
+ * @mod: Type of the removal
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * This function allows the removal of instances of a recurrent
+ * appointment. By using a combination of the @uid, @rid and @mod
+ * arguments, you can remove specific instances. If what you want
+ * is to remove all instances, use #NULL @rid and CALOBJ_MODE_THIS
+ * for the @mod.
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_remove_object_sync (ECalClient *client, const gchar *uid, const gchar *rid, CalObjModType mod, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar **strv;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (uid != NULL, FALSE);
+
+	if (!client->priv->gdbus_cal) {
+		g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_DBUS_ERROR, _("D-Bus calendar proxy gone"));
+		return FALSE;
+	}
+
+	strv = e_gdbus_cal_encode_remove_object (uid, rid, mod);
+
+	res = e_client_proxy_call_sync_strv__void (E_CLIENT (client), (const gchar * const *) strv, cancellable, error, e_gdbus_cal_call_remove_object_sync);
+
+	g_strfreev (strv);
+
+	return res;
+}
+
+/**
+ * e_cal_client_receive_objects:
+ * @client: an #ECalClient
+ * @icalcomp: An #icalcomponent
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Makes the backend receive the set of iCalendar objects specified in the
+ * @icalcomp argument. This is used for iTIP confirmation/cancellation
+ * messages for scheduled meetings.
+ *
+ * The call is finished by e_cal_client_receive_objects_finish() from
+ * the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_cal_client_receive_objects (ECalClient *client, const icalcomponent *icalcomp, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	guint32 opid;
+	gchar *comp_str, *gdbus_comp = NULL;
+
+	g_return_val_if_fail (icalcomp != NULL, 0);
+
+	comp_str = icalcomponent_as_ical_string_r ((icalcomponent *) icalcomp);
+
+	opid = e_client_proxy_call_string (E_CLIENT (client), e_util_ensure_gdbus_string (comp_str, &gdbus_comp), cancellable, callback, user_data, e_cal_client_receive_objects,
+			e_gdbus_cal_call_receive_objects,
+			e_gdbus_cal_call_receive_objects_finish, NULL, NULL, NULL, NULL);
+
+	g_free (comp_str);
+	g_free (gdbus_comp);
+
+	return opid;
+}
+
+/**
+ * e_cal_client_receive_objects_finish:
+ * @client: an #ECalClient
+ * @result: a #GAsyncResult
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_cal_client_receive_objects().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_receive_objects_finish (ECalClient *client, GAsyncResult *result, GError **error)
+{
+	return e_client_proxy_call_finish_void (E_CLIENT (client), result, error, e_cal_client_receive_objects);
+}
+
+/**
+ * e_cal_client_receive_objects_sync:
+ * @client: an #ECalClient
+ * @icalcomp: An #icalcomponent
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Makes the backend receive the set of iCalendar objects specified in the
+ * @icalcomp argument. This is used for iTIP confirmation/cancellation
+ * messages for scheduled meetings.
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_receive_objects_sync (ECalClient *client, const icalcomponent *icalcomp, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar *comp_str, *gdbus_comp = NULL;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+
+	if (!client->priv->gdbus_cal) {
+		g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_DBUS_ERROR, _("D-Bus calendar proxy gone"));
+		return FALSE;
+	}
+
+	comp_str = icalcomponent_as_ical_string_r ((icalcomponent *) icalcomp);
+
+	res = e_client_proxy_call_sync_string__void (E_CLIENT (client), e_util_ensure_gdbus_string (comp_str, &gdbus_comp), cancellable, error, e_gdbus_cal_call_receive_objects_sync);
+
+	g_free (comp_str);
+	g_free (gdbus_comp);
+
+	return res;
+}
+
+/**
+ * e_cal_client_send_objects:
+ * @client: an #ECalClient
+ * @icalcomp: An icalcomponent to be sent
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Requests a calendar backend to send meeting information stored in @icalcomp.
+ * The backend can modify this component and request a send to particular users.
+ * The call is finished by e_cal_client_send_objects_finish() from
+ * the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_cal_client_send_objects (ECalClient *client, const icalcomponent *icalcomp, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	guint32 opid;
+	gchar *comp_str, *gdbus_comp = NULL;
+
+	g_return_val_if_fail (icalcomp != NULL, 0);
+
+	comp_str = icalcomponent_as_ical_string_r ((icalcomponent *) icalcomp);
+
+	opid = e_client_proxy_call_string (E_CLIENT (client), e_util_ensure_gdbus_string (comp_str, &gdbus_comp), cancellable, callback, user_data, e_cal_client_send_objects,
+			e_gdbus_cal_call_send_objects,
+			NULL, NULL, NULL, e_gdbus_cal_call_send_objects_finish, NULL);
+
+	g_free (comp_str);
+	g_free (gdbus_comp);
+
+	return opid;
+}
+
+static gboolean
+complete_send_objects (gboolean res, gchar **out_strv, GSList **users, icalcomponent **modified_icalcomp, GError **error)
+{
+	g_return_val_if_fail (users != NULL, FALSE);
+	g_return_val_if_fail (modified_icalcomp != NULL, FALSE);
+
+	*users = NULL;
+	*modified_icalcomp = NULL;
+
+	if (res && out_strv) {
+		gchar *calobj = NULL;
+
+		if (e_gdbus_cal_decode_send_objects ((const gchar * const *) out_strv, &calobj, users)) {
+			*modified_icalcomp = icalparser_parse_string (calobj);
+			if (!*modified_icalcomp) {
+				g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_INVALID_OBJECT, e_cal_client_error_to_string (E_CAL_CLIENT_ERROR_INVALID_OBJECT));
+				e_client_util_free_string_slist (*users);
+				*users = NULL;
+				res = FALSE;
+			}
+		} else {
+			g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_INVALID_ARG, e_cal_client_error_to_string (E_CAL_CLIENT_ERROR_INVALID_ARG));
+			e_client_util_free_string_slist (*users);
+			*users = NULL;
+			res = FALSE;
+		}
+
+		g_free (calobj);
+	} else {
+		res = FALSE;
+	}
+
+	g_strfreev (out_strv);
+
+	return res;
+}
+
+/**
+ * e_cal_client_send_objects_finish:
+ * @client: an #ECalClient
+ * @result: a #GAsyncResult
+ * @users: (out): List of users to send the @modified_icalcomp to
+ * @modified_icalcomp: (out): Return value for the icalcomponent to be sent
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_cal_client_send_objects() and
+ * populates @users with a list of users to send @modified_icalcomp to.
+ * The @users list should be freed with e_client_util_free_string_slist() and
+ * the @modified_icalcomp should be freed with icalcomponent_free().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_send_objects_finish (ECalClient *client, GAsyncResult *result, GSList **users, icalcomponent **modified_icalcomp, GError **error)
+{
+	gboolean res;
+	gchar **out_strv = NULL;
+
+	g_return_val_if_fail (users != NULL, FALSE);
+	g_return_val_if_fail (modified_icalcomp != NULL, FALSE);
+
+	res = e_client_proxy_call_finish_strv (E_CLIENT (client), result, &out_strv, error, e_cal_client_send_objects);
+
+	return complete_send_objects (res, out_strv, users, modified_icalcomp, error);
+}
+
+/**
+ * e_cal_client_send_objects_sync:
+ * @client: an #ECalClient
+ * @icalcomp: An icalcomponent to be sent
+ * @users: (out): List of users to send the @modified_icalcomp to
+ * @modified_icalcomp: (out): Return value for the icalcomponent to be sent
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Requests a calendar backend to send meeting information stored in @icalcomp.
+ * The backend can modify this component and request a send to users in the @users list.
+ * The @users list should be freed with e_client_util_free_string_slist() and
+ * the @modified_icalcomp should be freed with icalcomponent_free().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_send_objects_sync (ECalClient *client, const icalcomponent *icalcomp, GSList **users, icalcomponent **modified_icalcomp, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar **out_strv = NULL, *comp_str, *gdbus_comp = NULL;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (icalcomp != NULL, FALSE);
+	g_return_val_if_fail (users != NULL, FALSE);
+	g_return_val_if_fail (modified_icalcomp != NULL, FALSE);
+
+	if (!client->priv->gdbus_cal) {
+		g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_DBUS_ERROR, _("D-Bus calendar proxy gone"));
+		return FALSE;
+	}
+
+	comp_str = icalcomponent_as_ical_string_r ((icalcomponent *) icalcomp);
+
+	res = e_client_proxy_call_sync_string__strv (E_CLIENT (client), e_util_ensure_gdbus_string (comp_str, &gdbus_comp), &out_strv, cancellable, error, e_gdbus_cal_call_send_objects_sync);
+
+	g_free (comp_str);
+	g_free (gdbus_comp);
+
+	return complete_send_objects (res, out_strv, users, modified_icalcomp, error);
+}
+
+/**
+ * e_cal_client_get_attachment_uris:
+ * @client: an #ECalClient
+ * @uid: Unique identifier for a calendar component
+ * @rid: Recurrence identifier
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Queries a calendar for a specified component's object attachment uris.
+ * The call is finished by e_cal_client_get_attachment_uris_finish() from
+ * the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_cal_client_get_attachment_uris (ECalClient *client, const gchar *uid, const gchar *rid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	guint32 opid;
+	gchar **strv;
+
+	g_return_val_if_fail (uid != NULL, 0);
+
+	strv = e_gdbus_cal_encode_get_attachment_uris (uid, rid);
+
+	opid = e_client_proxy_call_strv (E_CLIENT (client), (const gchar * const *) strv, cancellable, callback, user_data, e_cal_client_get_attachment_uris,
+			e_gdbus_cal_call_get_attachment_uris,
+			NULL, NULL, NULL, e_gdbus_cal_call_get_attachment_uris_finish, NULL);
+
+	g_strfreev (strv);
+
+	return opid;
+}
+
+/**
+ * e_cal_client_get_attachment_uris_finish:
+ * @client: an #ECalClient
+ * @result: a #GAsyncResult
+ * @attachment_uris: (out:) Return the list of attachment uris
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_cal_client_get_attachment_uris() and
+ * sets @attachment_uris to uris for component's attachments.
+ * The list should be freed with e_client_util_free_string_slist().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_get_attachment_uris_finish (ECalClient *client, GAsyncResult *result, GSList **attachment_uris, GError **error)
+{
+	gboolean res;
+	gchar **out_strv = NULL;
+
+	g_return_val_if_fail (attachment_uris != NULL, FALSE);
+
+	res = e_client_proxy_call_finish_strv (E_CLIENT (client), result, &out_strv, error, e_cal_client_get_attachment_uris);
+
+	if (res && out_strv) {
+		*attachment_uris = e_client_util_strv_to_slist ((const gchar * const *) out_strv);
+	} else {
+		*attachment_uris = NULL;
+	}
+
+	g_strfreev (out_strv);
+
+	return res;
+}
+
+/**
+ * e_cal_client_get_attachment_uris_sync:
+ * @client: an #ECalClient
+ * @uid: Unique identifier for a calendar component
+ * @rid: Recurrence identifier
+ * @attachment_uris: (out:) Return the list of attachment uris
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Queries a calendar for a specified component's object attachment uris.
+ * The list should be freed with e_client_util_free_string_slist().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_get_attachment_uris_sync (ECalClient *client, const gchar *uid, const gchar *rid, GSList **attachment_uris, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar **strv, **out_strv = NULL;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (uid != NULL, FALSE);
+	g_return_val_if_fail (attachment_uris != NULL, FALSE);
+
+	if (!client->priv->gdbus_cal) {
+		g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_DBUS_ERROR, _("D-Bus calendar proxy gone"));
+		return FALSE;
+	}
+
+	strv = e_gdbus_cal_encode_get_attachment_uris (uid, rid);
+
+	res = e_client_proxy_call_sync_strv__strv (E_CLIENT (client), (const gchar * const *) strv, &out_strv, cancellable, error, e_gdbus_cal_call_get_attachment_uris_sync);
+
+	g_strfreev (strv);
+
+	if (res && out_strv) {
+		*attachment_uris = e_client_util_strv_to_slist ((const gchar * const *) out_strv);
+	} else {
+		*attachment_uris = NULL;
+	}
+
+	g_strfreev (out_strv);
+
+	return res;
+}
+
+/**
+ * e_cal_client_get_view:
+ * @client: an #ECalClient
+ * @sexp: an S-expression representing the query.
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Query @client with @sexp, creating an #ECalView.
+ * The call is finished by e_cal_client_get_view_finish()
+ * from the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_cal_client_get_view (ECalClient *client, const gchar *sexp, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	guint32 opid;
+	gchar *gdbus_sexp = NULL;
+
+	g_return_val_if_fail (sexp != NULL, 0);
+
+	opid = e_client_proxy_call_string (E_CLIENT (client), e_util_ensure_gdbus_string (sexp, &gdbus_sexp), cancellable, callback, user_data, e_cal_client_get_view,
+			e_gdbus_cal_call_get_view,
+			NULL, NULL, e_gdbus_cal_call_get_view_finish, NULL, NULL);
+
+	g_free (gdbus_sexp);
+
+	return opid;
+}
+
+static gboolean
+complete_get_view (ECalClient *client, gboolean res, gchar *view_path, ECalView **cal_view, GError **error)
+{
+	g_return_val_if_fail (cal_view != NULL, FALSE);
+
+	if (view_path && res && cal_factory_proxy) {
+		EGdbusCalView *gdbus_calview;
+		GError *local_error = NULL;
+
+		gdbus_calview = e_gdbus_cal_view_proxy_new_sync (g_dbus_proxy_get_connection (G_DBUS_PROXY (cal_factory_proxy)),
+								G_DBUS_PROXY_FLAGS_NONE,
+								CALENDAR_DBUS_SERVICE_NAME,
+								view_path,
+								NULL,
+								&local_error);
+
+		if (gdbus_calview) {
+			*cal_view = _e_cal_view_new (client, gdbus_calview);
+		} else {
+			*cal_view = NULL;
+			res = FALSE;
+		}
+
+		if (local_error)
+			unwrap_dbus_error (local_error, error);
+	} else {
+		*cal_view = NULL;
+		res = FALSE;
+	}
+
+	if (!*cal_view && error && !*error)
+		g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_DBUS_ERROR, _("Cannot get connection to view"));
+
+	g_free (view_path);
+
+	return res;
+}
+
+/**
+ * e_cal_client_get_view_finish:
+ * @client: an #ECalClient
+ * @result: a #GAsyncResult
+ * @cal_view: (out) an #ECalView
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_cal_client_get_view().
+ * If successful, then the @cal_view is set to newly allocated #ECalView,
+ * which should be freed with g_object_unref().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_get_view_finish (ECalClient *client, GAsyncResult *result, ECalView **cal_view, GError **error)
+{
+	gboolean res;
+	gchar *view_path = NULL;
+
+	g_return_val_if_fail (cal_view != NULL, FALSE);
+
+	res = e_client_proxy_call_finish_string (E_CLIENT (client), result, &view_path, error, e_cal_client_get_view);
+
+	return complete_get_view (client, res, view_path, cal_view, error);
+}
+
+/**
+ * e_cal_client_get_view_sync:
+ * @client: an #ECalClient
+ * @sexp: an S-expression representing the query.
+ * @cal_view: (out) an #ECalView
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Query @client with @sexp, creating an #ECalView.
+ * If successful, then the @cal_view is set to newly allocated #ECalView,
+ * which should be freed with g_object_unref().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_get_view_sync (ECalClient *client, const gchar *sexp, ECalView **cal_view, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar *gdbus_sexp = NULL;
+	gchar *view_path = NULL;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (sexp != NULL, FALSE);
+	g_return_val_if_fail (cal_view != NULL, FALSE);
+
+	if (!client->priv->gdbus_cal) {
+		g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_DBUS_ERROR, _("D-Bus calendar proxy gone"));
+		return FALSE;
+	}
+
+	res = e_client_proxy_call_sync_string__string (E_CLIENT (client), e_util_ensure_gdbus_string (sexp, &gdbus_sexp), &view_path, cancellable, error, e_gdbus_cal_call_get_view_sync);
+
+	g_free (gdbus_sexp);
+
+	return complete_get_view (client, res, view_path, cal_view, error);
+}
+
+static icaltimezone *
+cal_client_get_timezone_from_cache (ECalClient *client, const gchar *tzid)
+{
+	icaltimezone *zone = NULL;
+
+	g_return_val_if_fail (client != NULL, NULL);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), NULL);
+	g_return_val_if_fail (client->priv != NULL, NULL);
+	g_return_val_if_fail (tzid != NULL, NULL);
+	g_return_val_if_fail (client->priv->zone_cache != NULL, NULL);
+	g_return_val_if_fail (client->priv->zone_cache_lock != NULL, NULL);
+
+	if (!*tzid)
+		return NULL;
+
+	g_mutex_lock (client->priv->zone_cache_lock);
+	if (g_str_equal (tzid, "UTC")) {
+		zone = icaltimezone_get_utc_timezone ();
+	} else {
+		/* See if we already have it in the cache. */
+		zone = g_hash_table_lookup (client->priv->zone_cache, tzid);
+	}
+
+	if (!zone) {
+		/*
+		 * Try to replace the original time zone with a more complete
+		 * and/or potentially updated system time zone. Note that this
+		 * also applies to TZIDs which match system time zones exactly:
+		 * they are extracted via icaltimezone_get_builtin_timezone_from_tzid()
+		 * below without a roundtrip to the backend.
+		 */
+		const gchar *systzid = e_cal_match_tzid (tzid);
+		if (systzid) {
+			/*
+			 * Use built-in time zone *and* rename it:
+			 * if the caller is asking for a TZID=FOO,
+			 * then likely because it has an event with
+			 * such a TZID. Returning a different TZID
+			 * would lead to broken VCALENDARs in the
+			 * caller.
+			 */
+			icaltimezone *syszone = icaltimezone_get_builtin_timezone_from_tzid (systzid);
+			if (syszone) {
+				gboolean found = FALSE;
+				icalcomponent *icalcomp = NULL;
+				icalproperty *prop;
+
+				icalcomp = icalcomponent_new_clone (icaltimezone_get_component (syszone));
+				prop = icalcomponent_get_first_property (icalcomp, ICAL_ANY_PROPERTY);
+				while (!found && prop) {
+					if (icalproperty_isa (prop) == ICAL_TZID_PROPERTY) {
+						icalproperty_set_value_from_string (prop, tzid, "NO");
+						found = TRUE;
+					}
+
+					prop = icalcomponent_get_next_property (icalcomp, ICAL_ANY_PROPERTY);
+				}
+
+				if (icalcomp) {
+					zone = icaltimezone_new ();
+					if (!icaltimezone_set_component (zone, icalcomp)) {
+						icalcomponent_free (icalcomp);
+						icaltimezone_free (zone, 1);
+						zone = NULL;
+					} else {
+						g_hash_table_insert (client->priv->zone_cache, g_strdup (icaltimezone_get_tzid (zone)), zone);
+					}
+				}
+			}
+		}
+	}
+
+	g_mutex_unlock (client->priv->zone_cache_lock);
+
+	return zone;
+}
+
+static gboolean
+cal_client_get_timezone_from_cache_finish (ECalClient *client, GAsyncResult *result, icaltimezone **zone, GError **error)
+{
+	GSimpleAsyncResult *simple;
+	GError *local_error = NULL;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+	g_return_val_if_fail (result != NULL, FALSE);
+	g_return_val_if_fail (zone != NULL, FALSE);
+	g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (client), cal_client_get_timezone_from_cache), FALSE);
+
+	simple = G_SIMPLE_ASYNC_RESULT (result);
+
+	if (g_simple_async_result_propagate_error (simple, &local_error)) {
+		e_client_unwrap_dbus_error (E_CLIENT (client), local_error, error);
+		return FALSE;
+	}
+
+	*zone = g_simple_async_result_get_op_res_gpointer (simple);
+
+	return *zone != NULL;
+}
+
+/**
+ * e_cal_client_get_timezone:
+ * @client: an #ECalClient
+ * @tzid: ID of the timezone to retrieve
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Retrieves a timezone object from the calendar backend.
+ * The call is finished by e_cal_client_get_timezone_finish() from
+ * the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_cal_client_get_timezone (ECalClient *client, const gchar *tzid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	guint32 opid;
+	gchar *gdbus_tzid = NULL;
+	icaltimezone *zone;
+
+	g_return_val_if_fail (tzid != NULL, 0);
+
+	zone = cal_client_get_timezone_from_cache (client, tzid);
+	if (zone) {
+		GCancellable *use_cancellable = cancellable;
+
+		if (!use_cancellable)
+			use_cancellable = g_cancellable_new ();
+
+		opid = e_client_register_op (E_CLIENT (client), use_cancellable);
+		if (opid) {
+			GSimpleAsyncResult *simple;
+
+			simple = g_simple_async_result_new (G_OBJECT (client), callback, user_data, cal_client_get_timezone_from_cache);
+			g_simple_async_result_set_op_res_gpointer (simple, zone, NULL);
+			g_simple_async_result_complete_in_idle (simple);
+			g_object_unref (simple);
+		}
+
+		if (use_cancellable != cancellable)
+			g_object_unref (use_cancellable);
+	} else {
+		opid = e_client_proxy_call_string (E_CLIENT (client), e_util_ensure_gdbus_string (tzid, &gdbus_tzid), cancellable, callback, user_data, e_cal_client_get_timezone,
+				e_gdbus_cal_call_get_timezone,
+				NULL, NULL, e_gdbus_cal_call_get_timezone_finish, NULL, NULL);
+
+		g_free (gdbus_tzid);
+	}
+
+	return opid;
+}
+
+static gboolean
+complete_get_timezone (ECalClient *client, gboolean res, gchar *out_string, icaltimezone **zone, GError **error)
+{
+	g_return_val_if_fail (zone != NULL, FALSE);
+
+	*zone = NULL;
+
+	if (res && out_string) {
+		icalcomponent *icalcomp;
+
+		icalcomp = icalparser_parse_string (out_string);
+		if (icalcomp) {
+			*zone = icaltimezone_new ();
+			if (!icaltimezone_set_component (*zone, icalcomp)) {
+				icaltimezone_free (*zone, 1);
+				icalcomponent_free (icalcomp);
+				res = FALSE;
+				g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_INVALID_OBJECT, e_cal_client_error_to_string (E_CAL_CLIENT_ERROR_INVALID_OBJECT));
+			} else {
+				g_mutex_lock (client->priv->zone_cache_lock);
+				g_hash_table_insert (client->priv->zone_cache, g_strdup (icaltimezone_get_tzid (*zone)), *zone);
+				g_mutex_unlock (client->priv->zone_cache_lock);
+			}
+		} else {
+			res = FALSE;
+			g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_INVALID_OBJECT, e_cal_client_error_to_string (E_CAL_CLIENT_ERROR_INVALID_OBJECT));
+		}
+	} else {
+		res = FALSE;
+	}
+
+	g_free (out_string);
+
+	return res;
+}
+
+/**
+ * e_cal_client_get_timezone_finish:
+ * @client: an #ECalClient
+ * @result: a #GAsyncResult
+ * @zone: (out): Return value for the timezone
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_cal_client_get_timezone() and
+ * sets @zone to a retrieved timezone object from the calendar backend.
+ * This object is owned by the @client, thus do not free it.
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_get_timezone_finish (ECalClient *client, GAsyncResult *result, icaltimezone **zone, GError **error)
+{
+	gboolean res;
+	gchar *out_string = NULL;
+
+	g_return_val_if_fail (zone != NULL, FALSE);
+
+	if (g_simple_async_result_get_source_tag (G_SIMPLE_ASYNC_RESULT (result)) == cal_client_get_timezone_from_cache) {
+		res = cal_client_get_timezone_from_cache_finish (client, result, zone, error);
+	} else {
+		res = e_client_proxy_call_finish_string (E_CLIENT (client), result, &out_string, error, e_cal_client_get_timezone);
+		res = complete_get_timezone (client, res, out_string, zone, error);
+	}
+
+	return res;
+}
+
+/**
+ * e_cal_client_get_timezone_sync:
+ * @client: an #ECalClient
+ * @tzid: ID of the timezone to retrieve
+ * @zone: (out): Return value for the timezone
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Retrieves a timezone object from the calendar backend.
+ * This object is owned by the @client, thus do not free it.
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_get_timezone_sync (ECalClient *client, const gchar *tzid, icaltimezone **zone, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar *gdbus_tzid = NULL, *out_string = NULL;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (tzid != NULL, FALSE);
+	g_return_val_if_fail (zone != NULL, FALSE);
+
+	if (!client->priv->gdbus_cal) {
+		g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_DBUS_ERROR, _("D-Bus calendar proxy gone"));
+		return FALSE;
+	}
+
+	*zone = cal_client_get_timezone_from_cache (client, tzid);
+	if (*zone)
+		return TRUE;
+
+	res = e_client_proxy_call_sync_string__string (E_CLIENT (client), e_util_ensure_gdbus_string (tzid, &gdbus_tzid), &out_string, cancellable, error, e_gdbus_cal_call_get_timezone_sync);
+
+	g_free (gdbus_tzid);
+
+	return complete_get_timezone (client, res, out_string, zone, error);
+}
+
+/**
+ * e_cal_client_add_timezone:
+ * @client: an #ECalClient
+ * @zone: The timezone to add
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Add a VTIMEZONE object to the given calendar client.
+ * The call is finished by e_cal_client_add_timezone_finish() from
+ * the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_cal_client_add_timezone (ECalClient *client, const icaltimezone *zone, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	guint32 opid;
+	icalcomponent *icalcomp;
+	gchar *zone_str, *gdbus_zone = NULL;
+
+	g_return_val_if_fail (zone != NULL, 0);
+
+	if (zone == icaltimezone_get_utc_timezone ())
+		return 0;
+
+	icalcomp = icaltimezone_get_component ((icaltimezone *) zone);
+	g_return_val_if_fail (icalcomp != NULL, 0);
+
+	zone_str = icalcomponent_as_ical_string_r (icalcomp);
+
+	opid = e_client_proxy_call_string (E_CLIENT (client), e_util_ensure_gdbus_string (zone_str, &gdbus_zone), cancellable, callback, user_data, e_cal_client_add_timezone,
+			e_gdbus_cal_call_add_timezone,
+			e_gdbus_cal_call_add_timezone_finish, NULL, NULL, NULL, NULL);
+
+	g_free (zone_str);
+	g_free (gdbus_zone);
+
+	return opid;
+}
+
+/**
+ * e_cal_client_add_timezone_finish:
+ * @client: an #ECalClient
+ * @result: a #GAsyncResult
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_cal_client_add_timezone().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_add_timezone_finish (ECalClient *client, GAsyncResult *result, GError **error)
+{
+	return e_client_proxy_call_finish_void (E_CLIENT (client), result, error, e_cal_client_add_timezone);
+}
+
+/**
+ * e_cal_client_add_timezone_sync:
+ * @client: an #ECalClient
+ * @zone: The timezone to add
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Add a VTIMEZONE object to the given calendar client.
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_add_timezone_sync (ECalClient *client, const icaltimezone *zone, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	icalcomponent *icalcomp;
+	gchar *zone_str, *gdbus_zone = NULL;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (zone != NULL, FALSE);
+
+	if (zone == icaltimezone_get_utc_timezone ())
+		return TRUE;
+
+	icalcomp = icaltimezone_get_component ((icaltimezone *) zone);
+	if (!icalcomp) {
+		g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_INVALID_ARG, e_cal_client_error_to_string (E_CAL_CLIENT_ERROR_INVALID_ARG));
+		return FALSE;
+	}
+
+	if (!client->priv->gdbus_cal) {
+		g_set_error_literal (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_DBUS_ERROR, _("D-Bus calendar proxy gone"));
+		return FALSE;
+	}
+
+	zone_str = icalcomponent_as_ical_string_r (icalcomp);
+
+	res = e_client_proxy_call_sync_string__void (E_CLIENT (client), e_util_ensure_gdbus_string (zone_str, &gdbus_zone), cancellable, error, e_gdbus_cal_call_add_timezone_sync);
+
+	g_free (zone_str);
+	g_free (gdbus_zone);
+
+	return res;
+}
+
+static GDBusProxy *
+cal_client_get_dbus_proxy (EClient *client)
+{
+	ECalClient *cal_client;
+
+	g_return_val_if_fail (client != NULL, NULL);
+
+	cal_client = E_CAL_CLIENT (client);
+	g_return_val_if_fail (cal_client != NULL, NULL);
+	g_return_val_if_fail (cal_client->priv != NULL, NULL);
+
+	return cal_client->priv->gdbus_cal;
+}
+
+static void
+cal_client_unwrap_dbus_error (EClient *client, GError *dbus_error, GError **out_error)
+{
+	unwrap_dbus_error (dbus_error, out_error);
+}
+
+static void
+cal_client_handle_authentication (EClient *client, const ECredentials *credentials)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+	gchar **strv;
+
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (credentials != NULL);
+
+	cal_client = E_CAL_CLIENT (client);
+	g_return_if_fail (cal_client != NULL);
+	g_return_if_fail (cal_client->priv != NULL);
+
+	if (!cal_client->priv->gdbus_cal)
+		return;
+
+	strv = e_credentials_to_strv (credentials);
+	g_return_if_fail (strv != NULL);
+
+	e_gdbus_cal_call_authenticate_user_sync (cal_client->priv->gdbus_cal, (const gchar * const *) strv, NULL, &error);
+
+	g_strfreev (strv);
+
+	if (error) {
+		g_debug ("%s: Failed to authenticate user: %s", G_STRFUNC, error->message);
+		g_error_free (error);
+	}
+}
+
+static gchar *
+cal_client_retrieve_capabilities (EClient *client)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+	gchar *capabilities = NULL;
+
+	g_return_val_if_fail (client != NULL, NULL);
+
+	cal_client = E_CAL_CLIENT (client);
+	g_return_val_if_fail (cal_client != NULL, NULL);
+	g_return_val_if_fail (cal_client->priv != NULL, NULL);
+
+	if (!cal_client->priv->gdbus_cal)
+		return NULL;
+
+	e_gdbus_cal_call_get_capabilities_sync (cal_client->priv->gdbus_cal, &capabilities, NULL, &error);
+
+	if (error) {
+		g_debug ("%s: Failed to retrieve capabilitites: %s", G_STRFUNC, error->message);
+		g_error_free (error);
+	}
+
+	return capabilities;
+}
+
+static void
+free_zone_cb (gpointer zone)
+{
+	icaltimezone_free (zone, 1);
+}
+
+static void
+e_cal_client_init (ECalClient *client)
+{
+	LOCK_FACTORY ();
+	active_cal_clients++;
+	UNLOCK_FACTORY ();
+
+	client->priv = G_TYPE_INSTANCE_GET_PRIVATE (client, E_TYPE_CAL_CLIENT, ECalClientPrivate);
+	client->priv->source_type = E_CAL_CLIENT_SOURCE_TYPE_LAST;
+	client->priv->default_zone = icaltimezone_copy (icaltimezone_get_utc_timezone ());
+	client->priv->cache_dir = NULL;
+	client->priv->zone_cache_lock = g_mutex_new ();
+	client->priv->zone_cache = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, free_zone_cb);
+}
+
+static void
+cal_client_dispose (GObject *object)
+{
+	EClient *client;
+
+	client = E_CLIENT (object);
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (client->priv != NULL);
+
+	e_client_cancel_all (client);
+
+	gdbus_cal_client_disconnect (E_CAL_CLIENT (client));
+
+	/* Chain up to parent's dispose() method. */
+	G_OBJECT_CLASS (e_cal_client_parent_class)->dispose (object);
+}
+
+static void
+cal_client_finalize (GObject *object)
+{
+	ECalClient *client;
+	ECalClientPrivate *priv;
+
+	client = E_CAL_CLIENT (object);
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (client->priv != NULL);
+
+	priv = client->priv;
+
+	g_free (priv->cache_dir);
+	priv->cache_dir = NULL;
+
+	if (priv->default_zone)
+		icaltimezone_free (priv->default_zone, 1);
+	priv->default_zone = NULL;
+
+	g_mutex_lock (priv->zone_cache_lock);
+	g_hash_table_destroy (priv->zone_cache);
+	priv->zone_cache = NULL;
+	g_mutex_unlock (priv->zone_cache_lock);
+	g_mutex_free (priv->zone_cache_lock);
+	priv->zone_cache_lock = NULL;
+
+	/* Chain up to parent's finalize() method. */
+	G_OBJECT_CLASS (e_cal_client_parent_class)->finalize (object);
+
+	LOCK_FACTORY ();
+	active_cal_clients--;
+	if (!active_cal_clients)
+		gdbus_cal_factory_proxy_disconnect (NULL);
+	UNLOCK_FACTORY ();
+}
+
+static void
+e_cal_client_class_init (ECalClientClass *klass)
+{
+	GObjectClass *object_class;
+	EClientClass *client_class;
+
+	g_type_class_add_private (klass, sizeof (ECalClientPrivate));
+
+	object_class = G_OBJECT_CLASS (klass);
+	object_class->dispose = cal_client_dispose;
+	object_class->finalize = cal_client_finalize;
+
+	client_class = E_CLIENT_CLASS (klass);
+	client_class->get_dbus_proxy = cal_client_get_dbus_proxy;
+	client_class->unwrap_dbus_error = cal_client_unwrap_dbus_error;
+	client_class->handle_authentication = cal_client_handle_authentication;
+	client_class->retrieve_capabilities = cal_client_retrieve_capabilities;
+	client_class->open = cal_client_open;
+	client_class->open_finish = cal_client_open_finish;
+	client_class->open_sync = cal_client_open_sync;
+	client_class->remove = cal_client_remove;
+	client_class->remove_finish = cal_client_remove_finish;
+	client_class->remove_sync = cal_client_remove_sync;
+}
diff --git a/calendar/libecal/e-cal-client.h b/calendar/libecal/e-cal-client.h
new file mode 100644
index 0000000..479d977
--- /dev/null
+++ b/calendar/libecal/e-cal-client.h
@@ -0,0 +1,211 @@
+/*
+ * e-cal-client.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#ifndef E_CAL_CLIENT_H
+#define E_CAL_CLIENT_H
+
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <libedataserver/e-client.h>
+#include <libecal/e-cal-recur.h>
+#include <libecal/e-cal-util.h>
+#include <libecal/e-cal-view.h>
+
+#define E_TYPE_CAL_CLIENT		(e_cal_client_get_type ())
+#define E_CAL_CLIENT(o)			(G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_CAL_CLIENT, ECalClient))
+#define E_CAL_CLIENT_CLASS(k)		(G_TYPE_CHECK_CLASS_CAST ((k), E_TYPE_CAL_CLIENT, ECalClientClass))
+#define E_IS_CAL_CLIENT(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_CAL_CLIENT))
+#define E_IS_CAL_CLIENT_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_CAL_CLIENT))
+#define E_CAL_CLIENT_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_CAL_CLIENT, ECalClientClass))
+
+G_BEGIN_DECLS
+
+typedef enum {
+	E_CAL_CLIENT_SOURCE_TYPE_EVENT,
+	E_CAL_CLIENT_SOURCE_TYPE_TODO,
+	E_CAL_CLIENT_SOURCE_TYPE_JOURNAL,
+	E_CAL_CLIENT_SOURCE_TYPE_LAST
+} ECalClientSourceType;
+
+GType e_cal_client_source_type_enum_get_type (void);
+
+#define E_CAL_CLIENT_ERROR e_cal_client_error_quark ()
+
+GQuark e_cal_client_error_quark (void) G_GNUC_CONST;
+
+typedef enum {
+	E_CAL_CLIENT_ERROR_SUCCESS,
+	E_CAL_CLIENT_ERROR_INVALID_ARG,
+	E_CAL_CLIENT_ERROR_BUSY,
+	E_CAL_CLIENT_ERROR_REPOSITORY_OFFLINE,
+	E_CAL_CLIENT_ERROR_NO_SUCH_CALENDAR,
+	E_CAL_CLIENT_ERROR_OBJECT_NOT_FOUND,
+	E_CAL_CLIENT_ERROR_INVALID_OBJECT,
+	E_CAL_CLIENT_ERROR_SOURCE_NOT_LOADED,
+	E_CAL_CLIENT_ERROR_SOURCE_ALREADY_LOADED,
+	E_CAL_CLIENT_ERROR_PERMISSION_DENIED,
+	E_CAL_CLIENT_ERROR_UNKNOWN_USER,
+	E_CAL_CLIENT_ERROR_OBJECT_ID_ALREADY_EXISTS,
+	E_CAL_CLIENT_ERROR_PROTOCOL_NOT_SUPPORTED,
+	E_CAL_CLIENT_ERROR_CANCELLED,
+	E_CAL_CLIENT_ERROR_COULD_NOT_CANCEL,
+	E_CAL_CLIENT_ERROR_AUTHENTICATION_FAILED,
+	E_CAL_CLIENT_ERROR_AUTHENTICATION_REQUIRED,
+	E_CAL_CLIENT_ERROR_INVALID_SERVER_VERSION,
+	E_CAL_CLIENT_ERROR_DBUS_ERROR,
+	E_CAL_CLIENT_ERROR_OTHER_ERROR,
+	E_CAL_CLIENT_ERROR_NOT_SUPPORTED
+} ECalClientError;
+
+const gchar *e_cal_client_error_to_string (ECalClientError code);
+
+typedef struct _ECalClient        ECalClient;
+typedef struct _ECalClientClass   ECalClientClass;
+typedef struct _ECalClientPrivate ECalClientPrivate;
+
+struct _ECalClient {
+	EClient parent;
+
+	/*< private >*/
+	ECalClientPrivate *priv;
+};
+
+struct _ECalClientClass {
+	EClientClass parent;
+};
+
+GType			e_cal_client_get_type			(void);
+
+/* Creating a new calendar */
+ECalClient *		e_cal_client_new			(ESource *source, ECalClientSourceType source_type, GError **error);
+ECalClient *		e_cal_client_new_from_uri		(const gchar *uri, ECalClientSourceType source_type, GError **error);
+ECalClient *		e_cal_client_new_system			(ECalClientSourceType source_type, GError **error);
+ECalClient *		e_cal_client_new_default		(ECalClientSourceType source_type, GError **error);
+
+/* Calendar discovery */
+gboolean		e_cal_client_set_default		(ECalClient *client, GError **error);
+gboolean		e_cal_client_set_default_source		(ESource *source, ECalClientSourceType source_type, GError **error);
+gboolean		e_cal_client_get_sources		(ESourceList **sources, ECalClientSourceType source_type, GError **error);
+
+/* Calendar properties not managed by EClient */
+ECalClientSourceType	e_cal_client_get_source_type		(ECalClient *client);
+const gchar *		e_cal_client_get_local_attachment_store	(ECalClient *client);
+void			e_cal_client_set_default_timezone	(ECalClient *client, const icaltimezone *zone);
+const icaltimezone *	e_cal_client_get_default_timezone	(ECalClient *client);
+
+/* Check predefined capabilities */
+gboolean		e_cal_client_check_one_alarm_only	(ECalClient *client);
+gboolean		e_cal_client_check_save_schedules	(ECalClient *client);
+gboolean		e_cal_client_check_refresh_supported	(ECalClient *client);
+gboolean		e_cal_client_check_organizer_must_attend(ECalClient *client);
+gboolean		e_cal_client_check_organizer_must_accept(ECalClient *client);
+gboolean		e_cal_client_check_recurrences_no_master(ECalClient *client);
+
+/* Utility functions */
+void		e_cal_client_free_icalcomp_slist		(GSList *icalcomps);
+void		e_cal_client_free_ecalcomp_slist		(GSList *ecalcomps);
+
+icaltimezone *	e_cal_client_resolve_tzid_cb			(const gchar *tzid, gpointer data);
+void		e_cal_client_generate_instances			(ECalClient *client, time_t start, time_t end, ECalRecurInstanceFn cb, gpointer cb_data);
+void		e_cal_client_generate_instances_for_object	(ECalClient *client, icalcomponent *icalcomp, time_t start, time_t end, ECalRecurInstanceFn cb, gpointer cb_data);
+gchar *		e_cal_client_get_component_as_string		(ECalClient *client, icalcomponent *icalcomp);
+
+/* Calendar methods */
+guint32		e_cal_client_get_capabilities			(ECalClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_cal_client_get_capabilities_finish		(ECalClient *client, GAsyncResult *result, GSList **capabilities, GError **error);
+gboolean	e_cal_client_get_capabilities_sync		(ECalClient *client, GSList **capabilities, GCancellable *cancellable, GError **error);
+
+guint32		e_cal_client_get_cal_email_address		(ECalClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_cal_client_get_cal_email_address_finish	(ECalClient *client, GAsyncResult *result, gchar **address, GError **error);
+gboolean	e_cal_client_get_cal_email_address_sync		(ECalClient *client, gchar **address, GCancellable *cancellable, GError **error);
+
+guint32		e_cal_client_get_alarm_email_address		(ECalClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_cal_client_get_alarm_email_address_finish	(ECalClient *client, GAsyncResult *result, gchar **address, GError **error);
+gboolean	e_cal_client_get_alarm_email_address_sync	(ECalClient *client, gchar **address, GCancellable *cancellable, GError **error);
+
+guint32		e_cal_client_get_default_object			(ECalClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_cal_client_get_default_object_finish		(ECalClient *client, GAsyncResult *result, icalcomponent **icalcomp, GError **error);
+gboolean	e_cal_client_get_default_object_sync		(ECalClient *client, icalcomponent **icalcomp, GCancellable *cancellable, GError **error);
+
+guint32		e_cal_client_refresh				(ECalClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_cal_client_refresh_finish			(ECalClient *client, GAsyncResult *result, GError **error);
+gboolean	e_cal_client_refresh_sync			(ECalClient *client, GCancellable *cancellable, GError **error);
+
+guint32		e_cal_client_get_object				(ECalClient *client, const gchar *uid, const gchar *rid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_cal_client_get_object_finish			(ECalClient *client, GAsyncResult *result, icalcomponent **icalcomp, GError **error);
+gboolean	e_cal_client_get_object_sync			(ECalClient *client, const gchar *uid, const gchar *rid, icalcomponent **icalcomp, GCancellable *cancellable, GError **error);
+
+guint32		e_cal_client_get_objects_for_uid		(ECalClient *client, const gchar *uid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_cal_client_get_objects_for_uid_finish		(ECalClient *client, GAsyncResult *result, GSList **ecalcomps, GError **error);
+gboolean	e_cal_client_get_objects_for_uid_sync		(ECalClient *client, const gchar *uid, GSList **ecalcomps, GCancellable *cancellable, GError **error);
+
+guint32		e_cal_client_get_object_list			(ECalClient *client, const gchar *sexp, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_cal_client_get_object_list_finish		(ECalClient *client, GAsyncResult *result, GSList **icalcomps, GError **error);
+gboolean	e_cal_client_get_object_list_sync		(ECalClient *client, const gchar *sexp, GSList **icalcomps, GCancellable *cancellable, GError **error);
+
+guint32		e_cal_client_get_object_list_as_comps		(ECalClient *client, const gchar *sexp, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_cal_client_get_object_list_as_comps_finish	(ECalClient *client, GAsyncResult *result, GSList **ecalcomps, GError **error);
+gboolean	e_cal_client_get_object_list_as_comps_sync	(ECalClient *client, const gchar *sexp, GSList **ecalcomps, GCancellable *cancellable, GError **error);
+
+guint32		e_cal_client_get_free_busy			(ECalClient *client, time_t start, time_t end, const GSList *users, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_cal_client_get_free_busy_finish		(ECalClient *client, GAsyncResult *result, GSList **ecalcomps, GError **error);
+gboolean	e_cal_client_get_free_busy_sync			(ECalClient *client, time_t start, time_t end, const GSList *users, GSList **ecalcomps, GCancellable *cancellable, GError **error);
+
+guint32		e_cal_client_create_object			(ECalClient *client, const icalcomponent *icalcomp, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_cal_client_create_object_finish		(ECalClient *client, GAsyncResult *result, gchar **uid, GError **error);
+gboolean	e_cal_client_create_object_sync			(ECalClient *client, const icalcomponent *icalcomp, gchar **uid, GCancellable *cancellable, GError **error);
+
+guint32		e_cal_client_modify_object			(ECalClient *client, const icalcomponent *icalcomp, CalObjModType mod, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_cal_client_modify_object_finish		(ECalClient *client, GAsyncResult *result, GError **error);
+gboolean	e_cal_client_modify_object_sync			(ECalClient *client, const icalcomponent *icalcomp, CalObjModType mod, GCancellable *cancellable, GError **error);
+
+guint32		e_cal_client_remove_object			(ECalClient *client, const gchar *uid, const gchar *rid, CalObjModType mod, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_cal_client_remove_object_finish		(ECalClient *client, GAsyncResult *result, GError **error);
+gboolean	e_cal_client_remove_object_sync			(ECalClient *client, const gchar *uid, const gchar *rid, CalObjModType mod, GCancellable *cancellable, GError **error);
+
+guint32		e_cal_client_receive_objects			(ECalClient *client, const icalcomponent *icalcomp, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_cal_client_receive_objects_finish		(ECalClient *client, GAsyncResult *result, GError **error);
+gboolean	e_cal_client_receive_objects_sync		(ECalClient *client, const icalcomponent *icalcomp, GCancellable *cancellable, GError **error);
+
+guint32		e_cal_client_send_objects			(ECalClient *client, const icalcomponent *icalcomp, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_cal_client_send_objects_finish		(ECalClient *client, GAsyncResult *result, GSList **users, icalcomponent **modified_icalcomp, GError **error);
+gboolean	e_cal_client_send_objects_sync			(ECalClient *client, const icalcomponent *icalcomp, GSList **users, icalcomponent **modified_icalcomp, GCancellable *cancellable, GError **error);
+
+guint32		e_cal_client_get_attachment_uris		(ECalClient *client, const gchar *uid, const gchar *rid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_cal_client_get_attachment_uris_finish		(ECalClient *client, GAsyncResult *result, GSList **attachment_uris, GError **error);
+gboolean	e_cal_client_get_attachment_uris_sync		(ECalClient *client, const gchar *uid, const gchar *rid, GSList **attachment_uris, GCancellable *cancellable, GError **error);
+
+guint32		e_cal_client_get_view				(ECalClient *client, const gchar *sexp, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_cal_client_get_view_finish			(ECalClient *client, GAsyncResult *result, ECalView **view, GError **error);
+gboolean	e_cal_client_get_view_sync			(ECalClient *client, const gchar *sexp, ECalView **view, GCancellable *cancellable, GError **error);
+
+guint32		e_cal_client_get_timezone			(ECalClient *client, const gchar *tzid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_cal_client_get_timezone_finish		(ECalClient *client, GAsyncResult *result, icaltimezone **zone, GError **error);
+gboolean	e_cal_client_get_timezone_sync			(ECalClient *client, const gchar *tzid, icaltimezone **zone, GCancellable *cancellable, GError **error);
+
+guint32		e_cal_client_add_timezone			(ECalClient *client, const icaltimezone *zone, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_cal_client_add_timezone_finish		(ECalClient *client, GAsyncResult *result, GError **error);
+gboolean	e_cal_client_add_timezone_sync			(ECalClient *client, const icaltimezone *zone, GCancellable *cancellable, GError **error);
+
+G_END_DECLS
+
+#endif /* E_CAL_CLIENT_H */
diff --git a/calendar/libecal/e-cal-component.c b/calendar/libecal/e-cal-component.c
index 92f8f35..42ee268 100644
--- a/calendar/libecal/e-cal-component.c
+++ b/calendar/libecal/e-cal-component.c
@@ -308,11 +308,11 @@ free_icalcomponent (ECalComponent *comp, gboolean free)
 	priv->categories = NULL;
 
 	priv->classification = NULL;
-	priv->comment_list = NULL;
+
+	priv->comment_list = free_slist (priv->comment_list);
 	priv->completed = NULL;
-	priv->contact_list = NULL;
+	priv->contact_list = free_slist (priv->contact_list);
 	priv->created = NULL;
-
 	priv->description_list = free_slist (priv->description_list);
 
 	priv->dtend.prop = NULL;
diff --git a/calendar/libecal/e-cal-types.h b/calendar/libecal/e-cal-types.h
index a9dca51..bd9be80 100644
--- a/calendar/libecal/e-cal-types.h
+++ b/calendar/libecal/e-cal-types.h
@@ -28,6 +28,8 @@ G_BEGIN_DECLS
 
 
 
+#ifndef E_CAL_DISABLE_DEPRECATED
+
 #define E_CALENDAR_ERROR e_calendar_error_quark()
 
 GQuark e_calendar_error_quark (void) G_GNUC_CONST;
@@ -68,7 +70,6 @@ typedef enum {
 	E_CALENDAR_STATUS_NOT_SUPPORTED
 } ECalendarStatus;
 
-#ifndef E_CAL_DISABLE_DEPRECATED
 #define E_CALENDAR_STATUS_CORBA_EXCEPTION E_CALENDAR_STATUS_DBUS_EXCEPTION
 #endif
 
diff --git a/calendar/libecal/e-cal-util.c b/calendar/libecal/e-cal-util.c
index b9fc1ca..1fb404d 100644
--- a/calendar/libecal/e-cal-util.c
+++ b/calendar/libecal/e-cal-util.c
@@ -1209,7 +1209,6 @@ e_cal_util_get_component_occur_times (ECalComponent *comp,
 {
 	struct icalrecurrencetype ir;
 	ECalComponentDateTime dt_start, dt_end;
-	GSList *rrules = NULL, *exrules = NULL, *elem, *rdates = NULL;
 
 	g_return_if_fail (comp != NULL);
 	g_return_if_fail (start != NULL);
@@ -1258,6 +1257,8 @@ e_cal_util_get_component_occur_times (ECalComponent *comp,
 		/* ALARMS, EVENTS: DTEND and reccurences */
 
 		if (e_cal_component_has_recurrences (comp)) {
+			GSList *rrules = NULL, *exrules = NULL, *elem, *rdates = NULL;
+
 			/* Do the RRULEs, EXRULEs and RDATEs*/
 			e_cal_component_get_rrule_property_list (comp, &rrules);
 			e_cal_component_get_exrule_property_list (comp, &exrules);
@@ -1316,6 +1317,8 @@ e_cal_util_get_component_occur_times (ECalComponent *comp,
 				else if (rdate_end > *end)
 					*end = rdate_end;
 			}
+
+			e_cal_component_free_period_list (rdates);
 		}
 
 		/* Get dtend of the component and convert it to UTC */
diff --git a/calendar/libecal/e-cal-view-private.h b/calendar/libecal/e-cal-view-private.h
index 9aa39df..be63ba6 100644
--- a/calendar/libecal/e-cal-view-private.h
+++ b/calendar/libecal/e-cal-view-private.h
@@ -28,7 +28,11 @@ G_BEGIN_DECLS
 
 struct _EGdbusCalView;
 
-ECalView *_e_cal_view_new (struct _ECal *client,  struct _EGdbusCalView *gdbus_calview);
+#ifndef E_CAL_DISABLE_DEPRECATED
+ECalView *_e_cal_view_new_for_ecal (struct _ECal *client,  struct _EGdbusCalView *gdbus_calview);
+#endif /* E_CAL_DISABLE_DEPRECATED */
+
+ECalView *_e_cal_view_new (struct _ECalClient *client,  struct _EGdbusCalView *gdbus_calview);
 
 G_END_DECLS
 
diff --git a/calendar/libecal/e-cal-view.c b/calendar/libecal/e-cal-view.c
index 379df5f..2c18254 100644
--- a/calendar/libecal/e-cal-view.c
+++ b/calendar/libecal/e-cal-view.c
@@ -27,24 +27,33 @@
 
 #include <string.h>
 #include "e-cal-marshal.h"
+#ifndef E_CAL_DISABLE_DEPRECATED
 #include "e-cal.h"
+#endif
+#include "e-cal-client.h"
 #include "e-cal-view.h"
 #include "e-cal-view-private.h"
-#include "e-gdbus-egdbuscalview.h"
+#include "e-gdbus-cal-view.h"
 
 G_DEFINE_TYPE (ECalView, e_cal_view, G_TYPE_OBJECT);
 
 /* Private part of the ECalView structure */
 struct _ECalViewPrivate {
-	EGdbusCalView *gdbus_calview;
+	GDBusProxy *gdbus_calview;
+	#ifndef E_CAL_DISABLE_DEPRECATED
 	ECal *client;
+	#endif
+	ECalClient *cal_client;
 };
 
 /* Property IDs */
 enum props {
 	PROP_0,
 	PROP_VIEW,
-	PROP_CLIENT
+	#ifndef E_CAL_DISABLE_DEPRECATED
+	PROP_CLIENT,
+	#endif
+	PROP_CAL_CLIENT
 };
 
 /* Signal IDs */
@@ -119,7 +128,7 @@ objects_added_cb (EGdbusCalView *gdbus_calview, const gchar * const *objects, EC
 }
 
 static void
-objects_modified_cb (EGdbusCalView *gdbus_calview, const gchar * const *objects, ECalView *view)
+objects_changed_cb (EGdbusCalView *gdbus_calview, const gchar * const *objects, ECalView *view)
 {
 	GList *list;
 
@@ -155,7 +164,7 @@ objects_removed_cb (EGdbusCalView *gdbus_calview, const gchar * const *uids, ECa
 }
 
 static void
-progress_cb (EGdbusCalView *gdbus_calview, const gchar *message, guint percent, ECalView *view)
+progress_cb (EGdbusCalView *gdbus_calview, guint percent, const gchar *message, ECalView *view)
 {
 	g_return_if_fail (E_IS_CAL_VIEW (view));
 
@@ -163,7 +172,7 @@ progress_cb (EGdbusCalView *gdbus_calview, const gchar *message, guint percent,
 }
 
 static void
-done_cb (EGdbusCalView *gdbus_calview, /* ECalendarStatus */ guint status, const gchar *message, ECalView *view)
+complete_cb (EGdbusCalView *gdbus_calview, /* ECalendarStatus */ guint status, const gchar *message, ECalView *view)
 {
 	g_return_if_fail (E_IS_CAL_VIEW (view));
 
@@ -198,14 +207,19 @@ e_cal_view_set_property (GObject *object, guint property_id, const GValue *value
 
 		priv->gdbus_calview = g_object_ref (g_value_get_pointer (value));
 		g_signal_connect (priv->gdbus_calview, "objects-added", G_CALLBACK (objects_added_cb), view);
-		g_signal_connect (priv->gdbus_calview, "objects-modified", G_CALLBACK (objects_modified_cb), view);
+		g_signal_connect (priv->gdbus_calview, "objects-changed", G_CALLBACK (objects_changed_cb), view);
 		g_signal_connect (priv->gdbus_calview, "objects-removed", G_CALLBACK (objects_removed_cb), view);
 		g_signal_connect (priv->gdbus_calview, "progress", G_CALLBACK (progress_cb), view);
-		g_signal_connect (priv->gdbus_calview, "done", G_CALLBACK (done_cb), view);
+		g_signal_connect (priv->gdbus_calview, "complete", G_CALLBACK (complete_cb), view);
+		break;
+	case PROP_CAL_CLIENT:
+		priv->cal_client = E_CAL_CLIENT (g_value_dup_object (value));
 		break;
+	#ifndef E_CAL_DISABLE_DEPRECATED
 	case PROP_CLIENT:
 		priv->client = E_CAL (g_value_dup_object (value));
 		break;
+	#endif
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 		break;
@@ -225,9 +239,14 @@ e_cal_view_get_property (GObject *object, guint property_id, GValue *value, GPar
 	case PROP_VIEW:
 		g_value_set_pointer (value, priv->gdbus_calview);
 		break;
+	case PROP_CAL_CLIENT:
+		g_value_set_object (value, priv->cal_client);
+		break;
+	#ifndef E_CAL_DISABLE_DEPRECATED
 	case PROP_CLIENT:
 		g_value_set_object (value, priv->client);
 		break;
+	#endif
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 		break;
@@ -261,7 +280,17 @@ e_cal_view_finalize (GObject *object)
 		}
 	}
 
-	g_object_unref (priv->client);
+	#ifndef E_CAL_DISABLE_DEPRECATED
+	if (priv->client) {
+		g_object_unref (priv->client);
+		priv->client = NULL;
+	}
+	#endif
+
+	if (priv->cal_client) {
+		g_object_unref (priv->cal_client);
+		priv->cal_client = NULL;
+	}
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (e_cal_view_parent_class)->finalize (object);
@@ -285,9 +314,15 @@ e_cal_view_class_init (ECalViewClass *klass)
 		g_param_spec_pointer ("view", "The GDBus view proxy", NULL,
 				      G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
 
+	#ifndef E_CAL_DISABLE_DEPRECATED
 	g_object_class_install_property (object_class, PROP_CLIENT,
 		g_param_spec_object ("client", "The e-cal for the view", NULL, E_TYPE_CAL,
 				      G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+	#endif
+
+	g_object_class_install_property (object_class, PROP_CAL_CLIENT,
+		g_param_spec_object ("cal-client", "The e-cal-client for the view", NULL, E_TYPE_CAL_CLIENT,
+				      G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
         /**
          * ECalView::objects-added:
          * @view:: self
@@ -359,6 +394,48 @@ e_cal_view_class_init (ECalViewClass *klass)
 
 /**
  * _e_cal_view_new:
+ * @client: An #ECalClient object.
+ * @gdbuc_calview: The GDBus object for the view.
+ *
+ * Creates a new view object by issuing the view creation request to the
+ * calendar server.
+ *
+ * Returns: A newly-created view object, or NULL if the request failed.
+ **/
+ECalView *
+_e_cal_view_new (ECalClient *client, EGdbusCalView *gdbus_calview)
+{
+	ECalView *view;
+
+	view = g_object_new (E_TYPE_CAL_VIEW,
+		"cal-client", client,
+		"view", gdbus_calview,
+		NULL);
+
+	return view;
+}
+
+/**
+ * e_cal_view_get_cal_client
+ * @view: A #ECalView object.
+ *
+ * Get the #ECalClient associated with this view.
+ *
+ * Returns: the associated client.
+ *
+ * Since: 3.2
+ */
+ECalClient *
+e_cal_view_get_cal_client (ECalView *view)
+{
+	g_return_val_if_fail (E_IS_CAL_VIEW (view), NULL);
+
+	return view->priv->cal_client;
+}
+
+#ifndef E_CAL_DISABLE_DEPRECATED
+/**
+ * _e_cal_view_new_for_ecal:
  * @client: An #ECal object.
  * @gdbuc_calview: The GDBus object for the view.
  *
@@ -368,12 +445,12 @@ e_cal_view_class_init (ECalViewClass *klass)
  * Returns: A newly-created view object, or NULL if the request failed.
  **/
 ECalView *
-_e_cal_view_new (ECal *client, EGdbusCalView *gdbus_calview)
+_e_cal_view_new_for_ecal (ECal *ecal, EGdbusCalView *gdbus_calview)
 {
 	ECalView *view;
 
 	view = g_object_new (E_TYPE_CAL_VIEW,
-		"client", client,
+		"client", ecal,
 		"view", gdbus_calview,
 		NULL);
 
@@ -381,7 +458,7 @@ _e_cal_view_new (ECal *client, EGdbusCalView *gdbus_calview)
 }
 
 /**
- * e_cal_view_get_client
+ * e_cal_view_get_client_ecal
  * @view: A #ECalView object.
  *
  * Get the #ECal associated with this view.
@@ -389,6 +466,8 @@ _e_cal_view_new (ECal *client, EGdbusCalView *gdbus_calview)
  * Returns: the associated client.
  *
  * Since: 2.22
+ *
+ * Deprecated: 3.2: Use #ECalClient and e_cal_view_get_cal_client() instead
  */
 ECal *
 e_cal_view_get_client (ECalView *view)
@@ -397,6 +476,7 @@ e_cal_view_get_client (ECalView *view)
 
 	return view->priv->client;
 }
+#endif
 
 /**
  * e_cal_view_start:
diff --git a/calendar/libecal/e-cal-view.h b/calendar/libecal/e-cal-view.h
index 0a3a5a0..347eac8 100644
--- a/calendar/libecal/e-cal-view.h
+++ b/calendar/libecal/e-cal-view.h
@@ -35,7 +35,13 @@ G_BEGIN_DECLS
 typedef struct _ECalView ECalView;
 typedef struct _ECalViewClass ECalViewClass;
 typedef struct _ECalViewPrivate ECalViewPrivate;
+
+#ifndef E_CAL_DISABLE_DEPRECATED
 struct _ECal;
+#endif
+struct _ECalClient;
+
+struct _ECalClient;
 
 struct _ECalView {
 	GObject object;
@@ -60,7 +66,12 @@ struct _ECalViewClass {
 
 GType      e_cal_view_get_type (void);
 
+#ifndef E_CAL_DISABLE_DEPRECATED
 struct _ECal *e_cal_view_get_client (ECalView *view);
+#endif
+
+struct _ECalClient *e_cal_view_get_cal_client (ECalView *view);
+
 void e_cal_view_start (ECalView *view);
 void e_cal_view_stop (ECalView *view);
 
diff --git a/calendar/libecal/e-cal.c b/calendar/libecal/e-cal.c
index b38d639..90127b8 100644
--- a/calendar/libecal/e-cal.c
+++ b/calendar/libecal/e-cal.c
@@ -28,6 +28,8 @@
  * The old signal "cal-opened" is deprecated since 3.0 and is replaced with
  * its equivalent "cal_opened_ex", which has a detailed #GError structure
  * as a parameter, instead of a status code only.
+ *
+ * Deprecated: 3.2: Use #ECalClient instead.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -40,6 +42,7 @@
 
 #include <libical/ical.h>
 #include <libedataserver/e-url.h>
+#include <libedataserver/e-credentials.h>
 #include <libedataserver/e-data-server-util.h>
 
 #include <glib-object.h>
@@ -52,9 +55,9 @@
 #include "e-cal-view-private.h"
 #include "e-cal.h"
 
-#include "e-gdbus-egdbuscalfactory.h"
-#include "e-gdbus-egdbuscal.h"
-#include "e-gdbus-egdbuscalview.h"
+#include "e-gdbus-cal.h"
+#include "e-gdbus-cal-view.h"
+#include "e-gdbus-cal-factory.h"
 
 static guint active_cals = 0, cal_connection_closed_id = 0;
 static EGdbusCalFactory *cal_factory_proxy = NULL;
@@ -77,7 +80,7 @@ static void e_cal_finalize (GObject *object);
 
 /* Private part of the ECal structure */
 struct _ECalPrivate {
-	EGdbusCal *gdbus_cal;
+	GDBusProxy *gdbus_cal;
 	guint gone_signal_id;
 
 	/* Load state to avoid multiple loads */
@@ -99,6 +102,7 @@ struct _ECalPrivate {
 	gchar *capabilities;
 
 	gint mode;
+	gboolean requires_auth;
 
 	gboolean read_only;
 
@@ -305,6 +309,8 @@ unwrap_gerror (GError **error)
  * Registers the #ECalSourceTypeEnum type with glib.
  *
  * Returns: the ID of the #ECalSourceTypeEnum type.
+ *
+ * Deprecated: 3.2: Use e_cal_client_source_type_enum_get_type() instead.
  */
 GType
 e_cal_source_type_enum_get_type (void)
@@ -334,6 +340,8 @@ e_cal_source_type_enum_get_type (void)
  * Registers the #ECalSetModeStatusEnum type with glib.
  *
  * Returns: the ID of the #ECalSetModeStatusEnum type.
+ *
+ * Deprecated: 3.2: This type has been dropped completely.
  */
 GType
 e_cal_set_mode_status_enum_get_type (void)
@@ -362,6 +370,8 @@ e_cal_set_mode_status_enum_get_type (void)
  * Registers the #CalModeEnum type with glib.
  *
  * Returns: the ID of the #CalModeEnum type.
+ *
+ * Deprecated: 3.2: This type has been dropped completely.
  */
 GType
 cal_mode_enum_get_type (void)
@@ -401,6 +411,7 @@ convert_type (ECalSourceType type)
 
 	return AnyType;
 }
+
 static void
 e_cal_init (ECal *ecal)
 {
@@ -729,6 +740,176 @@ e_cal_activate (GError **error)
 	return TRUE;
 }
 
+static gchar *
+build_proxy_pass_key (ECal *ecal, const gchar * parent_user)
+{
+	gchar *euri_str;
+	const gchar *uri;
+	EUri *euri;
+
+	uri = e_cal_get_uri (ecal);
+
+	euri = e_uri_new (uri);
+	g_free (euri->user);
+	euri->user = g_strdup (parent_user);
+
+	euri_str = e_uri_to_string (euri, FALSE);
+
+	e_uri_free (euri);
+	return euri_str;
+}
+
+static gchar *
+build_pass_key (ECal *ecal)
+{
+	gchar *euri_str;
+	const gchar *uri;
+	EUri *euri;
+
+	uri = e_cal_get_uri (ecal);
+
+	euri = e_uri_new (uri);
+	euri_str = e_uri_to_string (euri, FALSE);
+
+	e_uri_free (euri);
+	return euri_str;
+}
+
+static void async_open_report_result (ECal *ecal, const GError *error);
+
+static void
+authenticate_user_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	ECal *cal = user_data;
+	GError *error = NULL;
+
+	g_return_if_fail (cal != NULL);
+
+	if (!e_gdbus_cal_call_authenticate_user_finish (G_DBUS_PROXY (source_object), result, &error))
+		cal->priv->load_state = E_CAL_LOAD_NOT_LOADED;
+	else
+		cal->priv->load_state = E_CAL_LOAD_LOADED;
+
+	if (cal->priv->requires_auth && !error) {
+		cal->priv->load_state = E_CAL_LOAD_NOT_LOADED;
+		g_set_error_literal (&error, E_CALENDAR_ERROR, E_CALENDAR_STATUS_AUTHENTICATION_FAILED, e_cal_get_error_message (E_CALENDAR_STATUS_AUTHENTICATION_FAILED));
+	}
+
+	unwrap_gerror (&error);
+	async_open_report_result (cal, error);
+
+	if (error)
+		g_error_free (error);
+}
+
+static gboolean
+call_authenticate_user (ECal *cal, gboolean async, GError **error)
+{
+	gchar *username = NULL, *password = NULL;
+	ECredentials *credentials = NULL;
+	ECalPrivate *priv;
+
+	g_return_val_if_fail (cal != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL (cal), FALSE);
+
+	priv = cal->priv;
+
+	if (!priv->gdbus_cal) {
+		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_DBUS_EXCEPTION, error);
+	}
+
+	/* see if the backend needs authentication */
+	if ((priv->mode != CAL_MODE_LOCAL) && (e_source_get_property (priv->source, "auth") || priv->requires_auth)) {
+		gchar *prompt, *key, *auth_type = NULL;
+		gchar *parent_user;
+
+		priv->load_state = E_CAL_LOAD_AUTHENTICATING;
+
+		if (priv->auth_func == NULL) {
+			priv->load_state = E_CAL_LOAD_NOT_LOADED;
+			E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error);
+		}
+
+		username = e_source_get_duped_property (priv->source, "username");
+		if (!username) {
+			priv->load_state = E_CAL_LOAD_NOT_LOADED;
+			E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error);
+		}
+
+		prompt = g_strdup_printf (_("Enter password for %s (user %s)"),
+				e_source_peek_name (priv->source), username);
+
+		auth_type = e_source_get_duped_property (priv->source, "auth-type");
+		if (auth_type)
+			key = build_pass_key (cal);
+		else {
+			parent_user = e_source_get_duped_property (priv->source, "parent_id_name");
+			if (parent_user) {
+				key = build_proxy_pass_key (cal, parent_user);
+				/*
+				   This password prompt will be prompted rarely. Since the key that is passed to
+				   the auth_func corresponds to the parent user.
+				 */
+				prompt = g_strdup_printf (_("Enter password for %s to enable proxy for user %s"), e_source_peek_name (priv->source), parent_user);
+				g_free (parent_user);
+			} else
+				key = g_strdup (e_cal_get_uri (cal));
+		}
+		g_free (auth_type);
+
+		if (!key) {
+			priv->load_state = E_CAL_LOAD_NOT_LOADED;
+			g_free (username);
+			E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error);
+		}
+
+		password = priv->auth_func (cal, prompt, key, priv->auth_user_data);
+
+		if (!password) {
+			priv->load_state = E_CAL_LOAD_NOT_LOADED;
+			g_free (username);
+			E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error);
+		}
+
+		g_free (prompt);
+		g_free (key);
+	}
+
+	if (username)
+		credentials = e_credentials_new_args (
+			E_CREDENTIALS_KEY_USERNAME, username,
+			E_CREDENTIALS_KEY_PASSWORD, password,
+			NULL);
+	else
+		priv->load_state = E_CAL_LOAD_NOT_LOADED;
+
+	g_free (username);
+	e_credentials_util_safe_free_string (password);
+
+	if (credentials) {
+		gchar **strv = e_credentials_to_strv (credentials);
+
+		if (async) {
+			cal->priv->requires_auth = FALSE;
+			e_gdbus_cal_call_authenticate_user (cal->priv->gdbus_cal, (const gchar * const *) strv, NULL, authenticate_user_ready_cb, cal);
+		} else if (e_gdbus_cal_call_authenticate_user_sync (cal->priv->gdbus_cal, (const gchar * const *) strv, NULL, error))
+			priv->load_state = E_CAL_LOAD_LOADED;
+		else
+			priv->load_state = E_CAL_LOAD_NOT_LOADED;
+
+		g_strfreev (strv);
+		e_credentials_free (credentials);
+
+		if (error && *error)
+			unwrap_gerror (error);
+	} else if (priv->requires_auth) {
+		priv->load_state = E_CAL_LOAD_NOT_LOADED;
+		g_set_error_literal (error, E_CALENDAR_ERROR, E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, e_cal_get_error_message (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED));
+	}
+
+	return credentials && (!error || !*error);
+}
+
 static gboolean
 reopen_with_auth (gpointer data)
 {
@@ -750,11 +931,17 @@ reopen_with_auth (gpointer data)
 }
 
 static void
-auth_required_cb (EGdbusCal *gdbus_cal, ECal *cal)
+auth_required_cb (EGdbusCal *gdbus_cal, const ECredentials *credentials, ECal *cal)
 {
+	ECalPrivate *priv;
 	g_return_if_fail (E_IS_CAL (cal));
 
-	g_idle_add (reopen_with_auth, (gpointer) cal);
+	priv = cal->priv;
+
+	priv->requires_auth = TRUE;
+
+	if (priv->load_state != E_CAL_LOAD_AUTHENTICATING)
+		g_idle_add (reopen_with_auth, (gpointer) cal);
 }
 
 typedef struct
@@ -805,13 +992,12 @@ readonly_cb (EGdbusCal *gdbus_cal, gboolean read_only, ECal *cal)
 }
 
 static void
-mode_cb (EGdbusCal *gdbus_cal, EDataCalMode mode, ECal *cal)
+online_cb (EGdbusCal *gdbus_cal, gboolean is_online, ECal *cal)
 {
 	g_return_if_fail (E_IS_CAL (cal));
-	g_return_if_fail (mode & AnyMode);
 
 	g_signal_emit (G_OBJECT (cal), e_cal_signals[CAL_SET_MODE],
-		       0, E_CALENDAR_STATUS_OK, mode);
+		       0, E_CALENDAR_STATUS_OK, is_online ? Remote : Local);
 }
 
 /*
@@ -854,13 +1040,15 @@ set_local_attachment_store (ECal *ecal)
  *
  * Returns: A newly-created calendar client, or NULL if the client could
  * not be constructed because it could not contact the calendar server.
+ *
+ * Deprecated: 3.2: Use e_cal_client_new() instead.
  **/
 ECal *
 e_cal_new (ESource *source, ECalSourceType type)
 {
 	ECal *ecal;
 	ECalPrivate *priv;
-	gchar *path, *xml;
+	gchar *path, *xml, **strv;
 	GError *error = NULL;
 	GDBusConnection *connection;
 
@@ -883,7 +1071,9 @@ e_cal_new (ESource *source, ECalSourceType type)
 	priv->type = type;
 
 	xml = e_source_to_standalone_xml (priv->source);
-	if (!e_gdbus_cal_factory_call_get_cal_sync (cal_factory_proxy, xml, convert_type (priv->type), &path, NULL, &error)) {
+	strv = e_gdbus_cal_factory_encode_get_cal (xml, convert_type (priv->type));
+	if (!e_gdbus_cal_factory_call_get_cal_sync (G_DBUS_PROXY (cal_factory_proxy), (const gchar * const *) strv, &path, NULL, &error)) {
+		g_strfreev (strv);
 		g_free (xml);
 		unwrap_gerror (&error);
 		g_warning ("Cannot get cal from factory: %s", error ? error->message : "Unknown error");
@@ -892,14 +1082,15 @@ e_cal_new (ESource *source, ECalSourceType type)
 		g_object_unref (ecal);
 		return NULL;
 	}
+	g_strfreev (strv);
 	g_free (xml);
 
-	priv->gdbus_cal = e_gdbus_cal_proxy_new_sync (g_dbus_proxy_get_connection (G_DBUS_PROXY (cal_factory_proxy)),
+	priv->gdbus_cal = G_DBUS_PROXY (e_gdbus_cal_proxy_new_sync (g_dbus_proxy_get_connection (G_DBUS_PROXY (cal_factory_proxy)),
 						      G_DBUS_PROXY_FLAGS_NONE,
 						      CALENDAR_DBUS_SERVICE_NAME,
 						      path,
 						      NULL,
-						      &error);
+						      &error));
 
 	if (!priv->gdbus_cal) {
 		g_free (path);
@@ -925,7 +1116,7 @@ e_cal_new (ESource *source, ECalSourceType type)
 	g_signal_connect (priv->gdbus_cal, "auth-required", G_CALLBACK (auth_required_cb), ecal);
 	g_signal_connect (priv->gdbus_cal, "backend-error", G_CALLBACK (backend_error_cb), ecal);
 	g_signal_connect (priv->gdbus_cal, "readonly", G_CALLBACK (readonly_cb), ecal);
-	g_signal_connect (priv->gdbus_cal, "mode", G_CALLBACK (mode_cb), ecal);
+	g_signal_connect (priv->gdbus_cal, "online", G_CALLBACK (online_cb), ecal);
 
 	/* Set the local attachment store path for the calendar */
 	set_local_attachment_store (ecal);
@@ -1010,6 +1201,8 @@ check_uri (ESource *source, gpointer uri)
  *
  * Returns: A newly-created calendar client, or NULL if the client could
  * not be constructed because it could not contact the calendar server.
+ *
+ * Deprecated: 3.2: Use e_cal_client_new_from_uri() instead.
  **/
 ECal *
 e_cal_new_from_uri (const gchar *uri, ECalSourceType type)
@@ -1090,6 +1283,8 @@ get_local_source (ECalSourceType type)
  *
  * Returns: A newly-created calendar client, or %NULL if the client could
  * not be constructed.
+ *
+ * Deprecated: 3.2: Use e_cal_client_new_system() instead.
  */
 ECal *
 e_cal_new_system_calendar (void)
@@ -1106,6 +1301,8 @@ e_cal_new_system_calendar (void)
  *
  * Returns: A newly-created calendar client, or %NULL if the client could
  * not be constructed.
+ *
+ * Deprecated: 3.2: Use e_cal_client_new_system() instead.
  */
 ECal *
 e_cal_new_system_tasks (void)
@@ -1122,6 +1319,8 @@ e_cal_new_system_tasks (void)
  *
  * Returns: A newly-created calendar client, or %NULL if the client could
  * not be constructed.
+ *
+ * Deprecated: 3.2: Use e_cal_client_new_system() instead.
  */
 ECal *
 e_cal_new_system_memos (void)
@@ -1154,6 +1353,8 @@ e_cal_new_system_memos (void)
  *			  const gchar *prompt,
  *			  const gchar *key,
  *			  gpointer user_data)
+ *
+ * Deprecated: 3.2: Use EClient::authenticate() signal on an #ECalClient instead.
  */
 void
 e_cal_set_auth_func (ECal *ecal, ECalAuthFunc func, gpointer data)
@@ -1165,41 +1366,6 @@ e_cal_set_auth_func (ECal *ecal, ECalAuthFunc func, gpointer data)
 	ecal->priv->auth_user_data = data;
 }
 
-static gchar *
-build_proxy_pass_key (ECal *ecal, const gchar * parent_user)
-{
-	gchar *euri_str;
-	const gchar *uri;
-	EUri *euri;
-
-	uri = e_cal_get_uri (ecal);
-
-	euri = e_uri_new (uri);
-	g_free (euri->user);
-	euri->user = g_strdup (parent_user);
-
-	euri_str = e_uri_to_string (euri, FALSE);
-
-	e_uri_free (euri);
-	return euri_str;
-}
-
-static gchar *
-build_pass_key (ECal *ecal)
-{
-	gchar *euri_str;
-	const gchar *uri;
-	EUri *euri;
-
-	uri = e_cal_get_uri (ecal);
-
-	euri = e_uri_new (uri);
-	euri_str = e_uri_to_string (euri, FALSE);
-
-	e_uri_free (euri);
-	return euri_str;
-}
-
 static void
 async_open_report_result (ECal *ecal, const GError *error)
 {
@@ -1220,7 +1386,6 @@ async_open_report_result (ECal *ecal, const GError *error)
 	#else
 	} else {
 	#endif
-		e_gdbus_cal_call_is_read_only_sync (ecal->priv->gdbus_cal, NULL, NULL);
 	}
 
 	#ifndef E_CAL_DISABLE_DEPRECATED
@@ -1229,14 +1394,43 @@ async_open_report_result (ECal *ecal, const GError *error)
 	g_signal_emit (G_OBJECT (ecal), e_cal_signals[CAL_OPENED_EX], 0, error);
 }
 
+static gboolean
+reschedule_authenticate_cb (gpointer user_data)
+{
+	GError *error = NULL;
+	ECal *ecal = user_data;
+
+	g_return_val_if_fail (ecal && E_IS_CAL (ecal), FALSE);
+
+	if (g_main_depth () > 1)
+		return TRUE;
+
+	if (call_authenticate_user (ecal, TRUE, &error))
+		return FALSE;
+
+	unwrap_gerror (&error);
+	async_open_report_result (ecal, error);
+
+	if (error)
+		g_error_free (error);
+
+	return FALSE;
+}
+
 static void
-async_open_ready_cb (EGdbusCal *gdbus_cal, GAsyncResult *res, ECal *ecal)
+async_open_ready_cb (GDBusProxy *gdbus_cal, GAsyncResult *res, ECal *ecal)
 {
 	GError *error = NULL;
 
 	g_return_if_fail (ecal && E_IS_CAL (ecal));
 
-	e_gdbus_cal_call_open_finish (gdbus_cal, res, &error);
+	if (e_gdbus_cal_call_open_finish (gdbus_cal, res, &error)) {
+		if (g_main_depth () > 1) {
+			g_idle_add (reschedule_authenticate_cb, ecal);
+			return;
+		} else if (call_authenticate_user (ecal, TRUE, &error))
+			return;
+	}
 
 	unwrap_gerror (&error);
 
@@ -1254,7 +1448,6 @@ open_calendar (ECal *ecal, gboolean only_if_exists, GError **error,
 	gboolean needs_auth, gboolean async)
 {
 	ECalPrivate *priv;
-	gchar *username = NULL, *auth_type = NULL, *password = NULL;
 
 	g_return_val_if_fail (error != NULL, FALSE);
 
@@ -1267,11 +1460,9 @@ open_calendar (ECal *ecal, gboolean only_if_exists, GError **error,
 		return TRUE;
 	}
 
-	/* see if the backend needs authentication */
-	if ( (priv->mode !=  CAL_MODE_LOCAL) && e_source_get_property (priv->source, "auth")) {
-		gchar *prompt, *key;
-		gchar *parent_user;
+	priv->load_state = E_CAL_LOAD_LOADING;
 
+	if ((priv->mode != CAL_MODE_LOCAL) && e_source_get_property (priv->source, "auth")) {
 		priv->load_state = E_CAL_LOAD_AUTHENTICATING;
 
 		if (priv->auth_func == NULL) {
@@ -1282,47 +1473,7 @@ open_calendar (ECal *ecal, gboolean only_if_exists, GError **error,
 			E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error);
 		}
 
-		username = e_source_get_duped_property (priv->source, "username");
-		if (!username) {
-			priv->load_state = E_CAL_LOAD_NOT_LOADED;
-			#ifndef E_CAL_DISABLE_DEPRECATED
-			*status = E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED;
-			#endif
-			E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error);
-		}
-
-		prompt = g_strdup_printf (_("Enter password for %s (user %s)"),
-				e_source_peek_name (priv->source), username);
-
-		auth_type = e_source_get_duped_property (priv->source, "auth-type");
-		if (auth_type)
-			key = build_pass_key (ecal);
-		else {
-			parent_user = e_source_get_duped_property (priv->source, "parent_id_name");
-			if (parent_user) {
-				key = build_proxy_pass_key (ecal, parent_user);
-				/*
-				   This password prompt will be prompted rarely. Since the key that is passed to
-				   the auth_func corresponds to the parent user.
-				 */
-				prompt = g_strdup_printf (_("Enter password for %s to enable proxy for user %s"), e_source_peek_name (priv->source), parent_user);
-				g_free (parent_user);
-			} else
-				key = g_strdup (e_cal_get_uri (ecal));
-		}
-		g_free (auth_type);
-
-		if (!key) {
-			priv->load_state = E_CAL_LOAD_NOT_LOADED;
-			#ifndef E_CAL_DISABLE_DEPRECATED
-			*status = E_CALENDAR_STATUS_URI_NOT_LOADED;
-			#endif
-			E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error);
-		}
-
-		password = priv->auth_func (ecal, prompt, key, priv->auth_user_data);
-
-		if (!password) {
+		if (!e_source_get_property (priv->source, "username")) {
 			priv->load_state = E_CAL_LOAD_NOT_LOADED;
 			#ifndef E_CAL_DISABLE_DEPRECATED
 			*status = E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED;
@@ -1330,50 +1481,29 @@ open_calendar (ECal *ecal, gboolean only_if_exists, GError **error,
 			E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error);
 		}
 
-		g_free (prompt);
-		g_free (key);
+		needs_auth = TRUE;
 	}
 
-	priv->load_state = E_CAL_LOAD_LOADING;
-
 	#ifndef E_CAL_DISABLE_DEPRECATED
 	*status = E_CALENDAR_STATUS_OK;
 	#endif
 	if (!async) {
-		gchar *gdbus_username = NULL, *gdbus_password = NULL;
-
-		if (!e_gdbus_cal_call_open_sync (priv->gdbus_cal, only_if_exists, e_util_ensure_gdbus_string (username, &gdbus_username), e_util_ensure_gdbus_string (password, &gdbus_password), NULL, error)) {
+		if (!e_gdbus_cal_call_open_sync (priv->gdbus_cal, only_if_exists, NULL, error)) {
 			#ifndef E_CAL_DISABLE_DEPRECATED
 			*status = E_CALENDAR_STATUS_DBUS_EXCEPTION;
 			#endif
+		} else if (needs_auth && !call_authenticate_user (ecal, FALSE, error)) {
+			#ifndef E_CAL_DISABLE_DEPRECATED
+			*status = error && *error ? (*error)->code : E_CALENDAR_STATUS_AUTHENTICATION_FAILED;
+			#endif
 		}
 		if (!*error)
 			priv->load_state = E_CAL_LOAD_LOADED;
-
-		g_free (gdbus_username);
-		g_free (gdbus_password);
 	} else {
-		gchar *gdbus_username = NULL, *gdbus_password = NULL;
-
-		e_gdbus_cal_call_open (priv->gdbus_cal, only_if_exists, e_util_ensure_gdbus_string (username, &gdbus_username), e_util_ensure_gdbus_string (password, &gdbus_password), NULL, (GAsyncReadyCallback) async_open_ready_cb, ecal);
-
-		g_free (gdbus_username);
-		g_free (gdbus_password);
+		e_gdbus_cal_call_open (priv->gdbus_cal, only_if_exists, NULL, (GAsyncReadyCallback) async_open_ready_cb, ecal);
 	}
 
-	g_free (password);
-	g_free (username);
-
-	if (!*error) {
-		if (!async) {
-			GError *err = NULL;
-
-			e_gdbus_cal_call_is_read_only_sync (ecal->priv->gdbus_cal, NULL, &err);
-
-			if (err)
-				g_error_free (err);
-		}
-	} else {
+	if (*error) {
 		unwrap_gerror (error);
 		priv->load_state = E_CAL_LOAD_NOT_LOADED;
 	}
@@ -1397,6 +1527,8 @@ open_calendar (ECal *ecal, gboolean only_if_exists, GError **error,
  * New signal deprecates the old "cal_opened" signal.
  *
  * Returns: TRUE on success, FALSE on failure to issue the open request.
+ *
+ * Deprecated: 3.2: Use e_client_open_sync() on an #ECalClient object instead.
  **/
 gboolean
 e_cal_open (ECal *ecal, gboolean only_if_exists, GError **error)
@@ -1478,6 +1610,9 @@ async_report_idle (ECal *ecal, GError *error)
  * Because this operation runs in another thread, any authentication
  * callback set on the calendar will be called from this other thread.
  * See #e_cal_set_auth_func() for details.
+ *
+ * Deprecated: 3.2: Use e_client_open()/e_client_open_finish()
+ * on an #ECalClient object instead.
  **/
 void
 e_cal_open_async (ECal *ecal, gboolean only_if_exists)
@@ -1526,6 +1661,8 @@ e_cal_open_async (ECal *ecal, gboolean only_if_exists)
  * Returns: TRUE if calendar supports refresh and it was invoked, FALSE otherwise.
  *
  * Since: 2.30
+ *
+ * Deprecated: 3.2: Use e_cal_client_refresh_sync() instead.
  **/
 gboolean
 e_cal_refresh (ECal *ecal, GError **error)
@@ -1551,6 +1688,8 @@ e_cal_refresh (ECal *ecal, GError **error)
  * Removes a calendar.
  *
  * Returns: TRUE if the calendar was removed, FALSE if there was an error.
+ *
+ * Deprecated: 3.2: Use e_client_remove_sync() on an #ECalClient object instead.
  */
 gboolean
 e_cal_remove (ECal *ecal, GError **error)
@@ -1591,6 +1730,8 @@ build_uri_list (GNOME_Evolution_Calendar_StringSeq *seq)
  * Retrieves a list of all calendar clients for the given mode.
  *
  * Returns: list of uris.
+ *
+ * Deprecated: 3.2: This function has been dropped completely.
  */
 GList *
 e_cal_uri_list (ECal *ecal, CalMode mode)
@@ -1642,6 +1783,8 @@ e_cal_uri_list (ECal *ecal, CalMode mode)
  *
  * Returns: an #ECalSourceType value corresponding to the type
  * of the calendar client.
+ *
+ * Deprecated: 3.2: Use e_cal_client_get_source_type() instead.
  */
 ECalSourceType
 e_cal_get_source_type (ECal *ecal)
@@ -1665,6 +1808,8 @@ e_cal_get_source_type (ECal *ecal)
  * Returns: A #ECalLoadState value indicating whether the client has
  * not been loaded with #e_cal_open yet, whether it is being
  * loaded, or whether it is already loaded.
+ *
+ * Deprecated: 3.2: Use e_client_is_opened() on an #ECalClient instead.
  **/
 ECalLoadState
 e_cal_get_load_state (ECal *ecal)
@@ -1686,6 +1831,8 @@ e_cal_get_load_state (ECal *ecal)
  *
  * Returns: The source of the calendar that is already loaded or is being
  * loaded, or NULL if the ecal has not started a load request yet.
+ *
+ * Deprecated: 3.2: Use e_client_get_source() on an #ECalClient object instead.
  **/
 ESource *
 e_cal_get_source (ECal *ecal)
@@ -1707,6 +1854,8 @@ e_cal_get_source (ECal *ecal)
  *
  * Returns: The URI of the calendar that is already loaded or is being
  * loaded, or NULL if the client has not started a load request yet.
+ *
+ * Deprecated: 3.2: Use e_client_get_uri() on an #ECalClient object instead.
  **/
 const gchar *
 e_cal_get_uri (ECal *ecal)
@@ -1732,6 +1881,8 @@ e_cal_get_uri (ECal *ecal)
  *
  * Returns: The URL where the attachments are serialized in the
  * local filesystem.
+ *
+ * Deprecated: 3.2: Use e_cal_client_get_local_attachment_store() instead.
  **/
 const gchar *
 e_cal_get_local_attachment_store (ECal *ecal)
@@ -1756,6 +1907,8 @@ e_cal_get_local_attachment_store (ECal *ecal)
  * is specified, on exit, in the @read_only argument.
  *
  * Returns: TRUE if the call was successful, FALSE if there was an error.
+ *
+ * Deprecated: 3.2: Use e_cal_client_is_readonly() on an #ECalClient object instead.
  */
 gboolean
 e_cal_is_read_only (ECal *ecal, gboolean *read_only, GError **error)
@@ -1781,6 +1934,8 @@ e_cal_is_read_only (ECal *ecal, gboolean *read_only, GError **error)
  *
  * Returns: TRUE if the operation was successful, FALSE if there
  * was an error.
+ *
+ * Deprecated: 3.2: Use e_cal_client_get_cal_email_address_sync() instead.
  **/
 gboolean
 e_cal_get_cal_address (ECal *ecal, gchar **cal_address, GError **error)
@@ -1801,7 +1956,7 @@ e_cal_get_cal_address (ECal *ecal, gchar **cal_address, GError **error)
 			E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
 		}
 
-		if (!e_gdbus_cal_call_get_cal_address_sync (priv->gdbus_cal, &priv->cal_address, NULL, error)) {
+		if (!e_gdbus_cal_call_get_cal_email_address_sync (priv->gdbus_cal, &priv->cal_address, NULL, error)) {
 			UNLOCK_CACHE ();
 			E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_DBUS_EXCEPTION, error);
 		}
@@ -1823,6 +1978,8 @@ e_cal_get_cal_address (ECal *ecal, gchar **cal_address, GError **error)
  *
  * Returns: TRUE if the operation was successful, FALSE if there was
  * an error while contacting the backend.
+ *
+ * Deprecated: 3.2: Use e_cal_client_get_alarm_email_address_sync() instead.
  */
 gboolean
 e_cal_get_alarm_email_address (ECal *ecal, gchar **alarm_address, GError **error)
@@ -1856,6 +2013,8 @@ e_cal_get_alarm_email_address (ECal *ecal, gchar **alarm_address, GError **error
  *
  * Returns: TRUE if the call was successful, FALSE if there was an
  * error contacting the backend.
+ *
+ * Deprecated: 3.2: This function has been dropped completely.
  */
 gboolean
 e_cal_get_ldap_attribute (ECal *ecal, gchar **ldap_attribute, GError **error)
@@ -1868,19 +2027,11 @@ e_cal_get_ldap_attribute (ECal *ecal, gchar **ldap_attribute, GError **error)
 	e_return_error_if_fail (priv->gdbus_cal, E_CALENDAR_STATUS_REPOSITORY_OFFLINE);
 	*ldap_attribute = NULL;
 
-	if (priv->load_state != E_CAL_LOAD_LOADED) {
-		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
-	}
-
-	if (!e_gdbus_cal_call_get_ldap_attribute_sync (priv->gdbus_cal, ldap_attribute, NULL, error)) {
-		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_DBUS_EXCEPTION, error);
-	}
-
-	return TRUE;
+	E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_NOT_SUPPORTED, error);
 }
 
 static gboolean
-load_static_capabilities (ECal *ecal, GError **error)
+load_capabilities (ECal *ecal, GError **error)
 {
 	ECalPrivate *priv;
 
@@ -1898,7 +2049,7 @@ load_static_capabilities (ECal *ecal, GError **error)
 		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_OK, error);
 	}
 
-	if (!e_gdbus_cal_call_get_scheduling_information_sync (priv->gdbus_cal, &priv->capabilities, NULL, error)) {
+	if (!e_gdbus_cal_call_get_capabilities_sync (priv->gdbus_cal, &priv->capabilities, NULL, error)) {
 		UNLOCK_CACHE ();
 		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_DBUS_EXCEPTION, error);
 	}
@@ -1916,7 +2067,7 @@ check_capability (ECal *ecal, const gchar *cap)
 	priv = ecal->priv;
 
 	/* FIXME Check result */
-	load_static_capabilities (ecal, NULL);
+	load_capabilities (ecal, NULL);
 	if (priv->capabilities && strstr (priv->capabilities, cap))
 		return TRUE;
 
@@ -1930,6 +2081,8 @@ check_capability (ECal *ecal, const gchar *cap)
  * Checks if a calendar supports only one alarm per component.
  *
  * Returns: TRUE if the calendar allows only one alarm, FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_cal_client_check_one_alarm_only() instead.
  */
 gboolean
 e_cal_get_one_alarm_only (ECal *ecal)
@@ -1948,6 +2101,8 @@ e_cal_get_one_alarm_only (ECal *ecal)
  *
  * Returns: TRUE if the calendar forces organizers to attend meetings,
  * FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_cal_client_check_organizer_must_attend() instead.
  */
 gboolean
 e_cal_get_organizer_must_attend (ECal *ecal)
@@ -1966,6 +2121,8 @@ e_cal_get_organizer_must_attend (ECal *ecal)
  *
  * Returns: TRUE if the calendar has a master object for recurrences,
  * FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_cal_client_check_recurrences_no_master() instead.
  */
 gboolean
 e_cal_get_recurrences_no_master (ECal *ecal)
@@ -1984,6 +2141,8 @@ e_cal_get_recurrences_no_master (ECal *ecal)
  * Queries the calendar for static capabilities.
  *
  * Returns: TRUE if the capability is supported, FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_client_check_capability() on an #ECalClient object instead.
  */
 gboolean
 e_cal_get_static_capability (ECal *ecal, const gchar *cap)
@@ -2001,6 +2160,8 @@ e_cal_get_static_capability (ECal *ecal, const gchar *cap)
  * Checks whether the calendar saves schedules.
  *
  * Returns: TRUE if it saves schedules, FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_cal_client_check_save_schedules() instead.
  */
 gboolean
 e_cal_get_save_schedules (ECal *ecal)
@@ -2020,6 +2181,8 @@ e_cal_get_save_schedules (ECal *ecal)
  *
  * Returns: TRUE if the calendar requires organizers to accept, FALSE
  * otherwise.
+ *
+ * Deprecated: 3.2: Use e_cal_client_check_organizer_must_accept() instead.
  */
 gboolean
 e_cal_get_organizer_must_accept (ECal *ecal)
@@ -2039,6 +2202,8 @@ e_cal_get_organizer_must_accept (ECal *ecal)
  * Returns: TRUE if the calendar supports refreshing, FALSE otherwise.
  *
  * Since: 2.30
+ *
+ * Deprecated: 3.2: Use e_cal_client_check_refresh_supported() instead.
  */
 gboolean
 e_cal_get_refresh_supported (ECal *ecal)
@@ -2057,12 +2222,13 @@ e_cal_get_refresh_supported (ECal *ecal)
  * Switches online/offline mode on the calendar.
  *
  * Returns: TRUE if the switch was successful, FALSE if there was an error.
+ *
+ * Deprecated: 3.2: This function has been dropped completely.
  */
 gboolean
 e_cal_set_mode (ECal *ecal, CalMode mode)
 {
 	ECalPrivate *priv;
-	GError *error = NULL;
 
 	g_return_val_if_fail (ecal != NULL, FALSE);
 	g_return_val_if_fail (E_IS_CAL (ecal), FALSE);
@@ -2072,15 +2238,9 @@ e_cal_set_mode (ECal *ecal, CalMode mode)
 	g_return_val_if_fail (priv->gdbus_cal, FALSE);
 	g_return_val_if_fail (priv->load_state == E_CAL_LOAD_LOADED, FALSE);
 
-	if (!e_gdbus_cal_call_set_mode_sync (priv->gdbus_cal, mode, NULL, &error)) {
-		unwrap_gerror (&error);
-		g_printerr ("%s: %s\n", G_STRFUNC, error ? error->message : "Unknown error");
-		if (error)
-			g_error_free (error);
-		return FALSE;
-	}
+	g_debug ("%s: This function is not supported since 3.2", G_STRFUNC);
 
-	return TRUE;
+	return FALSE;
 }
 
 /* This is used in the callback which fetches all the timezones needed for an
@@ -2104,6 +2264,8 @@ struct _ECalGetTimezonesData {
  * values for properties needed.
  *
  * Returns: TRUE if the call was successful, FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_cal_client_get_default_object_sync() instead.
  */
 gboolean
 e_cal_get_default_object (ECal *ecal, icalcomponent **icalcomp, GError **error)
@@ -2154,6 +2316,8 @@ e_cal_get_default_object (ECal *ecal, icalcomponent **icalcomp, GError **error)
  * identifier and gets the attachments for the component.
  *
  * Returns: TRUE if the call was successful, FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_cal_client_get_attachment_uris_sync() instead.
  **/
 gboolean
 e_cal_get_attachments_for_comp (ECal *ecal, const gchar *uid, const gchar *rid, GSList **list, GError **error)
@@ -2161,7 +2325,7 @@ e_cal_get_attachments_for_comp (ECal *ecal, const gchar *uid, const gchar *rid,
 	ECalPrivate *priv;
 	ECalendarStatus status;
 	gchar **list_array;
-	gchar *gdbus_uid = NULL, *gdbus_rid = NULL;
+	gchar **strv;
 
 	e_return_error_if_fail (uid != NULL, E_CALENDAR_STATUS_INVALID_ARG);
 	e_return_error_if_fail (list != NULL, E_CALENDAR_STATUS_INVALID_ARG);
@@ -2174,15 +2338,14 @@ e_cal_get_attachments_for_comp (ECal *ecal, const gchar *uid, const gchar *rid,
 		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
 	}
 
-	if (!e_gdbus_cal_call_get_attachment_list_sync (priv->gdbus_cal, e_util_ensure_gdbus_string (uid, &gdbus_uid), e_util_ensure_gdbus_string (rid, &gdbus_rid), &list_array, NULL, error)) {
-		g_free (gdbus_uid);
-		g_free (gdbus_rid);
+	strv = e_gdbus_cal_encode_get_attachment_uris (uid, rid);
+	if (!e_gdbus_cal_call_get_attachment_uris_sync (priv->gdbus_cal, (const gchar * const *) strv, &list_array, NULL, error)) {
+		g_strfreev (strv);
 
 		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_DBUS_EXCEPTION, error);
 	}
 
-	g_free (gdbus_uid);
-	g_free (gdbus_rid);
+	g_strfreev (strv);
 
 	if (list_array) {
 		gchar **string;
@@ -2209,13 +2372,15 @@ e_cal_get_attachments_for_comp (ECal *ecal, const gchar *uid, const gchar *rid,
  * identifier.
  *
  * Returns: TRUE if the call was successful, FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_cal_client_get_object_sync() instead.
  **/
 gboolean
 e_cal_get_object (ECal *ecal, const gchar *uid, const gchar *rid, icalcomponent **icalcomp, GError **error)
 {
 	ECalPrivate *priv;
 	ECalendarStatus status;
-	gchar *object = NULL, *gdbus_uid = NULL, *gdbus_rid = NULL;
+	gchar *object = NULL, **strv;
 	icalcomponent *tmp_icalcomp;
 	icalcomponent_kind kind;
 
@@ -2230,15 +2395,14 @@ e_cal_get_object (ECal *ecal, const gchar *uid, const gchar *rid, icalcomponent
 		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
 	}
 
-	if (!e_gdbus_cal_call_get_object_sync (priv->gdbus_cal, e_util_ensure_gdbus_string (uid, &gdbus_uid), e_util_ensure_gdbus_string (rid, &gdbus_rid), &object, NULL, error)) {
-		g_free (gdbus_uid);
-		g_free (gdbus_rid);
+	strv = e_gdbus_cal_encode_get_object (uid, rid);
+	if (!e_gdbus_cal_call_get_object_sync (priv->gdbus_cal, (const gchar * const *) strv, &object, NULL, error)) {
+		g_strfreev (strv);
 
 		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_DBUS_EXCEPTION, error);
 	}
 
-	g_free (gdbus_uid);
-	g_free (gdbus_rid);
+	g_strfreev (strv);
 
 	status = E_CALENDAR_STATUS_OK;
 	tmp_icalcomp = icalparser_parse_string (object);
@@ -2294,13 +2458,15 @@ e_cal_get_object (ECal *ecal, const gchar *uid, const gchar *rid, icalcomponent
  * For non-recurring events, it will just return the object with that ID.
  *
  * Returns: TRUE if the call was successful, FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_cal_client_get_objects_for_uid_sync() instead.
  **/
 gboolean
 e_cal_get_objects_for_uid (ECal *ecal, const gchar *uid, GList **objects, GError **error)
 {
 	ECalPrivate *priv;
 	ECalendarStatus status;
-	gchar *object = NULL, *gdbus_uid = NULL;
+	gchar *object = NULL, **strv;
 
 	e_return_error_if_fail (uid != NULL, E_CALENDAR_STATUS_INVALID_ARG);
 	e_return_error_if_fail (objects != NULL, E_CALENDAR_STATUS_INVALID_ARG);
@@ -2313,13 +2479,14 @@ e_cal_get_objects_for_uid (ECal *ecal, const gchar *uid, GList **objects, GError
 		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
 	}
 
-	if (!e_gdbus_cal_call_get_object_sync (priv->gdbus_cal, e_util_ensure_gdbus_string (uid, &gdbus_uid), "", &object, NULL, error)) {
-		g_free (gdbus_uid);
+	strv = e_gdbus_cal_encode_get_object (uid, "");
+	if (!e_gdbus_cal_call_get_object_sync (priv->gdbus_cal, (const gchar * const *) strv, &object, NULL, error)) {
+		g_strfreev (strv);
 
 		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_DBUS_EXCEPTION, error);
 	}
 
-	g_free (gdbus_uid);
+	g_strfreev (strv);
 
 	status = E_CALENDAR_STATUS_OK;
 	{
@@ -2384,6 +2551,8 @@ e_cal_get_objects_for_uid (ECal *ecal, const gchar *uid, GList **objects, GError
  *
  * Returns: The timezone identified by the @tzid argument, or %NULL if
  * it could not be found.
+ *
+ * Deprecated: 3.2: Use e_cal_client_resolve_tzid_cb() instead.
  */
 icaltimezone*
 e_cal_resolve_tzid_cb (const gchar *tzid, gpointer data)
@@ -2414,13 +2583,13 @@ e_cal_resolve_tzid_cb (const gchar *tzid, gpointer data)
  * compute the changes done.
  *
  * Returns: TRUE if the call was successful, FALSE otherwise.
+ *
+ * Deprecated: 3.2: This function has been dropped completely.
  */
 gboolean
 e_cal_get_changes (ECal *ecal, const gchar *change_id, GList **changes, GError **error)
 {
 	ECalPrivate *priv;
-	gchar **additions = NULL, **modifications = NULL, **removals = NULL;
-	gchar *gdbus_change_id = NULL;
 
 	e_return_error_if_fail (changes != NULL, E_CALENDAR_STATUS_INVALID_ARG);
 	e_return_error_if_fail (change_id != NULL, E_CALENDAR_STATUS_INVALID_ARG);
@@ -2429,71 +2598,7 @@ e_cal_get_changes (ECal *ecal, const gchar *change_id, GList **changes, GError *
 	e_return_error_if_fail (priv->gdbus_cal, E_CALENDAR_STATUS_REPOSITORY_OFFLINE);
 	*changes = NULL;
 
-	if (priv->load_state != E_CAL_LOAD_LOADED) {
-		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
-	}
-
-	if (!e_gdbus_cal_call_get_changes_sync (priv->gdbus_cal, e_util_ensure_gdbus_string (change_id, &gdbus_change_id), &additions, &modifications, &removals, NULL, error)) {
-		g_free (gdbus_change_id);
-
-		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_DBUS_EXCEPTION, error);
-	}
-
-	g_free (gdbus_change_id);
-
-	/* TODO: Be more elegant and split this into a function */
-	/* Mostly copied from the old e-cal-listener.c */
-	if ((additions)&&(modifications)&&(removals)) {
-		gint i;
-		gchar **list = NULL, **l;
-		ECalChangeType change_type = E_CAL_CHANGE_ADDED;
-		icalcomponent *icalcomp;
-		ECalChange *change;
-
-		for (i = 0; i < 3; i++) {
-			switch (i) {
-			case 0:
-				change_type = E_CAL_CHANGE_ADDED;
-				list = additions;
-				break;
-			case 1:
-				change_type = E_CAL_CHANGE_MODIFIED;
-				list = modifications;
-				break;
-			case 2:
-				change_type = E_CAL_CHANGE_DELETED;
-				list = removals;
-			}
-
-			for (l = list; *l; l++) {
-				icalcomp = icalparser_parse_string (*l);
-				if (!icalcomp)
-					continue;
-				change = g_new (ECalChange, 1);
-				change->comp = e_cal_component_new ();
-				if (!e_cal_component_set_icalcomponent (change->comp, icalcomp)) {
-					icalcomponent_free (icalcomp);
-					g_object_unref (G_OBJECT (change->comp));
-					g_free (change);
-					continue;
-				}
-				change->type = change_type;
-				*changes = g_list_append (*changes, change);
-			}
-		}
-
-		g_strfreev (additions);
-		g_strfreev (modifications);
-		g_strfreev (removals);
-	} else {
-		g_strfreev (additions);
-		g_strfreev (modifications);
-		g_strfreev (removals);
-
-		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_OTHER_ERROR, error);
-	}
-
-	E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_OK, error);
+	E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_NOT_SUPPORTED, error);
 }
 
 /**
@@ -2501,6 +2606,8 @@ e_cal_get_changes (ECal *ecal, const gchar *change_id, GList **changes, GError *
  * @list: List of changes to be freed.
  *
  * Free a list of changes as returned by #e_cal_get_changes.
+ *
+ * Deprecated: 3.2: Use () instead.
  */
 void
 e_cal_free_change_list (GList *list)
@@ -2534,6 +2641,8 @@ e_cal_free_change_list (GList *list)
  * should be freed by using the #e_cal_free_object_list function.
  *
  * Returns: TRUE if the operation was successful, FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_cal_client_get_object_list_sync() instead.
  **/
 gboolean
 e_cal_get_object_list (ECal *ecal, const gchar *query, GList **objects, GError **error)
@@ -2589,6 +2698,8 @@ e_cal_get_object_list (ECal *ecal, const gchar *query, GList **objects, GError *
  * argument, which is a list of #ECalComponent.
  *
  * Returns: TRUE if the operation was successful, FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_cal_client_get_object_list_as_comps_sync() instead.
  */
 gboolean
 e_cal_get_object_list_as_comp (ECal *ecal, const gchar *query, GList **objects, GError **error)
@@ -2623,6 +2734,8 @@ e_cal_get_object_list_as_comp (ECal *ecal, const gchar *query, GList **objects,
  * @objects: List of objects to be freed.
  *
  * Frees a list of objects as returned by #e_cal_get_object_list.
+ *
+ * Deprecated: 3.2: Use e_cal_client_free_icalcomp_slist() instead.
  */
 void
 e_cal_free_object_list (GList *objects)
@@ -2681,16 +2794,18 @@ build_free_busy_list (const gchar **seq)
  * Gets free/busy information from the calendar server.
  *
  * Returns: TRUE if the operation was successful, FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_cal_client_get_free_busy_sync() instead.
  */
 gboolean
 e_cal_get_free_busy (ECal *ecal, GList *users, time_t start, time_t end,
 		     GList **freebusy, GError **error)
 {
 	ECalPrivate *priv;
-	gchar **users_list;
+	gchar **strv;
 	gchar **freebusy_array = NULL;
+	GSList *susers;
 	GList *l;
-	gint i;
 
 	e_return_error_if_fail (users != NULL, E_CALENDAR_STATUS_INVALID_ARG);
 	e_return_error_if_fail (freebusy != NULL, E_CALENDAR_STATUS_INVALID_ARG);
@@ -2703,15 +2818,19 @@ e_cal_get_free_busy (ECal *ecal, GList *users, time_t start, time_t end,
 		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
 	}
 
-	users_list = g_new0 (gchar *, g_list_length (users) + 1);
-	for (l = users, i = 0; l; l = l->next, i++)
-		users_list[i] = e_util_utf8_make_valid (l->data);
+	susers = NULL;
+	for (l = users; l; l = l->next) {
+		susers = g_slist_prepend (susers, l->data);
+	}
+	susers = g_slist_reverse (susers);
+	strv = e_gdbus_cal_encode_get_free_busy (start, end, susers);
+	g_slist_free (susers);
 
-	if (!e_gdbus_cal_call_get_free_busy_sync (priv->gdbus_cal, (const gchar * const *) users_list, start, end, &freebusy_array, NULL, error)) {
-		g_strfreev (users_list);
+	if (!e_gdbus_cal_call_get_free_busy_sync (priv->gdbus_cal, (const gchar * const *) strv, &freebusy_array, NULL, error)) {
+		g_strfreev (strv);
 		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_DBUS_EXCEPTION, error);
 	}
-	g_strfreev (users_list);
+	g_strfreev (strv);
 
 	if (freebusy_array) {
 		*freebusy = build_free_busy_list ((const gchar **) freebusy_array);
@@ -3112,6 +3231,8 @@ try_again:
  * The callback function should do a g_object_ref() of the calendar component
  * it gets passed if it intends to keep it around, since it will be unref'ed
  * as soon as the callback returns.
+ *
+ * Deprecated: 3.2: Use e_cal_client_generate_instances() instead.
  **/
 void
 e_cal_generate_instances (ECal *ecal, time_t start, time_t end,
@@ -3148,6 +3269,8 @@ e_cal_generate_instances (ECal *ecal, time_t start, time_t end,
  * The callback function should do a g_object_ref() of the calendar component
  * it gets passed if it intends to keep it around, since it will be unref'ed
  * as soon as the callback returns.
+ *
+ * Deprecated: 3.2: Use e_cal_client_generate_instances_for_object() instead.
  **/
 void
 e_cal_generate_instances_for_object (ECal *ecal, icalcomponent *icalcomp,
@@ -3275,6 +3398,8 @@ build_component_alarms_list (ECal *ecal, GList *object_list, time_t start, time_
  * using the #e_cal_free_alarms() function, or by freeing each element
  * separately with #e_cal_component_alarms_free() and then freeing the list with
  * #g_slist_free().
+ *
+ * Deprecated: 3.2: This function has been dropped completely.
  **/
 GSList *
 e_cal_get_alarms_in_range (ECal *ecal, time_t start, time_t end)
@@ -3330,6 +3455,8 @@ e_cal_get_alarms_in_range (ECal *ecal, time_t start, time_t end)
  *
  * Frees a list of #ECalComponentAlarms structures as returned by
  * e_cal_get_alarms_in_range().
+ *
+ * Deprecated: 3.2: This function has been dropped completely.
  **/
 void
 e_cal_free_alarms (GSList *comp_alarms)
@@ -3363,6 +3490,8 @@ e_cal_free_alarms (GSList *comp_alarms)
  * specified range of time.
  *
  * Returns: TRUE on success, FALSE if the object was not found.
+ *
+ * Deprecated: 3.2: This function has been dropped completely.
  **/
 gboolean
 e_cal_get_alarms_for_object (ECal *ecal, const ECalComponentId *id,
@@ -3418,13 +3547,13 @@ e_cal_get_alarms_for_object (ECal *ecal, const ECalComponentId *id,
  * the file backend does, ignore the operation.
  *
  * Returns: TRUE if the operation was successful, FALSE otherwise.
+ *
+ * Deprecated: 3.2: This function has been dropped completely.
  */
 gboolean
 e_cal_discard_alarm (ECal *ecal, ECalComponent *comp, const gchar *auid, GError **error)
 {
 	ECalPrivate *priv;
-	const gchar *uid = NULL;
-	gchar *gdbus_uid = NULL, *gdbus_auid = NULL;
 
 	e_return_error_if_fail (ecal != NULL, E_CALENDAR_STATUS_INVALID_ARG);
 	e_return_error_if_fail (E_IS_CAL (ecal), E_CALENDAR_STATUS_INVALID_ARG);
@@ -3438,19 +3567,7 @@ e_cal_discard_alarm (ECal *ecal, ECalComponent *comp, const gchar *auid, GError
 		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
 	}
 
-	e_cal_component_get_uid (comp, &uid);
-
-	if (!e_gdbus_cal_call_discard_alarm_sync (priv->gdbus_cal, e_util_ensure_gdbus_string (uid, &gdbus_uid), e_util_ensure_gdbus_string (auid, &gdbus_auid), NULL, error)) {
-		g_free (gdbus_uid);
-		g_free (gdbus_auid);
-
-		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_DBUS_EXCEPTION, error);
-	}
-
-	g_free (gdbus_uid);
-	g_free (gdbus_auid);
-
-	E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_OK, error);
+	E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_NOT_SUPPORTED, error);
 }
 
 typedef struct _ForeachTZIDCallbackData ForeachTZIDCallbackData;
@@ -3612,6 +3729,8 @@ e_cal_get_component_as_string_internal (ECal *ecal,
  *
  * Returns: the component as a complete iCalendar string, or NULL on
  * failure. The string should be freed after use.
+ *
+ * Deprecated: 3.2: Use e_cal_client_get_component_as_string() instead.
  **/
 gchar *
 e_cal_get_component_as_string (ECal *ecal, icalcomponent *icalcomp)
@@ -3631,6 +3750,8 @@ e_cal_get_component_as_string (ECal *ecal, icalcomponent *icalcomp)
  * in those cases that UID would be returned in the @uid argument.
  *
  * Returns: TRUE if the operation was successful, FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_cal_client_create_object_sync() instead.
  */
 gboolean
 e_cal_create_object (ECal *ecal, icalcomponent *icalcomp, gchar **uid, GError **error)
@@ -3689,12 +3810,14 @@ e_cal_create_object (ECal *ecal, icalcomponent *icalcomp, gchar **uid, GError **
  * CALOBJ_MOD_THISANDFUTURE).
  *
  * Returns: TRUE if the operation was successful, FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_cal_client_modify_object_sync() instead.
  */
 gboolean
 e_cal_modify_object (ECal *ecal, icalcomponent *icalcomp, CalObjModType mod, GError **error)
 {
 	ECalPrivate *priv;
-	gchar *obj, *gdbus_obj = NULL;
+	gchar *obj, **strv;
 
 	e_return_error_if_fail (E_IS_CAL (ecal), E_CALENDAR_STATUS_INVALID_ARG);
 	e_return_error_if_fail (icalcomp, E_CALENDAR_STATUS_INVALID_ARG);
@@ -3708,15 +3831,16 @@ e_cal_modify_object (ECal *ecal, icalcomponent *icalcomp, CalObjModType mod, GEr
 	}
 
 	obj = icalcomponent_as_ical_string_r (icalcomp);
-	if (!e_gdbus_cal_call_modify_object_sync (priv->gdbus_cal, e_util_ensure_gdbus_string (obj, &gdbus_obj), mod, NULL, error)) {
+	strv = e_gdbus_cal_encode_modify_object (obj, mod);
+	if (!e_gdbus_cal_call_modify_object_sync (priv->gdbus_cal, (const gchar * const *) strv, NULL, error)) {
 		g_free (obj);
-		g_free (gdbus_obj);
+		g_strfreev (strv);
 
 		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_DBUS_EXCEPTION, error);
 	}
 
 	g_free (obj);
-	g_free (gdbus_obj);
+	g_strfreev (strv);
 
 	E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_OK, error);
 }
@@ -3739,13 +3863,15 @@ e_cal_modify_object (ECal *ecal, icalcomponent *icalcomp, CalObjModType mod, GEr
  * are removed.
  *
  * Returns: TRUE if the operation was successful, FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_cal_client_remove_object_sync() instead.
  */
 gboolean
 e_cal_remove_object_with_mod (ECal *ecal, const gchar *uid,
 			      const gchar *rid, CalObjModType mod, GError **error)
 {
 	ECalPrivate *priv;
-	gchar *gdbus_uid = NULL, *gdbus_rid = NULL;
+	gchar **strv;
 
 	e_return_error_if_fail (E_IS_CAL (ecal), E_CALENDAR_STATUS_INVALID_ARG);
 	e_return_error_if_fail (uid, E_CALENDAR_STATUS_INVALID_ARG);
@@ -3757,15 +3883,14 @@ e_cal_remove_object_with_mod (ECal *ecal, const gchar *uid,
 		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
 	}
 
-	if (!e_gdbus_cal_call_remove_object_sync (priv->gdbus_cal, e_util_ensure_gdbus_string (uid, &gdbus_uid), e_util_ensure_gdbus_string (rid, &gdbus_rid), mod, NULL, error)) {
-		g_free (gdbus_uid);
-		g_free (gdbus_rid);
+	strv = e_gdbus_cal_encode_remove_object (uid, rid, mod);
+	if (!e_gdbus_cal_call_remove_object_sync (priv->gdbus_cal, (const gchar * const *) strv, NULL, error)) {
+		g_strfreev (strv);
 
 		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_DBUS_EXCEPTION, error);
 	}
 
-	g_free (gdbus_uid);
-	g_free (gdbus_rid);
+	g_strfreev (strv);
 
 	E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_OK, error);
 }
@@ -3781,6 +3906,8 @@ e_cal_remove_object_with_mod (ECal *ecal, const gchar *uid,
  * signal.
  *
  * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_cal_client_remove_object_sync() instead, with rid set to NULL and mod set to CALOBJ_MOD_THIS.
  **/
 gboolean
 e_cal_remove_object (ECal *ecal, const gchar *uid, GError **error)
@@ -3802,6 +3929,8 @@ e_cal_remove_object (ECal *ecal, const gchar *uid, GError **error)
  * messages for scheduled meetings.
  *
  * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_cal_client_receive_objects_sync() instead.
  */
 gboolean
 e_cal_receive_objects (ECal *ecal, icalcomponent *icalcomp, GError **error)
@@ -3846,14 +3975,16 @@ e_cal_receive_objects (ECal *ecal, icalcomponent *icalcomp, GError **error)
  * of users.
  *
  * Returns: TRUE if the operation was successful, FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_cal_client_send_objects_sync() instead.
  */
 gboolean
 e_cal_send_objects (ECal *ecal, icalcomponent *icalcomp, GList **users, icalcomponent **modified_icalcomp, GError **error)
 {
 	ECalPrivate *priv;
 	ECalendarStatus status;
-	gchar **users_array = NULL;
-	gchar *object = NULL, *obj, *gdbus_obj = NULL;
+	gchar **out_array = NULL;
+	gchar *obj, *gdbus_obj = NULL;
 
 	e_return_error_if_fail (users != NULL, E_CALENDAR_STATUS_INVALID_ARG);
 	e_return_error_if_fail (modified_icalcomp != NULL, E_CALENDAR_STATUS_INVALID_ARG);
@@ -3870,7 +4001,7 @@ e_cal_send_objects (ECal *ecal, icalcomponent *icalcomp, GList **users, icalcomp
 	}
 
 	obj = icalcomponent_as_ical_string_r (icalcomp);
-	if (!e_gdbus_cal_call_send_objects_sync (priv->gdbus_cal, e_util_ensure_gdbus_string (obj, &gdbus_obj), &users_array, &object, NULL, error)) {
+	if (!e_gdbus_cal_call_send_objects_sync (priv->gdbus_cal, e_util_ensure_gdbus_string (obj, &gdbus_obj), &out_array, NULL, error)) {
 		g_free (obj);
 		g_free (gdbus_obj);
 
@@ -3881,15 +4012,24 @@ e_cal_send_objects (ECal *ecal, icalcomponent *icalcomp, GList **users, icalcomp
 	g_free (gdbus_obj);
 
 	status = E_CALENDAR_STATUS_OK;
-	if (users_array) {
-		gchar **user;
+	if (out_array) {
+		GSList *susers = NULL, *iter;
+		gchar *object = NULL;
+
+		e_return_error_if_fail (e_gdbus_cal_decode_send_objects ((const gchar * const *) out_array, &object, &susers), E_CALENDAR_STATUS_OTHER_ERROR);
+
 		*modified_icalcomp = icalparser_parse_string (object);
 		if (!(*modified_icalcomp))
 			status = E_CALENDAR_STATUS_INVALID_OBJECT;
 
-		for (user = users_array; *user; user++)
-			*users = g_list_append (*users, g_strdup (*user));
-		g_strfreev (users_array);
+		*users = NULL;
+		for (iter = susers; iter; iter = iter->next) {
+			*users = g_list_append (*users, iter->data);
+		}
+		/* do not call g_free() on item's data of susers, it's moved to *users */
+		g_slist_free (susers);
+		g_strfreev (out_array);
+		g_free (object);
 	} else
 		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_OTHER_ERROR, error);
 
@@ -3906,6 +4046,8 @@ e_cal_send_objects (ECal *ecal, icalcomponent *icalcomp, GList **users, icalcomp
  * Retrieves a timezone object from the calendar backend.
  *
  * Returns: TRUE if the operation was successful, FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_cal_client_get_timezone_sync() instead.
  */
 gboolean
 e_cal_get_timezone (ECal *ecal, const gchar *tzid, icaltimezone **zone, GError **error)
@@ -4027,6 +4169,8 @@ e_cal_get_timezone (ECal *ecal, const gchar *tzid, icaltimezone **zone, GError *
  * Add a VTIMEZONE object to the given calendar.
  *
  * Returns: TRUE if successful, FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_cal_client_add_timezone_sync() instead.
  */
 gboolean
 e_cal_add_timezone (ECal *ecal, icaltimezone *izone, GError **error)
@@ -4083,6 +4227,8 @@ e_cal_add_timezone (ECal *ecal, icaltimezone *izone, GError **error)
  *
  * Returns: A query object that will emit notification signals as calendar
  * components are added and removed from the query in the server.
+ *
+ * Deprecated: 3.2: Use e_cal_client_get_view_sync() instead.
  **/
 gboolean
 e_cal_get_query (ECal *ecal, const gchar *sexp, ECalView **query, GError **error)
@@ -4103,7 +4249,7 @@ e_cal_get_query (ECal *ecal, const gchar *sexp, ECalView **query, GError **error
 		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
 	}
 
-	if (!e_gdbus_cal_call_get_query_sync (priv->gdbus_cal, e_util_ensure_gdbus_string (sexp, &gdbus_sexp), &query_path, NULL, error)) {
+	if (!e_gdbus_cal_call_get_view_sync (priv->gdbus_cal, e_util_ensure_gdbus_string (sexp, &gdbus_sexp), &query_path, NULL, error)) {
 		g_free (gdbus_sexp);
 
 		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_DBUS_EXCEPTION, error);
@@ -4126,7 +4272,7 @@ e_cal_get_query (ECal *ecal, const gchar *sexp, ECalView **query, GError **error
 		*query = NULL;
 		status = E_CALENDAR_STATUS_OTHER_ERROR;
 	} else {
-		*query = _e_cal_view_new (ecal, gdbus_calview);
+		*query = _e_cal_view_new_for_ecal (ecal, gdbus_calview);
 		g_object_unref (gdbus_calview);
 	}
 
@@ -4143,13 +4289,13 @@ e_cal_get_query (ECal *ecal, const gchar *sexp, ECalView **query, GError **error
  * the calendar.
  *
  * Returns: TRUE if the operation was successful, FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_cal_client_set_default_timezone() instead.
  */
 gboolean
 e_cal_set_default_timezone (ECal *ecal, icaltimezone *zone, GError **error)
 {
 	ECalPrivate *priv;
-	icalcomponent *icalcomp = NULL;
-	gchar *tzobj, *gdbus_tzobj = NULL;
 
 	e_return_error_if_fail (E_IS_CAL (ecal), E_CALENDAR_STATUS_INVALID_ARG);
 	e_return_error_if_fail (zone, E_CALENDAR_STATUS_INVALID_ARG);
@@ -4161,25 +4307,10 @@ e_cal_set_default_timezone (ECal *ecal, icaltimezone *zone, GError **error)
 		return TRUE;
 
 	/* FIXME Adding it to the server to change the tzid */
-	icalcomp = icaltimezone_get_component (zone);
-	if (!icalcomp) {
+	if (!icaltimezone_get_component (zone)) {
 		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_INVALID_ARG, error);
 	}
 
-	/* convert icaltimezone into a string */
-	tzobj = icalcomponent_as_ical_string_r (icalcomp);
-
-	/* call the backend */
-	if (!e_gdbus_cal_call_set_default_timezone_sync (priv->gdbus_cal, e_util_ensure_gdbus_string (tzobj, &gdbus_tzobj), NULL, error)) {
-		g_free (tzobj);
-		g_free (gdbus_tzobj);
-
-		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_DBUS_EXCEPTION, error);
-	}
-
-	g_free (tzobj);
-	g_free (gdbus_tzobj);
-
 	priv->default_zone = zone;
 
 	E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_OK, error);
@@ -4192,6 +4323,8 @@ e_cal_set_default_timezone (ECal *ecal, icaltimezone *zone, GError **error)
  * Gets an error message for the given status code.
  *
  * Returns: the error message.
+ *
+ * Deprecated: 3.2: Use e_cal_client_error_to_string() instead.
  */
 const gchar *
 e_cal_get_error_message (ECalendarStatus status)
@@ -4257,6 +4390,9 @@ e_cal_get_error_message (ECalendarStatus status)
  * Opens the default calendar.
  *
  * Returns: TRUE if it opened correctly, FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_cal_client_new_default_calendar() instead
+ * and open it on your own.
  */
 gboolean
 e_cal_open_default (ECal **ecal,
@@ -4318,6 +4454,8 @@ e_cal_open_default (ECal **ecal,
  * Sets a calendar as the default one.
  *
  * Returns: TRUE if the operation was successful, FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_cal_client_set_default() instead.
  */
 gboolean
 e_cal_set_default (ECal *ecal, GError **error)
@@ -4387,6 +4525,8 @@ set_default_source (ESourceList *sources, ESource *source, GError **error)
  * Sets the default source for the specified @type.
  *
  * Returns: TRUE if the operation was successful, FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_cal_client_set_default_source() instead.
  */
 gboolean
 e_cal_set_default_source (ESource *source, ECalSourceType type, GError **error)
@@ -4422,6 +4562,8 @@ get_sources (ESourceList **sources, const gchar *key, GError **error)
  * Gets the list of sources defined in the configuration for the given @type.
  *
  * Returns: TRUE if the operation was successful, FALSE otherwise.
+ *
+ * Deprecated: 3.2: Use e_cal_client_get_sources() instead.
  */
 gboolean
 e_cal_get_sources (ESourceList **sources, ECalSourceType type, GError **error)
diff --git a/calendar/libecal/e-cal.h b/calendar/libecal/e-cal.h
index ea599d5..a1dc014 100644
--- a/calendar/libecal/e-cal.h
+++ b/calendar/libecal/e-cal.h
@@ -22,6 +22,8 @@
 #ifndef E_CAL_H
 #define E_CAL_H
 
+#ifndef E_CAL_DISABLE_DEPRECATED
+
 #include <glib-object.h>
 #include "libedataserver/e-source-list.h"
 #include "libedataserver/e-source.h"
@@ -70,6 +72,14 @@ typedef enum {
 	E_CAL_LOAD_LOADED
 } ECalLoadState;
 
+#ifndef E_CAL_DISABLE_DEPRECATED
+typedef enum {
+	Local = 1 << 0,
+	Remote = 1 << 1,
+	AnyMode = 0x07
+} EDataCalMode;
+#endif
+
 struct _ECal {
 	GObject object;
 
@@ -215,4 +225,6 @@ gboolean e_cal_get_attachments_for_comp (ECal *ecal, const gchar *uid, const gch
 
 G_END_DECLS
 
+#endif /* E_CAL_DISABLE_DEPRECATED */
+
 #endif
diff --git a/calendar/libedata-cal/e-cal-backend-sexp.c b/calendar/libedata-cal/e-cal-backend-sexp.c
index e408d3d..b2afd91 100644
--- a/calendar/libedata-cal/e-cal-backend-sexp.c
+++ b/calendar/libedata-cal/e-cal-backend-sexp.c
@@ -382,9 +382,7 @@ func_occur_in_time_range (ESExp *esexp, gint argc, ESExpResult **argv, gpointer
 	end = argv[1]->value.time;
 
 	/* See if the object occurs in the specified time range */
-	default_zone = e_cal_backend_internal_get_default_timezone (ctx->backend);
-	if (!default_zone)
-		default_zone = icaltimezone_get_utc_timezone ();
+	default_zone = icaltimezone_get_utc_timezone ();
 
 	ctx->occurs = FALSE;
 	e_cal_recur_generate_instances (ctx->comp, start, end,
@@ -883,9 +881,7 @@ func_has_alarms_in_range (ESExp *esexp, gint argc, ESExpResult **argv, gpointer
 	end = argv[1]->value.time;
 
 	/* See if the object has alarms in the given time range */
-	default_zone = e_cal_backend_internal_get_default_timezone (ctx->backend);
-	if (!default_zone)
-		default_zone = icaltimezone_get_utc_timezone ();
+	default_zone = icaltimezone_get_utc_timezone ();
 
 	alarms = e_cal_util_generate_alarms_for_comp (ctx->comp, start, end,
 						      omit, resolve_tzid,
diff --git a/calendar/libedata-cal/e-cal-backend-sync.c b/calendar/libedata-cal/e-cal-backend-sync.c
index 8264719..1a9639d 100644
--- a/calendar/libedata-cal/e-cal-backend-sync.c
+++ b/calendar/libedata-cal/e-cal-backend-sync.c
@@ -21,15 +21,15 @@ struct _ECalBackendSyncPrivate {
 	gboolean mutex_lock;
 };
 
-#define LOCK_WRAPPER(func, args) \
-  g_assert (E_CAL_BACKEND_SYNC_GET_CLASS (backend)->func); \
-  if (backend->priv->mutex_lock) \
-    g_mutex_lock (backend->priv->sync_mutex); \
-  (* E_CAL_BACKEND_SYNC_GET_CLASS (backend)->func) args; \
-  if (backend->priv->mutex_lock) \
-    g_mutex_unlock (backend->priv->sync_mutex); \
-
-static GObjectClass *parent_class;
+#define LOCK_WRAPPER(func, args) G_STMT_START {				\
+	gboolean locked = backend->priv->mutex_lock;			\
+	g_return_if_fail (E_CAL_BACKEND_SYNC_GET_CLASS (backend)->func);\
+	if (locked)							\
+		g_mutex_lock (backend->priv->sync_mutex);		\
+	(* E_CAL_BACKEND_SYNC_GET_CLASS (backend)->func) args;		\
+	if (locked)							\
+		g_mutex_unlock (backend->priv->sync_mutex);		\
+	} G_STMT_END
 
 /**
  * e_cal_backend_sync_set_lock:
@@ -50,174 +50,246 @@ e_cal_backend_sync_set_lock (ECalBackendSync *backend, gboolean lock)
 }
 
 /**
- * e_cal_backend_sync_is_read_only:
+ * e_cal_backend_sync_open:
  * @backend: An ECalBackendSync object.
  * @cal: An EDataCal object.
- * @read_only: Return value for read-only status.
+ * @cancellable: a #GCancellable for the operation
+ * @only_if_exists: Whether to open the calendar if and only if it already exists
+ * or just create it when it does not exist.
  * @error: Out parameter for a #GError.
  *
- * Calls the is_read_only method on the given backend.
+ * Calls the open_sync method on the given backend.
  */
 void
-e_cal_backend_sync_is_read_only  (ECalBackendSync *backend, EDataCal *cal, gboolean *read_only, GError **error)
+e_cal_backend_sync_open (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gboolean only_if_exists, GError **error)
 {
 	e_return_data_cal_error_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
-	e_return_data_cal_error_if_fail (read_only, InvalidArg);
 
-	LOCK_WRAPPER (is_read_only_sync, (backend, cal, read_only, error));
+	LOCK_WRAPPER (open_sync, (backend, cal, cancellable, only_if_exists, error));
 }
 
 /**
- * e_cal_backend_sync_get_cal_address:
+ * e_cal_backend_sync_authenticate_user:
+ * @backend: an #ECalBackendSync
+ * @cal: an #EDataCal
+ * @cancellable: a #GCancellable for the operation
+ * @credentials: an #ECredentials to authenticate with
+ * @error: #GError to set, when something fails
+ *
+ * Authenticates @backend with given @credentials.
+ **/
+void
+e_cal_backend_sync_authenticate_user (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, ECredentials *credentials, GError **error)
+{
+	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
+	e_return_data_cal_error_if_fail (E_IS_DATA_CAL (cal), InvalidArg);
+	e_return_data_cal_error_if_fail (credentials, InvalidArg);
+
+	LOCK_WRAPPER (authenticate_user_sync, (backend, cal, cancellable, credentials, error));
+}
+
+/**
+ * e_cal_backend_sync_remove:
  * @backend: An ECalBackendSync object.
  * @cal: An EDataCal object.
- * @address: Return value for the address.
+ * @cancellable: a #GCancellable for the operation
  * @error: Out parameter for a #GError.
  *
- * Calls the get_cal_address method on the given backend.
+ * Calls the remove_sync method on the given backend.
  */
 void
-e_cal_backend_sync_get_cal_address  (ECalBackendSync *backend, EDataCal *cal, gchar **address, GError **error)
+e_cal_backend_sync_remove (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, GError **error)
 {
 	e_return_data_cal_error_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
-	e_return_data_cal_error_if_fail (address, InvalidArg);
 
-	LOCK_WRAPPER (get_cal_address_sync, (backend, cal, address, error));
+	LOCK_WRAPPER (remove_sync, (backend, cal, cancellable, error));
 }
 
 /**
- * e_cal_backend_sync_get_alarm_email_address:
+ * e_cal_backend_sync_refresh:
  * @backend: An ECalBackendSync object.
  * @cal: An EDataCal object.
- * @address: Return value for the address.
+ * @cancellable: a #GCancellable for the operation
  * @error: Out parameter for a #GError.
  *
- * Calls the get_alarm_email_address method on the given backend.
+ * Calls the refresh_sync method on the given backend.
+ *
+ * Since: 2.30
  */
 void
-e_cal_backend_sync_get_alarm_email_address  (ECalBackendSync *backend, EDataCal *cal, gchar **address, GError **error)
+e_cal_backend_sync_refresh  (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, GError **error)
 {
 	e_return_data_cal_error_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
-	e_return_data_cal_error_if_fail (address, InvalidArg);
+	e_return_data_cal_error_if_fail (E_CAL_BACKEND_SYNC_GET_CLASS (backend)->refresh_sync != NULL, UnsupportedMethod);
 
-	LOCK_WRAPPER (get_alarm_email_address_sync, (backend, cal, address, error));
+	LOCK_WRAPPER (refresh_sync, (backend, cal, cancellable, error));
 }
 
 /**
- * e_cal_backend_sync_get_ldap_attribute:
+ * e_cal_backend_sync_get_capabilities:
  * @backend: An ECalBackendSync object.
  * @cal: An EDataCal object.
- * @attribute: Return value for LDAP attribute.
+ * @cancellable: a #GCancellable for the operation
+ * @capabilities: Return value for comma-separated list of capabilities.
  * @error: Out parameter for a #GError.
  *
- * Calls the get_ldap_attribute method on the given backend.
+ * Calls the get_capabilities_sync method on the given backend.
  */
 void
-e_cal_backend_sync_get_ldap_attribute  (ECalBackendSync *backend, EDataCal *cal, gchar **attribute, GError **error)
+e_cal_backend_sync_get_capabilities (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **capabilities, GError **error)
 {
 	e_return_data_cal_error_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
-	e_return_data_cal_error_if_fail (attribute, InvalidArg);
+	e_return_data_cal_error_if_fail (capabilities, InvalidArg);
 
-	LOCK_WRAPPER (get_ldap_attribute_sync, (backend, cal, attribute, error));
+	LOCK_WRAPPER (get_capabilities_sync, (backend, cal, cancellable, capabilities, error));
 }
 
 /**
- * e_cal_backend_sync_get_static_capabilities:
+ * e_cal_backend_sync_get_cal_email_address:
  * @backend: An ECalBackendSync object.
  * @cal: An EDataCal object.
- * @capabilities: Return value for capabilities.
+ * @cancellable: a #GCancellable for the operation
+ * @address: Return value for the address.
  * @error: Out parameter for a #GError.
  *
- * Calls the get_capabilities method on the given backend.
+ * Calls the get_cal_email_address_sync method on the given backend.
  */
 void
-e_cal_backend_sync_get_static_capabilities  (ECalBackendSync *backend, EDataCal *cal, gchar **capabilities, GError **error)
+e_cal_backend_sync_get_cal_email_address  (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **address, GError **error)
 {
 	e_return_data_cal_error_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
-	e_return_data_cal_error_if_fail (capabilities, InvalidArg);
+	e_return_data_cal_error_if_fail (address, InvalidArg);
 
-	LOCK_WRAPPER (get_static_capabilities_sync, (backend, cal, capabilities, error));
+	LOCK_WRAPPER (get_cal_email_address_sync, (backend, cal, cancellable, address, error));
 }
 
 /**
- * e_cal_backend_sync_open:
+ * e_cal_backend_sync_get_alarm_email_address:
  * @backend: An ECalBackendSync object.
  * @cal: An EDataCal object.
- * @only_if_exists: Whether to open the calendar if and only if it already exists
- * or just create it when it does not exist.
- * @username: User name to use for authentication.
- * @password: Password to use for authentication.
+ * @cancellable: a #GCancellable for the operation
+ * @address: Return value for the address.
  * @error: Out parameter for a #GError.
  *
- * Calls the open method on the given backend.
+ * Calls the get_alarm_email_address_sync method on the given backend.
  */
 void
-e_cal_backend_sync_open  (ECalBackendSync *backend, EDataCal *cal, gboolean only_if_exists,
-			  const gchar *username, const gchar *password, GError **error)
+e_cal_backend_sync_get_alarm_email_address  (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **address, GError **error)
 {
 	e_return_data_cal_error_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
+	e_return_data_cal_error_if_fail (address, InvalidArg);
 
-	LOCK_WRAPPER (open_sync, (backend, cal, only_if_exists, username, password, error));
+	LOCK_WRAPPER (get_alarm_email_address_sync, (backend, cal, cancellable, address, error));
 }
 
 /**
- * e_cal_backend_sync_remove:
+ * e_cal_backend_sync_get_default_object:
  * @backend: An ECalBackendSync object.
  * @cal: An EDataCal object.
+ * @cancellable: a #GCancellable for the operation
+ * @calobj: Placeholder for returned object.
  * @error: Out parameter for a #GError.
  *
- * Calls the remove method on the given backend.
+ * Calls the get_default_object_sync method on the given backend.
  */
 void
-e_cal_backend_sync_remove  (ECalBackendSync *backend, EDataCal *cal, GError **error)
+e_cal_backend_sync_get_default_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **calobj, GError **error)
 {
 	e_return_data_cal_error_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
+	e_return_data_cal_error_if_fail (calobj, InvalidArg);
 
-	LOCK_WRAPPER (remove_sync, (backend, cal, error));
+	LOCK_WRAPPER (get_default_object_sync, (backend, cal, cancellable, calobj, error));
 }
 
 /**
- * e_cal_backend_sync_refresh:
+ * e_cal_backend_sync_get_object:
  * @backend: An ECalBackendSync object.
  * @cal: An EDataCal object.
+ * @cancellable: a #GCancellable for the operation
+ * @uid: UID of the object to get.
+ * @rid: Recurrence ID of the specific instance to get, or NULL if getting the
+ * master object.
+ * @calobj: Placeholder for returned object.
  * @error: Out parameter for a #GError.
  *
- * Calls the refresh method on the given backend.
+ * Calls the get_object_sync method on the given backend.
+ */
+void
+e_cal_backend_sync_get_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, gchar **calobj, GError **error)
+{
+	e_return_data_cal_error_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
+	e_return_data_cal_error_if_fail (calobj, InvalidArg);
+
+	LOCK_WRAPPER (get_object_sync, (backend, cal, cancellable, uid, rid, calobj, error));
+}
+
+/**
+ * e_cal_backend_sync_get_object_list:
+ * @backend: An ECalBackendSync object.
+ * @cal: An EDataCal object.
+ * @cancellable: a #GCancellable for the operation
+ * @sexp: Search query.
+ * @calobjs: Placeholder for list of returned objects.
+ * @error: Out parameter for a #GError.
  *
- * Since: 2.30
+ * Calls the get_object_list_sync method on the given backend.
  */
 void
-e_cal_backend_sync_refresh  (ECalBackendSync *backend, EDataCal *cal, GError **error)
+e_cal_backend_sync_get_object_list (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *sexp, GSList **calobjs, GError **error)
 {
 	e_return_data_cal_error_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
-	e_return_data_cal_error_if_fail (E_CAL_BACKEND_SYNC_GET_CLASS (backend)->refresh_sync != NULL, UnsupportedMethod);
+	e_return_data_cal_error_if_fail (calobjs, InvalidArg);
+
+	LOCK_WRAPPER (get_object_list_sync, (backend, cal, cancellable, sexp, calobjs, error));
+}
+
+/**
+ * e_cal_backend_sync_get_free_busy:
+ * @backend: An ECalBackendSync object.
+ * @cal: An EDataCal object.
+ * @cancellable: a #GCancellable for the operation
+ * @users: List of users to get F/B info from.
+ * @start: Time range start.
+ * @end: Time range end.
+ * @freebusyobjects: Placeholder for F/B information.
+ * @error: Out parameter for a #GError.
+ *
+ * Calls the get_free_busy_sync method on the given backend.
+ */
+void
+e_cal_backend_sync_get_free_busy (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const GSList *users, time_t start, time_t end, GSList **freebusyobjects, GError **error)
+{
+	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
 
-	LOCK_WRAPPER (refresh_sync, (backend, cal, error));
+	LOCK_WRAPPER (get_free_busy_sync, (backend, cal, cancellable, users, start, end, freebusyobjects, error));
 }
 
 /**
  * e_cal_backend_sync_create_object:
  * @backend: An ECalBackendSync object.
  * @cal: An EDataCal object.
+ * @cancellable: a #GCancellable for the operation
  * @calobj: The object to be added.
  * @uid: Placeholder for server-generated UID.
+ * @new_object: Placeholder for server-calobj, if it changed. Can be left as is if it's same as @calobj.
  * @error: Out parameter for a #GError.
  *
- * Calls the create_object method on the given backend.
+ * Calls the create_object_sync method on the given backend.
  */
 void
-e_cal_backend_sync_create_object (ECalBackendSync *backend, EDataCal *cal, gchar **calobj, gchar **uid, GError **error)
+e_cal_backend_sync_create_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, gchar **uid, gchar **new_object, GError **error)
 {
 	e_return_data_cal_error_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
 	e_return_data_cal_error_if_fail (E_CAL_BACKEND_SYNC_GET_CLASS (backend)->create_object_sync != NULL, UnsupportedMethod);
 
-	LOCK_WRAPPER (create_object_sync, (backend, cal, calobj, uid, error));
+	LOCK_WRAPPER (create_object_sync, (backend, cal, cancellable, calobj, uid, new_object, error));
 }
 
 /**
  * e_cal_backend_sync_modify_object:
  * @backend: An ECalBackendSync object.
  * @cal: An EDataCal object.
+ * @cancellable: a #GCancellable for the operation
  * @calobj: Object to be modified.
  * @mod: Type of modification to be done.
  * @old_object: Placeholder for returning the old object as it was stored on the
@@ -226,187 +298,115 @@ e_cal_backend_sync_create_object (ECalBackendSync *backend, EDataCal *cal, gchar
  * on the backend.
  * @error: Out parameter for a #GError.
  *
- * Calls the modify_object method on the given backend.
+ * Calls the modify_object_sync method on the given backend.
  */
 void
-e_cal_backend_sync_modify_object (ECalBackendSync *backend, EDataCal *cal, const gchar *calobj,
+e_cal_backend_sync_modify_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj,
 				  CalObjModType mod, gchar **old_object, gchar **new_object, GError **error)
 {
 	e_return_data_cal_error_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
 	e_return_data_cal_error_if_fail (E_CAL_BACKEND_SYNC_GET_CLASS (backend)->modify_object_sync != NULL, UnsupportedMethod);
 
-	LOCK_WRAPPER (modify_object_sync, (backend, cal, calobj, mod, old_object, new_object, error));
+	LOCK_WRAPPER (modify_object_sync, (backend, cal, cancellable, calobj, mod, old_object, new_object, error));
 }
 
 /**
  * e_cal_backend_sync_remove_object:
  * @backend: An ECalBackendSync object.
  * @cal: An EDataCal object.
+ * @cancellable: a #GCancellable for the operation
  * @uid: UID of the object to remove.
  * @rid: Recurrence ID of the instance to remove, or NULL if removing the
  * whole object.
  * @mod: Type of removal.
  * @old_object: Placeholder for returning the old object as it was stored on the
  * backend.
- * @object: Placeholder for returning the object after it has been modified (when
+ * @new_object: Placeholder for returning the object after it has been modified (when
  * removing individual instances). If removing the whole object, this will be
  * NULL.
  * @error: Out parameter for a #GError.
  *
- * Calls the remove_object method on the given backend.
+ * Calls the remove_object_sync method on the given backend.
  */
 void
-e_cal_backend_sync_remove_object (ECalBackendSync *backend, EDataCal *cal, const gchar *uid, const gchar *rid,
-				  CalObjModType mod, gchar **old_object, gchar **object, GError **error)
+e_cal_backend_sync_remove_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid,
+				  CalObjModType mod, gchar **old_object, gchar **new_object, GError **error)
 {
 	e_return_data_cal_error_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
 	e_return_data_cal_error_if_fail (E_CAL_BACKEND_SYNC_GET_CLASS (backend)->remove_object_sync != NULL, UnsupportedMethod);
 
-	LOCK_WRAPPER (remove_object_sync, (backend, cal, uid, rid, mod, old_object, object, error));
-}
-
-/**
- * e_cal_backend_sync_discard_alarm:
- * @backend: An ECalBackendSync object.
- * @cal: An EDataCal object.
- * @uid: UID of the object to discard the alarm from.
- * @auid: UID of the alarm to be discarded.
- * @error: Out parameter for a #GError.
- *
- * Calls the discard_alarm method on the given backend.
- */
-void
-e_cal_backend_sync_discard_alarm (ECalBackendSync *backend, EDataCal *cal, const gchar *uid, const gchar *auid, GError **error)
-{
-	e_return_data_cal_error_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
-	e_return_data_cal_error_if_fail (E_CAL_BACKEND_SYNC_GET_CLASS (backend)->discard_alarm_sync != NULL, UnsupportedMethod);
-
-	LOCK_WRAPPER (discard_alarm_sync, (backend, cal, uid, auid, error));
+	LOCK_WRAPPER (remove_object_sync, (backend, cal, cancellable, uid, rid, mod, old_object, new_object, error));
 }
 
 /**
  * e_cal_backend_sync_receive_objects:
  * @backend: An ECalBackendSync object.
  * @cal: An EDataCal object.
+ * @cancellable: a #GCancellable for the operation
  * @calobj: iCalendar object to receive.
  * @error: Out parameter for a #GError.
  *
- * Calls the receive_objects method on the given backend.
+ * Calls the receive_objects_sync method on the given backend.
  */
 void
-e_cal_backend_sync_receive_objects (ECalBackendSync *backend, EDataCal *cal, const gchar *calobj, GError **error)
+e_cal_backend_sync_receive_objects (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, GError **error)
 {
 	e_return_data_cal_error_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
 	e_return_data_cal_error_if_fail (E_CAL_BACKEND_SYNC_GET_CLASS (backend)->receive_objects_sync != NULL, UnsupportedMethod);
 
-	LOCK_WRAPPER (receive_objects_sync, (backend, cal, calobj, error));
+	LOCK_WRAPPER (receive_objects_sync, (backend, cal, cancellable, calobj, error));
 }
 
 /**
  * e_cal_backend_sync_send_objects:
  * @backend: An ECalBackendSync object.
  * @cal: An EDataCal object.
+ * @cancellable: a #GCancellable for the operation
  * @calobj: The iCalendar object to send.
  * @users: List of users to send notifications to.
  * @modified_calobj: Placeholder for the iCalendar object after being modified.
  * @error: Out parameter for a #GError.
  *
- * Calls the send_objects method on the given backend.
+ * Calls the send_objects_sync method on the given backend.
  */
 void
-e_cal_backend_sync_send_objects (ECalBackendSync *backend, EDataCal *cal, const gchar *calobj, GList **users,
+e_cal_backend_sync_send_objects (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, GSList **users,
 				 gchar **modified_calobj, GError **error)
 {
 	e_return_data_cal_error_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
 	e_return_data_cal_error_if_fail (E_CAL_BACKEND_SYNC_GET_CLASS (backend)->send_objects_sync != NULL, UnsupportedMethod);
 
-	LOCK_WRAPPER (send_objects_sync, (backend, cal, calobj, users, modified_calobj, error));
-}
-
-/**
- * e_cal_backend_sync_get_default_object:
- * @backend: An ECalBackendSync object.
- * @cal: An EDataCal object.
- * @object: Placeholder for returned object.
- * @error: Out parameter for a #GError.
- *
- * Calls the get_default_object method on the given backend.
- */
-void
-e_cal_backend_sync_get_default_object (ECalBackendSync *backend, EDataCal *cal, gchar **object, GError **error)
-{
-	e_return_data_cal_error_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
-	e_return_data_cal_error_if_fail (object, InvalidArg);
-
-	LOCK_WRAPPER (get_default_object_sync, (backend, cal, object, error));
-}
-
-/**
- * e_cal_backend_sync_get_object:
- * @backend: An ECalBackendSync object.
- * @cal: An EDataCal object.
- * @uid: UID of the object to get.
- * @rid: Recurrence ID of the specific instance to get, or NULL if getting the
- * master object.
- * @object: Placeholder for returned object.
- * @error: Out parameter for a #GError.
- *
- * Calls the get_object method on the given backend.
- */
-void
-e_cal_backend_sync_get_object (ECalBackendSync *backend, EDataCal *cal, const gchar *uid, const gchar *rid, gchar **object, GError **error)
-{
-	e_return_data_cal_error_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
-	e_return_data_cal_error_if_fail (object, InvalidArg);
-
-	LOCK_WRAPPER (get_object_sync, (backend, cal, uid, rid, object, error));
-}
-
-/**
- * e_cal_backend_sync_get_object_list:
- * @backend: An ECalBackendSync object.
- * @cal: An EDataCal object.
- * @sexp: Search query.
- * @objects: Placeholder for list of returned objects.
- * @error: Out parameter for a #GError.
- *
- * Calls the get_object_list method on the given backend.
- */
-void
-e_cal_backend_sync_get_object_list (ECalBackendSync *backend, EDataCal *cal, const gchar *sexp, GList **objects, GError **error)
-{
-	e_return_data_cal_error_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
-	e_return_data_cal_error_if_fail (objects, InvalidArg);
-
-	LOCK_WRAPPER (get_object_list_sync, (backend, cal, sexp, objects, error));
+	LOCK_WRAPPER (send_objects_sync, (backend, cal, cancellable, calobj, users, modified_calobj, error));
 }
 
 /**
- * e_cal_backend_sync_get_attachment_list:
+ * e_cal_backend_sync_get_attachment_uris:
  * @backend: An ECalBackendSync object.
  * @cal: An EDataCal object.
+ * @cancellable: a #GCancellable for the operation
  * @uid: Unique id of the calendar object.
  * @rid: Recurrence id of the calendar object.
  * @attachments: Placeholder for list of returned attachment uris.
  * @error: Out parameter for a #GError.
  *
- * Calls the get_attachment_list method on the given backend.
+ * Calls the get_attachment_uris_sync method on the given backend.
  */
 void
-e_cal_backend_sync_get_attachment_list (ECalBackendSync *backend, EDataCal *cal, const gchar *uid, const gchar *rid, GSList **attachments, GError **error)
+e_cal_backend_sync_get_attachment_uris (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, GSList **attachments, GError **error)
 {
 	e_return_data_cal_error_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
 	e_return_data_cal_error_if_fail (attachments, InvalidArg);
 
-	LOCK_WRAPPER (get_attachment_list_sync, (backend, cal, uid, rid, attachments, error));
+	LOCK_WRAPPER (get_attachment_uris_sync, (backend, cal, cancellable, uid, rid, attachments, error));
 }
 
 /**
  * e_cal_backend_sync_get_timezone:
  * @backend: An ECalBackendSync object.
  * @cal: An EDataCal object.
+ * @cancellable: a #GCancellable for the operation
  * @tzid: ID of the timezone to retrieve.
- * @object: Placeholder for the returned timezone.
+ * @tzobject: Placeholder for the returned timezone.
  * @error: Out parameter for a #GError.
  *
  * Calls the get_timezone_sync method on the given backend.
@@ -418,15 +418,15 @@ e_cal_backend_sync_get_attachment_list (ECalBackendSync *backend, EDataCal *cal,
  * get_timezone_sync completely.
  */
 void
-e_cal_backend_sync_get_timezone (ECalBackendSync *backend, EDataCal *cal, const gchar *tzid, gchar **object, GError **error)
+e_cal_backend_sync_get_timezone (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *tzid, gchar **tzobject, GError **error)
 {
 	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
 
 	if (E_CAL_BACKEND_SYNC_GET_CLASS (backend)->get_timezone_sync) {
-		LOCK_WRAPPER (get_timezone_sync, (backend, cal, tzid, object, error));
+		LOCK_WRAPPER (get_timezone_sync, (backend, cal, cancellable, tzid, tzobject, error));
 	}
 
-	if (object && !*object) {
+	if (tzobject && !*tzobject) {
 		icaltimezone *zone = NULL;
 
 		if (backend->priv->mutex_lock)
@@ -445,7 +445,7 @@ e_cal_backend_sync_get_timezone (ECalBackendSync *backend, EDataCal *cal, const
 			if (!icalcomp) {
 				g_propagate_error (error, e_data_cal_create_error (InvalidObject, NULL));
 			} else {
-				*object = icalcomponent_as_ical_string_r (icalcomp);
+				*tzobject = icalcomponent_as_ical_string_r (icalcomp);
 			}
 		}
 	}
@@ -455,334 +455,246 @@ e_cal_backend_sync_get_timezone (ECalBackendSync *backend, EDataCal *cal, const
  * e_cal_backend_sync_add_timezone:
  * @backend: An ECalBackendSync object.
  * @cal: An EDataCal object.
- * @tzobj: VTIMEZONE object to be added.
- * @error: Out parameter for a #GError.
- *
- * Calls the add_timezone method on the given backend.
- */
-void
-e_cal_backend_sync_add_timezone (ECalBackendSync *backend, EDataCal *cal, const gchar *tzobj, GError **error)
-{
-	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
-
-	LOCK_WRAPPER (add_timezone_sync, (backend, cal, tzobj, error));
-}
-
-/**
- * e_cal_backend_sync_set_default_zone:
- * @backend: An ECalBackendSync object.
- * @cal: An EDataCal object.
- * @tz: Timezone object as string.
+ * @cancellable: a #GCancellable for the operation
+ * @tzobject: VTIMEZONE object to be added.
  * @error: Out parameter for a #GError.
  *
- * Calls the set_default_zone method on the given backend.
+ * Calls the add_timezone_sync method on the given backend.
  */
 void
-e_cal_backend_sync_set_default_zone (ECalBackendSync *backend, EDataCal *cal, const gchar *tz, GError **error)
+e_cal_backend_sync_add_timezone (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *tzobject, GError **error)
 {
 	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
 
-	LOCK_WRAPPER (set_default_zone_sync, (backend, cal, tz, error));
-}
-
-/**
- * e_cal_backend_sync_get_changes:
- * @backend: An ECalBackendSync object.
- * @cal: An EDataCal object.
- * @change_id: ID of the change to use as base.
- * @adds: Placeholder for list of additions.
- * @modifies: Placeholder for list of modifications.
- * @deletes: Placeholder for list of deletions.
- * @error: Out parameter for a #GError.
- *
- * Calls the get_changes method on the given backend.
- */
-void
-e_cal_backend_sync_get_changes (ECalBackendSync *backend, EDataCal *cal, const gchar *change_id,
-				GList **adds, GList **modifies, GList **deletes, GError **error)
-{
-	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
-
-	LOCK_WRAPPER (get_changes_sync, (backend, cal, change_id, adds, modifies, deletes, error));
-}
-
-/**
- * e_cal_backend_sync_get_free_busy:
- * @backend: An ECalBackendSync object.
- * @cal: An EDataCal object.
- * @users: List of users to get F/B info from.
- * @start: Time range start.
- * @end: Time range end.
- * @freebusy: Placeholder for F/B information.
- * @error: Out parameter for a #GError.
- *
- * Calls the get_free_busy method on the given backend.
- */
-void
-e_cal_backend_sync_get_free_busy (ECalBackendSync *backend, EDataCal *cal, GList *users,
-				  time_t start, time_t end, GList **freebusy, GError **error)
-{
-	e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
-
-	LOCK_WRAPPER (get_freebusy_sync, (backend, cal, users, start, end, freebusy, error));
+	LOCK_WRAPPER (add_timezone_sync, (backend, cal, cancellable, tzobject, error));
 }
 
 static void
-_e_cal_backend_is_read_only (ECalBackend *backend, EDataCal *cal)
+cal_backend_open (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, gboolean only_if_exists)
 {
 	GError *error = NULL;
-	gboolean read_only = TRUE;
 
-	e_cal_backend_sync_is_read_only (E_CAL_BACKEND_SYNC (backend), cal, &read_only, &error);
+	e_cal_backend_sync_open (E_CAL_BACKEND_SYNC (backend), cal, cancellable, only_if_exists, &error);
 
-	e_data_cal_notify_read_only (cal, error, read_only);
+	e_data_cal_respond_open (cal, opid, error);
 }
 
 static void
-_e_cal_backend_get_cal_address (ECalBackend *backend, EDataCal *cal, EServerMethodContext context)
+cal_backend_authenticate_user (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, ECredentials *credentials)
 {
 	GError *error = NULL;
-	gchar *address = NULL;
 
-	e_cal_backend_sync_get_cal_address (E_CAL_BACKEND_SYNC (backend), cal, &address, &error);
+	e_cal_backend_sync_authenticate_user (E_CAL_BACKEND_SYNC (backend), cal, cancellable, credentials, &error);
 
-	e_data_cal_notify_cal_address (cal, context, error, address);
-
-	g_free (address);
+	e_data_cal_respond_authenticate_user (cal, opid, error);
 }
 
 static void
-_e_cal_backend_get_alarm_email_address (ECalBackend *backend, EDataCal *cal, EServerMethodContext context)
+cal_backend_remove (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable)
 {
 	GError *error = NULL;
-	gchar *address = NULL;
 
-	e_cal_backend_sync_get_alarm_email_address (E_CAL_BACKEND_SYNC (backend), cal, &address, &error);
+	e_cal_backend_sync_remove (E_CAL_BACKEND_SYNC (backend), cal, cancellable, &error);
 
-	e_data_cal_notify_alarm_email_address (cal, context, error, address);
-
-	g_free (address);
+	e_data_cal_respond_remove (cal, opid, error);
 }
 
 static void
-_e_cal_backend_get_ldap_attribute (ECalBackend *backend, EDataCal *cal, EServerMethodContext context)
+cal_backend_refresh (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable)
 {
 	GError *error = NULL;
-	gchar *attribute = NULL;
 
-	e_cal_backend_sync_get_ldap_attribute (E_CAL_BACKEND_SYNC (backend), cal, &attribute, &error);
+	e_cal_backend_sync_refresh (E_CAL_BACKEND_SYNC (backend), cal, cancellable, &error);
 
-	e_data_cal_notify_ldap_attribute (cal, context, error, attribute);
-
-	g_free (attribute);
+	e_data_cal_respond_refresh (cal, opid, error);
 }
 
 static void
-_e_cal_backend_get_static_capabilities (ECalBackend *backend, EDataCal *cal, EServerMethodContext context)
+cal_backend_get_capabilities (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable)
 {
 	GError *error = NULL;
 	gchar *capabilities = NULL;
 
-	e_cal_backend_sync_get_static_capabilities (E_CAL_BACKEND_SYNC (backend), cal, &capabilities, &error);
+	e_cal_backend_sync_get_capabilities (E_CAL_BACKEND_SYNC (backend), cal, cancellable, &capabilities, &error);
 
-	e_data_cal_notify_static_capabilities (cal, context, error, capabilities);
+	e_data_cal_respond_get_capabilities (cal, opid, error, capabilities);
 
 	g_free (capabilities);
 }
 
 static void
-_e_cal_backend_open (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, gboolean only_if_exists,
-		     const gchar *username, const gchar *password)
+cal_backend_get_cal_email_address (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable)
 {
 	GError *error = NULL;
+	gchar *address = NULL;
 
-	e_cal_backend_sync_open (E_CAL_BACKEND_SYNC (backend), cal, only_if_exists, username, password, &error);
-
-	e_data_cal_notify_open (cal, context, error);
-}
-
-static void
-_e_cal_backend_refresh (ECalBackend *backend, EDataCal *cal, EServerMethodContext context)
-{
-	GError *error = NULL;
+	e_cal_backend_sync_get_cal_email_address (E_CAL_BACKEND_SYNC (backend), cal, cancellable, &address, &error);
 
-	e_cal_backend_sync_refresh (E_CAL_BACKEND_SYNC (backend), cal, &error);
+	e_data_cal_respond_get_cal_email_address (cal, opid, error, address);
 
-	e_data_cal_notify_refresh (cal, context, error);
+	g_free (address);
 }
 
 static void
-_e_cal_backend_remove (ECalBackend *backend, EDataCal *cal, EServerMethodContext context)
+cal_backend_get_alarm_email_address (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable)
 {
 	GError *error = NULL;
+	gchar *address = NULL;
+
+	e_cal_backend_sync_get_alarm_email_address (E_CAL_BACKEND_SYNC (backend), cal, cancellable, &address, &error);
 
-	e_cal_backend_sync_remove (E_CAL_BACKEND_SYNC (backend), cal, &error);
+	e_data_cal_respond_get_alarm_email_address (cal, opid, error, address);
 
-	e_data_cal_notify_remove (cal, context, error);
+	g_free (address);
 }
 
 static void
-_e_cal_backend_create_object (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *calobj)
+cal_backend_get_default_object (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable)
 {
 	GError *error = NULL;
-	gchar *uid = NULL, *modified_calobj = (gchar *) calobj;
-
-	e_cal_backend_sync_create_object (E_CAL_BACKEND_SYNC (backend), cal, &modified_calobj, &uid, &error);
+	gchar *calobj = NULL;
 
-	e_data_cal_notify_object_created (cal, context, error, uid, modified_calobj);
+	e_cal_backend_sync_get_default_object (E_CAL_BACKEND_SYNC (backend), cal, cancellable, &calobj, &error);
 
-	/* free memory */
-	if (uid)
-		g_free (uid);
+	e_data_cal_respond_get_default_object (cal, opid, error, calobj);
 
-	if (modified_calobj != calobj)
-		g_free (modified_calobj);
+	g_free (calobj);
 }
 
 static void
-_e_cal_backend_modify_object (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *calobj, CalObjModType mod)
+cal_backend_get_object (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *uid, const gchar *rid)
 {
 	GError *error = NULL;
-	gchar *old_object = NULL;
-	gchar *new_object = NULL;
+	gchar *calobj = NULL;
 
-	e_cal_backend_sync_modify_object (E_CAL_BACKEND_SYNC (backend), cal,
-						   calobj, mod, &old_object, &new_object, &error);
+	e_cal_backend_sync_get_object (E_CAL_BACKEND_SYNC (backend), cal, cancellable, uid, rid, &calobj, &error);
 
-	if (new_object)
-		e_data_cal_notify_object_modified (cal, context, error, old_object, new_object);
-	else
-		e_data_cal_notify_object_modified (cal, context, error, old_object, calobj);
+	e_data_cal_respond_get_object (cal, opid, error, calobj);
 
-	g_free (old_object);
-	g_free (new_object);
+	g_free (calobj);
 }
 
 static void
-_e_cal_backend_remove_object (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *uid, const gchar *rid, CalObjModType mod)
+cal_backend_get_object_list (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *sexp)
 {
 	GError *error = NULL;
-	gchar *object = NULL, *old_object = NULL;
-
-	e_cal_backend_sync_remove_object (E_CAL_BACKEND_SYNC (backend), cal, uid, rid, mod, &old_object, &object, &error);
-
-	if (!error) {
-		ECalComponentId *id = g_new0 (ECalComponentId, 1);
-		id->uid = g_strdup (uid);
+	GSList *calobjs = NULL;
 
-		if (mod == CALOBJ_MOD_THIS)
-			id->rid = g_strdup (rid);
+	e_cal_backend_sync_get_object_list (E_CAL_BACKEND_SYNC (backend), cal, cancellable, sexp, &calobjs, &error);
 
-		if (!object)
-			e_data_cal_notify_object_removed (cal, context, error, id, old_object, object);
-		else
-			e_data_cal_notify_object_modified (cal, context, error, old_object, object);
+	e_data_cal_respond_get_object_list (cal, opid, error, calobjs);
 
-		e_cal_component_free_id (id);
-	} else
-		e_data_cal_notify_object_removed (cal, context, error, NULL, old_object, object);
-
-	g_free (old_object);
-	g_free (object);
+	g_slist_foreach (calobjs, (GFunc) g_free, NULL);
+	g_slist_free (calobjs);
 }
 
 static void
-_e_cal_backend_discard_alarm (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *uid, const gchar *auid)
+cal_backend_get_free_busy (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const GSList *users, time_t start, time_t end)
 {
 	GError *error = NULL;
+	GSList *freebusyobjs = NULL;
 
-	e_cal_backend_sync_discard_alarm (E_CAL_BACKEND_SYNC (backend), cal, uid, auid, &error);
+	e_cal_backend_sync_get_free_busy (E_CAL_BACKEND_SYNC (backend), cal, cancellable, users, start, end, &freebusyobjs, &error);
 
-	e_data_cal_notify_alarm_discarded (cal, context, error);
+	e_data_cal_respond_get_free_busy (cal, opid, error, freebusyobjs);
+
+	g_slist_foreach (freebusyobjs, (GFunc) g_free, NULL);
+	g_slist_free (freebusyobjs);
 }
 
 static void
-_e_cal_backend_receive_objects (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *calobj)
+cal_backend_create_object (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *calobj)
 {
 	GError *error = NULL;
+	gchar *uid = NULL, *new_object = NULL;
+
+	e_cal_backend_sync_create_object (E_CAL_BACKEND_SYNC (backend), cal, cancellable, calobj, &uid, &new_object, &error);
 
-	e_cal_backend_sync_receive_objects (E_CAL_BACKEND_SYNC (backend), cal, calobj, &error);
+	e_data_cal_respond_create_object (cal, opid, error, uid, new_object ? new_object : calobj);
 
-	e_data_cal_notify_objects_received (cal, context, error);
+	g_free (uid);
+	g_free (new_object);
 }
 
 static void
-_e_cal_backend_send_objects (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *calobj)
+cal_backend_modify_object (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *calobj, CalObjModType mod)
 {
 	GError *error = NULL;
-	GList *users = NULL;
-	gchar *modified_calobj = NULL;
+	gchar *old_object = NULL, *new_object = NULL;
 
-	e_cal_backend_sync_send_objects (E_CAL_BACKEND_SYNC (backend), cal, calobj, &users, &modified_calobj, &error);
-	e_data_cal_notify_objects_sent (cal, context, error, users, modified_calobj);
+	e_cal_backend_sync_modify_object (E_CAL_BACKEND_SYNC (backend), cal, cancellable, calobj, mod, &old_object, &new_object, &error);
 
-	g_list_foreach (users, (GFunc) g_free, NULL);
-	g_list_free (users);
-	g_free (modified_calobj);
+	e_data_cal_respond_modify_object (cal, opid, error, old_object ? old_object : calobj, new_object);
+
+	g_free (old_object);
+	g_free (new_object);
 }
 
 static void
-_e_cal_backend_get_default_object (ECalBackend *backend, EDataCal *cal, EServerMethodContext context)
+cal_backend_remove_object (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *uid, const gchar *rid, CalObjModType mod)
 {
 	GError *error = NULL;
-	gchar *object = NULL;
+	gchar *old_object = NULL, *new_object = NULL;
+	ECalComponentId compid;
 
-	e_cal_backend_sync_get_default_object (E_CAL_BACKEND_SYNC (backend), cal, &object, &error);
+	compid.uid = (gchar *) uid;
+	compid.rid = (gchar *) (mod == CALOBJ_MOD_THIS ? rid : NULL);
 
-	e_data_cal_notify_default_object (cal, context, error, object);
+	e_cal_backend_sync_remove_object (E_CAL_BACKEND_SYNC (backend), cal, cancellable, uid, rid, mod, &old_object, &new_object, &error);
 
-	g_free (object);
+	e_data_cal_respond_remove_object (cal, opid, error, &compid, old_object, new_object);
+
+	g_free (old_object);
+	g_free (new_object);
 }
 
 static void
-_e_cal_backend_get_object (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *uid, const gchar *rid)
+cal_backend_receive_objects (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *calobj)
 {
 	GError *error = NULL;
-	gchar *object = NULL;
-
-	e_cal_backend_sync_get_object (E_CAL_BACKEND_SYNC (backend), cal, uid, rid, &object, &error);
 
-	e_data_cal_notify_object (cal, context, error, object);
+	e_cal_backend_sync_receive_objects (E_CAL_BACKEND_SYNC (backend), cal, cancellable, calobj, &error);
 
-	g_free (object);
+	e_data_cal_respond_receive_objects (cal, opid, error);
 }
 
 static void
-_e_cal_backend_get_attachment_list (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *uid, const gchar *rid)
+cal_backend_send_objects (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *calobj)
 {
 	GError *error = NULL;
-	GSList *list = NULL;
+	GSList *users = NULL;
+	gchar *modified_calobj = NULL;
 
-	e_cal_backend_sync_get_attachment_list (E_CAL_BACKEND_SYNC (backend), cal, uid, rid, &list, &error);
+	e_cal_backend_sync_send_objects (E_CAL_BACKEND_SYNC (backend), cal, cancellable, calobj, &users, &modified_calobj, &error);
 
-	e_data_cal_notify_attachment_list (cal, context, error, list);
+	e_data_cal_respond_send_objects (cal, opid, error, users, modified_calobj ? modified_calobj : calobj);
 
-	g_slist_foreach (list, (GFunc) g_free, NULL);
-	g_free (list);
+	g_slist_foreach (users, (GFunc) g_free, NULL);
+	g_slist_free (users);
+	g_free (modified_calobj);
 }
 
 static void
-_e_cal_backend_get_object_list (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *sexp)
+cal_backend_get_attachment_uris (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *uid, const gchar *rid)
 {
 	GError *error = NULL;
-	GList *objects = NULL, *l;
+	GSList *attachments = NULL;
 
-	e_cal_backend_sync_get_object_list (E_CAL_BACKEND_SYNC (backend), cal, sexp, &objects, &error);
+	e_cal_backend_sync_get_attachment_uris (E_CAL_BACKEND_SYNC (backend), cal, cancellable, uid, rid, &attachments, &error);
 
-	e_data_cal_notify_object_list (cal, context, error, objects);
+	e_data_cal_respond_get_attachment_uris (cal, opid, error, attachments);
 
-	for (l = objects; l; l = l->next)
-		g_free (l->data);
-	g_list_free (objects);
+	g_slist_foreach (attachments, (GFunc) g_free, NULL);
+	g_slist_free (attachments);
 }
 
 static void
-_e_cal_backend_get_timezone (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *tzid)
+cal_backend_get_timezone (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *tzid)
 {
 	GError *error = NULL;
 	gchar *object = NULL;
 
-	e_cal_backend_sync_get_timezone (E_CAL_BACKEND_SYNC (backend), cal, tzid, &object, &error);
+	e_cal_backend_sync_get_timezone (E_CAL_BACKEND_SYNC (backend), cal, cancellable, tzid, &object, &error);
 
 	if (!object && tzid) {
 		/* fallback if tzid contains only the location of timezone */
@@ -827,22 +739,22 @@ _e_cal_backend_get_timezone (ECalBackend *backend, EDataCal *cal, EServerMethodC
 
 		/* also cache this timezone to backend */
 		if (object)
-			e_cal_backend_sync_add_timezone (E_CAL_BACKEND_SYNC (backend), cal, object, NULL);
+			e_cal_backend_sync_add_timezone (E_CAL_BACKEND_SYNC (backend), cal, cancellable, object, NULL);
 	}
 
-	e_data_cal_notify_timezone_requested (cal, context, error, object);
+	e_data_cal_respond_get_timezone	 (cal, opid, error, object);
 
 	g_free (object);
 }
 
 static void
-_e_cal_backend_add_timezone (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *tzobj)
+cal_backend_add_timezone (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *tzobject)
 {
 	GError *error = NULL;
 
-	e_cal_backend_sync_add_timezone (E_CAL_BACKEND_SYNC (backend), cal, tzobj, &error);
+	e_cal_backend_sync_add_timezone (E_CAL_BACKEND_SYNC (backend), cal, cancellable, tzobject, &error);
 
-	e_data_cal_notify_timezone_added (cal, context, error, tzobj);
+	e_data_cal_respond_add_timezone (cal, opid, error);
 }
 
 /* The default implementation is looking for timezone in the ical's builtin timezones,
@@ -853,7 +765,7 @@ _e_cal_backend_add_timezone (ECalBackend *backend, EDataCal *cal, EServerMethodC
    fails, then call parent's object internal_get_timezone, and that's all.
  */
 static icaltimezone *
-_e_cal_backend_internal_get_timezone (ECalBackend *backend, const gchar *tzid)
+cal_backend_internal_get_timezone (ECalBackend *backend, const gchar *tzid)
 {
 	icaltimezone *zone = NULL;
 
@@ -886,55 +798,6 @@ _e_cal_backend_internal_get_timezone (ECalBackend *backend, const gchar *tzid)
 }
 
 static void
-_e_cal_backend_set_default_zone (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *tz)
-{
-	GError *error = NULL;
-
-	e_cal_backend_sync_set_default_zone (E_CAL_BACKEND_SYNC (backend), cal, tz, &error);
-
-	e_data_cal_notify_default_timezone_set (cal, context, error);
-}
-
-static void
-_e_cal_backend_get_changes (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *change_id)
-{
-	GError *error = NULL;
-	GList *adds = NULL, *modifies = NULL, *deletes = NULL, *l;
-
-	e_cal_backend_sync_get_changes (E_CAL_BACKEND_SYNC (backend), cal, change_id,
-					       &adds, &modifies, &deletes, &error);
-
-	e_data_cal_notify_changes (cal, context, error, adds, modifies, deletes);
-
-	for (l = adds; l; l = l->next)
-		g_free (l->data);
-	g_list_free (adds);
-
-	for (l = modifies; l; l = l->next)
-		g_free (l->data);
-	g_list_free (modifies);
-
-	for (l = deletes; l; l = l->next)
-		g_free (l->data);
-	g_list_free (deletes);
-}
-
-static void
-_e_cal_backend_get_free_busy (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, GList *users, time_t start, time_t end)
-{
-	GError *error = NULL;
-	GList *freebusy = NULL, *l;
-
-	e_cal_backend_sync_get_free_busy (E_CAL_BACKEND_SYNC (backend), cal, users, start, end, &freebusy, &error);
-
-	e_data_cal_notify_free_busy (cal, context, error, freebusy);
-
-	for (l = freebusy; l; l = l->next)
-		g_free (l->data);
-	g_list_free (freebusy);
-}
-
-static void
 e_cal_backend_sync_init (ECalBackendSync *backend)
 {
 	ECalBackendSyncPrivate *priv;
@@ -959,43 +822,37 @@ e_cal_backend_sync_dispose (GObject *object)
 		backend->priv = NULL;
 	}
 
-	G_OBJECT_CLASS (parent_class)->dispose (object);
+	G_OBJECT_CLASS (e_cal_backend_sync_parent_class)->dispose (object);
 }
 
 static void
 e_cal_backend_sync_class_init (ECalBackendSyncClass *klass)
 {
 	GObjectClass *object_class;
-	ECalBackendClass *backend_class = E_CAL_BACKEND_CLASS (klass);
-
-	parent_class = g_type_class_peek_parent (klass);
-
-	object_class = (GObjectClass *) klass;
-
-	backend_class->is_read_only = _e_cal_backend_is_read_only;
-	backend_class->get_cal_address = _e_cal_backend_get_cal_address;
-	backend_class->get_alarm_email_address = _e_cal_backend_get_alarm_email_address;
-	backend_class->get_ldap_attribute = _e_cal_backend_get_ldap_attribute;
-	backend_class->get_static_capabilities = _e_cal_backend_get_static_capabilities;
-	backend_class->open = _e_cal_backend_open;
-	backend_class->refresh = _e_cal_backend_refresh;
-	backend_class->remove = _e_cal_backend_remove;
-	backend_class->create_object = _e_cal_backend_create_object;
-	backend_class->modify_object = _e_cal_backend_modify_object;
-	backend_class->remove_object = _e_cal_backend_remove_object;
-	backend_class->discard_alarm = _e_cal_backend_discard_alarm;
-	backend_class->receive_objects = _e_cal_backend_receive_objects;
-	backend_class->send_objects = _e_cal_backend_send_objects;
-	backend_class->get_default_object = _e_cal_backend_get_default_object;
-	backend_class->get_object = _e_cal_backend_get_object;
-	backend_class->get_object_list = _e_cal_backend_get_object_list;
-	backend_class->get_attachment_list = _e_cal_backend_get_attachment_list;
-	backend_class->get_timezone = _e_cal_backend_get_timezone;
-	backend_class->add_timezone = _e_cal_backend_add_timezone;
-	backend_class->set_default_zone = _e_cal_backend_set_default_zone;
-	backend_class->get_changes = _e_cal_backend_get_changes;
-	backend_class->get_free_busy = _e_cal_backend_get_free_busy;
-	backend_class->internal_get_timezone = _e_cal_backend_internal_get_timezone;
+	ECalBackendClass *backend_class;
 
+	object_class = G_OBJECT_CLASS (klass);
 	object_class->dispose = e_cal_backend_sync_dispose;
+
+	backend_class = E_CAL_BACKEND_CLASS (klass);
+	backend_class->open			= cal_backend_open;
+	backend_class->authenticate_user	= cal_backend_authenticate_user;
+	backend_class->remove			= cal_backend_remove;
+	backend_class->refresh			= cal_backend_refresh;
+	backend_class->get_capabilities		= cal_backend_get_capabilities;
+	backend_class->get_cal_email_address	= cal_backend_get_cal_email_address;
+	backend_class->get_alarm_email_address	= cal_backend_get_alarm_email_address;
+	backend_class->get_default_object	= cal_backend_get_default_object;
+	backend_class->get_object		= cal_backend_get_object;
+	backend_class->get_object_list		= cal_backend_get_object_list;
+	backend_class->get_free_busy		= cal_backend_get_free_busy;
+	backend_class->create_object		= cal_backend_create_object;
+	backend_class->modify_object		= cal_backend_modify_object;
+	backend_class->remove_object		= cal_backend_remove_object;
+	backend_class->receive_objects		= cal_backend_receive_objects;
+	backend_class->send_objects		= cal_backend_send_objects;
+	backend_class->get_attachment_uris	= cal_backend_get_attachment_uris;
+	backend_class->get_timezone		= cal_backend_get_timezone;
+	backend_class->add_timezone		= cal_backend_add_timezone;
+	backend_class->internal_get_timezone	= cal_backend_internal_get_timezone;
 }
diff --git a/calendar/libedata-cal/e-cal-backend-sync.h b/calendar/libedata-cal/e-cal-backend-sync.h
index 5080582..1b3fec7 100644
--- a/calendar/libedata-cal/e-cal-backend-sync.h
+++ b/calendar/libedata-cal/e-cal-backend-sync.h
@@ -16,6 +16,7 @@ G_BEGIN_DECLS
 #define E_IS_CAL_BACKEND_SYNC(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_CAL_BACKEND_SYNC))
 #define E_IS_CAL_BACKEND_SYNC_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_CAL_BACKEND_SYNC))
 #define E_CAL_BACKEND_SYNC_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((k), E_TYPE_CAL_BACKEND_SYNC, ECalBackendSyncClass))
+
 typedef struct _ECalBackendSync ECalBackendSync;
 typedef struct _ECalBackendSyncClass ECalBackendSyncClass;
 typedef struct _ECalBackendSyncPrivate ECalBackendSyncPrivate;
@@ -30,177 +31,51 @@ struct _ECalBackendSyncClass {
 	ECalBackendClass parent_class;
 
 	/* Virtual methods */
-	void (*is_read_only_sync)  (ECalBackendSync *backend, EDataCal *cal, gboolean *read_only, GError **perror);
-	void (*get_cal_address_sync)  (ECalBackendSync *backend, EDataCal *cal, gchar **address, GError **perror);
-	void (*get_alarm_email_address_sync)  (ECalBackendSync *backend, EDataCal *cal, gchar **address, GError **perror);
-	void (*get_ldap_attribute_sync)  (ECalBackendSync *backend, EDataCal *cal, gchar **attribute, GError **perror);
-	void (*get_static_capabilities_sync)  (ECalBackendSync *backend, EDataCal *cal, gchar **capabilities, GError **perror);
-
-	void (*open_sync)  (ECalBackendSync *backend, EDataCal *cal, gboolean only_if_exists, const gchar *username, const gchar *password, GError **perror);
-	void (*refresh_sync)  (ECalBackendSync *backend, EDataCal *cal, GError **perror);
-	void (*remove_sync)  (ECalBackendSync *backend, EDataCal *cal, GError **perror);
-
-	void (*create_object_sync)  (ECalBackendSync *backend, EDataCal *cal, gchar **calobj, gchar **uid, GError **perror);
-	void (*modify_object_sync)  (ECalBackendSync *backend, EDataCal *cal, const gchar *calobj, CalObjModType mod, gchar **old_object, gchar **new_object, GError **perror);
-	void (*remove_object_sync)  (ECalBackendSync *backend, EDataCal *cal, const gchar *uid, const gchar *rid, CalObjModType mod, gchar **old_object, gchar **object, GError **perror);
-
-	void (*discard_alarm_sync)  (ECalBackendSync *backend, EDataCal *cal, const gchar *uid, const gchar *auid, GError **perror);
-
-	void (*receive_objects_sync)  (ECalBackendSync *backend, EDataCal *cal, const gchar *calobj, GError **perror);
-	void (*send_objects_sync)  (ECalBackendSync *backend, EDataCal *cal, const gchar *calobj, GList **users,
-						     gchar **modified_calobj, GError **perror);
-
-	void (*get_default_object_sync)  (ECalBackendSync *backend, EDataCal *cal, gchar **object, GError **perror);
-	void (*get_object_sync)  (ECalBackendSync *backend, EDataCal *cal, const gchar *uid, const gchar *rid, gchar **object, GError **perror);
-	void (*get_object_list_sync)  (ECalBackendSync *backend, EDataCal *cal, const gchar *sexp, GList **objects, GError **perror);
-
-	void (*get_attachment_list_sync)  (ECalBackendSync *backend, EDataCal *cal, const gchar *uid, const gchar *rid, GSList **attachments, GError **perror);
-
-	void (*get_timezone_sync) (ECalBackendSync *backend, EDataCal *cal, const gchar *tzid, gchar **object, GError **perror);
-	void (*add_timezone_sync) (ECalBackendSync *backend, EDataCal *cal, const gchar *tzobj, GError **perror);
-	void (*set_default_zone_sync) (ECalBackendSync *backend, EDataCal *cal, const gchar *tz, GError **perror);
-
-	void (*get_changes_sync) (ECalBackendSync *backend, EDataCal *cal, const gchar *change_id, GList **adds, GList **modifies, GList **deletes, GError **perror);
-	void (*get_freebusy_sync) (ECalBackendSync *backend, EDataCal *cal, GList *users, time_t start, time_t end, GList **freebusy, GError **perror);
-
-	/* Padding for future expansion */
-	void (*_cal_reserved0) (void);
-	void (*_cal_reserved1) (void);
-	void (*_cal_reserved2) (void);
-	void (*_cal_reserved3) (void);
-	void (*_cal_reserved4) (void);
-
+	void	(* open_sync)			(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gboolean only_if_exists, GError **error);
+	void	(* authenticate_user_sync)	(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, ECredentials *credentials, GError **error);
+	void	(* remove_sync)			(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, GError **error);
+
+	void	(* refresh_sync)		(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, GError **error);
+	void	(* get_capabilities_sync)	(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **capabilities, GError **error);
+	void	(* get_cal_email_address_sync)	(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **address, GError **error);
+	void	(* get_alarm_email_address_sync)(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **address, GError **error);
+	void	(* get_default_object_sync)	(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **calobj, GError **error);
+	void	(* get_object_sync)		(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, gchar **calobj, GError **error);
+	void	(* get_object_list_sync)	(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *sexp, GSList **calobjs, GError **error);
+	void	(* get_free_busy_sync)		(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const GSList *users, time_t start, time_t end, GSList **freebusyobjs, GError **error);
+	void	(* create_object_sync)		(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, gchar **uid, gchar **new_object, GError **error);
+	void	(* modify_object_sync)		(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, CalObjModType mod, gchar **old_object, gchar **new_object, GError **error);
+	void	(* remove_object_sync)		(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, CalObjModType mod, gchar **old_object, gchar **new_object, GError **error);
+	void	(* receive_objects_sync)	(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, GError **error);
+	void	(* send_objects_sync)		(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, GSList **users, gchar **modified_calobj, GError **error);
+	void	(* get_attachment_uris_sync)	(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, GSList **attachments, GError **error);
+	void	(* get_timezone_sync)		(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *tzid, gchar **tzobject, GError **error);
+	void	(* add_timezone_sync)		(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *tzobject, GError **error);
 };
 
-typedef ECalBackendSync * (*ECalBackendSyncFactoryFn) (void);
-GType                e_cal_backend_sync_get_type                (void);
-
-void	e_cal_backend_sync_set_lock		(ECalBackendSync *backend,
-						 gboolean lock);
-
-void	e_cal_backend_sync_is_read_only		(ECalBackendSync *backend,
-						 EDataCal *cal,
-						 gboolean *read_only,
-						 GError **error);
-void	e_cal_backend_sync_get_cal_address	(ECalBackendSync *backend,
-						 EDataCal *cal,
-						 gchar **address,
-						 GError **error);
-void	e_cal_backend_sync_get_alarm_email_address
-						(ECalBackendSync *backend,
-						 EDataCal *cal,
-						 gchar **address,
-						 GError **error);
-void	e_cal_backend_sync_get_ldap_attribute	(ECalBackendSync *backend,
-						 EDataCal *cal,
-						 gchar **attribute,
-						 GError **error);
-void	e_cal_backend_sync_get_static_capabilities
-						(ECalBackendSync *backend,
-						 EDataCal *cal,
-						 gchar **capabiliites,
-						 GError **error);
-void	e_cal_backend_sync_open			(ECalBackendSync *backend,
-						 EDataCal *cal,
-						 gboolean only_if_exists,
-						 const gchar *username,
-						 const gchar *password,
-						 GError **error);
-void	e_cal_backend_sync_refresh		(ECalBackendSync *backend,
-						 EDataCal *cal,
-						 GError **error);
-void	e_cal_backend_sync_remove		(ECalBackendSync *backend,
-						 EDataCal *cal,
-						 GError **error);
-void	e_cal_backend_sync_create_object	(ECalBackendSync *backend,
-						 EDataCal *cal,
-						 gchar **calobj,
-						 gchar **uid,
-						 GError **error);
-void	e_cal_backend_sync_modify_object	(ECalBackendSync *backend,
-						 EDataCal *cal,
-						 const gchar *calobj,
-						 CalObjModType mod,
-						 gchar **old_object,
-						 gchar **new_object,
-						 GError **error);
-void	e_cal_backend_sync_remove_object	(ECalBackendSync *backend,
-						 EDataCal *cal,
-						 const gchar *uid,
-						 const gchar *rid,
-						 CalObjModType mod,
-						 gchar **old_object,
-						 gchar **object,
-						 GError **error);
-void	e_cal_backend_sync_get_attachment_list	(ECalBackendSync *backend,
-						 EDataCal *cal,
-						 const gchar *uid,
-						 const gchar *rid,
-						 GSList **attachments,
-						 GError **error);
-
-void	e_cal_backend_sync_discard_alarm	(ECalBackendSync *backend,
-						 EDataCal *cal,
-						 const gchar *uid,
-						 const gchar *auid,
-						 GError **error);
-
-void	e_cal_backend_sync_receive_objects	(ECalBackendSync *backend,
-						 EDataCal *cal,
-						 const gchar *calobj,
-						 GError **error);
-void	e_cal_backend_sync_send_objects		(ECalBackendSync *backend,
-						 EDataCal *cal,
-						 const gchar *calobj,
-						 GList **users,
-						 gchar **modified_calobj,
-						 GError **error);
-void	e_cal_backend_sync_get_default_object	(ECalBackendSync *backend,
-						 EDataCal *cal,
-						 gchar **object,
-						 GError **error);
-
-void	e_cal_backend_sync_get_object		(ECalBackendSync *backend,
-						 EDataCal *cal,
-						 const gchar *uid,
-						 const gchar *rid,
-						 gchar **object,
-						 GError **error);
-
-void	e_cal_backend_sync_get_object_list	(ECalBackendSync *backend,
-						 EDataCal *cal,
-						 const gchar *sexp,
-						 GList **objects,
-						 GError **error);
-
-void	e_cal_backend_sync_get_timezone		(ECalBackendSync *backend,
-						 EDataCal *cal,
-						 const gchar *tzid,
-						 gchar **object,
-						 GError **error);
-void	e_cal_backend_sync_add_timezone		(ECalBackendSync *backend,
-						 EDataCal *cal,
-						 const gchar *tzobj,
-						 GError **error);
-void	e_cal_backend_sync_set_default_zone	(ECalBackendSync *backend,
-						 EDataCal *cal,
-						 const gchar *tzobj,
-						 GError **error);
-
-void	e_cal_backend_sync_get_changes		(ECalBackendSync *backend,
-						 EDataCal *cal,
-						 const gchar *change_id,
-						 GList **adds,
-						 GList **modifies,
-						 GList **deletes,
-						 GError **error);
-void	e_cal_backend_sync_get_free_busy	(ECalBackendSync *backend,
-						 EDataCal *cal,
-						 GList *users,
-						 time_t start,
-						 time_t end,
-						 GList **freebusy,
-						 GError **error);
+GType	e_cal_backend_sync_get_type		(void);
+
+void	e_cal_backend_sync_set_lock		(ECalBackendSync *backend, gboolean lock);
+
+void	e_cal_backend_sync_open			(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gboolean only_if_exists, GError **error);
+void	e_cal_backend_sync_authenticate_user	(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, ECredentials *credentials, GError **error);
+void	e_cal_backend_sync_remove		(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, GError **error);
+void	e_cal_backend_sync_refresh		(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, GError **error);
+void	e_cal_backend_sync_get_capabilities	(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **capabilities, GError **error);
+void	e_cal_backend_sync_get_cal_email_address(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **address, GError **error);
+void	e_cal_backend_sync_get_alarm_email_address(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **address, GError **error);
+void	e_cal_backend_sync_get_default_object	(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, gchar **calobj, GError **error);
+void	e_cal_backend_sync_get_object		(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, gchar **calobj, GError **error);
+void	e_cal_backend_sync_get_object_list	(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *sexp, GSList **calobjs, GError **error);
+void	e_cal_backend_sync_get_free_busy	(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const GSList *users, time_t start, time_t end, GSList **freebusyobjs, GError **error);
+void	e_cal_backend_sync_create_object	(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, gchar **uid, gchar **new_object, GError **error);
+void	e_cal_backend_sync_modify_object	(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, CalObjModType mod, gchar **old_object, gchar **new_object, GError **error);
+void	e_cal_backend_sync_remove_object	(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, CalObjModType mod, gchar **old_object, gchar **new_object, GError **error);
+void	e_cal_backend_sync_receive_objects	(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, GError **error);
+void	e_cal_backend_sync_send_objects		(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, GSList **users, gchar **modified_calobj, GError **error);
+void	e_cal_backend_sync_get_attachment_uris	(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, GSList **attachments, GError **error);
+void	e_cal_backend_sync_get_timezone		(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *tzid, gchar **tzobject, GError **error);
+void	e_cal_backend_sync_add_timezone		(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *tzobject, GError **error);
 
 G_END_DECLS
 
diff --git a/calendar/libedata-cal/e-cal-backend.c b/calendar/libedata-cal/e-cal-backend.c
index 5082ab3..55cc53f 100644
--- a/calendar/libedata-cal/e-cal-backend.c
+++ b/calendar/libedata-cal/e-cal-backend.c
@@ -31,38 +31,32 @@
 #include "e-cal-backend.h"
 #include "e-cal-backend-cache.h"
 
-/* For convenience */
-#define CLASS(backend) (E_CAL_BACKEND_GET_CLASS(backend))
-
 #define EDC_ERROR(_code) e_data_cal_create_error (_code, NULL)
 
 /* Private part of the CalBackend structure */
 struct _ECalBackendPrivate {
 	/* The source for this backend */
 	ESource *source;
+	/* The kind of components for this backend */
+	icalcomponent_kind kind;
+
+	gboolean loaded, readonly, removed, online;
 
 	/* URI, from source. This is cached, since we return const. */
 	gchar *uri;
 
 	gchar *cache_dir;
 
-	/* The kind of components for this backend */
-	icalcomponent_kind kind;
-
 	/* List of Cal objects */
 	GMutex *clients_mutex;
-	GList *clients;
+	GSList *clients;
 
-	GMutex *queries_mutex;
-	EList *queries;
+	GMutex *views_mutex;
+	GSList *views;
 
 	/* ECalBackend to pass notifications on to */
 	ECalBackend *notification_proxy;
 
-	/* used when notifying clients about progress of some operation,
-	 * we do not send multiple notifications with the same percent
-	 * value */
-	gint last_percent_notified;
 };
 
 /* Property IDs */
@@ -264,10 +258,12 @@ cal_backend_finalize (GObject *object)
 
 	g_assert (priv->clients == NULL);
 
-	g_object_unref (priv->queries);
+	g_slist_free (priv->views);
+	/* should be NULL, anyway */
+	g_slist_free (priv->clients);
 
 	g_mutex_free (priv->clients_mutex);
-	g_mutex_free (priv->queries_mutex);
+	g_mutex_free (priv->views_mutex);
 
 	g_free (priv->uri);
 	g_free (priv->cache_dir);
@@ -285,6 +281,8 @@ static void
 cal_backend_constructed (GObject *object)
 {
 	cal_backend_set_default_cache_dir (E_CAL_BACKEND (object));
+
+	G_OBJECT_CLASS (e_cal_backend_parent_class)->constructed (object);
 }
 
 static void
@@ -364,54 +362,45 @@ e_cal_backend_init (ECalBackend *backend)
 	backend->priv->clients = NULL;
 	backend->priv->clients_mutex = g_mutex_new ();
 
-	backend->priv->queries = e_list_new (
-		(EListCopyFunc) NULL,
-		(EListFreeFunc) NULL, NULL);
-	backend->priv->queries_mutex = g_mutex_new ();
+	backend->priv->views = NULL;
+	backend->priv->views_mutex = g_mutex_new ();
+
+	backend->priv->loaded = FALSE;
+	backend->priv->readonly = TRUE;
+	backend->priv->online = FALSE;
 }
 
 /**
- * e_cal_backend_get_cache_dir:
+ * e_cal_backend_get_source:
  * @backend: an #ECalBackend
  *
- * Returns the cache directory for the given backend.
- *
- * Returns: the cache directory for the backend
+ * Gets the #ESource associated with the given backend.
  *
- * Since: 2.32
- **/
-const gchar *
-e_cal_backend_get_cache_dir (ECalBackend *backend)
+ * Returns: The #ESource for the backend.
+ */
+ESource *
+e_cal_backend_get_source (ECalBackend *backend)
 {
 	g_return_val_if_fail (E_IS_CAL_BACKEND (backend), NULL);
 
-	return backend->priv->cache_dir;
+	return backend->priv->source;
 }
 
 /**
- * e_cal_backend_set_cache_dir:
+ * e_cal_backend_get_uri:
  * @backend: an #ECalBackend
- * @cache_dir: a local cache directory
  *
- * Sets the cache directory for the given backend.
- *
- * Note that #ECalBackend is initialized with a usable default based on
- * #ECalBackend:source and #ECalBackend:kind properties.  Backends should
- * not override the default without good reason.
+ * Queries the URI of a calendar backend, which must already have an open
+ * calendar.
  *
- * Since: 2.32
+ * Returns: The URI where the calendar is stored.
  **/
-void
-e_cal_backend_set_cache_dir (ECalBackend *backend,
-                             const gchar *cache_dir)
+const gchar *
+e_cal_backend_get_uri (ECalBackend *backend)
 {
-	g_return_if_fail (E_IS_CAL_BACKEND (backend));
-	g_return_if_fail (cache_dir != NULL);
-
-	g_free (backend->priv->cache_dir);
-	backend->priv->cache_dir = g_strdup (cache_dir);
+	g_return_val_if_fail (E_IS_CAL_BACKEND (backend), NULL);
 
-	g_object_notify (G_OBJECT (backend), "cache-dir");
+	return backend->priv->uri;
 }
 
 /**
@@ -431,36 +420,143 @@ e_cal_backend_get_kind (ECalBackend *backend)
 }
 
 /**
- * e_cal_backend_get_source:
+ * e_cal_backend_is_loaded:
  * @backend: an #ECalBackend
  *
- * Gets the #ESource associated with the given backend.
+ * Returns: Whether is backend already loaded.
+ **/
+gboolean
+e_cal_backend_is_loaded (ECalBackend *backend)
+{
+	g_return_val_if_fail (E_IS_CAL_BACKEND (backend), FALSE);
+
+	return backend->priv->loaded;
+}
+
+/**
+ * e_cal_backend_set_is_loaded:
+ * @backend: an #ECalBackend
  *
- * Returns: The #ESource for the backend.
- */
-ESource *
-e_cal_backend_get_source (ECalBackend *backend)
+ * Stores value for e_cal_backend_is_loaded().
+ * Meant to be used by backend implementations.
+ **/
+void
+e_cal_backend_set_is_loaded (ECalBackend *backend, gboolean is_loaded)
 {
-	g_return_val_if_fail (E_IS_CAL_BACKEND (backend), NULL);
+	g_return_if_fail (E_IS_CAL_BACKEND (backend));
 
-	return backend->priv->source;
+	backend->priv->loaded = is_loaded;
 }
 
 /**
- * e_cal_backend_get_uri:
+ * e_cal_backend_is_readonly:
  * @backend: an #ECalBackend
  *
- * Queries the URI of a calendar backend, which must already have an open
- * calendar.
+ * Returns: Whether is backend read-only. This value is the last used
+ * in a call of e_cal_backend_notify_readonly().
+ **/
+gboolean
+e_cal_backend_is_readonly (ECalBackend *backend)
+{
+	g_return_val_if_fail (E_IS_CAL_BACKEND (backend), FALSE);
+
+	return backend->priv->readonly;
+}
+
+/**
+ * e_cal_backend_is_removed:
+ * @backend: an #ECalBackend
  *
- * Returns: The URI where the calendar is stored.
+ * Checks if @backend has been removed from its physical storage.
+ *
+ * Returns: %TRUE if @backend has been removed, %FALSE otherwise.
+ **/
+gboolean
+e_cal_backend_is_removed (ECalBackend *backend)
+{
+	g_return_val_if_fail (E_IS_CAL_BACKEND (backend), FALSE);
+
+	return backend->priv->removed;
+}
+
+/**
+ * e_cal_backend_set_is_removed:
+ * @backend: an #ECalBackend
+ * @is_removed: A flag indicating whether the backend's storage was removed
+ *
+ * Sets the flag indicating whether @backend was removed to @is_removed.
+ * Meant to be used by backend implementations.
+ **/
+void
+e_cal_backend_set_is_removed (ECalBackend *backend, gboolean is_removed)
+{
+	g_return_if_fail (E_IS_CAL_BACKEND (backend));
+
+	backend->priv->removed = is_removed;
+}
+
+/**
+ * e_cal_backend_get_cache_dir:
+ * @backend: an #ECalBackend
+ *
+ * Returns the cache directory for the given backend.
+ *
+ * Returns: the cache directory for the backend
+ *
+ * Since: 2.32
  **/
 const gchar *
-e_cal_backend_get_uri (ECalBackend *backend)
+e_cal_backend_get_cache_dir (ECalBackend *backend)
 {
 	g_return_val_if_fail (E_IS_CAL_BACKEND (backend), NULL);
 
-	return backend->priv->uri;
+	return backend->priv->cache_dir;
+}
+
+/**
+ * e_cal_backend_set_cache_dir:
+ * @backend: an #ECalBackend
+ * @cache_dir: a local cache directory
+ *
+ * Sets the cache directory for the given backend.
+ *
+ * Note that #ECalBackend is initialized with a usable default based on
+ * #ECalBackend:source and #ECalBackend:kind properties.  Backends should
+ * not override the default without good reason.
+ *
+ * Since: 2.32
+ **/
+void
+e_cal_backend_set_cache_dir (ECalBackend *backend,
+                             const gchar *cache_dir)
+{
+	g_return_if_fail (E_IS_CAL_BACKEND (backend));
+	g_return_if_fail (cache_dir != NULL);
+
+	g_free (backend->priv->cache_dir);
+	backend->priv->cache_dir = g_strdup (cache_dir);
+
+	g_object_notify (G_OBJECT (backend), "cache-dir");
+}
+
+
+/**
+ * e_cal_backend_get_capabilities:
+ * @backend: an #ECalBackend
+ * @cal: an #EDataCal
+ * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
+ *
+ * Calls the get_capabilities method on the given backend.
+ */
+void
+e_cal_backend_get_capabilities (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable)
+{
+	g_return_if_fail (backend != NULL);
+	g_return_if_fail (E_IS_CAL_BACKEND (backend));
+	g_return_if_fail (E_CAL_BACKEND_GET_CLASS (backend)->get_capabilities != NULL);
+
+	(* E_CAL_BACKEND_GET_CLASS (backend)->get_capabilities) (backend, cal, opid, cancellable);
 }
 
 static void
@@ -493,7 +589,7 @@ e_cal_backend_add_client (ECalBackend *backend, EDataCal *cal)
 	g_object_weak_ref (G_OBJECT (cal), cal_destroy_cb, backend);
 
 	g_mutex_lock (priv->clients_mutex);
-	priv->clients = g_list_append (priv->clients, cal);
+	priv->clients = g_slist_append (priv->clients, cal);
 	g_mutex_unlock (priv->clients_mutex);
 }
 
@@ -517,7 +613,7 @@ e_cal_backend_remove_client_private (ECalBackend *backend, EDataCal *cal, gboole
 
 	/* Disconnect */
 	g_mutex_lock (priv->clients_mutex);
-	priv->clients = g_list_remove (priv->clients, cal);
+	priv->clients = g_slist_remove (priv->clients, cal);
 	g_mutex_unlock (priv->clients_mutex);
 
 	/* When all clients go away, notify the parent factory about it so that
@@ -541,405 +637,267 @@ e_cal_backend_remove_client (ECalBackend *backend, EDataCal *cal)
 }
 
 /**
- * e_cal_backend_add_query:
+ * e_cal_backend_add_view:
  * @backend: an #ECalBackend
- * @query: An #EDataCalView object.
+ * @view: An #EDataCalView object.
  *
- * Adds a query to the list of live queries being run by the given backend.
- * Doing so means that any listener on the query will get notified of any
- * change that affect the live query.
+ * Adds a view to the list of live views being run by the given backend.
+ * Doing so means that any listener on the view will get notified of any
+ * change that affect the live view.
  */
 void
-e_cal_backend_add_query (ECalBackend *backend, EDataCalView *query)
+e_cal_backend_add_view (ECalBackend *backend, EDataCalView *view)
 {
 	g_return_if_fail (backend != NULL);
 	g_return_if_fail (E_IS_CAL_BACKEND (backend));
 
-	g_mutex_lock (backend->priv->queries_mutex);
-
-	e_list_append (backend->priv->queries, query);
+	g_mutex_lock (backend->priv->views_mutex);
 
-	g_mutex_unlock (backend->priv->queries_mutex);
-}
-
-/**
- * e_cal_backend_get_queries:
- * @backend: an #ECalBackend
- *
- * Gets the list of live queries being run on the given backend.
- *
- * Returns: The list of live queries.
- */
-EList *
-e_cal_backend_get_queries (ECalBackend *backend)
-{
-	g_return_val_if_fail (backend != NULL, NULL);
-	g_return_val_if_fail (E_IS_CAL_BACKEND (backend), NULL);
+	backend->priv->views = g_slist_append (backend->priv->views, view);
 
-	return backend->priv->queries;
+	g_mutex_unlock (backend->priv->views_mutex);
 }
 
 /**
- * e_cal_backend_remove_query
+ * e_cal_backend_remove_view
  * @backend: an #ECalBackend
- * @query: An #EDataCalView object, previously added with @ref e_cal_backend_add_query.
+ * @view: An #EDataCalView object, previously added with @ref e_cal_backend_add_view.
  *
- * Removes query from the list of live queries for the backend.
+ * Removes view from the list of live views for the backend.
  *
  * Since: 2.24
  **/
 void
-e_cal_backend_remove_query (ECalBackend *backend, EDataCalView *query)
+e_cal_backend_remove_view (ECalBackend *backend, EDataCalView *view)
 {
 	g_return_if_fail (backend != NULL);
 	g_return_if_fail (E_IS_CAL_BACKEND (backend));
 
-	g_mutex_lock (backend->priv->queries_mutex);
+	g_mutex_lock (backend->priv->views_mutex);
 
-	e_list_remove (backend->priv->queries, query);
+	backend->priv->views = g_slist_remove (backend->priv->views, view);
 
-	g_mutex_unlock (backend->priv->queries_mutex);
+	g_mutex_unlock (backend->priv->views_mutex);
 }
 
 /**
- * e_cal_backend_get_cal_address:
+ * e_cal_backend_foreach_view:
  * @backend: an #ECalBackend
+ * @callback: callback to call
+ * @user_data: user_data passed into the @callback
  *
- * Queries the cal address associated with a calendar backend, which
- * must already have an open calendar.
+ * Calls @callback for each known calendar view of this @backend.
+ * @callback returns %FALSE to stop further processing.
  **/
 void
-e_cal_backend_get_cal_address (ECalBackend *backend, EDataCal *cal, EServerMethodContext context)
+e_cal_backend_foreach_view (ECalBackend *backend, gboolean (* callback) (EDataCalView *view, gpointer user_data), gpointer user_data)
 {
-	g_return_if_fail (backend != NULL);
-	g_return_if_fail (E_IS_CAL_BACKEND (backend));
-
-	g_assert (CLASS (backend)->get_cal_address != NULL);
-
-	g_object_ref (backend);
-
-	(* CLASS (backend)->get_cal_address) (backend, cal, context);
+	const GSList *views;
+	EDataCalView *view;
+	gboolean stop = FALSE;
 
-	g_object_unref (backend);
-}
+	g_return_if_fail (backend != NULL);
+	g_return_if_fail (callback != NULL);
 
-void
-e_cal_backend_notify_readonly (ECalBackend *backend, gboolean read_only)
-{
-	ECalBackendPrivate *priv;
-	GList *l;
+	g_mutex_lock (backend->priv->views_mutex);
 
-	priv = backend->priv;
+	for (views = backend->priv->views; views && !stop; views = views->next) {
+		view = E_DATA_CAL_VIEW (views->data);
 
-	if (priv->notification_proxy) {
-		e_cal_backend_notify_readonly (priv->notification_proxy, read_only);
-		return;
+		g_object_ref (view);
+		stop = !callback (view, user_data);
+		g_object_unref (view);
 	}
-	for (l = priv->clients; l; l = l->next)
-		e_data_cal_notify_read_only (l->data, NULL /* Success */, read_only);
+
+	g_mutex_unlock (backend->priv->views_mutex);
 }
 
+/**
+ * e_cal_backend_set_notification_proxy:
+ * @backend: an #ECalBackend
+ * @proxy: The calendar backend to act as notification proxy.
+ *
+ * Sets the backend that will act as notification proxy for the given backend.
+ */
 void
-e_cal_backend_notify_cal_address (ECalBackend *backend, EServerMethodContext context, gchar *address)
+e_cal_backend_set_notification_proxy (ECalBackend *backend, ECalBackend *proxy)
 {
-	ECalBackendPrivate *priv;
-	GList *l;
-
-	priv = backend->priv;
+	g_return_if_fail (E_IS_CAL_BACKEND (backend));
 
-	for (l = priv->clients; l; l = l->next)
-		e_data_cal_notify_cal_address (l->data, context, NULL /* Success */, address);
+	backend->priv->notification_proxy = proxy;
 }
 
 /**
- * e_cal_backend_get_alarm_email_address:
- * @backend: an #ECalBackend
- * @cal: an #EDataCal
+ * e_cal_backend_set_online:
+ * @backend: A calendar backend
+ * @is_online: Whether is online
  *
- * Calls the get_alarm_email_address method on the given backend.
+ * Sets the online mode of the calendar
  */
 void
-e_cal_backend_get_alarm_email_address (ECalBackend *backend, EDataCal *cal, EServerMethodContext context)
+e_cal_backend_set_online (ECalBackend *backend, gboolean is_online)
 {
 	g_return_if_fail (backend != NULL);
 	g_return_if_fail (E_IS_CAL_BACKEND (backend));
+	g_return_if_fail (E_CAL_BACKEND_GET_CLASS (backend)->set_online != NULL);
 
-	g_assert (CLASS (backend)->get_alarm_email_address != NULL);
-
-	g_object_ref (backend);
-
-	(* CLASS (backend)->get_alarm_email_address) (backend, cal, context);
-
-	g_object_unref (backend);
+	(* E_CAL_BACKEND_GET_CLASS (backend)->set_online) (backend, is_online);
 }
 
 /**
- *e_cal_backend_get_alarm_email_address:
+ * e_cal_backend_open:
  * @backend: an #ECalBackend
  * @cal: an #EDataCal
+ * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
+ * @only_if_exists: Whether the calendar should be opened only if it already
+ * exists.  If FALSE, a new calendar will be created when the specified @uri
+ * does not exist.
  *
- * Calls the get_ldap_attribute method of the given backend.
+ * Opens a calendar backend with data from a calendar stored at the specified
+ * URI.
  */
 void
-e_cal_backend_get_ldap_attribute (ECalBackend *backend, EDataCal *cal, EServerMethodContext context)
+e_cal_backend_open (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, gboolean only_if_exists)
 {
 	g_return_if_fail (backend != NULL);
 	g_return_if_fail (E_IS_CAL_BACKEND (backend));
+	g_return_if_fail (E_CAL_BACKEND_GET_CLASS (backend)->open != NULL);
 
-	g_assert (CLASS (backend)->get_ldap_attribute != NULL);
-
-	g_object_ref (backend);
-
-	(* CLASS (backend)->get_ldap_attribute) (backend, cal, context);
-
-	g_object_unref (backend);
+	(* E_CAL_BACKEND_GET_CLASS (backend)->open) (backend, cal, opid, cancellable, only_if_exists);
 }
 
 /**
- * e_cal_backend_get_alarm_email_address:
+ * e_cal_backend_authenticate_user:
  * @backend: an #ECalBackend
  * @cal: an #EDataCal
+ * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
+ * @opid: the ID to use for this operation
+ * @credentials: #ECredentials to use for authentication
  *
- * Calls the get_static_capabilities method on the given backend.
- */
+ * Executes an 'authenticate' request specified by @opid on @cal
+ * using @backend.
+ **/
 void
-e_cal_backend_get_static_capabilities (ECalBackend *backend, EDataCal *cal, EServerMethodContext context)
+e_cal_backend_authenticate_user (ECalBackend  *backend,
+				 EDataCal     *cal,
+				 guint32       opid,
+				 GCancellable *cancellable,
+				 ECredentials *credentials)
 {
-	g_return_if_fail (backend != NULL);
 	g_return_if_fail (E_IS_CAL_BACKEND (backend));
+	g_return_if_fail (E_IS_DATA_CAL (cal));
+	g_return_if_fail (credentials != NULL);
+	g_return_if_fail (E_CAL_BACKEND_GET_CLASS (backend)->authenticate_user);
 
-	g_assert (CLASS (backend)->get_static_capabilities != NULL);
-
-	g_object_ref (backend);
-
-	(* CLASS (backend)->get_static_capabilities) (backend, cal, context);
-
-	g_object_unref (backend);
+	(* E_CAL_BACKEND_GET_CLASS (backend)->authenticate_user) (backend, cal, opid, cancellable, credentials);
 }
 
 /**
- * e_cal_backend_open:
+ * e_cal_backend_remove:
  * @backend: an #ECalBackend
  * @cal: an #EDataCal
- * @only_if_exists: Whether the calendar should be opened only if it already
- * exists.  If FALSE, a new calendar will be created when the specified @uri
- * does not exist.
- * @username: User name to use for authentication (if needed).
- * @password: Password for @username.
+ * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
  *
- * Opens a calendar backend with data from a calendar stored at the specified
- * URI.
+ * Removes the calendar being accessed by the given backend.
  */
 void
-e_cal_backend_open (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, gboolean only_if_exists,
-		    const gchar *username, const gchar *password)
+e_cal_backend_remove (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable)
 {
 	g_return_if_fail (backend != NULL);
 	g_return_if_fail (E_IS_CAL_BACKEND (backend));
+	g_return_if_fail (E_CAL_BACKEND_GET_CLASS (backend)->remove != NULL);
 
-	g_assert (CLASS (backend)->open != NULL);
-
-	g_object_ref (backend);
-
-	(* CLASS (backend)->open) (backend, cal, context, only_if_exists, username, password);
-
-	g_object_unref (backend);
+	(* E_CAL_BACKEND_GET_CLASS (backend)->remove) (backend, cal, opid, cancellable);
 }
 
 /**
  * e_cal_backend_refresh:
  * @backend: an #ECalBackend
  * @cal: an #EDataCal
+ * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
  *
  * Refreshes the calendar being accessed by the given backend.
  *
  * Since: 2.30
  */
 void
-e_cal_backend_refresh (ECalBackend *backend, EDataCal *cal, EServerMethodContext context)
+e_cal_backend_refresh (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable)
 {
 	g_return_if_fail (backend != NULL);
 	g_return_if_fail (E_IS_CAL_BACKEND (backend));
+	g_return_if_fail (E_CAL_BACKEND_GET_CLASS (backend)->refresh != NULL);
 
-	g_assert (CLASS (backend)->refresh != NULL);
-
-	g_object_ref (backend);
-
-	(* CLASS (backend)->refresh) (backend, cal, context);
-
-	g_object_unref (backend);
+	(* E_CAL_BACKEND_GET_CLASS (backend)->refresh) (backend, cal, opid, cancellable);
 }
 
 /**
- * e_cal_backend_remove:
+ * e_cal_backend_get_cal_email_address:
  * @backend: an #ECalBackend
  * @cal: an #EDataCal
+ * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
  *
- * Removes the calendar being accessed by the given backend.
- */
+ * Queries the cal address associated with a calendar backend, which
+ * must already have an open calendar.
+ **/
 void
-e_cal_backend_remove (ECalBackend *backend, EDataCal *cal, EServerMethodContext context)
+e_cal_backend_get_cal_email_address (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable)
 {
 	g_return_if_fail (backend != NULL);
 	g_return_if_fail (E_IS_CAL_BACKEND (backend));
+	g_return_if_fail (E_CAL_BACKEND_GET_CLASS (backend)->get_cal_email_address != NULL);
 
-	g_assert (CLASS (backend)->remove != NULL);
-
-	g_object_ref (backend);
-
-	(* CLASS (backend)->remove) (backend, cal, context);
-
-	g_object_unref (backend);
+	(* E_CAL_BACKEND_GET_CLASS (backend)->get_cal_email_address) (backend, cal, opid, cancellable);
 }
 
 /**
- * e_cal_backend_is_loaded:
+ * e_cal_backend_get_alarm_email_address:
  * @backend: an #ECalBackend
+ * @cal: an #EDataCal
+ * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
  *
- * Queries whether a calendar backend has been loaded yet.
- *
- * Returns: TRUE if the backend has been loaded with data, FALSE
- * otherwise.
+ * Calls the get_alarm_email_address method on the given backend.
  */
-gboolean
-e_cal_backend_is_loaded (ECalBackend *backend)
+void
+e_cal_backend_get_alarm_email_address (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable)
 {
-	gboolean result;
-
-	g_return_val_if_fail (backend != NULL, FALSE);
-	g_return_val_if_fail (E_IS_CAL_BACKEND (backend), FALSE);
+	g_return_if_fail (backend != NULL);
+	g_return_if_fail (E_IS_CAL_BACKEND (backend));
+	g_return_if_fail (E_CAL_BACKEND_GET_CLASS (backend)->get_alarm_email_address != NULL);
 
-	g_assert (CLASS (backend)->is_loaded != NULL);
-
-	g_object_ref (backend);
-
-	result = (* CLASS (backend)->is_loaded) (backend);
-
-	g_object_unref (backend);
-
-	return result;
-}
-
-/**
- * e_cal_backend_is_read_only
- * @backend: an #ECalBackend
- * @cal: an #EDataCal
- *
- * Queries whether a calendar backend is read only or not.
- *
- */
-void
-e_cal_backend_is_read_only (ECalBackend *backend, EDataCal *cal)
-{
-	g_return_if_fail (backend != NULL);
-	g_return_if_fail (E_IS_CAL_BACKEND (backend));
-
-	g_assert (CLASS (backend)->is_read_only != NULL);
-
-	g_object_ref (backend);
-
-	(* CLASS (backend)->is_read_only) (backend, cal);
-
-	g_object_unref (backend);
-}
-
-/**
- * e_cal_backend_start_query:
- * @backend: an #ECalBackend
- * @query: The query to be started.
- *
- * Starts a new live query on the given backend.
- */
-void
-e_cal_backend_start_query (ECalBackend *backend, EDataCalView *query)
-{
-	g_return_if_fail (backend != NULL);
-	g_return_if_fail (E_IS_CAL_BACKEND (backend));
-
-	g_assert (CLASS (backend)->start_query != NULL);
-
-	g_object_ref (backend);
-
-	(* CLASS (backend)->start_query) (backend, query);
-
-	g_object_unref (backend);
-}
-
-/**
- * e_cal_backend_get_mode:
- * @backend: an #ECalBackend
- *
- * Queries whether a calendar backend is connected remotely.
- *
- * Returns: The current mode the calendar is in
- **/
-CalMode
-e_cal_backend_get_mode (ECalBackend *backend)
-{
-	CalMode result;
-
-	g_return_val_if_fail (backend != NULL, FALSE);
-	g_return_val_if_fail (E_IS_CAL_BACKEND (backend), FALSE);
-
-	g_assert (CLASS (backend)->get_mode != NULL);
-
-	g_object_ref (backend);
-
-	result = (* CLASS (backend)->get_mode) (backend);
-
-	g_object_unref (backend);
-
-	return result;
-}
-
-/**
- * e_cal_backend_set_mode:
- * @backend: A calendar backend
- * @mode: Mode to change to
- *
- * Sets the mode of the calendar
- */
-void
-e_cal_backend_set_mode (ECalBackend *backend, CalMode mode)
-{
-	g_return_if_fail (backend != NULL);
-	g_return_if_fail (E_IS_CAL_BACKEND (backend));
-
-	g_assert (CLASS (backend)->set_mode != NULL);
-
-	g_object_ref (backend);
-
-	(* CLASS (backend)->set_mode) (backend, mode);
-
-	g_object_unref (backend);
-}
+	(* E_CAL_BACKEND_GET_CLASS (backend)->get_alarm_email_address) (backend, cal, opid, cancellable);
+}
 
 /**
  * e_cal_backend_get_default_object:
  * @backend: an #ECalBackend
  * @cal: an #EDataCal
+ * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
  *
  * Calls the get_default_object method on the given backend.
  */
 void
-e_cal_backend_get_default_object (ECalBackend *backend, EDataCal *cal, EServerMethodContext context)
+e_cal_backend_get_default_object (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable)
 {
 	g_return_if_fail (backend != NULL);
 	g_return_if_fail (E_IS_CAL_BACKEND (backend));
+	g_return_if_fail (E_CAL_BACKEND_GET_CLASS (backend)->get_default_object != NULL);
 
-	g_assert (CLASS (backend)->get_default_object != NULL);
-
-	g_object_ref (backend);
-
-	(* CLASS (backend)->get_default_object) (backend, cal, context);
-
-	g_object_unref (backend);
+	(* E_CAL_BACKEND_GET_CLASS (backend)->get_default_object) (backend, cal, opid, cancellable);
 }
 
 /**
  * e_cal_backend_get_object:
  * @backend: an #ECalBackend
  * @cal: an #EDataCal
+ * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
  * @uid: Unique identifier for a calendar object.
  * @rid: ID for the object's recurrence to get.
  *
@@ -947,74 +905,42 @@ e_cal_backend_get_default_object (ECalBackend *backend, EDataCal *cal, EServerMe
  * identifier and its recurrence ID (if a recurrent appointment).
  */
 void
-e_cal_backend_get_object (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *uid, const gchar *rid)
+e_cal_backend_get_object (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *uid, const gchar *rid)
 {
 	g_return_if_fail (backend != NULL);
 	g_return_if_fail (E_IS_CAL_BACKEND (backend));
 	g_return_if_fail (uid != NULL);
+	g_return_if_fail (E_CAL_BACKEND_GET_CLASS (backend)->get_object != NULL);
 
-	g_assert (CLASS (backend)->get_object != NULL);
-
-	g_object_ref (backend);
-
-	(* CLASS (backend)->get_object) (backend, cal, context, uid, rid);
-
-	g_object_unref (backend);
+	(* E_CAL_BACKEND_GET_CLASS (backend)->get_object) (backend, cal, opid, cancellable, uid, rid);
 }
 
 /**
  * e_cal_backend_get_object_list:
  * @backend: an #ECalBackend
  * @cal: an #EDataCal
+ * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
  * @sexp: Expression to search for.
  *
  * Calls the get_object_list method on the given backend.
  */
 void
-e_cal_backend_get_object_list (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *sexp)
-{
-	g_return_if_fail (backend != NULL);
-	g_return_if_fail (E_IS_CAL_BACKEND (backend));
-
-	g_assert (CLASS (backend)->get_object_list != NULL);
-
-	g_object_ref (backend);
-
-	(* CLASS (backend)->get_object_list) (backend, cal, context, sexp);
-
-	g_object_unref (backend);
-}
-
-/**
- * e_cal_backend_get_attachment_list:
- * @backend: an #ECalBackend
- * @cal: an #EDataCal
- * @uid: Unique identifier for a calendar object.
- * @rid: ID for the object's recurrence to get.
- *
- * Queries a calendar backend for attachments present in a calendar object based
- * on its unique identifier and its recurrence ID (if a recurrent appointment).
- */
-void
-e_cal_backend_get_attachment_list (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *uid, const gchar *rid)
+e_cal_backend_get_object_list (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *sexp)
 {
 	g_return_if_fail (backend != NULL);
 	g_return_if_fail (E_IS_CAL_BACKEND (backend));
-	g_return_if_fail (uid != NULL);
-
-	g_assert (CLASS (backend)->get_object != NULL);
+	g_return_if_fail (E_CAL_BACKEND_GET_CLASS (backend)->get_object_list != NULL);
 
-	g_object_ref (backend);
-
-	(* CLASS (backend)->get_attachment_list) (backend, cal, context, uid, rid);
-
-	g_object_unref (backend);
+	(* E_CAL_BACKEND_GET_CLASS (backend)->get_object_list) (backend, cal, opid, cancellable, sexp);
 }
 
 /**
  * e_cal_backend_get_free_busy:
  * @backend: an #ECalBackend
  * @cal: an #EDataCal
+ * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
  * @users: List of users to get free/busy information for.
  * @start: Start time for query.
  * @end: End time for query.
@@ -1022,51 +948,23 @@ e_cal_backend_get_attachment_list (ECalBackend *backend, EDataCal *cal, EServerM
  * Gets a free/busy object for the given time interval
  */
 void
-e_cal_backend_get_free_busy (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, GList *users, time_t start, time_t end)
+e_cal_backend_get_free_busy (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const GSList *users, time_t start, time_t end)
 {
 	g_return_if_fail (backend != NULL);
 	g_return_if_fail (E_IS_CAL_BACKEND (backend));
 	g_return_if_fail (start != -1 && end != -1);
 	g_return_if_fail (start <= end);
+	g_return_if_fail (E_CAL_BACKEND_GET_CLASS (backend)->get_free_busy != NULL);
 
-	g_assert (CLASS (backend)->get_free_busy != NULL);
-
-	g_object_ref (backend);
-
-	(* CLASS (backend)->get_free_busy) (backend, cal, context, users, start, end);
-
-	g_object_unref (backend);
-}
-
-/**
- * e_cal_backend_get_changes:
- * @backend: an #ECalBackend
- * @cal: an #EDataCal
- * @change_id: A unique uid for the callers change list
- *
- * Builds a sequence of objects and the type of change that occurred on them since
- * the last time the give change_id was seen
- */
-void
-e_cal_backend_get_changes (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *change_id)
-{
-	g_return_if_fail (backend != NULL);
-	g_return_if_fail (E_IS_CAL_BACKEND (backend));
-	g_return_if_fail (change_id != NULL);
-
-	g_assert (CLASS (backend)->get_changes != NULL);
-
-	g_object_ref (backend);
-
-	(* CLASS (backend)->get_changes) (backend, cal, context, change_id);
-
-	g_object_unref (backend);
+	(* E_CAL_BACKEND_GET_CLASS (backend)->get_free_busy) (backend, cal, opid, cancellable, users, start, end);
 }
 
 /**
  * e_cal_backend_discard_alarm
  * @backend: an #ECalBackend
  * @cal: an #EDataCal
+ * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
  * @uid: UID of the component to discard the alarm from.
  * @auid: Alarm ID.
  *
@@ -1074,77 +972,70 @@ e_cal_backend_get_changes (ECalBackend *backend, EDataCal *cal, EServerMethodCon
  * to do whatever is needed to really discard the alarm.
  */
 void
-e_cal_backend_discard_alarm (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *uid, const gchar *auid)
+e_cal_backend_discard_alarm (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *uid, const gchar *auid)
 {
 	g_return_if_fail (backend != NULL);
 	g_return_if_fail (E_IS_CAL_BACKEND (backend));
 	g_return_if_fail (uid != NULL);
 	g_return_if_fail (auid != NULL);
+	g_return_if_fail (E_CAL_BACKEND_GET_CLASS (backend)->discard_alarm != NULL);
 
-	g_assert (CLASS (backend)->discard_alarm != NULL);
-
-	g_object_ref (backend);
-
-	(* CLASS (backend)->discard_alarm) (backend, cal, context, uid, auid);
-
-	g_object_unref (backend);
+	(* E_CAL_BACKEND_GET_CLASS (backend)->discard_alarm) (backend, cal, opid, cancellable, uid, auid);
 }
 
 /**
  * e_cal_backend_create_object:
  * @backend: an #ECalBackend
  * @cal: an #EDataCal
+ * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
  * @calobj: The object to create.
  *
  * Calls the create_object method on the given backend.
  */
 void
-e_cal_backend_create_object (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *calobj)
+e_cal_backend_create_object (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *calobj)
 {
 	g_return_if_fail (backend != NULL);
 	g_return_if_fail (E_IS_CAL_BACKEND (backend));
 	g_return_if_fail (calobj != NULL);
 
-	g_object_ref (backend);
-
-	if (CLASS (backend)->create_object)
-		(* CLASS (backend)->create_object) (backend, cal, context, calobj);
+	if (E_CAL_BACKEND_GET_CLASS (backend)->create_object)
+		(* E_CAL_BACKEND_GET_CLASS (backend)->create_object) (backend, cal, opid, cancellable, calobj);
 	else
-		e_data_cal_notify_object_created (cal, context, EDC_ERROR (UnsupportedMethod), NULL, NULL);
-
-	g_object_unref (backend);
+		e_data_cal_respond_create_object (cal, opid, EDC_ERROR (UnsupportedMethod), NULL, NULL);
 }
 
 /**
  * e_cal_backend_modify_object:
  * @backend: an #ECalBackend
  * @cal: an #EDataCal
+ * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
  * @calobj: Object to be modified.
  * @mod: Type of modification.
  *
  * Calls the modify_object method on the given backend.
  */
 void
-e_cal_backend_modify_object (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *calobj, CalObjModType mod)
+e_cal_backend_modify_object (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *calobj, CalObjModType mod)
 {
 	g_return_if_fail (backend != NULL);
 	g_return_if_fail (E_IS_CAL_BACKEND (backend));
 	g_return_if_fail (calobj != NULL);
 
-	g_object_ref (backend);
-
-	if (CLASS (backend)->modify_object)
-		(* CLASS (backend)->modify_object) (backend, cal, context, calobj, mod);
+	if (E_CAL_BACKEND_GET_CLASS (backend)->modify_object)
+		(* E_CAL_BACKEND_GET_CLASS (backend)->modify_object) (backend, cal, opid, cancellable, calobj, mod);
 	else
-		e_data_cal_notify_object_removed (cal, context, EDC_ERROR (UnsupportedMethod), NULL, NULL, NULL);
-
-	g_object_unref (backend);
+		e_data_cal_respond_modify_object (cal, opid, EDC_ERROR (UnsupportedMethod), NULL, NULL);
 }
 
 /**
  * e_cal_backend_remove_object:
  * @backend: an #ECalBackend
  * @cal: an #EDataCal
+ * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
  * @uid: Unique identifier of the object to remove.
  * @rid: A recurrence ID.
  * @mod: Type of removal.
@@ -1153,205 +1044,184 @@ e_cal_backend_modify_object (ECalBackend *backend, EDataCal *cal, EServerMethodC
  * clients about the change.
  */
 void
-e_cal_backend_remove_object (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *uid, const gchar *rid, CalObjModType mod)
+e_cal_backend_remove_object (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *uid, const gchar *rid, CalObjModType mod)
 {
 	g_return_if_fail (backend != NULL);
 	g_return_if_fail (E_IS_CAL_BACKEND (backend));
 	g_return_if_fail (uid != NULL);
+	g_return_if_fail (E_CAL_BACKEND_GET_CLASS (backend)->remove_object != NULL);
 
-	g_assert (CLASS (backend)->remove_object != NULL);
-
-	g_object_ref (backend);
-
-	(* CLASS (backend)->remove_object) (backend, cal, context, uid, rid, mod);
-
-	g_object_unref (backend);
+	(* E_CAL_BACKEND_GET_CLASS (backend)->remove_object) (backend, cal, opid, cancellable, uid, rid, mod);
 }
 
 /**
  * e_cal_backend_receive_objects:
  * @backend: an #ECalBackend
  * @cal: an #EDataCal
+ * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
  * @calobj: iCalendar object.
  *
  * Calls the receive_objects method on the given backend.
  */
 void
-e_cal_backend_receive_objects (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *calobj)
+e_cal_backend_receive_objects (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *calobj)
 {
 	g_return_if_fail (backend != NULL);
 	g_return_if_fail (E_IS_CAL_BACKEND (backend));
 	g_return_if_fail (calobj != NULL);
+	g_return_if_fail (E_CAL_BACKEND_GET_CLASS (backend)->receive_objects != NULL);
 
-	g_assert (CLASS (backend)->receive_objects != NULL);
-
-	g_object_ref (backend);
-
-	(* CLASS (backend)->receive_objects) (backend, cal, context, calobj);
-
-	g_object_unref (backend);
+	(* E_CAL_BACKEND_GET_CLASS (backend)->receive_objects) (backend, cal, opid, cancellable, calobj);
 }
 
 /**
  * e_cal_backend_send_objects:
  * @backend: an #ECalBackend
  * @cal: an #EDataCal
+ * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
  * @calobj: iCalendar object to be sent.
  *
  * Calls the send_objects method on the given backend.
  */
 void
-e_cal_backend_send_objects (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *calobj)
+e_cal_backend_send_objects (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *calobj)
 {
 	g_return_if_fail (backend != NULL);
 	g_return_if_fail (E_IS_CAL_BACKEND (backend));
 	g_return_if_fail (calobj != NULL);
+	g_return_if_fail (E_CAL_BACKEND_GET_CLASS (backend)->send_objects != NULL);
 
-	g_assert (CLASS (backend)->send_objects != NULL);
-
-	g_object_ref (backend);
-
-	(* CLASS (backend)->send_objects) (backend, cal, context, calobj);
-
-	g_object_unref (backend);
+	(* E_CAL_BACKEND_GET_CLASS (backend)->send_objects) (backend, cal, opid, cancellable, calobj);
 }
 
 /**
- * e_cal_backend_get_timezone:
+ * e_cal_backend_get_attachment_uris:
  * @backend: an #ECalBackend
  * @cal: an #EDataCal
- * @tzid: Unique identifier of a VTIMEZONE object. Note that this must not be
- * NULL.
+ * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
+ * @uid: Unique identifier for a calendar object.
+ * @rid: ID for the object's recurrence to get.
  *
- * Returns the icaltimezone* corresponding to the TZID, or NULL if the TZID
- * can't be found.
+ * Queries a calendar backend for attachments present in a calendar object based
+ * on its unique identifier and its recurrence ID (if a recurrent appointment).
  */
 void
-e_cal_backend_get_timezone (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *tzid)
+e_cal_backend_get_attachment_uris (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *uid, const gchar *rid)
 {
 	g_return_if_fail (backend != NULL);
 	g_return_if_fail (E_IS_CAL_BACKEND (backend));
-	g_return_if_fail (tzid != NULL);
-
-	g_assert (CLASS (backend)->get_timezone != NULL);
-
-	g_object_ref (backend);
-
-	(* CLASS (backend)->get_timezone) (backend, cal, context, tzid);
+	g_return_if_fail (uid != NULL);
+	g_return_if_fail (E_CAL_BACKEND_GET_CLASS (backend)->get_attachment_uris != NULL);
 
-	g_object_unref (backend);
+	(* E_CAL_BACKEND_GET_CLASS (backend)->get_attachment_uris) (backend, cal, opid, cancellable, uid, rid);
 }
 
 /**
- * e_cal_backend_set_default_zone:
+ * e_cal_backend_get_timezone:
  * @backend: an #ECalBackend
  * @cal: an #EDataCal
- * @tzobj: The timezone object, in a string.
+ * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
+ * @tzid: Unique identifier of a VTIMEZONE object. Note that this must not be
+ * NULL.
  *
- * Sets the default timezone for the calendar, which is used to resolve
- * DATE and floating DATE-TIME values.
+ * Returns the icaltimezone* corresponding to the TZID, or NULL if the TZID
+ * can't be found.
  */
 void
-e_cal_backend_set_default_zone (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *tzobj)
+e_cal_backend_get_timezone (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *tzid)
 {
 	g_return_if_fail (backend != NULL);
 	g_return_if_fail (E_IS_CAL_BACKEND (backend));
-	g_return_if_fail (tzobj != NULL);
-
-	g_object_ref (backend);
-
-	(* CLASS (backend)->set_default_zone) (backend, cal, context, tzobj);
+	g_return_if_fail (tzid != NULL);
+	g_return_if_fail (E_CAL_BACKEND_GET_CLASS (backend)->get_timezone != NULL);
 
-	g_object_unref (backend);
+	(* E_CAL_BACKEND_GET_CLASS (backend)->get_timezone) (backend, cal, opid, cancellable, tzid);
 }
 
 /**
  * e_cal_backend_add_timezone
  * @backend: an #ECalBackend
  * @cal: an #EDataCal
+ * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
  * @tzobj: The timezone object, in a string.
  *
  * Add a timezone object to the given backend.
  */
 void
-e_cal_backend_add_timezone (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *tzobj)
+e_cal_backend_add_timezone (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *tzobject)
 {
 	g_return_if_fail (E_IS_CAL_BACKEND (backend));
-	g_return_if_fail (tzobj != NULL);
-	g_return_if_fail (CLASS (backend)->add_timezone != NULL);
-
-	g_object_ref (backend);
-
-	(* CLASS (backend)->add_timezone) (backend, cal, context, tzobj);
+	g_return_if_fail (tzobject != NULL);
+	g_return_if_fail (E_CAL_BACKEND_GET_CLASS (backend)->add_timezone != NULL);
 
-	g_object_unref (backend);
+	(* E_CAL_BACKEND_GET_CLASS (backend)->add_timezone) (backend, cal, opid, cancellable, tzobject);
 }
 
 /**
- * e_cal_backend_internal_get_default_timezone:
+ * e_cal_backend_internal_get_timezone:
  * @backend: an #ECalBackend
+ * @tzid: ID of the timezone to get.
  *
- * Calls the internal_get_default_timezone method on the given backend.
+ * Calls the internal_get_timezone method on the given backend.
  */
 icaltimezone *
-e_cal_backend_internal_get_default_timezone (ECalBackend *backend)
+e_cal_backend_internal_get_timezone (ECalBackend *backend, const gchar *tzid)
 {
-	icaltimezone *timezone;
-
 	g_return_val_if_fail (E_IS_CAL_BACKEND (backend), NULL);
-	g_return_val_if_fail (CLASS (backend)->internal_get_default_timezone != NULL, NULL);
-
-	g_object_ref (backend);
-
-	timezone = (* CLASS (backend)->internal_get_default_timezone) (backend);
-
-	g_object_unref (backend);
+	g_return_val_if_fail (tzid != NULL, NULL);
+	g_return_val_if_fail (E_CAL_BACKEND_GET_CLASS (backend)->internal_get_timezone != NULL, NULL);
 
-	return timezone;
+	return (* E_CAL_BACKEND_GET_CLASS (backend)->internal_get_timezone) (backend, tzid);
 }
 
 /**
- * e_cal_backend_internal_get_timezone:
+ * e_cal_backend_start_view:
  * @backend: an #ECalBackend
- * @tzid: ID of the timezone to get.
+ * @view: The view to be started.
  *
- * Calls the internal_get_timezone method on the given backend.
+ * Starts a new live view on the given backend.
  */
-icaltimezone *
-e_cal_backend_internal_get_timezone (ECalBackend *backend, const gchar *tzid)
+void
+e_cal_backend_start_view (ECalBackend *backend, EDataCalView *view)
 {
-	icaltimezone *timezone;
-
-	g_return_val_if_fail (E_IS_CAL_BACKEND (backend), NULL);
-	g_return_val_if_fail (tzid != NULL, NULL);
-	g_return_val_if_fail (CLASS (backend)->internal_get_timezone != NULL, NULL);
-
-	g_object_ref (backend);
-
-	timezone = (* CLASS (backend)->internal_get_timezone) (backend, tzid);
-
-	g_object_unref (backend);
+	g_return_if_fail (backend != NULL);
+	g_return_if_fail (E_IS_CAL_BACKEND (backend));
+	g_return_if_fail (E_CAL_BACKEND_GET_CLASS (backend)->start_view != NULL);
 
-	return timezone;
+	(* E_CAL_BACKEND_GET_CLASS (backend)->start_view) (backend, view);
 }
 
 /**
- * e_cal_backend_set_notification_proxy:
+ * e_cal_backend_stop_view:
  * @backend: an #ECalBackend
- * @proxy: The calendar backend to act as notification proxy.
+ * @view: The view to be stopped.
  *
- * Sets the backend that will act as notification proxy for the given backend.
+ * Stops a previously started live view on the given backend.
+ *
+ * Since: 3.2
  */
 void
-e_cal_backend_set_notification_proxy (ECalBackend *backend, ECalBackend *proxy)
+e_cal_backend_stop_view (ECalBackend *backend, EDataCalView *view)
 {
-	ECalBackendPrivate *priv;
-
+	g_return_if_fail (backend != NULL);
 	g_return_if_fail (E_IS_CAL_BACKEND (backend));
+	g_return_if_fail (E_CAL_BACKEND_GET_CLASS (backend)->stop_view != NULL);
 
-	priv = backend->priv;
+	(* E_CAL_BACKEND_GET_CLASS (backend)->stop_view) (backend, view);
+}
+
+static gboolean
+object_created_cb (EDataCalView *view, gpointer calobj)
+{
+	if (e_data_cal_view_object_matches (view, calobj))
+		e_data_cal_view_notify_objects_added_1 (view, calobj);
 
-	priv->notification_proxy = proxy;
+	return TRUE;
 }
 
 /**
@@ -1369,9 +1239,6 @@ void
 e_cal_backend_notify_object_created (ECalBackend *backend, const gchar *calobj)
 {
 	ECalBackendPrivate *priv;
-	EList *queries;
-	EIterator *iter;
-	EDataCalView *query;
 
 	priv = backend->priv;
 
@@ -1380,35 +1247,33 @@ e_cal_backend_notify_object_created (ECalBackend *backend, const gchar *calobj)
 		return;
 	}
 
-	queries = e_cal_backend_get_queries (backend);
-	iter = e_list_get_iterator (queries);
-
-	while (e_iterator_is_valid (iter)) {
-		query = QUERY (e_iterator_get (iter));
-
-		g_object_ref (query);
-		if (e_data_cal_view_object_matches (query, calobj))
-			e_data_cal_view_notify_objects_added_1 (query, calobj);
-		g_object_unref (query);
+	e_cal_backend_foreach_view (backend, object_created_cb, (gpointer) calobj);
+}
 
-		e_iterator_next (iter);
-	}
-	g_object_unref (iter);
+/**
+ * e_cal_backend_notify_objects_added:
+ *
+ * Since: 2.24
+ **/
+void
+e_cal_backend_notify_objects_added (ECalBackend *backend, EDataCalView *view, const GSList *objects)
+{
+	e_data_cal_view_notify_objects_added (view, objects);
 }
 
 static void
-match_query_and_notify (EDataCalView *query, const gchar *old_object, const gchar *object)
+match_view_and_notify (EDataCalView *view, const gchar *old_object, const gchar *object)
 {
 	gboolean old_match = FALSE, new_match = FALSE;
 
 	if (old_object)
-		old_match = e_data_cal_view_object_matches (query, old_object);
+		old_match = e_data_cal_view_object_matches (view, old_object);
 
-	new_match = e_data_cal_view_object_matches (query, object);
+	new_match = e_data_cal_view_object_matches (view, object);
 	if (old_match && new_match)
-		e_data_cal_view_notify_objects_modified_1 (query, object);
+		e_data_cal_view_notify_objects_modified_1 (view, object);
 	else if (new_match)
-		e_data_cal_view_notify_objects_added_1 (query, object);
+		e_data_cal_view_notify_objects_added_1 (view, object);
 	else if (old_match) {
 		ECalComponent *comp = NULL;
 
@@ -1416,7 +1281,7 @@ match_query_and_notify (EDataCalView *query, const gchar *old_object, const gcha
 		if (comp) {
 			ECalComponentId *id = e_cal_component_get_id (comp);
 
-			e_data_cal_view_notify_objects_removed_1 (query, id);
+			e_data_cal_view_notify_objects_removed_1 (view, id);
 
 			e_cal_component_free_id (id);
 			g_object_unref (comp);
@@ -1424,107 +1289,22 @@ match_query_and_notify (EDataCalView *query, const gchar *old_object, const gcha
 	}
 }
 
-/**
- * e_cal_backend_notify_view_progress_start
- * @backend: an #ECalBackend
- *
- * This methods has to be used before e_cal_backend_notify_view_progress.
- * Sets last notified percent value to 0.
- *
- * Since: 2.24
- **/
-void
-e_cal_backend_notify_view_progress_start (ECalBackend *backend)
-{
-	ECalBackendPrivate *priv;
-
-	priv = backend->priv;
-
-	priv->last_percent_notified = 0;
-}
-
-/**
- * e_cal_backend_notify_view_progress:
- * @backend: an #ECalBackend
- * @message: the UID of the removed object
- * @percent: percentage of the objects loaded in the view
- *
- * Notifies each of the backend's listeners about the view_progress in downloading the items.
- **/
-void
-e_cal_backend_notify_view_progress (ECalBackend *backend, const gchar *message, gint percent)
-{
-	ECalBackendPrivate *priv;
-	EList *queries;
-	EIterator *iter;
-	EDataCalView *query;
-
-	priv = backend->priv;
-
-	if (percent <= priv->last_percent_notified)
-		return;
-
-	priv->last_percent_notified = percent;
-
-	if (priv->notification_proxy) {
-		e_cal_backend_notify_view_progress (priv->notification_proxy, message, percent);
-		return;
-	}
-
-	queries = e_cal_backend_get_queries (backend);
-	iter = e_list_get_iterator (queries);
-
-	while (e_iterator_is_valid (iter)) {
-		query = QUERY (e_iterator_get (iter));
-
-		g_object_ref (query);
-
-		e_data_cal_view_notify_progress (query, message, percent);
-
-		g_object_unref (query);
-
-		e_iterator_next (iter);
-	}
-	g_object_unref (iter);
-}
+struct call_data {
+	const gchar *old_object;
+	const gchar *object;
+	const ECalComponentId *id;
+};
 
-/**
- * e_cal_backend_notify_view_done:
- * @backend: an #ECalBackend
- * @error: returns the error, if any, once the view is fully populated.
- *
- * Notifies each of the backend's listeners about the view_done in downloading the items.
- **/
-void
-e_cal_backend_notify_view_done (ECalBackend *backend, const GError *error)
+static gboolean
+call_match_and_notify (EDataCalView *view, gpointer user_data)
 {
-	ECalBackendPrivate *priv;
-	EList *queries;
-	EIterator *iter;
-	EDataCalView *query;
+	struct call_data *cd = user_data;
 
-	priv = backend->priv;
+	g_return_val_if_fail (user_data != NULL, FALSE);
 
-	if (priv->notification_proxy) {
-		e_cal_backend_notify_view_done (priv->notification_proxy, error);
-		return;
-	}
-
-	queries = e_cal_backend_get_queries (backend);
-	iter = e_list_get_iterator (queries);
-
-	while (e_iterator_is_valid (iter)) {
-		query = QUERY (e_iterator_get (iter));
-
-		g_object_ref (query);
+	match_view_and_notify (view, cd->old_object, cd->object);
 
-		e_data_cal_view_notify_done (query, error);
-
-		g_object_unref (query);
-
-		e_iterator_next (iter);
-	}
-	g_object_unref (iter);
+	return TRUE;
 }
 
 /**
@@ -1540,13 +1320,10 @@ e_cal_backend_notify_view_done (ECalBackend *backend, const GError *error)
  * modified by non-EDS clients.
  **/
 void
-e_cal_backend_notify_object_modified (ECalBackend *backend,
-				      const gchar *old_object, const gchar *object)
+e_cal_backend_notify_object_modified (ECalBackend *backend, const gchar *old_object, const gchar *object)
 {
 	ECalBackendPrivate *priv;
-	EList *queries;
-	EIterator *iter;
-	EDataCalView *query;
+	struct call_data cd;
 
 	priv = backend->priv;
 
@@ -1555,19 +1332,40 @@ e_cal_backend_notify_object_modified (ECalBackend *backend,
 		return;
 	}
 
-	queries = e_cal_backend_get_queries (backend);
-	iter = e_list_get_iterator (queries);
+	cd.old_object = old_object;
+	cd.object = object;
+	cd.id = NULL;
 
-	while (e_iterator_is_valid (iter)) {
-		query = QUERY (e_iterator_get (iter));
+	e_cal_backend_foreach_view (backend, call_match_and_notify, &cd);
+}
 
-		g_object_ref (query);
-		match_query_and_notify (query, old_object, object);
-		g_object_unref (query);
+/**
+ * e_cal_backend_notify_objects_modified:
+ *
+ * Since: 2.24
+ **/
+void
+e_cal_backend_notify_objects_modified (ECalBackend *backend, EDataCalView *view, const GSList *objects)
+{
+	e_data_cal_view_notify_objects_modified (view, objects);
+}
 
-		e_iterator_next (iter);
-	}
-	g_object_unref (iter);
+static gboolean
+object_removed_cb (EDataCalView *view, gpointer user_data)
+{
+	struct call_data *cd = user_data;
+
+	g_return_val_if_fail (user_data != NULL, FALSE);
+
+	if (cd->object == NULL) {
+		/* if object == NULL, it means the object has been completely
+		   removed from the backend */
+		if (!cd->old_object || e_data_cal_view_object_matches (view, cd->old_object))
+			e_data_cal_view_notify_objects_removed_1 (view, cd->id);
+	} else
+		match_view_and_notify (view, cd->old_object, cd->object);
+
+	return TRUE;
 }
 
 /**
@@ -1590,9 +1388,7 @@ e_cal_backend_notify_object_removed (ECalBackend *backend, const ECalComponentId
 				     const gchar *old_object, const gchar *object)
 {
 	ECalBackendPrivate *priv;
-	EList *queries;
-	EIterator *iter;
-	EDataCalView *query;
+	struct call_data cd;
 
 	priv = backend->priv;
 
@@ -1601,38 +1397,11 @@ e_cal_backend_notify_object_removed (ECalBackend *backend, const ECalComponentId
 		return;
 	}
 
-	queries = e_cal_backend_get_queries (backend);
-	iter = e_list_get_iterator (queries);
-
-	while (e_iterator_is_valid (iter)) {
-		query = QUERY (e_iterator_get (iter));
-
-		g_object_ref (query);
-
-		if (object == NULL) {
-			/* if object == NULL, it means the object has been completely
-			   removed from the backend */
-			if (!old_object || e_data_cal_view_object_matches (query, old_object))
-				e_data_cal_view_notify_objects_removed_1 (query, id);
-		} else
-			match_query_and_notify (query, old_object, object);
-
-		g_object_unref (query);
+	cd.old_object = old_object;
+	cd.object = object;
+	cd.id = id;
 
-		e_iterator_next (iter);
-	}
-	g_object_unref (iter);
-}
-
-/**
- * e_cal_backend_notify_objects_added:
- *
- * Since: 2.24
- **/
-void
-e_cal_backend_notify_objects_added (ECalBackend *backend, EDataCalView *query, const GList *objects)
-{
-	e_data_cal_view_notify_objects_added (query, objects);
+	e_cal_backend_foreach_view (backend, object_removed_cb, &cd);
 }
 
 /**
@@ -1641,85 +1410,126 @@ e_cal_backend_notify_objects_added (ECalBackend *backend, EDataCalView *query, c
  * Since: 2.24
  **/
 void
-e_cal_backend_notify_objects_removed (ECalBackend *backend, EDataCalView *query, const GList *ids)
+e_cal_backend_notify_objects_removed (ECalBackend *backend, EDataCalView *view, const GSList *ids)
 {
-	e_data_cal_view_notify_objects_removed (query, ids);
+	e_data_cal_view_notify_objects_removed (view, ids);
 }
 
 /**
- * e_cal_backend_notify_objects_modified:
+ * e_cal_backend_notify_error:
+ * @backend: an #ECalBackend
+ * @message: Error message
  *
- * Since: 2.24
+ * Notifies each of the backend's listeners about an error
  **/
 void
-e_cal_backend_notify_objects_modified (ECalBackend *backend, EDataCalView *query, const GList *objects)
+e_cal_backend_notify_error (ECalBackend *backend, const gchar *message)
 {
-	e_data_cal_view_notify_objects_modified (query, objects);
+	ECalBackendPrivate *priv = backend->priv;
+	GSList *l;
+
+	if (priv->notification_proxy) {
+		e_cal_backend_notify_error (priv->notification_proxy, message);
+		return;
+	}
+
+	g_mutex_lock (priv->clients_mutex);
+
+	for (l = priv->clients; l; l = l->next)
+		e_data_cal_report_error (l->data, message);
+
+	g_mutex_unlock (priv->clients_mutex);
 }
 
 /**
- * e_cal_backend_notify_mode:
+ * e_cal_backend_notify_readonly:
  * @backend: an #ECalBackend
- * @status: Status of the mode set
- * @mode: the current mode
+ * @is_readonly: flag indicating readonly status
  *
- * Notifies each of the backend's listeners about the results of a
- * setMode call.
+ * Notifies all backend's clients about the current readonly state.
+ * Meant to be used by backend implementations.
  **/
 void
-e_cal_backend_notify_mode (ECalBackend *backend,
-			   EDataCalViewListenerSetModeStatus status,
-			   EDataCalMode mode)
+e_cal_backend_notify_readonly (ECalBackend *backend, gboolean is_readonly)
 {
-	ECalBackendPrivate *priv = backend->priv;
-	GList *l;
+	ECalBackendPrivate *priv;
+	GSList *l;
+
+	priv = backend->priv;
+	priv->readonly = is_readonly;
 
 	if (priv->notification_proxy) {
-		e_cal_backend_notify_mode (priv->notification_proxy, status, mode);
+		e_cal_backend_notify_readonly (priv->notification_proxy, is_readonly);
 		return;
 	}
 
+	g_mutex_lock (priv->clients_mutex);
+
 	for (l = priv->clients; l; l = l->next)
-		e_data_cal_notify_mode (l->data, status, mode);
+		e_data_cal_report_readonly (l->data, is_readonly);
+
+	g_mutex_unlock (priv->clients_mutex);
 }
 
 /**
- * e_cal_backend_notify_auth_required:
+ * e_cal_backend_notify_online:
  * @backend: an #ECalBackend
+ * @is_online: flag indicating whether @backend is connected and online
  *
- * Notifies each of the backend's listeners that authentication is required to
- * open the calendar.
- */
+ * Notifies clients of @backend's connection status indicated by @is_online.
+ * Meant to be used by backend implementations.
+ **/
 void
-e_cal_backend_notify_auth_required (ECalBackend *backend)
+e_cal_backend_notify_online (ECalBackend *backend, gboolean is_online)
 {
-	ECalBackendPrivate *priv = backend->priv;
-	GList *l;
+	ECalBackendPrivate *priv;
+	GSList *clients;
 
-	for (l = priv->clients; l; l = l->next)
-		e_data_cal_notify_auth_required (l->data);
+	priv = backend->priv;
+	priv->online = is_online;
+
+	if (priv->notification_proxy) {
+		e_cal_backend_notify_online (priv->notification_proxy, is_online);
+		return;
+	}
+
+	g_mutex_lock (priv->clients_mutex);
+
+	for (clients = priv->clients; clients != NULL; clients = g_slist_next (clients))
+		e_data_cal_report_online (E_DATA_CAL (clients->data), is_online);
+
+	g_mutex_unlock (priv->clients_mutex);
 }
 
 /**
- * e_cal_backend_notify_error:
+ * e_cal_backend_notify_auth_required:
  * @backend: an #ECalBackend
- * @message: Error message
+ * @credentials: an #ECredentials that contains extra information for
+ *    a source for which authentication is requested.
+ *    This parameter can be NULL to indicate "for this calendar".
  *
- * Notifies each of the backend's listeners about an error
+ * Notifies clients that @backend requires authentication in order to
+ * connect. Means to be used by backend implementations.
  **/
 void
-e_cal_backend_notify_error (ECalBackend *backend, const gchar *message)
+e_cal_backend_notify_auth_required (ECalBackend *backend, const ECredentials *credentials)
 {
-	ECalBackendPrivate *priv = backend->priv;
-	GList *l;
+	ECalBackendPrivate *priv;
+	GSList *clients;
+
+	priv = backend->priv;
 
 	if (priv->notification_proxy) {
-		e_cal_backend_notify_error (priv->notification_proxy, message);
+		e_cal_backend_notify_auth_required (priv->notification_proxy, credentials);
 		return;
 	}
 
-	for (l = priv->clients; l; l = l->next)
-		e_data_cal_notify_error (l->data, message);
+	g_mutex_lock (priv->clients_mutex);
+
+	for (clients = priv->clients; clients != NULL; clients = g_slist_next (clients))
+		e_data_cal_report_auth_required (E_DATA_CAL (clients->data), credentials);
+
+	g_mutex_unlock (priv->clients_mutex);
 }
 
 /**
diff --git a/calendar/libedata-cal/e-cal-backend.h b/calendar/libedata-cal/e-cal-backend.h
index d9fccf8..98c1b50 100644
--- a/calendar/libedata-cal/e-cal-backend.h
+++ b/calendar/libedata-cal/e-cal-backend.h
@@ -23,8 +23,8 @@
 #ifndef E_CAL_BACKEND_H
 #define E_CAL_BACKEND_H
 
-#include "libedataserver/e-list.h"
-#include "libedataserver/e-source.h"
+#include <libedataserver/e-credentials.h>
+#include <libedataserver/e-source.h>
 #include <libecal/e-cal-util.h>
 #include <libecal/e-cal-component.h>
 #include "e-data-cal-common.h"
@@ -38,11 +38,10 @@ G_BEGIN_DECLS
 
 #define E_TYPE_CAL_BACKEND            (e_cal_backend_get_type ())
 #define E_CAL_BACKEND(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CAL_BACKEND, ECalBackend))
-#define E_CAL_BACKEND_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CAL_BACKEND,		\
-				     ECalBackendClass))
+#define E_CAL_BACKEND_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CAL_BACKEND, ECalBackendClass))
 #define E_IS_CAL_BACKEND(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CAL_BACKEND))
 #define E_IS_CAL_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_CAL_BACKEND))
-#define E_CAL_BACKEND_GET_CLASS(obj) (E_CAL_BACKEND_CLASS (G_OBJECT_GET_CLASS (obj)))
+#define E_CAL_BACKEND_GET_CLASS(obj)  (E_CAL_BACKEND_CLASS (G_OBJECT_GET_CLASS (obj)))
 
 struct _ECalBackendCache;
 
@@ -57,136 +56,103 @@ struct _ECalBackend {
 struct _ECalBackendClass {
 	GObjectClass parent_class;
 
-	/* Notification signals */
-	void (* last_client_gone) (ECalBackend *backend);
-	void (* cal_added) (ECalBackend *backend, EDataCal *cal);
-
 	/* Virtual methods */
-	gboolean (* is_loaded) (ECalBackend *backend);
-	void (* is_read_only) (ECalBackend *backend, EDataCal *cal);
-	void (* get_cal_address) (ECalBackend *backend, EDataCal *cal, EServerMethodContext context);
-	void (* get_alarm_email_address) (ECalBackend *backend, EDataCal *cal, EServerMethodContext context);
-	void (* get_ldap_attribute) (ECalBackend *backend, EDataCal *cal, EServerMethodContext context);
-	void (* get_static_capabilities) (ECalBackend *backend, EDataCal *cal, EServerMethodContext context);
-
-	void (* open) (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, gboolean only_if_exists, const gchar *username, const gchar *password);
-	void (* refresh) (ECalBackend *backend, EDataCal *cal, EServerMethodContext context);
-	void (* remove) (ECalBackend *backend, EDataCal *cal, EServerMethodContext context);
-
-	/* Object related virtual methods */
-	void (* create_object) (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *calobj);
-	void (* modify_object) (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *calobj, CalObjModType mod);
-	void (* remove_object) (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *uid, const gchar *rid, CalObjModType mod);
-
-	void (* discard_alarm) (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *uid, const gchar *auid);
-
-	void (* receive_objects) (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *calobj);
-	void (* send_objects) (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *calobj);
-
-	void (* get_default_object) (ECalBackend *backend, EDataCal *cal, EServerMethodContext context);
-	void (* get_object) (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *uid, const gchar *rid);
-	void (* get_object_list) (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *sexp);
-
-	void (* get_attachment_list) (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *uid, const gchar *rid);
-
-	/* Timezone related virtual methods */
-	void (* get_timezone) (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *tzid);
-	void (* add_timezone) (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *object);
-	void (* set_default_zone) (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *tzobj);
+	void	(* open)			(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, gboolean only_if_exists);
+	void	(* authenticate_user)		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, ECredentials *credentials);
+	void	(* remove)			(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable);
+	void	(* set_online)			(ECalBackend *backend, gboolean is_online);
+
+	void	(* refresh)			(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable);
+        void	(* get_capabilities)		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable);
+	void	(* get_cal_email_address)	(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable);
+	void	(* get_alarm_email_address)	(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable);
+	void	(* get_default_object)		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable);
+	void	(* get_object)			(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *uid, const gchar *rid);
+	void	(* get_object_list)		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *sexp);
+	void	(* get_free_busy)		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const GSList *users, time_t start, time_t end);
+	void	(* discard_alarm)		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *uid, const gchar *auid);
+	void	(* create_object)		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *calobj);
+	void	(* modify_object)		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *calobj, CalObjModType mod);
+	void	(* remove_object)		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *uid, const gchar *rid, CalObjModType mod);
+	void	(* receive_objects)		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *calobj);
+	void	(* send_objects)		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *calobj);
+	void	(* get_attachment_uris)		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *uid, const gchar *rid);
+	void	(* get_timezone)		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *tzid);
+	void	(* add_timezone)		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *tzobject);
+
+	void	(* start_view)			(ECalBackend *backend, EDataCalView *view);
+	void	(* stop_view)			(ECalBackend *backend, EDataCalView *view);
 
-	void (* start_query) (ECalBackend *backend, EDataCalView *query);
-
-	/* Mode relate virtual methods */
-	CalMode (* get_mode) (ECalBackend *backend);
-	void    (* set_mode) (ECalBackend *backend, CalMode mode);
-
-	void (* get_free_busy) (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, GList *users, time_t start, time_t end);
-	void (* get_changes) (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *change_id);
+	/* Notification signals */
+	void	(* last_client_gone)		(ECalBackend *backend);
 
 	/* Internal methods for use only in the pcs */
-	icaltimezone *(* internal_get_default_timezone) (ECalBackend *backend);
 	icaltimezone *(* internal_get_timezone) (ECalBackend *backend, const gchar *tzid);
 };
 
-GType e_cal_backend_get_type (void);
-
-ESource *e_cal_backend_get_source (ECalBackend *backend);
-const gchar *e_cal_backend_get_uri (ECalBackend *backend);
-icalcomponent_kind e_cal_backend_get_kind (ECalBackend *backend);
-
-const gchar *e_cal_backend_get_cache_dir (ECalBackend *backend);
-void e_cal_backend_set_cache_dir (ECalBackend *backend, const gchar *cache_dir);
-
-void e_cal_backend_add_client (ECalBackend *backend, EDataCal *cal);
-void e_cal_backend_remove_client (ECalBackend *backend, EDataCal *cal);
-
-void e_cal_backend_add_query (ECalBackend *backend, EDataCalView *query);
-EList *e_cal_backend_get_queries (ECalBackend *backend);
-void e_cal_backend_remove_query (ECalBackend *backend, EDataCalView *query);
-
-void e_cal_backend_is_read_only (ECalBackend *backend, EDataCal *cal);
-void e_cal_backend_get_cal_address (ECalBackend *backend, EDataCal *cal, EServerMethodContext context);
-void e_cal_backend_get_alarm_email_address (ECalBackend *backend, EDataCal *cal, EServerMethodContext context);
-void e_cal_backend_get_ldap_attribute (ECalBackend *backend, EDataCal *cal, EServerMethodContext context);
-void e_cal_backend_get_static_capabilities (ECalBackend *backend, EDataCal *cal, EServerMethodContext context);
-
-void e_cal_backend_open (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, gboolean only_if_exists, const gchar *username, const gchar *password);
-void e_cal_backend_refresh (ECalBackend *backend, EDataCal *cal, EServerMethodContext context);
-void e_cal_backend_remove (ECalBackend *backend, EDataCal *cal, EServerMethodContext context);
-
-void e_cal_backend_create_object (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *calobj);
-void e_cal_backend_modify_object (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *calobj, CalObjModType mod);
-void e_cal_backend_remove_object (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *uid, const gchar *rid, CalObjModType mod);
-
-void e_cal_backend_discard_alarm (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *uid, const gchar *auid);
-
-void e_cal_backend_receive_objects (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *calobj);
-void e_cal_backend_send_objects (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *calobj);
-
-void e_cal_backend_get_default_object (ECalBackend *backend, EDataCal *cal, EServerMethodContext context);
-void e_cal_backend_get_object (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *uid, const gchar *rid);
-void e_cal_backend_get_object_list (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *sexp);
-void e_cal_backend_get_attachment_list (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *uid, const gchar *rid);
-
-gboolean e_cal_backend_is_loaded (ECalBackend *backend);
-
-void e_cal_backend_start_query (ECalBackend *backend, EDataCalView *query);
-
-CalMode e_cal_backend_get_mode (ECalBackend *backend);
-void e_cal_backend_set_mode (ECalBackend *backend, CalMode mode);
-
-void e_cal_backend_get_timezone (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *tzid);
-void e_cal_backend_add_timezone (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *object);
-void e_cal_backend_set_default_zone (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *tzobj);
-
-void e_cal_backend_get_changes (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, const gchar *change_id);
-void e_cal_backend_get_free_busy (ECalBackend *backend, EDataCal *cal, EServerMethodContext context, GList *users, time_t start, time_t end);
-
-icaltimezone* e_cal_backend_internal_get_default_timezone (ECalBackend *backend);
-icaltimezone* e_cal_backend_internal_get_timezone (ECalBackend *backend, const gchar *tzid);
-
-void e_cal_backend_set_notification_proxy (ECalBackend *backend, ECalBackend *proxy);
-void e_cal_backend_notify_object_created  (ECalBackend *backend, const gchar *calobj);
-void e_cal_backend_notify_object_modified (ECalBackend *backend, const gchar *old_object, const gchar *object);
-void e_cal_backend_notify_object_removed  (ECalBackend *backend, const ECalComponentId *id, const gchar *old_object, const gchar *object);
-
-void e_cal_backend_notify_mode      (ECalBackend *backend,
-				     EDataCalViewListenerSetModeStatus status,
-				     EDataCalMode mode);
-void e_cal_backend_notify_auth_required (ECalBackend *backend);
-void e_cal_backend_notify_error     (ECalBackend *backend, const gchar *message);
-
-void e_cal_backend_notify_view_done (ECalBackend *backend, const GError *error);
-void e_cal_backend_notify_view_progress_start (ECalBackend *backend);
-void e_cal_backend_notify_view_progress (ECalBackend *backend, const gchar *message, gint percent);
-void e_cal_backend_notify_readonly (ECalBackend *backend, gboolean read_only);
-void e_cal_backend_notify_cal_address (ECalBackend *backend, EServerMethodContext context, gchar *address);
-
-void e_cal_backend_notify_objects_added (ECalBackend *backend, EDataCalView *query, const GList *objects);
-void e_cal_backend_notify_objects_removed (ECalBackend *backend, EDataCalView *query, const GList *ids);
-void e_cal_backend_notify_objects_modified (ECalBackend *backend, EDataCalView *query, const GList *objects);
-
-void e_cal_backend_empty_cache (ECalBackend *backend, struct _ECalBackendCache *cache);
+GType		e_cal_backend_get_type			(void);
+
+ESource *	e_cal_backend_get_source		(ECalBackend *backend);
+const gchar *	e_cal_backend_get_uri			(ECalBackend *backend);
+icalcomponent_kind e_cal_backend_get_kind		(ECalBackend *backend);
+gboolean	e_cal_backend_is_loaded			(ECalBackend *backend);
+gboolean	e_cal_backend_is_readonly		(ECalBackend *backend);
+gboolean	e_cal_backend_is_removed		(ECalBackend *backend);
+
+const gchar *	e_cal_backend_get_cache_dir		(ECalBackend *backend);
+void		e_cal_backend_set_cache_dir		(ECalBackend *backend, const gchar *cache_dir);
+
+void		e_cal_backend_add_client		(ECalBackend *backend, EDataCal *cal);
+void		e_cal_backend_remove_client		(ECalBackend *backend, EDataCal *cal);
+
+void		e_cal_backend_add_view			(ECalBackend *backend, EDataCalView *view);
+void		e_cal_backend_remove_view		(ECalBackend *backend, EDataCalView *view);
+void		e_cal_backend_foreach_view		(ECalBackend *backend, gboolean (* callback) (EDataCalView *view, gpointer user_data), gpointer user_data);
+
+void		e_cal_backend_set_notification_proxy	(ECalBackend *backend, ECalBackend *proxy);
+
+void		e_cal_backend_set_online		(ECalBackend *backend, gboolean is_online);
+void		e_cal_backend_open			(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, gboolean only_if_exists);
+void		e_cal_backend_authenticate_user		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, ECredentials *credentials);
+void		e_cal_backend_remove			(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable);
+void		e_cal_backend_refresh			(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable);
+void		e_cal_backend_get_capabilities		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable);
+void		e_cal_backend_get_cal_email_address	(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable);
+void		e_cal_backend_get_alarm_email_address	(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable);
+void		e_cal_backend_get_default_object	(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable);
+void		e_cal_backend_get_object		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *uid, const gchar *rid);
+void		e_cal_backend_get_object_list		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *sexp);
+void		e_cal_backend_get_free_busy		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const GSList *users, time_t start, time_t end);
+void		e_cal_backend_discard_alarm		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *uid, const gchar *auid);
+void		e_cal_backend_create_object		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *calobj);
+void		e_cal_backend_modify_object		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *calobj, CalObjModType mod);
+void		e_cal_backend_remove_object		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *uid, const gchar *rid, CalObjModType mod);
+void		e_cal_backend_receive_objects		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *calobj);
+void		e_cal_backend_send_objects		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *calobj);
+void		e_cal_backend_get_attachment_uris	(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *uid, const gchar *rid);
+void		e_cal_backend_get_timezone		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *tzid);
+void		e_cal_backend_add_timezone		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *tzobject);
+icaltimezone *	e_cal_backend_internal_get_timezone	(ECalBackend *backend, const gchar *tzid);
+void		e_cal_backend_start_view		(ECalBackend *backend, EDataCalView *view);
+void		e_cal_backend_stop_view			(ECalBackend *backend, EDataCalView *view);
+
+void		e_cal_backend_notify_object_created	(ECalBackend *backend, const gchar *calobj);
+void		e_cal_backend_notify_objects_added	(ECalBackend *backend, EDataCalView *view, const GSList *objects);
+void		e_cal_backend_notify_object_modified	(ECalBackend *backend, const gchar *old_object, const gchar *object);
+void		e_cal_backend_notify_objects_modified	(ECalBackend *backend, EDataCalView *view, const GSList *objects);
+void		e_cal_backend_notify_object_removed	(ECalBackend *backend, const ECalComponentId *id, const gchar *old_object, const gchar *object);
+void		e_cal_backend_notify_objects_removed	(ECalBackend *backend, EDataCalView *view, const GSList *ids);
+
+void		e_cal_backend_notify_error		(ECalBackend *backend, const gchar *message);
+void		e_cal_backend_notify_readonly		(ECalBackend *backend, gboolean is_readonly);
+void		e_cal_backend_notify_online		(ECalBackend *backend, gboolean is_online);
+void		e_cal_backend_notify_auth_required	(ECalBackend *backend, const ECredentials *credentials);
+
+void		e_cal_backend_empty_cache		(ECalBackend *backend, struct _ECalBackendCache *cache);
+
+/* protected functions for subclasses */
+void		e_cal_backend_set_is_loaded		(ECalBackend *backend, gboolean is_loaded);
+void		e_cal_backend_set_is_removed		(ECalBackend *backend, gboolean is_removed);
 
 G_END_DECLS
 
diff --git a/calendar/libedata-cal/e-data-cal-common.h b/calendar/libedata-cal/e-data-cal-common.h
index e81fb34..e03fc15 100644
--- a/calendar/libedata-cal/e-data-cal-common.h
+++ b/calendar/libedata-cal/e-data-cal-common.h
@@ -39,9 +39,6 @@ typedef struct _EDataCalViewClass EDataCalViewClass;
 typedef struct _ECalBackendSExp ECalBackendSExp;
 typedef struct _ECalBackendSExpClass ECalBackendSExpClass;
 
-/* Opaque type for backend method context */
-typedef gpointer EServerMethodContext;
-
 
 
 G_END_DECLS
diff --git a/calendar/libedata-cal/e-data-cal-factory.c b/calendar/libedata-cal/e-data-cal-factory.c
index f675940..15bc734 100644
--- a/calendar/libedata-cal/e-data-cal-factory.c
+++ b/calendar/libedata-cal/e-data-cal-factory.c
@@ -43,7 +43,7 @@
 #include "e-data-cal-factory.h"
 #include "e-cal-backend-loader-factory.h"
 
-#include "e-gdbus-egdbuscalfactory.h"
+#include "e-gdbus-cal-factory.h"
 
 #ifdef HAVE_ICAL_UNKNOWN_TOKEN_HANDLING
 #include <libical/ical.h>
@@ -92,7 +92,7 @@ struct _EDataCalFactoryPrivate {
 
 	GHashTable *connections;
 
-	gint mode;
+	gboolean is_online;
 
 	/* this is for notifications of source changes */
 	ESourceList *lists[E_CAL_SOURCE_TYPE_LAST];
@@ -292,6 +292,18 @@ calendar_freed_cb (EDataCalFactory *factory, GObject *dead)
 			10, (GSourceFunc) g_main_loop_quit, loop);
 }
 
+static void
+last_client_gone_cb (ECalBackend *backend, EDataCalFactory *factory)
+{
+	EDataCalFactoryPrivate *priv = factory->priv;
+
+	if (e_cal_backend_is_removed (backend)) {
+		g_mutex_lock (priv->backends_mutex);
+		g_hash_table_foreach_remove (priv->backends, remove_dead_calendar_cb, backend);
+		g_mutex_unlock (priv->backends_mutex);
+	}
+}
+
 struct find_backend_data {
 	const gchar *str_uri;
 	ECalBackend *backend;
@@ -324,7 +336,7 @@ find_backend_cb (gpointer key, gpointer value, gpointer data)
 }
 
 static gboolean
-impl_CalFactory_getCal (EGdbusCalFactory *object, GDBusMethodInvocation *invocation, const gchar *source_xml, guint type, EDataCalFactory *factory)
+impl_CalFactory_getCal (EGdbusCalFactory *object, GDBusMethodInvocation *invocation, const gchar * const *in_source_type, EDataCalFactory *factory)
 {
 	EDataCal *calendar;
 	EDataCalFactoryPrivate *priv = factory->priv;
@@ -338,6 +350,8 @@ impl_CalFactory_getCal (EGdbusCalFactory *object, GDBusMethodInvocation *invocat
 	const gchar *sender;
 	GList *list;
 	GError *error = NULL;
+	gchar *source_xml = NULL;
+	guint type = 0;
 
 	/* Remove a pending exit */
 	if (priv->exit_timeout) {
@@ -345,8 +359,18 @@ impl_CalFactory_getCal (EGdbusCalFactory *object, GDBusMethodInvocation *invocat
 		priv->exit_timeout = 0;
 	}
 
+	if (!e_gdbus_cal_factory_decode_get_cal (in_source_type, &source_xml, &type)) {
+		error = g_error_new (E_DATA_CAL_ERROR, NoSuchCal, _("Invalid call"));
+		g_dbus_method_invocation_return_gerror (invocation, error);
+		g_error_free (error);
+
+		return TRUE;
+	}
+
 	source = e_source_new_from_standalone_xml (source_xml);
 	if (!source) {
+		g_free (source_xml);
+
 		error = g_error_new (E_DATA_CAL_ERROR, NoSuchCal, _("Invalid source"));
 		g_dbus_method_invocation_return_gerror (invocation, error);
 		g_error_free (error);
@@ -354,6 +378,8 @@ impl_CalFactory_getCal (EGdbusCalFactory *object, GDBusMethodInvocation *invocat
 		return TRUE;
 	}
 
+	g_free (source_xml);
+
 	/* Get the URI so we can extract the protocol */
 	str_uri = e_source_get_uri (source);
 	if (!str_uri) {
@@ -464,7 +490,8 @@ impl_CalFactory_getCal (EGdbusCalFactory *object, GDBusMethodInvocation *invocat
 		g_hash_table_insert (
 			priv->backends, g_strdup (uid_type_string), backend);
 
-		e_cal_backend_set_mode (backend, priv->mode);
+		g_signal_connect (backend, "last-client-gone", G_CALLBACK (last_client_gone_cb), factory);
+		e_cal_backend_set_online (backend, priv->is_online);
 	} else if (!e_source_equal (source, e_cal_backend_get_source (backend))) {
 		/* source changed, update it in a backend */
 		update_source_in_backend (backend, source);
@@ -498,11 +525,10 @@ cleanup2:
 	g_free (uid_type_string);
 	g_object_unref (source);
 
-	if (error) {
-		g_dbus_method_invocation_return_gerror (invocation, error);
+	e_gdbus_cal_factory_complete_get_cal (object, invocation, path, error);
+
+	if (error)
 		g_error_free (error);
-	} else
-		e_gdbus_cal_factory_complete_get_cal (object, invocation, path);
 
 	g_free (path);
 
@@ -578,6 +604,7 @@ static void
 e_data_cal_factory_finalize (GObject *object)
 {
 	EDataCalFactory *factory = E_DATA_CAL_FACTORY (object);
+	gint ii;
 
 	g_return_if_fail (factory != NULL);
 
@@ -592,6 +619,16 @@ e_data_cal_factory_finalize (GObject *object)
 
 	g_mutex_free (factory->priv->backends_mutex);
 
+	for (ii = 0; ii < E_CAL_SOURCE_TYPE_LAST; ii++) {
+		if (factory->priv->lists[ii]) {
+			g_object_unref (factory->priv->lists[ii]);
+			factory->priv->lists[ii] = NULL;
+		}
+
+		g_slist_free (factory->priv->backends_by_type[ii]);
+		factory->priv->backends_by_type[ii] = NULL;
+	}
+
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (e_data_cal_factory_parent_class)->finalize (object);
 }
@@ -624,27 +661,27 @@ set_backend_online_status (gpointer key, gpointer value, gpointer data)
 {
 	ECalBackend *backend = E_CAL_BACKEND (value);
 
-	e_cal_backend_set_mode (backend,  GPOINTER_TO_INT (data));
+	e_cal_backend_set_online (backend,  GPOINTER_TO_INT (data) != 0);
 }
 
 /**
- * e_data_cal_factory_set_backend_mode:
+ * e_data_cal_factory_set_backend_online:
  * @factory: A calendar factory.
- * @mode: Online mode to set.
+ * @is_online: Online mode to set.
  *
  * Sets the online mode for all backends created by the given factory.
  */
 void
-e_data_cal_factory_set_backend_mode (EDataCalFactory *factory, gint mode)
+e_data_cal_factory_set_backend_online (EDataCalFactory *factory, gboolean is_online)
 {
 	g_return_if_fail (E_IS_DATA_CAL_FACTORY (factory));
 
-	factory->priv->mode = mode;
+	factory->priv->is_online = is_online;
 	g_mutex_lock (factory->priv->backends_mutex);
 	g_hash_table_foreach (
 		factory->priv->backends,
 		set_backend_online_status,
-		GINT_TO_POINTER (factory->priv->mode));
+		GINT_TO_POINTER (factory->priv->is_online ? 1 : 0));
 	g_mutex_unlock (factory->priv->backends_mutex);
 }
 
@@ -826,8 +863,7 @@ offline_state_changed_cb (EOfflineListener *eol,
 
 	g_return_if_fail (state == EOL_STATE_ONLINE || state == EOL_STATE_OFFLINE);
 
-	e_data_cal_factory_set_backend_mode (
-		factory, state == EOL_STATE_ONLINE ? Remote : Local);
+	e_data_cal_factory_set_backend_online (factory, state == EOL_STATE_ONLINE);
 }
 
 static void
diff --git a/calendar/libedata-cal/e-data-cal-factory.h b/calendar/libedata-cal/e-data-cal-factory.h
index cd5afe6..3bf4779 100644
--- a/calendar/libedata-cal/e-data-cal-factory.h
+++ b/calendar/libedata-cal/e-data-cal-factory.h
@@ -55,16 +55,13 @@ typedef enum {
 GQuark e_data_cal_factory_error_quark (void);
 #define E_DATA_CAL_FACTORY_ERROR e_data_cal_factory_error_quark ()
 
-GType       e_data_cal_factory_get_type        (void);
+GType	e_data_cal_factory_get_type        (void);
 
-void        e_data_cal_factory_register_backend  (EDataCalFactory *factory,
-						  ECalBackendFactory *backend_factory);
-
-void	    e_data_cal_factory_register_backends    (EDataCalFactory    *factory);
-
-gint         e_data_cal_factory_get_n_backends       (EDataCalFactory *factory);
-void        e_data_cal_factory_dump_active_backends (EDataCalFactory *factory);
-void        e_data_cal_factory_set_backend_mode (EDataCalFactory *factory, gint mode);
+void	e_data_cal_factory_register_backend	(EDataCalFactory *factory, ECalBackendFactory *backend_factory);
+void	e_data_cal_factory_register_backends	(EDataCalFactory *factory);
+gint	e_data_cal_factory_get_n_backends	(EDataCalFactory *factory);
+void	e_data_cal_factory_dump_active_backends	(EDataCalFactory *factory);
+void	e_data_cal_factory_set_backend_online	(EDataCalFactory *factory, gboolean is_online);
 
 G_END_DECLS
 
diff --git a/calendar/libedata-cal/e-data-cal-types.h b/calendar/libedata-cal/e-data-cal-types.h
index fce65cc..e2b47ed 100644
--- a/calendar/libedata-cal/e-data-cal-types.h
+++ b/calendar/libedata-cal/e-data-cal-types.h
@@ -39,12 +39,6 @@ typedef enum {
 } EDataCalCallStatus;
 
 typedef enum {
-	ModeSet,                    /* All OK */
-	ModeNotSet,                /* Generic error */
-	ModeNotSupported           /* Mode not supported */
-} EDataCalViewListenerSetModeStatus;
-
-typedef enum {
 	Event = 1 << 0,
 	Todo = 1 << 1,
 	Journal = 1 << 2,
@@ -58,12 +52,6 @@ typedef enum {
 	All = 0x07
 } EDataCalObjModType;
 
-typedef enum {
-	Local = 1 << 0,
-	Remote = 1 << 1,
-	AnyMode = 0x07
-} EDataCalMode;
-
 G_END_DECLS
 
 #endif /* __E_DATA_CAL_TYPES_H__ */
diff --git a/calendar/libedata-cal/e-data-cal-view.c b/calendar/libedata-cal/e-data-cal-view.c
index d8b1b1a..6688446 100644
--- a/calendar/libedata-cal/e-data-cal-view.c
+++ b/calendar/libedata-cal/e-data-cal-view.c
@@ -1,5 +1,5 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* Evolution calendar - Live search query implementation
+/* Evolution calendar - Live search view implementation
  *
  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
  * Copyright (C) 2009 Intel Corporation
@@ -33,7 +33,7 @@
 #include "libedataserver/e-data-server-util.h"
 #include "e-cal-backend-sexp.h"
 #include "e-data-cal-view.h"
-#include "e-gdbus-egdbuscalview.h"
+#include "e-gdbus-cal-view.h"
 
 static void ensure_pending_flush_timeout (EDataCalView *view);
 
@@ -48,9 +48,9 @@ struct _EDataCalViewPrivate {
 
 	gboolean started;
 	gboolean stopped;
-	gboolean done;
+	gboolean complete;
 
-	/* Sexp that defines the query */
+	/* Sexp that defines the view */
 	ECalBackendSExp *sexp;
 
 	GArray *adds;
@@ -118,11 +118,11 @@ id_equal (gconstpointer a, gconstpointer b)
 EDataCalView *
 e_data_cal_view_new (ECalBackend *backend, ECalBackendSExp *sexp)
 {
-	EDataCalView *query;
+	EDataCalView *view;
 
-	query = g_object_new (E_DATA_CAL_VIEW_TYPE, "backend", backend, "sexp", sexp, NULL);
+	view = g_object_new (E_DATA_CAL_VIEW_TYPE, "backend", backend, "sexp", sexp, NULL);
 
-	return query;
+	return view;
 }
 
 /**
@@ -131,14 +131,14 @@ e_data_cal_view_new (ECalBackend *backend, ECalBackendSExp *sexp)
  * Since: 2.32
  **/
 guint
-e_data_cal_view_register_gdbus_object (EDataCalView *query, GDBusConnection *connection, const gchar *object_path, GError **error)
+e_data_cal_view_register_gdbus_object (EDataCalView *view, GDBusConnection *connection, const gchar *object_path, GError **error)
 {
-	g_return_val_if_fail (query != NULL, 0);
-	g_return_val_if_fail (E_IS_DATA_CAL_VIEW (query), 0);
+	g_return_val_if_fail (view != NULL, 0);
+	g_return_val_if_fail (E_IS_DATA_CAL_VIEW (view), 0);
 	g_return_val_if_fail (connection != NULL, 0);
 	g_return_val_if_fail (object_path != NULL, 0);
 
-	return e_gdbus_cal_view_register_object (query->priv->gdbus_object, connection, object_path, error);
+	return e_gdbus_cal_view_register_object (view->priv->gdbus_object, connection, object_path, error);
 }
 
 static void
@@ -177,7 +177,7 @@ send_pending_changes (EDataCalView *view)
 	if (priv->changes->len == 0)
 		return;
 
-	e_gdbus_cal_view_emit_objects_modified (view->priv->gdbus_object, (const gchar * const *) priv->changes->data);
+	e_gdbus_cal_view_emit_objects_changed (view->priv->gdbus_object, (const gchar * const *) priv->changes->data);
 	reset_array (priv->changes);
 }
 
@@ -221,7 +221,7 @@ ensure_pending_flush_timeout (EDataCalView *view)
 	if (priv->flush_id)
 		return;
 
-	priv->flush_id = g_timeout_add (e_data_cal_view_is_done (view) ? 10 : (THRESHOLD_SECONDS * 1000), pending_flush_timeout_cb, view);
+	priv->flush_id = g_timeout_add (e_data_cal_view_is_completed (view) ? 10 : (THRESHOLD_SECONDS * 1000), pending_flush_timeout_cb, view);
 }
 
 static void
@@ -287,7 +287,7 @@ notify_remove (EDataCalView *view, ECalComponentId *id)
 }
 
 static void
-notify_done (EDataCalView *view, const GError *error)
+notify_complete (EDataCalView *view, const GError *error)
 {
 	gchar *gdbus_error_msg = NULL;
 
@@ -295,49 +295,49 @@ notify_done (EDataCalView *view, const GError *error)
 	send_pending_changes (view);
 	send_pending_removes (view);
 
-	e_gdbus_cal_view_emit_done (view->priv->gdbus_object, error ? error->code : 0, e_util_ensure_gdbus_string (error ? error->message : "", &gdbus_error_msg));
+	e_gdbus_cal_view_emit_complete (view->priv->gdbus_object, error ? error->code : 0, e_util_ensure_gdbus_string (error ? error->message : "", &gdbus_error_msg));
 
 	g_free (gdbus_error_msg);
 }
 
 static gboolean
-impl_DataCalView_start (EGdbusCalView *object, GDBusMethodInvocation *invocation, EDataCalView *query)
+impl_DataCalView_start (EGdbusCalView *object, GDBusMethodInvocation *invocation, EDataCalView *view)
 {
 	EDataCalViewPrivate *priv;
 
-	priv = query->priv;
+	priv = view->priv;
 
 	if (!priv->started) {
 		priv->started = TRUE;
-		e_debug_log(FALSE, E_DEBUG_LOG_DOMAIN_CAL_QUERIES, "---;%p;QUERY-START;%s;%s", query, e_data_cal_view_get_text (query), G_OBJECT_TYPE_NAME(priv->backend));
-		e_cal_backend_start_query (priv->backend, query);
+		e_debug_log(FALSE, E_DEBUG_LOG_DOMAIN_CAL_QUERIES, "---;%p;VIEW-START;%s;%s", view, e_data_cal_view_get_text (view), G_OBJECT_TYPE_NAME(priv->backend));
+		e_cal_backend_start_view (priv->backend, view);
 	}
 
-	e_gdbus_cal_view_complete_start (object, invocation);
+	e_gdbus_cal_view_complete_start (object, invocation, NULL);
 
 	return TRUE;
 }
 
 static gboolean
-impl_DataCalView_stop (EGdbusCalView *object, GDBusMethodInvocation *invocation, EDataCalView *query)
+impl_DataCalView_stop (EGdbusCalView *object, GDBusMethodInvocation *invocation, EDataCalView *view)
 {
 	EDataCalViewPrivate *priv;
 
-	priv = query->priv;
+	priv = view->priv;
 
 	priv->stopped = TRUE;
 
-	e_gdbus_cal_view_complete_stop (object, invocation);
+	e_gdbus_cal_view_complete_stop (object, invocation, NULL);
 
 	return TRUE;
 }
 
 static gboolean
-impl_DataCalView_dispose (EGdbusCalView *object, GDBusMethodInvocation *invocation, EDataCalView *query)
+impl_DataCalView_dispose (EGdbusCalView *object, GDBusMethodInvocation *invocation, EDataCalView *view)
 {
-	e_gdbus_cal_view_complete_dispose (object, invocation);
+	e_gdbus_cal_view_complete_dispose (object, invocation, NULL);
 
-	g_object_unref (query);
+	g_object_unref (view);
 
 	return TRUE;
 }
@@ -345,11 +345,11 @@ impl_DataCalView_dispose (EGdbusCalView *object, GDBusMethodInvocation *invocati
 static void
 e_data_cal_view_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
-	EDataCalView *query;
+	EDataCalView *view;
 	EDataCalViewPrivate *priv;
 
-	query = QUERY (object);
-	priv = query->priv;
+	view = E_DATA_CAL_VIEW (object);
+	priv = view->priv;
 
 	switch (property_id) {
 	case PROP_BACKEND:
@@ -367,11 +367,11 @@ e_data_cal_view_set_property (GObject *object, guint property_id, const GValue *
 static void
 e_data_cal_view_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
-	EDataCalView *query;
+	EDataCalView *view;
 	EDataCalViewPrivate *priv;
 
-	query = QUERY (object);
-	priv = query->priv;
+	view = E_DATA_CAL_VIEW (object);
+	priv = view->priv;
 
 	switch (property_id) {
 	case PROP_BACKEND:
@@ -388,22 +388,22 @@ e_data_cal_view_get_property (GObject *object, guint property_id, GValue *value,
 
 /* Instance init */
 static void
-e_data_cal_view_init (EDataCalView *query)
+e_data_cal_view_init (EDataCalView *view)
 {
 	EDataCalViewPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE (
-		query, E_DATA_CAL_VIEW_TYPE, EDataCalViewPrivate);
+		view, E_DATA_CAL_VIEW_TYPE, EDataCalViewPrivate);
 
-	query->priv = priv;
+	view->priv = priv;
 
 	priv->gdbus_object = e_gdbus_cal_view_stub_new ();
-	g_signal_connect (priv->gdbus_object, "handle-start", G_CALLBACK (impl_DataCalView_start), query);
-	g_signal_connect (priv->gdbus_object, "handle-stop", G_CALLBACK (impl_DataCalView_stop), query);
-	g_signal_connect (priv->gdbus_object, "handle-dispose", G_CALLBACK (impl_DataCalView_dispose), query);
+	g_signal_connect (priv->gdbus_object, "handle-start", G_CALLBACK (impl_DataCalView_start), view);
+	g_signal_connect (priv->gdbus_object, "handle-stop", G_CALLBACK (impl_DataCalView_stop), view);
+	g_signal_connect (priv->gdbus_object, "handle-dispose", G_CALLBACK (impl_DataCalView_dispose), view);
 
 	priv->backend = NULL;
 	priv->started = FALSE;
 	priv->stopped = FALSE;
-	priv->done = FALSE;
+	priv->complete = FALSE;
 	priv->sexp = NULL;
 
 	priv->adds = g_array_sized_new (TRUE, TRUE, sizeof (gchar *), THRESHOLD_ITEMS);
@@ -419,17 +419,17 @@ e_data_cal_view_init (EDataCalView *query)
 static void
 e_data_cal_view_dispose (GObject *object)
 {
-	EDataCalView *query;
+	EDataCalView *view;
 	EDataCalViewPrivate *priv;
 
 	g_return_if_fail (object != NULL);
-	g_return_if_fail (IS_QUERY (object));
+	g_return_if_fail (E_IS_DATA_CAL_VIEW (object));
 
-	query = QUERY (object);
-	priv = query->priv;
+	view = E_DATA_CAL_VIEW (object);
+	priv = view->priv;
 
 	if (priv->backend) {
-		e_cal_backend_remove_query (priv->backend, query);
+		e_cal_backend_remove_view (priv->backend, view);
 		g_object_unref (priv->backend);
 		priv->backend = NULL;
 	}
@@ -454,14 +454,22 @@ e_data_cal_view_dispose (GObject *object)
 static void
 e_data_cal_view_finalize (GObject *object)
 {
-	EDataCalView *query;
+	EDataCalView *view;
 	EDataCalViewPrivate *priv;
 
 	g_return_if_fail (object != NULL);
-	g_return_if_fail (IS_QUERY (object));
+	g_return_if_fail (E_IS_DATA_CAL_VIEW (object));
 
-	query = QUERY (object);
-	priv = query->priv;
+	view = E_DATA_CAL_VIEW (object);
+	priv = view->priv;
+
+	reset_array (priv->adds);
+	reset_array (priv->changes);
+	reset_array (priv->removes);
+
+	g_array_free (priv->adds, TRUE);
+	g_array_free (priv->changes, TRUE);
+	g_array_free (priv->removes, TRUE);
 
 	g_hash_table_destroy (priv->ids);
 
@@ -472,83 +480,67 @@ e_data_cal_view_finalize (GObject *object)
 
 /**
  * e_data_cal_view_get_text:
- * @query: A #EDataCalView object.
+ * @view: A #EDataCalView object.
  *
- * Get the expression used for the given query.
+ * Get the expression used for the given view.
  *
- * Returns: the query expression used to search.
+ * Returns: the view expression used to search.
  */
 const gchar *
-e_data_cal_view_get_text (EDataCalView *query)
+e_data_cal_view_get_text (EDataCalView *view)
 {
-	g_return_val_if_fail (IS_QUERY (query), NULL);
+	g_return_val_if_fail (E_IS_DATA_CAL_VIEW (view), NULL);
 
-	return e_cal_backend_sexp_text (query->priv->sexp);
+	return e_cal_backend_sexp_text (view->priv->sexp);
 }
 
 /**
  * e_data_cal_view_get_object_sexp:
- * @query: A query object.
+ * @view: A view object.
  *
- * Get the #ECalBackendSExp object used for the given query.
+ * Get the #ECalBackendSExp object used for the given view.
  *
  * Returns: The expression object used to search.
  */
 ECalBackendSExp *
-e_data_cal_view_get_object_sexp (EDataCalView *query)
+e_data_cal_view_get_object_sexp (EDataCalView *view)
 {
-	g_return_val_if_fail (IS_QUERY (query), NULL);
+	g_return_val_if_fail (E_IS_DATA_CAL_VIEW (view), NULL);
 
-	return query->priv->sexp;
+	return view->priv->sexp;
 }
 
 /**
  * e_data_cal_view_object_matches:
- * @query: A query object.
+ * @view: A view object.
  * @object: Object to match.
  *
  * Compares the given @object to the regular expression used for the
- * given query.
+ * given view.
  *
  * Returns: TRUE if the object matches the expression, FALSE if not.
  */
 gboolean
-e_data_cal_view_object_matches (EDataCalView *query, const gchar *object)
+e_data_cal_view_object_matches (EDataCalView *view, const gchar *object)
 {
 	EDataCalViewPrivate *priv;
 
-	g_return_val_if_fail (query != NULL, FALSE);
-	g_return_val_if_fail (IS_QUERY (query), FALSE);
+	g_return_val_if_fail (view != NULL, FALSE);
+	g_return_val_if_fail (E_IS_DATA_CAL_VIEW (view), FALSE);
 	g_return_val_if_fail (object != NULL, FALSE);
 
-	priv = query->priv;
+	priv = view->priv;
 
 	return e_cal_backend_sexp_match_object (priv->sexp, object, priv->backend);
 }
 
 /**
- * e_data_cal_view_get_matched_objects:
- * @query: A query object.
- *
- * Gets the list of objects already matched for the given query.
- *
- * Returns: A list of matched objects.
- */
-GList *
-e_data_cal_view_get_matched_objects (EDataCalView *query)
-{
-	g_return_val_if_fail (IS_QUERY (query), NULL);
-	/* TODO e_data_cal_view_get_matched_objects */
-	return NULL;
-}
-
-/**
  * e_data_cal_view_is_started:
- * @query: A query object.
+ * @view: A view object.
  *
- * Checks whether the given query has already been started.
+ * Checks whether the given view has already been started.
  *
- * Returns: TRUE if the query has already been started, FALSE otherwise.
+ * Returns: TRUE if the view has already been started, FALSE otherwise.
  */
 gboolean
 e_data_cal_view_is_started (EDataCalView *view)
@@ -560,11 +552,11 @@ e_data_cal_view_is_started (EDataCalView *view)
 
 /**
  * e_data_cal_view_is_stopped:
- * @query: A query object.
+ * @view: A view object.
  *
- * Checks whether the given query has been stopped.
+ * Checks whether the given view has been stopped.
  *
- * Returns: TRUE if the query has been stopped, FALSE otherwise.
+ * Returns: TRUE if the view has been stopped, FALSE otherwise.
  *
  * Since: 2.32
  */
@@ -577,40 +569,36 @@ e_data_cal_view_is_stopped (EDataCalView *view)
 }
 
 /**
- * e_data_cal_view_is_done:
- * @query: A query object.
+ * e_data_cal_view_is_completed:
+ * @view: A view object.
  *
- * Checks whether the given query is already done. Being done means the initial
+ * Checks whether the given view is already completed. Being completed means the initial
  * matching of objects have been finished, not that no more notifications about
- * changes will be sent. In fact, even after done, notifications will still be sent
- * if there are changes in the objects matching the query search expression.
+ * changes will be sent. In fact, even after completed, notifications will still be sent
+ * if there are changes in the objects matching the view search expression.
  *
- * Returns: TRUE if the query is done, FALSE if still in progress.
+ * Returns: TRUE if the view is completed, FALSE if still in progress.
  */
 gboolean
-e_data_cal_view_is_done (EDataCalView *query)
+e_data_cal_view_is_completed (EDataCalView *view)
 {
-	EDataCalViewPrivate *priv;
-
-	g_return_val_if_fail (IS_QUERY (query), FALSE);
-
-	priv = query->priv;
+	g_return_val_if_fail (E_IS_DATA_CAL_VIEW (view), FALSE);
 
-	return priv->done;
+	return view->priv->complete;
 }
 
 /**
  * e_data_cal_view_notify_objects_added:
- * @query: A query object.
+ * @view: A view object.
  * @objects: List of objects that have been added.
  *
- * Notifies all query listeners of the addition of a list of objects.
+ * Notifies all view listeners of the addition of a list of objects.
  */
 void
-e_data_cal_view_notify_objects_added (EDataCalView *view, const GList *objects)
+e_data_cal_view_notify_objects_added (EDataCalView *view, const GSList *objects)
 {
 	EDataCalViewPrivate *priv;
-	const GList *l;
+	const GSList *l;
 
 	g_return_if_fail (view && E_IS_DATA_CAL_VIEW (view));
 	priv = view->priv;
@@ -629,15 +617,15 @@ e_data_cal_view_notify_objects_added (EDataCalView *view, const GList *objects)
 
 /**
  * e_data_cal_view_notify_objects_added_1:
- * @query: A query object.
+ * @view: A view object.
  * @object: The object that has been added.
  *
- * Notifies all the query listeners of the addition of a single object.
+ * Notifies all the view listeners of the addition of a single object.
  */
 void
 e_data_cal_view_notify_objects_added_1 (EDataCalView *view, const gchar *object)
 {
-	GList l = {NULL,};
+	GSList l = {NULL,};
 
 	g_return_if_fail (view && E_IS_DATA_CAL_VIEW (view));
 	g_return_if_fail (object);
@@ -648,16 +636,16 @@ e_data_cal_view_notify_objects_added_1 (EDataCalView *view, const gchar *object)
 
 /**
  * e_data_cal_view_notify_objects_modified:
- * @query: A query object.
+ * @view: A view object.
  * @objects: List of modified objects.
  *
- * Notifies all query listeners of the modification of a list of objects.
+ * Notifies all view listeners of the modification of a list of objects.
  */
 void
-e_data_cal_view_notify_objects_modified (EDataCalView *view, const GList *objects)
+e_data_cal_view_notify_objects_modified (EDataCalView *view, const GSList *objects)
 {
 	EDataCalViewPrivate *priv;
-	const GList *l;
+	const GSList *l;
 
 	g_return_if_fail (view && E_IS_DATA_CAL_VIEW (view));
 	priv = view->priv;
@@ -677,15 +665,15 @@ e_data_cal_view_notify_objects_modified (EDataCalView *view, const GList *object
 
 /**
  * e_data_cal_view_notify_objects_modified_1:
- * @query: A query object.
+ * @view: A view object.
  * @object: The modified object.
  *
- * Notifies all query listeners of the modification of a single object.
+ * Notifies all view listeners of the modification of a single object.
  */
 void
 e_data_cal_view_notify_objects_modified_1 (EDataCalView *view, const gchar *object)
 {
-	GList l = {NULL,};
+	GSList l = {NULL,};
 
 	g_return_if_fail (view && E_IS_DATA_CAL_VIEW (view));
 	g_return_if_fail (object);
@@ -696,16 +684,16 @@ e_data_cal_view_notify_objects_modified_1 (EDataCalView *view, const gchar *obje
 
 /**
  * e_data_cal_view_notify_objects_removed:
- * @query: A query object.
+ * @view: A view object.
  * @ids: List of IDs for the objects that have been removed.
  *
- * Notifies all query listener of the removal of a list of objects.
+ * Notifies all view listener of the removal of a list of objects.
  */
 void
-e_data_cal_view_notify_objects_removed (EDataCalView *view, const GList *ids)
+e_data_cal_view_notify_objects_removed (EDataCalView *view, const GSList *ids)
 {
 	EDataCalViewPrivate *priv;
-	const GList *l;
+	const GSList *l;
 
 	g_return_if_fail (view && E_IS_DATA_CAL_VIEW (view));
 	priv = view->priv;
@@ -726,15 +714,15 @@ e_data_cal_view_notify_objects_removed (EDataCalView *view, const GList *ids)
 
 /**
  * e_data_cal_view_notify_objects_removed_1:
- * @query: A query object.
+ * @view: A view object.
  * @id: ID of the removed object.
  *
- * Notifies all query listener of the removal of a single object.
+ * Notifies all view listener of the removal of a single object.
  */
 void
 e_data_cal_view_notify_objects_removed_1 (EDataCalView *view, const ECalComponentId *id)
 {
-	GList l = {NULL,};
+	GSList l = {NULL,};
 
 	g_return_if_fail (view && E_IS_DATA_CAL_VIEW (view));
 	g_return_if_fail (id);
@@ -745,14 +733,14 @@ e_data_cal_view_notify_objects_removed_1 (EDataCalView *view, const ECalComponen
 
 /**
  * e_data_cal_view_notify_progress:
- * @query: A query object.
- * @message: Progress message to send to listeners.
+ * @view: A view object.
  * @percent: Percentage completed.
+ * @message: Progress message to send to listeners.
  *
- * Notifies all query listeners of progress messages.
+ * Notifies all view listeners of progress messages.
  */
 void
-e_data_cal_view_notify_progress (EDataCalView *view, const gchar *message, gint percent)
+e_data_cal_view_notify_progress (EDataCalView *view, gint percent, const gchar *message)
 {
 	EDataCalViewPrivate *priv;
 	gchar *gdbus_message = NULL;
@@ -763,21 +751,21 @@ e_data_cal_view_notify_progress (EDataCalView *view, const gchar *message, gint
 	if (!priv->started || priv->stopped)
 		return;
 
-	e_gdbus_cal_view_emit_progress (view->priv->gdbus_object, e_util_ensure_gdbus_string (message, &gdbus_message), percent);
+	e_gdbus_cal_view_emit_progress (view->priv->gdbus_object, percent, e_util_ensure_gdbus_string (message, &gdbus_message));
 
 	g_free (gdbus_message);
 }
 
 /**
- * e_data_cal_view_notify_done:
- * @query: A query object.
- * @error: Query completion error, if any.
+ * e_data_cal_view_notify_complete:
+ * @view: A view object.
+ * @error: View completion error, if any.
  *
- * Notifies all query listeners of the completion of the query, including a
+ * Notifies all view listeners of the completion of the view, including a
  * status code.
  */
 void
-e_data_cal_view_notify_done (EDataCalView *view, const GError *error)
+e_data_cal_view_notify_complete (EDataCalView *view, const GError *error)
 {
 	EDataCalViewPrivate *priv;
 
@@ -789,9 +777,9 @@ e_data_cal_view_notify_done (EDataCalView *view, const GError *error)
 
 	g_mutex_lock (priv->pending_mutex);
 
-	priv->done = TRUE;
+	priv->complete = TRUE;
 
-	notify_done (view, error);
+	notify_complete (view, error);
 
 	g_mutex_unlock (priv->pending_mutex);
 }
diff --git a/calendar/libedata-cal/e-data-cal-view.h b/calendar/libedata-cal/e-data-cal-view.h
index 2ec3f48..81825cc 100644
--- a/calendar/libedata-cal/e-data-cal-view.h
+++ b/calendar/libedata-cal/e-data-cal-view.h
@@ -1,4 +1,4 @@
-/* Evolution calendar - Live search query implementation
+/* Evolution calendar - Live search view implementation
  *
  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
  *
@@ -36,9 +36,6 @@ G_BEGIN_DECLS
 #define E_DATA_CAL_VIEW(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_DATA_CAL_VIEW_TYPE, EDataCalView))
 #define E_DATA_CAL_VIEW_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), E_DATA_CAL_VIEW_TYPE, EDataCalViewClass))
 #define E_IS_DATA_CAL_VIEW(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_DATA_CAL_VIEW_TYPE))
-/* Deprecated macros */
-#define QUERY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_DATA_CAL_VIEW_TYPE, EDataCalView))
-#define IS_QUERY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_DATA_CAL_VIEW_TYPE))
 
 typedef struct _EDataCalViewPrivate EDataCalViewPrivate;
 
@@ -51,37 +48,24 @@ struct _EDataCalViewClass {
 	GObjectClass parent_class;
 };
 
-GType                 e_data_cal_view_get_type (void);
-EDataCalView         *e_data_cal_view_new (ECalBackend *backend, ECalBackendSExp *sexp);
+GType			e_data_cal_view_get_type			(void);
+EDataCalView *		e_data_cal_view_new				(ECalBackend *backend, ECalBackendSExp *sexp);
+guint			e_data_cal_view_register_gdbus_object		(EDataCalView *view, GDBusConnection *connection, const gchar *object_path, GError **error);
+const gchar *		e_data_cal_view_get_text			(EDataCalView *view);
+ECalBackendSExp *	e_data_cal_view_get_object_sexp			(EDataCalView *view);
+gboolean		e_data_cal_view_object_matches			(EDataCalView *view, const gchar *object);
+gboolean		e_data_cal_view_is_started			(EDataCalView *view);
+gboolean		e_data_cal_view_is_completed			(EDataCalView *view);
+gboolean		e_data_cal_view_is_stopped			(EDataCalView *view);
 
-guint e_data_cal_view_register_gdbus_object (EDataCalView *query, GDBusConnection *connection, const gchar *object_path, GError **error);
-
-const gchar           *e_data_cal_view_get_text (EDataCalView *query);
-ECalBackendSExp      *e_data_cal_view_get_object_sexp (EDataCalView *query);
-gboolean              e_data_cal_view_object_matches (EDataCalView *query, const gchar *object);
-
-GList                *e_data_cal_view_get_matched_objects (EDataCalView *query);
-gboolean              e_data_cal_view_is_started (EDataCalView *query);
-gboolean              e_data_cal_view_is_done (EDataCalView *query);
-gboolean              e_data_cal_view_is_stopped (EDataCalView *query);
-
-void                  e_data_cal_view_notify_objects_added (EDataCalView       *query,
-							    const GList *objects);
-void                  e_data_cal_view_notify_objects_added_1 (EDataCalView       *query,
-							      const gchar *object);
-void                  e_data_cal_view_notify_objects_modified (EDataCalView       *query,
-							       const GList *objects);
-void                  e_data_cal_view_notify_objects_modified_1 (EDataCalView       *query,
-								 const gchar *object);
-void                  e_data_cal_view_notify_objects_removed (EDataCalView       *query,
-							      const GList *ids);
-void                  e_data_cal_view_notify_objects_removed_1 (EDataCalView       *query,
-								const ECalComponentId *id);
-void                  e_data_cal_view_notify_progress (EDataCalView      *query,
-						       const gchar *message,
-						       gint         percent);
-void                  e_data_cal_view_notify_done (EDataCalView                               *query,
-						   const GError *error);
+void			e_data_cal_view_notify_objects_added		(EDataCalView *view, const GSList *objects);
+void			e_data_cal_view_notify_objects_added_1		(EDataCalView *view, const gchar *object);
+void			e_data_cal_view_notify_objects_modified		(EDataCalView *view, const GSList *objects);
+void			e_data_cal_view_notify_objects_modified_1	(EDataCalView *view, const gchar *object);
+void			e_data_cal_view_notify_objects_removed		(EDataCalView *view, const GSList *ids);
+void			e_data_cal_view_notify_objects_removed_1	(EDataCalView *view, const ECalComponentId *id);
+void			e_data_cal_view_notify_progress			(EDataCalView *view, gint percent, const gchar *message);
+void			e_data_cal_view_notify_complete			(EDataCalView *view, const GError *error);
 
 G_END_DECLS
 
diff --git a/calendar/libedata-cal/e-data-cal.c b/calendar/libedata-cal/e-data-cal.c
index 87e9dd6..7aeddf6 100644
--- a/calendar/libedata-cal/e-data-cal.c
+++ b/calendar/libedata-cal/e-data-cal.c
@@ -31,11 +31,13 @@
 #include <unistd.h>
 
 #include <glib-object.h>
-#include <libedataserver/e-debug-log.h>
+#include <libedataserver/e-credentials.h>
 #include <libedataserver/e-data-server-util.h>
+#include <libedataserver/e-operation-pool.h>
+
 #include "e-data-cal.h"
 #include "e-data-cal-enumtypes.h"
-#include "e-gdbus-egdbuscal.h"
+#include "e-gdbus-cal.h"
 
 G_DEFINE_TYPE (EDataCal, e_data_cal, G_TYPE_OBJECT);
 
@@ -44,11 +46,312 @@ G_DEFINE_TYPE (EDataCal, e_data_cal, G_TYPE_OBJECT);
 
 struct _EDataCalPrivate {
 	EGdbusCal *gdbus_object;
+
 	ECalBackend *backend;
 	ESource *source;
-	GHashTable *live_queries;
+
+	GStaticRecMutex pending_ops_lock;
+	GHashTable *pending_ops; /* opid to GCancellable for still running operations */
 };
 
+static EOperationPool *ops_pool = NULL;
+
+typedef enum {
+	OP_OPEN,
+	OP_AUTHENTICATE,
+	OP_REMOVE,
+	OP_REFRESH,
+	OP_GET_CACHE_DIR,
+	OP_GET_CAPABILITIES,
+	OP_GET_CAL_EMAIL_ADDRESS,
+	OP_GET_ALARM_EMAIL_ADDRESS,
+	OP_GET_DEFAULT_OBJECT,
+	OP_GET_OBJECT,
+	OP_GET_OBJECT_LIST,
+	OP_GET_FREE_BUSY,
+	OP_CREATE_OBJECT,
+	OP_MODIFY_OBJECT,
+	OP_REMOVE_OBJECT,
+	OP_RECEIVE_OBJECTS,
+	OP_SEND_OBJECTS,
+	OP_GET_ATTACHMENT_URIS,
+	OP_GET_VIEW,
+	OP_GET_TIMEZONE,
+	OP_ADD_TIMEZONE,
+	OP_CANCEL_OPERATION,
+	OP_CANCEL_ALL,
+	OP_CLOSE
+} OperationID;
+
+typedef struct {
+	OperationID op;
+	guint32 id; /* operation id */
+	EDataCal *cal; /* calendar */
+	GCancellable *cancellable;
+
+	union {
+		/* OP_OPEN */
+		gboolean only_if_exists;
+		/* OP_AUTHENTICATE */
+		ECredentials *credentials;
+		/* OP_GET_OBJECT */
+		/* OP_GET_ATTACHMENT_URIS */
+		struct _ur {
+			gchar *uid;
+			gchar *rid;
+		} ur;
+		/* OP_GET_OBJECT_LIST */
+		/* OP_GET_VIEW */
+		gchar *sexp;
+		/* OP_GET_FREE_BUSY */
+		struct _free_busy {
+			time_t start, end;
+			GSList *users;
+		} fb;
+		/* OP_CREATE_OBJECT */
+		/* OP_RECEIVE_OBJECTS */
+		/* OP_SEND_OBJECTS */
+		struct _co {
+			gchar *calobj;
+		} co;
+		/* OP_MODIFY_OBJECT */
+		struct _mo {
+			gchar *calobj;
+			EDataCalObjModType mod;
+		} mo;
+		/* OP_REMOVE_OBJECT */
+		struct _ro {
+			gchar *uid;
+			gchar *rid;
+			EDataCalObjModType mod;
+		} ro;
+		/* OP_GET_TIMEZONE */
+		gchar *tzid;
+		/* OP_ADD_TIMEZONE */
+		gchar *tzobject;
+		/* OP_CANCEL_OPERATION */
+		guint opid;
+
+		/* OP_REMOVE */
+		/* OP_REFRESH */
+		/* OP_GET_CACHE_DIR */
+		/* OP_GET_CAPABILITIES */
+		/* OP_GET_CAL_EMAIL_ADDRESS */
+		/* OP_GET_ALARM_EMAIL_ADDRESS */
+		/* OP_GET_DEFAULT_OBJECT */
+		/* OP_CANCEL_ALL */
+		/* OP_CLOSE */
+	} d;
+} OperationData;
+
+/* Function to get a new EDataCalView path, used by getView below */
+static gchar *
+construct_calview_path (void)
+{
+	static guint counter = 1;
+	return g_strdup_printf ("/org/gnome/evolution/dataserver/CalendarView/%d/%d", getpid(), counter++);
+}
+
+static void
+cancel_ops_cb (gpointer opid, gpointer cancellable, gpointer user_data)
+{
+	g_return_if_fail (cancellable != NULL);
+
+	g_cancellable_cancel (cancellable);
+}
+
+static void
+operation_thread (gpointer data, gpointer user_data)
+{
+	OperationData *op = data;
+	ECalBackend *backend;
+
+	backend = e_data_cal_get_backend (op->cal);
+
+	switch (op->op) {
+	case OP_OPEN:
+		e_cal_backend_open (backend, op->cal, op->id, op->cancellable, op->d.only_if_exists);
+		break;
+	case OP_AUTHENTICATE:
+		e_cal_backend_authenticate_user (backend, op->cal, op->id, op->cancellable, op->d.credentials);
+		e_credentials_free (op->d.credentials);
+		break;
+	case OP_REMOVE:
+		e_cal_backend_remove (backend, op->cal, op->id, op->cancellable);
+		break;
+	case OP_REFRESH:
+		e_cal_backend_refresh (backend, op->cal, op->id, op->cancellable);
+		break;
+	case OP_GET_CACHE_DIR: {
+		gchar *gdbus_cache_dir = NULL;
+
+		e_gdbus_cal_emit_get_cache_dir_done (op->cal->priv->gdbus_object, op->id, NULL, e_util_ensure_gdbus_string (e_cal_backend_get_cache_dir (backend), &gdbus_cache_dir));
+
+		g_free (gdbus_cache_dir);
+		} break;
+	case OP_GET_CAPABILITIES:
+		e_cal_backend_get_capabilities (backend, op->cal, op->id, op->cancellable);
+		break;
+	case OP_GET_CAL_EMAIL_ADDRESS:
+		e_cal_backend_get_cal_email_address (backend, op->cal, op->id, op->cancellable);
+		break;
+	case OP_GET_ALARM_EMAIL_ADDRESS:
+		e_cal_backend_get_alarm_email_address (backend, op->cal, op->id, op->cancellable);
+		break;
+	case OP_GET_DEFAULT_OBJECT:
+		e_cal_backend_get_default_object (backend, op->cal, op->id, op->cancellable);
+		break;
+	case OP_GET_OBJECT:
+		e_cal_backend_get_object (backend, op->cal, op->id, op->cancellable, op->d.ur.uid, op->d.ur.rid && *op->d.ur.rid ? op->d.ur.rid : NULL);
+		g_free (op->d.ur.uid);
+		g_free (op->d.ur.rid);
+		break;
+	case OP_GET_OBJECT_LIST:
+		e_cal_backend_get_object_list (backend, op->cal, op->id, op->cancellable, op->d.sexp);
+		g_free (op->d.sexp);
+		break;
+	case OP_GET_FREE_BUSY:
+		e_cal_backend_get_free_busy (backend, op->cal, op->id, op->cancellable, op->d.fb.users, op->d.fb.start, op->d.fb.end);
+		g_slist_foreach (op->d.fb.users, (GFunc) g_free, NULL);
+		g_slist_free (op->d.fb.users);
+		break;
+	case OP_CREATE_OBJECT:
+		e_cal_backend_create_object (backend, op->cal, op->id, op->cancellable, op->d.co.calobj);
+		g_free (op->d.co.calobj);
+		break;
+	case OP_MODIFY_OBJECT:
+		e_cal_backend_modify_object (backend, op->cal, op->id, op->cancellable, op->d.mo.calobj, op->d.mo.mod);
+		g_free (op->d.mo.calobj);
+		break;
+	case OP_REMOVE_OBJECT:
+		e_cal_backend_remove_object (backend, op->cal, op->id, op->cancellable, op->d.ro.uid, op->d.ro.rid && *op->d.ro.rid ? op->d.ro.rid : NULL, op->d.ro.mod);
+		g_free (op->d.ro.uid);
+		g_free (op->d.ro.rid);
+		break;
+	case OP_RECEIVE_OBJECTS:
+		e_cal_backend_receive_objects (backend, op->cal, op->id, op->cancellable, op->d.co.calobj);
+		g_free (op->d.co.calobj);
+		break;
+	case OP_SEND_OBJECTS:
+		e_cal_backend_send_objects (backend, op->cal, op->id, op->cancellable, op->d.co.calobj);
+		g_free (op->d.co.calobj);
+		break;
+	case OP_GET_ATTACHMENT_URIS:
+		e_cal_backend_get_attachment_uris (backend, op->cal, op->id, op->cancellable, op->d.ur.uid, op->d.ur.rid && *op->d.ur.rid ? op->d.ur.rid : NULL);
+		g_free (op->d.ur.uid);
+		g_free (op->d.ur.rid);
+		break;
+	case OP_GET_VIEW:
+		if (op->d.sexp) {
+			EDataCalView *view;
+			ECalBackendSExp *obj_sexp;
+			gchar *path;
+			GError *error = NULL;
+
+			/* we handle this entirely here, since it doesn't require any
+			   backend involvement now that we have e_cal_view_start to
+			   actually kick off the search. */
+
+			obj_sexp = e_cal_backend_sexp_new (op->d.sexp);
+			if (!obj_sexp) {
+				g_free (op->d.sexp);
+				e_data_cal_respond_get_view (op->cal, op->id, EDC_ERROR (InvalidQuery), NULL);
+				break;
+			}
+
+			view = e_data_cal_view_new (backend, obj_sexp);
+			if (!view) {
+				g_object_unref (obj_sexp);
+				g_free (op->d.sexp);
+				e_data_cal_respond_get_view (op->cal, op->id, EDC_ERROR (OtherError), NULL);
+				break;
+			}
+
+			path = construct_calview_path ();
+			e_data_cal_view_register_gdbus_object (view, e_gdbus_cal_stub_get_connection (op->cal->priv->gdbus_object), path, &error);
+
+			if (error) {
+				g_object_unref (view);
+				g_free (op->d.sexp);
+				e_data_cal_respond_get_view (op->cal, op->id, EDC_ERROR_EX (OtherError, error->message), NULL);
+				g_error_free (error);
+				g_free (path);
+
+				break;
+			}
+
+			e_cal_backend_add_view (backend, view);
+
+			e_data_cal_respond_get_view (op->cal, op->id, EDC_ERROR (Success), path);
+
+			g_free (path);
+		}
+		g_free (op->d.sexp);
+		break;
+	case OP_GET_TIMEZONE:
+		e_cal_backend_get_timezone (backend, op->cal, op->id, op->cancellable, op->d.tzid);
+		g_free (op->d.tzid);
+		break;
+	case OP_ADD_TIMEZONE:
+		e_cal_backend_add_timezone (backend, op->cal, op->id, op->cancellable, op->d.tzobject);
+		g_free (op->d.tzobject);
+		break;
+	case OP_CANCEL_OPERATION:
+		g_static_rec_mutex_lock (&op->cal->priv->pending_ops_lock);
+
+		if (g_hash_table_lookup (op->cal->priv->pending_ops, GUINT_TO_POINTER (op->d.opid))) {
+			GCancellable *cancellable = g_hash_table_lookup (op->cal->priv->pending_ops, GUINT_TO_POINTER (op->d.opid));
+
+			g_cancellable_cancel (cancellable);
+		}
+
+		g_static_rec_mutex_unlock (&op->cal->priv->pending_ops_lock);
+		break;
+	case OP_CLOSE:
+		/* close just cancels all pending ops and frees data cal */
+		e_cal_backend_remove_client (backend, op->cal);
+	case OP_CANCEL_ALL:
+		g_static_rec_mutex_lock (&op->cal->priv->pending_ops_lock);
+		g_hash_table_foreach (op->cal->priv->pending_ops, cancel_ops_cb, NULL);
+		g_static_rec_mutex_unlock (&op->cal->priv->pending_ops_lock);
+		break;
+	}
+
+	g_object_unref (op->cal);
+	g_object_unref (op->cancellable);
+	g_slice_free (OperationData, op);
+}
+
+static OperationData *
+op_new (OperationID op, EDataCal *cal)
+{
+	OperationData *data;
+
+	data = g_slice_new0 (OperationData);
+	data->op = op;
+	data->cal = g_object_ref (cal);
+	data->id = e_operation_pool_reserve_opid (ops_pool);
+	data->cancellable = g_cancellable_new ();
+
+	g_static_rec_mutex_lock (&cal->priv->pending_ops_lock);
+	g_hash_table_insert (cal->priv->pending_ops, GUINT_TO_POINTER (data->id), g_object_ref (data->cancellable));
+	g_static_rec_mutex_unlock (&cal->priv->pending_ops_lock);
+
+	return data;
+}
+
+static void
+op_complete (EDataCal *cal, guint32 opid)
+{
+	g_return_if_fail (cal != NULL);
+
+	e_operation_pool_release_opid (ops_pool, opid);
+
+	g_static_rec_mutex_lock (&cal->priv->pending_ops_lock);
+	g_hash_table_remove (cal->priv->pending_ops, GUINT_TO_POINTER (opid));
+	g_static_rec_mutex_unlock (&cal->priv->pending_ops_lock);
+}
+
 /* Create the EDataCal error quark */
 GQuark
 e_data_cal_error_quark (void)
@@ -195,6 +498,19 @@ data_cal_return_error (GDBusMethodInvocation *invocation, const GError *perror,
 	g_error_free (error);
 }
 
+
+EDataCal *
+e_data_cal_new (ECalBackend *backend, ESource *source)
+{
+	EDataCal *cal;
+
+	cal = g_object_new (E_TYPE_DATA_CAL, NULL);
+	cal->priv->backend = g_object_ref (backend);
+	cal->priv->source = g_object_ref (source);
+
+	return cal;
+}
+
 /**
  * e_data_cal_get_source:
  * @cal: an #EDataCal
@@ -208,344 +524,388 @@ data_cal_return_error (GDBusMethodInvocation *invocation, const GError *perror,
 ESource*
 e_data_cal_get_source (EDataCal *cal)
 {
-  return cal->priv->source;
+	return cal->priv->source;
 }
 
 ECalBackend*
 e_data_cal_get_backend (EDataCal *cal)
 {
-  return cal->priv->backend;
+	return cal->priv->backend;
 }
 
-/* EDataCal::getUri method */
-static gboolean
-impl_Cal_getUri (EGdbusCal *object, GDBusMethodInvocation *invocation, EDataCal *cal)
+/**
+ * e_data_cal_register_gdbus_object:
+ *
+ * Registers GDBus object of this EDataCal.
+ *
+ * Since: 2.32
+ **/
+guint
+e_data_cal_register_gdbus_object (EDataCal *cal, GDBusConnection *connection, const gchar *object_path, GError **error)
 {
-	e_gdbus_cal_complete_get_uri (object, invocation, e_cal_backend_get_uri (cal->priv->backend));
+	g_return_val_if_fail (cal != NULL, 0);
+	g_return_val_if_fail (E_IS_DATA_CAL (cal), 0);
+	g_return_val_if_fail (connection != NULL, 0);
+	g_return_val_if_fail (object_path != NULL, 0);
 
-	return TRUE;
+	return e_gdbus_cal_register_object (cal->priv->gdbus_object, connection, object_path, error);
 }
 
-/* EDataCal::getCacheDir method */
+
 static gboolean
-impl_Cal_getCacheDir (EGdbusCal *object, GDBusMethodInvocation *invocation, EDataCal *cal)
+impl_Cal_open (EGdbusCal *object, GDBusMethodInvocation *invocation, gboolean in_only_if_exists, EDataCal *cal)
 {
-	e_gdbus_cal_complete_get_cache_dir (object, invocation, e_cal_backend_get_cache_dir (cal->priv->backend));
+	OperationData *op;
 
-	return TRUE;
-}
+	op = op_new (OP_OPEN, cal);
+	op->d.only_if_exists = in_only_if_exists;
 
-/* EDataCal::open method */
-static gboolean
-impl_Cal_open (EGdbusCal *object, GDBusMethodInvocation *invocation, gboolean only_if_exists, const gchar *username, const gchar *password, EDataCal *cal)
-{
-	e_cal_backend_open (cal->priv->backend, cal, invocation, only_if_exists, username, password);
+	e_gdbus_cal_complete_open (cal->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
-/* EDataCal::refresh method */
 static gboolean
-impl_Cal_refresh (EGdbusCal *object, GDBusMethodInvocation *invocation, EDataCal *cal)
+impl_Cal_authenticateUser (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar * const *in_credentials, EDataCal *cal)
 {
-	e_cal_backend_refresh (cal->priv->backend, cal, invocation);
+	OperationData *op;
 
-	return TRUE;
-}
+	if (in_credentials == NULL) {
+		GError *error = e_data_cal_create_error (InvalidArg, NULL);
+		/* Translators: This is prefix to a detailed error message */
+		data_cal_return_error (invocation, error, _("Cannot authenticate user: "));
+		g_error_free (error);
+		return TRUE;
+	}
 
-/* EDataCal::close method */
-static gboolean
-impl_Cal_close (EGdbusCal *object, GDBusMethodInvocation *invocation, EDataCal *cal)
-{
-	e_cal_backend_remove_client (cal->priv->backend, cal);
-	e_gdbus_cal_complete_close (object, invocation);
+	op = op_new (OP_AUTHENTICATE, cal);
+	op->d.credentials = e_credentials_new_strv (in_credentials);
 
-	g_object_unref (cal);
+	e_gdbus_cal_complete_authenticate_user (cal->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
-/* EDataCal::remove method */
 static gboolean
 impl_Cal_remove (EGdbusCal *object, GDBusMethodInvocation *invocation, EDataCal *cal)
 {
-	e_cal_backend_remove (cal->priv->backend, cal, invocation);
+	OperationData *op;
 
-	return TRUE;
-}
+	op = op_new (OP_REMOVE, cal);
 
-/* EDataCal::isReadOnly method */
-static gboolean
-impl_Cal_isReadOnly (EGdbusCal *object, GDBusMethodInvocation *invocation, EDataCal *cal)
-{
-	e_cal_backend_is_read_only (cal->priv->backend, cal);
-	e_gdbus_cal_complete_is_read_only (object, invocation);
+	e_gdbus_cal_complete_remove (cal->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
-/* EDataCal::getCalAddress method */
 static gboolean
-impl_Cal_getCalAddress (EGdbusCal *object, GDBusMethodInvocation *invocation, EDataCal *cal)
+impl_Cal_refresh (EGdbusCal *object, GDBusMethodInvocation *invocation, EDataCal *cal)
 {
-	e_cal_backend_get_cal_address (cal->priv->backend, cal, invocation);
+	OperationData *op;
+
+	op = op_new (OP_REFRESH, cal);
+
+	e_gdbus_cal_complete_refresh (cal->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
-/* EDataCal::getAlarmEmailAddress method */
 static gboolean
-impl_Cal_getAlarmEmailAddress (EGdbusCal *object, GDBusMethodInvocation *invocation, EDataCal *cal)
+impl_Cal_getCacheDir (EGdbusCal *object, GDBusMethodInvocation *invocation, EDataCal *cal)
 {
-	e_cal_backend_get_alarm_email_address (cal->priv->backend, cal, invocation);
+	OperationData *op;
+
+	op = op_new (OP_GET_CACHE_DIR, cal);
+
+	e_gdbus_cal_complete_get_cache_dir (cal->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
-/* EDataCal::getLdapAttribute method */
 static gboolean
-impl_Cal_getLdapAttribute (EGdbusCal *object, GDBusMethodInvocation *invocation, EDataCal *cal)
+impl_Cal_getCapabilities (EGdbusCal *object, GDBusMethodInvocation *invocation, EDataCal *cal)
 {
-	e_cal_backend_get_ldap_attribute (cal->priv->backend, cal, invocation);
+	OperationData *op;
+
+	op = op_new (OP_GET_CAPABILITIES, cal);
+
+	e_gdbus_cal_complete_get_capabilities (cal->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
-/* EDataCal::getSchedulingInformation method */
 static gboolean
-impl_Cal_getSchedulingInformation (EGdbusCal *object, GDBusMethodInvocation *invocation, EDataCal *cal)
+impl_Cal_getCalEmailAddress (EGdbusCal *object, GDBusMethodInvocation *invocation, EDataCal *cal)
 {
-	e_cal_backend_get_static_capabilities (cal->priv->backend, cal, invocation);
+	OperationData *op;
+
+	op = op_new (OP_GET_CAL_EMAIL_ADDRESS, cal);
+
+	e_gdbus_cal_complete_get_cal_email_address (cal->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
-/* EDataCal::setMode method */
 static gboolean
-impl_Cal_setMode (EGdbusCal *object, GDBusMethodInvocation *invocation, EDataCalMode mode, EDataCal *cal)
+impl_Cal_getAlarmEmailAddress (EGdbusCal *object, GDBusMethodInvocation *invocation, EDataCal *cal)
 {
-	e_cal_backend_set_mode (cal->priv->backend, mode);
-	e_gdbus_cal_complete_set_mode (object, invocation);
+	OperationData *op;
+
+	op = op_new (OP_GET_ALARM_EMAIL_ADDRESS, cal);
+
+	e_gdbus_cal_complete_get_alarm_email_address (cal->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
-/* EDataCal::getDefaultObject method */
 static gboolean
 impl_Cal_getDefaultObject (EGdbusCal *object, GDBusMethodInvocation *invocation, EDataCal *cal)
 {
-	e_cal_backend_get_default_object (cal->priv->backend, cal, invocation);
+	OperationData *op;
 
-	return TRUE;
-}
+	op = op_new (OP_GET_DEFAULT_OBJECT, cal);
 
-/* EDataCal::getObject method */
-static gboolean
-impl_Cal_getObject (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *uid, const gchar *rid, EDataCal *cal)
-{
-	e_cal_backend_get_object (cal->priv->backend, cal, invocation, uid, rid);
+	e_gdbus_cal_complete_get_default_object (cal->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
-/* EDataCal::getObjectList method */
 static gboolean
-impl_Cal_getObjectList (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *sexp, EDataCal *cal)
+impl_Cal_getObject (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar * const *in_uid_rid, EDataCal *cal)
 {
-	e_cal_backend_get_object_list (cal->priv->backend, cal, invocation, sexp);
+	OperationData *op;
+
+	op = op_new (OP_GET_OBJECT, cal);
+	g_return_val_if_fail (e_gdbus_cal_decode_get_object (in_uid_rid, &op->d.ur.uid, &op->d.ur.rid), FALSE);
+
+	e_gdbus_cal_complete_get_object (cal->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
-/* EDataCal::getChanges method */
 static gboolean
-impl_Cal_getChanges (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *change_id, EDataCal *cal)
+impl_Cal_getObjectList (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *in_sexp, EDataCal *cal)
 {
-	e_cal_backend_get_changes (cal->priv->backend, cal, invocation, change_id);
+	OperationData *op;
+
+	op = op_new (OP_GET_OBJECT_LIST, cal);
+	op->d.sexp = g_strdup (in_sexp);
+
+	e_gdbus_cal_complete_get_object_list (cal->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
-/* EDataCal::getFreeBusy method */
 static gboolean
-impl_Cal_getFreeBusy (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar **user_list, guint start, guint end, EDataCal *cal)
+impl_Cal_getFreeBusy (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar * const *in_start_end_userlist, EDataCal *cal)
 {
-	GList *users = NULL;
+	OperationData *op;
+	guint start, end;
 
-	if (user_list) {
-		gint i;
+	op = op_new (OP_GET_FREE_BUSY, cal);
+	g_return_val_if_fail (e_gdbus_cal_decode_get_free_busy (in_start_end_userlist, &start, &end, &op->d.fb.users), FALSE);
 
-		for (i = 0; user_list[i]; i++)
-			users = g_list_append (users, (gpointer)user_list[i]);
-	}
+	op->d.fb.start = (time_t) start;
+	op->d.fb.end = (time_t) end;
 
-	/* call the backend's get_free_busy method */
-	e_cal_backend_get_free_busy (cal->priv->backend, cal, invocation, users, (time_t)start, (time_t)end);
+	e_gdbus_cal_complete_get_free_busy (cal->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
-/* EDataCal::discardAlarm method */
 static gboolean
-impl_Cal_discardAlarm (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *uid, const gchar *auid, EDataCal *cal)
+impl_Cal_createObject (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *in_calobj, EDataCal *cal)
 {
-	e_cal_backend_discard_alarm (cal->priv->backend, cal, invocation, uid, auid);
+	OperationData *op;
 
-	return TRUE;
-}
+	op = op_new (OP_CREATE_OBJECT, cal);
+	op->d.co.calobj = g_strdup (in_calobj);
 
-/* EDataCal::createObject method */
-static gboolean
-impl_Cal_createObject (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *calobj, EDataCal *cal)
-{
-	e_cal_backend_create_object (cal->priv->backend, cal, invocation, calobj);
+	e_gdbus_cal_complete_create_object (cal->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
-/* EDataCal::modifyObject method */
 static gboolean
-impl_Cal_modifyObject (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *calobj, EDataCalObjModType mod, EDataCal *cal)
+impl_Cal_modifyObject (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar * const *in_calobj_mod, EDataCal *cal)
 {
-	e_cal_backend_modify_object (cal->priv->backend, cal, invocation, calobj, mod);
+	OperationData *op;
+	guint mod;
+
+	op = op_new (OP_MODIFY_OBJECT, cal);
+	g_return_val_if_fail (e_gdbus_cal_decode_modify_object (in_calobj_mod, &op->d.mo.calobj, &mod), FALSE);
+	op->d.mo.mod = mod;
+
+	e_gdbus_cal_complete_modify_object (cal->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
-/* EDataCal::removeObject method */
 static gboolean
-impl_Cal_removeObject (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *uid, const gchar *rid, EDataCalObjModType mod, EDataCal *cal)
+impl_Cal_removeObject (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar * const *in_uid_rid_mod, EDataCal *cal)
 {
-	if (rid[0] == '\0')
-		rid = NULL;
+	OperationData *op;
+	guint mod = 0;
 
-	e_cal_backend_remove_object (cal->priv->backend, cal, invocation, uid, rid, mod);
+	op = op_new (OP_REMOVE_OBJECT, cal);
+	g_return_val_if_fail (e_gdbus_cal_decode_remove_object (in_uid_rid_mod, &op->d.ro.uid, &op->d.ro.rid, &mod), FALSE);
+	op->d.ro.mod = mod;
+
+	e_gdbus_cal_complete_remove_object (cal->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
-/* EDataCal::receiveObjects method */
 static gboolean
-impl_Cal_receiveObjects (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *calobj, EDataCal *cal)
+impl_Cal_receiveObjects (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *in_calobj, EDataCal *cal)
 {
-	e_cal_backend_receive_objects (cal->priv->backend, cal, invocation, calobj);
+	OperationData *op;
+
+	op = op_new (OP_RECEIVE_OBJECTS, cal);
+	op->d.co.calobj = g_strdup (in_calobj);
+
+	e_gdbus_cal_complete_receive_objects (cal->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
-/* EDataCal::sendObjects method */
 static gboolean
-impl_Cal_sendObjects (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *calobj, EDataCal *cal)
+impl_Cal_sendObjects (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *in_calobj, EDataCal *cal)
 {
-	e_cal_backend_send_objects (cal->priv->backend, cal, invocation, calobj);
+	OperationData *op;
+
+	op = op_new (OP_SEND_OBJECTS, cal);
+	op->d.co.calobj = g_strdup (in_calobj);
+
+	e_gdbus_cal_complete_send_objects (cal->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
-/* EDataCal::getAttachmentList method */
 static gboolean
-impl_Cal_getAttachmentList (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *uid, const gchar *rid, EDataCal *cal)
+impl_Cal_getAttachmentUris (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar * const *in_uid_rid, EDataCal *cal)
 {
-	e_cal_backend_get_attachment_list (cal->priv->backend, cal, invocation, uid, rid);
+	OperationData *op;
 
-	return TRUE;
-}
+	op = op_new (OP_GET_ATTACHMENT_URIS, cal);
+	g_return_val_if_fail (e_gdbus_cal_decode_get_attachment_uris (in_uid_rid, &op->d.ur.uid, &op->d.ur.rid), FALSE);
 
-/* Function to get a new EDataCalView path, used by getQuery below */
-static gchar *
-construct_calview_path (void)
-{
-	static guint counter = 1;
-	return g_strdup_printf ("/org/gnome/evolution/dataserver/CalendarView/%d/%d", getpid(), counter++);
+	e_gdbus_cal_complete_get_attachment_uris (cal->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
+
+	return TRUE;
 }
 
-/* EDataCal::getQuery method */
 static gboolean
-impl_Cal_getQuery (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *sexp, EDataCal *cal)
+impl_Cal_getView (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *in_sexp, EDataCal *cal)
 {
-	EDataCalView *query;
-	ECalBackendSExp *obj_sexp;
-	gchar *path;
-	GError *error = NULL;
+	OperationData *op;
 
-	/* we handle this entirely here, since it doesn't require any
-	   backend involvement now that we have e_cal_view_start to
-	   actually kick off the search. */
+	op = op_new (OP_GET_VIEW, cal);
+	op->d.sexp = g_strdup (in_sexp);
 
-	obj_sexp = e_cal_backend_sexp_new (sexp);
-	if (!obj_sexp) {
-		e_data_cal_notify_query (cal, invocation, EDC_ERROR (InvalidQuery), NULL);
-		return TRUE;
-	}
+	e_gdbus_cal_complete_get_view (cal->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
-	query = e_data_cal_view_new (cal->priv->backend, obj_sexp);
-	e_debug_log (FALSE, E_DEBUG_LOG_DOMAIN_CAL_QUERIES, "%p;%p;NEW;%s;%s", cal, query, sexp, G_OBJECT_TYPE_NAME (cal->priv->backend));
-	if (!query) {
-		g_object_unref (obj_sexp);
-		e_data_cal_notify_query (cal, invocation, EDC_ERROR (OtherError), NULL);
-		return TRUE;
-	}
+	return TRUE;
+}
 
-	/* log query to evaluate cache performance */
-	e_debug_log (FALSE, E_DEBUG_LOG_DOMAIN_CAL_QUERIES, "%p;%p;REUSED;%s;%s", cal, query, sexp, G_OBJECT_TYPE_NAME (cal->priv->backend));
+static gboolean
+impl_Cal_getTimezone (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *in_tzid, EDataCal *cal)
+{
+	OperationData *op;
 
-	path = construct_calview_path ();
-	e_data_cal_view_register_gdbus_object (query, g_dbus_method_invocation_get_connection (invocation), path, &error);
+	op = op_new (OP_GET_TIMEZONE, cal);
+	op->d.tzid = g_strdup (in_tzid);
 
-	if (error) {
-		g_object_unref (query);
-		e_data_cal_notify_query (cal, invocation, EDC_ERROR_EX (OtherError, error->message), NULL);
-		g_error_free (error);
-		g_free (path);
+	e_gdbus_cal_complete_get_timezone (cal->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
-		return TRUE;
-	}
+	return TRUE;
+}
 
-	e_cal_backend_add_query (cal->priv->backend, query);
+static gboolean
+impl_Cal_addTimezone (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *in_tzobject, EDataCal *cal)
+{
+	OperationData *op;
 
-	e_data_cal_notify_query (cal, invocation, EDC_ERROR (Success), path);
+	op = op_new (OP_ADD_TIMEZONE, cal);
+	op->d.tzobject = g_strdup (in_tzobject);
 
-	g_free (path);
+	e_gdbus_cal_complete_add_timezone (cal->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
-/* EDataCal::getTimezone method */
 static gboolean
-impl_Cal_getTimezone (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *tzid, EDataCal *cal)
+impl_Cal_cancelOperation (EGdbusCal *object, GDBusMethodInvocation *invocation, guint in_opid, EDataCal *cal)
 {
-	e_cal_backend_get_timezone (cal->priv->backend, cal, invocation, tzid);
+	OperationData *op;
+
+	op = op_new (OP_CANCEL_OPERATION, cal);
+	op->d.opid = in_opid;
+
+	e_gdbus_cal_complete_cancel_operation (cal->priv->gdbus_object, invocation, NULL);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
-/* EDataCal::addTimezone method */
 static gboolean
-impl_Cal_addTimezone (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *tz, EDataCal *cal)
+impl_Cal_cancelAll (EGdbusCal *object, GDBusMethodInvocation *invocation, EDataCal *cal)
 {
-	e_cal_backend_add_timezone (cal->priv->backend, cal, invocation, tz);
+	OperationData *op;
+
+	op = op_new (OP_CANCEL_ALL, cal);
+
+	e_gdbus_cal_complete_cancel_all (cal->priv->gdbus_object, invocation, NULL);
+	e_operation_pool_push (ops_pool, op);
 
 	return TRUE;
 }
 
-/* EDataCal::setDefaultTimezone method */
 static gboolean
-impl_Cal_setDefaultTimezone (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *tz, EDataCal *cal)
+impl_Cal_close (EGdbusCal *object, GDBusMethodInvocation *invocation, EDataCal *cal)
 {
-	e_cal_backend_set_default_zone (cal->priv->backend, cal, invocation, tz);
+	OperationData *op;
+
+	op = op_new (OP_CLOSE, cal);
+
+	e_gdbus_cal_complete_close (cal->priv->gdbus_object, invocation, NULL);
+	e_operation_pool_push (ops_pool, op);
+
+	g_object_unref (cal);
 
 	return TRUE;
 }
 
 /* free returned pointer with g_strfreev() */
 static gchar **
-create_str_array_from_glist (GList *lst)
+gslist_to_strv (const GSList *lst)
 {
 	gchar **seq;
-	GList *l;
+	const GSList *l;
 	gint i;
 
-	seq = g_new0 (gchar *, g_list_length (lst) + 1);
+	seq = g_new0 (gchar *, g_slist_length ((GSList *) lst) + 1);
 	for (l = lst, i = 0; l; l = l->next, i++) {
 		seq[i] = e_util_utf8_make_valid (l->data);
 	}
@@ -553,205 +913,268 @@ create_str_array_from_glist (GList *lst)
 	return seq;
 }
 
-/* free returned pointer with g_strfreev() */
-static gchar **
-create_str_array_from_gslist (GSList *lst)
+/**
+ * e_data_cal_notify_open:
+ * @cal: A calendar client interface.
+ * @error: Operation error, if any, automatically freed if passed it.
+ *
+ * Notifies listeners of the completion of the open method call.
+ */
+void
+e_data_cal_respond_open (EDataCal *cal, guint32 opid, GError *error)
 {
-	gchar **seq;
-	GSList *l;
-	gint i;
+	op_complete (cal, opid);
 
-	seq = g_new0 (gchar *, g_slist_length (lst) + 1);
-	for (l = lst, i = 0; l; l = l->next, i++) {
-		seq[i] = e_util_utf8_make_valid (l->data);
-	}
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Cannot open calendar: "));
 
-	return seq;
+	e_gdbus_cal_emit_open_done (cal->priv->gdbus_object, opid, error);
+
+	if (error)
+		g_error_free (error);
+}
+
+void
+e_data_cal_respond_authenticate_user (EDataCal *cal, guint32 opid, GError *error)
+{
+	op_complete (cal, opid);
+
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Cannot authenticate user: "));
+
+	e_gdbus_cal_emit_authenticate_user_done (cal->priv->gdbus_object, opid, error);
+
+	if (error)
+		g_error_free (error);
 }
 
 /**
- * e_data_cal_notify_read_only:
+ * e_data_cal_respond_remove:
  * @cal: A calendar client interface.
  * @error: Operation error, if any, automatically freed if passed it.
- * @read_only: Read only value.
  *
- * Notifies listeners of the completion of the is_read_only method call.
+ * Notifies listeners of the completion of the remove method call.
  */
 void
-e_data_cal_notify_read_only (EDataCal *cal, GError *error, gboolean read_only)
+e_data_cal_respond_remove (EDataCal *cal, guint32 opid, GError *error)
 {
-	g_return_if_fail (cal != NULL);
-	g_return_if_fail (E_IS_DATA_CAL (cal));
+	op_complete (cal, opid);
 
-	if (error) {
-		e_data_cal_notify_error (cal, error->message);
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Cannot remove calendar: "));
+
+	e_gdbus_cal_emit_remove_done (cal->priv->gdbus_object, opid, error);
+
+	if (error)
 		g_error_free (error);
-	} else {
-		e_gdbus_cal_emit_readonly (cal->priv->gdbus_object, read_only);
-	}
+	else
+		e_cal_backend_set_is_removed (cal->priv->backend, TRUE);
 }
 
 /**
- * e_data_cal_notify_cal_address:
+ * e_data_cal_respond_refresh:
  * @cal: A calendar client interface.
  * @error: Operation error, if any, automatically freed if passed it.
- * @address: Calendar address.
  *
- * Notifies listeners of the completion of the get_cal_address method call.
+ * Notifies listeners of the completion of the refresh method call.
+ *
+ * Since: 2.30
  */
 void
-e_data_cal_notify_cal_address (EDataCal *cal, EServerMethodContext context, GError *error, const gchar *address)
+e_data_cal_respond_refresh (EDataCal *cal, guint32 opid, GError *error)
 {
-	GDBusMethodInvocation *invocation = context;
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_cal_return_error (invocation, error, _("Cannot retrieve calendar address: %s"));
-		g_error_free (error);
-	} else {
-		gchar *gdbus_address = NULL;
+	op_complete (cal, opid);
 
-		e_gdbus_cal_complete_get_cal_address (cal->priv->gdbus_object, invocation, e_util_ensure_gdbus_string (address, &gdbus_address));
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Cannot refresh calendar: "));
 
-		g_free (gdbus_address);
-	}
+	e_gdbus_cal_emit_refresh_done (cal->priv->gdbus_object, opid, error);
+
+	if (error)
+		g_error_free (error);
 }
 
 /**
- * e_data_cal_notify_alarm_email_address:
+ * e_data_cal_respond_get_capabilities:
  * @cal: A calendar client interface.
  * @error: Operation error, if any, automatically freed if passed it.
- * @address: Alarm email address.
+ * @calabilities: Comma-separated list of capabilities for the calendar.
  *
- * Notifies listeners of the completion of the get_alarm_email_address method call.
+ * Notifies listeners of the completion of the get_capabilities method call.
  */
 void
-e_data_cal_notify_alarm_email_address (EDataCal *cal, EServerMethodContext context, GError *error, const gchar *address)
+e_data_cal_respond_get_capabilities (EDataCal *cal, guint32 opid, GError *error, const gchar *capabilities)
 {
-	GDBusMethodInvocation *invocation = context;
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_cal_return_error (invocation, error, _("Cannot retrieve calendar alarm e-mail address: %s"));
-		g_error_free (error);
-	} else {
-		gchar *gdbus_address = NULL;
+	gchar *gdbus_capabilities = NULL;
 
-		e_gdbus_cal_complete_get_alarm_email_address (cal->priv->gdbus_object, invocation, e_util_ensure_gdbus_string (address, &gdbus_address));
+	op_complete (cal, opid);
 
-		g_free (gdbus_address);
-	}
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Cannot retrieve calendar capabilities: "));
+
+	e_gdbus_cal_emit_get_capabilities_done (cal->priv->gdbus_object, opid, error, e_util_ensure_gdbus_string (capabilities, &gdbus_capabilities));
+
+	g_free (gdbus_capabilities);
+	if (error)
+		g_error_free (error);
 }
 
 /**
- * e_data_cal_notify_ldap_attribute:
+ * e_data_cal_respond_get_cal_email_address:
  * @cal: A calendar client interface.
  * @error: Operation error, if any, automatically freed if passed it.
- * @attibute: LDAP attribute.
+ * @address: Calendar address.
  *
- * Notifies listeners of the completion of the get_ldap_attribute method call.
+ * Notifies listeners of the completion of the get_cal_email_address method call.
  */
 void
-e_data_cal_notify_ldap_attribute (EDataCal *cal, EServerMethodContext context, GError *error, const gchar *attribute)
+e_data_cal_respond_get_cal_email_address (EDataCal *cal, guint32 opid, GError *error, const gchar *address)
 {
-	GDBusMethodInvocation *invocation = context;
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_cal_return_error (invocation, error, _("Cannot retrieve calendar's LDAP attribute: %s"));
-		g_error_free (error);
-	} else {
-		gchar *gdbus_attribute = NULL;
+	gchar *gdbus_address = NULL;
 
-		e_gdbus_cal_complete_get_ldap_attribute (cal->priv->gdbus_object, invocation, e_util_ensure_gdbus_string (attribute, &gdbus_attribute));
+	op_complete (cal, opid);
 
-		g_free (gdbus_attribute);
-	}
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Cannot retrieve calendar address: "));
+
+	e_gdbus_cal_emit_get_cal_email_address_done (cal->priv->gdbus_object, opid, error, e_util_ensure_gdbus_string (address, &gdbus_address));
+
+	g_free (gdbus_address);
+	if (error)
+		g_error_free (error);
 }
 
 /**
- * e_data_cal_notify_static_capabilities:
+ * e_data_cal_respond_get_alarm_email_address:
  * @cal: A calendar client interface.
  * @error: Operation error, if any, automatically freed if passed it.
- * @capabilities: Static capabilities from the backend.
+ * @address: Alarm email address.
  *
- * Notifies listeners of the completion of the get_static_capabilities method call.
+ * Notifies listeners of the completion of the get_alarm_email_address method call.
  */
 void
-e_data_cal_notify_static_capabilities (EDataCal *cal, EServerMethodContext context, GError *error, const gchar *capabilities)
+e_data_cal_respond_get_alarm_email_address (EDataCal *cal, guint32 opid, GError *error, const gchar *address)
 {
-	GDBusMethodInvocation *invocation = context;
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_cal_return_error (invocation, error, _("Cannot retrieve calendar scheduling information: %s"));
-		g_error_free (error);
-	} else {
-		gchar *gdbus_capabilities = NULL;
+	gchar *gdbus_address = NULL;
 
-		e_gdbus_cal_complete_get_scheduling_information (cal->priv->gdbus_object, invocation, e_util_ensure_gdbus_string (capabilities, &gdbus_capabilities));
+	op_complete (cal, opid);
 
-		g_free (gdbus_capabilities);
-	}
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Cannot retrieve calendar alarm e-mail address: "));
+
+	e_gdbus_cal_emit_get_alarm_email_address_done (cal->priv->gdbus_object, opid, error, e_util_ensure_gdbus_string (address, &gdbus_address));
+
+	g_free (gdbus_address);
+	if (error)
+		g_error_free (error);
 }
 
 /**
- * e_data_cal_notify_open:
+ * e_data_cal_respond_get_default_object:
  * @cal: A calendar client interface.
  * @error: Operation error, if any, automatically freed if passed it.
+ * @object: The default object as an iCalendar string.
  *
- * Notifies listeners of the completion of the open method call.
+ * Notifies listeners of the completion of the get_default_object method call.
  */
 void
-e_data_cal_notify_open (EDataCal *cal, EServerMethodContext context, GError *error)
+e_data_cal_respond_get_default_object (EDataCal *cal, guint32 opid, GError *error, const gchar *object)
 {
-	GDBusMethodInvocation *invocation = context;
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_cal_return_error (invocation, error, _("Cannot open calendar: %s"));
+	gchar *gdbus_object = NULL;
+
+	op_complete (cal, opid);
+
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Cannot retrieve default calendar object: "));
+
+	e_gdbus_cal_emit_get_default_object_done (cal->priv->gdbus_object, opid, error, e_util_ensure_gdbus_string (object, &gdbus_object));
+
+	g_free (gdbus_object);
+	if (error)
 		g_error_free (error);
-	} else
-		e_gdbus_cal_complete_open (cal->priv->gdbus_object, invocation);
 }
 
 /**
- * e_data_cal_notify_refresh:
+ * e_data_cal_respond_get_object:
  * @cal: A calendar client interface.
  * @error: Operation error, if any, automatically freed if passed it.
+ * @object: The object retrieved as an iCalendar string.
  *
- * Notifies listeners of the completion of the refresh method call.
+ * Notifies listeners of the completion of the get_object method call.
+ */
+void
+e_data_cal_respond_get_object (EDataCal *cal, guint32 opid, GError *error, const gchar *object)
+{
+	gchar *gdbus_object = NULL;
+
+	op_complete (cal, opid);
+
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Cannot retrieve calendar object path: "));
+
+	e_gdbus_cal_emit_get_object_done (cal->priv->gdbus_object, opid, error, e_util_ensure_gdbus_string (object, &gdbus_object));
+
+	g_free (gdbus_object);
+	if (error)
+		g_error_free (error);
+}
+
+/**
+ * e_data_cal_respond_get_object_list:
+ * @cal: A calendar client interface.
+ * @error: Operation error, if any, automatically freed if passed it.
+ * @objects: List of retrieved objects.
  *
- * Since: 2.30
+ * Notifies listeners of the completion of the get_object_list method call.
  */
 void
-e_data_cal_notify_refresh (EDataCal *cal, EServerMethodContext context, GError *error)
+e_data_cal_respond_get_object_list (EDataCal *cal, guint32 opid, GError *error, const GSList *objects)
 {
-	GDBusMethodInvocation *invocation = context;
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_cal_return_error (invocation, error, _("Cannot refresh calendar: %s"));
+	gchar **strv_objects;
+
+	op_complete (cal, opid);
+
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Cannot retrieve calendar object list: "));
+
+	strv_objects = gslist_to_strv (objects);
+
+	e_gdbus_cal_emit_get_object_list_done (cal->priv->gdbus_object, opid, error, (const gchar * const *) strv_objects);
+
+	g_strfreev (strv_objects);
+	if (error)
 		g_error_free (error);
-	} else
-		e_gdbus_cal_complete_refresh (cal->priv->gdbus_object, invocation);
 }
 
 /**
- * e_data_cal_notify_remove:
+ * e_data_cal_respond_get_free_busy:
  * @cal: A calendar client interface.
  * @error: Operation error, if any, automatically freed if passed it.
+ * @freebusy: List of free/busy objects.
  *
- * Notifies listeners of the completion of the remove method call.
+ * Notifies listeners of the completion of the get_free_busy method call.
  */
 void
-e_data_cal_notify_remove (EDataCal *cal, EServerMethodContext context, GError *error)
+e_data_cal_respond_get_free_busy (EDataCal *cal, guint32 opid, GError *error, const GSList *freebusy)
 {
-	GDBusMethodInvocation *invocation = context;
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_cal_return_error (invocation, error, _("Cannot remove calendar: %s"));
+	gchar **strv_freebusy;
+
+	op_complete (cal, opid);
+
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Cannot retrieve calendar free/busy list: "));
+
+	strv_freebusy = gslist_to_strv (freebusy);
+
+	e_gdbus_cal_emit_get_free_busy_done (cal->priv->gdbus_object, opid, error, (const gchar * const *) strv_freebusy);
+
+	g_strfreev (strv_freebusy);
+	if (error)
 		g_error_free (error);
-	} else
-		e_gdbus_cal_complete_remove (cal->priv->gdbus_object, invocation);
 }
 
 /**
- * e_data_cal_notify_object_created:
+ * e_data_cal_respond_create_object:
  * @cal: A calendar client interface.
  * @error: Operation error, if any, automatically freed if passed it.
  * @uid: UID of the object created.
@@ -759,26 +1182,27 @@ e_data_cal_notify_remove (EDataCal *cal, EServerMethodContext context, GError *e
  *
  * Notifies listeners of the completion of the create_object method call.
  */void
-e_data_cal_notify_object_created (EDataCal *cal, EServerMethodContext context, GError *error,
+e_data_cal_respond_create_object (EDataCal *cal, guint32 opid, GError *error,
 				  const gchar *uid, const gchar *object)
 {
-	GDBusMethodInvocation *invocation = context;
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_cal_return_error (invocation, error, _("Cannot create calendar object: %s"));
-		g_error_free (error);
-	} else {
-		gchar *gdbus_uid = NULL;
+	gchar *gdbus_uid = NULL;
 
-		e_cal_backend_notify_object_created (cal->priv->backend, object);
-		e_gdbus_cal_complete_create_object (cal->priv->gdbus_object, invocation, e_util_ensure_gdbus_string (uid, &gdbus_uid));
+	op_complete (cal, opid);
 
-		g_free (gdbus_uid);
-	}
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Cannot create calendar object: "));
+
+	e_gdbus_cal_emit_create_object_done (cal->priv->gdbus_object, opid, error, e_util_ensure_gdbus_string (uid, &gdbus_uid));
+
+	g_free (gdbus_uid);
+	if (error)
+		g_error_free (error);
+	else
+		e_cal_backend_notify_object_created (cal->priv->backend, object);
 }
 
 /**
- * e_data_cal_notify_object_modified:
+ * e_data_cal_respond_modify_object:
  * @cal: A calendar client interface.
  * @error: Operation error, if any, automatically freed if passed it.
  * @old_object: The old object as an iCalendar string.
@@ -787,22 +1211,24 @@ e_data_cal_notify_object_created (EDataCal *cal, EServerMethodContext context, G
  * Notifies listeners of the completion of the modify_object method call.
  */
 void
-e_data_cal_notify_object_modified (EDataCal *cal, EServerMethodContext context, GError *error,
-				   const gchar *old_object, const gchar *object)
+e_data_cal_respond_modify_object (EDataCal *cal, guint32 opid, GError *error,
+				  const gchar *old_object, const gchar *object)
 {
-	GDBusMethodInvocation *invocation = context;
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_cal_return_error (invocation, error, _("Cannot modify calendar object: %s"));
+	op_complete (cal, opid);
+
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Cannot modify calendar object: "));
+
+	e_gdbus_cal_emit_modify_object_done (cal->priv->gdbus_object, opid, error);
+
+	if (error)
 		g_error_free (error);
-	} else {
+	else
 		e_cal_backend_notify_object_modified (cal->priv->backend, old_object, object);
-		e_gdbus_cal_complete_modify_object (cal->priv->gdbus_object, invocation);
-	}
 }
 
 /**
- * e_data_cal_notify_object_removed:
+ * e_data_cal_respond_remove_object:
  * @cal: A calendar client interface.
  * @error: Operation error, if any, automatically freed if passed it.
  * @uid: UID of the removed object.
@@ -813,60 +1239,45 @@ e_data_cal_notify_object_modified (EDataCal *cal, EServerMethodContext context,
  * Notifies listeners of the completion of the remove_object method call.
  */
 void
-e_data_cal_notify_object_removed (EDataCal *cal, EServerMethodContext context, GError *error,
+e_data_cal_respond_remove_object (EDataCal *cal, guint32 opid, GError *error,
 				  const ECalComponentId *id, const gchar *old_object, const gchar *object)
 {
-	GDBusMethodInvocation *invocation = context;
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_cal_return_error (invocation, error, _("Cannot remove calendar object: %s"));
+	op_complete (cal, opid);
+
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Cannot remove calendar object: "));
+
+	e_gdbus_cal_emit_remove_object_done (cal->priv->gdbus_object, opid, error);
+
+	if (error)
 		g_error_free (error);
-	} else {
+	else
 		e_cal_backend_notify_object_removed (cal->priv->backend, id, old_object, object);
-		e_gdbus_cal_complete_remove_object (cal->priv->gdbus_object, invocation);
-	}
 }
 
 /**
- * e_data_cal_notify_objects_received:
+ * e_data_cal_respond_receive_objects:
  * @cal: A calendar client interface.
  * @error: Operation error, if any, automatically freed if passed it.
  *
  * Notifies listeners of the completion of the receive_objects method call.
  */
 void
-e_data_cal_notify_objects_received (EDataCal *cal, EServerMethodContext context, GError *error)
+e_data_cal_respond_receive_objects (EDataCal *cal, guint32 opid, GError *error)
 {
-	GDBusMethodInvocation *invocation = context;
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_cal_return_error (invocation, error, _("Cannot receive calendar objects: %s"));
-		g_error_free (error);
-	} else
-		e_gdbus_cal_complete_receive_objects (cal->priv->gdbus_object, invocation);
-}
+	op_complete (cal, opid);
 
-/**
- * e_data_cal_notify_alarm_discarded:
- * @cal: A calendar client interface.
- * @error: Operation error, if any, automatically freed if passed it.
- *
- * Notifies listeners of the completion of the discard_alarm method call.
- */
-void
-e_data_cal_notify_alarm_discarded (EDataCal *cal, EServerMethodContext context, GError *error)
-{
-	GDBusMethodInvocation *invocation = context;
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_cal_return_error (invocation, error, _("Cannot discard calendar alarm: %s"));
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Cannot receive calendar objects: "));
+
+	e_gdbus_cal_emit_receive_objects_done (cal->priv->gdbus_object, opid, error);
+
+	if (error)
 		g_error_free (error);
-	} else
-		e_gdbus_cal_complete_discard_alarm (cal->priv->gdbus_object, invocation);
 }
 
 /**
- * e_data_cal_notify_objects_sent:
+ * e_data_cal_respond_send_objects:
  * @cal: A calendar client interface.
  * @error: Operation error, if any, automatically freed if passed it.
  * @users: List of users.
@@ -875,330 +1286,166 @@ e_data_cal_notify_alarm_discarded (EDataCal *cal, EServerMethodContext context,
  * Notifies listeners of the completion of the send_objects method call.
  */
 void
-e_data_cal_notify_objects_sent (EDataCal *cal, EServerMethodContext context, GError *error, GList *users, const gchar *calobj)
+e_data_cal_respond_send_objects (EDataCal *cal, guint32 opid, GError *error, const GSList *users, const gchar *calobj)
 {
-	GDBusMethodInvocation *invocation = context;
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_cal_return_error (invocation, error, _("Cannot send calendar objects: %s"));
-		g_error_free (error);
-	} else {
-		gchar **users_array = create_str_array_from_glist (users);
-		gchar *gdbus_calobj = NULL;
+	gchar **strv_users_calobj;
 
-		e_gdbus_cal_complete_send_objects (cal->priv->gdbus_object, invocation, (const gchar * const *) users_array, e_util_ensure_gdbus_string (calobj, &gdbus_calobj));
+	op_complete (cal, opid);
 
-		g_free (gdbus_calobj);
-		g_strfreev (users_array);
-	}
-}
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Cannot send calendar objects: "));
 
-/**
- * e_data_cal_notify_default_object:
- * @cal: A calendar client interface.
- * @error: Operation error, if any, automatically freed if passed it.
- * @object: The default object as an iCalendar string.
- *
- * Notifies listeners of the completion of the get_default_object method call.
- */
-void
-e_data_cal_notify_default_object (EDataCal *cal, EServerMethodContext context, GError *error, const gchar *object)
-{
-	GDBusMethodInvocation *invocation = context;
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_cal_return_error (invocation, error, _("Cannot retrieve default calendar object path: %s"));
-		g_error_free (error);
-	} else {
-		gchar *gdbus_object = NULL;
+	strv_users_calobj = e_gdbus_cal_encode_send_objects (calobj, users);
 
-		e_gdbus_cal_complete_get_default_object (cal->priv->gdbus_object, invocation, e_util_ensure_gdbus_string (object, &gdbus_object));
+	e_gdbus_cal_emit_send_objects_done (cal->priv->gdbus_object, opid, error, (const gchar * const *) strv_users_calobj);
 
-		g_free (gdbus_object);
-	}
+	g_strfreev (strv_users_calobj);
+	if (error)
+		g_error_free (error);
 }
 
 /**
- * e_data_cal_notify_object:
+ * e_data_cal_respond_get_attachment_uris:
  * @cal: A calendar client interface.
  * @error: Operation error, if any, automatically freed if passed it.
- * @object: The object retrieved as an iCalendar string.
+ * @attachment_uris: List of retrieved attachment uri's.
  *
- * Notifies listeners of the completion of the get_object method call.
- */
+ * Notifies listeners of the completion of the get_attachment_uris method call.+ */
 void
-e_data_cal_notify_object (EDataCal *cal, EServerMethodContext context, GError *error, const gchar *object)
+e_data_cal_respond_get_attachment_uris (EDataCal *cal, guint32 opid, GError *error, const GSList *attachment_uris)
 {
-	GDBusMethodInvocation *invocation = context;
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_cal_return_error (invocation, error, _("Cannot retrieve calendar object path: %s"));
-		g_error_free (error);
-	} else {
-		gchar *gdbus_object = NULL;
+	gchar **strv_attachment_uris;
 
-		e_gdbus_cal_complete_get_object (cal->priv->gdbus_object, invocation, e_util_ensure_gdbus_string (object, &gdbus_object));
+	op_complete (cal, opid);
 
-		g_free (gdbus_object);
-	}
-}
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Could not retrieve attachment uris: "));
 
-/**
- * e_data_cal_notify_object_list:
- * @cal: A calendar client interface.
- * @error: Operation error, if any, automatically freed if passed it.
- * @objects: List of retrieved objects.
- *
- * Notifies listeners of the completion of the get_object_list method call.
- */
-void
-e_data_cal_notify_object_list (EDataCal *cal, EServerMethodContext context, GError *error, GList *objects)
-{
-	GDBusMethodInvocation *invocation = context;
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_cal_return_error (invocation, error, _("Cannot retrieve calendar object list: %s"));
-		g_error_free (error);
-	} else {
-		gchar **seq = create_str_array_from_glist (objects);
+	strv_attachment_uris = gslist_to_strv (attachment_uris);
 
-		e_gdbus_cal_complete_get_object_list (cal->priv->gdbus_object, invocation, (const gchar * const *) seq);
+	e_gdbus_cal_emit_get_attachment_uris_done (cal->priv->gdbus_object, opid, error, (const gchar * const *) strv_attachment_uris);
 
-		g_strfreev (seq);
-	}
+	g_strfreev (strv_attachment_uris);
+	if (error)
+		g_error_free (error);
 }
 
 /**
- * e_data_cal_notify_attachment_list:
+ * e_data_cal_respond_get_view:
  * @cal: A calendar client interface.
  * @error: Operation error, if any, automatically freed if passed it.
- * @attachments: List of retrieved attachment uri's.
+ * @view_path: The new live view path.
  *
- * Notifies listeners of the completion of the get_attachment_list method call.+ */
+ * Notifies listeners of the completion of the get_view method call.
+ */
 void
-e_data_cal_notify_attachment_list (EDataCal *cal, EServerMethodContext context, GError *error, GSList *attachments)
+e_data_cal_respond_get_view (EDataCal *cal, guint32 opid, GError *error, const gchar *view_path)
 {
-	GDBusMethodInvocation *invocation = context;
-	gchar **seq;
+	gchar *gdbus_view_path = NULL;
 
-	seq = create_str_array_from_gslist (attachments);
+	op_complete (cal, opid);
 
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_cal_return_error (invocation, error, _("Could not retrieve attachment list: %s"));
-		g_error_free (error);
-	} else
-		e_gdbus_cal_complete_get_attachment_list (cal->priv->gdbus_object, invocation, (const gchar * const *) seq);
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Could not get calendar view path: "));
 
-	g_strfreev (seq);
-}
+	e_gdbus_cal_emit_get_view_done (cal->priv->gdbus_object, opid, error, e_util_ensure_gdbus_string (view_path, &gdbus_view_path));
 
-/**
- * e_data_cal_notify_query:
- * @cal: A calendar client interface.
- * @error: Operation error, if any, automatically freed if passed it.
- * @query: The new live query.
- *
- * Notifies listeners of the completion of the get_query method call.
- */
-void
-e_data_cal_notify_query (EDataCal *cal, EServerMethodContext context, GError *error, const gchar *query)
-{
-	/*
-	 * Only have a seperate notify function to follow suit with the rest of this
-	 * file - it'd be much easier to just do the return in the above function
-	 */
-	GDBusMethodInvocation *invocation = context;
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_cal_return_error (invocation, error, _("Could not complete calendar query: %s"));
+	g_free (gdbus_view_path);
+	if (error)
 		g_error_free (error);
-	} else {
-		gchar *gdbus_query = NULL;
-
-		e_gdbus_cal_complete_get_query (cal->priv->gdbus_object, invocation, e_util_ensure_gdbus_string (query, &gdbus_query));
-
-		g_free (gdbus_query);
-	}
 }
 
 /**
- * e_data_cal_notify_timezone_requested:
+ * e_data_cal_respond_get_timezone:
  * @cal: A calendar client interface.
  * @error: Operation error, if any, automatically freed if passed it.
- * @object: The requested timezone as an iCalendar string.
+ * @tzobject: The requested timezone as an iCalendar string.
  *
  * Notifies listeners of the completion of the get_timezone method call.
  */
 void
-e_data_cal_notify_timezone_requested (EDataCal *cal, EServerMethodContext context, GError *error, const gchar *object)
+e_data_cal_respond_get_timezone (EDataCal *cal, guint32 opid, GError *error, const gchar *tzobject)
 {
-	GDBusMethodInvocation *invocation = context;
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_cal_return_error (invocation, error, _("Could not retrieve calendar time zone: %s"));
-		g_error_free (error);
-	} else {
-		gchar *gdbus_object = NULL;
+	gchar *gdbus_tzobject = NULL;
 
-		e_gdbus_cal_complete_get_timezone (cal->priv->gdbus_object, invocation, e_util_ensure_gdbus_string (object, &gdbus_object));
+	op_complete (cal, opid);
 
-		g_free (gdbus_object);
-	}
-}
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Could not retrieve calendar time zone: "));
 
-/**
- * e_data_cal_notify_timezone_added:
- * @cal: A calendar client interface.
- * @error: Operation error, if any, automatically freed if passed it.
- * @tzid: ID of the added timezone.
- *
- * Notifies listeners of the completion of the add_timezone method call.
- */
-void
-e_data_cal_notify_timezone_added (EDataCal *cal, EServerMethodContext context, GError *error, const gchar *tzid)
-{
-	GDBusMethodInvocation *invocation = context;
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_cal_return_error (invocation, error, _("Could not add calendar time zone: %s"));
-		g_error_free (error);
-	} else
-		e_gdbus_cal_complete_add_timezone (cal->priv->gdbus_object, invocation);
-}
+	e_gdbus_cal_emit_get_timezone_done (cal->priv->gdbus_object, opid, error, e_util_ensure_gdbus_string (tzobject, &gdbus_tzobject));
 
-/**
- * e_data_cal_notify_default_timezone_set:
- * @cal: A calendar client interface.
- * @error: Operation error, if any, automatically freed if passed it.
- *
- * Notifies listeners of the completion of the set_default_timezone method call.
- */
-void
-e_data_cal_notify_default_timezone_set (EDataCal *cal, EServerMethodContext context, GError *error)
-{
-	GDBusMethodInvocation *invocation = context;
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_cal_return_error (invocation, error, _("Could not set default calendar time zone: %s"));
+	g_free (gdbus_tzobject);
+	if (error)
 		g_error_free (error);
-	} else
-		e_gdbus_cal_complete_set_default_timezone (cal->priv->gdbus_object, invocation);
 }
 
 /**
- * e_data_cal_notify_changes:
+ * e_data_cal_notify_timezone_added:
  * @cal: A calendar client interface.
  * @error: Operation error, if any, automatically freed if passed it.
- * @adds: List of additions.
- * @modifies: List of modifications.
- * @deletes: List of removals.
  *
- * Notifies listeners of the completion of the get_changes method call.
+ * Notifies listeners of the completion of the add_timezone method call.
  */
 void
-e_data_cal_notify_changes (EDataCal *cal, EServerMethodContext context, GError *error,
-			   GList *adds, GList *modifies, GList *deletes)
+e_data_cal_respond_add_timezone (EDataCal *cal, guint32 opid, GError *error)
 {
-	GDBusMethodInvocation *invocation = context;
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_cal_return_error (invocation, error, _("Cannot retrieve calendar changes: %s"));
-		g_error_free (error);
-	} else {
-		gchar **additions, **modifications, **removals;
+	op_complete (cal, opid);
 
-		additions = create_str_array_from_glist (adds);
-		modifications = create_str_array_from_glist (modifies);
-		removals = create_str_array_from_glist (deletes);
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Could not add calendar time zone: "));
 
-		e_gdbus_cal_complete_get_changes (cal->priv->gdbus_object, invocation, (const gchar * const *) additions, (const gchar * const *) modifications, (const gchar * const *) removals);
+	e_gdbus_cal_emit_add_timezone_done (cal->priv->gdbus_object, opid, error);
 
-		g_strfreev (additions);
-		g_strfreev (modifications);
-		g_strfreev (removals);
-	}
+	if (error)
+		g_error_free (error);
 }
 
-/**
- * e_data_cal_notify_free_busy:
- * @cal: A calendar client interface.
- * @error: Operation error, if any, automatically freed if passed it.
- * @freebusy: List of free/busy objects.
- *
- * Notifies listeners of the completion of the get_free_busy method call.
- */
 void
-e_data_cal_notify_free_busy (EDataCal *cal, EServerMethodContext context, GError *error, GList *freebusy)
+e_data_cal_report_error (EDataCal *cal, const gchar *message)
 {
-	GDBusMethodInvocation *invocation = context;
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_cal_return_error (invocation, error, _("Cannot retrieve calendar free/busy list: %s"));
-		g_error_free (error);
-	} else {
-		gchar **seq;
-
-		seq = create_str_array_from_glist (freebusy);
-
-		e_gdbus_cal_complete_get_free_busy (cal->priv->gdbus_object, invocation, (const gchar * const *) seq);
+	g_return_if_fail (cal != NULL);
+	g_return_if_fail (message != NULL);
 
-		g_strfreev (seq);
-	}
+	e_gdbus_cal_emit_backend_error (cal->priv->gdbus_object, message);
 }
 
-/**
- * e_data_cal_notify_mode:
- * @cal: A calendar client interface.
- * @status: Status of the mode set.
- * @mode: The current mode.
- *
- * Notifies the listener of the results of a set_mode call.
- **/
 void
-e_data_cal_notify_mode (EDataCal *cal,
-			EDataCalViewListenerSetModeStatus status,
-			EDataCalMode mode)
+e_data_cal_report_readonly (EDataCal *cal, gboolean readonly)
 {
 	g_return_if_fail (cal != NULL);
-	g_return_if_fail (E_IS_DATA_CAL (cal));
 
-	e_gdbus_cal_emit_mode (cal->priv->gdbus_object, mode);
+	e_gdbus_cal_emit_readonly (cal->priv->gdbus_object, readonly);
 }
 
-/**
- * e_data_cal_notify_auth_required:
- * @cal: A calendar client interface.
- *
- * Notifies listeners that authorization is required to open the calendar.
- */
 void
-e_data_cal_notify_auth_required (EDataCal *cal)
+e_data_cal_report_online (EDataCal *cal, gboolean is_online)
 {
 	g_return_if_fail (cal != NULL);
-	g_return_if_fail (E_IS_DATA_CAL (cal));
 
-	e_gdbus_cal_emit_auth_required (cal->priv->gdbus_object);
+	e_gdbus_cal_emit_online (cal->priv->gdbus_object, is_online);
 }
 
-/**
- * e_data_cal_notify_error
- * @cal: A calendar client interface.
- * @message: Error message.
- *
- * Notify a calendar client of an error occurred in the backend.
- */
+/* credentilas contains extra information for a source for which authentication is requested.
+   This parameter can be NULL to indicate "for this calendar".
+*/
 void
-e_data_cal_notify_error (EDataCal *cal, const gchar *message)
+e_data_cal_report_auth_required (EDataCal *cal, const ECredentials *credentials)
 {
-	gchar *gdbus_message = NULL;
+	gchar *empty_strv[2];
+	gchar **strv = NULL;
 
 	g_return_if_fail (cal != NULL);
-	g_return_if_fail (E_IS_DATA_CAL (cal));
 
-	e_gdbus_cal_emit_backend_error (cal->priv->gdbus_object, e_util_ensure_gdbus_string (message, &gdbus_message));
+	empty_strv[0] = NULL;
+	empty_strv[1] = NULL;
+
+	if (credentials)
+		strv = e_credentials_to_strv (credentials);
 
-	g_free (gdbus_message);
+	e_gdbus_cal_emit_auth_required (cal->priv->gdbus_object, (const gchar * const *) (strv ? strv : empty_strv));
+
+	g_strfreev (strv);
 }
 
 /* Instance init */
@@ -1207,52 +1454,78 @@ e_data_cal_init (EDataCal *ecal)
 {
 	EGdbusCal *gdbus_object;
 
-	ecal->priv = G_TYPE_INSTANCE_GET_PRIVATE (
-		ecal, E_TYPE_DATA_CAL, EDataCalPrivate);
+	ecal->priv = G_TYPE_INSTANCE_GET_PRIVATE (ecal, E_TYPE_DATA_CAL, EDataCalPrivate);
 
 	ecal->priv->gdbus_object = e_gdbus_cal_stub_new ();
+	ecal->priv->pending_ops = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_object_unref);
+	g_static_rec_mutex_init (&ecal->priv->pending_ops_lock);
 
 	gdbus_object = ecal->priv->gdbus_object;
-	g_signal_connect (gdbus_object, "handle-get-uri", G_CALLBACK (impl_Cal_getUri), ecal);
-	g_signal_connect (gdbus_object, "handle-get-cache-dir", G_CALLBACK (impl_Cal_getCacheDir), ecal);
 	g_signal_connect (gdbus_object, "handle-open", G_CALLBACK (impl_Cal_open), ecal);
-	g_signal_connect (gdbus_object, "handle-refresh", G_CALLBACK (impl_Cal_refresh), ecal);
-	g_signal_connect (gdbus_object, "handle-close", G_CALLBACK (impl_Cal_close), ecal);
+	g_signal_connect (gdbus_object, "handle-authenticate-user", G_CALLBACK (impl_Cal_authenticateUser), ecal);
 	g_signal_connect (gdbus_object, "handle-remove", G_CALLBACK (impl_Cal_remove), ecal);
-	g_signal_connect (gdbus_object, "handle-is-read-only", G_CALLBACK (impl_Cal_isReadOnly), ecal);
-	g_signal_connect (gdbus_object, "handle-get-cal-address", G_CALLBACK (impl_Cal_getCalAddress), ecal);
+	g_signal_connect (gdbus_object, "handle-refresh", G_CALLBACK (impl_Cal_refresh), ecal);
+	g_signal_connect (gdbus_object, "handle-get-cache-dir", G_CALLBACK (impl_Cal_getCacheDir), ecal);
+	g_signal_connect (gdbus_object, "handle-get-capabilities", G_CALLBACK (impl_Cal_getCapabilities), ecal);
+	g_signal_connect (gdbus_object, "handle-get-cal-email-address", G_CALLBACK (impl_Cal_getCalEmailAddress), ecal);
 	g_signal_connect (gdbus_object, "handle-get-alarm-email-address", G_CALLBACK (impl_Cal_getAlarmEmailAddress), ecal);
-	g_signal_connect (gdbus_object, "handle-get-ldap-attribute", G_CALLBACK (impl_Cal_getLdapAttribute), ecal);
-	g_signal_connect (gdbus_object, "handle-get-scheduling-information", G_CALLBACK (impl_Cal_getSchedulingInformation), ecal);
-	g_signal_connect (gdbus_object, "handle-set-mode", G_CALLBACK (impl_Cal_setMode), ecal);
 	g_signal_connect (gdbus_object, "handle-get-default-object", G_CALLBACK (impl_Cal_getDefaultObject), ecal);
 	g_signal_connect (gdbus_object, "handle-get-object", G_CALLBACK (impl_Cal_getObject), ecal);
 	g_signal_connect (gdbus_object, "handle-get-object-list", G_CALLBACK (impl_Cal_getObjectList), ecal);
-	g_signal_connect (gdbus_object, "handle-get-changes", G_CALLBACK (impl_Cal_getChanges), ecal);
 	g_signal_connect (gdbus_object, "handle-get-free-busy", G_CALLBACK (impl_Cal_getFreeBusy), ecal);
-	g_signal_connect (gdbus_object, "handle-discard-alarm", G_CALLBACK (impl_Cal_discardAlarm), ecal);
 	g_signal_connect (gdbus_object, "handle-create-object", G_CALLBACK (impl_Cal_createObject), ecal);
 	g_signal_connect (gdbus_object, "handle-modify-object", G_CALLBACK (impl_Cal_modifyObject), ecal);
 	g_signal_connect (gdbus_object, "handle-remove-object", G_CALLBACK (impl_Cal_removeObject), ecal);
 	g_signal_connect (gdbus_object, "handle-receive-objects", G_CALLBACK (impl_Cal_receiveObjects), ecal);
 	g_signal_connect (gdbus_object, "handle-send-objects", G_CALLBACK (impl_Cal_sendObjects), ecal);
-	g_signal_connect (gdbus_object, "handle-get-attachment-list", G_CALLBACK (impl_Cal_getAttachmentList), ecal);
-	g_signal_connect (gdbus_object, "handle-get-query", G_CALLBACK (impl_Cal_getQuery), ecal);
+	g_signal_connect (gdbus_object, "handle-get-attachment-uris", G_CALLBACK (impl_Cal_getAttachmentUris), ecal);
+	g_signal_connect (gdbus_object, "handle-get-view", G_CALLBACK (impl_Cal_getView), ecal);
 	g_signal_connect (gdbus_object, "handle-get-timezone", G_CALLBACK (impl_Cal_getTimezone), ecal);
 	g_signal_connect (gdbus_object, "handle-add-timezone", G_CALLBACK (impl_Cal_addTimezone), ecal);
-	g_signal_connect (gdbus_object, "handle-set-default-timezone", G_CALLBACK (impl_Cal_setDefaultTimezone), ecal);
+	g_signal_connect (gdbus_object, "handle-cancel-operation", G_CALLBACK (impl_Cal_cancelOperation), ecal);
+	g_signal_connect (gdbus_object, "handle-cancel-all", G_CALLBACK (impl_Cal_cancelAll), ecal);
+	g_signal_connect (gdbus_object, "handle-close", G_CALLBACK (impl_Cal_close), ecal);
+}
+
+static void
+data_cal_dispose (GObject *object)
+{
+	EDataCal *cal = E_DATA_CAL (object);
+
+	g_return_if_fail (cal != NULL);
+
+	if (cal->priv->backend) {
+		g_object_unref (cal->priv->backend);
+		cal->priv->backend = NULL;
+	}
+
+	if (cal->priv->source) {
+		g_object_unref (cal->priv->source);
+		cal->priv->source = NULL;
+	}
+
+	G_OBJECT_CLASS (e_data_cal_parent_class)->dispose (object);
 }
 
 static void
-e_data_cal_finalize (GObject *object)
+data_cal_finalize (GObject *object)
 {
 	EDataCal *cal = E_DATA_CAL (object);
 
 	g_return_if_fail (cal != NULL);
 
-	g_object_unref (cal->priv->gdbus_object);
+	if (cal->priv->pending_ops) {
+		g_hash_table_destroy (cal->priv->pending_ops);
+		cal->priv->pending_ops = NULL;
+	}
+
+	g_static_rec_mutex_free (&cal->priv->pending_ops_lock);
+
+	if (cal->priv->gdbus_object) {
+		g_object_unref (cal->priv->gdbus_object);
+		cal->priv->gdbus_object = NULL;
+	}
 
-	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (e_data_cal_parent_class)->finalize (object);
 }
 
@@ -1265,33 +1538,9 @@ e_data_cal_class_init (EDataCalClass *klass)
 	g_type_class_add_private (klass, sizeof (EDataCalPrivate));
 
 	object_class = G_OBJECT_CLASS (klass);
-	object_class->finalize = e_data_cal_finalize;
-}
-
-EDataCal *
-e_data_cal_new (ECalBackend *backend, ESource *source)
-{
-	EDataCal *cal;
-	cal = g_object_new (E_TYPE_DATA_CAL, NULL);
-	cal->priv->backend = backend;
-	cal->priv->source = source;
-	return cal;
-}
-
-/**
- * e_data_cal_register_gdbus_object:
- *
- * Registers GDBus object of this EDataCal.
- *
- * Since: 2.32
- **/
-guint
-e_data_cal_register_gdbus_object (EDataCal *cal, GDBusConnection *connection, const gchar *object_path, GError **error)
-{
-	g_return_val_if_fail (cal != NULL, 0);
-	g_return_val_if_fail (E_IS_DATA_CAL (cal), 0);
-	g_return_val_if_fail (connection != NULL, 0);
-	g_return_val_if_fail (object_path != NULL, 0);
+	object_class->dispose = data_cal_dispose;
+	object_class->finalize = data_cal_finalize;
 
-	return e_gdbus_cal_register_object (cal->priv->gdbus_object, connection, object_path, error);
+	if (!ops_pool)
+		ops_pool = e_operation_pool_new (10, operation_thread, NULL);
 }
diff --git a/calendar/libedata-cal/e-data-cal.h b/calendar/libedata-cal/e-data-cal.h
index 05a270d..b962fc5 100644
--- a/calendar/libedata-cal/e-data-cal.h
+++ b/calendar/libedata-cal/e-data-cal.h
@@ -103,70 +103,36 @@ struct _EDataCalClass {
 
 GType e_data_cal_get_type (void);
 
-EDataCal *e_data_cal_new (ECalBackend *backend, ESource *source);
-
-guint e_data_cal_register_gdbus_object (EDataCal *cal, GDBusConnection *connection, const gchar *object_path, GError **error);
-
-ECalBackend *e_data_cal_get_backend (EDataCal *cal);
-ESource* e_data_cal_get_source (EDataCal *cal);
-
-void e_data_cal_notify_read_only           (EDataCal *cal, GError *error,
-					    gboolean read_only);
-void e_data_cal_notify_cal_address         (EDataCal *cal, EServerMethodContext context, GError *error,
-					    const gchar *address);
-void e_data_cal_notify_alarm_email_address (EDataCal *cal, EServerMethodContext context, GError *error,
-					    const gchar *address);
-void e_data_cal_notify_ldap_attribute      (EDataCal *cal, EServerMethodContext context, GError *error,
-					    const gchar *attribute);
-void e_data_cal_notify_static_capabilities (EDataCal *cal, EServerMethodContext context, GError *error,
-					    const gchar *capabilities);
-
-void e_data_cal_notify_open   (EDataCal *cal, EServerMethodContext context, GError *error);
-void e_data_cal_notify_refresh (EDataCal *cal, EServerMethodContext context, GError *error);
-void e_data_cal_notify_remove (EDataCal *cal, EServerMethodContext context, GError *error);
-
-void e_data_cal_notify_object_created  (EDataCal *cal, EServerMethodContext context, GError *error,
-					const gchar *uid, const gchar *object);
-void e_data_cal_notify_object_modified (EDataCal *cal, EServerMethodContext context, GError *error,
-					const gchar *old_object, const gchar *object);
-void e_data_cal_notify_object_removed  (EDataCal *cal, EServerMethodContext context, GError *error,
-					const ECalComponentId *id, const gchar *old_object, const gchar *object);
-void e_data_cal_notify_alarm_discarded (EDataCal *cal, EServerMethodContext context, GError *error);
-
-void e_data_cal_notify_objects_received (EDataCal *cal, EServerMethodContext context, GError *error);
-void e_data_cal_notify_objects_sent     (EDataCal *cal, EServerMethodContext context, GError *error, GList *users,
-					 const gchar *calobj);
-
-void e_data_cal_notify_default_object (EDataCal *cal, EServerMethodContext context, GError *error,
-				       const gchar *object);
-void e_data_cal_notify_object         (EDataCal *cal, EServerMethodContext context, GError *error,
-				       const gchar *object);
-void e_data_cal_notify_object_list    (EDataCal *cal, EServerMethodContext context, GError *error,
-				       GList *objects);
-
-void e_data_cal_notify_query (EDataCal *cal, EServerMethodContext context, GError *error,
-			      const gchar *query_path);
-
-void e_data_cal_notify_timezone_requested   (EDataCal *cal, EServerMethodContext context, GError *error,
-					     const gchar *object);
-void e_data_cal_notify_timezone_added       (EDataCal *cal, EServerMethodContext context, GError *error,
-					     const gchar *tzid);
-void e_data_cal_notify_default_timezone_set (EDataCal *cal, EServerMethodContext context, GError *error);
-
-void e_data_cal_notify_changes   (EDataCal *cal, EServerMethodContext context, GError *error,
-				  GList *adds, GList *modifies, GList *deletes);
-void e_data_cal_notify_free_busy (EDataCal *cal, EServerMethodContext context, GError *error,
-				  GList *freebusy);
-
-void e_data_cal_notify_mode  (EDataCal *cal,
-			      EDataCalViewListenerSetModeStatus status,
-			      EDataCalMode mode);
-
-void e_data_cal_notify_auth_required (EDataCal *cal);
-
-void e_data_cal_notify_error (EDataCal *cal, const gchar *message);
-
-void e_data_cal_notify_attachment_list (EDataCal *cal, EServerMethodContext context, GError *error, GSList *objects);
+EDataCal *	e_data_cal_new					(ECalBackend *backend, ESource *source);
+ECalBackend *	e_data_cal_get_backend				(EDataCal *cal);
+ESource *	e_data_cal_get_source				(EDataCal *cal);
+guint		e_data_cal_register_gdbus_object		(EDataCal *cal, GDBusConnection *connection, const gchar *object_path, GError **error);
+
+void		e_data_cal_respond_open				(EDataCal *cal, guint32 opid, GError *error);
+void		e_data_cal_respond_authenticate_user		(EDataCal *cal, guint32 opid, GError *error);
+void		e_data_cal_respond_remove			(EDataCal *cal, guint32 opid, GError *error);
+void		e_data_cal_respond_refresh			(EDataCal *cal, guint32 opid, GError *error);
+void		e_data_cal_respond_get_capabilities		(EDataCal *cal, guint32 opid, GError *error, const gchar *capabilities);
+void		e_data_cal_respond_get_cal_email_address	(EDataCal *cal, guint32 opid, GError *error, const gchar *address);
+void		e_data_cal_respond_get_alarm_email_address	(EDataCal *cal, guint32 opid, GError *error, const gchar *address);
+void		e_data_cal_respond_get_default_object		(EDataCal *cal, guint32 opid, GError *error, const gchar *object);
+void		e_data_cal_respond_get_object			(EDataCal *cal, guint32 opid, GError *error, const gchar *object);
+void		e_data_cal_respond_get_object_list		(EDataCal *cal, guint32 opid, GError *error, const GSList *objects);
+void		e_data_cal_respond_get_free_busy		(EDataCal *cal, guint32 opid, GError *error, const GSList *freebusy);
+void		e_data_cal_respond_create_object		(EDataCal *cal, guint32 opid, GError *error, const gchar *uid, const gchar *object);
+void		e_data_cal_respond_modify_object		(EDataCal *cal, guint32 opid, GError *error, const gchar *old_object, const gchar *object);
+void		e_data_cal_respond_remove_object		(EDataCal *cal, guint32 opid, GError *error, const ECalComponentId *id, const gchar *old_object, const gchar *object);
+void		e_data_cal_respond_receive_objects		(EDataCal *cal, guint32 opid, GError *error);
+void		e_data_cal_respond_send_objects			(EDataCal *cal, guint32 opid, GError *error, const GSList *users, const gchar *calobj);
+void		e_data_cal_respond_get_attachment_uris		(EDataCal *cal, guint32 opid, GError *error, const GSList *attachments);
+void		e_data_cal_respond_get_view			(EDataCal *cal, guint32 opid, GError *error, const gchar *view_path);
+void		e_data_cal_respond_get_timezone			(EDataCal *cal, guint32 opid, GError *error, const gchar *tzobject);
+void		e_data_cal_respond_add_timezone			(EDataCal *cal, guint32 opid, GError *error);
+
+void		e_data_cal_report_error				(EDataCal *cal, const gchar *message);
+void		e_data_cal_report_readonly			(EDataCal *cal, gboolean is_readonly);
+void		e_data_cal_report_online			(EDataCal *cal, gboolean is_online);
+void		e_data_cal_report_auth_required			(EDataCal *cal, const ECredentials *credentials);
 
 G_END_DECLS
 
diff --git a/calendar/libegdbus/Makefile.am b/calendar/libegdbus/Makefile.am
index 82f2b1b..e29a27c 100644
--- a/calendar/libegdbus/Makefile.am
+++ b/calendar/libegdbus/Makefile.am
@@ -1,13 +1,3 @@
-GDBUS_XML_FILES =				\
-	../libedata-cal/e-data-cal-factory.xml	\
-	../libedata-cal/e-data-cal-view.xml	\
-	../libedata-cal/e-data-cal.xml
-
-gdbus-files: $(GDBUS_XML_FILES)
-	gdbus-codegen --namespace=EGdbus --strip-prefix=org.gnome.evolution.dataserver.calendar --output-prefix=e-gdbus $(GDBUS_XML_FILES)
-	rm e-gdbus-bindings.h
-	rm e-gdbus-bindings.stamp
-
 # The library
 noinst_LTLIBRARIES = libegdbus-cal.la
 
@@ -19,21 +9,16 @@ libegdbus_cal_la_CPPFLAGS =			\
 	$(E_DATA_SERVER_CFLAGS)
 
 libegdbus_cal_la_SOURCES =			\
-	e-gdbus-egdbuscal.h			\
-	e-gdbus-egdbuscal.c			\
-	e-gdbus-egdbuscalfactory.h		\
-	e-gdbus-egdbuscalfactory.c		\
-	e-gdbus-egdbuscalview.h			\
-	e-gdbus-egdbuscalview.c			\
-	e-gdbus-marshallers.h			\
-	e-gdbus-marshallers.c			\
-	e-gdbus-typemappers.h
+	e-gdbus-cal.h				\
+	e-gdbus-cal.c				\
+	e-gdbus-cal-factory.h			\
+	e-gdbus-cal-factory.c			\
+	e-gdbus-cal-view.h			\
+	e-gdbus-cal-view.c
 
 libegdbus_cal_la_LIBADD =			\
 	$(E_DATA_SERVER_LIBS)
 
 libegdbus_cal_la_LDFLAGS = $(NO_UNDEFINED)
 
-EXTRA_DIST = e-gdbus-marshallers.list
-
 -include $(top_srcdir)/git.mk
diff --git a/calendar/libegdbus/e-gdbus-cal-factory.c b/calendar/libegdbus/e-gdbus-cal-factory.c
new file mode 100644
index 0000000..e241828
--- /dev/null
+++ b/calendar/libegdbus/e-gdbus-cal-factory.c
@@ -0,0 +1,604 @@
+/*
+ * e-gdbus-cal-factory.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <gio/gio.h>
+
+#include <libedataserver/e-data-server-util.h>
+#include <libedataserver/e-gdbus-marshallers.h>
+
+#include "e-gdbus-cal-factory.h"
+
+#define GDBUS_CAL_FACTORY_INTERFACE_NAME "org.gnome.evolution.dataserver.CalendarFactory"
+
+typedef EGdbusCalFactoryIface EGdbusCalFactoryInterface;
+G_DEFINE_INTERFACE (EGdbusCalFactory, e_gdbus_cal_factory, G_TYPE_OBJECT);
+
+enum
+{
+	_0_SIGNAL,
+	__GET_CAL_METHOD,
+	__LAST_SIGNAL
+};
+
+static guint signals[__LAST_SIGNAL] = {0};
+
+/* ------------------------------------------------------------------------- */
+
+/* Various lookup tables */
+
+static GHashTable *_method_name_to_id = NULL;
+static GHashTable *_method_name_to_type = NULL;
+
+static guint
+lookup_method_id_from_method_name (const gchar *method_name)
+{
+	return GPOINTER_TO_UINT (g_hash_table_lookup (_method_name_to_id, method_name));
+}
+
+static guint
+lookup_method_type_from_method_name (const gchar *method_name)
+{
+	return GPOINTER_TO_UINT (g_hash_table_lookup (_method_name_to_type, method_name));
+}
+
+/* ------------------------------------------------------------------------- */
+
+static void
+e_gdbus_cal_factory_default_init (EGdbusCalFactoryIface *iface)
+{
+	/* Build lookup structures */
+	_method_name_to_id = g_hash_table_new (g_str_hash, g_str_equal);
+	_method_name_to_type = g_hash_table_new (g_str_hash, g_str_equal);
+
+	E_INIT_GDBUS_METHOD_STRV (EGdbusCalFactoryIface, "getCal", get_cal, __GET_CAL_METHOD)
+}
+
+/* encodes source and source type into a strv usable for a wire transfer;
+   Free returned pointer with g_strfreev() */
+gchar **
+e_gdbus_cal_factory_encode_get_cal (const gchar *in_source, guint in_type)
+{
+	gchar **strv;
+
+	g_return_val_if_fail (in_source != NULL, NULL);
+
+	strv = g_new0 (gchar *, 3);
+	strv[0] = g_strdup (in_source);
+	strv[1] = g_strdup_printf ("%u", (guint32) in_type);
+	strv[2] = NULL;
+
+	return strv;
+}
+
+/* decodes source and source type from a strv recevied from a wire transfer;
+   free out_source with g_free(); returns TRUE is successful. */
+gboolean
+e_gdbus_cal_factory_decode_get_cal (const gchar * const * in_strv, gchar **out_source, guint *out_type)
+{
+	g_return_val_if_fail (in_strv != NULL, FALSE);
+	g_return_val_if_fail (in_strv[0] != NULL, FALSE);
+	g_return_val_if_fail (in_strv[1] != NULL, FALSE);
+	g_return_val_if_fail (in_strv[2] == NULL, FALSE);
+	g_return_val_if_fail (out_source != NULL, FALSE);
+	g_return_val_if_fail (out_type != NULL, FALSE);
+
+	*out_source = g_strdup (in_strv[0]);
+	*out_type = atoi (in_strv[1]);
+
+	return TRUE;
+}
+
+/* C Bindings for properties */
+
+void
+e_gdbus_cal_factory_call_get_cal (GDBusProxy *proxy, const gchar * const *in_source_type, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	/* in_source_type has only two items, the first is ESource, the second is source type */
+	/* use e_gdbus_cal_factory_encode_get_cal() to encode them */
+
+	g_return_if_fail (in_source_type != NULL);
+	g_return_if_fail (in_source_type[0] != NULL);
+	g_return_if_fail (in_source_type[1] != NULL);
+	g_return_if_fail (in_source_type[2] == NULL);
+
+	e_gdbus_proxy_method_call_strv ("getCal", proxy, in_source_type, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_factory_call_get_cal_finish (GDBusProxy *proxy, GAsyncResult *result, gchar **out_path, GError **error)
+{
+	return e_gdbus_proxy_method_call_finish_string (proxy, result, out_path, error);
+}
+
+gboolean
+e_gdbus_cal_factory_call_get_cal_sync (GDBusProxy *proxy, const gchar * const *in_source_type, gchar **out_path, GCancellable *cancellable, GError **error)
+{
+	/* in_source_type has only two items, the first is ESource, the second is source type */
+	/* use e_gdbus_cal_factory_encode_get_cal() to encode them */
+
+	g_return_val_if_fail (in_source_type != NULL, FALSE);
+	g_return_val_if_fail (in_source_type[0] != NULL, FALSE);
+	g_return_val_if_fail (in_source_type[1] != NULL, FALSE);
+	g_return_val_if_fail (in_source_type[2] == NULL, FALSE);
+
+	return e_gdbus_proxy_method_call_sync_strv__string ("getCal", proxy, in_source_type, out_path, cancellable, error);
+}
+
+void
+e_gdbus_cal_factory_complete_get_cal (EGdbusCalFactory *object, GDBusMethodInvocation *invocation, const gchar *out_path, const GError *error)
+{
+	e_gdbus_complete_sync_method_string (object, invocation, out_path, error);
+}
+
+E_DECLARE_GDBUS_SYNC_METHOD_1_WITH_RETURN (cal_factory, getCal, source_type, "as", path, "s")
+
+static const GDBusMethodInfo * const e_gdbus_cal_factory_method_info_pointers[] =
+{
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal_factory, getCal),
+	NULL
+};
+
+static const GDBusInterfaceInfo _e_gdbus_cal_factory_interface_info =
+{
+	-1,
+	(gchar *) GDBUS_CAL_FACTORY_INTERFACE_NAME,
+	(GDBusMethodInfo **) &e_gdbus_cal_factory_method_info_pointers,
+	(GDBusSignalInfo **) NULL,
+	(GDBusPropertyInfo **) NULL,
+};
+
+static void
+handle_method_call (GDBusConnection       *connection,
+                    const gchar           *sender,
+                    const gchar           *object_path,
+                    const gchar           *interface_name,
+                    const gchar           *method_name,
+                    GVariant              *parameters,
+                    GDBusMethodInvocation *invocation,
+                    gpointer               user_data)
+{
+	guint method_id, method_type;
+
+	method_id = lookup_method_id_from_method_name (method_name);
+	method_type = lookup_method_type_from_method_name (method_name);
+
+	g_return_if_fail (method_id != 0);
+	g_return_if_fail (method_type != 0);
+
+	e_gdbus_stub_handle_method_call (user_data, invocation, parameters, method_name, signals[method_id], method_type);
+}
+
+static GVariant *
+get_property (GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GError **error, gpointer user_data)
+{
+	g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "This implementation does not support property `%s'", property_name);
+	return NULL;
+}
+
+static gboolean
+set_property (GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GVariant *value, GError **error, gpointer user_data)
+{
+	g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "This implementation does not support property `%s'", property_name);
+	return FALSE;
+}
+
+static const GDBusInterfaceVTable e_gdbus_cal_factory_interface_vtable =
+{
+	handle_method_call,
+	get_property,
+	set_property
+};
+
+static gboolean
+emit_notifications_in_idle (gpointer user_data)
+{
+	GObject *object = G_OBJECT (user_data);
+	GDBusConnection *connection;
+	const gchar *path;
+	GHashTable *notification_queue;
+	GHashTableIter iter;
+	const gchar *property_name;
+	GVariant *value;
+	GVariantBuilder *builder;
+	GVariantBuilder *invalidated_builder;
+	GHashTable *pvc;
+	gboolean has_changes;
+
+	notification_queue = g_object_get_data (object, "gdbus-codegen-notification-queue");
+	path = g_object_get_data (object, "gdbus-codegen-path");
+	connection = g_object_get_data (object, "gdbus-codegen-connection");
+	pvc = g_object_get_data (object, "gdbus-codegen-pvc");
+	g_assert (notification_queue != NULL && path != NULL && connection != NULL && pvc != NULL);
+
+	builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
+	invalidated_builder = g_variant_builder_new (G_VARIANT_TYPE ("as"));
+	g_hash_table_iter_init (&iter, notification_queue);
+	has_changes = FALSE;
+	while (g_hash_table_iter_next (&iter, (gpointer) &property_name, (gpointer) &value)) {
+		GVariant *cached_value;
+		cached_value = g_hash_table_lookup (pvc, property_name);
+		if (cached_value == NULL || !g_variant_equal (cached_value, value)) {
+			g_hash_table_insert (pvc, (gpointer) property_name, (gpointer) g_variant_ref (value));
+			g_variant_builder_add (builder, "{sv}", property_name, value);
+			has_changes = TRUE;
+		}
+	}
+
+	if (has_changes) {
+		g_dbus_connection_emit_signal (connection,
+					NULL,
+					path,
+					"org.freedesktop.DBus.Properties",
+					"PropertiesChanged",
+					g_variant_new ("(sa{sv}as)",
+							GDBUS_CAL_FACTORY_INTERFACE_NAME,
+							builder,
+							invalidated_builder),
+					NULL);
+	} else {
+		g_variant_builder_unref (builder);
+		g_variant_builder_unref (invalidated_builder);
+	}
+
+	g_hash_table_remove_all (notification_queue);
+	g_object_set_data (object, "gdbus-codegen-notification-idle-id", GUINT_TO_POINTER (0));
+	return FALSE;
+}
+
+/**
+ * e_gdbus_cal_factory_drain_notify:
+ * @object: A #EGdbusCalFactory that is exported.
+ *
+ * If @object has queued notifications, empty the queue forcing
+ * the <literal>PropertiesChanged</literal> signal to be emitted.
+ * See <xref linkend="EGdbusCalFactory.description"/> for more background information.
+ */
+void
+e_gdbus_cal_factory_drain_notify (EGdbusCalFactory *object)
+{
+	gint idle_id;
+	idle_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (object), "gdbus-codegen-notification-idle-id"));
+	if (idle_id > 0) {
+		emit_notifications_in_idle (object);
+		g_source_remove (idle_id);
+	}
+}
+
+static void
+on_object_unregistered (GObject *object)
+{
+	gint idle_id;
+	idle_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (object), "gdbus-codegen-notification-idle-id"));
+	if (idle_id > 0) {
+		g_source_remove (idle_id);
+	}
+	g_object_set_data (G_OBJECT (object), "gdbus-codegen-path", NULL);
+	g_object_set_data (G_OBJECT (object), "gdbus-codegen-connection", NULL);
+}
+
+/**
+ * e_gdbus_cal_factory_register_object:
+ * @object: An instance of a #GObject<!-- -->-derived type implementing the #EGdbusCalFactory interface.
+ * @connection: A #GDBusConnection.
+ * @object_path: The object to register the object at.
+ * @error: Return location for error or %NULL.
+ *
+ * Registers @object at @object_path on @connection.
+ *
+ * See <xref linkend="EGdbusCalFactory.description"/>
+ * for how properties, methods and signals are handled.
+ *
+ * Returns: 0 if @error is set, otherwise a registration id (never 0) that can be used with g_dbus_connection_unregister_object().
+ */
+guint
+e_gdbus_cal_factory_register_object (EGdbusCalFactory *object, GDBusConnection *connection, const gchar *object_path, GError **error)
+{
+	GHashTable *pvc;
+
+	pvc = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify) g_variant_unref);
+
+	g_object_set_data_full (G_OBJECT (object), "gdbus-codegen-path", (gpointer) g_strdup (object_path), g_free);
+	g_object_set_data (G_OBJECT (object), "gdbus-codegen-connection", (gpointer) connection);
+	g_object_set_data_full (G_OBJECT (object), "gdbus-codegen-pvc", (gpointer) pvc, (GDestroyNotify) g_hash_table_unref);
+	return g_dbus_connection_register_object (connection,
+		object_path,
+		(GDBusInterfaceInfo *) &_e_gdbus_cal_factory_interface_info,
+		&e_gdbus_cal_factory_interface_vtable,
+		object,
+		(GDestroyNotify) on_object_unregistered,
+		error);
+}
+
+/**
+ * e_gdbus_cal_factory_interface_info:
+ *
+ * Gets interface description for the <literal>org.gnome.evolution.dataserver.CalendarFactory</literal> D-Bus interface.
+ *
+ * Returns: A #GDBusInterfaceInfo. Do not free, the object is statically allocated.
+ */
+const GDBusInterfaceInfo *
+e_gdbus_cal_factory_interface_info (void)
+{
+	return &_e_gdbus_cal_factory_interface_info;
+}
+
+/* ---------------------------------------------------------------------- */
+
+static void proxy_iface_init (EGdbusCalFactoryIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (EGdbusCalFactoryProxy, e_gdbus_cal_factory_proxy, G_TYPE_DBUS_PROXY,
+                         G_IMPLEMENT_INTERFACE (E_TYPE_GDBUS_CAL_FACTORY, proxy_iface_init));
+
+static void
+e_gdbus_cal_factory_proxy_init (EGdbusCalFactoryProxy *proxy)
+{
+	g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), (GDBusInterfaceInfo *) &_e_gdbus_cal_factory_interface_info);
+}
+
+static void
+g_signal (GDBusProxy *proxy, const gchar *sender_name, const gchar *signal_name, GVariant *parameters)
+{
+	/*
+	guint signal_id, signal_type;
+
+	signal_id = lookup_signal_id_from_signal_name (signal_name);
+	signal_type = lookup_signal_type_from_signal_name (signal_name);
+
+	g_return_if_fail (signal_id != 0);
+	g_return_if_fail (signal_type != 0);
+
+	e_gdbus_proxy_emit_signal (proxy, parameters, signals[signal_id], signal_type);
+	*/
+}
+
+static void
+e_gdbus_cal_factory_proxy_class_init (EGdbusCalFactoryProxyClass *klass)
+{
+	GDBusProxyClass *proxy_class;
+
+	proxy_class = G_DBUS_PROXY_CLASS (klass);
+	proxy_class->g_signal = g_signal;
+}
+
+static void
+proxy_iface_init (EGdbusCalFactoryIface *iface)
+{
+}
+
+/**
+ * e_gdbus_cal_factory_proxy_new:
+ * @connection: A #GDBusConnection.
+ * @flags: Flags used when constructing the proxy.
+ * @name: A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
+ * @object_path: An object path.
+ * @cancellable: A #GCancellable or %NULL.
+ * @callback: Callback function to invoke when the proxy is ready.
+ * @user_data: User data to pass to @callback.
+ *
+ * Like g_dbus_proxy_new() but returns a #EGdbusCalFactoryProxy.
+ *
+ * This is a failable asynchronous constructor - when the proxy is ready, callback will be invoked and you can use e_gdbus_cal_factory_proxy_new_finish() to get the result.
+ */
+void
+e_gdbus_cal_factory_proxy_new (GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	g_async_initable_new_async (E_TYPE_GDBUS_CAL_FACTORY_PROXY,
+				G_PRIORITY_DEFAULT,
+				cancellable,
+				callback,
+				user_data,
+				"g-flags", flags,
+				"g-name", name,
+				"g-connection", connection,
+				"g-object-path", object_path,
+				"g-interface-name", GDBUS_CAL_FACTORY_INTERFACE_NAME,
+				NULL);
+}
+
+/**
+ * e_gdbus_cal_factory_proxy_new_finish:
+ * @result: A #GAsyncResult obtained from the #GAsyncReadyCallback function passed to e_gdbus_cal_factory_proxy_new().
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes creating a #EGdbusCalFactoryProxy.
+ *
+ * Returns: A #EGdbusCalFactoryProxy or %NULL if @error is set. Free with g_object_unref().
+ */
+EGdbusCalFactory *
+e_gdbus_cal_factory_proxy_new_finish (GAsyncResult *result, GError **error)
+{
+	GObject *object;
+	GObject *source_object;
+	source_object = g_async_result_get_source_object (result);
+	g_assert (source_object != NULL);
+	object = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), result, error);
+	g_object_unref (source_object);
+	if (object != NULL)
+		return E_GDBUS_CAL_FACTORY (object);
+	else
+		return NULL;
+}
+
+/**
+ * e_gdbus_cal_factory_proxy_new_sync:
+ * @connection: A #GDBusConnection.
+ * @flags: Flags used when constructing the proxy.
+ * @name: A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
+ * @object_path: An object path.
+ * @cancellable: A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Like g_dbus_proxy_new_sync() but returns a #EGdbusCalFactoryProxy.
+ *
+ * This is a synchronous failable constructor. See e_gdbus_cal_factory_proxy_new() and e_gdbus_cal_factory_proxy_new_finish() for the asynchronous version.
+ *
+ * Returns: A #EGdbusCalFactoryProxy or %NULL if error is set. Free with g_object_unref().
+ */
+EGdbusCalFactory *
+e_gdbus_cal_factory_proxy_new_sync (GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error)
+{
+	GInitable *initable;
+	initable = g_initable_new (E_TYPE_GDBUS_CAL_FACTORY_PROXY,
+				cancellable,
+				error,
+				"g-flags", flags,
+				"g-name", name,
+				"g-connection", connection,
+				"g-object-path", object_path,
+				"g-interface-name", GDBUS_CAL_FACTORY_INTERFACE_NAME,
+				NULL);
+	if (initable != NULL)
+		return E_GDBUS_CAL_FACTORY (initable);
+	else
+		return NULL;
+}
+
+/**
+ * e_gdbus_cal_factory_proxy_new_for_bus:
+ * @bus_type: A #GBusType.
+ * @flags: Flags used when constructing the proxy.
+ * @name: A bus name (well-known or unique).
+ * @object_path: An object path.
+ * @cancellable: A #GCancellable or %NULL.
+ * @callback: Callback function to invoke when the proxy is ready.
+ * @user_data: User data to pass to @callback.
+ *
+ * Like g_dbus_proxy_new_for_bus() but returns a #EGdbusCalFactoryProxy.
+ *
+ * This is a failable asynchronous constructor - when the proxy is ready, callback will be invoked and you can use e_gdbus_cal_factory_proxy_new_for_bus_finish() to get the result.
+ */
+void
+e_gdbus_cal_factory_proxy_new_for_bus (GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	g_async_initable_new_async (E_TYPE_GDBUS_CAL_FACTORY_PROXY,
+				G_PRIORITY_DEFAULT,
+				cancellable,
+				callback,
+				user_data,
+				"g-flags", flags,
+				"g-name", name,
+				"g-bus-type", bus_type,
+				"g-object-path", object_path,
+				"g-interface-name", GDBUS_CAL_FACTORY_INTERFACE_NAME,
+				NULL);
+}
+
+/**
+ * e_gdbus_cal_factory_proxy_new_for_bus_finish:
+ * @result: A #GAsyncResult obtained from the #GAsyncReadyCallback function passed to e_gdbus_cal_factory_proxy_new_for_bus().
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes creating a #EGdbusCalFactoryProxy.
+ *
+ * Returns: A #EGdbusCalFactoryProxy or %NULL if @error is set. Free with g_object_unref().
+ */
+EGdbusCalFactory *
+e_gdbus_cal_factory_proxy_new_for_bus_finish (GAsyncResult *result, GError **error)
+{
+	GObject *object;
+	GObject *source_object;
+	source_object = g_async_result_get_source_object (result);
+	g_assert (source_object != NULL);
+	object = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), result, error);
+	g_object_unref (source_object);
+	if (object != NULL)
+		return E_GDBUS_CAL_FACTORY (object);
+	else
+		return NULL;
+}
+
+/**
+ * e_gdbus_cal_factory_proxy_new_for_bus_sync:
+ * @bus_type: A #GBusType.
+ * @flags: Flags used when constructing the proxy.
+ * @name: A bus name (well-known or unique).
+ * @object_path: An object path.
+ * @cancellable: A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Like g_dbus_proxy_new_for_bus_sync() but returns a #EGdbusCalFactoryProxy.
+ *
+ * This is a synchronous failable constructor. See e_gdbus_cal_factory_proxy_new_for_bus() and e_gdbus_cal_factory_proxy_new_for_bus_finish() for the asynchronous version.
+ *
+ * Returns: A #EGdbusCalFactoryProxy or %NULL if error is set. Free with g_object_unref().
+ */
+EGdbusCalFactory *
+e_gdbus_cal_factory_proxy_new_for_bus_sync (GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error)
+{
+	GInitable *initable;
+	initable = g_initable_new (E_TYPE_GDBUS_CAL_FACTORY_PROXY,
+				cancellable,
+				error,
+				"g-flags", flags,
+				"g-name", name,
+				"g-bus-type", bus_type,
+				"g-object-path", object_path,
+				"g-interface-name", GDBUS_CAL_FACTORY_INTERFACE_NAME,
+				NULL);
+	if (initable != NULL)
+		return E_GDBUS_CAL_FACTORY (initable);
+	else
+		return NULL;
+}
+
+/* ---------------------------------------------------------------------- */
+
+struct _EGdbusCalFactoryStubPrivate
+{
+	gint foo;
+};
+
+static void stub_iface_init (EGdbusCalFactoryIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (EGdbusCalFactoryStub, e_gdbus_cal_factory_stub, G_TYPE_OBJECT,
+                         G_IMPLEMENT_INTERFACE (E_TYPE_GDBUS_CAL_FACTORY, stub_iface_init));
+
+static void
+e_gdbus_cal_factory_stub_init (EGdbusCalFactoryStub *stub)
+{
+	stub->priv = G_TYPE_INSTANCE_GET_PRIVATE (stub, E_TYPE_GDBUS_CAL_FACTORY_STUB, EGdbusCalFactoryStubPrivate);
+}
+
+static void
+e_gdbus_cal_factory_stub_class_init (EGdbusCalFactoryStubClass *klass)
+{
+	g_type_class_add_private (klass, sizeof (EGdbusCalFactoryStubPrivate));
+}
+
+static void
+stub_iface_init (EGdbusCalFactoryIface *iface)
+{
+}
+
+/**
+ * e_gdbus_cal_factory_stub_new:
+ *
+ * Creates a new stub object that can be exported via e_gdbus_cal_factory_register_object().
+ *
+ * Returns: A #EGdbusCalFactoryStub instance. Free with g_object_unref().
+ */
+EGdbusCalFactory *
+e_gdbus_cal_factory_stub_new (void)
+{
+	return E_GDBUS_CAL_FACTORY (g_object_new (E_TYPE_GDBUS_CAL_FACTORY_STUB, NULL));
+}
diff --git a/calendar/libegdbus/e-gdbus-cal-factory.h b/calendar/libegdbus/e-gdbus-cal-factory.h
new file mode 100644
index 0000000..1977c35
--- /dev/null
+++ b/calendar/libegdbus/e-gdbus-cal-factory.h
@@ -0,0 +1,116 @@
+/*
+ * e-gdbus-cal-factory.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#ifndef E_GDBUS_CAL_FACTORY_H
+#define E_GDBUS_CAL_FACTORY_H
+
+#include <gio/gio.h>
+
+#include <libedataserver/e-gdbus-templates.h>
+
+G_BEGIN_DECLS
+
+#define E_TYPE_GDBUS_CAL_FACTORY         (e_gdbus_cal_factory_get_type ())
+#define E_GDBUS_CAL_FACTORY(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_GDBUS_CAL_FACTORY, EGdbusCalFactory))
+#define E_IS_GDBUS_CAL_FACTORY(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_GDBUS_CAL_FACTORY))
+#define E_GDBUS_CAL_FACTORY_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE((o), E_TYPE_GDBUS_CAL_FACTORY, EGdbusCalFactoryIface))
+
+typedef struct _EGdbusCalFactory EGdbusCalFactory; /* Dummy typedef */
+typedef struct _EGdbusCalFactoryIface EGdbusCalFactoryIface;
+
+GType e_gdbus_cal_factory_get_type (void) G_GNUC_CONST;
+
+/* ---------------------------------------------------------------------- */
+
+typedef struct _EGdbusCalFactoryProxy EGdbusCalFactoryProxy;
+typedef struct _EGdbusCalFactoryProxyClass EGdbusCalFactoryProxyClass;
+typedef struct _EGdbusCalFactoryProxyPrivate EGdbusCalFactoryProxyPrivate;
+
+struct _EGdbusCalFactoryProxy
+{
+	GDBusProxy parent_instance;
+	EGdbusCalFactoryProxyPrivate *priv;
+};
+
+struct _EGdbusCalFactoryProxyClass
+{
+	GDBusProxyClass parent_class;
+};
+
+#define E_TYPE_GDBUS_CAL_FACTORY_PROXY (e_gdbus_cal_factory_proxy_get_type ())
+GType e_gdbus_cal_factory_proxy_get_type (void) G_GNUC_CONST;
+
+void			e_gdbus_cal_factory_proxy_new		(GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+EGdbusCalFactory *	e_gdbus_cal_factory_proxy_new_finish	(GAsyncResult *result, GError **error);
+EGdbusCalFactory *	e_gdbus_cal_factory_proxy_new_sync	(GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error);
+
+void			e_gdbus_cal_factory_proxy_new_for_bus	(GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+EGdbusCalFactory *	e_gdbus_cal_factory_proxy_new_for_bus_finish (GAsyncResult  *result, GError **error);
+EGdbusCalFactory *	e_gdbus_cal_factory_proxy_new_for_bus_sync (GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error);
+
+/* ---------------------------------------------------------------------- */
+
+typedef struct _EGdbusCalFactoryStub EGdbusCalFactoryStub;
+typedef struct _EGdbusCalFactoryStubClass EGdbusCalFactoryStubClass;
+typedef struct _EGdbusCalFactoryStubPrivate EGdbusCalFactoryStubPrivate;
+
+struct _EGdbusCalFactoryStub
+{
+	GObject parent_instance;
+	EGdbusCalFactoryStubPrivate *priv;
+};
+
+struct _EGdbusCalFactoryStubClass
+{
+	GObjectClass parent_class;
+};
+
+#define E_TYPE_GDBUS_CAL_FACTORY_STUB (e_gdbus_cal_factory_stub_get_type ())
+GType e_gdbus_cal_factory_stub_get_type (void) G_GNUC_CONST;
+
+EGdbusCalFactory *e_gdbus_cal_factory_stub_new (void);
+
+guint e_gdbus_cal_factory_register_object (EGdbusCalFactory *object, GDBusConnection *connection, const gchar *object_path, GError **error);
+void e_gdbus_cal_factory_drain_notify (EGdbusCalFactory *object);
+const GDBusInterfaceInfo *e_gdbus_cal_factory_interface_info (void) G_GNUC_CONST;
+
+struct _EGdbusCalFactoryIface
+{
+	GTypeInterface parent_iface;
+
+	/* Signal handlers for handling D-Bus method calls: */
+	gboolean (*handle_get_cal) (EGdbusCalFactory *object, GDBusMethodInvocation *invocation, const gchar * const *in_source_type);
+};
+
+gchar **	e_gdbus_cal_factory_encode_get_cal (const gchar *in_source, guint in_type);
+gboolean	e_gdbus_cal_factory_decode_get_cal (const gchar * const * in_strv, gchar **out_source, guint *out_type);
+
+/* D-Bus Methods */
+void		e_gdbus_cal_factory_call_get_cal	(GDBusProxy *proxy, const gchar * const *in_source_type, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_factory_call_get_cal_finish	(GDBusProxy *proxy, GAsyncResult *result, gchar **out_path, GError **error);
+gboolean	e_gdbus_cal_factory_call_get_cal_sync	(GDBusProxy *proxy, const gchar * const *in_source_type, gchar **out_path, GCancellable *cancellable, GError **error);
+
+/* D-Bus Methods Completion Helpers */
+void		e_gdbus_cal_factory_complete_get_cal	(EGdbusCalFactory *object, GDBusMethodInvocation *invocation, const gchar *out_path, const GError *error);
+
+G_END_DECLS
+
+#endif /* E_GDBUS_CAL_FACTORY_H */
diff --git a/calendar/libegdbus/e-gdbus-cal-view.c b/calendar/libegdbus/e-gdbus-cal-view.c
new file mode 100644
index 0000000..f9f1ad7
--- /dev/null
+++ b/calendar/libegdbus/e-gdbus-cal-view.c
@@ -0,0 +1,669 @@
+/*
+ * e-gdbus-cal-view.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#include <stdio.h>
+#include <gio/gio.h>
+
+#include <libedataserver/e-data-server-util.h>
+#include <libedataserver/e-gdbus-marshallers.h>
+
+#include "e-gdbus-cal-view.h"
+
+#define GDBUS_CAL_VIEW_INTERFACE_NAME "org.gnome.evolution.dataserver.CalendarView"
+
+typedef EGdbusCalViewIface EGdbusCalViewInterface;
+G_DEFINE_INTERFACE (EGdbusCalView, e_gdbus_cal_view, G_TYPE_OBJECT);
+
+enum
+{
+	_0_SIGNAL,
+	__OBJECTS_ADDED_SIGNAL,
+	__OBJECTS_CHANGED_SIGNAL,
+	__OBJECTS_REMOVED_SIGNAL,
+	__PROGRESS_SIGNAL,
+	__COMPLETE_SIGNAL,
+	__START_METHOD,
+	__STOP_METHOD,
+	__DISPOSE_METHOD,
+	__LAST_SIGNAL
+};
+
+static guint signals[__LAST_SIGNAL] = {0};
+
+/* ------------------------------------------------------------------------- */
+
+/* Various lookup tables */
+
+static GHashTable *_method_name_to_id = NULL;
+static GHashTable *_method_name_to_type = NULL;
+static GHashTable *_signal_name_to_id = NULL;
+static GHashTable *_signal_name_to_type = NULL;
+
+static guint
+lookup_method_id_from_method_name (const gchar *method_name)
+{
+	return GPOINTER_TO_UINT (g_hash_table_lookup (_method_name_to_id, method_name));
+}
+
+static guint
+lookup_method_type_from_method_name (const gchar *method_name)
+{
+	return GPOINTER_TO_UINT (g_hash_table_lookup (_method_name_to_type, method_name));
+}
+
+static guint
+lookup_signal_id_from_signal_name (const gchar *signal_name)
+{
+	return GPOINTER_TO_UINT (g_hash_table_lookup (_signal_name_to_id, signal_name));
+}
+
+static guint
+lookup_signal_type_from_signal_name (const gchar *signal_name)
+{
+	return GPOINTER_TO_UINT (g_hash_table_lookup (_signal_name_to_type, signal_name));
+}
+
+/* ------------------------------------------------------------------------- */
+
+E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_STRV	 (GDBUS_CAL_VIEW_INTERFACE_NAME, objects_added)
+E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_STRV	 (GDBUS_CAL_VIEW_INTERFACE_NAME, objects_changed)
+E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_STRV	 (GDBUS_CAL_VIEW_INTERFACE_NAME, objects_removed)
+E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_UINT_STRING (GDBUS_CAL_VIEW_INTERFACE_NAME, progress)
+E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_UINT_STRING (GDBUS_CAL_VIEW_INTERFACE_NAME, complete)
+
+static void
+e_gdbus_cal_view_default_init (EGdbusCalViewIface *iface)
+{
+	/* Build lookup structures */
+	_method_name_to_id = g_hash_table_new (g_str_hash, g_str_equal);
+	_method_name_to_type = g_hash_table_new (g_str_hash, g_str_equal);
+	_signal_name_to_id = g_hash_table_new (g_str_hash, g_str_equal);
+	_signal_name_to_type = g_hash_table_new (g_str_hash, g_str_equal);
+
+	
+	/* GObject signals definitions for D-Bus signals: */
+	E_INIT_GDBUS_SIGNAL_STRV	(EGdbusCalViewIface, "ObjectsAdded",	objects_added, __OBJECTS_ADDED_SIGNAL)
+	E_INIT_GDBUS_SIGNAL_STRV	(EGdbusCalViewIface, "ObjectsChanged",	objects_changed, __OBJECTS_CHANGED_SIGNAL)
+	E_INIT_GDBUS_SIGNAL_STRV	(EGdbusCalViewIface, "ObjectsRemoved",	objects_removed, __OBJECTS_REMOVED_SIGNAL)
+	E_INIT_GDBUS_SIGNAL_UINT_STRING	(EGdbusCalViewIface, "Progress",	progress, __PROGRESS_SIGNAL)
+	E_INIT_GDBUS_SIGNAL_UINT_STRING	(EGdbusCalViewIface, "Complete",	complete, __COMPLETE_SIGNAL)
+
+	/* GObject signals definitions for D-Bus methods: */
+	E_INIT_GDBUS_METHOD_VOID	(EGdbusCalViewIface, "start",		start, __START_METHOD)
+	E_INIT_GDBUS_METHOD_VOID	(EGdbusCalViewIface, "stop",		stop, __STOP_METHOD)
+	E_INIT_GDBUS_METHOD_VOID	(EGdbusCalViewIface, "dispose",		dispose, __DISPOSE_METHOD)
+}
+
+
+void
+e_gdbus_cal_view_call_start (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_method_call_void ("start", proxy, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_view_call_start_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return e_gdbus_proxy_method_call_finish_void (proxy, result, error);
+}
+
+gboolean
+e_gdbus_cal_view_call_start_sync (GDBusProxy *proxy, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_method_call_sync_void__void ("start", proxy, cancellable, error);
+}
+
+void
+e_gdbus_cal_view_call_stop (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_method_call_void ("stop", proxy, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_view_call_stop_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return e_gdbus_proxy_method_call_finish_void (proxy, result, error);
+}
+
+gboolean
+e_gdbus_cal_view_call_stop_sync (GDBusProxy *proxy, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_method_call_sync_void__void ("stop", proxy, cancellable, error);
+}
+
+void
+e_gdbus_cal_view_call_dispose (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_method_call_void ("dispose", proxy, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_view_call_dispose_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return e_gdbus_proxy_method_call_finish_void (proxy, result, error);
+}
+
+gboolean
+e_gdbus_cal_view_call_dispose_sync (GDBusProxy *proxy, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_method_call_sync_void__void ("dispose", proxy, cancellable, error);
+}
+
+void
+e_gdbus_cal_view_emit_objects_added (EGdbusCalView *object, const gchar * const *arg_objects)
+{
+	g_signal_emit (object, signals[__OBJECTS_ADDED_SIGNAL], 0, arg_objects);
+}
+
+void
+e_gdbus_cal_view_emit_objects_changed (EGdbusCalView *object, const gchar * const *arg_objects)
+{
+	g_signal_emit (object, signals[__OBJECTS_CHANGED_SIGNAL], 0, arg_objects);
+}
+
+void
+e_gdbus_cal_view_emit_objects_removed (EGdbusCalView *object, const gchar * const *arg_uids)
+{
+	g_signal_emit (object, signals[__OBJECTS_REMOVED_SIGNAL], 0, arg_uids);
+}
+
+void
+e_gdbus_cal_view_emit_progress (EGdbusCalView *object, guint arg_percent, const gchar *arg_message)
+{
+	g_signal_emit (object, signals[__PROGRESS_SIGNAL], 0, arg_percent, arg_message);
+}
+
+void
+e_gdbus_cal_view_emit_complete (EGdbusCalView *object, guint arg_status, const gchar *arg_message)
+{
+	g_signal_emit (object, signals[__COMPLETE_SIGNAL], 0, arg_status, arg_message);
+}
+
+E_DECLARE_GDBUS_NOTIFY_SIGNAL_1 (cal_view, ObjectsAdded, objects, "as")
+E_DECLARE_GDBUS_NOTIFY_SIGNAL_1 (cal_view, ObjectsChanged, objects, "as")
+E_DECLARE_GDBUS_NOTIFY_SIGNAL_1 (cal_view, ObjectsRemoved, uids, "as")
+E_DECLARE_GDBUS_NOTIFY_SIGNAL_2 (cal_view, Progress, percent, "u", message, "s")
+E_DECLARE_GDBUS_NOTIFY_SIGNAL_2 (cal_view, Complete, status, "u", message, "s")
+
+E_DECLARE_GDBUS_SYNC_METHOD_0	(cal_view, start)
+E_DECLARE_GDBUS_SYNC_METHOD_0	(cal_view, stop)
+E_DECLARE_GDBUS_SYNC_METHOD_0	(cal_view, dispose)
+
+static const GDBusMethodInfo * const e_gdbus_cal_view_method_info_pointers[] =
+{
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal_view, start),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal_view, stop),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal_view, dispose),
+	NULL
+};
+
+static const GDBusSignalInfo * const e_gdbus_cal_view_signal_info_pointers[] =
+{
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal_view, ObjectsAdded),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal_view, ObjectsChanged),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal_view, ObjectsRemoved),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal_view, Progress),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal_view, Complete),
+	NULL
+};
+
+static const GDBusInterfaceInfo _e_gdbus_cal_view_interface_info =
+{
+	-1,
+	(gchar *) GDBUS_CAL_VIEW_INTERFACE_NAME,
+	(GDBusMethodInfo **) &e_gdbus_cal_view_method_info_pointers,
+	(GDBusSignalInfo **) &e_gdbus_cal_view_signal_info_pointers,
+	(GDBusPropertyInfo **) NULL
+};
+
+static void
+handle_method_call (GDBusConnection       *connection,
+                    const gchar           *sender,
+                    const gchar           *object_path,
+                    const gchar           *interface_name,
+                    const gchar           *method_name,
+                    GVariant              *parameters,
+                    GDBusMethodInvocation *invocation,
+                    gpointer               user_data)
+{
+	guint method_id, method_type;
+
+	method_id = lookup_method_id_from_method_name (method_name);
+	method_type = lookup_method_type_from_method_name (method_name);
+
+	g_return_if_fail (method_id != 0);
+	g_return_if_fail (method_type != 0);
+
+	e_gdbus_stub_handle_method_call (user_data, invocation, parameters, method_name, signals[method_id], method_type);
+}
+
+static GVariant *
+get_property (GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GError **error, gpointer user_data)
+{
+	g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "This implementation does not support property `%s'", property_name);
+	return NULL;
+}
+
+static gboolean
+set_property (GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GVariant *value, GError **error, gpointer user_data)
+{
+	g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "This implementation does not support property `%s'", property_name);
+	return FALSE;
+}
+
+static const GDBusInterfaceVTable e_gdbus_cal_view_interface_vtable =
+{
+  handle_method_call,
+  get_property,
+  set_property
+};
+
+static gboolean
+emit_notifications_in_idle (gpointer user_data)
+{
+	GObject *object = G_OBJECT (user_data);
+	GDBusConnection *connection;
+	const gchar *path;
+	GHashTable *notification_queue;
+	GHashTableIter iter;
+	const gchar *property_name;
+	GVariant *value;
+	GVariantBuilder *builder;
+	GVariantBuilder *invalidated_builder;
+	GHashTable *pvc;
+	gboolean has_changes;
+
+	notification_queue = g_object_get_data (object, "gdbus-codegen-notification-queue");
+	path = g_object_get_data (object, "gdbus-codegen-path");
+	connection = g_object_get_data (object, "gdbus-codegen-connection");
+	pvc = g_object_get_data (object, "gdbus-codegen-pvc");
+	g_assert (notification_queue != NULL && path != NULL && connection != NULL && pvc != NULL);
+
+	builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
+	invalidated_builder = g_variant_builder_new (G_VARIANT_TYPE ("as"));
+	g_hash_table_iter_init (&iter, notification_queue);
+	has_changes = FALSE;
+	while (g_hash_table_iter_next (&iter, (gpointer) &property_name, (gpointer) &value)) {
+		GVariant *cached_value;
+		cached_value = g_hash_table_lookup (pvc, property_name);
+		if (cached_value == NULL || !g_variant_equal (cached_value, value)) {
+			g_hash_table_insert (pvc, (gpointer) property_name, (gpointer) g_variant_ref (value));
+			g_variant_builder_add (builder, "{sv}", property_name, value);
+			has_changes = TRUE;
+		}
+    }
+
+	if (has_changes) {
+		g_dbus_connection_emit_signal (connection,
+					NULL,
+					path,
+					"org.freedesktop.DBus.Properties",
+					"PropertiesChanged",
+					g_variant_new ("(sa{sv}as)",
+							GDBUS_CAL_VIEW_INTERFACE_NAME,
+							builder,
+							invalidated_builder),
+					NULL);
+	} else {
+		g_variant_builder_unref (builder);
+		g_variant_builder_unref (invalidated_builder);
+	}
+
+	g_hash_table_remove_all (notification_queue);
+	g_object_set_data (object, "gdbus-codegen-notification-idle-id", GUINT_TO_POINTER (0));
+	return FALSE;
+}
+
+/**
+ * e_gdbus_cal_view_drain_notify:
+ * @object: A #EGdbusCalView that is exported.
+ *
+ * If @object has queued notifications, empty the queue forcing
+ * the <literal>PropertiesChanged</literal> signal to be emitted.
+ * See <xref linkend="EGdbusCalView.description"/> for more background information.
+ */
+void
+e_gdbus_cal_view_drain_notify (EGdbusCalView *object)
+{
+	gint idle_id;
+	idle_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (object), "gdbus-codegen-notification-idle-id"));
+	if (idle_id > 0) {
+		emit_notifications_in_idle (object);
+		g_source_remove (idle_id);
+	}
+}
+
+static void
+on_object_unregistered (GObject *object)
+{
+	gint idle_id;
+	idle_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (object), "gdbus-codegen-notification-idle-id"));
+	if (idle_id > 0) {
+		g_source_remove (idle_id);
+	}
+	g_object_set_data (G_OBJECT (object), "gdbus-codegen-path", NULL);
+	g_object_set_data (G_OBJECT (object), "gdbus-codegen-connection", NULL);
+}
+
+/**
+ * e_gdbus_cal_view_register_object:
+ * @object: An instance of a #GObject<!-- -->-derived type implementing the #EGdbusCalView interface.
+ * @connection: A #GDBusConnection.
+ * @object_path: The object to register the object at.
+ * @error: Return location for error or %NULL.
+ *
+ * Registers @object at @object_path on @connection.
+ *
+ * See <xref linkend="EGdbusCalView.description"/>
+ * for how properties, methods and signals are handled.
+ *
+ * Returns: 0 if @error is set, otherwise a registration id (never 0) that can be used with g_dbus_connection_unregister_object().
+ */
+guint
+e_gdbus_cal_view_register_object (EGdbusCalView *object, GDBusConnection *connection, const gchar *object_path, GError **error)
+{
+	GHashTable *pvc;
+
+	pvc = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify) g_variant_unref);
+
+	g_object_set_data_full (G_OBJECT (object), "gdbus-codegen-path", (gpointer) g_strdup (object_path), g_free);
+	g_object_set_data (G_OBJECT (object), "gdbus-codegen-connection", (gpointer) connection);
+	g_object_set_data_full (G_OBJECT (object), "gdbus-codegen-pvc", (gpointer) pvc, (GDestroyNotify) g_hash_table_unref);
+	return g_dbus_connection_register_object (connection,
+		object_path,
+		(GDBusInterfaceInfo *) &_e_gdbus_cal_view_interface_info,
+		&e_gdbus_cal_view_interface_vtable,
+		object,
+		(GDestroyNotify) on_object_unregistered,
+		error);
+}
+
+/**
+ * e_gdbus_cal_view_interface_info:
+ *
+ * Gets interface description for the <literal>org.gnome.evolution.dataserver.CalendarView</literal> D-Bus interface.
+ *
+ * Returns: A #GDBusInterfaceInfo. Do not free, the object is statically allocated.
+ */
+const GDBusInterfaceInfo *
+e_gdbus_cal_view_interface_info (void)
+{
+	return &_e_gdbus_cal_view_interface_info;
+}
+
+/* ---------------------------------------------------------------------- */
+
+static void proxy_iface_init (EGdbusCalViewIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (EGdbusCalViewProxy, e_gdbus_cal_view_proxy, G_TYPE_DBUS_PROXY,
+                         G_IMPLEMENT_INTERFACE (E_TYPE_GDBUS_CAL_VIEW, proxy_iface_init));
+
+static void
+e_gdbus_cal_view_proxy_init (EGdbusCalViewProxy *proxy)
+{
+	g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), (GDBusInterfaceInfo *) &_e_gdbus_cal_view_interface_info);
+}
+
+static void
+g_signal (GDBusProxy *proxy, const gchar *sender_name, const gchar *signal_name, GVariant *parameters)
+{
+	guint signal_id, signal_type;
+
+	signal_id = lookup_signal_id_from_signal_name (signal_name);
+	signal_type = lookup_signal_type_from_signal_name (signal_name);
+
+	g_return_if_fail (signal_id != 0);
+	g_return_if_fail (signal_type != 0);
+
+	e_gdbus_proxy_emit_signal (proxy, parameters, signals[signal_id], signal_type);
+}
+
+static void
+e_gdbus_cal_view_proxy_class_init (EGdbusCalViewProxyClass *klass)
+{
+	GDBusProxyClass *proxy_class;
+
+	proxy_class = G_DBUS_PROXY_CLASS (klass);
+	proxy_class->g_signal = g_signal;
+}
+
+static void
+proxy_iface_init (EGdbusCalViewIface *iface)
+{
+}
+
+/**
+ * e_gdbus_cal_view_proxy_new:
+ * @connection: A #GDBusConnection.
+ * @flags: Flags used when constructing the proxy.
+ * @name: A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
+ * @object_path: An object path.
+ * @cancellable: A #GCancellable or %NULL.
+ * @callback: Callback function to invoke when the proxy is ready.
+ * @user_data: User data to pass to @callback.
+ *
+ * Like g_dbus_proxy_new() but returns a #EGdbusCalViewProxy.
+ *
+ * This is a failable asynchronous constructor - when the proxy is ready, callback will be invoked and you can use e_gdbus_cal_view_proxy_new_finish() to get the result.
+ */
+void
+e_gdbus_cal_view_proxy_new (GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	g_async_initable_new_async (E_TYPE_GDBUS_CAL_VIEW_PROXY,
+				G_PRIORITY_DEFAULT,
+				cancellable,
+				callback,
+				user_data,
+				"g-flags", flags,
+				"g-name", name,
+				"g-connection", connection,
+				"g-object-path", object_path,
+				"g-interface-name", GDBUS_CAL_VIEW_INTERFACE_NAME,
+				NULL);
+}
+
+/**
+ * e_gdbus_cal_view_proxy_new_finish:
+ * @result: A #GAsyncResult obtained from the #GAsyncReadyCallback function passed to e_gdbus_cal_view_proxy_new().
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes creating a #EGdbusCalViewProxy.
+ *
+ * Returns: A #EGdbusCalViewProxy or %NULL if @error is set. Free with g_object_unref().
+ */
+EGdbusCalView *
+e_gdbus_cal_view_proxy_new_finish (GAsyncResult *result, GError **error)
+{
+	GObject *object;
+	GObject *source_object;
+	source_object = g_async_result_get_source_object (result);
+	g_assert (source_object != NULL);
+	object = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), result, error);
+	g_object_unref (source_object);
+	if (object != NULL)
+		return E_GDBUS_CAL_VIEW (object);
+	else
+		return NULL;
+}
+
+/**
+ * e_gdbus_cal_view_proxy_new_sync:
+ * @connection: A #GDBusConnection.
+ * @flags: Flags used when constructing the proxy.
+ * @name: A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
+ * @object_path: An object path.
+ * @cancellable: A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Like g_dbus_proxy_new_sync() but returns a #EGdbusCalViewProxy.
+ *
+ * This is a synchronous failable constructor. See e_gdbus_cal_view_proxy_new() and e_gdbus_cal_view_proxy_new_finish() for the asynchronous version.
+ *
+ * Returns: A #EGdbusCalViewProxy or %NULL if error is set. Free with g_object_unref().
+ */
+EGdbusCalView *
+e_gdbus_cal_view_proxy_new_sync (GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error)
+{
+	GInitable *initable;
+	initable = g_initable_new (E_TYPE_GDBUS_CAL_VIEW_PROXY,
+				cancellable,
+				error,
+				"g-flags", flags,
+				"g-name", name,
+				"g-connection", connection,
+				"g-object-path", object_path,
+				"g-interface-name", GDBUS_CAL_VIEW_INTERFACE_NAME,
+				NULL);
+	if (initable != NULL)
+		return E_GDBUS_CAL_VIEW (initable);
+	else
+		return NULL;
+}
+
+/**
+ * e_gdbus_cal_view_proxy_new_for_bus:
+ * @bus_type: A #GBusType.
+ * @flags: Flags used when constructing the proxy.
+ * @name: A bus name (well-known or unique).
+ * @object_path: An object path.
+ * @cancellable: A #GCancellable or %NULL.
+ * @callback: Callback function to invoke when the proxy is ready.
+ * @user_data: User data to pass to @callback.
+ *
+ * Like g_dbus_proxy_new_for_bus() but returns a #EGdbusCalViewProxy.
+ *
+ * This is a failable asynchronous constructor - when the proxy is ready, callback will be invoked and you can use e_gdbus_cal_view_proxy_new_for_bus_finish() to get the result.
+ */
+void
+e_gdbus_cal_view_proxy_new_for_bus (GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	g_async_initable_new_async (E_TYPE_GDBUS_CAL_VIEW_PROXY,
+				G_PRIORITY_DEFAULT,
+				cancellable,
+				callback,
+				user_data,
+				"g-flags", flags,
+				"g-name", name,
+				"g-bus-type", bus_type,
+				"g-object-path", object_path,
+				"g-interface-name", GDBUS_CAL_VIEW_INTERFACE_NAME,
+				NULL);
+}
+
+/**
+ * e_gdbus_cal_view_proxy_new_for_bus_finish:
+ * @result: A #GAsyncResult obtained from the #GAsyncReadyCallback function passed to e_gdbus_cal_view_proxy_new_for_bus().
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes creating a #EGdbusCalViewProxy.
+ *
+ * Returns: A #EGdbusCalViewProxy or %NULL if @error is set. Free with g_object_unref().
+ */
+EGdbusCalView *
+e_gdbus_cal_view_proxy_new_for_bus_finish (GAsyncResult  *result, GError **error)
+{
+	GObject *object;
+	GObject *source_object;
+	source_object = g_async_result_get_source_object (result);
+	g_assert (source_object != NULL);
+	object = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), result, error);
+	g_object_unref (source_object);
+	if (object != NULL)
+		return E_GDBUS_CAL_VIEW (object);
+	else
+		return NULL;
+}
+
+/**
+ * e_gdbus_cal_view_proxy_new_for_bus_sync:
+ * @bus_type: A #GBusType.
+ * @flags: Flags used when constructing the proxy.
+ * @name: A bus name (well-known or unique).
+ * @object_path: An object path.
+ * @cancellable: A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Like g_dbus_proxy_new_for_bus_sync() but returns a #EGdbusCalViewProxy.
+ *
+ * This is a synchronous failable constructor. See e_gdbus_cal_view_proxy_new_for_bus() and e_gdbus_cal_view_proxy_new_for_bus_finish() for the asynchronous version.
+ *
+ * Returns: A #EGdbusCalViewProxy or %NULL if error is set. Free with g_object_unref().
+ */
+EGdbusCalView *
+e_gdbus_cal_view_proxy_new_for_bus_sync (GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error)
+{
+	GInitable *initable;
+	initable = g_initable_new (E_TYPE_GDBUS_CAL_VIEW_PROXY,
+				cancellable,
+				error,
+				"g-flags", flags,
+				"g-name", name,
+				"g-bus-type", bus_type,
+				"g-object-path", object_path,
+				"g-interface-name", GDBUS_CAL_VIEW_INTERFACE_NAME,
+				NULL);
+	if (initable != NULL)
+		return E_GDBUS_CAL_VIEW (initable);
+	else
+		return NULL;
+}
+
+/* ---------------------------------------------------------------------- */
+
+struct _EGdbusCalViewStubPrivate
+{
+	gint foo;
+};
+
+static void stub_iface_init (EGdbusCalViewIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (EGdbusCalViewStub, e_gdbus_cal_view_stub, G_TYPE_OBJECT,
+                         G_IMPLEMENT_INTERFACE (E_TYPE_GDBUS_CAL_VIEW, stub_iface_init));
+
+static void
+e_gdbus_cal_view_stub_init (EGdbusCalViewStub *stub)
+{
+	stub->priv = G_TYPE_INSTANCE_GET_PRIVATE (stub, E_TYPE_GDBUS_CAL_VIEW_STUB, EGdbusCalViewStubPrivate);
+}
+
+static void
+e_gdbus_cal_view_stub_class_init (EGdbusCalViewStubClass *klass)
+{
+	g_type_class_add_private (klass, sizeof (EGdbusCalViewStubPrivate));
+}
+
+static void
+stub_iface_init (EGdbusCalViewIface *iface)
+{
+}
+
+/**
+ * e_gdbus_cal_view_stub_new:
+ *
+ * Creates a new stub object that can be exported via e_gdbus_cal_view_register_object().
+ *
+ * Returns: A #EGdbusCalViewStub instance. Free with g_object_unref().
+ */
+EGdbusCalView *
+e_gdbus_cal_view_stub_new (void)
+{
+	return E_GDBUS_CAL_VIEW (g_object_new (E_TYPE_GDBUS_CAL_VIEW_STUB, NULL));
+}
diff --git a/calendar/libegdbus/e-gdbus-cal-view.h b/calendar/libegdbus/e-gdbus-cal-view.h
new file mode 100644
index 0000000..0c4bfb6
--- /dev/null
+++ b/calendar/libegdbus/e-gdbus-cal-view.h
@@ -0,0 +1,141 @@
+/*
+ * e-gdbus-cal-view.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#ifndef E_GDBUS_CAL_VIEW_H
+#define E_GDBUS_CAL_VIEW_H
+
+#include <gio/gio.h>
+
+#include <libedataserver/e-gdbus-templates.h>
+
+G_BEGIN_DECLS
+
+#define E_TYPE_GDBUS_CAL_VIEW         (e_gdbus_cal_view_get_type ())
+#define E_GDBUS_CAL_VIEW(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_GDBUS_CAL_VIEW, EGdbusCalView))
+#define E_IS_GDBUS_CAL_VIEW(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_GDBUS_CAL_VIEW))
+#define E_GDBUS_CAL_VIEW_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE((o), E_TYPE_GDBUS_CAL_VIEW, EGdbusCalViewIface))
+
+typedef struct _EGdbusCalView EGdbusCalView; /* Dummy typedef */
+typedef struct _EGdbusCalViewIface EGdbusCalViewIface;
+
+GType e_gdbus_cal_view_get_type (void) G_GNUC_CONST;
+
+/* ---------------------------------------------------------------------- */
+
+typedef struct _EGdbusCalViewProxy EGdbusCalViewProxy;
+typedef struct _EGdbusCalViewProxyClass EGdbusCalViewProxyClass;
+typedef struct _EGdbusCalViewProxyPrivate EGdbusCalViewProxyPrivate;
+
+struct _EGdbusCalViewProxy
+{
+	GDBusProxy parent_instance;
+	EGdbusCalViewProxyPrivate *priv;
+};
+
+struct _EGdbusCalViewProxyClass
+{
+	GDBusProxyClass parent_class;
+};
+
+#define E_TYPE_GDBUS_CAL_VIEW_PROXY (e_gdbus_cal_view_proxy_get_type ())
+GType e_gdbus_cal_view_proxy_get_type (void) G_GNUC_CONST;
+
+void		e_gdbus_cal_view_proxy_new (GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+EGdbusCalView *	e_gdbus_cal_view_proxy_new_finish (GAsyncResult *result, GError **error);
+EGdbusCalView *	e_gdbus_cal_view_proxy_new_sync (GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_cal_view_proxy_new_for_bus (GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+EGdbusCalView *	e_gdbus_cal_view_proxy_new_for_bus_finish (GAsyncResult *result, GError **error);
+EGdbusCalView *	e_gdbus_cal_view_proxy_new_for_bus_sync (GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error);
+
+/* ---------------------------------------------------------------------- */
+
+typedef struct _EGdbusCalViewStub EGdbusCalViewStub;
+typedef struct _EGdbusCalViewStubClass EGdbusCalViewStubClass;
+typedef struct _EGdbusCalViewStubPrivate EGdbusCalViewStubPrivate;
+
+struct _EGdbusCalViewStub
+{
+	GObject parent_instance;
+	EGdbusCalViewStubPrivate *priv;
+};
+
+struct _EGdbusCalViewStubClass
+{
+	GObjectClass parent_class;
+};
+
+#define E_TYPE_GDBUS_CAL_VIEW_STUB (e_gdbus_cal_view_stub_get_type ())
+GType e_gdbus_cal_view_stub_get_type (void) G_GNUC_CONST;
+
+EGdbusCalView *e_gdbus_cal_view_stub_new (void);
+guint e_gdbus_cal_view_register_object (EGdbusCalView *object, GDBusConnection *connection, const gchar *object_path, GError **error);
+void e_gdbus_cal_view_drain_notify (EGdbusCalView *object);
+
+const GDBusInterfaceInfo *e_gdbus_cal_view_interface_info (void) G_GNUC_CONST;
+
+struct _EGdbusCalViewIface
+{
+	GTypeInterface parent_iface;
+
+	/* Signal handlers for receiving D-Bus signals: */
+	void	(*objects_added)	(EGdbusCalView *object, const gchar * const *arg_objects);
+	void	(*objects_changed)	(EGdbusCalView *object, const gchar * const *arg_objects);
+	void	(*objects_removed)	(EGdbusCalView *object, const gchar * const *arg_uids);
+
+	void	(*progress)		(EGdbusCalView *object, guint arg_percent, const gchar *arg_message);
+	void	(*complete)		(EGdbusCalView *object, guint arg_status, const gchar *arg_message);
+
+	/* Signal handlers for handling D-Bus method calls: */
+	gboolean (*handle_start)	(EGdbusCalView *object, GDBusMethodInvocation *invocation);
+	gboolean (*handle_stop)		(EGdbusCalView *object, GDBusMethodInvocation *invocation);
+	gboolean (*handle_dispose)	(EGdbusCalView *object, GDBusMethodInvocation *invocation);
+};
+
+/* D-Bus Methods */
+void		e_gdbus_cal_view_call_start		(GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_view_call_start_finish	(GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean	e_gdbus_cal_view_call_start_sync	(GDBusProxy *proxy, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_cal_view_call_stop		(GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_view_call_stop_finish	(GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean	e_gdbus_cal_view_call_stop_sync		(GDBusProxy *proxy, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_cal_view_call_dispose		(GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_view_call_dispose_finish	(GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean	e_gdbus_cal_view_call_dispose_sync	(GDBusProxy *proxy, GCancellable *cancellable, GError **error);
+
+/* D-Bus Methods Completion Helpers */
+#define e_gdbus_cal_view_complete_start		e_gdbus_complete_sync_method_void
+#define e_gdbus_cal_view_complete_stop		e_gdbus_complete_sync_method_void
+#define e_gdbus_cal_view_complete_dispose	e_gdbus_complete_sync_method_void
+
+/* D-Bus Signal Emission Helpers */
+void e_gdbus_cal_view_emit_objects_added	(EGdbusCalView *object, const gchar * const *arg_objects);
+void e_gdbus_cal_view_emit_objects_changed	(EGdbusCalView *object, const gchar * const *arg_objects);
+void e_gdbus_cal_view_emit_objects_removed	(EGdbusCalView *object, const gchar * const *arg_uids);
+
+void e_gdbus_cal_view_emit_progress		(EGdbusCalView *object, guint arg_percent, const gchar *arg_message);
+void e_gdbus_cal_view_emit_complete		(EGdbusCalView *object, guint arg_status, const gchar *arg_message);
+
+G_END_DECLS
+
+#endif /* E_GDBUS_CAL_VIEW_H */
diff --git a/calendar/libegdbus/e-gdbus-cal.c b/calendar/libegdbus/e-gdbus-cal.c
new file mode 100644
index 0000000..12c20ad
--- /dev/null
+++ b/calendar/libegdbus/e-gdbus-cal.c
@@ -0,0 +1,1581 @@
+/*
+ * e-gdbus-cal.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <gio/gio.h>
+
+#include <libedataserver/e-data-server-util.h>
+#include <libedataserver/e-gdbus-marshallers.h>
+
+#include "e-gdbus-cal.h"
+
+#define GDBUS_CAL_INTERFACE_NAME "org.gnome.evolution.dataserver.Calendar"
+
+typedef EGdbusCalIface EGdbusCalInterface;
+G_DEFINE_INTERFACE (EGdbusCal, e_gdbus_cal, G_TYPE_OBJECT);
+
+enum
+{
+	_0_SIGNAL,
+	__BACKEND_ERROR_SIGNAL,
+	__READONLY_SIGNAL,
+	__ONLINE_SIGNAL,
+	__AUTH_REQUIRED_SIGNAL,
+	__OPEN_METHOD,
+	__OPEN_DONE_SIGNAL,
+	__AUTHENTICATE_USER_METHOD,
+	__AUTHENTICATE_USER_DONE_SIGNAL,
+	__REMOVE_METHOD,
+	__REMOVE_DONE_SIGNAL,
+	__REFRESH_METHOD,
+	__REFRESH_DONE_SIGNAL,
+	__GET_CACHE_DIR_METHOD,
+	__GET_CACHE_DIR_DONE_SIGNAL,
+	__GET_CAPABILITIES_METHOD,
+	__GET_CAPABILITIES_DONE_SIGNAL,
+	__GET_CAL_EMAIL_ADDRESS_METHOD,
+	__GET_CAL_EMAIL_ADDRESS_DONE_SIGNAL,
+	__GET_ALARM_EMAIL_ADDRESS_METHOD,
+	__GET_ALARM_EMAIL_ADDRESS_DONE_SIGNAL,
+	__GET_DEFAULT_OBJECT_METHOD,
+	__GET_DEFAULT_OBJECT_DONE_SIGNAL,
+	__GET_OBJECT_METHOD,
+	__GET_OBJECT_DONE_SIGNAL,
+	__GET_OBJECT_LIST_METHOD,
+	__GET_OBJECT_LIST_DONE_SIGNAL,
+	__GET_FREE_BUSY_METHOD,
+	__GET_FREE_BUSY_DONE_SIGNAL,
+	__CREATE_OBJECT_METHOD,
+	__CREATE_OBJECT_DONE_SIGNAL,
+	__MODIFY_OBJECT_METHOD,
+	__MODIFY_OBJECT_DONE_SIGNAL,
+	__REMOVE_OBJECT_METHOD,
+	__REMOVE_OBJECT_DONE_SIGNAL,
+	__RECEIVE_OBJECTS_METHOD,
+	__RECEIVE_OBJECTS_DONE_SIGNAL,
+	__SEND_OBJECTS_METHOD,
+	__SEND_OBJECTS_DONE_SIGNAL,
+	__GET_ATTACHMENT_URIS_METHOD,
+	__GET_ATTACHMENT_URIS_DONE_SIGNAL,
+	__GET_VIEW_METHOD,
+	__GET_VIEW_DONE_SIGNAL,
+	__GET_TIMEZONE_METHOD,
+	__GET_TIMEZONE_DONE_SIGNAL,
+	__ADD_TIMEZONE_METHOD,
+	__ADD_TIMEZONE_DONE_SIGNAL,
+	__CANCEL_OPERATION_METHOD,
+	__CANCEL_ALL_METHOD,
+	__CLOSE_METHOD,
+	__LAST_SIGNAL
+};
+
+static guint signals[__LAST_SIGNAL] = {0};
+
+struct _EGdbusCalProxyPrivate
+{
+	GHashTable *pending_ops;
+};
+
+/* ------------------------------------------------------------------------- */
+
+/* Various lookup tables */
+
+static GHashTable *_method_name_to_id = NULL;
+static GHashTable *_method_name_to_type = NULL;
+static GHashTable *_signal_name_to_id = NULL;
+static GHashTable *_signal_name_to_type = NULL;
+
+static guint
+lookup_method_id_from_method_name (const gchar *method_name)
+{
+	return GPOINTER_TO_UINT (g_hash_table_lookup (_method_name_to_id, method_name));
+}
+
+static guint
+lookup_method_type_from_method_name (const gchar *method_name)
+{
+	return GPOINTER_TO_UINT (g_hash_table_lookup (_method_name_to_type, method_name));
+}
+
+static guint
+lookup_signal_id_from_signal_name (const gchar *signal_name)
+{
+	return GPOINTER_TO_UINT (g_hash_table_lookup (_signal_name_to_id, signal_name));
+}
+
+static guint
+lookup_signal_type_from_signal_name (const gchar *signal_name)
+{
+	return GPOINTER_TO_UINT (g_hash_table_lookup (_signal_name_to_type, signal_name));
+}
+
+/* ------------------------------------------------------------------------- */
+
+E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_STRING  (GDBUS_CAL_INTERFACE_NAME, backend_error)
+E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_BOOLEAN (GDBUS_CAL_INTERFACE_NAME, readonly)
+E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_BOOLEAN (GDBUS_CAL_INTERFACE_NAME, online)
+E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_STRV    (GDBUS_CAL_INTERFACE_NAME, auth_required)
+
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_VOID	(GDBUS_CAL_INTERFACE_NAME, open)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_VOID	(GDBUS_CAL_INTERFACE_NAME, authenticate_user)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_VOID	(GDBUS_CAL_INTERFACE_NAME, remove)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_VOID	(GDBUS_CAL_INTERFACE_NAME, refresh)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRING	(GDBUS_CAL_INTERFACE_NAME, get_cache_dir)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRING	(GDBUS_CAL_INTERFACE_NAME, get_capabilities)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRING	(GDBUS_CAL_INTERFACE_NAME, get_cal_email_address)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRING	(GDBUS_CAL_INTERFACE_NAME, get_alarm_email_address)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRING	(GDBUS_CAL_INTERFACE_NAME, get_default_object)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRING	(GDBUS_CAL_INTERFACE_NAME, get_object)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRV	(GDBUS_CAL_INTERFACE_NAME, get_object_list)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRV	(GDBUS_CAL_INTERFACE_NAME, get_free_busy)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRING	(GDBUS_CAL_INTERFACE_NAME, create_object)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_VOID	(GDBUS_CAL_INTERFACE_NAME, modify_object)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_VOID	(GDBUS_CAL_INTERFACE_NAME, remove_object)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_VOID	(GDBUS_CAL_INTERFACE_NAME, receive_objects)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRV	(GDBUS_CAL_INTERFACE_NAME, send_objects)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRV	(GDBUS_CAL_INTERFACE_NAME, get_attachment_uris)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRING	(GDBUS_CAL_INTERFACE_NAME, get_view)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRING	(GDBUS_CAL_INTERFACE_NAME, get_timezone)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_VOID	(GDBUS_CAL_INTERFACE_NAME, add_timezone)
+
+static void
+e_gdbus_cal_default_init (EGdbusCalIface *iface)
+{
+	/* Build lookup structures */
+	_method_name_to_id = g_hash_table_new (g_str_hash, g_str_equal);
+	_method_name_to_type = g_hash_table_new (g_str_hash, g_str_equal);
+	_signal_name_to_id = g_hash_table_new (g_str_hash, g_str_equal);
+	_signal_name_to_type = g_hash_table_new (g_str_hash, g_str_equal);
+
+	/* GObject signals definitions for D-Bus signals: */
+	E_INIT_GDBUS_SIGNAL_STRING		(EGdbusCalIface, "backend_error",	backend_error,	__BACKEND_ERROR_SIGNAL)
+	E_INIT_GDBUS_SIGNAL_BOOLEAN		(EGdbusCalIface, "readonly",		readonly,	__READONLY_SIGNAL)
+	E_INIT_GDBUS_SIGNAL_BOOLEAN		(EGdbusCalIface, "online",		online,		__ONLINE_SIGNAL)
+	E_INIT_GDBUS_SIGNAL_STRV   		(EGdbusCalIface, "auth_required", 	auth_required,	__AUTH_REQUIRED_SIGNAL)
+
+	/* GObject signals definitions for D-Bus methods: */
+	E_INIT_GDBUS_METHOD_ASYNC_BOOLEAN__VOID	(EGdbusCalIface, "open",			open, __OPEN_METHOD, __OPEN_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_STRV__VOID	(EGdbusCalIface, "authenticateUser",		authenticate_user, __AUTHENTICATE_USER_METHOD, __AUTHENTICATE_USER_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_VOID__VOID	(EGdbusCalIface, "remove",			remove, __REMOVE_METHOD, __REMOVE_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_VOID__VOID	(EGdbusCalIface, "refresh",			refresh, __REFRESH_METHOD, __REFRESH_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_VOID__STRING	(EGdbusCalIface, "getCacheDir",			get_cache_dir, __GET_CACHE_DIR_METHOD, __GET_CACHE_DIR_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_VOID__STRING	(EGdbusCalIface, "getCapabilities",		get_capabilities, __GET_CAPABILITIES_METHOD, __GET_CAPABILITIES_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_VOID__STRING	(EGdbusCalIface, "getCalEmailAddress",		get_cal_email_address, __GET_CAL_EMAIL_ADDRESS_METHOD, __GET_CAL_EMAIL_ADDRESS_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_VOID__STRING	(EGdbusCalIface, "getAlarmEmailAddress",	get_alarm_email_address, __GET_ALARM_EMAIL_ADDRESS_METHOD, __GET_ALARM_EMAIL_ADDRESS_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_VOID__STRING	(EGdbusCalIface, "getDefaultObject",		get_default_object, __GET_DEFAULT_OBJECT_METHOD, __GET_DEFAULT_OBJECT_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_STRV__STRING	(EGdbusCalIface, "getObject",			get_object, __GET_OBJECT_METHOD, __GET_OBJECT_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_STRING__STRV	(EGdbusCalIface, "getObjectList",		get_object_list, __GET_OBJECT_LIST_METHOD, __GET_OBJECT_LIST_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_STRV__STRV	(EGdbusCalIface, "getFreeBusy",			get_free_busy, __GET_FREE_BUSY_METHOD, __GET_FREE_BUSY_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_STRING__STRING(EGdbusCalIface, "createObject",		create_object, __CREATE_OBJECT_METHOD, __CREATE_OBJECT_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_STRV__VOID	(EGdbusCalIface, "modifyObject",		modify_object, __MODIFY_OBJECT_METHOD, __MODIFY_OBJECT_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_STRV__VOID	(EGdbusCalIface, "removeObject",		remove_object, __REMOVE_OBJECT_METHOD, __REMOVE_OBJECT_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_STRING__VOID	(EGdbusCalIface, "receiveObjects",		receive_objects, __RECEIVE_OBJECTS_METHOD, __RECEIVE_OBJECTS_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_STRING__STRV	(EGdbusCalIface, "sendObjects",			send_objects, __SEND_OBJECTS_METHOD, __SEND_OBJECTS_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_STRV__STRV	(EGdbusCalIface, "getAttachmentUris",		get_attachment_uris, __GET_ATTACHMENT_URIS_METHOD, __GET_ATTACHMENT_URIS_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_STRING__STRING(EGdbusCalIface, "getView",			get_view, __GET_VIEW_METHOD, __GET_VIEW_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_STRING__STRING(EGdbusCalIface, "getTimezone",			get_timezone, __GET_TIMEZONE_METHOD, __GET_TIMEZONE_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_STRING__VOID	(EGdbusCalIface, "addTimezone",			add_timezone, __ADD_TIMEZONE_METHOD, __ADD_TIMEZONE_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_UINT		(EGdbusCalIface, "cancelOperation",		cancel_operation, __CANCEL_OPERATION_METHOD)
+	E_INIT_GDBUS_METHOD_VOID		(EGdbusCalIface, "cancelAll",			cancel_all, __CANCEL_ALL_METHOD)
+	E_INIT_GDBUS_METHOD_VOID		(EGdbusCalIface, "close",			close, __CLOSE_METHOD)
+}
+
+static gchar **
+encode_string_string (const gchar *str1, const gchar *str2)
+{
+	gchar **strv;
+
+	strv = g_new0 (gchar *, 3);
+	strv[0] = e_util_utf8_make_valid (str1 ? str1 : "");
+	strv[1] = e_util_utf8_make_valid (str2 ? str2 : "");
+	strv[2] = NULL;
+
+	return strv;
+}
+
+static gboolean
+decode_string_string (const gchar * const *in_strv, gchar **out_str1, gchar **out_str2)
+{
+	g_return_val_if_fail (in_strv != NULL, FALSE);
+	g_return_val_if_fail (in_strv[0] != NULL, FALSE);
+	g_return_val_if_fail (in_strv[1] != NULL, FALSE);
+	g_return_val_if_fail (in_strv[2] == NULL, FALSE);
+	g_return_val_if_fail (out_str1 != NULL, FALSE);
+	g_return_val_if_fail (out_str2 != NULL, FALSE);
+
+	*out_str1 = g_strdup (in_strv[0]);
+	*out_str2 = g_strdup (in_strv[1]);
+
+	return TRUE;
+}
+
+void
+e_gdbus_cal_call_open (GDBusProxy *proxy, gboolean in_only_if_exists, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_boolean ("open", e_gdbus_cal_call_open, E_GDBUS_ASYNC_OP_KEEPER (proxy), in_only_if_exists, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_call_open_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return e_gdbus_proxy_finish_call_void (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, error, e_gdbus_cal_call_open);
+}
+
+gboolean
+e_gdbus_cal_call_open_sync (GDBusProxy *proxy, gboolean in_only_if_exists, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_boolean__void (proxy, in_only_if_exists, cancellable, error,
+		e_gdbus_cal_call_open,
+		e_gdbus_cal_call_open_finish);
+}
+
+void
+e_gdbus_cal_call_authenticate_user (GDBusProxy *proxy, const gchar * const *in_credentials, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_strv ("authenticateUser", e_gdbus_cal_call_authenticate_user, E_GDBUS_ASYNC_OP_KEEPER (proxy), in_credentials, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_call_authenticate_user_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return e_gdbus_proxy_finish_call_void (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, error, e_gdbus_cal_call_authenticate_user);
+}
+
+gboolean
+e_gdbus_cal_call_authenticate_user_sync (GDBusProxy *proxy, const gchar * const *in_credentials, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_strv__void (proxy, in_credentials, cancellable, error,
+		e_gdbus_cal_call_authenticate_user,
+		e_gdbus_cal_call_authenticate_user_finish);
+}
+
+void
+e_gdbus_cal_call_remove (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_void ("remove", e_gdbus_cal_call_remove, E_GDBUS_ASYNC_OP_KEEPER (proxy), cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_call_remove_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return e_gdbus_proxy_finish_call_void (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, error, e_gdbus_cal_call_remove);
+}
+
+gboolean
+e_gdbus_cal_call_remove_sync (GDBusProxy *proxy, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_void__void (proxy, cancellable, error,
+		e_gdbus_cal_call_remove,
+		e_gdbus_cal_call_remove_finish);
+}
+
+void
+e_gdbus_cal_call_refresh (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_void ("refresh", e_gdbus_cal_call_refresh, E_GDBUS_ASYNC_OP_KEEPER (proxy), cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_call_refresh_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return e_gdbus_proxy_finish_call_void (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, error, e_gdbus_cal_call_refresh);
+}
+
+gboolean
+e_gdbus_cal_call_refresh_sync (GDBusProxy *proxy, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_void__void (proxy, cancellable, error,
+		e_gdbus_cal_call_refresh,
+		e_gdbus_cal_call_refresh_finish);
+}
+
+void
+e_gdbus_cal_call_get_cache_dir (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_void ("getCacheDir", e_gdbus_cal_call_get_cache_dir, E_GDBUS_ASYNC_OP_KEEPER (proxy), cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_call_get_cache_dir_finish (GDBusProxy *proxy, GAsyncResult *result, gchar **out_dirname, GError **error)
+{
+	return e_gdbus_proxy_finish_call_string (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, out_dirname, error, e_gdbus_cal_call_get_cache_dir);
+}
+
+gboolean
+e_gdbus_cal_call_get_cache_dir_sync (GDBusProxy *proxy, gchar **out_dirname, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_void__string (proxy, out_dirname, cancellable, error,
+		e_gdbus_cal_call_get_cache_dir,
+		e_gdbus_cal_call_get_cache_dir_finish);
+}
+
+void
+e_gdbus_cal_call_get_capabilities (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_void ("getCapabilities", e_gdbus_cal_call_get_capabilities, E_GDBUS_ASYNC_OP_KEEPER (proxy), cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_call_get_capabilities_finish (GDBusProxy *proxy, GAsyncResult *result, gchar **out_capabilities, GError **error)
+{
+	return e_gdbus_proxy_finish_call_string (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, out_capabilities, error, e_gdbus_cal_call_get_capabilities);
+}
+
+gboolean
+e_gdbus_cal_call_get_capabilities_sync (GDBusProxy *proxy, gchar **out_capabilities, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_void__string (proxy, out_capabilities, cancellable, error,
+		e_gdbus_cal_call_get_capabilities,
+		e_gdbus_cal_call_get_capabilities_finish);
+}
+
+void
+e_gdbus_cal_call_get_cal_email_address (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_void ("getCalEmailAddress", e_gdbus_cal_call_get_cal_email_address, E_GDBUS_ASYNC_OP_KEEPER (proxy), cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_call_get_cal_email_address_finish (GDBusProxy *proxy, GAsyncResult *result, gchar **out_address, GError **error)
+{
+	return e_gdbus_proxy_finish_call_string (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, out_address, error, e_gdbus_cal_call_get_cal_email_address);
+}
+
+gboolean
+e_gdbus_cal_call_get_cal_email_address_sync (GDBusProxy *proxy, gchar **out_address, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_void__string (proxy, out_address, cancellable, error,
+		e_gdbus_cal_call_get_cal_email_address,
+		e_gdbus_cal_call_get_cal_email_address_finish);
+}
+
+void
+e_gdbus_cal_call_get_alarm_email_address (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_void ("getAlarmEmailAddress", e_gdbus_cal_call_get_alarm_email_address, E_GDBUS_ASYNC_OP_KEEPER (proxy), cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_call_get_alarm_email_address_finish (GDBusProxy *proxy, GAsyncResult *result, gchar **out_address, GError **error)
+{
+	return e_gdbus_proxy_finish_call_string (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, out_address, error, e_gdbus_cal_call_get_alarm_email_address);
+}
+
+gboolean
+e_gdbus_cal_call_get_alarm_email_address_sync (GDBusProxy *proxy, gchar **out_address, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_void__string (proxy, out_address, cancellable, error,
+		e_gdbus_cal_call_get_alarm_email_address,
+		e_gdbus_cal_call_get_alarm_email_address_finish);
+}
+
+void
+e_gdbus_cal_call_get_default_object (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_void ("getDefaultObject", e_gdbus_cal_call_get_default_object, E_GDBUS_ASYNC_OP_KEEPER (proxy), cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_call_get_default_object_finish (GDBusProxy *proxy, GAsyncResult *result, gchar **out_object, GError **error)
+{
+	return e_gdbus_proxy_finish_call_string (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, out_object, error, e_gdbus_cal_call_get_default_object);
+}
+
+gboolean
+e_gdbus_cal_call_get_default_object_sync (GDBusProxy *proxy, gchar **out_object, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_void__string (proxy, out_object, cancellable, error,
+		e_gdbus_cal_call_get_default_object,
+		e_gdbus_cal_call_get_default_object_finish);
+}
+
+/* free returned pointer with g_strfreev() */
+gchar **
+e_gdbus_cal_encode_get_object (const gchar *in_uid, const gchar *in_rid)
+{
+	return encode_string_string (in_uid, in_rid);
+}
+
+/* free out_uid and out_rid with g_free() */
+gboolean
+e_gdbus_cal_decode_get_object (const gchar * const *in_strv, gchar **out_uid, gchar **out_rid)
+{
+	return decode_string_string (in_strv, out_uid, out_rid);
+}
+
+void
+e_gdbus_cal_call_get_object (GDBusProxy *proxy, const gchar * const *in_uid_rid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_strv ("getObject", e_gdbus_cal_call_get_object, E_GDBUS_ASYNC_OP_KEEPER (proxy), in_uid_rid, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_call_get_object_finish (GDBusProxy *proxy, GAsyncResult *result, gchar **out_object, GError **error)
+{
+	return e_gdbus_proxy_finish_call_string (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, out_object, error, e_gdbus_cal_call_get_object);
+}
+
+gboolean
+e_gdbus_cal_call_get_object_sync (GDBusProxy *proxy, const gchar * const *in_uid_rid, gchar **out_object, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_strv__string (proxy, in_uid_rid, out_object, cancellable, error,
+		e_gdbus_cal_call_get_object,
+		e_gdbus_cal_call_get_object_finish);
+}
+
+void
+e_gdbus_cal_call_get_object_list (GDBusProxy *proxy, const gchar *in_sexp, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_string ("getObjectList", e_gdbus_cal_call_get_object_list, E_GDBUS_ASYNC_OP_KEEPER (proxy), in_sexp, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_call_get_object_list_finish (GDBusProxy *proxy, GAsyncResult *result, gchar ***out_objects, GError **error)
+{
+	return e_gdbus_proxy_finish_call_strv (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, out_objects, error, e_gdbus_cal_call_get_object_list);
+}
+
+gboolean
+e_gdbus_cal_call_get_object_list_sync (GDBusProxy *proxy, const gchar *in_sexp, gchar ***out_objects, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_string__strv (proxy, in_sexp, out_objects, cancellable, error,
+		e_gdbus_cal_call_get_object_list,
+		e_gdbus_cal_call_get_object_list_finish);
+}
+
+/* free returned pointer with g_strfreev() */
+gchar **
+e_gdbus_cal_encode_get_free_busy (guint in_start, guint in_end, const GSList *in_users)
+{
+	gchar **strv;
+	gint ii;
+
+	g_return_val_if_fail (in_users != NULL, NULL);
+
+	strv = g_new0 (gchar *, g_slist_length ((GSList *) in_users) + 3);
+	strv[0] = g_strdup_printf ("%u", in_start);
+	strv[1] = g_strdup_printf ("%u", in_end);
+
+	for (ii = 0; in_users; ii++, in_users = in_users->next) {
+		strv[ii + 2] = e_util_utf8_make_valid (in_users->data);
+	}
+
+	strv[ii + 2] = NULL;
+
+	return strv;
+}
+
+/* free out_users with g_slist_foreach (out_users, (GFunc) g_free, NULL), g_slist_free (out_users); */
+gboolean
+e_gdbus_cal_decode_get_free_busy (const gchar * const *in_strv, guint *out_start, guint *out_end, GSList **out_users)
+{
+	gint ii;
+
+	g_return_val_if_fail (in_strv != NULL, FALSE);
+	g_return_val_if_fail (in_strv[0] != NULL, FALSE);
+	g_return_val_if_fail (in_strv[1] != NULL, FALSE);
+	g_return_val_if_fail (out_start != NULL, FALSE);
+	g_return_val_if_fail (out_end != NULL, FALSE);
+	g_return_val_if_fail (out_users != NULL, FALSE);
+
+	*out_users = NULL;
+
+	for (ii = 0; in_strv[ii + 2]; ii++) {
+		*out_users = g_slist_prepend (*out_users, g_strdup (in_strv[ii + 2]));
+	}
+
+	*out_start = atoi (in_strv[0]);
+	*out_end = atoi (in_strv[1]);
+	*out_users = g_slist_reverse (*out_users);
+
+	return TRUE;
+}
+
+void
+e_gdbus_cal_call_get_free_busy (GDBusProxy *proxy, const gchar * const *in_start_end_userlist, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_strv ("getFreeBusy", e_gdbus_cal_call_get_free_busy, E_GDBUS_ASYNC_OP_KEEPER (proxy), in_start_end_userlist, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_call_get_free_busy_finish (GDBusProxy *proxy, GAsyncResult *result, gchar ***out_freebusy, GError **error)
+{
+	return e_gdbus_proxy_finish_call_strv (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, out_freebusy, error, e_gdbus_cal_call_get_free_busy);
+}
+
+gboolean
+e_gdbus_cal_call_get_free_busy_sync (GDBusProxy *proxy, const gchar * const *in_start_end_userlist, gchar ***out_freebusy, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_strv__strv (proxy, in_start_end_userlist, out_freebusy, cancellable, error,
+		e_gdbus_cal_call_get_free_busy,
+		e_gdbus_cal_call_get_free_busy_finish);
+}
+
+void
+e_gdbus_cal_call_create_object (GDBusProxy *proxy, const gchar *in_calobj, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_string ("createObject", e_gdbus_cal_call_create_object, E_GDBUS_ASYNC_OP_KEEPER (proxy), in_calobj, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_call_create_object_finish (GDBusProxy *proxy, GAsyncResult *result, gchar **out_uid, GError **error)
+{
+	return e_gdbus_proxy_finish_call_string (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, out_uid, error, e_gdbus_cal_call_create_object);
+}
+
+gboolean
+e_gdbus_cal_call_create_object_sync (GDBusProxy *proxy, const gchar *in_calobj, gchar **out_uid, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_string__string (proxy, in_calobj, out_uid, cancellable, error,
+		e_gdbus_cal_call_create_object,
+		e_gdbus_cal_call_create_object_finish);
+}
+
+/* free returned pointer with g_strfreev() */
+gchar **
+e_gdbus_cal_encode_modify_object (const gchar *in_calobj, guint in_mod)
+{
+	gchar **strv;
+
+	g_return_val_if_fail (in_calobj != NULL, NULL);
+
+	strv = g_new0 (gchar *, 3);
+	strv[0] = e_util_utf8_make_valid (in_calobj);
+	strv[1] = g_strdup_printf ("%u", (guint32) in_mod);
+	strv[2] = NULL;
+
+	return strv;
+}
+
+/* free out_calobj with g_free() */
+gboolean
+e_gdbus_cal_decode_modify_object (const gchar * const *in_strv, gchar **out_calobj, guint *out_mod)
+{
+	g_return_val_if_fail (in_strv != NULL, FALSE);
+	g_return_val_if_fail (in_strv[0] != NULL, FALSE);
+	g_return_val_if_fail (in_strv[1] != NULL, FALSE);
+	g_return_val_if_fail (in_strv[2] == NULL, FALSE);
+	g_return_val_if_fail (out_calobj != NULL, FALSE);
+	g_return_val_if_fail (out_mod != NULL, FALSE);
+
+	*out_calobj = g_strdup (in_strv[0]);
+	*out_mod = atoi (in_strv[1]);
+
+	return TRUE;
+}
+
+void
+e_gdbus_cal_call_modify_object (GDBusProxy *proxy, const gchar * const *in_calobj_mod, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_strv ("modifyObject", e_gdbus_cal_call_modify_object, E_GDBUS_ASYNC_OP_KEEPER (proxy), in_calobj_mod, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_call_modify_object_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return e_gdbus_proxy_finish_call_void (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, error, e_gdbus_cal_call_modify_object);
+}
+
+gboolean
+e_gdbus_cal_call_modify_object_sync (GDBusProxy *proxy, const gchar * const *in_calobj_mod, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_strv__void (proxy, in_calobj_mod, cancellable, error,
+		e_gdbus_cal_call_modify_object,
+		e_gdbus_cal_call_modify_object_finish);
+}
+
+/* free returned pointer with g_strfreev() */
+gchar **
+e_gdbus_cal_encode_remove_object (const gchar *in_uid, const gchar *in_rid, guint in_mod)
+{
+	gchar **strv;
+
+	g_return_val_if_fail (in_uid != NULL, NULL);
+
+	strv = g_new0 (gchar *, 4);
+	strv[0] = e_util_utf8_make_valid (in_uid);
+	strv[1] = e_util_utf8_make_valid (in_rid ? in_rid : "");
+	strv[2] = g_strdup_printf ("%u", (guint32) in_mod);
+	strv[3] = NULL;
+
+	return strv;
+}
+
+/* free out_uid and out_rid with g_free() */
+gboolean
+e_gdbus_cal_decode_remove_object (const gchar * const *in_strv, gchar **out_uid, gchar **out_rid, guint *out_mod)
+{
+	g_return_val_if_fail (in_strv != NULL, FALSE);
+	g_return_val_if_fail (in_strv[0] != NULL, FALSE);
+	g_return_val_if_fail (in_strv[1] != NULL, FALSE);
+	g_return_val_if_fail (in_strv[2] != NULL, FALSE);
+	g_return_val_if_fail (in_strv[3] == NULL, FALSE);
+	g_return_val_if_fail (out_uid != NULL, FALSE);
+	g_return_val_if_fail (out_rid != NULL, FALSE);
+	g_return_val_if_fail (out_mod != NULL, FALSE);
+
+	*out_uid = g_strdup (in_strv[0]);
+	*out_rid = g_strdup (in_strv[1]);
+	*out_mod = atoi (in_strv[2]);
+
+	return TRUE;
+}
+
+void
+e_gdbus_cal_call_remove_object (GDBusProxy *proxy, const gchar * const *in_uid_rid_mod, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_strv ("removeObject", e_gdbus_cal_call_remove_object, E_GDBUS_ASYNC_OP_KEEPER (proxy), in_uid_rid_mod, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_call_remove_object_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return e_gdbus_proxy_finish_call_void (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, error, e_gdbus_cal_call_remove_object);
+}
+
+gboolean
+e_gdbus_cal_call_remove_object_sync (GDBusProxy *proxy, const gchar * const *in_uid_rid_mod, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_strv__void (proxy, in_uid_rid_mod, cancellable, error,
+		e_gdbus_cal_call_remove_object,
+		e_gdbus_cal_call_remove_object_finish);
+}
+
+void
+e_gdbus_cal_call_receive_objects (GDBusProxy *proxy, const gchar *in_calobj, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_string ("receiveObjects", e_gdbus_cal_call_receive_objects, E_GDBUS_ASYNC_OP_KEEPER (proxy), in_calobj, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_call_receive_objects_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return e_gdbus_proxy_finish_call_void (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, error, e_gdbus_cal_call_receive_objects);
+}
+
+gboolean
+e_gdbus_cal_call_receive_objects_sync (GDBusProxy *proxy, const gchar *in_calobj, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_string__void (proxy, in_calobj, cancellable, error,
+		e_gdbus_cal_call_receive_objects,
+		e_gdbus_cal_call_receive_objects_finish);
+}
+
+/* free returned pointer with g_strfreev() */
+gchar **
+e_gdbus_cal_encode_send_objects (const gchar *in_calobj, const GSList *in_users)
+{
+	gint ii;
+	gchar **strv;
+
+	g_return_val_if_fail (in_calobj != NULL, NULL);
+
+	strv = g_new0 (gchar *, g_slist_length ((GSList *) in_users) + 2);
+	strv[0] = e_util_utf8_make_valid (in_calobj);
+	for (ii = 0; in_users; ii++, in_users = in_users->next) {
+		strv[ii + 1] = e_util_utf8_make_valid (in_users->data);
+	}
+	strv[ii + 1] = NULL;
+
+	return strv;
+}
+
+/* free out_calobj with g_free() and out_users with g_strfreev() */
+gboolean
+e_gdbus_cal_decode_send_objects (const gchar * const *in_strv, gchar **out_calobj, GSList **out_users)
+{
+	gint ii;
+
+	g_return_val_if_fail (in_strv != NULL, FALSE);
+	g_return_val_if_fail (in_strv[0] != NULL, FALSE);
+	g_return_val_if_fail (out_calobj != NULL, FALSE);
+	g_return_val_if_fail (out_users != NULL, FALSE);
+
+	*out_users = NULL;
+
+	for (ii = 0; in_strv[ii + 1]; ii++) {
+		*out_users = g_slist_prepend (*out_users, g_strdup (in_strv[ii + 1]));
+	}
+
+	*out_calobj = g_strdup (in_strv[0]);
+	*out_users = g_slist_reverse (*out_users);
+
+	return TRUE;
+}
+
+void
+e_gdbus_cal_call_send_objects (GDBusProxy *proxy, const gchar *in_calobj, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_string ("sendObjects", e_gdbus_cal_call_send_objects, E_GDBUS_ASYNC_OP_KEEPER (proxy), in_calobj, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_call_send_objects_finish (GDBusProxy *proxy, GAsyncResult *result, gchar ***out_calobj_users, GError **error)
+{
+	return e_gdbus_proxy_finish_call_strv (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, out_calobj_users, error, e_gdbus_cal_call_send_objects);
+}
+
+gboolean
+e_gdbus_cal_call_send_objects_sync (GDBusProxy *proxy, const gchar *in_calobj, gchar ***out_calobj_users, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_string__strv (proxy, in_calobj, out_calobj_users, cancellable, error,
+		e_gdbus_cal_call_send_objects,
+		e_gdbus_cal_call_send_objects_finish);
+}
+
+/* free returned pointer with g_strfreev() */
+gchar **
+e_gdbus_cal_encode_get_attachment_uris (const gchar *in_uid, const gchar *in_rid)
+{
+	return encode_string_string (in_uid, in_rid);
+}
+
+/* free out_uid and out_rid with g_free() */
+gboolean
+e_gdbus_cal_decode_get_attachment_uris (const gchar * const *in_strv, gchar **out_uid, gchar **out_rid)
+{
+	return decode_string_string (in_strv, out_uid, out_rid);
+}
+
+void
+e_gdbus_cal_call_get_attachment_uris (GDBusProxy *proxy, const gchar * const *in_uid_rid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_strv ("getAttachmentUris", e_gdbus_cal_call_get_attachment_uris, E_GDBUS_ASYNC_OP_KEEPER (proxy), in_uid_rid, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_call_get_attachment_uris_finish (GDBusProxy *proxy, GAsyncResult *result, gchar ***out_attachments, GError **error)
+{
+	return e_gdbus_proxy_finish_call_strv (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, out_attachments, error, e_gdbus_cal_call_get_attachment_uris);
+}
+
+gboolean
+e_gdbus_cal_call_get_attachment_uris_sync (GDBusProxy *proxy, const gchar * const *in_uid_rid, gchar ***out_attachments, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_strv__strv (proxy, in_uid_rid, out_attachments, cancellable, error,
+		e_gdbus_cal_call_get_attachment_uris,
+		e_gdbus_cal_call_get_attachment_uris_finish);
+}
+
+void
+e_gdbus_cal_call_get_view (GDBusProxy *proxy, const gchar *in_sexp, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_string ("getView", e_gdbus_cal_call_get_view, E_GDBUS_ASYNC_OP_KEEPER (proxy), in_sexp, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_call_get_view_finish (GDBusProxy *proxy, GAsyncResult *result, gchar **out_view_path, GError **error)
+{
+	return e_gdbus_proxy_finish_call_string (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, out_view_path, error, e_gdbus_cal_call_get_view);
+}
+
+gboolean
+e_gdbus_cal_call_get_view_sync (GDBusProxy *proxy, const gchar *in_sexp, gchar **out_view_path, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_string__string (proxy, in_sexp, out_view_path, cancellable, error,
+		e_gdbus_cal_call_get_view,
+		e_gdbus_cal_call_get_view_finish);
+}
+
+void
+e_gdbus_cal_call_get_timezone (GDBusProxy *proxy, const gchar *in_tzid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_string ("getTimezone", e_gdbus_cal_call_get_timezone, E_GDBUS_ASYNC_OP_KEEPER (proxy), in_tzid, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_call_get_timezone_finish (GDBusProxy *proxy, GAsyncResult *result, gchar **out_tzobject, GError **error)
+{
+	return e_gdbus_proxy_finish_call_string (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, out_tzobject, error, e_gdbus_cal_call_get_timezone);
+}
+
+gboolean
+e_gdbus_cal_call_get_timezone_sync (GDBusProxy *proxy, const gchar *in_tzid, gchar **out_tzobject, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_string__string (proxy, in_tzid, out_tzobject, cancellable, error,
+		e_gdbus_cal_call_get_timezone,
+		e_gdbus_cal_call_get_timezone_finish);
+}
+
+void
+e_gdbus_cal_call_add_timezone (GDBusProxy *proxy, const gchar *in_tzobject, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_string ("addTimezone", e_gdbus_cal_call_add_timezone, E_GDBUS_ASYNC_OP_KEEPER (proxy), in_tzobject, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_call_add_timezone_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return e_gdbus_proxy_finish_call_void (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, error, e_gdbus_cal_call_add_timezone);
+}
+
+gboolean
+e_gdbus_cal_call_add_timezone_sync (GDBusProxy *proxy, const gchar *in_tzobject, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_string__void (proxy, in_tzobject, cancellable, error,
+		e_gdbus_cal_call_add_timezone,
+		e_gdbus_cal_call_add_timezone_finish);
+}
+
+void
+e_gdbus_cal_call_cancel_operation (GDBusProxy *proxy, guint in_opid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_method_call_uint ("cancelOperation", proxy, in_opid, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_call_cancel_operation_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return e_gdbus_proxy_method_call_finish_void (proxy, result, error);
+}
+
+gboolean
+e_gdbus_cal_call_cancel_operation_sync (GDBusProxy *proxy, guint in_opid, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_method_call_sync_uint__void ("cancelOperation", proxy, in_opid, cancellable, error);
+}
+
+void
+e_gdbus_cal_call_cancel_all (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_method_call_void ("cancelAll", proxy, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_call_cancel_all_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return e_gdbus_proxy_method_call_finish_void (proxy, result, error);
+}
+
+gboolean
+e_gdbus_cal_call_cancel_all_sync (GDBusProxy *proxy, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_method_call_sync_void__void ("cancelAll", proxy, cancellable, error);
+}
+
+void
+e_gdbus_cal_call_close (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_method_call_void ("close", proxy, cancellable, callback, user_data);
+}
+	
+gboolean
+e_gdbus_cal_call_close_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return e_gdbus_proxy_method_call_finish_void (proxy, result, error);
+}
+
+gboolean
+e_gdbus_cal_call_close_sync (GDBusProxy *proxy, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_method_call_sync_void__void ("close", proxy, cancellable, error);
+}
+
+#define DECLARE_EMIT_DONE_SIGNAL_0(_mname, _sig_id)									\
+void															\
+e_gdbus_cal_emit_ ## _mname ## _done (EGdbusCal *object, guint arg_opid, const GError *arg_error)			\
+{															\
+	g_signal_emit (object, signals[_sig_id], 0, arg_opid, arg_error);						\
+}
+
+#define DECLARE_EMIT_DONE_SIGNAL_1(_mname, _sig_id, _par_type)								\
+void															\
+e_gdbus_cal_emit_ ## _mname ## _done (EGdbusCal *object, guint arg_opid, const GError *arg_error, _par_type out_par)	\
+{															\
+	g_signal_emit (object, signals[_sig_id], 0, arg_opid, arg_error, out_par);					\
+}
+
+DECLARE_EMIT_DONE_SIGNAL_0 (open,			__OPEN_DONE_SIGNAL)
+DECLARE_EMIT_DONE_SIGNAL_0 (authenticate_user,		__AUTHENTICATE_USER_DONE_SIGNAL)
+DECLARE_EMIT_DONE_SIGNAL_0 (remove,			__REMOVE_DONE_SIGNAL)
+DECLARE_EMIT_DONE_SIGNAL_0 (refresh,			__REFRESH_DONE_SIGNAL)
+DECLARE_EMIT_DONE_SIGNAL_1 (get_cache_dir,		__GET_CACHE_DIR_DONE_SIGNAL, const gchar *)
+DECLARE_EMIT_DONE_SIGNAL_1 (get_capabilities,		__GET_CAPABILITIES_DONE_SIGNAL, const gchar *)
+DECLARE_EMIT_DONE_SIGNAL_1 (get_cal_email_address,	__GET_CAL_EMAIL_ADDRESS_DONE_SIGNAL, const gchar *)
+DECLARE_EMIT_DONE_SIGNAL_1 (get_alarm_email_address,	__GET_ALARM_EMAIL_ADDRESS_DONE_SIGNAL, const gchar *)
+DECLARE_EMIT_DONE_SIGNAL_1 (get_default_object,		__GET_DEFAULT_OBJECT_DONE_SIGNAL, const gchar *)
+DECLARE_EMIT_DONE_SIGNAL_1 (get_object,			__GET_OBJECT_DONE_SIGNAL, const gchar *)
+DECLARE_EMIT_DONE_SIGNAL_1 (get_object_list,		__GET_OBJECT_LIST_DONE_SIGNAL, const gchar * const *)
+DECLARE_EMIT_DONE_SIGNAL_1 (get_free_busy,		__GET_FREE_BUSY_DONE_SIGNAL, const gchar * const *)
+DECLARE_EMIT_DONE_SIGNAL_1 (create_object,		__CREATE_OBJECT_DONE_SIGNAL, const gchar *)
+DECLARE_EMIT_DONE_SIGNAL_0 (modify_object,		__MODIFY_OBJECT_DONE_SIGNAL)
+DECLARE_EMIT_DONE_SIGNAL_0 (remove_object,		__REMOVE_OBJECT_DONE_SIGNAL)
+DECLARE_EMIT_DONE_SIGNAL_0 (receive_objects,		__RECEIVE_OBJECTS_DONE_SIGNAL)
+DECLARE_EMIT_DONE_SIGNAL_1 (send_objects,		__SEND_OBJECTS_DONE_SIGNAL, const gchar * const *)
+DECLARE_EMIT_DONE_SIGNAL_1 (get_attachment_uris,	__GET_ATTACHMENT_URIS_DONE_SIGNAL, const gchar * const *)
+DECLARE_EMIT_DONE_SIGNAL_1 (get_view,			__GET_VIEW_DONE_SIGNAL, const gchar *)
+DECLARE_EMIT_DONE_SIGNAL_1 (get_timezone,		__GET_TIMEZONE_DONE_SIGNAL, const gchar *)
+DECLARE_EMIT_DONE_SIGNAL_0 (add_timezone,		__ADD_TIMEZONE_DONE_SIGNAL)
+
+void
+e_gdbus_cal_emit_backend_error (EGdbusCal *object, const gchar *arg_message)
+{
+	g_return_if_fail (object != NULL);
+	g_return_if_fail (arg_message != NULL);
+
+	g_signal_emit (object, signals[__BACKEND_ERROR_SIGNAL], 0, arg_message);
+}
+
+void
+e_gdbus_cal_emit_readonly (EGdbusCal *object, gboolean arg_is_readonly)
+{
+	g_signal_emit (object, signals[__READONLY_SIGNAL], 0, arg_is_readonly);
+}
+
+void
+e_gdbus_cal_emit_online (EGdbusCal *object, gboolean arg_is_online)
+{
+	g_signal_emit (object, signals[__ONLINE_SIGNAL], 0, arg_is_online);
+}
+
+void
+e_gdbus_cal_emit_auth_required (EGdbusCal *object, const gchar * const *arg_credentials)
+{
+	g_signal_emit (object, signals[__AUTH_REQUIRED_SIGNAL], 0, arg_credentials);
+}
+
+E_DECLARE_GDBUS_NOTIFY_SIGNAL_1 (cal, backend_error, message, "s")
+E_DECLARE_GDBUS_NOTIFY_SIGNAL_1 (cal, readonly, is_readonly, "b")
+E_DECLARE_GDBUS_NOTIFY_SIGNAL_1 (cal, online, is_online, "b")
+E_DECLARE_GDBUS_NOTIFY_SIGNAL_1 (cal, auth_required, credentials, "as")
+
+E_DECLARE_GDBUS_ASYNC_METHOD_1			(cal, open, only_if_exists, "b")
+E_DECLARE_GDBUS_ASYNC_METHOD_1			(cal, authenticateUser, credentials, "as")
+E_DECLARE_GDBUS_ASYNC_METHOD_0			(cal, remove)
+E_DECLARE_GDBUS_ASYNC_METHOD_0			(cal, refresh)
+E_DECLARE_GDBUS_ASYNC_METHOD_0_WITH_RETURN	(cal, getCacheDir, dirname, "s")
+E_DECLARE_GDBUS_ASYNC_METHOD_0_WITH_RETURN	(cal, getCapabilities, capabilities, "s")
+E_DECLARE_GDBUS_ASYNC_METHOD_0_WITH_RETURN	(cal, getCalEmailAddress, address, "s")
+E_DECLARE_GDBUS_ASYNC_METHOD_0_WITH_RETURN	(cal, getAlarmEmailAddress, address, "s")
+E_DECLARE_GDBUS_ASYNC_METHOD_0_WITH_RETURN	(cal, getDefaultObject, object, "s")
+E_DECLARE_GDBUS_ASYNC_METHOD_1_WITH_RETURN	(cal, getObject, uid_rid, "as", object, "s")
+E_DECLARE_GDBUS_ASYNC_METHOD_1_WITH_RETURN	(cal, getObjectList, sexp, "s", objects, "as")
+E_DECLARE_GDBUS_ASYNC_METHOD_1_WITH_RETURN	(cal, getFreeBusy, start_stop_users, "as", freebusy, "as")
+E_DECLARE_GDBUS_ASYNC_METHOD_1			(cal, discardAlarm, uid_auid, "as")
+E_DECLARE_GDBUS_ASYNC_METHOD_1_WITH_RETURN	(cal, createObject, object, "s", uid, "s")
+E_DECLARE_GDBUS_ASYNC_METHOD_1			(cal, modifyObject, object_mod, "as")
+E_DECLARE_GDBUS_ASYNC_METHOD_1			(cal, removeObject, uid_rid_mod, "as")
+E_DECLARE_GDBUS_ASYNC_METHOD_1			(cal, receiveObjects, object, "s")
+E_DECLARE_GDBUS_ASYNC_METHOD_1_WITH_RETURN	(cal, sendObjects, object, "s", object_users, "as")
+E_DECLARE_GDBUS_ASYNC_METHOD_1_WITH_RETURN	(cal, getAttachmentUris, uid_rid, "as", attachments, "as")
+E_DECLARE_GDBUS_ASYNC_METHOD_1_WITH_RETURN	(cal, getView, sexp, "s", view_path, "s")
+E_DECLARE_GDBUS_ASYNC_METHOD_1_WITH_RETURN	(cal, getTimezone, tzid, "s", tzobject, "s")
+E_DECLARE_GDBUS_ASYNC_METHOD_1			(cal, addTimezone, tzobject, "s")
+
+E_DECLARE_GDBUS_SYNC_METHOD_1			(cal, cancelOperation, opid, "u")
+E_DECLARE_GDBUS_SYNC_METHOD_0			(cal, cancelAll)
+E_DECLARE_GDBUS_SYNC_METHOD_0			(cal, close)
+
+static const GDBusMethodInfo * const e_gdbus_cal_method_info_pointers[] =
+{
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, open),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, authenticateUser),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, remove),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, refresh),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, getCacheDir),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, getCapabilities),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, getCalEmailAddress),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, getAlarmEmailAddress),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, getDefaultObject),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, getObject),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, getObjectList),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, getFreeBusy),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, discardAlarm),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, createObject),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, modifyObject),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, removeObject),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, receiveObjects),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, sendObjects),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, getAttachmentUris),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, getView),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, getTimezone),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, addTimezone),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, cancelOperation),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, cancelAll),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, close),
+	NULL
+};
+
+static const GDBusSignalInfo * const e_gdbus_cal_signal_info_pointers[] =
+{
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, backend_error),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, readonly),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, online),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, auth_required),
+
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, open_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, authenticateUser_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, remove_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, refresh_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, getCacheDir_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, getCapabilities_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, getCalEmailAddress_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, getAlarmEmailAddress_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, getDefaultObject_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, getObject_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, getObjectList_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, getFreeBusy_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, discardAlarm_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, createObject_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, modifyObject_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, removeObject_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, receiveObjects_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, sendObjects_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, getAttachmentUris_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, getView_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, getTimezone_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, addTimezone_done),
+	NULL
+};
+
+static const GDBusInterfaceInfo _e_gdbus_cal_interface_info =
+{
+	-1,
+	(gchar *) GDBUS_CAL_INTERFACE_NAME,
+	(GDBusMethodInfo **) &e_gdbus_cal_method_info_pointers,
+	(GDBusSignalInfo **) &e_gdbus_cal_signal_info_pointers,
+	(GDBusPropertyInfo **) NULL
+};
+
+static void
+handle_method_call (GDBusConnection       *connection,
+                    const gchar           *sender,
+                    const gchar           *object_path,
+                    const gchar           *interface_name,
+                    const gchar           *method_name,
+                    GVariant              *parameters,
+                    GDBusMethodInvocation *invocation,
+                    gpointer               user_data)
+{
+	guint method_id, method_type;
+
+	method_id = lookup_method_id_from_method_name (method_name);
+	method_type = lookup_method_type_from_method_name (method_name);
+
+	g_return_if_fail (method_id != 0);
+	g_return_if_fail (method_type != 0);
+
+	e_gdbus_stub_handle_method_call (user_data, invocation, parameters, method_name, signals[method_id], method_type);
+}
+
+static GVariant *
+get_property (GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GError **error, gpointer user_data)
+{
+	g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "This implementation does not support property `%s'", property_name);
+	return NULL;
+}
+
+static gboolean
+set_property (GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GVariant *value, GError **error, gpointer user_data)
+{
+	g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "This implementation does not support property `%s'", property_name);
+	return FALSE;
+}
+
+static const GDBusInterfaceVTable e_gdbus_cal_interface_vtable =
+{
+	handle_method_call,
+	get_property,
+	set_property
+};
+
+static gboolean
+emit_notifications_in_idle (gpointer user_data)
+{
+	GObject *object = G_OBJECT (user_data);
+	GDBusConnection *connection;
+	const gchar *path;
+	GHashTable *notification_queue;
+	GHashTableIter iter;
+	const gchar *property_name;
+	GVariant *value;
+	GVariantBuilder *builder;
+	GVariantBuilder *invalidated_builder;
+	GHashTable *pvc;
+	gboolean has_changes;
+
+	notification_queue = g_object_get_data (object, "gdbus-codegen-notification-queue");
+	path = g_object_get_data (object, "gdbus-codegen-path");
+	connection = g_object_get_data (object, "gdbus-codegen-connection");
+	pvc = g_object_get_data (object, "gdbus-codegen-pvc");
+	g_assert (notification_queue != NULL && path != NULL && connection != NULL && pvc != NULL);
+
+	builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
+	invalidated_builder = g_variant_builder_new (G_VARIANT_TYPE ("as"));
+	g_hash_table_iter_init (&iter, notification_queue);
+	has_changes = FALSE;
+	while (g_hash_table_iter_next (&iter, (gpointer) &property_name, (gpointer) &value)) {
+		GVariant *cached_value;
+		cached_value = g_hash_table_lookup (pvc, property_name);
+		if (cached_value == NULL || !g_variant_equal (cached_value, value)) {
+			g_hash_table_insert (pvc, (gpointer) property_name, (gpointer) g_variant_ref (value));
+			g_variant_builder_add (builder, "{sv}", property_name, value);
+			has_changes = TRUE;
+		}
+	}
+
+	if (has_changes) {
+		g_dbus_connection_emit_signal (connection,
+					NULL,
+					path,
+					"org.freedesktop.DBus.Properties",
+					"PropertiesChanged",
+					g_variant_new ("(sa{sv}as)",
+							GDBUS_CAL_INTERFACE_NAME,
+							builder,
+							invalidated_builder),
+					NULL);
+	} else {
+		g_variant_builder_unref (builder);
+		g_variant_builder_unref (invalidated_builder);
+	}
+
+	g_hash_table_remove_all (notification_queue);
+	g_object_set_data (object, "gdbus-codegen-notification-idle-id", GUINT_TO_POINTER (0));
+	return FALSE;
+}
+
+/**
+ * e_gdbus_cal_drain_notify:
+ * @object: A #EGdbusCal that is exported.
+ *
+ * If @object has queued notifications, empty the queue forcing
+ * the <literal>PropertiesChanged</literal> signal to be emitted.
+ * See <xref linkend="EGdbusCal.description"/> for more background information.
+ */
+void
+e_gdbus_cal_drain_notify (EGdbusCal *object)
+{
+	gint idle_id;
+	idle_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (object), "gdbus-codegen-notification-idle-id"));
+	if (idle_id > 0) {
+		emit_notifications_in_idle (object);
+		g_source_remove (idle_id);
+	}
+}
+
+static void
+on_object_unregistered (GObject *object)
+{
+	gint idle_id;
+	idle_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (object), "gdbus-codegen-notification-idle-id"));
+	if (idle_id > 0) {
+		g_source_remove (idle_id);
+	}
+	g_object_set_data (G_OBJECT (object), "gdbus-codegen-path", NULL);
+	g_object_set_data (G_OBJECT (object), "gdbus-codegen-connection", NULL);
+}
+
+/**
+ * e_gdbus_cal_register_object:
+ * @object: An instance of a #GObject<!-- -->-derived type implementing the #EGdbusCal interface.
+ * @connection: A #GDBusConnection.
+ * @object_path: The object to register the object at.
+ * @error: Return location for error or %NULL.
+ *
+ * Registers @object at @object_path on @connection.
+ *
+ * See <xref linkend="EGdbusCal.description"/>
+ * for how properties, methods and signals are handled.
+ *
+ * Returns: 0 if @error is set, otherwise a registration id (never 0) that can be used with g_dbus_connection_unregister_object().
+ */
+guint
+e_gdbus_cal_register_object (EGdbusCal *object, GDBusConnection *connection, const gchar *object_path, GError **error)
+{
+	GHashTable *pvc;
+
+	pvc = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify) g_variant_unref);
+
+	g_object_set_data_full (G_OBJECT (object), "gdbus-codegen-path", (gpointer) g_strdup (object_path), g_free);
+	g_object_set_data (G_OBJECT (object), "gdbus-codegen-connection", (gpointer) connection);
+	g_object_set_data_full (G_OBJECT (object), "gdbus-codegen-pvc", (gpointer) pvc, (GDestroyNotify) g_hash_table_unref);
+
+	return g_dbus_connection_register_object (connection,
+			object_path,
+			(GDBusInterfaceInfo *) &_e_gdbus_cal_interface_info,
+			&e_gdbus_cal_interface_vtable,
+			object,
+			(GDestroyNotify) on_object_unregistered,
+			error);
+}
+
+/**
+ * e_gdbus_cal_interface_info:
+ *
+ * Gets interface description for the <literal>org.gnome.evolution.dataserver.Calendar</literal> D-Bus interface.
+ *
+ * Returns: A #GDBusInterfaceInfo. Do not free, the object is statically allocated.
+ */
+const GDBusInterfaceInfo *
+e_gdbus_cal_interface_info (void)
+{
+	return &_e_gdbus_cal_interface_info;
+}
+
+/* ---------------------------------------------------------------------- */
+
+static void proxy_iface_init (EGdbusCalIface *iface);
+static void async_op_keeper_iface_init (EGdbusAsyncOpKeeperInterface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (EGdbusCalProxy, e_gdbus_cal_proxy, G_TYPE_DBUS_PROXY,
+                         G_IMPLEMENT_INTERFACE (E_TYPE_GDBUS_CAL, proxy_iface_init)
+			 G_IMPLEMENT_INTERFACE (E_TYPE_GDBUS_ASYNC_OP_KEEPER, async_op_keeper_iface_init));
+
+static void
+e_gdbus_cal_proxy_init (EGdbusCalProxy *proxy)
+{
+	g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), (GDBusInterfaceInfo *) &_e_gdbus_cal_interface_info);
+
+	proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, E_TYPE_GDBUS_CAL_PROXY, EGdbusCalProxyPrivate);
+	proxy->priv->pending_ops = e_gdbus_async_op_keeper_create_pending_ops (E_GDBUS_ASYNC_OP_KEEPER (proxy));
+
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_VOID   (open);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_VOID   (authenticate_user);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_VOID   (remove);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_VOID   (refresh);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRING (get_cache_dir);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRING (get_capabilities);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRING (get_cal_email_address);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRING (get_alarm_email_address);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRING (get_default_object);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRING (get_object);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRV   (get_object_list);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRV   (get_free_busy);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRING (create_object);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_VOID   (modify_object);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_VOID   (remove_object);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_VOID   (receive_objects);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRV   (send_objects);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRV   (get_attachment_uris);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRING (get_view);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRING (get_timezone);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_VOID   (add_timezone);
+}
+
+static void
+g_signal (GDBusProxy *proxy, const gchar *sender_name, const gchar *signal_name, GVariant *parameters)
+{
+	guint signal_id, signal_type;
+
+	signal_id = lookup_signal_id_from_signal_name (signal_name);
+	signal_type = lookup_signal_type_from_signal_name (signal_name);
+
+	g_return_if_fail (signal_id != 0);
+	g_return_if_fail (signal_type != 0);
+
+	e_gdbus_proxy_emit_signal (proxy, parameters, signals[signal_id], signal_type);
+}
+
+static void
+gdbus_cal_proxy_finalize (GObject *object)
+{
+	EGdbusCalProxy *proxy = E_GDBUS_CAL_PROXY (object);
+
+	g_return_if_fail (proxy != NULL);
+	g_return_if_fail (proxy->priv != NULL);
+
+	if (g_hash_table_size (proxy->priv->pending_ops))
+		g_debug ("%s: Kept %d items in pending_ops", G_STRFUNC, g_hash_table_size (proxy->priv->pending_ops));
+
+	g_hash_table_destroy (proxy->priv->pending_ops);
+
+	G_OBJECT_CLASS (e_gdbus_cal_proxy_parent_class)->finalize (object);
+}
+
+static void
+e_gdbus_cal_proxy_class_init (EGdbusCalProxyClass *klass)
+{
+	GObjectClass *object_class;
+	GDBusProxyClass *proxy_class;
+
+	g_type_class_add_private (klass, sizeof (EGdbusCalProxyPrivate));
+
+	object_class = G_OBJECT_CLASS (klass);
+	object_class->finalize = gdbus_cal_proxy_finalize;
+
+	proxy_class = G_DBUS_PROXY_CLASS (klass);
+	proxy_class->g_signal = g_signal;
+}
+
+static void
+proxy_iface_init (EGdbusCalIface *iface)
+{
+}
+
+static GHashTable *
+gdbus_cal_get_pending_ops (EGdbusAsyncOpKeeper *object)
+{
+	EGdbusCalProxy *proxy;
+
+	g_return_val_if_fail (object != NULL, NULL);
+	g_return_val_if_fail (E_IS_GDBUS_CAL_PROXY (object), NULL);
+
+	proxy = E_GDBUS_CAL_PROXY (object);
+	g_return_val_if_fail (proxy != NULL, NULL);
+	g_return_val_if_fail (proxy->priv != NULL, NULL);
+
+	return proxy->priv->pending_ops;
+}
+
+static gboolean
+gdbus_cal_call_cancel_operation_sync (EGdbusAsyncOpKeeper *object, guint in_opid, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_cal_call_cancel_operation_sync (G_DBUS_PROXY (object), in_opid, cancellable, error);
+}
+
+static void
+async_op_keeper_iface_init (EGdbusAsyncOpKeeperInterface *iface)
+{
+	g_return_if_fail (iface != NULL);
+
+	iface->get_pending_ops = gdbus_cal_get_pending_ops;
+	iface->cancel_op_sync = gdbus_cal_call_cancel_operation_sync;
+}
+
+/**
+ * e_gdbus_cal_proxy_new:
+ * @connection: A #GDBusConnection.
+ * @flags: Flags used when constructing the proxy.
+ * @name: A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
+ * @object_path: An object path.
+ * @cancellable: A #GCancellable or %NULL.
+ * @callback: Callback function to invoke when the proxy is ready.
+ * @user_data: User data to pass to @callback.
+ *
+ * Like g_dbus_proxy_new() but returns a #EGdbusCalProxy.
+ *
+ * This is a failable asynchronous constructor - when the proxy is ready, callback will be invoked and you can use e_gdbus_cal_proxy_new_finish() to get the result.
+ */
+void
+e_gdbus_cal_proxy_new (GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	g_async_initable_new_async (E_TYPE_GDBUS_CAL_PROXY,
+				G_PRIORITY_DEFAULT,
+				cancellable,
+				callback,
+				user_data,
+				"g-flags", flags,
+				"g-name", name,
+				"g-connection", connection,
+				"g-object-path", object_path,
+				"g-interface-name", GDBUS_CAL_INTERFACE_NAME,
+				NULL);
+}
+
+/**
+ * e_gdbus_cal_proxy_new_finish:
+ * @result: A #GAsyncResult obtained from the #GAsyncReadyCallback function passed to e_gdbus_cal_proxy_new().
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes creating a #EGdbusCalProxy.
+ *
+ * Returns: A #EGdbusCalProxy or %NULL if @error is set. Free with g_object_unref().
+ */
+EGdbusCal *
+e_gdbus_cal_proxy_new_finish (GAsyncResult  *result, GError **error)
+{
+	GObject *object;
+	GObject *source_object;
+	source_object = g_async_result_get_source_object (result);
+	g_assert (source_object != NULL);
+	object = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), result, error);
+	g_object_unref (source_object);
+	if (object != NULL)
+		return E_GDBUS_CAL (object);
+	else
+		return NULL;
+}
+
+/**
+ * e_gdbus_cal_proxy_new_sync:
+ * @connection: A #GDBusConnection.
+ * @flags: Flags used when constructing the proxy.
+ * @name: A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
+ * @object_path: An object path.
+ * @cancellable: A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Like g_dbus_proxy_new_sync() but returns a #EGdbusCalProxy.
+ *
+ * This is a synchronous failable constructor. See e_gdbus_cal_proxy_new() and e_gdbus_cal_proxy_new_finish() for the asynchronous version.
+ *
+ * Returns: A #EGdbusCalProxy or %NULL if error is set. Free with g_object_unref().
+ */
+EGdbusCal *
+e_gdbus_cal_proxy_new_sync (GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error)
+{
+	GInitable *initable;
+	initable = g_initable_new (E_TYPE_GDBUS_CAL_PROXY,
+				cancellable,
+				error,
+				"g-flags", flags,
+				"g-name", name,
+				"g-connection", connection,
+				"g-object-path", object_path,
+				"g-interface-name", GDBUS_CAL_INTERFACE_NAME,
+				NULL);
+	if (initable != NULL)
+		return E_GDBUS_CAL (initable);
+	else
+		return NULL;
+}
+
+/**
+ * e_gdbus_cal_proxy_new_for_bus:
+ * @bus_type: A #GBusType.
+ * @flags: Flags used when constructing the proxy.
+ * @name: A bus name (well-known or unique).
+ * @object_path: An object path.
+ * @cancellable: A #GCancellable or %NULL.
+ * @callback: Callback function to invoke when the proxy is ready.
+ * @user_data: User data to pass to @callback.
+ *
+ * Like g_dbus_proxy_new_for_bus() but returns a #EGdbusCalProxy.
+ *
+ * This is a failable asynchronous constructor - when the proxy is ready, callback will be invoked and you can use e_gdbus_cal_proxy_new_for_bus_finish() to get the result.
+ */
+void
+e_gdbus_cal_proxy_new_for_bus (GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	g_async_initable_new_async (E_TYPE_GDBUS_CAL_PROXY,
+				G_PRIORITY_DEFAULT,
+				cancellable,
+				callback,
+				user_data,
+				"g-flags", flags,
+				"g-name", name,
+				"g-bus-type", bus_type,
+				"g-object-path", object_path,
+				"g-interface-name", GDBUS_CAL_INTERFACE_NAME,
+				NULL);
+}
+
+/**
+ * e_gdbus_cal_proxy_new_for_bus_finish:
+ * @result: A #GAsyncResult obtained from the #GAsyncReadyCallback function passed to e_gdbus_cal_proxy_new_for_bus().
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes creating a #EGdbusCalProxy.
+ *
+ * Returns: A #EGdbusCalProxy or %NULL if @error is set. Free with g_object_unref().
+ */
+EGdbusCal *
+e_gdbus_cal_proxy_new_for_bus_finish (GAsyncResult *result, GError **error)
+{
+	GObject *object;
+	GObject *source_object;
+	source_object = g_async_result_get_source_object (result);
+	g_assert (source_object != NULL);
+	object = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), result, error);
+	g_object_unref (source_object);
+	if (object != NULL)
+		return E_GDBUS_CAL (object);
+	else
+		return NULL;
+}
+
+/**
+ * e_gdbus_cal_proxy_new_for_bus_sync:
+ * @bus_type: A #GBusType.
+ * @flags: Flags used when constructing the proxy.
+ * @name: A bus name (well-known or unique).
+ * @object_path: An object path.
+ * @cancellable: A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Like g_dbus_proxy_new_for_bus_sync() but returns a #EGdbusCalProxy.
+ *
+ * This is a synchronous failable constructor. See e_gdbus_cal_proxy_new_for_bus() and e_gdbus_cal_proxy_new_for_bus_finish() for the asynchronous version.
+ *
+ * Returns: A #EGdbusCalProxy or %NULL if error is set. Free with g_object_unref().
+ */
+EGdbusCal *
+e_gdbus_cal_proxy_new_for_bus_sync (GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error)
+{
+	GInitable *initable;
+	initable = g_initable_new (E_TYPE_GDBUS_CAL_PROXY,
+				cancellable,
+				error,
+				"g-flags", flags,
+				"g-name", name,
+				"g-bus-type", bus_type,
+				"g-object-path", object_path,
+				"g-interface-name", GDBUS_CAL_INTERFACE_NAME,
+				NULL);
+	if (initable != NULL)
+		return E_GDBUS_CAL (initable);
+	else
+		return NULL;
+}
+
+/* ---------------------------------------------------------------------- */
+
+struct _EGdbusCalStubPrivate
+{
+	gint foo;
+};
+
+static void stub_iface_init (EGdbusCalIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (EGdbusCalStub, e_gdbus_cal_stub, G_TYPE_OBJECT,
+                         G_IMPLEMENT_INTERFACE (E_TYPE_GDBUS_CAL, stub_iface_init));
+
+static void
+e_gdbus_cal_stub_init (EGdbusCalStub *stub)
+{
+	stub->priv = G_TYPE_INSTANCE_GET_PRIVATE (stub, E_TYPE_GDBUS_CAL_STUB, EGdbusCalStubPrivate);
+}
+
+static void
+e_gdbus_cal_stub_class_init (EGdbusCalStubClass *klass)
+{
+	g_type_class_add_private (klass, sizeof (EGdbusCalStubPrivate));
+}
+
+static void
+stub_iface_init (EGdbusCalIface *iface)
+{
+}
+
+/**
+ * e_gdbus_cal_stub_new:
+ *
+ * Creates a new stub object that can be exported via e_gdbus_cal_register_object().
+ *
+ * Returns: A #EGdbusCalStub instance. Free with g_object_unref().
+ */
+EGdbusCal *
+e_gdbus_cal_stub_new (void)
+{
+	return E_GDBUS_CAL (g_object_new (E_TYPE_GDBUS_CAL_STUB, NULL));
+}
+
+/* Returns GDBus connection associated with the stub object */
+GDBusConnection *
+e_gdbus_cal_stub_get_connection (EGdbusCal *stub)
+{
+	g_return_val_if_fail (stub != NULL, NULL);
+	g_return_val_if_fail (E_IS_GDBUS_CAL_STUB (stub), NULL);
+
+	return g_object_get_data (G_OBJECT (stub), "gdbus-codegen-connection");
+}
diff --git a/calendar/libegdbus/e-gdbus-cal.h b/calendar/libegdbus/e-gdbus-cal.h
new file mode 100644
index 0000000..3292702
--- /dev/null
+++ b/calendar/libegdbus/e-gdbus-cal.h
@@ -0,0 +1,347 @@
+/*
+ * e-gdbus-cal.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#ifndef E_GDBUS_CAL_H
+#define E_GDBUS_CAL_H
+
+#include <gio/gio.h>
+
+#include <libedataserver/e-gdbus-templates.h>
+
+G_BEGIN_DECLS
+
+#define E_TYPE_GDBUS_CAL	(e_gdbus_cal_get_type ())
+#define E_GDBUS_CAL(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_GDBUS_CAL, EGdbusCal))
+#define E_IS_GDBUS_CAL(o)	(G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_GDBUS_CAL))
+#define E_GDBUS_CAL_GET_IFACE(o)(G_TYPE_INSTANCE_GET_INTERFACE((o), E_TYPE_GDBUS_CAL, EGdbusCalIface))
+
+typedef struct _EGdbusCal EGdbusCal; /* Dummy typedef */
+typedef struct _EGdbusCalIface EGdbusCalIface;
+
+GType e_gdbus_cal_get_type (void) G_GNUC_CONST;
+
+/* ---------------------------------------------------------------------- */
+
+typedef struct _EGdbusCalProxy EGdbusCalProxy;
+typedef struct _EGdbusCalProxyClass EGdbusCalProxyClass;
+typedef struct _EGdbusCalProxyPrivate EGdbusCalProxyPrivate;
+
+struct _EGdbusCalProxy
+{
+	GDBusProxy parent_instance;
+	EGdbusCalProxyPrivate *priv;
+};
+
+struct _EGdbusCalProxyClass
+{
+	GDBusProxyClass parent_class;
+};
+
+#define E_TYPE_GDBUS_CAL_PROXY	(e_gdbus_cal_proxy_get_type ())
+#define E_GDBUS_CAL_PROXY(o)	(G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_GDBUS_CAL_PROXY, EGdbusCalProxy))
+#define E_IS_GDBUS_CAL_PROXY(o)	(G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_GDBUS_CAL_PROXY))
+GType e_gdbus_cal_proxy_get_type (void) G_GNUC_CONST;
+
+void		e_gdbus_cal_proxy_new		(GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+EGdbusCal *	e_gdbus_cal_proxy_new_finish	(GAsyncResult  *result, GError **error);
+EGdbusCal *	e_gdbus_cal_proxy_new_sync	(GDBusConnection *connection, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_cal_proxy_new_for_bus		(GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+EGdbusCal *	e_gdbus_cal_proxy_new_for_bus_finish	(GAsyncResult *result, GError **error);
+EGdbusCal *	e_gdbus_cal_proxy_new_for_bus_sync	(GBusType bus_type, GDBusProxyFlags flags, const gchar *name, const gchar *object_path, GCancellable *cancellable, GError **error);
+
+/* ---------------------------------------------------------------------- */
+
+typedef struct _EGdbusCalStub EGdbusCalStub;
+typedef struct _EGdbusCalStubClass EGdbusCalStubClass;
+typedef struct _EGdbusCalStubPrivate EGdbusCalStubPrivate;
+
+struct _EGdbusCalStub
+{
+	GObject parent_instance;
+	EGdbusCalStubPrivate *priv;
+};
+
+struct _EGdbusCalStubClass
+{
+	GObjectClass parent_class;
+};
+
+#define E_TYPE_GDBUS_CAL_STUB	(e_gdbus_cal_stub_get_type ())
+#define E_GDBUS_CAL_STUB(o)	(G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_GDBUS_CAL_STUB, EGdbusCalStub))
+#define E_IS_GDBUS_CAL_STUB(o)	(G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_GDBUS_CAL_STUB))
+GType e_gdbus_cal_stub_get_type (void) G_GNUC_CONST;
+
+EGdbusCal *e_gdbus_cal_stub_new (void);
+GDBusConnection *e_gdbus_cal_stub_get_connection (EGdbusCal *stub);
+
+guint e_gdbus_cal_register_object (EGdbusCal *object, GDBusConnection *connection, const gchar *object_path, GError **error);
+void e_gdbus_cal_drain_notify (EGdbusCal *object);
+
+const GDBusInterfaceInfo *e_gdbus_cal_interface_info (void) G_GNUC_CONST;
+
+struct _EGdbusCalIface
+{
+	GTypeInterface parent_iface;
+
+	/* Signal handlers for receiving D-Bus signals: */
+	void	(*backend_error)			(EGdbusCal *object, const gchar *arg_message);
+	void	(*readonly)				(EGdbusCal *object, gboolean arg_is_readonly);
+	void	(*online)				(EGdbusCal *object, gboolean arg_is_online);
+	void	(*auth_required)			(EGdbusCal *object, const gchar * const *arg_credentials);
+
+	/* Signal handlers for handling D-Bus method calls: */
+	gboolean (*handle_open)				(EGdbusCal *object, GDBusMethodInvocation *invocation, gboolean in_only_if_exists);
+	void	 (*open_done)				(EGdbusCal *object, guint arg_opid, const GError *arg_error);
+
+	gboolean (*handle_authenticate_user)		(EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar * const *in_credentials);
+	void	 (*authenticate_user_done)		(EGdbusCal *object, guint arg_opid, const GError *arg_error);
+
+	gboolean (*handle_remove)			(EGdbusCal *object, GDBusMethodInvocation *invocation);
+	void	 (*remove_done)				(EGdbusCal *object, guint arg_opid, const GError *arg_error);
+
+	gboolean (*handle_refresh)			(EGdbusCal *object, GDBusMethodInvocation *invocation);
+	void	 (*refresh_done)			(EGdbusCal *object, guint arg_opid, const GError *arg_error);
+
+	gboolean (*handle_get_cache_dir)		(EGdbusCal *object, GDBusMethodInvocation *invocation);
+	void	 (*get_cache_dir_done)			(EGdbusCal *object, guint arg_opid, const GError *arg_error, gchar **out_dirname);
+
+	gboolean (*handle_get_capabilities)		(EGdbusCal *object, GDBusMethodInvocation *invocation);
+	void	 (*get_capabilities_done)		(EGdbusCal *object, guint arg_opid, const GError *arg_error, gchar **out_capabilities);
+
+	gboolean (*handle_get_cal_email_address)	(EGdbusCal *object, GDBusMethodInvocation *invocation);
+	void	 (*get_cal_email_address_done)		(EGdbusCal *object, guint arg_opid, const GError *arg_error, gchar **out_cal_address);
+
+	gboolean (*handle_get_alarm_email_address)	(EGdbusCal *object, GDBusMethodInvocation *invocation);
+	void	 (*get_alarm_email_address_done)	(EGdbusCal *object, guint arg_opid, const GError *arg_error, gchar **out_alarm_email_address);
+
+	gboolean (*handle_get_default_object)		(EGdbusCal *object, GDBusMethodInvocation *invocation);
+	void	 (*get_default_object_done)		(EGdbusCal *object, guint arg_opid, const GError *arg_error, gchar **out_default_object);
+
+	gboolean (*handle_get_object)			(EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar * const *in_uid_rid);
+	void	 (*get_object_done)			(EGdbusCal *object, guint arg_opid, const GError *arg_error, gchar **out_object);
+
+	gboolean (*handle_get_object_list)		(EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *in_sexp);
+	void	 (*get_object_list_done)		(EGdbusCal *object, guint arg_opid, const GError *arg_error, gchar ***out_objects);
+
+	gboolean (*handle_get_free_busy)		(EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar * const *in_start_end_userlist);
+	void	 (*get_free_busy_done)			(EGdbusCal *object, guint arg_opid, const GError *arg_error, gchar ***out_freebusy);
+
+	gboolean (*handle_create_object)		(EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *in_calobj);
+	void	 (*create_object_done)			(EGdbusCal *object, guint arg_opid, const GError *arg_error, gchar **out_uid);
+
+	gboolean (*handle_modify_object)		(EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar * const *in_calobj_mod);
+	void	 (*modify_object_done)			(EGdbusCal *object, guint arg_opid, const GError *arg_error);
+
+	gboolean (*handle_remove_object)		(EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar * const *in_uid_rid_mod);
+	void	 (*remove_object_done)			(EGdbusCal *object, guint arg_opid, const GError *arg_error);
+
+	gboolean (*handle_receive_objects)		(EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *in_calobj);
+	void	 (*receive_objects_done)		(EGdbusCal *object, guint arg_opid, const GError *arg_error);
+
+	gboolean (*handle_send_objects)			(EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *in_calobj);
+	void	 (*send_objects_done)			(EGdbusCal *object, guint arg_opid, const GError *arg_error, gchar ***out_calobj_users);
+
+	gboolean (*handle_get_attachment_uris)		(EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar * const *in_uid_rid);
+	void	 (*get_attachment_uris_done)		(EGdbusCal *object, guint arg_opid, const GError *arg_error, gchar ***out_attachments);
+
+	gboolean (*handle_get_view)			(EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *in_sexp);
+	void	 (*get_view_done)			(EGdbusCal *object, guint arg_opid, const GError *arg_error, gchar **out_view_path);
+
+	gboolean (*handle_get_timezone)			(EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *in_tzid);
+	void	 (*get_timezone_done)			(EGdbusCal *object, guint arg_opid, const GError *arg_error, gchar **out_tzobject);
+
+	gboolean (*handle_add_timezone)			(EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *in_tzobject);
+	void	 (*add_timezone_done)			(EGdbusCal *object, guint arg_opid, const GError *arg_error);
+
+	gboolean (*handle_cancel_operation)		(EGdbusCal *object, GDBusMethodInvocation *invocation, guint in_opid);
+	gboolean (*handle_cancel_all)			(EGdbusCal *object, GDBusMethodInvocation *invocation);
+	gboolean (*handle_close)			(EGdbusCal *object, GDBusMethodInvocation *invocation);
+};
+
+/* D-Bus Methods */
+void		e_gdbus_cal_call_open				(GDBusProxy *proxy, gboolean in_only_if_exists, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_call_open_finish			(GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean	e_gdbus_cal_call_open_sync			(GDBusProxy *proxy, gboolean in_only_if_exists, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_cal_call_authenticate_user		(GDBusProxy *proxy, const gchar * const *in_credentials, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_call_authenticate_user_finish	(GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean	e_gdbus_cal_call_authenticate_user_sync		(GDBusProxy *proxy, const gchar * const *in_credentials, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_cal_call_remove				(GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_call_remove_finish			(GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean	e_gdbus_cal_call_remove_sync			(GDBusProxy *proxy, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_cal_call_refresh			(GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_call_refresh_finish			(GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean	e_gdbus_cal_call_refresh_sync			(GDBusProxy *proxy, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_cal_call_get_cache_dir			(GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_call_get_cache_dir_finish		(GDBusProxy *proxy, GAsyncResult *result, gchar **out_dirname, GError **error);
+gboolean	e_gdbus_cal_call_get_cache_dir_sync		(GDBusProxy *proxy, gchar **out_dirname, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_cal_call_get_capabilities		(GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_call_get_capabilities_finish	(GDBusProxy *proxy, GAsyncResult *result, gchar **out_capabilities, GError **error);
+gboolean	e_gdbus_cal_call_get_capabilities_sync		(GDBusProxy *proxy, gchar **out_capabilities, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_cal_call_get_cal_email_address		(GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_call_get_cal_email_address_finish	(GDBusProxy *proxy, GAsyncResult *result, gchar **out_address, GError **error);
+gboolean	e_gdbus_cal_call_get_cal_email_address_sync	(GDBusProxy *proxy, gchar **out_address, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_cal_call_get_alarm_email_address	(GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_call_get_alarm_email_address_finish	(GDBusProxy *proxy, GAsyncResult *result, gchar **out_address, GError **error);
+gboolean	e_gdbus_cal_call_get_alarm_email_address_sync	(GDBusProxy *proxy, gchar **out_address, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_cal_call_get_default_object		(GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_call_get_default_object_finish	(GDBusProxy *proxy, GAsyncResult *result, gchar **out_object, GError **error);
+gboolean	e_gdbus_cal_call_get_default_object_sync	(GDBusProxy *proxy, gchar **out_object, GCancellable *cancellable, GError **error);
+
+gchar **	e_gdbus_cal_encode_get_object			(const gchar *in_uid, const gchar *in_rid);
+gboolean	e_gdbus_cal_decode_get_object			(const gchar * const *in_strv, gchar **out_uid, gchar **out_rid);
+void		e_gdbus_cal_call_get_object			(GDBusProxy *proxy, const gchar * const *in_uid_rid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_call_get_object_finish		(GDBusProxy *proxy, GAsyncResult *result, gchar **out_object, GError **error);
+gboolean	e_gdbus_cal_call_get_object_sync		(GDBusProxy *proxy, const gchar * const *in_uid_rid, gchar **out_object, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_cal_call_get_object_list		(GDBusProxy *proxy, const gchar *in_sexp, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_call_get_object_list_finish		(GDBusProxy *proxy, GAsyncResult *result, gchar ***out_objects, GError **error);
+gboolean	e_gdbus_cal_call_get_object_list_sync		(GDBusProxy *proxy, const gchar *in_sexp, gchar ***out_objects, GCancellable *cancellable, GError **error);
+
+gchar **	e_gdbus_cal_encode_get_free_busy		(guint in_start, guint in_end, const GSList *in_users);
+gboolean	e_gdbus_cal_decode_get_free_busy		(const gchar * const *in_strv, guint *out_start, guint *out_end, GSList **out_users);
+void		e_gdbus_cal_call_get_free_busy			(GDBusProxy *proxy, const gchar * const *in_start_end_userlist, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_call_get_free_busy_finish		(GDBusProxy *proxy, GAsyncResult *result, gchar ***out_freebusy, GError **error);
+gboolean	e_gdbus_cal_call_get_free_busy_sync		(GDBusProxy *proxy, const gchar * const *in_start_end_userlist, gchar ***out_freebusy, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_cal_call_create_object			(GDBusProxy *proxy, const gchar *in_calobj, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_call_create_object_finish		(GDBusProxy *proxy, GAsyncResult *result, gchar **out_uid, GError **error);
+gboolean	e_gdbus_cal_call_create_object_sync		(GDBusProxy *proxy, const gchar *in_calobj, gchar **out_uid, GCancellable *cancellable, GError **error);
+
+gchar **	e_gdbus_cal_encode_modify_object		(const gchar *in_calobj, guint in_mod);
+gboolean	e_gdbus_cal_decode_modify_object		(const gchar * const *in_strv, gchar **out_calobj, guint *out_mod);
+void		e_gdbus_cal_call_modify_object			(GDBusProxy *proxy, const gchar * const *in_calobj_mod, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_call_modify_object_finish		(GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean	e_gdbus_cal_call_modify_object_sync		(GDBusProxy *proxy, const gchar * const *in_calobj_mod, GCancellable *cancellable, GError **error);
+
+gchar **	e_gdbus_cal_encode_remove_object		(const gchar *in_uid, const gchar *in_rid, guint in_mod);
+gboolean	e_gdbus_cal_decode_remove_object		(const gchar * const *in_strv, gchar **out_uid, gchar **out_rid, guint *out_mod);
+void		e_gdbus_cal_call_remove_object			(GDBusProxy *proxy, const gchar * const *in_uid_rid_mod, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_call_remove_object_finish		(GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean	e_gdbus_cal_call_remove_object_sync		(GDBusProxy *proxy, const gchar * const *in_uid_rid_mod, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_cal_call_receive_objects		(GDBusProxy *proxy, const gchar *in_calobj, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_call_receive_objects_finish		(GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean	e_gdbus_cal_call_receive_objects_sync		(GDBusProxy *proxy, const gchar *in_calobj, GCancellable *cancellable, GError **error);
+
+gchar **	e_gdbus_cal_encode_send_objects			(const gchar *in_calobj, const GSList *in_users);
+gboolean	e_gdbus_cal_decode_send_objects			(const gchar * const *in_strv, gchar **out_calobj, GSList **out_users);
+void		e_gdbus_cal_call_send_objects			(GDBusProxy *proxy, const gchar *in_calobj, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_call_send_objects_finish		(GDBusProxy *proxy, GAsyncResult *result, gchar ***out_calobj_users, GError **error);
+gboolean	e_gdbus_cal_call_send_objects_sync		(GDBusProxy *proxy, const gchar *in_calobj, gchar ***out_calobj_users, GCancellable *cancellable, GError **error);
+
+gchar **	e_gdbus_cal_encode_get_attachment_uris		(const gchar *in_uid, const gchar *in_rid);
+gboolean	e_gdbus_cal_decode_get_attachment_uris		(const gchar * const *in_strv, gchar **out_uid, gchar **out_rid);
+void		e_gdbus_cal_call_get_attachment_uris		(GDBusProxy *proxy, const gchar * const *in_uid_rid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_call_get_attachment_uris_finish	(GDBusProxy *proxy, GAsyncResult *result, gchar ***out_attachments, GError **error);
+gboolean	e_gdbus_cal_call_get_attachment_uris_sync	(GDBusProxy *proxy, const gchar * const *in_uid_rid, gchar ***out_attachments, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_cal_call_get_view			(GDBusProxy *proxy, const gchar *in_sexp, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_call_get_view_finish		(GDBusProxy *proxy, GAsyncResult *result, gchar **out_view_path, GError **error);
+gboolean	e_gdbus_cal_call_get_view_sync			(GDBusProxy *proxy, const gchar *in_sexp, gchar **out_view_path, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_cal_call_get_timezone			(GDBusProxy *proxy, const gchar *in_tzid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_call_get_timezone_finish		(GDBusProxy *proxy, GAsyncResult *result, gchar **out_tzobject, GError **error);
+gboolean	e_gdbus_cal_call_get_timezone_sync		(GDBusProxy *proxy, const gchar *in_tzid, gchar **out_tzobject, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_cal_call_add_timezone			(GDBusProxy *proxy, const gchar *in_tzobject, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_call_add_timezone_finish		(GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean	e_gdbus_cal_call_add_timezone_sync		(GDBusProxy *proxy, const gchar *in_tzobject, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_cal_call_cancel_operation		(GDBusProxy *proxy, guint in_opid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_call_cancel_operation_finish	(GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean	e_gdbus_cal_call_cancel_operation_sync		(GDBusProxy *proxy, guint in_opid, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_cal_call_cancel_all			(GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_call_cancel_all_finish		(GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean	e_gdbus_cal_call_cancel_all_sync		(GDBusProxy *proxy, GCancellable *cancellable, GError **error);
+
+void		e_gdbus_cal_call_close				(GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_call_close_finish			(GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean	e_gdbus_cal_call_close_sync			(GDBusProxy *proxy, GCancellable *cancellable, GError **error);
+
+/* D-Bus Methods Completion Helpers */
+#define e_gdbus_cal_complete_open			e_gdbus_complete_async_method
+#define e_gdbus_cal_complete_authenticate_user		e_gdbus_complete_async_method
+#define e_gdbus_cal_complete_remove			e_gdbus_complete_async_method
+#define e_gdbus_cal_complete_refresh			e_gdbus_complete_async_method
+#define e_gdbus_cal_complete_get_cache_dir		e_gdbus_complete_async_method
+#define e_gdbus_cal_complete_get_capabilities		e_gdbus_complete_async_method
+#define e_gdbus_cal_complete_get_cal_email_address	e_gdbus_complete_async_method
+#define e_gdbus_cal_complete_get_alarm_email_address	e_gdbus_complete_async_method
+#define e_gdbus_cal_complete_get_default_object		e_gdbus_complete_async_method
+#define e_gdbus_cal_complete_get_object			e_gdbus_complete_async_method
+#define e_gdbus_cal_complete_get_object_list		e_gdbus_complete_async_method
+#define e_gdbus_cal_complete_get_free_busy		e_gdbus_complete_async_method
+#define e_gdbus_cal_complete_discard_alarm		e_gdbus_complete_async_method
+#define e_gdbus_cal_complete_create_object		e_gdbus_complete_async_method
+#define e_gdbus_cal_complete_modify_object		e_gdbus_complete_async_method
+#define e_gdbus_cal_complete_remove_object		e_gdbus_complete_async_method
+#define e_gdbus_cal_complete_receive_objects		e_gdbus_complete_async_method
+#define e_gdbus_cal_complete_send_objects		e_gdbus_complete_async_method
+#define e_gdbus_cal_complete_get_attachment_uris	e_gdbus_complete_async_method
+#define e_gdbus_cal_complete_get_view			e_gdbus_complete_async_method
+#define e_gdbus_cal_complete_get_timezone		e_gdbus_complete_async_method
+#define e_gdbus_cal_complete_add_timezone		e_gdbus_complete_async_method
+#define e_gdbus_cal_complete_cancel_operation		e_gdbus_complete_sync_method_void
+#define e_gdbus_cal_complete_cancel_all			e_gdbus_complete_sync_method_void
+#define e_gdbus_cal_complete_close			e_gdbus_complete_sync_method_void
+
+void e_gdbus_cal_emit_open_done				(EGdbusCal *object, guint arg_opid, const GError *arg_error);
+void e_gdbus_cal_emit_authenticate_user_done		(EGdbusCal *object, guint arg_opid, const GError *arg_error);
+void e_gdbus_cal_emit_remove_done			(EGdbusCal *object, guint arg_opid, const GError *arg_error);
+void e_gdbus_cal_emit_refresh_done			(EGdbusCal *object, guint arg_opid, const GError *arg_error);
+void e_gdbus_cal_emit_get_cache_dir_done		(EGdbusCal *object, guint arg_opid, const GError *arg_error, const gchar *out_dirname);
+void e_gdbus_cal_emit_get_capabilities_done		(EGdbusCal *object, guint arg_opid, const GError *arg_error, const gchar *out_capabilities);
+void e_gdbus_cal_emit_get_cal_email_address_done	(EGdbusCal *object, guint arg_opid, const GError *arg_error, const gchar *out_address);
+void e_gdbus_cal_emit_get_alarm_email_address_done	(EGdbusCal *object, guint arg_opid, const GError *arg_error, const gchar *out_address);
+void e_gdbus_cal_emit_get_default_object_done		(EGdbusCal *object, guint arg_opid, const GError *arg_error, const gchar *out_object);
+void e_gdbus_cal_emit_get_object_done			(EGdbusCal *object, guint arg_opid, const GError *arg_error, const gchar *out_object);
+void e_gdbus_cal_emit_get_object_list_done		(EGdbusCal *object, guint arg_opid, const GError *arg_error, const gchar * const *out_objects);
+void e_gdbus_cal_emit_get_free_busy_done		(EGdbusCal *object, guint arg_opid, const GError *arg_error, const gchar * const *out_freebusy);
+void e_gdbus_cal_emit_discard_alarm_done		(EGdbusCal *object, guint arg_opid, const GError *arg_error);
+void e_gdbus_cal_emit_create_object_done		(EGdbusCal *object, guint arg_opid, const GError *arg_error, const gchar *out_uid);
+void e_gdbus_cal_emit_modify_object_done		(EGdbusCal *object, guint arg_opid, const GError *arg_error);
+void e_gdbus_cal_emit_remove_object_done		(EGdbusCal *object, guint arg_opid, const GError *arg_error);
+void e_gdbus_cal_emit_receive_objects_done		(EGdbusCal *object, guint arg_opid, const GError *arg_error);
+void e_gdbus_cal_emit_send_objects_done			(EGdbusCal *object, guint arg_opid, const GError *arg_error, const gchar * const *out_calobj_users);
+void e_gdbus_cal_emit_get_attachment_uris_done		(EGdbusCal *object, guint arg_opid, const GError *arg_error, const gchar * const *out_attachments);
+void e_gdbus_cal_emit_get_view_done			(EGdbusCal *object, guint arg_opid, const GError *arg_error, const gchar *out_view_path);
+void e_gdbus_cal_emit_get_timezone_done			(EGdbusCal *object, guint arg_opid, const GError *arg_error, const gchar *out_object);
+void e_gdbus_cal_emit_add_timezone_done			(EGdbusCal *object, guint arg_opid, const GError *arg_error);
+
+/* D-Bus Signal Emission Helpers */
+void e_gdbus_cal_emit_backend_error	(EGdbusCal *object, const gchar *arg_message);
+void e_gdbus_cal_emit_readonly		(EGdbusCal *object, gboolean arg_is_readonly);
+void e_gdbus_cal_emit_online		(EGdbusCal *object, gint arg_is_online);
+void e_gdbus_cal_emit_auth_required	(EGdbusCal *object, const gchar * const *arg_credentials);
+
+G_END_DECLS
+
+#endif /* E_GDBUS_CAL_H */
diff --git a/configure.ac b/configure.ac
index 9c1bee8..53a2623 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,8 +55,8 @@ EDS_MICRO_VERSION=eds_micro_version
 dnl ******************************
 dnl D-Bus versioning
 dnl ******************************
-ADDRESS_BOOK_DBUS_SERVICE_NAME="org.gnome.evolution.dataserver.AddressBook0"
-CALENDAR_DBUS_SERVICE_NAME="org.gnome.evolution.dataserver.Calendar0"
+ADDRESS_BOOK_DBUS_SERVICE_NAME="org.gnome.evolution.dataserver.AddressBook1"
+CALENDAR_DBUS_SERVICE_NAME="org.gnome.evolution.dataserver.Calendar1"
 
 AC_DEFINE_UNQUOTED(
        ADDRESS_BOOK_DBUS_SERVICE_NAME,
@@ -82,19 +82,19 @@ LIBEDATASERVERUI_CURRENT=0
 LIBEDATASERVERUI_REVISION=0
 LIBEDATASERVERUI_AGE=0
 
-LIBECAL_CURRENT=10
+LIBECAL_CURRENT=11
 LIBECAL_REVISION=2
 LIBECAL_AGE=2
 
-LIBEDATACAL_CURRENT=11
+LIBEDATACAL_CURRENT=12
 LIBEDATACAL_REVISION=0
 LIBEDATACAL_AGE=0
 
-LIBEDATABOOK_CURRENT=9
+LIBEDATABOOK_CURRENT=10
 LIBEDATABOOK_REVISION=0
 LIBEDATABOOK_AGE=0
 
-LIBEBOOK_CURRENT=13
+LIBEBOOK_CURRENT=14
 LIBEBOOK_REVISION=1
 LIBEBOOK_AGE=3
 
@@ -1478,8 +1478,10 @@ servers/groupwise/Makefile
 servers/groupwise/libegroupwise.pc
 tests/Makefile
 tests/libebook/Makefile
+tests/libebook/client/Makefile
 tests/libebook/vcard/Makefile
 tests/libecal/Makefile
+tests/libecal/client/Makefile
 tests/libedata-cal/Makefile
 tests/libedataserver/Makefile
 tests/libedataserverui/Makefile
diff --git a/libedataserver/Makefile.am b/libedataserver/Makefile.am
index 3041867..347c2a0 100644
--- a/libedataserver/Makefile.am
+++ b/libedataserver/Makefile.am
@@ -1,3 +1,7 @@
+# The marshallers
+MARSHAL_GENERATED = e-gdbus-marshallers.c e-gdbus-marshallers.h
+ EVO_MARSHAL_RULE@
+
 lib_LTLIBRARIES = libedataserver-1.2.la
 
 libedataserver_1_2_la_CPPFLAGS = \
@@ -14,14 +18,20 @@ libedataserver_1_2_la_CPPFLAGS = \
 	$(SOUP_CFLAGS)
 
 libedataserver_1_2_la_SOURCES =		\
+	$(MARSHAL_GENERATED)		\
 	e-account-list.c		\
 	e-account.c			\
 	e-categories.c			\
+	e-client.c			\
+	e-credentials.c			\
 	e-flag.c			\
+	e-gdbus-templates.h		\
+	e-gdbus-templates.c		\
 	e-iterator.c			\
 	e-list.c			\
 	e-list-iterator.c		\
 	e-memory.c			\
+	e-operation-pool.c		\
 	e-proxy.c			\
 	e-sexp.c			\
 	e-source-group.c		\
@@ -52,11 +62,14 @@ libedataserverinclude_HEADERS =		\
 	e-account-list.h		\
 	e-account.h			\
 	e-categories.h			\
+	e-client.h			\
+	e-credentials.h			\
 	e-flag.h			\
 	e-iterator.h			\
 	e-list.h			\
 	e-list-iterator.h		\
 	e-memory.h			\
+	e-operation-pool.h		\
 	e-proxy.h			\
 	e-sexp.h			\
 	e-source-group.h		\
@@ -81,7 +94,8 @@ EXTRA_DIST = 						\
 	$(pkgconfig_DATA:-$(API_VERSION).pc=.pc.in)	\
 	eds-version.h.in
 
-CLEANFILES =
+BUILT_SOURCES = $(MARSHAL_GENERATED)
+CLEANFILES = $(BUILT_SOURCES)
 DISTCLEANFILES = eds-version.h $(pkgconfig_DATA)
 
 -include $(INTROSPECTION_MAKEFILE)
diff --git a/libedataserver/e-client.c b/libedataserver/e-client.c
new file mode 100644
index 0000000..63ee46d
--- /dev/null
+++ b/libedataserver/e-client.c
@@ -0,0 +1,1951 @@
+/*
+ * e-client.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+#include <gio/gio.h>
+
+#include "e-gdbus-marshallers.h"
+#include "e-operation-pool.h"
+
+#include "e-client.h"
+
+struct _EClientPrivate
+{
+	GStaticRecMutex prop_mutex;
+
+	ESource *source;
+	gchar *uri;
+	gboolean online;
+	gboolean readonly;
+	gboolean opened;
+	gboolean capabilities_retrieved;
+	GSList *capabilities;
+
+	GStaticRecMutex ops_mutex;
+	guint32 last_opid;
+	GHashTable *ops; /* opid to GCancellable */
+};
+
+enum {
+	PROP_0,
+	PROP_SOURCE,
+	PROP_CAPABILITIES,
+	PROP_READONLY,
+	PROP_ONLINE,
+	PROP_OPENED
+};
+
+enum {
+	AUTHENTICATE,
+	BACKEND_ERROR,
+	BACKEND_DIED,
+	LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL];
+static EOperationPool *ops_pool = NULL;
+
+G_DEFINE_ABSTRACT_TYPE (EClient, e_client, G_TYPE_OBJECT)
+
+static void client_set_source (EClient *client, ESource *source);
+static void client_operation_thread (gpointer data, gpointer user_data);
+static void client_handle_authentication (EClient *client, const ECredentials *credentials);
+
+static void
+e_client_init (EClient *client)
+{
+	client->priv = G_TYPE_INSTANCE_GET_PRIVATE (client, E_TYPE_CLIENT, EClientPrivate);
+
+	client->priv->readonly = TRUE;
+
+	g_static_rec_mutex_init (&client->priv->prop_mutex);
+
+	g_static_rec_mutex_init (&client->priv->ops_mutex);
+	client->priv->last_opid = 0;
+	client->priv->ops = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_object_unref);
+}
+
+static void
+client_dispose (GObject *object)
+{
+	EClient *client;
+
+	client = E_CLIENT (object);
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (client->priv != NULL);
+
+	e_client_cancel_all (client);
+
+	/* Chain up to parent's dispose() method. */
+	G_OBJECT_CLASS (e_client_parent_class)->dispose (object);
+}
+
+static void
+client_finalize (GObject *object)
+{
+	EClient *client;
+	EClientPrivate *priv;
+
+	client = E_CLIENT (object);
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (client->priv != NULL);
+
+	priv = client->priv;
+
+	g_static_rec_mutex_lock (&priv->prop_mutex);
+
+	if (priv->source) {
+		g_object_unref (priv->source);
+		priv->source = NULL;
+	}
+
+	if (priv->uri) {
+		g_free (priv->uri);
+		priv->uri = NULL;
+	}
+
+	if (priv->capabilities) {
+		g_slist_foreach (priv->capabilities, (GFunc) g_free, NULL);
+		g_slist_free (priv->capabilities);
+		priv->capabilities = NULL;
+	}
+
+	if (priv->ops) {
+		g_hash_table_destroy (priv->ops);
+		priv->ops = NULL;
+	}
+
+	g_static_rec_mutex_unlock (&priv->prop_mutex);
+	g_static_rec_mutex_free (&priv->prop_mutex);
+	g_static_rec_mutex_free (&priv->ops_mutex);
+
+	/* Chain up to parent's finalize() method. */
+	G_OBJECT_CLASS (e_client_parent_class)->finalize (object);
+}
+
+static void
+client_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+{
+	switch (property_id) {
+		case PROP_SOURCE:
+			client_set_source (E_CLIENT (object), g_value_get_object (value));
+			return;
+
+		case PROP_ONLINE:
+			e_client_set_online (E_CLIENT (object), g_value_get_boolean (value));
+			return;
+	}
+
+	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+client_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+{
+	switch (property_id) {
+		case PROP_SOURCE:
+			g_value_set_object (value, e_client_get_source (E_CLIENT (object)));
+			return;
+
+		case PROP_CAPABILITIES:
+			g_value_set_pointer (value, (gpointer) e_client_get_capabilities (E_CLIENT (object)));
+			return;
+
+		case PROP_READONLY:
+			g_value_set_boolean (value, e_client_is_readonly (E_CLIENT (object)));
+			return;
+
+		case PROP_ONLINE:
+			g_value_set_boolean (value, e_client_is_online (E_CLIENT (object)));
+			return;
+
+		case PROP_OPENED:
+			g_value_set_boolean (value, e_client_is_opened (E_CLIENT (object)));
+			return;
+	}
+
+	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+e_client_class_init (EClientClass *klass)
+{
+	GObjectClass *object_class;
+
+	g_type_class_add_private (klass, sizeof (EClientPrivate));
+
+	object_class = G_OBJECT_CLASS (klass);
+	object_class->set_property = client_set_property;
+	object_class->get_property = client_get_property;
+	object_class->dispose = client_dispose;
+	object_class->finalize = client_finalize;
+
+	g_object_class_install_property (
+		object_class,
+		PROP_SOURCE,
+		g_param_spec_object (
+			"source",
+			NULL,
+			NULL,
+			E_TYPE_SOURCE,
+			G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+	g_object_class_install_property (
+		object_class,
+		PROP_CAPABILITIES,
+		g_param_spec_pointer (
+			"capabilities",
+			NULL,
+			NULL,
+			G_PARAM_READABLE));
+
+	g_object_class_install_property (
+		object_class,
+		PROP_READONLY,
+		g_param_spec_boolean (
+			"readonly",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READABLE));
+
+	g_object_class_install_property (
+		object_class,
+		PROP_ONLINE,
+		g_param_spec_boolean (
+			"online",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READWRITE));
+
+	g_object_class_install_property (
+		object_class,
+		PROP_OPENED,
+		g_param_spec_boolean (
+			"opened",
+			NULL,
+			NULL,
+			FALSE,
+			G_PARAM_READABLE));
+
+	signals[AUTHENTICATE] = g_signal_new (
+		"authenticate",
+		G_OBJECT_CLASS_TYPE (klass),
+		G_SIGNAL_RUN_LAST,
+		G_STRUCT_OFFSET (EClientClass, authenticate),
+		NULL, NULL,
+		e_gdbus_marshallers_BOOLEAN__POINTER,
+		G_TYPE_BOOLEAN, 1,
+		G_TYPE_POINTER);
+
+	signals[BACKEND_ERROR] = g_signal_new (
+		"backend-error",
+		G_OBJECT_CLASS_TYPE (klass),
+		G_SIGNAL_RUN_FIRST,
+		G_STRUCT_OFFSET (EClientClass, backend_error),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__STRING,
+		G_TYPE_NONE, 1,
+		G_TYPE_STRING);
+
+	signals[BACKEND_DIED] = g_signal_new (
+		"backend-died",
+		G_OBJECT_CLASS_TYPE (klass),
+		G_SIGNAL_RUN_LAST,
+		G_STRUCT_OFFSET (EClientClass, backend_died),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__VOID,
+		G_TYPE_NONE, 0);
+
+	if (!ops_pool)
+		ops_pool = e_operation_pool_new (2, client_operation_thread, NULL);
+}
+
+typedef enum {
+	E_CLIENT_OP_AUTHENTICATE
+} EClientOp;
+
+typedef struct _EClientOpData {
+	EClient *client;
+	EClientOp op;
+
+	union {
+		ECredentials *credentials;
+	} d;
+} EClientOpData;
+
+static void
+client_operation_thread (gpointer data, gpointer user_data)
+{
+	EClientOpData *op_data = data;
+
+	g_return_if_fail (op_data != NULL);
+
+	switch (op_data->op) {
+	case E_CLIENT_OP_AUTHENTICATE:
+		if (e_client_emit_authenticate (op_data->client, op_data->d.credentials))
+			client_handle_authentication (op_data->client, op_data->d.credentials);
+		e_credentials_free (op_data->d.credentials);
+		break;
+	}
+
+	g_object_unref (op_data->client);
+	g_free (op_data);
+}
+
+static void
+client_set_source (EClient *client, ESource *source)
+{
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (E_IS_CLIENT (client));
+	g_return_if_fail (client->priv != NULL);
+	g_return_if_fail (source != NULL);
+	g_return_if_fail (E_IS_SOURCE (source));
+
+	g_object_ref (source);
+
+	if (client->priv->source)
+		g_object_unref (client->priv->source);
+
+	client->priv->source = source;
+}
+
+/**
+ * e_client_get_source:
+ * @client: an #EClient
+ *
+ * Get the #ESource that this client has assigned.
+ *
+ * Returns: The source.
+ *
+ * Since: 3.2
+ **/
+ESource *
+e_client_get_source (EClient *client)
+{
+	g_return_val_if_fail (client != NULL, NULL);
+	g_return_val_if_fail (E_IS_CLIENT (client), NULL);
+	g_return_val_if_fail (client->priv != NULL, NULL);
+
+	return client->priv->source;
+}
+
+/**
+ * e_client_get_uri:
+ * @client: an #EClient
+ *
+ * Get the URI that this client has assigned. This string should not be freed.
+ *
+ * Returns: The URI.
+ *
+ * Since: 3.2
+ **/
+const gchar *
+e_client_get_uri (EClient *client)
+{
+	g_return_val_if_fail (client != NULL, NULL);
+	g_return_val_if_fail (E_IS_CLIENT (client), NULL);
+	g_return_val_if_fail (client->priv != NULL, NULL);
+
+	if (!client->priv->uri)
+		client->priv->uri = e_source_get_uri (e_client_get_source (client));
+
+	return client->priv->uri;
+}
+
+static void
+client_ensure_capabilities (EClient *client)
+{
+	EClientClass *klass;
+	gchar *capabilities;
+
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (E_IS_CLIENT (client));
+	g_return_if_fail (client->priv != NULL);
+
+	klass = E_CLIENT_GET_CLASS (client);
+	g_return_if_fail (klass != NULL);
+	g_return_if_fail (klass->retrieve_capabilities != NULL);
+
+	if (client->priv->capabilities_retrieved || client->priv->capabilities)
+		return;
+
+	g_static_rec_mutex_lock (&client->priv->prop_mutex);
+
+	capabilities = klass->retrieve_capabilities (client);
+
+	e_client_set_capabilities (client, capabilities);
+
+	g_free (capabilities);
+
+	client->priv->capabilities_retrieved = TRUE;
+
+	g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+}
+
+/**
+ * e_client_get_capabilities:
+ * @client: an #EClient
+ *
+ * Get list of strings with capabilities advertised by a backend.
+ * This list, together with inner strings, is owned by the @client.
+ * To check for individual capabilities use e_client_check_capability().
+ *
+ * Returns: #GSList of const strings of capabilities
+ *
+ * Since: 3.2
+ **/
+const GSList *
+e_client_get_capabilities (EClient *client)
+{
+	g_return_val_if_fail (client != NULL, NULL);
+	g_return_val_if_fail (E_IS_CLIENT (client), NULL);
+	g_return_val_if_fail (client->priv != NULL, NULL);
+
+	client_ensure_capabilities (client);
+
+	return client->priv->capabilities;
+}
+
+/**
+ * e_client_check_capability:
+ * @client: an #EClient
+ * @capability: a capability
+ *
+ * Check if backend supports particular capability.
+ * To get all capabilities use e_client_get_capabilities().
+ *
+ * Returns: #GSList of const strings of capabilities
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_client_check_capability (EClient *client, const gchar *capability)
+{
+	GSList *iter;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (capability, FALSE);
+
+	g_static_rec_mutex_lock (&client->priv->prop_mutex);
+
+	client_ensure_capabilities (client);
+
+	for (iter = client->priv->capabilities; iter; iter = g_slist_next (iter)) {
+		const gchar *cap = iter->data;
+
+		if (cap && g_ascii_strcasecmp (cap, capability) == 0) {
+			g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+			return TRUE;
+		}
+	}
+
+	g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+
+	return FALSE;
+}
+
+/* capabilities - comma-separated list of capabilities; can be NULL to unset */
+void
+e_client_set_capabilities (EClient *client, const gchar *capabilities)
+{
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (E_IS_CLIENT (client));
+	g_return_if_fail (client->priv != NULL);
+
+	g_static_rec_mutex_lock (&client->priv->prop_mutex);
+
+	if (!capabilities)
+		client->priv->capabilities_retrieved = FALSE;
+
+	g_slist_foreach (client->priv->capabilities, (GFunc) g_free, NULL);
+	g_slist_free (client->priv->capabilities);
+	client->priv->capabilities = e_client_util_parse_capabilities (capabilities);
+
+	g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+
+	g_object_notify (G_OBJECT (client), "capabilities");
+}
+
+/**
+ * e_client_is_readonly:
+ * @client: an #EClient
+ *
+ * Check if this @client is read-only.
+ *
+ * Returns: %TRUE if this @client is read-only, otherwise %FALSE.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_client_is_readonly (EClient *client)
+{
+	g_return_val_if_fail (client != NULL, TRUE);
+	g_return_val_if_fail (E_IS_CLIENT (client), TRUE);
+	g_return_val_if_fail (client->priv != NULL, TRUE);
+
+	return client->priv->readonly;
+}
+
+void
+e_client_set_readonly (EClient *client, gboolean readonly)
+{
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (E_IS_CLIENT (client));
+	g_return_if_fail (client->priv != NULL);
+
+	g_static_rec_mutex_lock (&client->priv->prop_mutex);
+	if ((readonly ? 1 : 0) == (client->priv->readonly ? 1 : 0)) {
+		g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+		return;
+	}
+
+	client->priv->readonly = readonly;
+
+	g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+
+	g_object_notify (G_OBJECT (client), "readonly");
+}
+
+/**
+ * e_client_is_online:
+ * @client: an #EClient
+ *
+ * Check if this @client is connected.
+ *
+ * Returns: %TRUE if this @client is connected, otherwise %FALSE.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_client_is_online (EClient *client)
+{
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+
+	return client->priv->online;
+}
+
+void
+e_client_set_online (EClient *client, gboolean is_online)
+{
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (E_IS_CLIENT (client));
+	g_return_if_fail (client->priv != NULL);
+
+	/* newly connected/disconnected => make sure capabilities will be correct */
+	e_client_set_capabilities (client, NULL);
+
+	g_static_rec_mutex_lock (&client->priv->prop_mutex);
+	if ((is_online ? 1: 0) == (client->priv->online ? 1 : 0)) {
+		g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+		return;
+	}
+
+	client->priv->online = is_online;
+
+	g_static_rec_mutex_unlock (&client->priv->prop_mutex);
+
+	g_object_notify (G_OBJECT (client), "online");
+}
+
+/**
+ * e_client_is_opened:
+ * @client: an #EClient
+ *
+ * Check if this @client has been opened.
+ *
+ * Returns: %TRUE if this @client has been opened, otherwise %FALSE.
+ *
+ * Since: 3.2.
+ **/
+gboolean
+e_client_is_opened (EClient *client)
+{
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+
+	return client->priv->opened;
+}
+
+/**
+ * e_client_cancel_op:
+ * @client: an #EClient
+ * @opid: asynchronous operation ID
+ *
+ * Cancels particular asynchronous operation. The @opid is returned from
+ * an asynchronous function, like e_client_open(). The function does nothing
+ * if the asynchronous operation doesn't exist any more.
+ *
+ * Since: 3.2
+ **/
+void
+e_client_cancel_op (EClient *client, guint32 opid)
+{
+	GCancellable *cancellable;
+
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (E_IS_CLIENT (client));
+	g_return_if_fail (client->priv != NULL);
+	g_return_if_fail (client->priv->ops != NULL);
+
+	g_static_rec_mutex_lock (&client->priv->ops_mutex);
+
+	cancellable = g_hash_table_lookup (client->priv->ops, GINT_TO_POINTER (opid));
+	if (cancellable)
+		g_cancellable_cancel (cancellable);
+
+	g_static_rec_mutex_unlock (&client->priv->ops_mutex);
+}
+
+static void
+gather_opids_cb (gpointer opid, gpointer cancellable, gpointer ids_list)
+{
+	GSList **ids = ids_list;
+
+	g_return_if_fail (ids_list != NULL);
+
+	*ids = g_slist_prepend (*ids, opid);
+}
+
+static void
+cancel_op_cb (gpointer opid, gpointer client)
+{
+	e_client_cancel_op (client, GPOINTER_TO_INT (opid));
+}
+
+/**
+ * e_client_cancel_all:
+ * @client: an #EClient
+ *
+ * Cancels all pending operations started on @client.
+ *
+ * Since: 3.2
+ **/
+void
+e_client_cancel_all (EClient *client)
+{
+	GSList *opids = NULL;
+
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (E_IS_CLIENT (client));
+	g_return_if_fail (client->priv != NULL);
+	g_return_if_fail (client->priv->ops != NULL);
+
+	g_static_rec_mutex_lock (&client->priv->ops_mutex);
+
+	g_hash_table_foreach (client->priv->ops, gather_opids_cb, &opids);
+
+	g_slist_foreach (opids, cancel_op_cb, client);
+	g_slist_free (opids);
+
+	g_static_rec_mutex_unlock (&client->priv->ops_mutex);
+}
+
+guint32
+e_client_register_op (EClient *client, GCancellable *cancellable)
+{
+	guint32 opid;
+
+	g_return_val_if_fail (client != NULL, 0);
+	g_return_val_if_fail (E_IS_CLIENT (client), 0);
+	g_return_val_if_fail (client->priv != NULL, 0);
+	g_return_val_if_fail (client->priv->ops != NULL, 0);
+	g_return_val_if_fail (cancellable != NULL, 0);
+
+	g_static_rec_mutex_lock (&client->priv->ops_mutex);
+
+	client->priv->last_opid++;
+	if (!client->priv->last_opid)
+		client->priv->last_opid++;
+
+	while (g_hash_table_lookup (client->priv->ops, GINT_TO_POINTER (client->priv->last_opid)))
+		client->priv->last_opid++;
+
+	g_return_val_if_fail (client->priv->last_opid != 0, 0);
+
+	opid = client->priv->last_opid;
+	g_hash_table_insert (client->priv->ops, GINT_TO_POINTER (opid), g_object_ref (cancellable));
+
+	g_static_rec_mutex_unlock (&client->priv->ops_mutex);
+
+	return opid;
+}
+
+void
+e_client_unregister_op (EClient *client, guint32 opid)
+{
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (E_IS_CLIENT (client));
+	g_return_if_fail (client->priv != NULL);
+	g_return_if_fail (client->priv->ops != NULL);
+
+	g_static_rec_mutex_lock (&client->priv->ops_mutex);
+	g_hash_table_remove (client->priv->ops, GINT_TO_POINTER (opid));
+	g_static_rec_mutex_unlock (&client->priv->ops_mutex);
+}
+
+static void
+client_handle_authentication (EClient *client, const ECredentials *credentials)
+{
+	EClientClass *klass;
+
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (E_IS_CLIENT (client));
+	g_return_if_fail (credentials != NULL);
+
+	klass = E_CLIENT_GET_CLASS (client);
+	g_return_if_fail (klass != NULL);
+	g_return_if_fail (klass->handle_authentication != NULL);
+
+	return klass->handle_authentication (client, credentials);
+}
+
+/* Processes authentication request in a new thread. Usual steps are:
+   a) backend sends an auth-required signal
+   b) EClient implementation calls this function
+   c) a new thread is run which emits authenticate signal by e_client_emit_authenticate()
+   d) if anyone responds (returns true), the EClient::handle_authentication
+      is called from the same extra thread with new credentials
+   e) EClient implementation passes results to backend in the EClient::handle_authentication
+*/
+void
+e_client_process_authentication (EClient *client, const ECredentials *credentials)
+{
+	EClientOpData *op_data;
+
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (E_IS_CLIENT (client));
+
+	op_data = g_new0 (EClientOpData, 1);
+	op_data->client = g_object_ref (client);
+	op_data->op = E_CLIENT_OP_AUTHENTICATE;
+	op_data->d.credentials = credentials ? e_credentials_new_clone (credentials) : e_credentials_new ();
+
+	e_operation_pool_push (ops_pool, op_data);
+}
+
+gboolean
+e_client_emit_authenticate (EClient *client, ECredentials *credentials)
+{
+	gboolean handled = FALSE;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
+	g_return_val_if_fail (credentials != NULL, FALSE);
+
+	g_signal_emit (client, signals[AUTHENTICATE], 0, credentials, &handled);
+
+	return handled;
+}
+
+void
+e_client_emit_backend_error (EClient *client, const gchar *error_msg)
+{
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (E_IS_CLIENT (client));
+	g_return_if_fail (error_msg != NULL);
+
+	g_signal_emit (client, signals[BACKEND_ERROR], 0, error_msg);
+}
+
+void
+e_client_emit_backend_died (EClient *client)
+{
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (E_IS_CLIENT (client));
+
+	g_signal_emit (client, signals[BACKEND_DIED], 0);
+}
+
+/**
+ * e_client_open:
+ * @client: an #EClient
+ * @only_if_exists: if %TRUE, fail if this book doesn't already exist, otherwise create it first
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Opens the @client, making it ready for queries and other operations.
+ * The call is finished by e_client_open_finish() from the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_client_open (EClient *client, gboolean only_if_exists, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	EClientClass *klass;
+
+	g_return_val_if_fail (client != NULL, 0);
+	g_return_val_if_fail (E_IS_CLIENT (client), 0);
+	g_return_val_if_fail (client->priv != NULL, 0);
+	g_return_val_if_fail (callback != NULL, 0);
+
+	klass = E_CLIENT_GET_CLASS (client);
+	g_return_val_if_fail (klass != NULL, 0);
+	g_return_val_if_fail (klass->open != NULL, 0);
+
+	return klass->open (client, only_if_exists, cancellable, callback, user_data);
+}
+
+/**
+ * e_client_open_finish:
+ * @client: an #EClient
+ * @result: a #GAsyncResult
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_client_open().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_client_open_finish (EClient *client, GAsyncResult *result, GError **error)
+{
+	EClientClass *klass;
+	gboolean res;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+
+	klass = E_CLIENT_GET_CLASS (client);
+	g_return_val_if_fail (klass != NULL, FALSE);
+	g_return_val_if_fail (klass->open_finish != NULL, FALSE);
+
+	res = klass->open_finish (client, result, error);
+
+	client->priv->opened = res;
+
+	return res;
+}
+
+/**
+ * e_client_open_sync:
+ * @client: an #EClient
+ * @only_if_exists: if %TRUE, fail if this book doesn't already exist, otherwise create it first
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Opens the @client, making it ready for queries and other operations.
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_client_open_sync (EClient *client, gboolean only_if_exists, GCancellable *cancellable, GError **error)
+{
+	EClientClass *klass;
+	gboolean res;
+
+	klass = E_CLIENT_GET_CLASS (client);
+	g_return_val_if_fail (klass != NULL, FALSE);
+	g_return_val_if_fail (klass->open_sync != NULL, FALSE);
+
+	res = klass->open_sync (client, only_if_exists, cancellable, error);
+
+	client->priv->opened = res;
+
+	return res;
+}
+
+/**
+ * e_client_remove:
+ * @client: an #EClient
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Removes the backing data for this #EClient. For example, with the file backend this
+ * deletes the database file. You cannot get it back!
+ * The call is finished by e_client_remove_finish() from the @callback.
+ *
+ * Returns: Asynchronous operation ID, which can be passed to e_client_cancel_op(),
+ * or zero on a failure.
+ *
+ * Since: 3.2
+ **/
+guint32
+e_client_remove (EClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	EClientClass *klass;
+
+	g_return_val_if_fail (client != NULL, 0);
+	g_return_val_if_fail (E_IS_CLIENT (client), 0);
+	g_return_val_if_fail (client->priv != NULL, 0);
+	g_return_val_if_fail (callback != NULL, 0);
+
+	klass = E_CLIENT_GET_CLASS (client);
+	g_return_val_if_fail (klass != NULL, 0);
+	g_return_val_if_fail (klass->remove != NULL, 0);
+
+	return klass->remove (client, cancellable, callback, user_data);
+}
+
+/**
+ * e_client_remove_finish:
+ * @client: an #EClient
+ * @result: a #GAsyncResult
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_client_remove().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_client_remove_finish (EClient *client, GAsyncResult *result, GError **error)
+{
+	EClientClass *klass;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+
+	klass = E_CLIENT_GET_CLASS (client);
+	g_return_val_if_fail (klass != NULL, FALSE);
+	g_return_val_if_fail (klass->remove_finish != NULL, FALSE);
+
+	return klass->remove_finish (client, result, error);
+}
+
+/**
+ * e_client_remove_sync:
+ * @client: an #EClient
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Removes the backing data for this #EClient. For example, with the file backend this
+ * deletes the database file. You cannot get it back!
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_client_remove_sync (EClient *client, GCancellable *cancellable, GError **error)
+{
+	EClientClass *klass;
+
+	klass = E_CLIENT_GET_CLASS (client);
+	g_return_val_if_fail (klass != NULL, FALSE);
+	g_return_val_if_fail (klass->remove_sync != NULL, FALSE);
+
+	return klass->remove_sync (client, cancellable, error);
+}
+
+/**
+ * e_client_util_slist_to_strv:
+ * @strings: a #GSList of strings (const gchar *)
+ *
+ * Convert list of strings into NULL-terminates array of strings.
+ *
+ * Returns: Newly allocated NULL-terminated array of strings.
+ * Returned pointer should be freed with g_strfreev().
+ *
+ * Note: Pair function for this is e_client_util_strv_to_slist().
+ *
+ * Sice: 3.2
+ **/
+gchar **
+e_client_util_slist_to_strv (const GSList *strings)
+{
+	const GSList *iter;
+	GPtrArray *array;
+
+	array = g_ptr_array_sized_new (g_slist_length ((GSList *) strings) + 1);
+
+	for (iter = strings; iter; iter = iter->next) {
+		const gchar *str = iter->data;
+
+		if (str)
+			g_ptr_array_add (array, g_strdup (str));
+	}
+
+	/* NULL-terminated */
+	g_ptr_array_add (array, NULL);
+
+	return (gchar **) g_ptr_array_free (array, FALSE);
+}
+
+/**
+ * e_client_util_strv_to_slist:
+ * @strv: a NULL-terminated array of strings (const gchar *)
+ *
+ * Convert NULL-terminated array of strings to a list of strings.
+ *
+ * Returns: Newly allocated #GSList of newly allocated strings.
+ * Returned pointer should be freed with e_client_util_free_string_slist().
+ *
+ * Note: Pair function for this is e_client_util_slist_to_strv().
+ *
+ * Sice: 3.2
+ **/
+GSList *
+e_client_util_strv_to_slist (const gchar * const *strv)
+{
+	GSList *slist = NULL;
+	gint ii;
+
+	if (!strv)
+		return NULL;
+
+	for (ii = 0; strv[ii]; ii++) {
+		slist = g_slist_prepend (slist, g_strdup (strv[ii]));
+	}
+
+	return g_slist_reverse (slist);
+}
+
+/**
+ * e_client_util_free_string_slist:
+ * @strings: a #GSList of strings (gchar *)
+ *
+ * Frees memory previously allocated by e_client_util_strv_to_slist().
+ *
+ * Sice: 3.2
+ **/
+void
+e_client_util_free_string_slist (GSList *strings)
+{
+	if (!strings)
+		return;
+
+	g_slist_foreach (strings, (GFunc) g_free, NULL);
+	g_slist_free (strings);
+}
+
+/**
+ * e_client_util_free_object_slist:
+ * @objects: a #GSList of #GObject-s
+ *
+ * Calls g_object_unref() on each member of @objects and then frees
+ * also @objects itself.
+ *
+ * Sice: 3.2
+ **/
+void
+e_client_util_free_object_slist (GSList *objects)
+{
+	if (!objects)
+		return;
+
+	g_slist_foreach (objects, (GFunc) g_object_unref, NULL);
+	g_slist_free (objects);
+}
+
+/**
+ * e_client_util_parse_capabilities:
+ * @capabilitites: string of capabilities
+ *
+ * Parse comma-separated list of capabilities into #GSList.
+ *
+ * Reeturns: Newly allocated #GSList of newly allocated strings
+ * corresponding to capabilities as parsed from @capabilities.
+ * Free returned pointer with e_client_util_free_string_slist().
+ *
+ * Since: 3.2
+ **/
+GSList *
+e_client_util_parse_capabilities (const gchar *capabilities)
+{
+	GSList *caps_slist = NULL;
+	gchar **caps_strv = NULL;
+	gint ii;
+
+	if (!capabilities || !*capabilities)
+		return NULL;
+
+	caps_strv = g_strsplit (capabilities, ",", -1);
+	g_return_val_if_fail (caps_strv != NULL, NULL);
+
+	for (ii = 0; caps_strv && caps_strv[ii]; ii++) {
+		gchar *cap = g_strstrip (caps_strv[ii]);
+
+		if (cap && *cap)
+			caps_slist = g_slist_prepend (caps_slist, g_strdup (cap));
+	}
+
+	g_strfreev (caps_strv);
+
+	return g_slist_reverse (caps_slist);
+}
+
+/* for each known source calls check_func, which should return TRUE if the required
+   source have been found. Function returns NULL or the source on which was returned
+   TRUE by the check_func. Non-NULL pointer should be unreffed by g_object_unref. */
+static ESource *
+search_known_sources (ESourceList *sources, gboolean (*check_func)(ESource *source, gpointer user_data), gpointer user_data)
+{
+	ESource *res = NULL;
+	GSList *g;
+
+	g_return_val_if_fail (check_func != NULL, NULL);
+	g_return_val_if_fail (sources != NULL, NULL);
+
+	for (g = e_source_list_peek_groups (sources); g; g = g->next) {
+		ESourceGroup *group = E_SOURCE_GROUP (g->data);
+		GSList *s;
+
+		for (s = e_source_group_peek_sources (group); s; s = s->next) {
+			ESource *source = E_SOURCE (s->data);
+
+			if (check_func (source, user_data)) {
+				res = g_object_ref (source);
+				break;
+			}
+		}
+
+		if (res)
+			break;
+	}
+
+	return res;
+}
+
+static gboolean
+check_uri (ESource *source, gpointer uri)
+{
+	const gchar *suri;
+
+	g_return_val_if_fail (source != NULL, FALSE);
+	g_return_val_if_fail (uri != NULL, FALSE);
+
+	suri = e_source_peek_absolute_uri (source);
+
+	if (suri && g_ascii_strcasecmp (suri, uri) == 0)
+		return TRUE;
+
+	if (!suri && e_source_peek_group (source)) {
+		gboolean res = FALSE;
+		gchar *my_uri = g_strconcat (
+			e_source_group_peek_base_uri (e_source_peek_group (source)),
+			e_source_peek_relative_uri (source),
+			NULL);
+
+		res = my_uri && g_ascii_strcasecmp (my_uri, uri) == 0;
+
+		g_free (my_uri);
+
+		return res;
+	}
+
+	return FALSE;
+}
+
+struct check_system_data
+{
+	const gchar *uri;
+	ESource *uri_source;
+};
+
+static gboolean
+check_system (ESource *source, gpointer data)
+{
+	struct check_system_data *csd = data;
+
+	g_return_val_if_fail (source != NULL, FALSE);
+	g_return_val_if_fail (data != NULL, FALSE);
+
+	if (e_source_get_property (source, "system")) {
+		return TRUE;
+	}
+
+	if (check_uri (source, (gpointer) csd->uri)) {
+		if (csd->uri_source)
+			g_object_unref (csd->uri_source);
+		csd->uri_source = g_object_ref (source);
+	}
+
+	return FALSE;
+}
+
+ESource *
+e_client_util_get_system_source (ESourceList *source_list)
+{
+	struct check_system_data csd;
+	ESource *system_source = NULL;
+
+	g_return_val_if_fail (source_list != NULL, NULL);
+	g_return_val_if_fail (E_IS_SOURCE_LIST (source_list), NULL);
+
+	csd.uri = "local:system";
+	csd.uri_source = NULL;
+
+	system_source = search_known_sources (source_list, check_system, &csd);
+
+	if (!system_source) {
+		system_source = csd.uri_source;
+		csd.uri_source = NULL;
+	}
+
+	if (csd.uri_source)
+		g_object_unref (csd.uri_source);
+
+	return system_source;
+}
+
+gboolean
+e_client_util_set_default (ESourceList *source_list, ESource *source)
+{
+	const gchar *uid;
+	GSList *g;
+
+	g_return_val_if_fail (source_list != NULL, FALSE);
+	g_return_val_if_fail (E_IS_SOURCE_LIST (source_list), FALSE);
+	g_return_val_if_fail (source != NULL, FALSE);
+	g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
+
+	uid = e_source_peek_uid (source);
+
+	/* make sure the source is actually in the ESourceList.  If
+	   it's not we don't bother adding it, just return an error */
+	source = e_source_list_peek_source_by_uid (source_list, uid);
+	if (!source)
+		return FALSE;
+
+	/* loop over all the sources clearing out any "default"
+	   properties we find */
+	for (g = e_source_list_peek_groups (source_list); g; g = g->next) {
+		GSList *s;
+		for (s = e_source_group_peek_sources (E_SOURCE_GROUP (g->data));
+		     s; s = s->next) {
+			e_source_set_property (E_SOURCE (s->data), "default", NULL);
+		}
+	}
+
+	/* set the "default" property on the source */
+	e_source_set_property (source, "default", "true");
+
+	return TRUE;
+}
+
+ESource *
+e_client_util_get_source_for_uri (ESourceList *source_list, const gchar *uri)
+{
+	ESource *source;
+
+	g_return_val_if_fail (source_list != NULL, NULL);
+	g_return_val_if_fail (E_IS_SOURCE_LIST (source_list), NULL);
+	g_return_val_if_fail (uri != NULL, NULL);
+
+	source = search_known_sources (source_list, check_uri, (gpointer) uri);
+	if (!source)
+		source = e_source_new_with_absolute_uri ("", uri);
+
+	return source;
+}
+
+GDBusProxy *
+e_client_get_dbus_proxy (EClient *client)
+{
+	EClientClass *klass;
+
+	g_return_val_if_fail (client != NULL, NULL);
+	g_return_val_if_fail (E_IS_CLIENT (client), NULL);
+
+	klass = E_CLIENT_GET_CLASS (client);
+	g_return_val_if_fail (klass != NULL, NULL);
+	g_return_val_if_fail (klass->get_dbus_proxy != NULL, NULL);
+
+	return klass->get_dbus_proxy (client);
+}
+
+/**
+ * Unwraps D-Bus error to local error. dbus_error is automatically freed.
+ * dbus_erorr and out_error can point to the same variable.
+ **/
+void
+e_client_unwrap_dbus_error (EClient *client, GError *dbus_error, GError **out_error)
+{
+	EClientClass *klass;
+
+	g_return_if_fail (client != NULL);
+	g_return_if_fail (E_IS_CLIENT (client));
+
+	klass = E_CLIENT_GET_CLASS (client);
+	g_return_if_fail (klass != NULL);
+	g_return_if_fail (klass->unwrap_dbus_error != NULL);
+
+	if (!dbus_error || !out_error) {
+		if (dbus_error)
+			g_error_free (dbus_error);
+	} else {
+		klass->unwrap_dbus_error (client, dbus_error, out_error);
+	}
+}
+
+typedef struct _EClientAsyncOpData
+{
+	EClient *client;
+	guint32 opid;
+
+	gpointer source_tag;
+	GAsyncReadyCallback callback;
+	gpointer user_data;
+
+	gboolean result; /* result of the finish function call */
+
+	/* only one can be non-NULL, and the type is telling which 'out' value is valid */
+	EClientProxyFinishVoidFunc finish_void;
+	EClientProxyFinishBooleanFunc finish_boolean;
+	EClientProxyFinishStringFunc finish_string;
+	EClientProxyFinishStrvFunc finish_strv;
+	EClientProxyFinishUintFunc finish_uint;
+
+	union {
+		gboolean val_boolean;
+		gchar *val_string;
+		gchar **val_strv;
+		guint val_uint;
+	} out;
+} EClientAsyncOpData;
+
+static void
+async_data_free (EClientAsyncOpData *async_data)
+{
+	g_return_if_fail (async_data != NULL);
+	g_return_if_fail (async_data->client != NULL);
+
+	e_client_unregister_op (async_data->client, async_data->opid);
+
+	if (async_data->finish_string)
+		g_free (async_data->out.val_string);
+	else if (async_data->finish_strv)
+		g_strfreev (async_data->out.val_strv);
+
+	g_object_unref (async_data->client);
+	g_free (async_data);
+}
+
+static gboolean
+complete_async_op_in_idle_cb (gpointer user_data)
+{
+	GSimpleAsyncResult *simple = user_data;
+	gint run_main_depth;
+
+	g_return_val_if_fail (simple != NULL, FALSE);
+
+	run_main_depth = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (simple), "run-main-depth"));
+	if (run_main_depth < 1)
+		run_main_depth = 1;
+
+	/* do not receive in higher level than was initially run */
+	if (g_main_depth () > run_main_depth) {
+		return TRUE;
+	}
+
+	g_simple_async_result_complete (simple);
+	g_object_unref (simple);
+
+	return FALSE;
+}
+
+static void
+finish_async_op (EClientAsyncOpData *async_data, const GError *error, gboolean in_idle)
+{
+	GSimpleAsyncResult *simple;
+
+	g_return_if_fail (async_data != NULL);
+	g_return_if_fail (async_data->source_tag != NULL);
+	g_return_if_fail (async_data->client != NULL);
+
+	simple = g_simple_async_result_new (G_OBJECT (async_data->client), async_data->callback, async_data->user_data, async_data->source_tag);
+	g_simple_async_result_set_op_res_gpointer (simple, async_data, (GDestroyNotify) async_data_free);
+
+	if (error != NULL)
+		g_simple_async_result_set_from_error (simple, error);
+
+	if (in_idle) {
+		g_object_set_data (G_OBJECT (simple), "run-main-depth", GINT_TO_POINTER (g_main_depth ()));
+		g_idle_add (complete_async_op_in_idle_cb, simple);
+	} else {
+		g_simple_async_result_complete (simple);
+		g_object_unref (simple);
+	}
+}
+
+static void
+async_result_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	GError *error = NULL;
+	EClientAsyncOpData *async_data;
+	EClient *client;
+
+	g_return_if_fail (result != NULL);
+	g_return_if_fail (source_object != NULL);
+
+	async_data = user_data;
+	g_return_if_fail (async_data != NULL);
+	g_return_if_fail (async_data->client != NULL);
+
+	client = async_data->client;
+	g_return_if_fail (e_client_get_dbus_proxy (client) == G_DBUS_PROXY (source_object));
+
+	if (async_data->finish_void)
+		async_data->result = async_data->finish_void (G_DBUS_PROXY (source_object), result, &error);
+	else if (async_data->finish_boolean)
+		async_data->result = async_data->finish_boolean (G_DBUS_PROXY (source_object), result, &async_data->out.val_boolean, &error);
+	else if (async_data->finish_string)
+		async_data->result = async_data->finish_string (G_DBUS_PROXY (source_object), result, &async_data->out.val_string, &error);
+	else if (async_data->finish_strv)
+		async_data->result = async_data->finish_strv (G_DBUS_PROXY (source_object), result, &async_data->out.val_strv, &error);
+	else if (async_data->finish_uint)
+		async_data->result = async_data->finish_uint (G_DBUS_PROXY (source_object), result, &async_data->out.val_uint, &error);
+	else
+		g_warning ("%s: Do not know how to finish async operation", G_STRFUNC);
+
+	finish_async_op (async_data, error, FALSE);
+
+	if (error != NULL)
+		g_error_free (error);
+}
+
+static EClientAsyncOpData *
+prepare_async_data (EClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data, gpointer source_tag, EClientProxyFinishVoidFunc finish_void, EClientProxyFinishBooleanFunc finish_boolean, EClientProxyFinishStringFunc finish_string, EClientProxyFinishStrvFunc finish_strv, EClientProxyFinishUintFunc finish_uint, GDBusProxy **proxy, guint32 *opid, GCancellable **out_cancellable)
+{
+	EClientAsyncOpData *async_data;
+	GCancellable *use_cancellable;
+
+	g_return_val_if_fail (client != NULL, NULL);
+	g_return_val_if_fail (callback != NULL, NULL);
+	g_return_val_if_fail (source_tag != NULL, NULL);
+	g_return_val_if_fail (proxy != NULL, NULL);
+	g_return_val_if_fail (opid != NULL, NULL);
+	g_return_val_if_fail (out_cancellable != NULL, NULL);
+	g_return_val_if_fail (finish_void || finish_boolean || finish_string || finish_strv || finish_uint, NULL);
+
+	if (finish_void) {
+		g_return_val_if_fail (finish_boolean == NULL, NULL);
+		g_return_val_if_fail (finish_string == NULL, NULL);
+		g_return_val_if_fail (finish_strv == NULL, NULL);
+		g_return_val_if_fail (finish_uint == NULL, NULL);
+	}
+
+	if (finish_boolean) {
+		g_return_val_if_fail (finish_void == NULL, NULL);
+		g_return_val_if_fail (finish_string == NULL, NULL);
+		g_return_val_if_fail (finish_strv == NULL, NULL);
+		g_return_val_if_fail (finish_uint == NULL, NULL);
+	}
+
+	if (finish_string) {
+		g_return_val_if_fail (finish_void == NULL, NULL);
+		g_return_val_if_fail (finish_boolean == NULL, NULL);
+		g_return_val_if_fail (finish_strv == NULL, NULL);
+		g_return_val_if_fail (finish_uint == NULL, NULL);
+	}
+
+	if (finish_strv) {
+		g_return_val_if_fail (finish_void == NULL, NULL);
+		g_return_val_if_fail (finish_boolean == NULL, NULL);
+		g_return_val_if_fail (finish_string == NULL, NULL);
+		g_return_val_if_fail (finish_uint == NULL, NULL);
+	}
+
+	if (finish_uint) {
+		g_return_val_if_fail (finish_void == NULL, NULL);
+		g_return_val_if_fail (finish_boolean == NULL, NULL);
+		g_return_val_if_fail (finish_string == NULL, NULL);
+		g_return_val_if_fail (finish_strv == NULL, NULL);
+	}
+
+	*proxy = e_client_get_dbus_proxy (client);
+	if (!*proxy)
+		return NULL;
+
+	use_cancellable = cancellable;
+	if (!use_cancellable)
+		use_cancellable = g_cancellable_new ();
+
+	*opid = e_client_register_op (client, use_cancellable);
+	async_data = g_new0 (EClientAsyncOpData, 1);
+	async_data->client = g_object_ref (client);
+	async_data->opid = *opid;
+	async_data->source_tag = source_tag;
+	async_data->callback = callback;
+	async_data->user_data = user_data;
+	async_data->finish_void = finish_void;
+	async_data->finish_boolean = finish_boolean;
+	async_data->finish_string = finish_string;
+	async_data->finish_strv = finish_strv;
+	async_data->finish_uint = finish_uint;
+
+	/* EClient from e_client_register_op() took ownership of the use_cancellable */
+	if (use_cancellable != cancellable)
+		g_object_unref (use_cancellable);
+
+	*out_cancellable = use_cancellable;
+
+	return async_data;
+}
+
+guint32
+e_client_proxy_call_void (EClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data, gpointer source_tag, void (*func) (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data), EClientProxyFinishVoidFunc finish_void, EClientProxyFinishBooleanFunc finish_boolean, EClientProxyFinishStringFunc finish_string, EClientProxyFinishStrvFunc finish_strv, EClientProxyFinishUintFunc finish_uint)
+{
+	EClientAsyncOpData *async_data;
+	guint32 opid = 0;
+	GDBusProxy *proxy = NULL;
+
+	g_return_val_if_fail (client != NULL, 0);
+	g_return_val_if_fail (E_IS_CLIENT (client), 0);
+	g_return_val_if_fail (callback != NULL, 0);
+	g_return_val_if_fail (source_tag != NULL, 0);
+	g_return_val_if_fail (func != NULL, 0);
+
+	async_data = prepare_async_data (client, cancellable, callback, user_data, source_tag, finish_void, finish_boolean, finish_string, finish_strv, finish_uint, &proxy, &opid, &cancellable);
+	g_return_val_if_fail (async_data != NULL, 0);
+
+	func (proxy, cancellable, async_result_ready_cb, async_data);
+
+	return opid;
+}
+
+guint32
+e_client_proxy_call_boolean (EClient *client, gboolean in_boolean, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data, gpointer source_tag, void (*func) (GDBusProxy *proxy, gboolean in_boolean, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data), EClientProxyFinishVoidFunc finish_void, EClientProxyFinishBooleanFunc finish_boolean, EClientProxyFinishStringFunc finish_string, EClientProxyFinishStrvFunc finish_strv, EClientProxyFinishUintFunc finish_uint)
+{
+	EClientAsyncOpData *async_data;
+	guint32 opid = 0;
+	GDBusProxy *proxy = NULL;
+
+	g_return_val_if_fail (client != NULL, 0);
+	g_return_val_if_fail (E_IS_CLIENT (client), 0);
+	g_return_val_if_fail (callback != NULL, 0);
+	g_return_val_if_fail (source_tag != NULL, 0);
+	g_return_val_if_fail (func != NULL, 0);
+
+	async_data = prepare_async_data (client, cancellable, callback, user_data, source_tag, finish_void, finish_boolean, finish_string, finish_strv, finish_uint, &proxy, &opid, &cancellable);
+	g_return_val_if_fail (async_data != NULL, 0);
+
+	func (proxy, in_boolean, cancellable, async_result_ready_cb, async_data);
+
+	return opid;
+}
+
+guint32
+e_client_proxy_call_string (EClient *client, const gchar *in_string, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data, gpointer source_tag, void (*func) (GDBusProxy *proxy, const gchar * in_string, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data), EClientProxyFinishVoidFunc finish_void, EClientProxyFinishBooleanFunc finish_boolean, EClientProxyFinishStringFunc finish_string, EClientProxyFinishStrvFunc finish_strv, EClientProxyFinishUintFunc finish_uint)
+{
+	EClientAsyncOpData *async_data;
+	guint32 opid = 0;
+	GDBusProxy *proxy = NULL;
+
+	g_return_val_if_fail (client != NULL, 0);
+	g_return_val_if_fail (E_IS_CLIENT (client), 0);
+	g_return_val_if_fail (callback != NULL, 0);
+	g_return_val_if_fail (source_tag != NULL, 0);
+	g_return_val_if_fail (func != NULL, 0);
+	g_return_val_if_fail (in_string != NULL, 0);
+
+	async_data = prepare_async_data (client, cancellable, callback, user_data, source_tag, finish_void, finish_boolean, finish_string, finish_strv, finish_uint, &proxy, &opid, &cancellable);
+	g_return_val_if_fail (async_data != NULL, 0);
+
+	func (proxy, in_string, cancellable, async_result_ready_cb, async_data);
+
+	return opid;
+}
+
+guint32
+e_client_proxy_call_strv (EClient *client, const gchar * const *in_strv, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data, gpointer source_tag, void (*func) (GDBusProxy *proxy, const gchar * const * in_strv, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data), EClientProxyFinishVoidFunc finish_void, EClientProxyFinishBooleanFunc finish_boolean, EClientProxyFinishStringFunc finish_string, EClientProxyFinishStrvFunc finish_strv, EClientProxyFinishUintFunc finish_uint)
+{
+	EClientAsyncOpData *async_data;
+	guint32 opid = 0;
+	GDBusProxy *proxy = NULL;
+
+	g_return_val_if_fail (client != NULL, 0);
+	g_return_val_if_fail (E_IS_CLIENT (client), 0);
+	g_return_val_if_fail (callback != NULL, 0);
+	g_return_val_if_fail (source_tag != NULL, 0);
+	g_return_val_if_fail (func != NULL, 0);
+	g_return_val_if_fail (in_strv != NULL, 0);
+
+	async_data = prepare_async_data (client, cancellable, callback, user_data, source_tag, finish_void, finish_boolean, finish_string, finish_strv, finish_uint, &proxy, &opid, &cancellable);
+	g_return_val_if_fail (async_data != NULL, 0);
+
+	func (proxy, in_strv, cancellable, async_result_ready_cb, async_data);
+
+	return opid;
+}
+
+guint32
+e_client_proxy_call_uint (EClient *client, guint in_uint, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data, gpointer source_tag, void (*func) (GDBusProxy *proxy, guint in_uint, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data), EClientProxyFinishVoidFunc finish_void, EClientProxyFinishBooleanFunc finish_boolean, EClientProxyFinishStringFunc finish_string, EClientProxyFinishStrvFunc finish_strv, EClientProxyFinishUintFunc finish_uint)
+{
+	EClientAsyncOpData *async_data;
+	guint32 opid = 0;
+	GDBusProxy *proxy = NULL;
+
+	g_return_val_if_fail (client != NULL, 0);
+	g_return_val_if_fail (E_IS_CLIENT (client), 0);
+	g_return_val_if_fail (callback != NULL, 0);
+	g_return_val_if_fail (source_tag != NULL, 0);
+	g_return_val_if_fail (func != NULL, 0);
+
+	async_data = prepare_async_data (client, cancellable, callback, user_data, source_tag, finish_void, finish_boolean, finish_string, finish_strv, finish_uint, &proxy, &opid, &cancellable);
+	g_return_val_if_fail (async_data != NULL, 0);
+
+	func (proxy, in_uint, cancellable, async_result_ready_cb, async_data);
+
+	return opid;
+}
+
+gboolean
+e_client_proxy_call_finish_void (EClient *client, GAsyncResult *result, GError **error, gpointer source_tag)
+{
+	GSimpleAsyncResult *simple;
+	GError *local_error = NULL;
+	EClientAsyncOpData *async_data;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
+	g_return_val_if_fail (result != NULL, FALSE);
+	g_return_val_if_fail (source_tag != NULL, FALSE);
+	g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (client), source_tag), FALSE);
+
+	simple = G_SIMPLE_ASYNC_RESULT (result);
+
+	if (g_simple_async_result_propagate_error (simple, &local_error)) {
+		e_client_unwrap_dbus_error (client, local_error, error);
+		return FALSE;
+	}
+
+	async_data = g_simple_async_result_get_op_res_gpointer (simple);
+	g_return_val_if_fail (async_data != NULL, FALSE);
+
+	return async_data->result;
+}
+
+gboolean
+e_client_proxy_call_finish_boolean (EClient *client, GAsyncResult *result, gboolean *out_boolean, GError **error, gpointer source_tag)
+{
+	GSimpleAsyncResult *simple;
+	GError *local_error = NULL;
+	EClientAsyncOpData *async_data;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
+	g_return_val_if_fail (result != NULL, FALSE);
+	g_return_val_if_fail (source_tag != NULL, FALSE);
+	g_return_val_if_fail (out_boolean != NULL, FALSE);
+	g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (client), source_tag), FALSE);
+
+	simple = G_SIMPLE_ASYNC_RESULT (result);
+
+	if (g_simple_async_result_propagate_error (simple, &local_error)) {
+		e_client_unwrap_dbus_error (client, local_error, error);
+		return FALSE;
+	}
+
+	async_data = g_simple_async_result_get_op_res_gpointer (simple);
+	g_return_val_if_fail (async_data != NULL, FALSE);
+
+	*out_boolean = async_data->out.val_boolean;
+
+	return async_data->result;
+}
+
+gboolean
+e_client_proxy_call_finish_string (EClient *client, GAsyncResult *result, gchar **out_string, GError **error, gpointer source_tag)
+{
+	GSimpleAsyncResult *simple;
+	GError *local_error = NULL;
+	EClientAsyncOpData *async_data;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
+	g_return_val_if_fail (result != NULL, FALSE);
+	g_return_val_if_fail (source_tag != NULL, FALSE);
+	g_return_val_if_fail (out_string != NULL, FALSE);
+	g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (client), source_tag), FALSE);
+
+	simple = G_SIMPLE_ASYNC_RESULT (result);
+
+	if (g_simple_async_result_propagate_error (simple, &local_error)) {
+		e_client_unwrap_dbus_error (client, local_error, error);
+		return FALSE;
+	}
+
+	async_data = g_simple_async_result_get_op_res_gpointer (simple);
+	g_return_val_if_fail (async_data != NULL, FALSE);
+
+	*out_string = async_data->out.val_string;
+	async_data->out.val_string = NULL;
+
+	return async_data->result;
+}
+
+gboolean
+e_client_proxy_call_finish_strv (EClient *client, GAsyncResult *result, gchar ***out_strv, GError **error, gpointer source_tag)
+{
+	GSimpleAsyncResult *simple;
+	GError *local_error = NULL;
+	EClientAsyncOpData *async_data;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
+	g_return_val_if_fail (result != NULL, FALSE);
+	g_return_val_if_fail (source_tag != NULL, FALSE);
+	g_return_val_if_fail (out_strv != NULL, FALSE);
+	g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (client), source_tag), FALSE);
+
+	simple = G_SIMPLE_ASYNC_RESULT (result);
+
+	if (g_simple_async_result_propagate_error (simple, &local_error)) {
+		e_client_unwrap_dbus_error (client, local_error, error);
+		return FALSE;
+	}
+
+	async_data = g_simple_async_result_get_op_res_gpointer (simple);
+	g_return_val_if_fail (async_data != NULL, FALSE);
+
+	*out_strv = async_data->out.val_strv;
+	async_data->out.val_strv = NULL;
+
+	return async_data->result;
+}
+
+gboolean
+e_client_proxy_call_finish_uint (EClient *client, GAsyncResult *result, guint *out_uint, GError **error, gpointer source_tag)
+{
+	GSimpleAsyncResult *simple;
+	GError *local_error = NULL;
+	EClientAsyncOpData *async_data;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
+	g_return_val_if_fail (result != NULL, FALSE);
+	g_return_val_if_fail (source_tag != NULL, FALSE);
+	g_return_val_if_fail (out_uint != NULL, FALSE);
+	g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (client), source_tag), FALSE);
+
+	simple = G_SIMPLE_ASYNC_RESULT (result);
+
+	if (g_simple_async_result_propagate_error (simple, &local_error)) {
+		e_client_unwrap_dbus_error (client, local_error, error);
+		return FALSE;
+	}
+
+	async_data = g_simple_async_result_get_op_res_gpointer (simple);
+	g_return_val_if_fail (async_data != NULL, FALSE);
+
+	*out_uint = async_data->out.val_uint;
+
+	return async_data->result;
+}
+
+#define SYNC_CALL_TEMPLATE(_out_test,_the_call)			\
+	GDBusProxy *proxy;					\
+	GCancellable *use_cancellable;				\
+	guint32 opid;						\
+	gboolean result;					\
+	GError *local_error = NULL;				\
+								\
+	g_return_val_if_fail (client != NULL, FALSE);		\
+	g_return_val_if_fail (E_IS_CLIENT (client), FALSE);	\
+	g_return_val_if_fail (func != NULL, FALSE);		\
+	g_return_val_if_fail (_out_test != NULL, FALSE);	\
+								\
+	proxy = e_client_get_dbus_proxy (client);		\
+	g_return_val_if_fail (proxy != NULL, FALSE);		\
+								\
+	use_cancellable = cancellable;				\
+	if (!use_cancellable)					\
+		use_cancellable = g_cancellable_new ();		\
+								\
+	g_object_ref (client);					\
+	opid = e_client_register_op (client, use_cancellable);	\
+								\
+	result = func _the_call;				\
+								\
+	e_client_unregister_op (client, opid);			\
+	g_object_unref (client);				\
+								\
+	if (use_cancellable != cancellable)			\
+		g_object_unref (use_cancellable);		\
+								\
+	e_client_unwrap_dbus_error (client, local_error, error);\
+								\
+	return result;
+
+gboolean
+e_client_proxy_call_sync_void__void (EClient *client, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, GCancellable *cancellable, GError **error))
+{
+	SYNC_CALL_TEMPLATE (client, (proxy, use_cancellable, &local_error))
+}
+
+gboolean
+e_client_proxy_call_sync_void__boolean (EClient *client, gboolean *out_boolean, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, gboolean *out_boolean, GCancellable *cancellable, GError **error))
+{
+	SYNC_CALL_TEMPLATE (out_boolean, (proxy, out_boolean, use_cancellable, &local_error))
+}
+
+gboolean
+e_client_proxy_call_sync_void__string (EClient *client, gchar **out_string, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, gchar **out_string, GCancellable *cancellable, GError **error))
+{
+	SYNC_CALL_TEMPLATE (out_string, (proxy, out_string, use_cancellable, &local_error))
+}
+
+gboolean
+e_client_proxy_call_sync_void__strv (EClient *client, gchar ***out_strv, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, gchar ***out_strv, GCancellable *cancellable, GError **error))
+{
+	SYNC_CALL_TEMPLATE (out_strv, (proxy, out_strv, use_cancellable, &local_error))
+}
+
+gboolean
+e_client_proxy_call_sync_void__uint (EClient *client, guint *out_uint, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, guint *out_uint, GCancellable *cancellable, GError **error))
+{
+	SYNC_CALL_TEMPLATE (out_uint, (proxy, out_uint, use_cancellable, &local_error))
+}
+
+gboolean
+e_client_proxy_call_sync_boolean__void (EClient *client, gboolean in_boolean, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, gboolean in_boolean, GCancellable *cancellable, GError **error))
+{
+	SYNC_CALL_TEMPLATE (client, (proxy, in_boolean, use_cancellable, &local_error))
+}
+
+gboolean
+e_client_proxy_call_sync_boolean__boolean (EClient *client, gboolean in_boolean, gboolean *out_boolean, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, gboolean in_boolean, gboolean *out_boolean, GCancellable *cancellable, GError **error))
+{
+	SYNC_CALL_TEMPLATE (out_boolean, (proxy, in_boolean, out_boolean, use_cancellable, &local_error))
+}
+
+gboolean
+e_client_proxy_call_sync_boolean__string (EClient *client, gboolean in_boolean, gchar **out_string, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, gboolean in_boolean, gchar **out_string, GCancellable *cancellable, GError **error))
+{
+	SYNC_CALL_TEMPLATE (out_string, (proxy, in_boolean, out_string, use_cancellable, &local_error))
+}
+
+gboolean
+e_client_proxy_call_sync_boolean__strv (EClient *client, gboolean in_boolean, gchar ***out_strv, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, gboolean in_boolean, gchar ***out_strv, GCancellable *cancellable, GError **error))
+{
+	SYNC_CALL_TEMPLATE (out_strv, (proxy, in_boolean, out_strv, use_cancellable, &local_error))
+}
+
+gboolean
+e_client_proxy_call_sync_boolean__uint (EClient *client, gboolean in_boolean, guint *out_uint, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, gboolean in_boolean, guint *out_uint, GCancellable *cancellable, GError **error))
+{
+	SYNC_CALL_TEMPLATE (out_uint, (proxy, in_boolean, out_uint, use_cancellable, &local_error))
+}
+
+gboolean
+e_client_proxy_call_sync_string__void (EClient *client, const gchar *in_string, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, const gchar *in_string, GCancellable *cancellable, GError **error))
+{
+	SYNC_CALL_TEMPLATE (client, (proxy, in_string, use_cancellable, &local_error))
+}
+
+gboolean
+e_client_proxy_call_sync_string__boolean (EClient *client, const gchar *in_string, gboolean *out_boolean, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, const gchar *in_string, gboolean *out_boolean, GCancellable *cancellable, GError **error))
+{
+	SYNC_CALL_TEMPLATE (out_boolean, (proxy, in_string, out_boolean, use_cancellable, &local_error))
+}
+
+gboolean
+e_client_proxy_call_sync_string__string (EClient *client, const gchar *in_string, gchar **out_string, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, const gchar *in_string, gchar **out_string, GCancellable *cancellable, GError **error))
+{
+	SYNC_CALL_TEMPLATE (out_string, (proxy, in_string, out_string, use_cancellable, &local_error))
+}
+
+gboolean
+e_client_proxy_call_sync_string__strv (EClient *client, const gchar *in_string, gchar ***out_strv, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, const gchar *in_string, gchar ***out_strv, GCancellable *cancellable, GError **error))
+{
+	SYNC_CALL_TEMPLATE (out_strv, (proxy, in_string, out_strv, use_cancellable, &local_error))
+}
+
+gboolean
+e_client_proxy_call_sync_string__uint (EClient *client, const gchar *in_string, guint *out_uint, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, const gchar *in_string, guint *out_uint, GCancellable *cancellable, GError **error))
+{
+	SYNC_CALL_TEMPLATE (out_uint, (proxy, in_string, out_uint, use_cancellable, &local_error))
+}
+
+gboolean
+e_client_proxy_call_sync_strv__void (EClient *client, const gchar * const *in_strv, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, const gchar * const *in_strv, GCancellable *cancellable, GError **error))
+{
+	SYNC_CALL_TEMPLATE (client, (proxy, in_strv, use_cancellable, &local_error))
+}
+
+gboolean
+e_client_proxy_call_sync_strv__boolean (EClient *client, const gchar * const *in_strv, gboolean *out_boolean, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, const gchar * const *in_strv, gboolean *out_boolean, GCancellable *cancellable, GError **error))
+{
+	SYNC_CALL_TEMPLATE (out_boolean, (proxy, in_strv, out_boolean, use_cancellable, &local_error))
+}
+
+gboolean
+e_client_proxy_call_sync_strv__string (EClient *client, const gchar * const *in_strv, gchar **out_string, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, const gchar * const *in_strv, gchar **out_string, GCancellable *cancellable, GError **error))
+{
+	SYNC_CALL_TEMPLATE (out_string, (proxy, in_strv, out_string, use_cancellable, &local_error))
+}
+
+gboolean
+e_client_proxy_call_sync_strv__strv (EClient *client, const gchar * const *in_strv, gchar ***out_strv, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, const gchar * const *in_strv, gchar ***out_strv, GCancellable *cancellable, GError **error))
+{
+	SYNC_CALL_TEMPLATE (out_strv, (proxy, in_strv, out_strv, use_cancellable, &local_error))
+}
+
+gboolean
+e_client_proxy_call_sync_strv__uint (EClient *client, const gchar * const *in_strv, guint *out_uint, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, const gchar * const *in_strv, guint *out_uint, GCancellable *cancellable, GError **error))
+{
+	SYNC_CALL_TEMPLATE (out_uint, (proxy, in_strv, out_uint, use_cancellable, &local_error))
+}
+
+gboolean
+e_client_proxy_call_sync_uint__void (EClient *client, guint in_uint, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, guint in_uint, GCancellable *cancellable, GError **error))
+{
+	SYNC_CALL_TEMPLATE (client, (proxy, in_uint, use_cancellable, &local_error))
+}
+
+gboolean
+e_client_proxy_call_sync_uint__boolean (EClient *client, guint in_uint, gboolean *out_boolean, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, guint in_uint, gboolean *out_boolean, GCancellable *cancellable, GError **error))
+{
+	SYNC_CALL_TEMPLATE (out_boolean, (proxy, in_uint, out_boolean, use_cancellable, &local_error))
+}
+
+gboolean
+e_client_proxy_call_sync_uint__string (EClient *client, guint in_uint, gchar **out_string, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, guint in_uint, gchar **out_string, GCancellable *cancellable, GError **error))
+{
+	SYNC_CALL_TEMPLATE (out_string, (proxy, in_uint, out_string, use_cancellable, &local_error))
+}
+
+gboolean
+e_client_proxy_call_sync_uint__strv (EClient *client, guint in_uint, gchar ***out_strv, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, guint in_uint, gchar ***out_strv, GCancellable *cancellable, GError **error))
+{
+	SYNC_CALL_TEMPLATE (out_strv, (proxy, in_uint, out_strv, use_cancellable, &local_error))
+}
+
+gboolean
+e_client_proxy_call_sync_uint__uint (EClient *client, guint in_uint, guint *out_uint, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, guint in_uint, guint *out_uint, GCancellable *cancellable, GError **error))
+{
+	SYNC_CALL_TEMPLATE (out_uint, (proxy, in_uint, out_uint, use_cancellable, &local_error))
+}
+
+#undef SYNC_CALL_TEMPLATE
diff --git a/libedataserver/e-client.h b/libedataserver/e-client.h
new file mode 100644
index 0000000..04ece4b
--- /dev/null
+++ b/libedataserver/e-client.h
@@ -0,0 +1,168 @@
+/*
+ * e-client.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#ifndef E_CLIENT_H
+#define E_CLIENT_H
+
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <libedataserver/e-credentials.h>
+#include <libedataserver/e-source.h>
+#include <libedataserver/e-source-list.h>
+
+#define E_TYPE_CLIENT		(e_client_get_type ())
+#define E_CLIENT(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_CLIENT, EClient))
+#define E_CLIENT_CLASS(k)	(G_TYPE_CHECK_CLASS_CAST ((k), E_TYPE_CLIENT, EClientClass))
+#define E_IS_CLIENT(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_CLIENT))
+#define E_IS_CLIENT_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_CLIENT))
+#define E_CLIENT_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_CLIENT, EClientClass))
+
+typedef struct _EClient        EClient;
+typedef struct _EClientClass   EClientClass;
+typedef struct _EClientPrivate EClientPrivate;
+
+struct _EClient {
+	GObject parent;
+
+	/*< private >*/
+	EClientPrivate *priv;
+};
+
+struct _EClientClass {
+	GObjectClass parent;
+
+	/* virtual methods */
+	GDBusProxy *	(* get_dbus_proxy) (EClient *client);
+	void		(* unwrap_dbus_error) (EClient *client, GError *dbus_error, GError **out_error);
+
+	guint32		(* open) (EClient *client, gboolean only_if_exists, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+	gboolean	(* open_finish) (EClient *client, GAsyncResult *result, GError **error);
+	gboolean	(* open_sync) (EClient *client, gboolean only_if_exists, GCancellable *cancellable, GError **error);
+
+	guint32		(* remove) (EClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+	gboolean	(* remove_finish) (EClient *client, GAsyncResult *result, GError **error);
+	gboolean	(* remove_sync) (EClient *client, GCancellable *cancellable, GError **error);
+
+	void		(* handle_authentication) (EClient *client, const ECredentials *credentials);
+	gchar *		(* retrieve_capabilities) (EClient *client);
+
+	/* signals */
+	gboolean	(* authenticate) (EClient *client, ECredentials *credentials);
+	void		(* backend_error) (EClient *client, const gchar *error_msg);
+	void		(* backend_died) (EClient *client);
+};
+
+GType		e_client_get_type		(void);
+
+ESource *	e_client_get_source		(EClient *client);
+const gchar *	e_client_get_uri		(EClient *client);
+const GSList *	e_client_get_capabilities	(EClient *client);
+gboolean	e_client_check_capability	(EClient *client, const gchar *capability);
+gboolean	e_client_is_readonly		(EClient *client);
+gboolean	e_client_is_online		(EClient *client);
+gboolean	e_client_is_opened		(EClient *client);
+
+void		e_client_cancel_op		(EClient *client, guint32 opid);
+void		e_client_cancel_all		(EClient *client);
+
+guint32		e_client_open			(EClient *client, gboolean only_if_exists, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_client_open_finish		(EClient *client, GAsyncResult *result, GError **error);
+gboolean	e_client_open_sync		(EClient *client, gboolean only_if_exists, GCancellable *cancellable, GError **error);
+
+guint32		e_client_remove			(EClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_client_remove_finish		(EClient *client, GAsyncResult *result, GError **error);
+gboolean	e_client_remove_sync		(EClient *client, GCancellable *cancellable, GError **error);
+
+/* utility functions */
+gchar **	e_client_util_slist_to_strv	(const GSList *strings);
+GSList *	e_client_util_strv_to_slist	(const gchar * const *strv);
+void		e_client_util_free_string_slist	(GSList *strings);
+void		e_client_util_free_object_slist	(GSList *objects);
+GSList *	e_client_util_parse_capabilities(const gchar *capabilities);
+
+/* protected functions */
+void		e_client_set_capabilities	(EClient *client, const gchar *capabilities);
+void		e_client_set_readonly		(EClient *client, gboolean readonly);
+void		e_client_set_online		(EClient *client, gboolean is_online);
+guint32		e_client_register_op		(EClient *client, GCancellable *cancellable);
+void		e_client_unregister_op		(EClient *client, guint32 opid);
+void		e_client_process_authentication	(EClient *client, const ECredentials *credentials);
+
+gboolean	e_client_emit_authenticate	(EClient *client, ECredentials *credentials);
+void		e_client_emit_backend_error	(EClient *client, const gchar *error_msg);
+void		e_client_emit_backend_died	(EClient *client);
+
+ESource *	e_client_util_get_system_source	(ESourceList *source_list);
+gboolean	e_client_util_set_default	(ESourceList *source_list, ESource *source);
+ESource *	e_client_util_get_source_for_uri(ESourceList *source_list, const gchar *uri);
+
+/* protected functions simplifying sync/async calls */
+GDBusProxy *	e_client_get_dbus_proxy		(EClient *client);
+void		e_client_unwrap_dbus_error	(EClient *client, GError *dbus_error, GError **out_error);
+
+typedef gboolean (* EClientProxyFinishVoidFunc)		(GDBusProxy *proxy, GAsyncResult *result, GError **error);
+typedef gboolean (* EClientProxyFinishBooleanFunc)	(GDBusProxy *proxy, GAsyncResult *result, gboolean *out_boolean, GError **error);
+typedef gboolean (* EClientProxyFinishStringFunc)	(GDBusProxy *proxy, GAsyncResult *result, gchar **out_string, GError **error);
+typedef gboolean (* EClientProxyFinishStrvFunc)		(GDBusProxy *proxy, GAsyncResult *result, gchar ***out_strv, GError **error);
+typedef gboolean (* EClientProxyFinishUintFunc)		(GDBusProxy *proxy, GAsyncResult *result, guint *out_uint, GError **error);
+
+guint32		e_client_proxy_call_void	(EClient *client, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data, gpointer source_tag, void (*func) (GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data), EClientProxyFinishVoidFunc finish_void, EClientProxyFinishBooleanFunc finish_boolean, EClientProxyFinishStringFunc finish_string, EClientProxyFinishStrvFunc finish_strv, EClientProxyFinishUintFunc finish_uint);
+guint32		e_client_proxy_call_boolean	(EClient *client, gboolean in_boolean, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data, gpointer source_tag, void (*func) (GDBusProxy *proxy, gboolean in_boolean, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data), EClientProxyFinishVoidFunc finish_void, EClientProxyFinishBooleanFunc finish_boolean, EClientProxyFinishStringFunc finish_string, EClientProxyFinishStrvFunc finish_strv, EClientProxyFinishUintFunc finish_uint);
+guint32		e_client_proxy_call_string	(EClient *client, const gchar *in_string, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data, gpointer source_tag, void (*func) (GDBusProxy *proxy, const gchar * in_string, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data), EClientProxyFinishVoidFunc finish_void, EClientProxyFinishBooleanFunc finish_boolean, EClientProxyFinishStringFunc finish_string, EClientProxyFinishStrvFunc finish_strv, EClientProxyFinishUintFunc finish_uint);
+guint32		e_client_proxy_call_strv	(EClient *client, const gchar * const *in_strv, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data, gpointer source_tag, void (*func) (GDBusProxy *proxy, const gchar * const * in_strv, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data), EClientProxyFinishVoidFunc finish_void, EClientProxyFinishBooleanFunc finish_boolean, EClientProxyFinishStringFunc finish_string, EClientProxyFinishStrvFunc finish_strv, EClientProxyFinishUintFunc finish_uint);
+guint32		e_client_proxy_call_uint	(EClient *client, guint in_uint, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data, gpointer source_tag, void (*func) (GDBusProxy *proxy, guint in_uint, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data), EClientProxyFinishVoidFunc finish_void, EClientProxyFinishBooleanFunc finish_boolean, EClientProxyFinishStringFunc finish_string, EClientProxyFinishStrvFunc finish_strv, EClientProxyFinishUintFunc finish_uint);
+
+gboolean	e_client_proxy_call_finish_void		(EClient *client, GAsyncResult *result, GError **error, gpointer source_tag);
+gboolean	e_client_proxy_call_finish_boolean	(EClient *client, GAsyncResult *result, gboolean *out_boolean, GError **error, gpointer source_tag);
+gboolean	e_client_proxy_call_finish_string	(EClient *client, GAsyncResult *result, gchar **out_string, GError **error, gpointer source_tag);
+gboolean	e_client_proxy_call_finish_strv		(EClient *client, GAsyncResult *result, gchar ***out_strv, GError **error, gpointer source_tag);
+gboolean	e_client_proxy_call_finish_uint		(EClient *client, GAsyncResult *result, guint *out_uint, GError **error, gpointer source_tag);
+
+gboolean	e_client_proxy_call_sync_void__void		(EClient *client, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, GCancellable *cancellable, GError **error));
+gboolean	e_client_proxy_call_sync_void__boolean		(EClient *client, gboolean *out_boolean, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, gboolean *out_boolean, GCancellable *cancellable, GError **error));
+gboolean	e_client_proxy_call_sync_void__string		(EClient *client, gchar **out_string, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, gchar **out_string, GCancellable *cancellable, GError **error));
+gboolean	e_client_proxy_call_sync_void__strv		(EClient *client, gchar ***out_strv, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, gchar ***out_strv, GCancellable *cancellable, GError **error));
+gboolean	e_client_proxy_call_sync_void__uint		(EClient *client, guint *out_uint, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, guint *out_uint, GCancellable *cancellable, GError **error));
+gboolean	e_client_proxy_call_sync_boolean__void		(EClient *client, gboolean in_boolean, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, gboolean in_boolean, GCancellable *cancellable, GError **error));
+gboolean	e_client_proxy_call_sync_boolean__boolean	(EClient *client, gboolean in_boolean, gboolean *out_boolean, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, gboolean in_boolean, gboolean *out_boolean, GCancellable *cancellable, GError **error));
+gboolean	e_client_proxy_call_sync_boolean__string	(EClient *client, gboolean in_boolean, gchar **out_string, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, gboolean in_boolean, gchar **out_string, GCancellable *cancellable, GError **error));
+gboolean	e_client_proxy_call_sync_boolean__strv		(EClient *client, gboolean in_boolean, gchar ***out_strv, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, gboolean in_boolean, gchar ***out_strv, GCancellable *cancellable, GError **error));
+gboolean	e_client_proxy_call_sync_boolean__uint		(EClient *client, gboolean in_boolean, guint *out_uint, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, gboolean in_boolean, guint *out_uint, GCancellable *cancellable, GError **error));
+gboolean	e_client_proxy_call_sync_string__void		(EClient *client, const gchar *in_string, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, const gchar *in_string, GCancellable *cancellable, GError **error));
+gboolean	e_client_proxy_call_sync_string__boolean	(EClient *client, const gchar *in_string, gboolean *out_boolean, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, const gchar *in_string, gboolean *out_boolean, GCancellable *cancellable, GError **error));
+gboolean	e_client_proxy_call_sync_string__string		(EClient *client, const gchar *in_string, gchar **out_string, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, const gchar *in_string, gchar **out_string, GCancellable *cancellable, GError **error));
+gboolean	e_client_proxy_call_sync_string__strv		(EClient *client, const gchar *in_string, gchar ***out_strv, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, const gchar *in_string, gchar ***out_strv, GCancellable *cancellable, GError **error));
+gboolean	e_client_proxy_call_sync_string__uint		(EClient *client, const gchar *in_string, guint *out_uint, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, const gchar *in_string, guint *out_uint, GCancellable *cancellable, GError **error));
+gboolean	e_client_proxy_call_sync_strv__void		(EClient *client, const gchar * const *in_strv, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, const gchar * const *in_strv, GCancellable *cancellable, GError **error));
+gboolean	e_client_proxy_call_sync_strv__boolean		(EClient *client, const gchar * const *in_strv, gboolean *out_boolean, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, const gchar * const *in_strv, gboolean *out_boolean, GCancellable *cancellable, GError **error));
+gboolean	e_client_proxy_call_sync_strv__string		(EClient *client, const gchar * const *in_strv, gchar **out_string, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, const gchar * const *in_strv, gchar **out_string, GCancellable *cancellable, GError **error));
+gboolean	e_client_proxy_call_sync_strv__strv		(EClient *client, const gchar * const *in_strv, gchar ***out_strv, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, const gchar * const *in_strv, gchar ***out_strv, GCancellable *cancellable, GError **error));
+gboolean	e_client_proxy_call_sync_strv__uint		(EClient *client, const gchar * const *in_strv, guint *out_uint, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, const gchar * const *in_strv, guint *out_uint, GCancellable *cancellable, GError **error));
+gboolean	e_client_proxy_call_sync_uint__void		(EClient *client, guint in_uint, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, guint in_uint, GCancellable *cancellable, GError **error));
+gboolean	e_client_proxy_call_sync_uint__boolean		(EClient *client, guint in_uint, gboolean *out_boolean, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, guint in_uint, gboolean *out_boolean, GCancellable *cancellable, GError **error));
+gboolean	e_client_proxy_call_sync_uint__string		(EClient *client, guint in_uint, gchar **out_string, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, guint in_uint, gchar **out_string, GCancellable *cancellable, GError **error));
+gboolean	e_client_proxy_call_sync_uint__strv		(EClient *client, guint in_uint, gchar ***out_strv, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, guint in_uint, gchar ***out_strv, GCancellable *cancellable, GError **error));
+gboolean	e_client_proxy_call_sync_uint__uint		(EClient *client, guint in_uint, guint *out_uint, GCancellable *cancellable, GError **error, gboolean (*func) (GDBusProxy *proxy, guint in_uint, guint *out_uint, GCancellable *cancellable, GError **error));
+
+G_END_DECLS
+
+#endif /* E_CLIENT_H */
diff --git a/libedataserver/e-credentials.c b/libedataserver/e-credentials.c
new file mode 100644
index 0000000..ab4910c
--- /dev/null
+++ b/libedataserver/e-credentials.c
@@ -0,0 +1,560 @@
+/*
+ * e-credentials.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "e-data-server-util.h"
+
+#include "e-credentials.h"
+
+struct _ECredentialsPrivate
+{
+	GHashTable *keys;
+	GHashTable *peek_keys;
+};
+
+static gboolean
+key_equal (gconstpointer str1, gconstpointer str2)
+{
+	g_return_val_if_fail (str1 != NULL, FALSE);
+	g_return_val_if_fail (str2 != NULL, FALSE);
+
+	if (str1 == str2)
+		return TRUE;
+
+	return g_ascii_strcasecmp (str1, str2) == 0;
+}
+
+ECredentials *
+e_credentials_new (void)
+{
+	ECredentials *credentials;
+
+	credentials = g_new0 (ECredentials, 1);
+	credentials->priv = g_new0 (ECredentialsPrivate, 1);
+	credentials->priv->keys = g_hash_table_new_full (g_str_hash, key_equal, g_free, (GDestroyNotify) e_credentials_util_safe_free_string);
+	credentials->priv->peek_keys = g_hash_table_new_full (g_str_hash, key_equal, g_free, (GDestroyNotify) e_credentials_util_safe_free_string);
+
+	return credentials;
+}
+
+/* Expects @keys as NULL terminate list of strings "key:encoded_value".
+   The same can be returned from e_credentials_to_strv().
+*/
+ECredentials *
+e_credentials_new_strv (const gchar * const *keys)
+{
+	ECredentials *credentials;
+	gint ii;
+
+	g_return_val_if_fail (keys != NULL, NULL);
+
+	credentials = e_credentials_new ();
+
+	for (ii = 0; keys[ii]; ii++) {
+		const gchar *key = keys[ii], *sep;
+
+		sep = strchr (key, ':');
+
+		/* skip empty and invalid values */
+		if (sep)
+			g_hash_table_insert (credentials->priv->keys, g_strndup (key, sep - key), g_strdup (sep + 1));
+	}
+
+	return credentials;
+}
+
+/* NULL-terminated list of string pairs <key, value>; value is in a clear form */
+ECredentials *
+e_credentials_new_args	(const gchar *key, ...)
+{
+	ECredentials *credentials;
+	va_list va;
+
+	g_return_val_if_fail (key != NULL, NULL);
+
+	credentials = e_credentials_new ();
+
+	va_start (va, key);
+
+	while (key) {
+		const gchar *value = va_arg (va, const gchar *);
+
+		if (key && *key && value && *value)
+			e_credentials_set (credentials, key, value);
+
+		key = va_arg (va, const gchar *);
+	}
+
+	va_end (va);
+
+	return credentials;
+}
+
+static void
+copy_keys_cb (gpointer key, gpointer value, gpointer hash_table)
+{
+	g_hash_table_insert (hash_table, g_strdup (key), g_strdup (value));
+}
+
+ECredentials *
+e_credentials_new_clone	(const ECredentials *credentials)
+{
+	ECredentials *res;
+
+	g_return_val_if_fail (credentials != NULL, NULL);
+	g_return_val_if_fail (credentials->priv != NULL, NULL);
+	g_return_val_if_fail (credentials->priv->keys != NULL, NULL);
+
+	res = e_credentials_new ();
+
+	g_hash_table_foreach (credentials->priv->keys, copy_keys_cb, res->priv->keys);
+
+	return res;
+}
+
+void
+e_credentials_free (ECredentials *credentials)
+{
+	if (!credentials)
+		return;
+
+	g_return_if_fail (credentials->priv != NULL);
+
+	g_hash_table_destroy (credentials->priv->keys);
+	g_hash_table_destroy (credentials->priv->peek_keys);
+	g_free (credentials->priv);
+	g_free (credentials);
+}
+
+static void
+add_to_array_cb (gpointer key, gpointer value, gpointer ptr_array)
+{
+	if (key && value && ptr_array) {
+		gchar *str = g_strconcat (key, ":", value, NULL);
+
+		g_ptr_array_add (ptr_array, e_util_utf8_make_valid (str));
+
+		g_free (str);
+	}
+}
+
+/* Returns NULL-terminated array of strings with keys and encoded values;
+   To read them back pass this pointer to e_credentials_new(). As it returns
+   newly allocated string then this should be freed with g_strfreev()
+   when no longer needed.
+*/
+gchar **
+e_credentials_to_strv (const ECredentials *credentials)
+{
+	GPtrArray *array;
+
+	g_return_val_if_fail (credentials != NULL, NULL);
+	g_return_val_if_fail (credentials->priv != NULL, NULL);
+	g_return_val_if_fail (credentials->priv->keys != NULL, NULL);
+
+	array = g_ptr_array_sized_new (g_hash_table_size (credentials->priv->keys) + 1);
+
+	g_hash_table_foreach (credentials->priv->keys, add_to_array_cb, array);
+
+	/* NULL-terminated */
+	g_ptr_array_add (array, NULL);
+
+	return (gchar **) g_ptr_array_free (array, FALSE);
+}
+
+static gchar *
+encode_string (const gchar *decoded)
+{
+	gsize len, ii;
+	guchar xval, *copy;
+	gchar *res;
+
+	if (!decoded || !*decoded)
+		return NULL;
+
+	copy = (guchar *) g_strdup (decoded);
+	len = strlen ((const gchar *) copy);
+
+	xval = 17;
+	for (ii = 0; ii < len; ii++) {
+		copy[ii] = copy[ii] ^ xval;
+		xval += 17;
+	}
+
+	res = g_base64_encode (copy, len);
+
+	g_free (copy);
+
+	return res;
+}
+
+static gchar *
+decode_string (const gchar *encoded)
+{
+	guchar *data, xval;
+	gsize len = 0, ii;
+	gchar *res;
+
+	g_return_val_if_fail (encoded != NULL, NULL);
+	g_return_val_if_fail (*encoded, NULL);
+
+	data = g_base64_decode (encoded, &len);
+	g_return_val_if_fail (data != NULL, NULL);
+	g_return_val_if_fail (len > 0, NULL);
+
+	xval = 17;
+	for (ii = 0; ii < len; ii++) {
+		data[ii] = data[ii] ^ xval;
+		xval += 17;
+	}
+
+	res = g_strndup ((const gchar *) data, len);
+
+	e_credentials_util_safe_free_string ((gchar *) data);
+
+	return res;
+}
+
+/* sets value for a key, if value is NULL or an empty string then the key is removed.
+   the value is supposed to be in a clear form (unencoded).
+   'key' cannot contain colon.
+*/
+void
+e_credentials_set (ECredentials *credentials, const gchar *key, const gchar *value)
+{
+	g_return_if_fail (credentials != NULL);
+	g_return_if_fail (credentials->priv != NULL);
+	g_return_if_fail (credentials->priv->keys != NULL);
+	g_return_if_fail (credentials->priv->peek_keys != NULL);
+	g_return_if_fail (key != NULL);
+	g_return_if_fail (*key);
+	g_return_if_fail (strchr (key, ':') == NULL);
+
+	g_hash_table_remove (credentials->priv->peek_keys, key);
+
+	if (!value) {
+		g_hash_table_remove (credentials->priv->keys, key);
+	} else {
+		g_hash_table_insert (credentials->priv->keys, g_strdup (key), encode_string (value));
+	}
+}
+
+/* Returned pointer should be freed with e_credentials_util_safe_free_string()
+   when no longer needed.
+*/
+gchar *
+e_credentials_get (const ECredentials *credentials, const gchar *key)
+{
+	const gchar *stored;
+
+	g_return_val_if_fail (credentials != NULL, NULL);
+	g_return_val_if_fail (credentials->priv != NULL, NULL);
+	g_return_val_if_fail (credentials->priv->keys != NULL, NULL);
+	g_return_val_if_fail (key != NULL, NULL);
+	g_return_val_if_fail (*key, NULL);
+
+	stored = g_hash_table_lookup (credentials->priv->keys, key);
+	if (!stored)
+		return NULL;
+
+	return decode_string (stored);
+}
+
+/* peeks value for a key, in a clear form. The value is valid until free
+   of the @credentials structure or until the key value is rewritten
+   by e_credentials_set()
+*/
+const gchar *
+e_credentials_peek (ECredentials *credentials, const gchar *key)
+{
+	gchar *value;
+
+	g_return_val_if_fail (credentials != NULL, NULL);
+	g_return_val_if_fail (credentials->priv != NULL, NULL);
+	g_return_val_if_fail (credentials->priv->peek_keys != NULL, NULL);
+	g_return_val_if_fail (key != NULL, NULL);
+	g_return_val_if_fail (*key, NULL);
+
+	value = g_hash_table_lookup (credentials->priv->peek_keys, key);
+	if (value)
+		return value;
+
+	value = e_credentials_get (credentials, key);
+	if (value)
+		g_hash_table_insert (credentials->priv->peek_keys, g_strdup (key), value);
+
+	return value;
+}
+
+struct equal_data
+{
+	gboolean equal;
+	GHashTable *keys;
+};
+
+static void
+check_equal_cb (gpointer key, gpointer value, gpointer user_data)
+{
+	struct equal_data *ed = user_data;
+
+	g_return_if_fail (ed != NULL);
+	g_return_if_fail (ed->keys != NULL);
+	g_return_if_fail (key != NULL);
+	g_return_if_fail (value != NULL);
+
+	ed->equal = ed->equal && g_strcmp0 (value, g_hash_table_lookup (ed->keys, key)) == 0;
+}
+
+/* Returns whether two credential structurs contain the same keys with same values */
+gboolean
+e_credentials_equal (const ECredentials *credentials1, const ECredentials *credentials2)
+{
+	struct equal_data ed;
+
+	if (!credentials1 && !credentials2)
+		return TRUE;
+
+	if (credentials1 == credentials2)
+		return TRUE;
+
+	if (!credentials1 || !credentials2)
+		return FALSE;
+
+	g_return_val_if_fail (credentials1->priv != NULL, FALSE);
+	g_return_val_if_fail (credentials1->priv->keys != NULL, FALSE);
+	g_return_val_if_fail (credentials2->priv != NULL, FALSE);
+	g_return_val_if_fail (credentials2->priv->keys != NULL, FALSE);
+
+	if (g_hash_table_size (credentials1->priv->keys) != g_hash_table_size (credentials2->priv->keys))
+		return FALSE;
+
+	ed.equal = TRUE;
+	ed.keys = credentials2->priv->keys;
+
+	g_hash_table_foreach (credentials1->priv->keys, check_equal_cb, &ed);
+
+	return ed.equal;
+}
+
+/* Returns whether two credentials structures has same keys. Key names are NULL-terminated. */
+gboolean
+e_credentials_equal_keys (const ECredentials *credentials1, const ECredentials *credentials2, const gchar *key1, ...)
+{
+	va_list va;
+	gboolean equal = TRUE;
+
+	g_return_val_if_fail (credentials1 != NULL, FALSE);
+	g_return_val_if_fail (credentials1->priv != NULL, FALSE);
+	g_return_val_if_fail (credentials1->priv->keys != NULL, FALSE);
+	g_return_val_if_fail (credentials2 != NULL, FALSE);
+	g_return_val_if_fail (credentials2->priv != NULL, FALSE);
+	g_return_val_if_fail (credentials2->priv->keys != NULL, FALSE);
+	g_return_val_if_fail (key1 != NULL, FALSE);
+
+	va_start (va, key1);
+
+	while (key1 && equal) {
+		equal = g_strcmp0 (g_hash_table_lookup (credentials1->priv->keys, key1), g_hash_table_lookup (credentials2->priv->keys, key1)) == 0;
+
+		key1 = va_arg (va, const gchar *);
+	}
+
+	va_end (va);
+
+	return equal;
+}	
+
+/**
+ * Returns whether @credentials contains @key.
+ * This key is non-NULL and non-empty string.
+ **/
+gboolean
+e_credentials_has_key (const ECredentials *credentials, const gchar *key)
+{
+	g_return_val_if_fail (credentials != NULL, FALSE);
+	g_return_val_if_fail (credentials->priv != NULL, FALSE);
+	g_return_val_if_fail (credentials->priv->keys != NULL, FALSE);
+	g_return_val_if_fail (key != NULL, FALSE);
+	g_return_val_if_fail (*key, FALSE);
+
+	return g_hash_table_lookup (credentials->priv->keys, key) != NULL;
+}
+
+guint
+e_credentials_keys_size (const ECredentials *credentials)
+{
+	g_return_val_if_fail (credentials != NULL, 0);
+	g_return_val_if_fail (credentials->priv != NULL, 0);
+	g_return_val_if_fail (credentials->priv->keys != NULL, 0);
+
+	return g_hash_table_size (credentials->priv->keys);
+}
+
+static void
+gather_key_names (gpointer key, gpointer value, gpointer pslist)
+{
+	GSList **slist = pslist;
+
+	g_return_if_fail (pslist != NULL);
+	g_return_if_fail (key != NULL);
+
+	*slist = g_slist_prepend (*slist, key);
+}
+
+/* Returns newly allocated list of key names stored in the credentials strucutre;
+   strings are internal credentials values, only the list is newly allocated.
+   Free the list with g_slist_free() when no longer needed.
+*/
+GSList *
+e_credentials_list_keys	(const ECredentials *credentials)
+{
+	GSList *keys = NULL;
+
+	g_return_val_if_fail (credentials != NULL, NULL);
+	g_return_val_if_fail (credentials->priv != NULL, NULL);
+	g_return_val_if_fail (credentials->priv->keys != NULL, NULL);
+
+	g_hash_table_foreach (credentials->priv->keys, gather_key_names, &keys);
+
+	return g_slist_reverse (keys);
+}
+
+/* Removes all keys in once. */
+void
+e_credentials_clear (ECredentials *credentials)
+{
+	g_return_if_fail (credentials != NULL);
+	g_return_if_fail (credentials->priv != NULL);
+	g_return_if_fail (credentials->priv->keys != NULL);
+	g_return_if_fail (credentials->priv->peek_keys != NULL);
+
+	g_hash_table_remove_all (credentials->priv->peek_keys);
+	g_hash_table_remove_all (credentials->priv->keys);
+}
+
+void
+e_credentials_clear_peek (ECredentials *credentials)
+{
+	g_return_if_fail (credentials != NULL);
+	g_return_if_fail (credentials->priv != NULL);
+	g_return_if_fail (credentials->priv->peek_keys != NULL);
+
+	g_hash_table_remove_all (credentials->priv->peek_keys);
+}
+
+void
+e_credentials_util_safe_free_string (gchar *str)
+{
+	if (!str)
+		return;
+
+	if (*str)
+		memset (str, 0, sizeof (gchar) * strlen (str));
+
+	g_free (str);
+}
+
+static struct _PromptFlags {
+	ECredentialsPromptFlags flag_uint;
+	const gchar *flag_string;
+	gboolean is_bit_flag; /* if false, then checked against E_CREDENTIALS_PROMPT_FLAG_REMEMBER_MASK */
+} PromptFlags[] = {
+	{ E_CREDENTIALS_PROMPT_FLAG_REMEMBER_NEVER,	"remember-never",	FALSE },
+	{ E_CREDENTIALS_PROMPT_FLAG_REMEMBER_SESSION,	"remember-session",	FALSE },
+	{ E_CREDENTIALS_PROMPT_FLAG_REMEMBER_FOREVER,	"remember-forever",	FALSE },
+
+	{ E_CREDENTIALS_PROMPT_FLAG_SECRET,		"secret",		TRUE },
+	{ E_CREDENTIALS_PROMPT_FLAG_REPROMPT,		"reprompt",		TRUE },
+	{ E_CREDENTIALS_PROMPT_FLAG_ONLINE,		"online",		TRUE },
+	{ E_CREDENTIALS_PROMPT_FLAG_DISABLE_REMEMBER,	"disable-remember",	TRUE },
+	{ E_CREDENTIALS_PROMPT_FLAG_PASSPHRASE,		"passphrase",		TRUE }
+};
+
+/* Returned pointer can be passed to e_credentials_util_string_to prompt_flags()
+   to decode it back to flags. Free returned pointer with g_free().
+*/
+gchar *
+e_credentials_util_prompt_flags_to_string (guint prompt_flags)
+{
+	gint ii;
+	guint masked = prompt_flags & E_CREDENTIALS_PROMPT_FLAG_REMEMBER_MASK;
+	GString *str = g_string_new ("");
+
+	for (ii = 0; ii < G_N_ELEMENTS (PromptFlags); ii++) {
+		const gchar *add = NULL;
+
+		if (PromptFlags[ii].is_bit_flag) {
+			if ((prompt_flags & PromptFlags[ii].flag_uint) != 0)
+				add = PromptFlags[ii].flag_string;
+		} else if (masked == PromptFlags[ii].flag_uint) {
+			add = PromptFlags[ii].flag_string;
+		}
+
+		if (!add)
+			continue;
+
+		if (str->len)
+			g_string_append (str, ",");
+
+		g_string_append (str, add);
+	}
+
+	return g_string_free (str, FALSE);
+}
+
+guint
+e_credentials_util_string_to_prompt_flags (const gchar *prompt_flags_string)
+{
+	gchar **strv;
+	gint ii, jj;
+	guint flags = 0;
+
+	if (!prompt_flags_string || !*prompt_flags_string)
+		return flags;
+
+	strv = g_strsplit (prompt_flags_string, ",", -1);
+	if (!strv)
+		return flags;
+
+	for (jj = 0; strv[jj]; jj++) {
+		const gchar *str = strv[jj];
+
+		for (ii = 0; ii < G_N_ELEMENTS (PromptFlags); ii++) {
+			if (g_str_equal (PromptFlags[ii].flag_string, str)) {
+				if (PromptFlags[ii].is_bit_flag)
+					flags |= PromptFlags[ii].flag_uint;
+				else
+					flags = (flags & (~E_CREDENTIALS_PROMPT_FLAG_REMEMBER_MASK)) | PromptFlags[ii].flag_uint;
+			}
+		}
+	}
+
+	g_strfreev (strv);
+
+	return flags;
+}
diff --git a/libedataserver/e-credentials.h b/libedataserver/e-credentials.h
new file mode 100644
index 0000000..223e344
--- /dev/null
+++ b/libedataserver/e-credentials.h
@@ -0,0 +1,86 @@
+/*
+ * e-credentials.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#ifndef E_CREDENTIALS_H
+#define E_CREDENTIALS_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef struct _ECredentialsPrivate ECredentialsPrivate;
+
+typedef struct _ECredentials
+{
+	ECredentialsPrivate *priv;
+} ECredentials;
+
+#define E_CREDENTIALS_KEY_USERNAME	"username"
+#define E_CREDENTIALS_KEY_PASSWORD	"password"
+#define E_CREDENTIALS_KEY_AUTH_METHOD	"auth-method"
+#define E_CREDENTIALS_KEY_AUTH_DOMAIN	"auth-domain"
+#define E_CREDENTIALS_KEY_PROMPT_TITLE	"prompt-title"
+#define E_CREDENTIALS_KEY_PROMPT_TEXT	"prompt-text"
+#define E_CREDENTIALS_KEY_PROMPT_KEY	"prompt-key"
+#define E_CREDENTIALS_KEY_PROMPT_FLAGS	"prompt-flags"
+
+#define E_CREDENTIALS_AUTH_DOMAIN_ADDRESSBOOK	"Addressbook"
+#define E_CREDENTIALS_AUTH_DOMAIN_CALENDAR	"Calendar"
+#define E_CREDENTIALS_AUTH_DOMAIN_MAIL		"Mail"
+
+/* this is 1:1 with EPasswordsRememberType */
+typedef enum {
+	E_CREDENTIALS_PROMPT_FLAG_REMEMBER_NEVER,
+	E_CREDENTIALS_PROMPT_FLAG_REMEMBER_SESSION,
+	E_CREDENTIALS_PROMPT_FLAG_REMEMBER_FOREVER,
+	E_CREDENTIALS_PROMPT_FLAG_REMEMBER_MASK = 0xf,
+
+	E_CREDENTIALS_PROMPT_FLAG_SECRET = 1 << 8, /* whether hide password letters in the UI */
+	E_CREDENTIALS_PROMPT_FLAG_REPROMPT = 1 << 9, /* automatically set when username and password is provided */
+	E_CREDENTIALS_PROMPT_FLAG_ONLINE = 1 << 10, /* only ask if we're online */
+	E_CREDENTIALS_PROMPT_FLAG_DISABLE_REMEMBER = 1 << 11, /* disable the 'remember password' checkbox */
+	E_CREDENTIALS_PROMPT_FLAG_PASSPHRASE = 1 << 12 /* We are asking a passphrase */
+} ECredentialsPromptFlags;
+
+ECredentials *	e_credentials_new	(void);
+ECredentials *	e_credentials_new_strv	(const gchar * const *strv);
+ECredentials *	e_credentials_new_args	(const gchar *key, ...) G_GNUC_NULL_TERMINATED;
+ECredentials *	e_credentials_new_clone	(const ECredentials *credentials);
+void		e_credentials_free	(      ECredentials *credentials);
+gchar **	e_credentials_to_strv	(const ECredentials *credentials);
+void		e_credentials_set	(      ECredentials *credentials, const gchar *key, const gchar *value);
+gchar *		e_credentials_get	(const ECredentials *credentials, const gchar *key);
+const gchar *	e_credentials_peek	(      ECredentials *credentials, const gchar *key);
+gboolean	e_credentials_equal	(const ECredentials *credentials1, const ECredentials *credentials2);
+gboolean	e_credentials_equal_keys(const ECredentials *credentials1, const ECredentials *credentials2, const gchar *key1, ...) G_GNUC_NULL_TERMINATED;
+gboolean	e_credentials_has_key	(const ECredentials *credentials, const gchar *key);
+guint		e_credentials_keys_size	(const ECredentials *credentials);
+GSList *	e_credentials_list_keys	(const ECredentials *credentials);
+void		e_credentials_clear	(      ECredentials *credentials);
+void		e_credentials_clear_peek(      ECredentials *credentials);
+
+void		e_credentials_util_safe_free_string (gchar *str);
+gchar *		e_credentials_util_prompt_flags_to_string (guint prompt_flags); /* bit-or of ECredentialsPromptFlags */
+guint		e_credentials_util_string_to_prompt_flags (const gchar *prompt_flags_string); /* bit-or of ECredentialsPromptFlags */
+
+G_END_DECLS
+
+#endif /* E_CREDENTIALS_H */
diff --git a/libedataserver/e-data-server-util.c b/libedataserver/e-data-server-util.c
index 0c62df7..0afc955 100644
--- a/libedataserver/e-data-server-util.c
+++ b/libedataserver/e-data-server-util.c
@@ -910,3 +910,87 @@ e_data_server_util_get_dbus_call_timeout (void)
 {
 	return default_dbus_timeout;
 }
+
+G_LOCK_DEFINE_STATIC (ptr_tracker);
+static GHashTable *ptr_tracker = NULL;
+
+static void
+dump_left_ptrs_cb (gpointer ptr, gpointer info, gpointer user_data)
+{
+	g_print ("      %p %s%s%s", ptr, info ? "(" : "", info ? (const gchar *) info : "", info ? ")" : "");
+}
+
+static void
+dump_tracked_ptrs (gboolean is_at_exit)
+{
+	G_LOCK (ptr_tracker);
+
+	if (ptr_tracker) {
+		g_print ("\n----------------------------------------------------------\n");
+		if (g_hash_table_size (ptr_tracker) == 0) {
+			g_print ("   All tracked pointers were properly removed\n");
+		} else {
+			g_print ("   Left %d tracked pointers:\n", g_hash_table_size (ptr_tracker));
+			g_hash_table_foreach (ptr_tracker, dump_left_ptrs_cb, NULL);
+		}
+		g_print ("----------------------------------------------------------\n");
+	} else if (!is_at_exit) {
+		g_print ("\n----------------------------------------------------------\n");
+		g_print ("   Did not track any pointers yet\n");
+		g_print ("----------------------------------------------------------\n");
+	}
+
+	G_UNLOCK (ptr_tracker);
+}
+
+static void
+dump_left_at_exit_cb (void)
+{
+	dump_tracked_ptrs (TRUE);
+
+	G_LOCK (ptr_tracker);
+	if (ptr_tracker) {
+		g_hash_table_destroy (ptr_tracker);
+		ptr_tracker = NULL;
+	}
+	G_UNLOCK (ptr_tracker);
+}
+
+void
+e_pointer_tracker_track_with_info (gpointer ptr, const gchar *info)
+{
+	g_return_if_fail (ptr != NULL);
+
+	G_LOCK (ptr_tracker);
+	if (!ptr_tracker) {
+		ptr_tracker = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free);
+		g_atexit (dump_left_at_exit_cb);
+	}
+
+	g_hash_table_insert (ptr_tracker, ptr, g_strdup (info));
+
+	G_UNLOCK (ptr_tracker);
+}
+
+void
+e_pointer_tracker_untrack (gpointer ptr)
+{
+	g_return_if_fail (ptr != NULL);
+
+	G_LOCK (ptr_tracker);
+
+	if (!ptr_tracker)
+		g_printerr ("Pointer tracker not initialized, thus cannot remove %p\n", ptr);
+	else if (!g_hash_table_lookup (ptr_tracker, ptr))
+		g_printerr ("Pointer %p is not tracked\n", ptr);
+	else
+		g_hash_table_remove (ptr_tracker, ptr);
+
+	G_UNLOCK (ptr_tracker);
+}
+
+void
+e_pointer_tracker_dump (void)
+{
+	dump_tracked_ptrs (FALSE);
+}
diff --git a/libedataserver/e-data-server-util.h b/libedataserver/e-data-server-util.h
index 0fa514d..0a52578 100644
--- a/libedataserver/e-data-server-util.h
+++ b/libedataserver/e-data-server-util.h
@@ -73,6 +73,11 @@ gint		e_data_server_util_get_dbus_call_timeout
 void		e_data_server_util_set_dbus_call_timeout
 						(gint timeout_msec);
 
+#define		e_pointer_tracker_track(ptr) e_pointer_tracker_track_with_info (ptr, G_STRFUNC)
+void		e_pointer_tracker_track_with_info (gpointer ptr, const gchar *info);
+void		e_pointer_tracker_untrack (gpointer ptr);
+void		e_pointer_tracker_dump (void);
+
 G_END_DECLS
 
 #endif /* E_DATA_SERVER_UTIL_H */
diff --git a/addressbook/libegdbus/e-gdbus-marshallers.list b/libedataserver/e-gdbus-marshallers.list
similarity index 55%
rename from addressbook/libegdbus/e-gdbus-marshallers.list
rename to libedataserver/e-gdbus-marshallers.list
index 46f24d4..9bf81c4 100644
--- a/addressbook/libegdbus/e-gdbus-marshallers.list
+++ b/libedataserver/e-gdbus-marshallers.list
@@ -1,10 +1,13 @@
-BOOLEAN:OBJECT,STRING
-VOID:BOXED
-VOID:STRING
-VOID:UINT,STRING
+BOOLEAN:POINTER
 BOOLEAN:OBJECT
-VOID:BOOLEAN
 BOOLEAN:OBJECT,BOOLEAN
-BOOLEAN:OBJECT,STRING,STRING,STRING
 BOOLEAN:OBJECT,BOXED
-BOOLEAN:OBJECT,STRING,UINT
+BOOLEAN:OBJECT,STRING
+BOOLEAN:OBJECT,UINT
+VOID:UINT,BOXED
+VOID:UINT,BOXED,STRING
+VOID:UINT,BOXED,BOXED
+VOID:UINT,STRING
+
+VOID:BOXED
+VOID:STRING
diff --git a/libedataserver/e-gdbus-templates.c b/libedataserver/e-gdbus-templates.c
new file mode 100644
index 0000000..bf0f01c
--- /dev/null
+++ b/libedataserver/e-gdbus-templates.c
@@ -0,0 +1,1663 @@
+/*
+ * e-gdbus-templates.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gio/gio.h>
+
+#include <stdio.h>
+
+#include "e-data-server-util.h"
+#include "e-flag.h"
+#include "e-gdbus-templates.h"
+
+gboolean
+e_gdbus_signal_emission_hook_void (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, const gchar *signal_name, const gchar *iface_name)
+{
+	GObject *object;
+	GDBusConnection *connection;
+	const gchar *path;
+
+	if (n_param_values < 1 || !G_VALUE_HOLDS (&param_values[0], G_TYPE_OBJECT))
+		return FALSE;
+
+	object = g_value_get_object (&param_values[0]);
+	path = g_object_get_data (object, "gdbus-codegen-path");
+	connection = g_object_get_data (object, "gdbus-codegen-connection");
+	if (connection == NULL || path == NULL)
+		return FALSE;
+
+	g_dbus_connection_emit_signal (connection, NULL, path, iface_name, signal_name, NULL, NULL);
+
+	return TRUE;
+}
+
+gboolean
+e_gdbus_signal_emission_hook_boolean (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, const gchar *signal_name, const gchar *iface_name)
+{
+	GObject *object;
+	GDBusConnection *connection;
+	const gchar *path;
+	GVariant *params;
+	GVariant *item;
+	GVariantBuilder *builder;
+
+	if (n_param_values < 1 || !G_VALUE_HOLDS (&param_values[0], G_TYPE_OBJECT))
+		return FALSE;
+
+	object = g_value_get_object (&param_values[0]);
+	path = g_object_get_data (object, "gdbus-codegen-path");
+	connection = g_object_get_data (object, "gdbus-codegen-connection");
+	if (connection == NULL || path == NULL)
+		return FALSE;
+
+	builder = g_variant_builder_new (G_VARIANT_TYPE_TUPLE);
+	g_assert_cmpint (n_param_values - 1, ==, 1);
+	param_values++;
+	item = g_variant_new_boolean (g_value_get_boolean (param_values));
+	g_variant_builder_add_value (builder, item);
+	param_values++;
+	params = g_variant_builder_end (builder);
+	g_variant_builder_unref (builder);
+
+	g_dbus_connection_emit_signal (connection, NULL, path, iface_name, signal_name, params, NULL);
+
+	return TRUE;
+}
+
+gboolean
+e_gdbus_signal_emission_hook_string (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, const gchar *signal_name, const gchar *iface_name)
+{
+	GObject *object;
+	GDBusConnection *connection;
+	const gchar *path;
+	GVariant *params;
+	GVariant *item;
+	GVariantBuilder *builder;
+
+	if (n_param_values < 1 || !G_VALUE_HOLDS (&param_values[0], G_TYPE_OBJECT))
+		return FALSE;
+
+	object = g_value_get_object (&param_values[0]);
+	path = g_object_get_data (object, "gdbus-codegen-path");
+	connection = g_object_get_data (object, "gdbus-codegen-connection");
+	if (connection == NULL || path == NULL)
+		return FALSE;
+
+	builder = g_variant_builder_new (G_VARIANT_TYPE_TUPLE);
+	g_assert_cmpint (n_param_values - 1, ==, 1);
+	param_values++;
+	item = g_variant_new_string (g_value_get_string (param_values));
+	g_variant_builder_add_value (builder, item);
+	param_values++;
+	params = g_variant_builder_end (builder);
+	g_variant_builder_unref (builder);
+
+	g_dbus_connection_emit_signal (connection, NULL, path, iface_name, signal_name, params, NULL);
+
+	return TRUE;
+}
+
+gboolean
+e_gdbus_signal_emission_hook_strv (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, const gchar *signal_name, const gchar *iface_name)
+{
+	GObject *object;
+	GDBusConnection *connection;
+	const gchar *path;
+	GVariant *params;
+	GVariant *item;
+	GVariantBuilder *builder;
+	const gchar * const *arg_strv;
+
+	if (n_param_values < 1 || !G_VALUE_HOLDS (&param_values[0], G_TYPE_OBJECT))
+		return FALSE;
+
+	object = g_value_get_object (&param_values[0]);
+	path = g_object_get_data (object, "gdbus-codegen-path");
+	connection = g_object_get_data (object, "gdbus-codegen-connection");
+	if (connection == NULL || path == NULL)
+		return FALSE;
+
+	builder = g_variant_builder_new (G_VARIANT_TYPE_TUPLE);
+	g_assert_cmpint (n_param_values - 1, ==, 1);
+	param_values++;
+	arg_strv = g_value_get_boxed (param_values);
+	item = g_variant_new_strv (arg_strv, -1);
+	g_variant_builder_add_value (builder, item);
+	param_values++;
+	params = g_variant_builder_end (builder);
+	g_variant_builder_unref (builder);
+
+	g_dbus_connection_emit_signal (connection, NULL, path, iface_name, signal_name, params, NULL);
+
+	return TRUE;
+}
+
+gboolean
+e_gdbus_signal_emission_hook_uint (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, const gchar *signal_name, const gchar *iface_name)
+{
+	GObject *object;
+	GDBusConnection *connection;
+	const gchar *path;
+	GVariant *params;
+	GVariant *item;
+	GVariantBuilder *builder;
+
+	if (n_param_values < 1 || !G_VALUE_HOLDS (&param_values[0], G_TYPE_OBJECT))
+		return FALSE;
+
+	object = g_value_get_object (&param_values[0]);
+	path = g_object_get_data (object, "gdbus-codegen-path");
+	connection = g_object_get_data (object, "gdbus-codegen-connection");
+	if (connection == NULL || path == NULL)
+		return FALSE;
+
+	builder = g_variant_builder_new (G_VARIANT_TYPE_TUPLE);
+	g_assert_cmpint (n_param_values - 1, ==, 1);
+	param_values++;
+	item = g_variant_new_uint32 (g_value_get_uint (param_values));
+	g_variant_builder_add_value (builder, item);
+	param_values++;
+	params = g_variant_builder_end (builder);
+	g_variant_builder_unref (builder);
+
+	g_dbus_connection_emit_signal (connection, NULL, path, iface_name, signal_name, params, NULL);
+
+	return TRUE;
+}
+
+gboolean
+e_gdbus_signal_emission_hook_uint_string (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, const gchar *signal_name, const gchar *iface_name)
+{
+	GObject *object;
+	GDBusConnection *connection;
+	const gchar *path;
+	GVariant *params;
+	GVariant *item;
+	GVariantBuilder *builder;
+
+	if (n_param_values < 1 || !G_VALUE_HOLDS (&param_values[0], G_TYPE_OBJECT))
+		return FALSE;
+
+	object = g_value_get_object (&param_values[0]);
+	path = g_object_get_data (object, "gdbus-codegen-path");
+	connection = g_object_get_data (object, "gdbus-codegen-connection");
+	if (connection == NULL || path == NULL)
+		return FALSE;
+
+	builder = g_variant_builder_new (G_VARIANT_TYPE_TUPLE);
+	g_assert_cmpint (n_param_values - 1, ==, 2);
+	param_values++;
+	item = g_variant_new_uint32 (g_value_get_uint (param_values));
+	g_variant_builder_add_value (builder, item);
+	param_values++;
+	item = g_variant_new_string (g_value_get_string (param_values));
+	g_variant_builder_add_value (builder, item);
+	param_values++;
+	params = g_variant_builder_end (builder);
+	g_variant_builder_unref (builder);
+
+	g_dbus_connection_emit_signal (connection, NULL, path, iface_name, signal_name, params, NULL);
+
+	return TRUE;
+}
+
+gboolean
+e_gdbus_signal_emission_hook_async_void (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, const gchar *signal_name, const gchar *iface_name)
+{
+	GObject *object;
+	GDBusConnection *connection;
+	const gchar *path;
+	GVariant *params;
+	GVariant *item;
+	GVariantBuilder *builder;
+	GError *arg_error;
+
+	if (n_param_values < 1 || !G_VALUE_HOLDS (&param_values[0], G_TYPE_OBJECT))
+		return FALSE;
+
+	object = g_value_get_object (&param_values[0]);
+	path = g_object_get_data (object, "gdbus-codegen-path");
+	connection = g_object_get_data (object, "gdbus-codegen-connection");
+	if (connection == NULL || path == NULL)
+		return FALSE;
+
+	builder = g_variant_builder_new (G_VARIANT_TYPE_TUPLE);
+	g_assert_cmpint (n_param_values - 1, ==, 2);
+	param_values++;
+	item = g_variant_new_uint32 (g_value_get_uint (param_values));
+	g_variant_builder_add_value (builder, item);
+	param_values++;
+	arg_error = g_value_get_boxed (param_values);
+	if (arg_error) {
+		gchar *dbus_error_name = g_dbus_error_encode_gerror (arg_error);
+		item = g_variant_new_string (dbus_error_name ? dbus_error_name : "");
+		g_variant_builder_add_value (builder, item);
+		item = g_variant_new_string (arg_error->message);
+		g_variant_builder_add_value (builder, item);
+		g_free (dbus_error_name);
+	} else {
+		item = g_variant_new_string ("");
+		g_variant_builder_add_value (builder, item);
+		item = g_variant_new_string ("");
+		g_variant_builder_add_value (builder, item);
+	}
+	param_values++;
+	params = g_variant_builder_end (builder);
+	g_variant_builder_unref (builder);
+
+	g_dbus_connection_emit_signal (connection, NULL, path, iface_name, signal_name, params, NULL);
+
+	return TRUE;
+}
+
+gboolean
+e_gdbus_signal_emission_hook_async_boolean (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, const gchar *signal_name, const gchar *iface_name)
+{
+	GObject *object;
+	GDBusConnection *connection;
+	const gchar *path;
+	GVariant *params;
+	GVariant *item;
+	GVariantBuilder *builder;
+	GError *arg_error;
+
+	if (n_param_values < 1 || !G_VALUE_HOLDS (&param_values[0], G_TYPE_OBJECT))
+		return FALSE;
+
+	object = g_value_get_object (&param_values[0]);
+	path = g_object_get_data (object, "gdbus-codegen-path");
+	connection = g_object_get_data (object, "gdbus-codegen-connection");
+	if (connection == NULL || path == NULL)
+		return FALSE;
+
+	builder = g_variant_builder_new (G_VARIANT_TYPE_TUPLE);
+	g_assert_cmpint (n_param_values - 1, ==, 3);
+	param_values++;
+	item = g_variant_new_uint32 (g_value_get_uint (param_values));
+	g_variant_builder_add_value (builder, item);
+	param_values++;
+	arg_error = g_value_get_boxed (param_values);
+	if (arg_error) {
+		gchar *dbus_error_name = g_dbus_error_encode_gerror (arg_error);
+		item = g_variant_new_string (dbus_error_name ? dbus_error_name : "");
+		g_variant_builder_add_value (builder, item);
+		item = g_variant_new_string (arg_error->message);
+		g_variant_builder_add_value (builder, item);
+		g_free (dbus_error_name);
+	} else {
+		item = g_variant_new_string ("");
+		g_variant_builder_add_value (builder, item);
+		item = g_variant_new_string ("");
+		g_variant_builder_add_value (builder, item);
+	}
+	param_values++;
+	item = g_variant_new_boolean (g_value_get_boolean (param_values));
+	g_variant_builder_add_value (builder, item);
+	param_values++;
+	params = g_variant_builder_end (builder);
+	g_variant_builder_unref (builder);
+
+	g_dbus_connection_emit_signal (connection, NULL, path, iface_name, signal_name, params, NULL);
+
+	return TRUE;
+}
+
+gboolean
+e_gdbus_signal_emission_hook_async_string (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, const gchar *signal_name, const gchar *iface_name)
+{
+	GObject *object;
+	GDBusConnection *connection;
+	const gchar *path;
+	GVariant *params;
+	GVariant *item;
+	GVariantBuilder *builder;
+	GError *arg_error;
+
+	if (n_param_values < 1 || !G_VALUE_HOLDS (&param_values[0], G_TYPE_OBJECT))
+		return FALSE;
+
+	object = g_value_get_object (&param_values[0]);
+	path = g_object_get_data (object, "gdbus-codegen-path");
+	connection = g_object_get_data (object, "gdbus-codegen-connection");
+	if (connection == NULL || path == NULL)
+		return FALSE;
+
+	builder = g_variant_builder_new (G_VARIANT_TYPE_TUPLE);
+	g_assert_cmpint (n_param_values - 1, ==, 3);
+	param_values++;
+	item = g_variant_new_uint32 (g_value_get_uint (param_values));
+	g_variant_builder_add_value (builder, item);
+	param_values++;
+	arg_error = g_value_get_boxed (param_values);
+	if (arg_error) {
+		gchar *dbus_error_name = g_dbus_error_encode_gerror (arg_error);
+		item = g_variant_new_string (dbus_error_name ? dbus_error_name : "");
+		g_variant_builder_add_value (builder, item);
+		item = g_variant_new_string (arg_error->message);
+		g_variant_builder_add_value (builder, item);
+		g_free (dbus_error_name);
+	} else {
+		item = g_variant_new_string ("");
+		g_variant_builder_add_value (builder, item);
+		item = g_variant_new_string ("");
+		g_variant_builder_add_value (builder, item);
+	}
+	param_values++;
+	item = g_variant_new_string (g_value_get_string (param_values));
+	g_variant_builder_add_value (builder, item);
+	param_values++;
+	params = g_variant_builder_end (builder);
+	g_variant_builder_unref (builder);
+
+	g_dbus_connection_emit_signal (connection, NULL, path, iface_name, signal_name, params, NULL);
+
+	return TRUE;
+}
+
+gboolean
+e_gdbus_signal_emission_hook_async_strv (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, const gchar *signal_name, const gchar *iface_name)
+{
+	GObject *object;
+	GDBusConnection *connection;
+	const gchar *path;
+	GVariant *params;
+	GVariant *item;
+	GVariantBuilder *builder;
+	const GError *arg_error;
+	const gchar * const *arg_strv;
+
+	if (n_param_values < 1 || !G_VALUE_HOLDS (&param_values[0], G_TYPE_OBJECT))
+		return FALSE;
+
+	object = g_value_get_object (&param_values[0]);
+	path = g_object_get_data (object, "gdbus-codegen-path");
+	connection = g_object_get_data (object, "gdbus-codegen-connection");
+	if (connection == NULL || path == NULL)
+		return FALSE;
+
+	builder = g_variant_builder_new (G_VARIANT_TYPE_TUPLE);
+	g_assert_cmpint (n_param_values - 1, ==, 3);
+	param_values++;
+	item = g_variant_new_uint32 (g_value_get_uint (param_values));
+	g_variant_builder_add_value (builder, item);
+	param_values++;
+	arg_error = g_value_get_boxed (param_values);
+	if (arg_error) {
+		gchar *dbus_error_name = g_dbus_error_encode_gerror (arg_error);
+		item = g_variant_new_string (dbus_error_name ? dbus_error_name : "");
+		g_variant_builder_add_value (builder, item);
+		item = g_variant_new_string (arg_error->message);
+		g_variant_builder_add_value (builder, item);
+		g_free (dbus_error_name);
+	} else {
+		item = g_variant_new_string ("");
+		g_variant_builder_add_value (builder, item);
+		item = g_variant_new_string ("");
+		g_variant_builder_add_value (builder, item);
+	}
+	param_values++;
+	arg_strv = g_value_get_boxed (param_values);
+	item = g_variant_new_strv (arg_strv, -1);
+	g_variant_builder_add_value (builder, item);
+	param_values++;
+	params = g_variant_builder_end (builder);
+	g_variant_builder_unref (builder);
+
+	g_dbus_connection_emit_signal (connection, NULL, path, iface_name, signal_name, params, NULL);
+
+	return TRUE;
+}
+
+gboolean
+e_gdbus_signal_emission_hook_async_uint (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, const gchar *signal_name, const gchar *iface_name)
+{
+	GObject *object;
+	GDBusConnection *connection;
+	const gchar *path;
+	GVariant *params;
+	GVariant *item;
+	GVariantBuilder *builder;
+	GError *arg_error;
+
+	if (n_param_values < 1 || !G_VALUE_HOLDS (&param_values[0], G_TYPE_OBJECT))
+		return FALSE;
+
+	object = g_value_get_object (&param_values[0]);
+	path = g_object_get_data (object, "gdbus-codegen-path");
+	connection = g_object_get_data (object, "gdbus-codegen-connection");
+	if (connection == NULL || path == NULL)
+		return FALSE;
+
+	builder = g_variant_builder_new (G_VARIANT_TYPE_TUPLE);
+	g_assert_cmpint (n_param_values - 1, ==, 3);
+	param_values++;
+	item = g_variant_new_uint32 (g_value_get_uint (param_values));
+	g_variant_builder_add_value (builder, item);
+	param_values++;
+	arg_error = g_value_get_boxed (param_values);
+	if (arg_error) {
+		gchar *dbus_error_name = g_dbus_error_encode_gerror (arg_error);
+		item = g_variant_new_string (dbus_error_name ? dbus_error_name : "");
+		g_variant_builder_add_value (builder, item);
+		item = g_variant_new_string (arg_error->message);
+		g_variant_builder_add_value (builder, item);
+		g_free (dbus_error_name);
+	} else {
+		item = g_variant_new_string ("");
+		g_variant_builder_add_value (builder, item);
+		item = g_variant_new_string ("");
+		g_variant_builder_add_value (builder, item);
+	}
+	param_values++;
+	item = g_variant_new_uint32 (g_value_get_uint (param_values));
+	g_variant_builder_add_value (builder, item);
+	param_values++;
+	params = g_variant_builder_end (builder);
+	g_variant_builder_unref (builder);
+
+	g_dbus_connection_emit_signal (connection, NULL, path, iface_name, signal_name, params, NULL);
+
+	return TRUE;
+}
+
+void
+e_gdbus_proxy_emit_signal (GDBusProxy *proxy, GVariant *parameters, guint signal_id, guint signal_type)
+{
+	gboolean arg_boolean = FALSE;
+	const gchar *arg_const_string = NULL;
+	const gchar **arg_const_strv = NULL;
+	guint arg_uint = 0;
+
+	g_return_if_fail (proxy != NULL);
+
+	if ((signal_type & E_GDBUS_TYPE_IS_ASYNC) != 0) {
+		/* the signal is a done signal, thus opid and error name with error message are first two parameters */
+		guint arg_opid = 0;
+		const gchar *dbus_error_name = NULL, *dbus_error_message = NULL;
+		GError *arg_error = NULL;
+
+		signal_type = signal_type & (~E_GDBUS_TYPE_IS_ASYNC);
+		switch (signal_type) {
+		case E_GDBUS_TYPE_VOID:
+			g_variant_get (parameters, "(u&s&s)", &arg_opid, &dbus_error_name, &dbus_error_message);
+			break;
+		case E_GDBUS_TYPE_BOOLEAN:
+			g_variant_get (parameters, "(u&s&sb)", &arg_opid, &dbus_error_name, &dbus_error_message, &arg_boolean);
+			break;
+		case E_GDBUS_TYPE_STRING:
+			g_variant_get (parameters, "(u&s&s&s)", &arg_opid, &dbus_error_name, &dbus_error_message, &arg_const_string);
+			break;
+		case E_GDBUS_TYPE_STRV:
+			/* array is newly allocated, but items are gvariant's */
+			g_variant_get (parameters, "(u&s&s^a&s)", &arg_opid, &dbus_error_name, &dbus_error_message, &arg_const_strv);
+			break;
+		case E_GDBUS_TYPE_UINT:
+			g_variant_get (parameters, "(u&s&su)", &arg_opid, &dbus_error_name, &dbus_error_message, &arg_uint);
+			break;
+		default:
+			g_warning ("%s: Unknown E_GDBUS_TYPE %x", G_STRFUNC, signal_type);
+			return;
+		}
+
+		if (dbus_error_name && *dbus_error_name && dbus_error_message)
+			arg_error = g_dbus_error_new_for_dbus_error (dbus_error_name, dbus_error_message);
+
+		switch (signal_type) {
+		case E_GDBUS_TYPE_VOID:
+			g_signal_emit (proxy, signal_id, 0, arg_opid, arg_error);
+			break;
+		case E_GDBUS_TYPE_BOOLEAN:
+			g_signal_emit (proxy, signal_id, 0, arg_opid, arg_error, arg_boolean);
+			break;
+		case E_GDBUS_TYPE_STRING:
+			g_signal_emit (proxy, signal_id, 0, arg_opid, arg_error, arg_const_string);
+			break;
+		case E_GDBUS_TYPE_STRV:
+			g_signal_emit (proxy, signal_id, 0, arg_opid, arg_error, arg_const_strv);
+			g_free (arg_const_strv);
+			break;
+		case E_GDBUS_TYPE_UINT:
+			g_signal_emit (proxy, signal_id, 0, arg_opid, arg_error, arg_uint);
+			break;
+		default:
+			g_warning ("%s: Unknown E_GDBUS_TYPE %x", G_STRFUNC, signal_type);
+			break;
+		}
+
+		if (arg_error)
+			g_error_free (arg_error);
+	} else {
+		switch (signal_type) {
+		case E_GDBUS_TYPE_VOID:
+			g_signal_emit (proxy, signal_id, 0);
+			break;
+		case E_GDBUS_TYPE_BOOLEAN:
+			g_variant_get (parameters, "(b)", &arg_boolean);
+			g_signal_emit (proxy, signal_id, 0, arg_boolean);
+			break;
+		case E_GDBUS_TYPE_STRING:
+			g_variant_get (parameters, "(&s)", &arg_const_string);
+			g_signal_emit (proxy, signal_id, 0, arg_const_string);
+			break;
+		case E_GDBUS_TYPE_STRV:
+			/* array is newly allocated, but items are gvariant's */
+			g_variant_get (parameters, "(^a&s)", &arg_const_strv);
+			g_signal_emit (proxy, signal_id, 0, arg_const_strv);
+			g_free (arg_const_strv);
+			break;
+		case E_GDBUS_TYPE_UINT:
+			g_variant_get (parameters, "(u)", &arg_uint);
+			g_signal_emit (proxy, signal_id, 0, arg_uint);
+			break;
+		case E_GDBUS_TYPE_UINT | E_GDBUS_TYPE_STRING:
+			g_variant_get (parameters, "(u&s)", &arg_uint, &arg_const_string);
+			g_signal_emit (proxy, signal_id, 0, arg_uint, arg_const_string);
+			break;
+		default:
+			g_warning ("%s: Unknown E_GDBUS_TYPE %x", G_STRFUNC, signal_type);
+			break;
+		}
+	}
+}
+
+void
+e_gdbus_stub_handle_method_call (GObject *stub_object, GDBusMethodInvocation *invocation, GVariant *parameters, const gchar *method_name, guint method_id, guint method_type)
+{
+	gboolean handled = FALSE;
+	gboolean arg_boolean = FALSE;
+	const gchar *arg_const_string = NULL;
+	const gchar ** arg_const_strv = NULL;
+	guint arg_uint = 0;
+
+	g_return_if_fail (stub_object != NULL);
+	g_return_if_fail (method_name != NULL);
+
+	switch (method_type & (~E_GDBUS_TYPE_IS_ASYNC)) {
+	case E_GDBUS_TYPE_VOID:
+		g_signal_emit (stub_object, method_id, 0, invocation, &handled);
+		break;
+	case E_GDBUS_TYPE_BOOLEAN:
+		g_variant_get (parameters, "(b)", &arg_boolean);
+		g_signal_emit (stub_object, method_id, 0, invocation, arg_boolean, &handled);
+		break;
+	case E_GDBUS_TYPE_STRING:
+		g_variant_get (parameters, "(&s)", &arg_const_string);
+		g_signal_emit (stub_object, method_id, 0, invocation, arg_const_string, &handled);
+		break;
+	case E_GDBUS_TYPE_STRV:
+		/* array is newly allocated, but items are gvariant's */
+		g_variant_get (parameters, "(^a&s)", &arg_const_strv);
+		g_signal_emit (stub_object, method_id, 0, invocation, arg_const_strv, &handled);
+		g_free (arg_const_strv);
+		break;
+	case E_GDBUS_TYPE_UINT:
+		g_variant_get (parameters, "(u)", &arg_uint);
+		g_signal_emit (stub_object, method_id, 0, invocation, arg_uint, &handled);
+		break;
+	default:
+		g_warning ("%s: Unknown E_GDBUS_TYPE %x", G_STRFUNC, method_type);
+		break;
+	}
+
+	if (!handled)
+	      g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "Method `%s' is not implemented", method_name);
+}
+
+G_DEFINE_INTERFACE (EGdbusAsyncOpKeeper, e_gdbus_async_op_keeper, G_TYPE_OBJECT)
+
+static void
+e_gdbus_async_op_keeper_default_init (EGdbusAsyncOpKeeperInterface *iface)
+{
+}
+
+/* Created hash table of pending async operations. This can be freed
+   with g_hash_table_destroy() in dispose. Interface asks for this
+   ponter by call of e_gdbus_async_op_keeper_create_pending_ops().
+*/
+GHashTable *
+e_gdbus_async_op_keeper_create_pending_ops (EGdbusAsyncOpKeeper *object)
+{
+	g_return_val_if_fail (object != NULL, NULL);
+	g_return_val_if_fail (E_IS_GDBUS_ASYNC_OP_KEEPER (object), NULL);
+
+	return g_hash_table_new (g_direct_hash, g_direct_equal);
+}
+
+/* Returns hash table of pending async operations previously created
+   by e_gdbus_async_op_keeper_create_pending_ops().
+*/
+GHashTable *
+e_gdbus_async_op_keeper_get_pending_ops (EGdbusAsyncOpKeeper *object)
+{
+	EGdbusAsyncOpKeeperInterface *iface;
+
+	g_return_val_if_fail (E_IS_GDBUS_ASYNC_OP_KEEPER (object), 0);
+
+	iface = E_GDBUS_ASYNC_OP_KEEPER_GET_IFACE (object);
+	g_return_val_if_fail (iface->get_pending_ops != NULL, 0);
+
+	return iface->get_pending_ops (object);
+}
+
+/* synchronously cancels one operation - sends a request from client to the server */
+gboolean
+e_gdbus_async_op_keeper_cancel_op_sync (EGdbusAsyncOpKeeper *object, guint in_opid, GCancellable *cancellable, GError **error)
+{
+	EGdbusAsyncOpKeeperInterface *iface;
+
+	g_return_val_if_fail (E_IS_GDBUS_ASYNC_OP_KEEPER (object), FALSE);
+
+	iface = E_GDBUS_ASYNC_OP_KEEPER_GET_IFACE (object);
+	g_return_val_if_fail (iface->cancel_op_sync != NULL, FALSE);
+
+	return iface->cancel_op_sync (object, in_opid, cancellable, error);
+}
+
+/* Used to finish asynchronous GDBus call - this might be done in the callback
+   as soon as possible; method returns to a caller operation ID which was started */
+void
+e_gdbus_complete_async_method (gpointer object, GDBusMethodInvocation *invocation, guint opid)
+{
+	g_dbus_method_invocation_return_value (invocation, g_variant_new ("(u)", opid));
+}
+
+/* Used to finish synchronous GDBus call - this might be done in the callback
+   as soon as possible */
+void
+e_gdbus_complete_sync_method_void (gpointer object, GDBusMethodInvocation *invocation, const GError *error)
+{
+	if (error)
+		g_dbus_method_invocation_return_gerror (invocation, error);
+	else
+		g_dbus_method_invocation_return_value (invocation, NULL);
+}
+
+void
+e_gdbus_complete_sync_method_boolean (gpointer object, GDBusMethodInvocation *invocation, gboolean out_boolean, const GError *error)
+{
+	if (error)
+		g_dbus_method_invocation_return_gerror (invocation, error);
+	else
+		g_dbus_method_invocation_return_value (invocation, g_variant_new ("(b)", out_boolean));
+}
+
+void
+e_gdbus_complete_sync_method_string (gpointer object, GDBusMethodInvocation *invocation, const gchar *out_string, const GError *error)
+{
+	if (error)
+		g_dbus_method_invocation_return_gerror (invocation, error);
+	else
+		g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", out_string));
+}
+
+void
+e_gdbus_complete_sync_method_strv (gpointer object, GDBusMethodInvocation *invocation, const gchar * const *out_strv, const GError *error)
+{
+	if (error)
+		g_dbus_method_invocation_return_gerror (invocation, error);
+	else
+		g_dbus_method_invocation_return_value (invocation, g_variant_new ("(^as)", out_strv));
+}
+
+void
+e_gdbus_complete_sync_method_uint (gpointer object, GDBusMethodInvocation *invocation, guint out_uint, const GError *error)
+{
+	if (error)
+		g_dbus_method_invocation_return_gerror (invocation, error);
+	else
+		g_dbus_method_invocation_return_value (invocation, g_variant_new ("(u)", out_uint));
+}
+
+typedef struct _AsyncOpData
+{
+	EGdbusAsyncOpKeeper *proxy;
+	guint opid;
+
+	GCancellable *cancellable;
+	gulong cancel_id;
+
+	gpointer async_source_tag;
+	GAsyncReadyCallback async_callback;
+	gpointer async_user_data;
+
+	guint result_type; /* any of E_GDBUS_TYPE_... except of E_GDBUS_TYPE_IS_ASYNC */
+	union {
+		gboolean out_boolean;
+		gchar *out_string;
+		gchar ** out_strv;
+		guint out_uint;
+	} result;
+} AsyncOpData;
+
+
+static void
+async_op_data_free (AsyncOpData *op_data)
+{
+	GHashTable *pending_ops;
+
+	g_return_if_fail (op_data != NULL);
+
+	if (op_data->cancellable) {
+		if (op_data->cancel_id)
+			g_cancellable_disconnect (op_data->cancellable, op_data->cancel_id);
+		g_object_unref (op_data->cancellable);
+	}
+
+	pending_ops = e_gdbus_async_op_keeper_get_pending_ops (E_GDBUS_ASYNC_OP_KEEPER (op_data->proxy));
+	if (pending_ops)
+		g_hash_table_remove (pending_ops, GUINT_TO_POINTER (op_data->opid));
+	g_object_unref (op_data->proxy);
+
+	switch (op_data->result_type) {
+	case E_GDBUS_TYPE_STRING:
+		if (op_data->result.out_string)
+			g_free (op_data->result.out_string);
+		break;
+	case E_GDBUS_TYPE_STRV:
+		if (op_data->result.out_strv)
+			g_strfreev (op_data->result.out_strv);
+		break;
+	}
+
+	g_free (op_data);
+
+	g_return_if_fail (pending_ops != NULL);
+}
+
+static void
+async_op_complete (AsyncOpData *op_data, const GError *error, gboolean in_idle)
+{
+	GSimpleAsyncResult *simple;
+
+	g_return_if_fail (op_data != NULL);
+
+	simple = g_simple_async_result_new (G_OBJECT (op_data->proxy), op_data->async_callback, op_data->async_user_data, op_data->async_source_tag);
+	g_simple_async_result_set_op_res_gpointer (simple, op_data, (GDestroyNotify) async_op_data_free);
+	if (error)
+		g_simple_async_result_set_from_error (simple, error);
+
+	if (in_idle)
+		g_simple_async_result_complete_in_idle (simple);
+	else
+		g_simple_async_result_complete (simple);
+
+	g_object_unref (simple);
+}
+
+static void
+gdbus_op_cancelled_cb (GCancellable *cancellable, AsyncOpData *op_data)
+{
+	GError *call_error = NULL;
+
+	g_return_if_fail (op_data != NULL);
+
+	if (!e_gdbus_async_op_keeper_cancel_op_sync (op_data->proxy, op_data->opid, NULL, &call_error)) {
+		/* only if failed, because otherwise will receive cancelled signal from the server */
+		GError *error = NULL;
+
+		g_return_if_fail (g_cancellable_set_error_if_cancelled (cancellable, &error));
+
+		async_op_complete (op_data, error, TRUE);
+		g_error_free (error);
+	}
+
+	if (call_error) {
+		g_debug ("%s: Failed to cancel operation: %s\n", G_STRFUNC, call_error->message);
+		g_error_free (call_error);
+	}
+}
+
+static void
+gdbus_async_call_opid_ready_cb (GObject *source_proxy, GAsyncResult *result, gpointer user_data)
+{
+	GVariant *_result;
+	GError *error = NULL;
+	AsyncOpData *op_data = user_data;
+
+	_result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_proxy), result, &error);
+
+	if (_result != NULL && !error) {
+		EGdbusAsyncOpKeeper *op_keeper = E_GDBUS_ASYNC_OP_KEEPER (source_proxy);
+		GHashTable *pending_ops;
+		gboolean add_pending = TRUE;
+
+		g_return_if_fail (op_keeper != NULL);
+
+		pending_ops = e_gdbus_async_op_keeper_get_pending_ops (op_keeper);
+		g_return_if_fail (pending_ops != NULL);
+
+		g_variant_get (_result, "(u)", &op_data->opid);
+		g_variant_unref (_result);
+
+		if (op_data->cancellable && !g_cancellable_set_error_if_cancelled (op_data->cancellable, &error))
+			op_data->cancel_id = g_cancellable_connect (op_data->cancellable, G_CALLBACK (gdbus_op_cancelled_cb), op_data, NULL);
+		else
+			add_pending = op_data->cancellable == NULL;
+
+		/* add to pending ops, waiting for associated 'done' signal */
+		if (add_pending)
+			g_hash_table_insert (pending_ops, GUINT_TO_POINTER (op_data->opid), op_data);
+	} else if (_result) {
+		g_variant_unref (_result);
+	}
+
+	if (error) {
+		async_op_complete (op_data, error, FALSE);
+		g_error_free (error);
+	}
+}
+
+static gchar **
+copy_strv (const gchar * const *strv)
+{
+	GPtrArray *array;
+	gint ii;
+
+	array = g_ptr_array_sized_new (g_strv_length ((gchar **) strv) + 1);
+
+	for (ii = 0; strv[ii]; ii++) {
+		g_ptr_array_add (array, g_strdup (strv[ii]));
+	}
+
+	/* NULL-terminated */
+	g_ptr_array_add (array, NULL);
+
+	return (gchar **) g_ptr_array_free (array, FALSE);
+}
+
+static void
+gdbus_proxy_async_method_done (guint e_gdbus_type, gconstpointer out_value, EGdbusAsyncOpKeeper *object, guint arg_opid, const GError *error)
+{
+	AsyncOpData *op_data;
+	GHashTable *pending_ops;
+
+	g_return_if_fail (object != NULL);
+	g_return_if_fail (E_IS_GDBUS_ASYNC_OP_KEEPER (object));
+
+	pending_ops = e_gdbus_async_op_keeper_get_pending_ops (object);
+	g_return_if_fail (pending_ops != NULL);
+
+	op_data = g_hash_table_lookup (pending_ops, GUINT_TO_POINTER (arg_opid));
+	if (!op_data) {
+		g_debug ("%s: Operation %d gone before got done signal for it", G_STRFUNC, arg_opid);
+		return;
+	}
+
+	if (out_value) {
+		op_data->result_type = e_gdbus_type;
+
+		switch (e_gdbus_type) {
+		case E_GDBUS_TYPE_VOID:
+			break;
+		case E_GDBUS_TYPE_BOOLEAN:
+			op_data->result.out_boolean = * ((const gboolean *)out_value);
+			break;
+		case E_GDBUS_TYPE_STRING:
+			op_data->result.out_string = g_strdup ((const gchar *) out_value);
+			break;
+		case E_GDBUS_TYPE_STRV:
+			op_data->result.out_strv = copy_strv ((const gchar * const *) out_value);
+			break;
+		case E_GDBUS_TYPE_UINT:
+			op_data->result.out_uint = * ((const guint *) out_value);
+			break;
+		default:
+			g_warning ("%s: Unknown E_GDBUS_TYPE %x", G_STRFUNC, e_gdbus_type);
+			break;
+		}
+	}
+
+	async_op_complete (op_data, error, TRUE);
+}
+
+void
+e_gdbus_proxy_async_method_done_void (EGdbusAsyncOpKeeper *proxy, guint arg_opid, const GError *error)
+{
+	gdbus_proxy_async_method_done (E_GDBUS_TYPE_VOID, NULL, proxy, arg_opid, error);
+}
+
+void
+e_gdbus_proxy_async_method_done_boolean (EGdbusAsyncOpKeeper *proxy, guint arg_opid, const GError *error, gboolean out_boolean)
+{
+	gdbus_proxy_async_method_done (E_GDBUS_TYPE_BOOLEAN, &out_boolean, proxy, arg_opid, error);
+}
+
+/* takes ownership of the out parameter */
+void
+e_gdbus_proxy_async_method_done_string (EGdbusAsyncOpKeeper *proxy, guint arg_opid, const GError *error, const gchar *out_string)
+{
+	gdbus_proxy_async_method_done (E_GDBUS_TYPE_STRING, out_string, proxy, arg_opid, error);
+}
+
+/* takes ownership of the out parameter */
+void
+e_gdbus_proxy_async_method_done_strv (EGdbusAsyncOpKeeper *proxy, guint arg_opid, const GError *error, const gchar * const *out_strv)
+{
+	gdbus_proxy_async_method_done (E_GDBUS_TYPE_STRV, out_strv, proxy, arg_opid, error);
+}
+
+void
+e_gdbus_proxy_async_method_done_uint (EGdbusAsyncOpKeeper *proxy, guint arg_opid, const GError *error, guint out_uint)
+{
+	gdbus_proxy_async_method_done (E_GDBUS_TYPE_UINT, &out_uint, proxy, arg_opid, error);
+}
+
+/* takes ownership of _params */
+static void
+gdbus_proxy_call_with_params (GVariant *_params, const gchar *method_name, gpointer source_tag, EGdbusAsyncOpKeeper *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	AsyncOpData *op_data;
+
+	op_data = g_new0 (AsyncOpData, 1);
+	op_data->proxy = g_object_ref (proxy);
+	op_data->opid = 0;
+	op_data->async_source_tag = source_tag;
+	op_data->async_callback = callback;
+	op_data->async_user_data = user_data;
+	op_data->cancellable = cancellable;
+	if (op_data->cancellable)
+		g_object_ref (op_data->cancellable);
+
+	g_dbus_proxy_call (G_DBUS_PROXY (proxy), method_name, _params, G_DBUS_CALL_FLAGS_NONE, e_data_server_util_get_dbus_call_timeout (), cancellable, gdbus_async_call_opid_ready_cb, op_data);
+}
+
+void
+e_gdbus_proxy_call_void (const gchar *method_name, gpointer source_tag, EGdbusAsyncOpKeeper *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	gdbus_proxy_call_with_params (NULL, method_name, source_tag, proxy, cancellable, callback, user_data);
+}
+
+void
+e_gdbus_proxy_call_boolean (const gchar *method_name, gpointer source_tag, EGdbusAsyncOpKeeper *proxy, gboolean in_boolean, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	GVariant *_params;
+
+	_params = g_variant_new ("(b)", in_boolean);
+
+	gdbus_proxy_call_with_params (_params, method_name, source_tag, proxy, cancellable, callback, user_data);
+}
+
+void
+e_gdbus_proxy_call_string (const gchar *method_name, gpointer source_tag, EGdbusAsyncOpKeeper *proxy, const gchar *in_string, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	GVariant *_params;
+
+	_params = g_variant_new ("(s)", in_string);
+
+	gdbus_proxy_call_with_params (_params, method_name, source_tag, proxy, cancellable, callback, user_data);
+}
+
+void
+e_gdbus_proxy_call_strv (const gchar *method_name, gpointer source_tag, EGdbusAsyncOpKeeper *proxy, const gchar * const *in_strv, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	GVariant *_params;
+
+	_params = g_variant_new ("(^as)", in_strv);
+
+	gdbus_proxy_call_with_params (_params, method_name, source_tag, proxy, cancellable, callback, user_data);
+}
+
+void
+e_gdbus_proxy_call_uint (const gchar *method_name, gpointer source_tag, EGdbusAsyncOpKeeper *proxy, guint in_uint, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	GVariant *_params;
+
+	_params = g_variant_new ("(u)", in_uint);
+
+	gdbus_proxy_call_with_params (_params, method_name, source_tag, proxy, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_proxy_finish_call_void (EGdbusAsyncOpKeeper *proxy, GAsyncResult *result, GError **error, gpointer source_tag)
+{
+	g_return_val_if_fail (proxy != NULL, FALSE);
+	g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (proxy), source_tag), FALSE);
+
+	return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error);
+}
+
+gboolean
+e_gdbus_proxy_finish_call_boolean (EGdbusAsyncOpKeeper *proxy, GAsyncResult *result, gboolean *out_boolean, GError **error, gpointer source_tag)
+{
+	AsyncOpData *op_data;
+
+	g_return_val_if_fail (proxy != NULL, FALSE);
+	g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (proxy), source_tag), FALSE);
+	g_return_val_if_fail (out_boolean != NULL, FALSE);
+
+	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error))
+		return FALSE;
+
+	op_data = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (result));
+	g_return_val_if_fail (op_data != NULL, FALSE);
+	g_return_val_if_fail (op_data->result_type == E_GDBUS_TYPE_BOOLEAN, FALSE);
+
+	*out_boolean = op_data->result.out_boolean;
+
+	return TRUE;
+}
+
+/* caller takes ownership and responsibility for freeing the out parameter */
+gboolean
+e_gdbus_proxy_finish_call_string (EGdbusAsyncOpKeeper *proxy, GAsyncResult *result, gchar **out_string, GError **error, gpointer source_tag)
+{
+	AsyncOpData *op_data;
+
+	g_return_val_if_fail (proxy != NULL, FALSE);
+	g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (proxy), source_tag), FALSE);
+	g_return_val_if_fail (out_string != NULL, FALSE);
+
+	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error))
+		return FALSE;
+
+	op_data = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (result));
+	g_return_val_if_fail (op_data != NULL, FALSE);
+	g_return_val_if_fail (op_data->result_type == E_GDBUS_TYPE_STRING, FALSE);
+
+	*out_string = op_data->result.out_string;
+	op_data->result.out_string = NULL;
+
+	return TRUE;
+}
+
+/* caller takes ownership and responsibility for freeing the out parameter */
+gboolean
+e_gdbus_proxy_finish_call_strv (EGdbusAsyncOpKeeper *proxy, GAsyncResult *result, gchar ***out_strv, GError **error, gpointer source_tag)
+{
+	AsyncOpData *op_data;
+
+	g_return_val_if_fail (proxy != NULL, FALSE);
+	g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (proxy), source_tag), FALSE);
+	g_return_val_if_fail (out_strv != NULL, FALSE);
+
+	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error))
+		return FALSE;
+
+	op_data = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (result));
+	g_return_val_if_fail (op_data != NULL, FALSE);
+	g_return_val_if_fail (op_data->result_type == E_GDBUS_TYPE_STRV, FALSE);
+
+	*out_strv = op_data->result.out_strv;
+	op_data->result.out_strv = NULL;
+
+	return TRUE;
+}
+
+gboolean
+e_gdbus_proxy_finish_call_uint (EGdbusAsyncOpKeeper *proxy, GAsyncResult *result, guint *out_uint, GError **error, gpointer source_tag)
+{
+	AsyncOpData *op_data;
+
+	g_return_val_if_fail (proxy != NULL, FALSE);
+	g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (proxy), source_tag), FALSE);
+	g_return_val_if_fail (out_uint != NULL, FALSE);
+
+	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error))
+		return FALSE;
+
+	op_data = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (result));
+	g_return_val_if_fail (op_data != NULL, FALSE);
+	g_return_val_if_fail (op_data->result_type == E_GDBUS_TYPE_STRING, FALSE);
+
+	*out_uint = op_data->result.out_uint;
+
+	return TRUE;
+}
+
+typedef struct _SyncOpData
+{
+	EFlag *flag;
+	GError **error;
+
+	guint out_type; /* one of E_GDBUS_TYPE_... except of E_GDBUS_TYPE_IS_ASYNC */
+	union {
+		gboolean *out_boolean;
+		gchar **out_string;
+		gchar ***out_strv;
+		guint *out_uint;
+	} out_arg;
+
+	union {
+		EGdbusCallFinishVoid finish_void;
+		EGdbusCallFinishBoolean finish_boolean;
+		EGdbusCallFinishString finish_string;
+		EGdbusCallFinishStrv finish_strv;
+		EGdbusCallFinishUint finish_uint;
+	} finish_func;
+
+	gboolean finish_result;
+} SyncOpData;
+
+static void
+gdbus_proxy_sync_ready_cb (GObject *proxy, GAsyncResult *result, gpointer user_data)
+{
+	SyncOpData *sync_data = user_data;
+
+	g_return_if_fail (sync_data != NULL);
+	g_return_if_fail (sync_data->flag != NULL);
+
+	switch (sync_data->out_type) {
+	case E_GDBUS_TYPE_VOID:
+		g_return_if_fail (sync_data->finish_func.finish_void != NULL);
+		sync_data->finish_result = sync_data->finish_func.finish_void (G_DBUS_PROXY (proxy), result, sync_data->error);
+		break;
+	case E_GDBUS_TYPE_BOOLEAN:
+		g_return_if_fail (sync_data->finish_func.finish_boolean != NULL);
+		sync_data->finish_result = sync_data->finish_func.finish_boolean (G_DBUS_PROXY (proxy), result, sync_data->out_arg.out_boolean, sync_data->error);
+		break;
+	case E_GDBUS_TYPE_STRING:
+		g_return_if_fail (sync_data->finish_func.finish_string != NULL);
+		sync_data->finish_result = sync_data->finish_func.finish_string (G_DBUS_PROXY (proxy), result, sync_data->out_arg.out_string, sync_data->error);
+		break;
+	case E_GDBUS_TYPE_STRV:
+		g_return_if_fail (sync_data->finish_func.finish_strv != NULL);
+		sync_data->finish_result = sync_data->finish_func.finish_strv (G_DBUS_PROXY (proxy), result, sync_data->out_arg.out_strv, sync_data->error);
+		break;
+	case E_GDBUS_TYPE_UINT:
+		g_return_if_fail (sync_data->finish_func.finish_uint != NULL);
+		sync_data->finish_result = sync_data->finish_func.finish_uint (G_DBUS_PROXY (proxy), result, sync_data->out_arg.out_uint, sync_data->error);
+		break;
+	default:
+		g_warning ("%s: Unknown 'out' E_GDBUS_TYPE %x", G_STRFUNC, sync_data->out_type);
+		sync_data->finish_result = FALSE;
+	}
+
+	e_flag_set (sync_data->flag);
+}
+
+static gboolean
+gdbus_proxy_call_sync (GDBusProxy *proxy, GCancellable *cancellable, GError **error, gpointer start_func, gpointer finish_func, guint in_type, gconstpointer in_value, guint out_type, gpointer out_value)
+{
+	SyncOpData sync_data = { 0 };
+
+	g_return_val_if_fail (proxy != NULL, FALSE);
+	g_return_val_if_fail (start_func != NULL, FALSE);
+	g_return_val_if_fail (finish_func != NULL, FALSE);
+
+	switch (out_type) {
+	case E_GDBUS_TYPE_VOID:
+		sync_data.finish_func.finish_void = finish_func;
+		break;
+	case E_GDBUS_TYPE_BOOLEAN:
+		sync_data.out_arg.out_boolean = out_value;
+		sync_data.finish_func.finish_boolean = finish_func;
+		break;
+	case E_GDBUS_TYPE_STRING:
+		sync_data.out_arg.out_string = out_value;
+		sync_data.finish_func.finish_string = finish_func;
+		break;
+	case E_GDBUS_TYPE_STRV:
+		sync_data.out_arg.out_strv = out_value;
+		sync_data.finish_func.finish_strv = finish_func;
+		break;
+	case E_GDBUS_TYPE_UINT:
+		sync_data.out_arg.out_uint = out_value;
+		sync_data.finish_func.finish_uint = finish_func;
+		break;
+	default:
+		g_warning ("%s: Unknown 'out' E_GDBUS_TYPE %x", G_STRFUNC, out_type);
+		return FALSE;
+	}
+
+	sync_data.flag = e_flag_new ();
+	sync_data.error = error;
+	sync_data.out_type = out_type;
+
+	switch (in_type) {
+	case E_GDBUS_TYPE_VOID: {
+		EGdbusCallStartVoid start = start_func;
+		start (proxy, cancellable, gdbus_proxy_sync_ready_cb, &sync_data);
+	} break;
+	case E_GDBUS_TYPE_BOOLEAN: {
+		EGdbusCallStartBoolean start = start_func;
+		start (proxy, * ((gboolean *) in_value), cancellable, gdbus_proxy_sync_ready_cb, &sync_data);
+	} break;
+	case E_GDBUS_TYPE_STRING: {
+		EGdbusCallStartString start = start_func;
+		start (proxy, (const gchar *) in_value, cancellable, gdbus_proxy_sync_ready_cb, &sync_data);
+	} break;
+	case E_GDBUS_TYPE_STRV: {
+		EGdbusCallStartStrv start = start_func;
+		start (proxy, (const gchar * const *) in_value, cancellable, gdbus_proxy_sync_ready_cb, &sync_data);
+	} break;
+	case E_GDBUS_TYPE_UINT: {
+		EGdbusCallStartUint start = start_func;
+		start (proxy, * ((guint *) in_value), cancellable, gdbus_proxy_sync_ready_cb, &sync_data);
+	} break;
+	default:
+		g_warning ("%s: Unknown 'in' E_GDBUS_TYPE %x", G_STRFUNC, in_type);
+		e_flag_free (sync_data.flag);
+		return FALSE;
+	}
+
+	/* check if called from the main thread */
+	if (g_main_context_is_owner (g_main_context_default ())
+	    || g_main_context_default () == g_main_context_get_thread_default ()
+	    || !g_main_context_get_thread_default ()) {
+		/* Might not be the best thing here, but as the async operation
+		   is divided into two-steps process, invoking the method and
+		   waiting for its "done" signal, then if the sync method is called
+		   from the main thread, then there is probably no other option.
+		*/
+		while (!e_flag_is_set (sync_data.flag)) {
+			g_usleep (250000);
+			g_main_context_iteration (NULL, FALSE);
+		}
+	} else {
+		/* is called in a dedicated thread */
+		e_flag_wait (sync_data.flag);
+	}
+	e_flag_free (sync_data.flag);
+
+	return sync_data.finish_result;
+}
+
+gboolean
+e_gdbus_proxy_call_sync_void__void (GDBusProxy *proxy, GCancellable *cancellable, GError **error, EGdbusCallStartVoid start_func, EGdbusCallFinishVoid finish_func)
+{
+	g_return_val_if_fail (proxy != NULL, FALSE);
+	g_return_val_if_fail (start_func != NULL, FALSE);
+	g_return_val_if_fail (finish_func != NULL, FALSE);
+
+	return gdbus_proxy_call_sync (proxy, cancellable, error, start_func, finish_func, E_GDBUS_TYPE_VOID, NULL, E_GDBUS_TYPE_VOID, NULL);
+}
+
+gboolean
+e_gdbus_proxy_call_sync_void__boolean (GDBusProxy *proxy, gboolean *out_boolean, GCancellable *cancellable, GError **error, EGdbusCallStartVoid start_func, EGdbusCallFinishBoolean finish_func)
+{
+	g_return_val_if_fail (proxy != NULL, FALSE);
+	g_return_val_if_fail (start_func != NULL, FALSE);
+	g_return_val_if_fail (finish_func != NULL, FALSE);
+	g_return_val_if_fail (out_boolean != NULL, FALSE);
+
+	return gdbus_proxy_call_sync (proxy, cancellable, error, start_func, finish_func, E_GDBUS_TYPE_VOID, NULL, E_GDBUS_TYPE_BOOLEAN, out_boolean);
+}
+
+gboolean
+e_gdbus_proxy_call_sync_void__string (GDBusProxy *proxy, gchar **out_string, GCancellable *cancellable, GError **error, EGdbusCallStartVoid start_func, EGdbusCallFinishString finish_func)
+{
+	g_return_val_if_fail (proxy != NULL, FALSE);
+	g_return_val_if_fail (start_func != NULL, FALSE);
+	g_return_val_if_fail (finish_func != NULL, FALSE);
+	g_return_val_if_fail (out_string != NULL, FALSE);
+
+	return gdbus_proxy_call_sync (proxy, cancellable, error, start_func, finish_func, E_GDBUS_TYPE_VOID, NULL, E_GDBUS_TYPE_STRING, out_string);
+}
+
+gboolean
+e_gdbus_proxy_call_sync_void__strv (GDBusProxy *proxy, gchar ***out_strv, GCancellable *cancellable, GError **error, EGdbusCallStartVoid start_func, EGdbusCallFinishStrv finish_func)
+{
+	g_return_val_if_fail (proxy != NULL, FALSE);
+	g_return_val_if_fail (start_func != NULL, FALSE);
+	g_return_val_if_fail (finish_func != NULL, FALSE);
+	g_return_val_if_fail (out_strv != NULL, FALSE);
+
+	return gdbus_proxy_call_sync (proxy, cancellable, error, start_func, finish_func, E_GDBUS_TYPE_VOID, NULL, E_GDBUS_TYPE_STRV, out_strv);
+}
+
+gboolean
+e_gdbus_proxy_call_sync_void__uint (GDBusProxy *proxy, guint *out_uint, GCancellable *cancellable, GError **error, EGdbusCallStartVoid start_func, EGdbusCallFinishUint finish_func)
+{
+	g_return_val_if_fail (proxy != NULL, FALSE);
+	g_return_val_if_fail (start_func != NULL, FALSE);
+	g_return_val_if_fail (finish_func != NULL, FALSE);
+	g_return_val_if_fail (out_uint != NULL, FALSE);
+
+	return gdbus_proxy_call_sync (proxy, cancellable, error, start_func, finish_func, E_GDBUS_TYPE_VOID, NULL, E_GDBUS_TYPE_UINT, out_uint);
+}
+
+gboolean
+e_gdbus_proxy_call_sync_boolean__void (GDBusProxy *proxy, gboolean in_boolean, GCancellable *cancellable, GError **error, EGdbusCallStartBoolean start_func, EGdbusCallFinishVoid finish_func)
+{
+	g_return_val_if_fail (proxy != NULL, FALSE);
+	g_return_val_if_fail (start_func != NULL, FALSE);
+	g_return_val_if_fail (finish_func != NULL, FALSE);
+
+	return gdbus_proxy_call_sync (proxy, cancellable, error, start_func, finish_func, E_GDBUS_TYPE_BOOLEAN, &in_boolean, E_GDBUS_TYPE_VOID, NULL);
+}
+
+gboolean
+e_gdbus_proxy_call_sync_string__void (GDBusProxy *proxy, const gchar *in_string, GCancellable *cancellable, GError **error, EGdbusCallStartString start_func, EGdbusCallFinishVoid finish_func)
+{
+	g_return_val_if_fail (proxy != NULL, FALSE);
+	g_return_val_if_fail (start_func != NULL, FALSE);
+	g_return_val_if_fail (finish_func != NULL, FALSE);
+	g_return_val_if_fail (in_string != NULL, FALSE);
+
+	return gdbus_proxy_call_sync (proxy, cancellable, error, start_func, finish_func, E_GDBUS_TYPE_STRING, in_string, E_GDBUS_TYPE_VOID, NULL);
+}
+
+gboolean
+e_gdbus_proxy_call_sync_strv__void (GDBusProxy *proxy, const gchar * const *in_strv, GCancellable *cancellable, GError **error, EGdbusCallStartStrv start_func, EGdbusCallFinishVoid finish_func)
+{
+	g_return_val_if_fail (proxy != NULL, FALSE);
+	g_return_val_if_fail (start_func != NULL, FALSE);
+	g_return_val_if_fail (finish_func != NULL, FALSE);
+	g_return_val_if_fail (in_strv != NULL, FALSE);
+
+	return gdbus_proxy_call_sync (proxy, cancellable, error, start_func, finish_func, E_GDBUS_TYPE_STRV, in_strv, E_GDBUS_TYPE_VOID, NULL);
+}
+
+gboolean
+e_gdbus_proxy_call_sync_uint__void (GDBusProxy *proxy, guint in_uint, GCancellable *cancellable, GError **error, EGdbusCallStartUint start_func, EGdbusCallFinishVoid finish_func)
+{
+	g_return_val_if_fail (proxy != NULL, FALSE);
+	g_return_val_if_fail (start_func != NULL, FALSE);
+	g_return_val_if_fail (finish_func != NULL, FALSE);
+
+	return gdbus_proxy_call_sync (proxy, cancellable, error, start_func, finish_func, E_GDBUS_TYPE_UINT, &in_uint, E_GDBUS_TYPE_VOID, NULL);
+}
+
+gboolean
+e_gdbus_proxy_call_sync_string__string (GDBusProxy *proxy, const gchar *in_string, gchar **out_string, GCancellable *cancellable, GError **error, EGdbusCallStartString start_func, EGdbusCallFinishString finish_func)
+{
+	g_return_val_if_fail (proxy != NULL, FALSE);
+	g_return_val_if_fail (start_func != NULL, FALSE);
+	g_return_val_if_fail (finish_func != NULL, FALSE);
+	g_return_val_if_fail (in_string != NULL, FALSE);
+	g_return_val_if_fail (out_string != NULL, FALSE);
+
+	return gdbus_proxy_call_sync (proxy, cancellable, error, start_func, finish_func, E_GDBUS_TYPE_STRING, in_string, E_GDBUS_TYPE_STRING, out_string);
+}
+
+gboolean
+e_gdbus_proxy_call_sync_string__strv (GDBusProxy *proxy, const gchar *in_string, gchar ***out_strv, GCancellable *cancellable, GError **error, EGdbusCallStartString start_func, EGdbusCallFinishStrv finish_func)
+{
+	g_return_val_if_fail (proxy != NULL, FALSE);
+	g_return_val_if_fail (start_func != NULL, FALSE);
+	g_return_val_if_fail (finish_func != NULL, FALSE);
+	g_return_val_if_fail (in_string != NULL, FALSE);
+	g_return_val_if_fail (out_strv != NULL, FALSE);
+
+	return gdbus_proxy_call_sync (proxy, cancellable, error, start_func, finish_func, E_GDBUS_TYPE_STRING, in_string, E_GDBUS_TYPE_STRV, out_strv);
+}
+
+gboolean
+e_gdbus_proxy_call_sync_strv__string (GDBusProxy *proxy, const gchar * const *in_strv, gchar **out_string, GCancellable *cancellable, GError **error, EGdbusCallStartStrv start_func, EGdbusCallFinishString finish_func)
+{
+	g_return_val_if_fail (proxy != NULL, FALSE);
+	g_return_val_if_fail (start_func != NULL, FALSE);
+	g_return_val_if_fail (finish_func != NULL, FALSE);
+	g_return_val_if_fail (in_strv != NULL, FALSE);
+	g_return_val_if_fail (out_string != NULL, FALSE);
+
+	return gdbus_proxy_call_sync (proxy, cancellable, error, start_func, finish_func, E_GDBUS_TYPE_STRV, in_strv, E_GDBUS_TYPE_STRING, out_string);
+}
+
+gboolean
+e_gdbus_proxy_call_sync_strv__strv (GDBusProxy *proxy, const gchar * const *in_strv, gchar ***out_strv, GCancellable *cancellable, GError **error, EGdbusCallStartStrv start_func, EGdbusCallFinishStrv finish_func)
+{
+	g_return_val_if_fail (proxy != NULL, FALSE);
+	g_return_val_if_fail (start_func != NULL, FALSE);
+	g_return_val_if_fail (finish_func != NULL, FALSE);
+	g_return_val_if_fail (in_strv != NULL, FALSE);
+	g_return_val_if_fail (out_strv != NULL, FALSE);
+
+	return gdbus_proxy_call_sync (proxy, cancellable, error, start_func, finish_func, E_GDBUS_TYPE_STRV, in_strv, E_GDBUS_TYPE_STRV, out_strv);
+}
+
+static void
+proxy_method_call (const gchar *method_name, guint param_type, gconstpointer param_value, GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	GVariant *params = NULL;
+	GVariant *item;
+	GVariantBuilder *builder = NULL;
+
+	g_return_if_fail (method_name != NULL);
+	g_return_if_fail (proxy != NULL);
+	g_return_if_fail (G_IS_DBUS_PROXY (proxy));
+	if (param_type != E_GDBUS_TYPE_VOID)
+		g_return_if_fail (param_value != NULL);
+
+	switch (param_type) {
+	case E_GDBUS_TYPE_VOID:
+		break;
+	case E_GDBUS_TYPE_BOOLEAN:
+		builder = g_variant_builder_new (G_VARIANT_TYPE_TUPLE);
+		item = g_variant_new_boolean (* ((const gboolean *) param_value));
+		g_variant_builder_add_value (builder, item);
+		break;
+	case E_GDBUS_TYPE_STRING:
+		builder = g_variant_builder_new (G_VARIANT_TYPE_TUPLE);
+		item = g_variant_new_string ((const gchar *) param_value);
+		g_variant_builder_add_value (builder, item);
+		break;
+	case E_GDBUS_TYPE_STRV:
+		builder = g_variant_builder_new (G_VARIANT_TYPE_TUPLE);
+		item = g_variant_new_strv ((const gchar * const *) param_value, -1);
+		g_variant_builder_add_value (builder, item);
+		break;
+	case E_GDBUS_TYPE_UINT:
+		builder = g_variant_builder_new (G_VARIANT_TYPE_TUPLE);
+		item = g_variant_new_uint32 (* ((const guint *) param_value));
+		g_variant_builder_add_value (builder, item);
+		break;
+	default:
+		g_warning ("%s: Unknown 'param' E_GDBUS_TYPE %x", G_STRFUNC, param_type);
+		return;
+	}
+
+	if (builder != NULL) {
+		params = g_variant_builder_end (builder);
+		g_variant_builder_unref (builder);
+	}
+
+	g_dbus_proxy_call (G_DBUS_PROXY (proxy), method_name, params, G_DBUS_CALL_FLAGS_NONE, e_data_server_util_get_dbus_call_timeout (), cancellable, callback, user_data);	
+}
+
+void
+e_gdbus_proxy_method_call_void (const gchar *method_name, GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	proxy_method_call (method_name, E_GDBUS_TYPE_VOID, NULL, proxy, cancellable, callback, user_data);
+}
+
+void
+e_gdbus_proxy_method_call_boolean (const gchar *method_name, GDBusProxy *proxy, gboolean in_boolean, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	proxy_method_call (method_name, E_GDBUS_TYPE_BOOLEAN, &in_boolean, proxy, cancellable, callback, user_data);
+}
+
+void
+e_gdbus_proxy_method_call_string (const gchar *method_name, GDBusProxy *proxy, const gchar *in_string, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	proxy_method_call (method_name, E_GDBUS_TYPE_STRING, in_string, proxy, cancellable, callback, user_data);
+}
+
+void
+e_gdbus_proxy_method_call_strv (const gchar *method_name, GDBusProxy *proxy, const gchar * const *in_strv, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	proxy_method_call (method_name, E_GDBUS_TYPE_STRV, in_strv, proxy, cancellable, callback, user_data);
+}
+
+void
+e_gdbus_proxy_method_call_uint (const gchar *method_name, GDBusProxy *proxy, guint in_uint, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	proxy_method_call (method_name, E_GDBUS_TYPE_VOID, &in_uint, proxy, cancellable, callback, user_data);
+}
+
+static gboolean
+process_result (const gchar *caller_func_name, guint out_type, gpointer out_value, GVariant *_result)
+{
+	if (out_type != E_GDBUS_TYPE_VOID)
+		g_return_val_if_fail (out_value != NULL, FALSE);
+
+	if (_result == NULL)
+		return FALSE;
+
+	switch (out_type) {
+	case E_GDBUS_TYPE_VOID:
+		break;
+	case E_GDBUS_TYPE_BOOLEAN:
+		g_variant_get (_result, "(b)", (gboolean *) out_value);
+		break;
+	case E_GDBUS_TYPE_STRING:
+		g_variant_get (_result, "(s)", (gchar **) out_value);
+		break;
+	case E_GDBUS_TYPE_STRV:
+		g_variant_get (_result, "(^as)", (gchar ***) out_value);
+		break;
+	case E_GDBUS_TYPE_UINT:
+		g_variant_get (_result, "(u)", (guint *) out_value);
+		break;
+	default:
+		g_warning ("%s: Unknown 'out' E_GDBUS_TYPE %x", caller_func_name ? caller_func_name : G_STRFUNC, out_type);
+		break;
+	}
+
+	g_variant_unref (_result);
+
+	return TRUE;
+}
+
+static gboolean
+proxy_method_call_finish (guint out_type, gpointer out_param, GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	g_return_val_if_fail (proxy != NULL, FALSE);
+	g_return_val_if_fail (G_IS_DBUS_PROXY (proxy), FALSE);
+	if (out_type != E_GDBUS_TYPE_VOID)
+		g_return_val_if_fail (out_param != NULL, FALSE);
+
+	return process_result (G_STRFUNC, out_type, out_param, g_dbus_proxy_call_finish (proxy, result, error));
+}
+
+gboolean
+e_gdbus_proxy_method_call_finish_void (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return proxy_method_call_finish (E_GDBUS_TYPE_VOID, NULL, proxy, result, error);
+}
+
+gboolean
+e_gdbus_proxy_method_call_finish_boolean (GDBusProxy *proxy, GAsyncResult *result, gboolean *out_boolean, GError **error)
+{
+	return proxy_method_call_finish (E_GDBUS_TYPE_BOOLEAN, out_boolean, proxy, result, error);
+}
+
+gboolean
+e_gdbus_proxy_method_call_finish_string (GDBusProxy *proxy, GAsyncResult *result, gchar **out_string, GError **error)
+{
+	return proxy_method_call_finish (E_GDBUS_TYPE_STRING, out_string, proxy, result, error);
+}
+
+gboolean
+e_gdbus_proxy_method_call_finish_strv (GDBusProxy *proxy, GAsyncResult *result, gchar ***out_strv, GError **error)
+{
+	return proxy_method_call_finish (E_GDBUS_TYPE_STRV, out_strv, proxy, result, error);
+}
+
+gboolean
+e_gdbus_proxy_method_call_finish_uint (GDBusProxy *proxy, GAsyncResult *result, guint *out_uint, GError **error)
+{
+	return proxy_method_call_finish (E_GDBUS_TYPE_UINT, out_uint, proxy, result, error);
+}
+
+static gboolean
+proxy_method_call_sync (const gchar *method_name, guint in_type, gconstpointer in_value, guint out_type, gpointer out_value, GDBusProxy *proxy, GCancellable *cancellable, GError **error)
+{
+	GVariant *params = NULL;
+	GVariant *item;
+	GVariantBuilder *builder = NULL;
+
+	g_return_val_if_fail (method_name != NULL, FALSE);
+	g_return_val_if_fail (proxy != NULL, FALSE);
+	g_return_val_if_fail (G_IS_DBUS_PROXY (proxy), FALSE);
+	if (in_type != E_GDBUS_TYPE_VOID)
+		g_return_val_if_fail (in_value != NULL, FALSE);
+	if (out_type != E_GDBUS_TYPE_VOID)
+		g_return_val_if_fail (out_value != NULL, FALSE);
+
+	switch (in_type) {
+	case E_GDBUS_TYPE_VOID:
+		break;
+	case E_GDBUS_TYPE_BOOLEAN:
+		builder = g_variant_builder_new (G_VARIANT_TYPE_TUPLE);
+		item = g_variant_new_boolean (* ((const gboolean *) in_value));
+		g_variant_builder_add_value (builder, item);
+		break;
+	case E_GDBUS_TYPE_STRING:
+		builder = g_variant_builder_new (G_VARIANT_TYPE_TUPLE);
+		item = g_variant_new_string ((const gchar *) in_value);
+		g_variant_builder_add_value (builder, item);
+		break;
+	case E_GDBUS_TYPE_STRV:
+		builder = g_variant_builder_new (G_VARIANT_TYPE_TUPLE);
+		item = g_variant_new_strv ((const gchar * const *) in_value, -1);
+		g_variant_builder_add_value (builder, item);
+		break;
+	case E_GDBUS_TYPE_UINT:
+		builder = g_variant_builder_new (G_VARIANT_TYPE_TUPLE);
+		item = g_variant_new_uint32 (* ((const guint *) in_value));
+		g_variant_builder_add_value (builder, item);
+		break;
+	default:
+		g_warning ("%s: Unknown 'in' E_GDBUS_TYPE %x", G_STRFUNC, in_type);
+		return FALSE;
+	}
+
+	if (builder != NULL) {
+		params = g_variant_builder_end (builder);
+		g_variant_builder_unref (builder);
+	}
+
+	return process_result (G_STRFUNC, out_type, out_value, g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), method_name, params, G_DBUS_CALL_FLAGS_NONE, e_data_server_util_get_dbus_call_timeout (), cancellable, error));
+}
+
+gboolean
+e_gdbus_proxy_method_call_sync_void__void (const gchar *method_name, GDBusProxy *proxy, GCancellable *cancellable, GError **error)
+{
+	return proxy_method_call_sync (method_name, E_GDBUS_TYPE_VOID, NULL, E_GDBUS_TYPE_VOID, NULL, proxy, cancellable, error);
+}
+
+gboolean
+e_gdbus_proxy_method_call_sync_boolean__void (const gchar *method_name, GDBusProxy *proxy, gboolean in_boolean, GCancellable *cancellable, GError **error)
+{
+	return proxy_method_call_sync (method_name, E_GDBUS_TYPE_BOOLEAN, &in_boolean, E_GDBUS_TYPE_VOID, NULL, proxy, cancellable, error);
+}
+
+gboolean
+e_gdbus_proxy_method_call_sync_string__void (const gchar *method_name, GDBusProxy *proxy, const gchar *in_string, GCancellable *cancellable, GError **error)
+{
+	return proxy_method_call_sync (method_name, E_GDBUS_TYPE_STRING, in_string, E_GDBUS_TYPE_VOID, NULL, proxy, cancellable, error);
+}
+
+gboolean
+e_gdbus_proxy_method_call_sync_strv__void (const gchar *method_name, GDBusProxy *proxy, const gchar * const *in_strv, GCancellable *cancellable, GError **error)
+{
+	return proxy_method_call_sync (method_name, E_GDBUS_TYPE_STRV, in_strv, E_GDBUS_TYPE_VOID, NULL, proxy, cancellable, error);
+}
+
+gboolean
+e_gdbus_proxy_method_call_sync_uint__void (const gchar *method_name, GDBusProxy *proxy, guint in_uint, GCancellable *cancellable, GError **error)
+{
+	return proxy_method_call_sync (method_name, E_GDBUS_TYPE_UINT, &in_uint, E_GDBUS_TYPE_VOID, NULL, proxy, cancellable, error);
+}
+
+gboolean
+e_gdbus_proxy_method_call_sync_string__string (const gchar *method_name, GDBusProxy *proxy, const gchar *in_string, gchar **out_string, GCancellable *cancellable, GError **error)
+{
+	return proxy_method_call_sync (method_name, E_GDBUS_TYPE_STRING, in_string, E_GDBUS_TYPE_STRING, out_string, proxy, cancellable, error);
+}
+
+gboolean
+e_gdbus_proxy_method_call_sync_strv__string (const gchar *method_name, GDBusProxy *proxy, const gchar * const *in_strv, gchar **out_string, GCancellable *cancellable, GError **error)
+{
+	return proxy_method_call_sync (method_name, E_GDBUS_TYPE_STRV, in_strv, E_GDBUS_TYPE_STRING, out_string, proxy, cancellable, error);
+}
diff --git a/libedataserver/e-gdbus-templates.h b/libedataserver/e-gdbus-templates.h
new file mode 100644
index 0000000..bedb51e
--- /dev/null
+++ b/libedataserver/e-gdbus-templates.h
@@ -0,0 +1,747 @@
+/*
+ * e-gdbus-templates.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#ifndef E_GDBUS_TEMPLATES_H
+#define E_GDBUS_TEMPLATES_H
+
+#include <gio/gio.h>
+#include <libedataserver/e-gdbus-marshallers.h>
+
+G_BEGIN_DECLS
+
+#define E_TYPE_GDBUS_ASYNC_OP_KEEPER		(e_gdbus_async_op_keeper_get_type ())
+#define E_GDBUS_ASYNC_OP_KEEPER(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_GDBUS_ASYNC_OP_KEEPER, EGdbusAsyncOpKeeper))
+#define E_IS_GDBUS_ASYNC_OP_KEEPER(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_GDBUS_ASYNC_OP_KEEPER))
+#define E_GDBUS_ASYNC_OP_KEEPER_GET_IFACE(o)	(G_TYPE_INSTANCE_GET_INTERFACE((o), E_TYPE_GDBUS_ASYNC_OP_KEEPER, EGdbusAsyncOpKeeperInterface))
+
+typedef struct _EGdbusAsyncOpKeeper EGdbusAsyncOpKeeper; /* Dummy typedef */
+typedef struct _EGdbusAsyncOpKeeperInterface EGdbusAsyncOpKeeperInterface;
+
+struct _EGdbusAsyncOpKeeperInterface
+{
+	GTypeInterface parent_iface;
+
+	GHashTable *	(* get_pending_ops)	(EGdbusAsyncOpKeeper *object);
+	gboolean	(* cancel_op_sync)	(EGdbusAsyncOpKeeper *object, guint in_opid, GCancellable *cancellable, GError **error);
+};
+
+GType e_gdbus_async_op_keeper_get_type (void) G_GNUC_CONST;
+
+GHashTable *	e_gdbus_async_op_keeper_create_pending_ops	(EGdbusAsyncOpKeeper *object);
+GHashTable *	e_gdbus_async_op_keeper_get_pending_ops		(EGdbusAsyncOpKeeper *object);
+gboolean	e_gdbus_async_op_keeper_cancel_op_sync		(EGdbusAsyncOpKeeper *object, guint in_opid, GCancellable *cancellable, GError **error);
+
+enum {
+	E_GDBUS_TYPE_IS_ASYNC	= 1 << 0, /* if set, then OPID and GError precedes to actual parameter */
+	E_GDBUS_TYPE_VOID	= 1 << 1,
+	E_GDBUS_TYPE_BOOLEAN	= 1 << 2,
+	E_GDBUS_TYPE_STRING	= 1 << 3,
+	E_GDBUS_TYPE_STRV	= 1 << 4,
+	E_GDBUS_TYPE_UINT	= 1 << 5
+};
+
+/* _where is a target component name, like ' ## _where ## ' or 'cal'
+   _mname is method name, like 'open'
+   _mtype is method type, like 'method_in'
+   _param_name is parameter name, like 'only_if_exists'
+   _param_type is parameter type, as string, like "s"
+   all except _param_type are identificators, not strings
+*/
+#define E_DECLARE_GDBUS_ARG(_where, _mname, _mtype, _param_name, _param_type)				\
+	static const GDBusArgInfo e_gdbus_ ## _where ## _ ## _mtype ## _mname ## _param_name =		\
+	{												\
+		-1,											\
+		(gchar *) # _param_name,								\
+		(gchar *) _param_type,									\
+		(GDBusAnnotationInfo **) NULL,								\
+	};
+
+#define E_DECLARE_GDBUS_NOTIFY_SIGNAL_0(_where, _sname)							\
+	static const GDBusSignalInfo e_gdbus_ ## _where ## _signal_ ## _sname =				\
+	{												\
+		-1,											\
+		(gchar *) # _sname,									\
+		(GDBusArgInfo **) NULL,									\
+		(GDBusAnnotationInfo **) NULL,								\
+	};
+
+#define E_DECLARE_GDBUS_NOTIFY_SIGNAL_1(_where, _sname, _p1_name, _p1_type)				\
+	E_DECLARE_GDBUS_ARG (_where, _sname, signal, _p1_name, _p1_type)				\
+													\
+	static const GDBusArgInfo * const e_gdbus_ ## _where ## _signal_arg_pointers_ ## _sname[] =	\
+	{												\
+		&e_gdbus_ ## _where ## _signal ## _sname ## _p1_name,					\
+		NULL											\
+	};												\
+													\
+	static const GDBusSignalInfo e_gdbus_ ## _where ## _signal_ ## _sname =				\
+	{												\
+		-1,											\
+		(gchar *) # _sname,									\
+		(GDBusArgInfo **) &e_gdbus_ ## _where ## _signal_arg_pointers_ ## _sname,		\
+		(GDBusAnnotationInfo **) NULL,								\
+	};
+
+#define E_DECLARE_GDBUS_NOTIFY_SIGNAL_2(_where, _sname, _p1_name, _p1_type, _p2_name, _p2_type)		\
+	E_DECLARE_GDBUS_ARG (_where, _sname, signal, _p1_name, _p1_type)				\
+	E_DECLARE_GDBUS_ARG (_where, _sname, signal, _p2_name, _p2_type)				\
+													\
+	static const GDBusArgInfo * const e_gdbus_ ## _where ## _signal_arg_pointers_ ## _sname[] =	\
+	{												\
+		&e_gdbus_ ## _where ## _signal ## _sname ## _p1_name,					\
+		&e_gdbus_ ## _where ## _signal ## _sname ## _p2_name,					\
+		NULL											\
+	};												\
+													\
+	static const GDBusSignalInfo e_gdbus_ ## _where ## _signal_ ## _sname =				\
+	{												\
+		-1,											\
+		(gchar *) # _sname,									\
+		(GDBusArgInfo **) &e_gdbus_ ## _where ## _signal_arg_pointers_ ## _sname,		\
+		(GDBusAnnotationInfo **) NULL,								\
+	};
+
+#define E_DECLARE_GDBUS_ASYNC_DONE_SIGNAL_0(_where, _sname)						\
+	E_DECLARE_GDBUS_ARG (_where, _sname, signal, opid, "u")						\
+	E_DECLARE_GDBUS_ARG (_where, _sname, signal, dbus_error_name, "s")				\
+	E_DECLARE_GDBUS_ARG (_where, _sname, signal, dbus_error_message, "s")				\
+													\
+	static const GDBusArgInfo * const e_gdbus_ ## _where ## _signal_arg_pointers_ ## _sname[] =	\
+	{												\
+		&e_gdbus_ ## _where ## _signal ## _sname ## opid,					\
+		&e_gdbus_ ## _where ## _signal ## _sname ## dbus_error_name,				\
+		&e_gdbus_ ## _where ## _signal ## _sname ## dbus_error_message,				\
+		NULL											\
+	};												\
+													\
+	static const GDBusSignalInfo e_gdbus_ ## _where ## _signal_ ## _sname =				\
+	{												\
+		-1,											\
+		(gchar *) # _sname,									\
+		(GDBusArgInfo **) &e_gdbus_ ## _where ## _signal_arg_pointers_ ## _sname,		\
+		(GDBusAnnotationInfo **) NULL,								\
+	};
+
+#define E_DECLARE_GDBUS_ASYNC_DONE_SIGNAL_1(_where, _sname, _p1_name, _p1_type)				\
+	E_DECLARE_GDBUS_ARG (_where, _sname, signal, opid, "u")						\
+	E_DECLARE_GDBUS_ARG (_where, _sname, signal, dbus_error_name, "s")				\
+	E_DECLARE_GDBUS_ARG (_where, _sname, signal, dbus_error_message, "s")				\
+	E_DECLARE_GDBUS_ARG (_where, _sname, signal, _p1_name, _p1_type)				\
+													\
+	static const GDBusArgInfo * const e_gdbus_ ## _where ## _signal_arg_pointers_ ## _sname[] =	\
+	{												\
+		&e_gdbus_ ## _where ## _signal ## _sname ## opid,					\
+		&e_gdbus_ ## _where ## _signal ## _sname ## dbus_error_name,				\
+		&e_gdbus_ ## _where ## _signal ## _sname ## dbus_error_message,				\
+		&e_gdbus_ ## _where ## _signal ## _sname ## _p1_name,					\
+		NULL											\
+	};												\
+													\
+	static const GDBusSignalInfo e_gdbus_ ## _where ## _signal_ ## _sname =				\
+	{												\
+		-1,											\
+		(gchar *) # _sname,									\
+		(GDBusArgInfo **) &e_gdbus_ ## _where ## _signal_arg_pointers_ ## _sname,		\
+		(GDBusAnnotationInfo **) NULL,								\
+	};
+
+#define E_DECLARE_GDBUS_SYNC_METHOD_0(_where, _name)							\
+	static const GDBusMethodInfo e_gdbus_ ## _where ## _method_ ## _name =				\
+	{												\
+		-1,											\
+		(gchar *) # _name,									\
+		(GDBusArgInfo **) NULL,									\
+		(GDBusArgInfo **) NULL,									\
+		(GDBusAnnotationInfo **) NULL,								\
+	};
+
+#define E_DECLARE_GDBUS_SYNC_METHOD_1(_where, _name, _p1_name, _p1_type)				\
+	E_DECLARE_GDBUS_ARG (_where, _mname, method_in, _p1_name, _p1_type)				\
+													\
+	static const GDBusArgInfo * const e_gdbus_ ## _where ## _method_in_arg_pointers_ ## _mname[] =	\
+	{												\
+		&e_gdbus_ ## _where ## _method_in ## _mname ## _p1_name,				\
+		NULL											\
+	};												\
+													\
+	static const GDBusMethodInfo e_gdbus_ ## _where ## _method_ ## _name =				\
+	{												\
+		-1,											\
+		(gchar *) # _name,									\
+		(GDBusArgInfo **) &e_gdbus_ ## _where ## _method_in_arg_pointers_ ## _mname,		\
+		(GDBusArgInfo **) NULL,									\
+		(GDBusAnnotationInfo **) NULL,								\
+	};
+
+#define E_DECLARE_GDBUS_SYNC_METHOD_0_WITH_RETURN(_where, _mname, _r1_name, _r1_type)			\
+	E_DECLARE_GDBUS_ARG (_where, _mname, method_out, _r1_name, _r1_type)				\
+													\
+	static const GDBusArgInfo * const e_gdbus_ ## _where ## _method_out_arg_pointers_ ## _mname[] =	\
+	{												\
+		&e_gdbus_ ## _where ## _method_out ## _mname ## _r1_name,				\
+		NULL											\
+	};												\
+													\
+	static const GDBusMethodInfo e_gdbus_ ## _where ## _method_ ## _mname =				\
+	{												\
+		-1,											\
+		(gchar *) # _mname,									\
+		(GDBusArgInfo **) NULL,									\
+		(GDBusArgInfo **) &e_gdbus_ ## _where ## _method_out_arg_pointers_ ## _mname,		\
+		(GDBusAnnotationInfo **) NULL,								\
+	};
+
+#define E_DECLARE_GDBUS_SYNC_METHOD_1_WITH_RETURN(_where, _mname, _p1_name, _p1_type, _r1_name, _r1_type)\
+	E_DECLARE_GDBUS_ARG (_where, _mname, method_in, _p1_name, _p1_type)				\
+	E_DECLARE_GDBUS_ARG (_where, _mname, method_out, _r1_name, _r1_type)				\
+													\
+	static const GDBusArgInfo * const e_gdbus_ ## _where ## _method_in_arg_pointers_ ## _mname[] =	\
+	{												\
+		&e_gdbus_ ## _where ## _method_in ## _mname ## _p1_name,				\
+		NULL											\
+	};												\
+													\
+	static const GDBusArgInfo * const e_gdbus_ ## _where ## _method_out_arg_pointers_ ## _mname[] =	\
+	{												\
+		&e_gdbus_ ## _where ## _method_out ## _mname ## _r1_name,				\
+		NULL											\
+	};												\
+													\
+	static const GDBusMethodInfo e_gdbus_ ## _where ## _method_ ## _mname =				\
+	{												\
+		-1,											\
+		(gchar *) # _mname,									\
+		(GDBusArgInfo **) &e_gdbus_ ## _where ## _method_in_arg_pointers_ ## _mname,		\
+		(GDBusArgInfo **) &e_gdbus_ ## _where ## _method_out_arg_pointers_ ## _mname,		\
+		(GDBusAnnotationInfo **) NULL,								\
+	};
+
+#define E_DECLARE_GDBUS_ASYNC_METHOD_0(_where, _mname)							\
+	E_DECLARE_GDBUS_ASYNC_DONE_SIGNAL_0 (_where, _mname ## _done)					\
+	E_DECLARE_GDBUS_ARG (_where, _mname, method_out, opid, "u")					\
+													\
+	static const GDBusArgInfo * const e_gdbus_ ## _where ## _method_out_arg_pointers_ ## _mname[] =	\
+	{												\
+		&e_gdbus_ ## _where ## _method_out ## _mname ## opid,					\
+		NULL											\
+	};												\
+													\
+	static const GDBusMethodInfo e_gdbus_ ## _where ## _method_ ## _mname =				\
+	{												\
+		-1,											\
+		(gchar *) # _mname,									\
+		(GDBusArgInfo **) NULL,									\
+		(GDBusArgInfo **) &e_gdbus_ ## _where ## _method_out_arg_pointers_ ## _mname,		\
+		(GDBusAnnotationInfo **) NULL,								\
+	};
+
+#define E_DECLARE_GDBUS_ASYNC_METHOD_1(_where, _mname, _p1_name, _p1_type)				\
+	E_DECLARE_GDBUS_ASYNC_DONE_SIGNAL_0 (_where, _mname ## _done)					\
+	E_DECLARE_GDBUS_ARG (_where, _mname, method_in, _p1_name, _p1_type)				\
+	E_DECLARE_GDBUS_ARG (_where, _mname, method_out, opid, "u")					\
+													\
+	static const GDBusArgInfo * const e_gdbus_ ## _where ## _method_in_arg_pointers_ ## _mname[] =	\
+	{												\
+		&e_gdbus_ ## _where ## _method_in ## _mname ## _p1_name,				\
+		NULL											\
+	};												\
+													\
+	static const GDBusArgInfo * const e_gdbus_ ## _where ## _method_out_arg_pointers_ ## _mname[] =	\
+	{												\
+		&e_gdbus_ ## _where ## _method_out ## _mname ## opid,					\
+		NULL											\
+	};												\
+													\
+	static const GDBusMethodInfo e_gdbus_ ## _where ## _method_ ## _mname =				\
+	{												\
+		-1,											\
+		(gchar *) # _mname,									\
+		(GDBusArgInfo **) &e_gdbus_ ## _where ## _method_in_arg_pointers_ ## _mname,		\
+		(GDBusArgInfo **) &e_gdbus_ ## _where ## _method_out_arg_pointers_ ## _mname,		\
+		(GDBusAnnotationInfo **) NULL,								\
+	};
+
+#define E_DECLARE_GDBUS_ASYNC_METHOD_0_WITH_RETURN(_where, _mname, _r1_name, _r1_type)			\
+	E_DECLARE_GDBUS_ASYNC_DONE_SIGNAL_1 (_where, _mname ## _done, _r1_name, _r1_type)		\
+	E_DECLARE_GDBUS_ARG (_where, _mname, method_out, opid, "u")					\
+													\
+	static const GDBusArgInfo * const e_gdbus_ ## _where ## _method_out_arg_pointers_ ## _mname[] =	\
+	{												\
+		&e_gdbus_ ## _where ## _method_out ## _mname ## opid,					\
+		NULL											\
+	};												\
+													\
+	static const GDBusMethodInfo e_gdbus_ ## _where ## _method_ ## _mname =				\
+	{												\
+		-1,											\
+		(gchar *) # _mname,									\
+		(GDBusArgInfo **) NULL,									\
+		(GDBusArgInfo **) &e_gdbus_ ## _where ## _method_out_arg_pointers_ ## _mname,		\
+		(GDBusAnnotationInfo **) NULL,								\
+	};
+
+#define E_DECLARE_GDBUS_ASYNC_METHOD_1_WITH_RETURN(_where, _mname, _p1_name, _p1_type, _r1_name, _r1_type)\
+	E_DECLARE_GDBUS_ASYNC_DONE_SIGNAL_1 (_where, _mname ## _done, _r1_name, _r1_type)		\
+	E_DECLARE_GDBUS_ARG (_where, _mname, method_in, _p1_name, _p1_type)				\
+	E_DECLARE_GDBUS_ARG (_where, _mname, method_out, opid, "u")					\
+													\
+	static const GDBusArgInfo * const e_gdbus_ ## _where ## _method_in_arg_pointers_ ## _mname[] =	\
+	{												\
+		&e_gdbus_ ## _where ## _method_in ## _mname ## _p1_name,				\
+		NULL											\
+	};												\
+													\
+	static const GDBusArgInfo * const e_gdbus_ ## _where ## _method_out_arg_pointers_ ## _mname[] =	\
+	{												\
+		&e_gdbus_ ## _where ## _method_out ## _mname ## opid,					\
+		NULL											\
+	};												\
+													\
+	static const GDBusMethodInfo e_gdbus_ ## _where ## _method_ ## _mname =				\
+	{												\
+		-1,											\
+		(gchar *) # _mname,									\
+		(GDBusArgInfo **) &e_gdbus_ ## _where ## _method_in_arg_pointers_ ## _mname,		\
+		(GDBusArgInfo **) &e_gdbus_ ## _where ## _method_out_arg_pointers_ ## _mname,		\
+		(GDBusAnnotationInfo **) NULL,								\
+	};
+
+#define E_DECLARED_GDBUS_SIGNAL_INFO_NAME(_where, _sname) e_gdbus_ ## _where ## _signal_ ## _sname
+#define E_DECLARED_GDBUS_METHOD_INFO_NAME(_where, _mname) e_gdbus_ ## _where ## _method_ ## _mname
+
+/* this requires signal_emission_hook_cb_ ## _sig_name hook defined,
+   which can be created with one of E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_... macros */
+#define E_INIT_GDBUS_SIGNAL_VOID(_iface_struct, _dbus_sig_name_str, _sig_name_var, _sig_id)					\
+	signals[_sig_id] = g_signal_new (# _sig_name_var,									\
+			G_TYPE_FROM_INTERFACE (iface),										\
+			G_SIGNAL_RUN_LAST,											\
+			G_STRUCT_OFFSET (_iface_struct, _sig_name_var),								\
+			NULL,													\
+			NULL,													\
+			g_cclosure_marshal_VOID__VOID,										\
+			G_TYPE_NONE,												\
+			0);													\
+																\
+	g_signal_add_emission_hook (signals[_sig_id], 0, signal_emission_hook_cb_ ## _sig_name_var, (gpointer) _dbus_sig_name_str, NULL);\
+	g_hash_table_insert (_signal_name_to_id, (gpointer) _dbus_sig_name_str, GUINT_TO_POINTER (_sig_id));			\
+	g_hash_table_insert (_signal_name_to_type, (gpointer) _dbus_sig_name_str, GUINT_TO_POINTER (E_GDBUS_TYPE_VOID));
+
+#define E_INIT_GDBUS_SIGNAL_TMPL_TYPED(_mtype, _gtype, _iface_struct, _dbus_sig_name_str, _sig_name_var, _sig_id)		\
+	signals[_sig_id] = g_signal_new (# _sig_name_var,									\
+			G_TYPE_FROM_INTERFACE (iface),										\
+			G_SIGNAL_RUN_LAST,											\
+			G_STRUCT_OFFSET (_iface_struct, _sig_name_var),								\
+			NULL,													\
+			NULL,													\
+			g_cclosure_marshal_VOID__ ## _mtype,									\
+			G_TYPE_NONE,												\
+			1,													\
+			G_TYPE_ ## _gtype);											\
+																\
+	g_signal_add_emission_hook (signals[_sig_id], 0, signal_emission_hook_cb_ ## _sig_name_var, (gpointer) _dbus_sig_name_str, NULL);\
+	g_hash_table_insert (_signal_name_to_id, (gpointer) _dbus_sig_name_str, GUINT_TO_POINTER (_sig_id));			\
+	g_hash_table_insert (_signal_name_to_type, (gpointer) _dbus_sig_name_str, GUINT_TO_POINTER (E_GDBUS_TYPE_ ## _gtype));
+
+#define E_INIT_GDBUS_SIGNAL_BOOLEAN(_iface_struct, _dbus_sig_name_str, _sig_name_var, _sig_id)					\
+	E_INIT_GDBUS_SIGNAL_TMPL_TYPED (BOOLEAN, BOOLEAN, _iface_struct, _dbus_sig_name_str, _sig_name_var, _sig_id)
+
+#define E_INIT_GDBUS_SIGNAL_STRING(_iface_struct, _dbus_sig_name_str, _sig_name_var, _sig_id)					\
+	E_INIT_GDBUS_SIGNAL_TMPL_TYPED (STRING, STRING, _iface_struct, _dbus_sig_name_str, _sig_name_var, _sig_id)
+
+#define E_INIT_GDBUS_SIGNAL_STRV(_iface_struct, _dbus_sig_name_str, _sig_name_var, _sig_id)					\
+	E_INIT_GDBUS_SIGNAL_TMPL_TYPED (BOXED, STRV, _iface_struct, _dbus_sig_name_str, _sig_name_var, _sig_id)
+
+#define E_INIT_GDBUS_SIGNAL_UINT(_iface_struct, _dbus_sig_name_str, _sig_name_var, _sig_id)					\
+	E_INIT_GDBUS_SIGNAL_TMPL_TYPED (UINT, UINT, _iface_struct, _dbus_sig_name_str, _sig_name_var, _sig_id)
+
+#define E_INIT_GDBUS_SIGNAL_UINT_STRING(_iface_struct, _dbus_sig_name_str, _sig_name_var, _sig_id)				\
+	signals[_sig_id] = g_signal_new (# _sig_name_var,									\
+			G_TYPE_FROM_INTERFACE (iface),										\
+			G_SIGNAL_RUN_LAST,											\
+			G_STRUCT_OFFSET (_iface_struct, _sig_name_var),								\
+			NULL,													\
+			NULL,													\
+			e_gdbus_marshallers_VOID__UINT_STRING,									\
+			G_TYPE_NONE,												\
+			2,													\
+			G_TYPE_UINT, G_TYPE_STRING);										\
+																\
+	g_signal_add_emission_hook (signals[_sig_id], 0, signal_emission_hook_cb_ ## _sig_name_var, (gpointer) _dbus_sig_name_str, NULL);\
+	g_hash_table_insert (_signal_name_to_id, (gpointer) _dbus_sig_name_str, GUINT_TO_POINTER (_sig_id));			\
+	g_hash_table_insert (_signal_name_to_type, (gpointer) _dbus_sig_name_str, GUINT_TO_POINTER (E_GDBUS_TYPE_UINT | E_GDBUS_TYPE_STRING));
+
+#define E_INIT_GDBUS_METHOD_DONE_VOID(_iface_struct, _sig_name_var, _done_sig_id)						\
+	signals[_done_sig_id] = g_signal_new (# _sig_name_var "_done",								\
+			G_TYPE_FROM_INTERFACE (iface),										\
+			G_SIGNAL_RUN_LAST,											\
+			G_STRUCT_OFFSET (_iface_struct, _sig_name_var ## _done),						\
+			NULL,													\
+			NULL,													\
+			e_gdbus_marshallers_VOID__UINT_BOXED,									\
+			G_TYPE_NONE,												\
+			2,													\
+			G_TYPE_UINT, G_TYPE_ERROR);										\
+	g_signal_add_emission_hook (signals[_done_sig_id], 0,									\
+			signal_emission_hook_cb_ ## _sig_name_var ## _done, (gpointer) # _sig_name_var "_done", NULL);		\
+	g_hash_table_insert (_signal_name_to_id, (gpointer) # _sig_name_var "_done", GUINT_TO_POINTER (_done_sig_id));		\
+	g_hash_table_insert (_signal_name_to_type, (gpointer) # _sig_name_var "_done", GUINT_TO_POINTER (E_GDBUS_TYPE_IS_ASYNC | E_GDBUS_TYPE_VOID));
+
+#define E_INIT_GDBUS_METHOD_DONE_ASYNC_TMPL_TYPED(_mtype, _gtype, _iface_struct, _sig_name_var, _done_sig_id)			\
+	signals[_done_sig_id] = g_signal_new (# _sig_name_var "_done",								\
+			G_TYPE_FROM_INTERFACE (iface),										\
+			G_SIGNAL_RUN_LAST,											\
+			G_STRUCT_OFFSET (_iface_struct, _sig_name_var ## _done),						\
+			NULL,													\
+			NULL,													\
+			e_gdbus_marshallers_VOID__UINT_BOXED_ ## _mtype,							\
+			G_TYPE_NONE,												\
+			3,													\
+			G_TYPE_UINT, G_TYPE_ERROR, G_TYPE_ ## _gtype);								\
+	g_signal_add_emission_hook (signals[_done_sig_id], 0,									\
+			signal_emission_hook_cb_ ## _sig_name_var ## _done, (gpointer) # _sig_name_var "_done", NULL);		\
+	g_hash_table_insert (_signal_name_to_id, (gpointer) # _sig_name_var "_done", GUINT_TO_POINTER (_done_sig_id));		\
+	g_hash_table_insert (_signal_name_to_type, (gpointer) # _sig_name_var "_done", GUINT_TO_POINTER (E_GDBUS_TYPE_IS_ASYNC | E_GDBUS_TYPE_ ## _gtype));
+
+#define E_INIT_GDBUS_METHOD_DONE_BOOLEAN(_iface_struct, _sig_name_var, _done_sig_id)						\
+	E_INIT_GDBUS_METHOD_DONE_ASYNC_TMPL_TYPED (BOOLEAN, BOOLEAN, _iface_struct, _sig_name_var, _done_sig_id)
+
+#define E_INIT_GDBUS_METHOD_DONE_STRING(_iface_struct, _sig_name_var, _done_sig_id)						\
+	E_INIT_GDBUS_METHOD_DONE_ASYNC_TMPL_TYPED (STRING, STRING, _iface_struct, _sig_name_var, _done_sig_id)
+
+#define E_INIT_GDBUS_METHOD_DONE_STRV(_iface_struct, _sig_name_var, _done_sig_id)						\
+	E_INIT_GDBUS_METHOD_DONE_ASYNC_TMPL_TYPED (BOXED, STRV, _iface_struct, _sig_name_var, _done_sig_id)
+
+#define E_INIT_GDBUS_METHOD_DONE_UINT(_iface_struct, _sig_name_var, _done_sig_id)						\
+	E_INIT_GDBUS_METHOD_DONE_ASYNC_TMPL_TYPED (UINT, UINT, _iface_struct, _sig_name_var, _done_sig_id)
+
+/* do not use this directly, there is missing _method_name_to_type insertion */
+#define E_INIT_GDBUS_METHOD_CALL_TMPL_VOID(_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)			\
+	signals[_method_sig_id] = g_signal_new ("handle-" # _sig_name_var,							\
+			G_TYPE_FROM_INTERFACE (iface),										\
+			G_SIGNAL_RUN_LAST,											\
+			G_STRUCT_OFFSET (_iface_struct, handle_ ## _sig_name_var),						\
+			NULL, NULL,												\
+			e_gdbus_marshallers_BOOLEAN__OBJECT,									\
+			G_TYPE_BOOLEAN,												\
+			1,													\
+			G_TYPE_DBUS_METHOD_INVOCATION);										\
+	g_hash_table_insert (_method_name_to_id, (gpointer) _dbus_sig_name_str, GUINT_TO_POINTER (_method_sig_id));
+
+/* do not use this directly, there is missing _method_name_to_type insertion */
+#define E_INIT_GDBUS_METHOD_CALL_TMPL_TYPED(_mtype, _gtype, _iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)	\
+	signals[_method_sig_id] = g_signal_new ("handle-" # _sig_name_var,							\
+			G_TYPE_FROM_INTERFACE (iface),										\
+			G_SIGNAL_RUN_LAST,											\
+			G_STRUCT_OFFSET (_iface_struct, handle_ ## _sig_name_var),						\
+			NULL, NULL,												\
+			e_gdbus_marshallers_BOOLEAN__OBJECT_ ## _mtype,								\
+			G_TYPE_BOOLEAN,												\
+			2,													\
+			G_TYPE_DBUS_METHOD_INVOCATION,										\
+			G_TYPE_ ## _gtype);											\
+	g_hash_table_insert (_method_name_to_id, (gpointer) _dbus_sig_name_str, GUINT_TO_POINTER (_method_sig_id));		\
+
+#define E_INIT_GDBUS_METHOD_CALL_ASYNC_TMPL_TYPED(_mtype, _gtype, _iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)	\
+	E_INIT_GDBUS_METHOD_CALL_TMPL_TYPED (_mtype, _gtype, _iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)	\
+	g_hash_table_insert (_method_name_to_type, (gpointer) _dbus_sig_name_str, GUINT_TO_POINTER (E_GDBUS_TYPE_ ## _gtype | E_GDBUS_TYPE_IS_ASYNC));
+
+#define E_INIT_GDBUS_METHOD_VOID(_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)				\
+	E_INIT_GDBUS_METHOD_CALL_TMPL_VOID(_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)			\
+	g_hash_table_insert (_method_name_to_type, (gpointer) _dbus_sig_name_str, GUINT_TO_POINTER (E_GDBUS_TYPE_VOID));
+
+#define E_INIT_GDBUS_METHOD_BOOLEAN(_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)				\
+	E_INIT_GDBUS_METHOD_CALL_TMPL_TYPED (BOOLEAN, BOOLEAN, _iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)\
+	g_hash_table_insert (_method_name_to_type, (gpointer) _dbus_sig_name_str, GUINT_TO_POINTER (E_GDBUS_TYPE_BOOLEAN));
+
+#define E_INIT_GDBUS_METHOD_STRING(_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)				\
+	E_INIT_GDBUS_METHOD_CALL_TMPL_TYPED (STRING, STRING, _iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)	\
+	g_hash_table_insert (_method_name_to_type, (gpointer) _dbus_sig_name_str, GUINT_TO_POINTER (E_GDBUS_TYPE_STRING));
+
+#define E_INIT_GDBUS_METHOD_STRV(_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)				\
+	E_INIT_GDBUS_METHOD_CALL_TMPL_TYPED (BOXED, STRV, _iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)	\
+	g_hash_table_insert (_method_name_to_type, (gpointer) _dbus_sig_name_str, GUINT_TO_POINTER (E_GDBUS_TYPE_STRV));
+
+#define E_INIT_GDBUS_METHOD_UINT(_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)				\
+	E_INIT_GDBUS_METHOD_CALL_TMPL_TYPED (UINT, UINT, _iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)	\
+	g_hash_table_insert (_method_name_to_type, (gpointer) _dbus_sig_name_str, GUINT_TO_POINTER (E_GDBUS_TYPE_UINT));
+
+#define E_INIT_GDBUS_METHOD_CALL_VOID(_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)				\
+	E_INIT_GDBUS_METHOD_CALL_TMPL_VOID(_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)			\
+	g_hash_table_insert (_method_name_to_type, (gpointer) _dbus_sig_name_str, GUINT_TO_POINTER (E_GDBUS_TYPE_VOID | E_GDBUS_TYPE_IS_ASYNC));
+
+#define E_INIT_GDBUS_METHOD_CALL_BOOLEAN(_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)			\
+	E_INIT_GDBUS_METHOD_CALL_ASYNC_TMPL_TYPED (BOOLEAN, BOOLEAN, _iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)
+
+#define E_INIT_GDBUS_METHOD_CALL_STRING(_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)			\
+	E_INIT_GDBUS_METHOD_CALL_ASYNC_TMPL_TYPED (STRING, STRING, _iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)
+
+#define E_INIT_GDBUS_METHOD_CALL_STRV(_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)				\
+	E_INIT_GDBUS_METHOD_CALL_ASYNC_TMPL_TYPED (BOXED, STRV, _iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)
+
+#define E_INIT_GDBUS_METHOD_CALL_UINT(_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)				\
+	E_INIT_GDBUS_METHOD_CALL_ASYNC_TMPL_TYPED (UINT, UINT, _iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)
+
+#define E_INIT_GDBUS_METHOD_ASYNC_VOID__VOID(_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id, _done_sig_id)	\
+	E_INIT_GDBUS_METHOD_CALL_VOID (_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)			\
+	E_INIT_GDBUS_METHOD_DONE_VOID (_iface_struct, _sig_name_var, _done_sig_id)
+
+#define E_INIT_GDBUS_METHOD_ASYNC_VOID__STRING(_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id, _done_sig_id)	\
+	E_INIT_GDBUS_METHOD_CALL_VOID   (_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)			\
+	E_INIT_GDBUS_METHOD_DONE_STRING (_iface_struct, _sig_name_var, _done_sig_id)
+
+#define E_INIT_GDBUS_METHOD_ASYNC_VOID__STRV(_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id, _done_sig_id)	\
+	E_INIT_GDBUS_METHOD_CALL_VOID (_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)			\
+	E_INIT_GDBUS_METHOD_DONE_STRV (_iface_struct, _sig_name_var, _done_sig_id)
+
+#define E_INIT_GDBUS_METHOD_ASYNC_BOOLEAN__VOID(_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id, _done_sig_id)	\
+	E_INIT_GDBUS_METHOD_CALL_BOOLEAN (_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)			\
+	E_INIT_GDBUS_METHOD_DONE_VOID    (_iface_struct, _sig_name_var, _done_sig_id)
+
+#define E_INIT_GDBUS_METHOD_ASYNC_UINT__VOID(_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id, _done_sig_id)	\
+	E_INIT_GDBUS_METHOD_CALL_UINT (_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)			\
+	E_INIT_GDBUS_METHOD_DONE_VOID (_iface_struct, _sig_name_var, _done_sig_id)
+
+#define E_INIT_GDBUS_METHOD_ASYNC_STRING__VOID(_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id, _done_sig_id)	\
+	E_INIT_GDBUS_METHOD_CALL_STRING (_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)			\
+	E_INIT_GDBUS_METHOD_DONE_VOID   (_iface_struct, _sig_name_var, _done_sig_id)
+
+#define E_INIT_GDBUS_METHOD_ASYNC_STRV__VOID(_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id, _done_sig_id)	\
+	E_INIT_GDBUS_METHOD_CALL_STRV (_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)			\
+	E_INIT_GDBUS_METHOD_DONE_VOID (_iface_struct, _sig_name_var, _done_sig_id)
+
+#define E_INIT_GDBUS_METHOD_ASYNC_STRING__STRING(_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id, _done_sig_id)\
+	E_INIT_GDBUS_METHOD_CALL_STRING (_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)			\
+	E_INIT_GDBUS_METHOD_DONE_STRING (_iface_struct, _sig_name_var, _done_sig_id)
+
+#define E_INIT_GDBUS_METHOD_ASYNC_STRING__STRV(_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id, _done_sig_id)	\
+	E_INIT_GDBUS_METHOD_CALL_STRING (_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)			\
+	E_INIT_GDBUS_METHOD_DONE_STRV   (_iface_struct, _sig_name_var, _done_sig_id)
+
+#define E_INIT_GDBUS_METHOD_ASYNC_STRV__STRING(_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id, _done_sig_id)	\
+	E_INIT_GDBUS_METHOD_CALL_STRV (_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)			\
+	E_INIT_GDBUS_METHOD_DONE_STRING (_iface_struct, _sig_name_var, _done_sig_id)
+
+#define E_INIT_GDBUS_METHOD_ASYNC_STRV__STRV(_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id, _done_sig_id)	\
+	E_INIT_GDBUS_METHOD_CALL_STRV (_iface_struct, _dbus_sig_name_str, _sig_name_var, _method_sig_id)			\
+	E_INIT_GDBUS_METHOD_DONE_STRV (_iface_struct, _sig_name_var, _done_sig_id)
+
+#define E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_VOID(_iface_name, _sig_name)										\
+	static gboolean																	\
+	signal_emission_hook_cb_ ## _sig_name (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, gpointer user_data)	\
+	{																		\
+		return e_gdbus_signal_emission_hook_void (ihint, n_param_values, param_values, user_data, _iface_name);					\
+	}
+
+#define E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_BOOLEAN(_iface_name, _sig_name)										\
+	static gboolean																	\
+	signal_emission_hook_cb_ ## _sig_name (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, gpointer user_data)	\
+	{																		\
+		return e_gdbus_signal_emission_hook_boolean (ihint, n_param_values, param_values, user_data, _iface_name);				\
+	}
+
+#define E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_STRING(_iface_name, _sig_name)										\
+	static gboolean																	\
+	signal_emission_hook_cb_ ## _sig_name (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, gpointer user_data)	\
+	{																		\
+		return e_gdbus_signal_emission_hook_string (ihint, n_param_values, param_values, user_data, _iface_name);				\
+	}
+
+#define E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_STRV(_iface_name, _sig_name)										\
+	static gboolean																	\
+	signal_emission_hook_cb_ ## _sig_name (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, gpointer user_data)	\
+	{																		\
+		return e_gdbus_signal_emission_hook_strv (ihint, n_param_values, param_values, user_data, _iface_name);					\
+	}
+
+#define E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_UINT(_iface_name, _sig_name)										\
+	static gboolean																	\
+	signal_emission_hook_cb_ ## _sig_name (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, gpointer user_data)	\
+	{																		\
+		return e_gdbus_signal_emission_hook_uint (ihint, n_param_values, param_values, user_data, _iface_name);					\
+	}
+
+#define E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_UINT_STRING(_iface_name, _sig_name)										\
+	static gboolean																	\
+	signal_emission_hook_cb_ ## _sig_name (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, gpointer user_data)	\
+	{																		\
+		return e_gdbus_signal_emission_hook_uint_string (ihint, n_param_values, param_values, user_data, _iface_name);					\
+	}
+
+#define E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_ASYNC_VOID(_iface_name, _sig_name)										\
+	static gboolean																	\
+	signal_emission_hook_cb_ ## _sig_name (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, gpointer user_data)	\
+	{																		\
+		return e_gdbus_signal_emission_hook_async_void (ihint, n_param_values, param_values, user_data, _iface_name);				\
+	}
+
+#define E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_ASYNC_BOOLEAN(_iface_name, _sig_name)									\
+	static gboolean																	\
+	signal_emission_hook_cb_ ## _sig_name (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, gpointer user_data)	\
+	{																		\
+		return e_gdbus_signal_emission_hook_async_boolean (ihint, n_param_values, param_values, user_data, _iface_name);			\
+	}
+
+#define E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_ASYNC_STRING(_iface_name, _sig_name)									\
+	static gboolean																	\
+	signal_emission_hook_cb_ ## _sig_name (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, gpointer user_data)	\
+	{																		\
+		return e_gdbus_signal_emission_hook_async_string (ihint, n_param_values, param_values, user_data, _iface_name);				\
+	}
+
+#define E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_ASYNC_STRV(_iface_name, _sig_name)										\
+	static gboolean																	\
+	signal_emission_hook_cb_ ## _sig_name (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, gpointer user_data)	\
+	{																		\
+		return e_gdbus_signal_emission_hook_async_strv (ihint, n_param_values, param_values, user_data, _iface_name);				\
+	}
+
+#define E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_ASYNC_UINT(_iface_name, _sig_name)										\
+	static gboolean																	\
+	signal_emission_hook_cb_ ## _sig_name (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, gpointer user_data)	\
+	{																		\
+		return e_gdbus_signal_emission_hook_async_uint (ihint, n_param_values, param_values, user_data, _iface_name);				\
+	}
+
+#define E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_VOID(_iface_name, _sig_name)									\
+	E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_ASYNC_VOID (_iface_name, _sig_name ## _done)
+
+#define E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_BOOLEAN(_iface_name, _sig_name)									\
+	E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_ASYNC_BOOLEAN (_iface_name, _sig_name ## _done)
+
+#define E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRING(_iface_name, _sig_name)									\
+	E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_ASYNC_STRING (_iface_name, _sig_name ## _done)
+
+#define E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRV(_iface_name, _sig_name)									\
+	E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_ASYNC_STRV (_iface_name, _sig_name ## _done)
+
+#define E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_UINT(_iface_name, _sig_name)									\
+	E_DECLARE_GDBUS_SIGNAL_EMISSION_HOOK_ASYNC_UINT (_iface_name, _sig_name ## _done)
+
+#define E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_VOID(_sig_name)												\
+	g_signal_connect (proxy, # _sig_name "_done", G_CALLBACK (e_gdbus_proxy_async_method_done_void), NULL);
+
+#define E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_BOOLEAN(_sig_name)												\
+	g_signal_connect (proxy, # _sig_name "_done", G_CALLBACK (e_gdbus_proxy_async_method_done_boolean), NULL);
+
+#define E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRING(_sig_name)												\
+	g_signal_connect (proxy, # _sig_name "_done", G_CALLBACK (e_gdbus_proxy_async_method_done_string), NULL);
+
+#define E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRV(_sig_name)												\
+	g_signal_connect (proxy, # _sig_name "_done", G_CALLBACK (e_gdbus_proxy_async_method_done_strv), NULL);
+
+#define E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_UINT(_sig_name)												\
+	g_signal_connect (proxy, # _sig_name "_done", G_CALLBACK (e_gdbus_proxy_async_method_done_uint), NULL);
+
+void e_gdbus_proxy_emit_signal (GDBusProxy *proxy, GVariant *parameters, guint signal_id, guint signal_type);
+void e_gdbus_stub_handle_method_call (GObject *stub_object, GDBusMethodInvocation *invocation, GVariant *parameters, const gchar *method_name, guint method_id, guint method_type);
+
+gboolean e_gdbus_signal_emission_hook_void          (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, const gchar *signal_name, const gchar *iface_name);
+gboolean e_gdbus_signal_emission_hook_boolean       (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, const gchar *signal_name, const gchar *iface_name);
+gboolean e_gdbus_signal_emission_hook_string        (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, const gchar *signal_name, const gchar *iface_name);
+gboolean e_gdbus_signal_emission_hook_strv          (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, const gchar *signal_name, const gchar *iface_name);
+gboolean e_gdbus_signal_emission_hook_uint          (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, const gchar *signal_name, const gchar *iface_name);
+gboolean e_gdbus_signal_emission_hook_uint_string   (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, const gchar *signal_name, const gchar *iface_name);
+
+gboolean e_gdbus_signal_emission_hook_async_void    (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, const gchar *signal_name, const gchar *iface_name);
+gboolean e_gdbus_signal_emission_hook_async_boolean (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, const gchar *signal_name, const gchar *iface_name);
+gboolean e_gdbus_signal_emission_hook_async_string  (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, const gchar *signal_name, const gchar *iface_name);
+gboolean e_gdbus_signal_emission_hook_async_strv    (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, const gchar *signal_name, const gchar *iface_name);
+gboolean e_gdbus_signal_emission_hook_async_uint    (GSignalInvocationHint *ihint, guint n_param_values, const GValue *param_values, const gchar *signal_name, const gchar *iface_name);
+
+/* GDBus calls method completion functions; after the 'async' method is expected associated done signal */
+void e_gdbus_complete_async_method (gpointer object, GDBusMethodInvocation *invocation, guint opid);
+void e_gdbus_complete_sync_method_void		(gpointer object, GDBusMethodInvocation *invocation, const GError *error);
+void e_gdbus_complete_sync_method_boolean	(gpointer object, GDBusMethodInvocation *invocation, gboolean out_boolean, const GError *error);
+void e_gdbus_complete_sync_method_string	(gpointer object, GDBusMethodInvocation *invocation, const gchar *out_string, const GError *error);
+void e_gdbus_complete_sync_method_strv		(gpointer object, GDBusMethodInvocation *invocation, const gchar * const *out_strv, const GError *error);
+void e_gdbus_complete_sync_method_uint		(gpointer object, GDBusMethodInvocation *invocation, guint out_uint, const GError *error);
+
+/* callbacks on done signal handlers in the client proxy, which implements EGdbusAsyncOpKeeper interface;
+   functions take ownership of out parameters and are responsible for their freeing */
+void e_gdbus_proxy_async_method_done_void	(EGdbusAsyncOpKeeper *proxy, guint arg_opid, const GError *error);
+void e_gdbus_proxy_async_method_done_boolean	(EGdbusAsyncOpKeeper *proxy, guint arg_opid, const GError *error, gboolean out_boolean);
+void e_gdbus_proxy_async_method_done_string	(EGdbusAsyncOpKeeper *proxy, guint arg_opid, const GError *error, const gchar *out_string);
+void e_gdbus_proxy_async_method_done_strv	(EGdbusAsyncOpKeeper *proxy, guint arg_opid, const GError *error, const gchar * const *out_strv);
+void e_gdbus_proxy_async_method_done_uint	(EGdbusAsyncOpKeeper *proxy, guint arg_opid, const GError *error, guint out_uint);
+
+void e_gdbus_proxy_call_void	(const gchar *method_name, gpointer source_tag, EGdbusAsyncOpKeeper *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+void e_gdbus_proxy_call_boolean	(const gchar *method_name, gpointer source_tag, EGdbusAsyncOpKeeper *proxy, gboolean in_boolean, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+void e_gdbus_proxy_call_string	(const gchar *method_name, gpointer source_tag, EGdbusAsyncOpKeeper *proxy, const gchar *in_string, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+void e_gdbus_proxy_call_strv	(const gchar *method_name, gpointer source_tag, EGdbusAsyncOpKeeper *proxy, const gchar * const *in_strv, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+void e_gdbus_proxy_call_uint	(const gchar *method_name, gpointer source_tag, EGdbusAsyncOpKeeper *proxy, guint in_uint, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+
+gboolean e_gdbus_proxy_finish_call_void    (EGdbusAsyncOpKeeper *proxy, GAsyncResult *result, GError **error, gpointer source_tag);
+gboolean e_gdbus_proxy_finish_call_boolean (EGdbusAsyncOpKeeper *proxy, GAsyncResult *result, gboolean *out_boolean, GError **error, gpointer source_tag);
+gboolean e_gdbus_proxy_finish_call_string  (EGdbusAsyncOpKeeper *proxy, GAsyncResult *result, gchar **out_string, GError **error, gpointer source_tag);
+gboolean e_gdbus_proxy_finish_call_strv    (EGdbusAsyncOpKeeper *proxy, GAsyncResult *result, gchar ***out_strv, GError **error, gpointer source_tag);
+gboolean e_gdbus_proxy_finish_call_uint    (EGdbusAsyncOpKeeper *proxy, GAsyncResult *result, guint *out_uint, GError **error, gpointer source_tag);
+
+typedef void (* EGdbusCallStartVoid)	(GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+typedef void (* EGdbusCallStartBoolean)	(GDBusProxy *proxy, gboolean in_boolean, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+typedef void (* EGdbusCallStartString)	(GDBusProxy *proxy, const gchar *in_string, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+typedef void (* EGdbusCallStartStrv)	(GDBusProxy *proxy, const gchar * const *in_strv, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+typedef void (* EGdbusCallStartUint)	(GDBusProxy *proxy, guint in_uint, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+
+typedef gboolean (* EGdbusCallFinishVoid)	(GDBusProxy *proxy, GAsyncResult *result, GError **error);
+typedef gboolean (* EGdbusCallFinishBoolean)	(GDBusProxy *proxy, GAsyncResult *result, gboolean *out_boolean, GError **error);
+typedef gboolean (* EGdbusCallFinishString)	(GDBusProxy *proxy, GAsyncResult *result, gchar **out_string, GError **error);
+typedef gboolean (* EGdbusCallFinishStrv)	(GDBusProxy *proxy, GAsyncResult *result, gchar ***out_strv, GError **error);
+typedef gboolean (* EGdbusCallFinishUint)	(GDBusProxy *proxy, GAsyncResult *result, guint *out_uint, GError **error);
+
+/* this is for methods which are dividied into invocation and done signal */
+gboolean e_gdbus_proxy_call_sync_void__void	(GDBusProxy *proxy, GCancellable *cancellable, GError **error, EGdbusCallStartVoid start_func, EGdbusCallFinishVoid finish_func);
+gboolean e_gdbus_proxy_call_sync_void__boolean	(GDBusProxy *proxy, gboolean *out_boolean, GCancellable *cancellable, GError **error, EGdbusCallStartVoid start_func, EGdbusCallFinishBoolean finish_func);
+gboolean e_gdbus_proxy_call_sync_void__string	(GDBusProxy *proxy, gchar **out_string, GCancellable *cancellable, GError **error, EGdbusCallStartVoid start_func, EGdbusCallFinishString finish_func);
+gboolean e_gdbus_proxy_call_sync_void__strv	(GDBusProxy *proxy, gchar ***out_strv, GCancellable *cancellable, GError **error, EGdbusCallStartVoid start_func, EGdbusCallFinishStrv finish_func);
+gboolean e_gdbus_proxy_call_sync_void__uint	(GDBusProxy *proxy, guint *out_uint, GCancellable *cancellable, GError **error, EGdbusCallStartVoid start_func, EGdbusCallFinishUint finish_func);
+gboolean e_gdbus_proxy_call_sync_boolean__void	(GDBusProxy *proxy, gboolean in_boolean, GCancellable *cancellable, GError **error, EGdbusCallStartBoolean start_func, EGdbusCallFinishVoid finish_func);
+gboolean e_gdbus_proxy_call_sync_string__void	(GDBusProxy *proxy, const gchar *in_string, GCancellable *cancellable, GError **error, EGdbusCallStartString start_func, EGdbusCallFinishVoid finish_func);
+gboolean e_gdbus_proxy_call_sync_strv__void	(GDBusProxy *proxy, const gchar * const *in_strv, GCancellable *cancellable, GError **error, EGdbusCallStartStrv start_func, EGdbusCallFinishVoid finish_func);
+gboolean e_gdbus_proxy_call_sync_uint__void	(GDBusProxy *proxy, guint in_uint, GCancellable *cancellable, GError **error, EGdbusCallStartUint start_func, EGdbusCallFinishVoid finish_func);
+gboolean e_gdbus_proxy_call_sync_string__string	(GDBusProxy *proxy, const gchar *in_string, gchar **out_string, GCancellable *cancellable, GError **error, EGdbusCallStartString start_func, EGdbusCallFinishString finish_func);
+gboolean e_gdbus_proxy_call_sync_string__strv	(GDBusProxy *proxy, const gchar *in_string, gchar ***out_strv, GCancellable *cancellable, GError **error, EGdbusCallStartString start_func, EGdbusCallFinishStrv finish_func);
+gboolean e_gdbus_proxy_call_sync_strv__string	(GDBusProxy *proxy, const gchar * const *in_strv, gchar **out_string, GCancellable *cancellable, GError **error, EGdbusCallStartStrv start_func, EGdbusCallFinishString finish_func);
+gboolean e_gdbus_proxy_call_sync_strv__strv	(GDBusProxy *proxy, const gchar * const *in_strv, gchar ***out_strv, GCancellable *cancellable, GError **error, EGdbusCallStartStrv start_func, EGdbusCallFinishStrv finish_func);
+
+/* this is for "synchronous" methods, those without done signal */
+void	 e_gdbus_proxy_method_call_void			(const gchar *method_name, GDBusProxy *proxy, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+void	 e_gdbus_proxy_method_call_boolean		(const gchar *method_name, GDBusProxy *proxy, gboolean in_boolean, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+void	 e_gdbus_proxy_method_call_string		(const gchar *method_name, GDBusProxy *proxy, const gchar *in_string, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+void	 e_gdbus_proxy_method_call_strv			(const gchar *method_name, GDBusProxy *proxy, const gchar * const *in_strv, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+void	 e_gdbus_proxy_method_call_uint			(const gchar *method_name, GDBusProxy *proxy, guint in_uint, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+
+gboolean e_gdbus_proxy_method_call_finish_void		(GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean e_gdbus_proxy_method_call_finish_boolean	(GDBusProxy *proxy, GAsyncResult *result, gboolean *out_boolean, GError **error);
+gboolean e_gdbus_proxy_method_call_finish_string	(GDBusProxy *proxy, GAsyncResult *result, gchar **out_string, GError **error);
+gboolean e_gdbus_proxy_method_call_finish_strv		(GDBusProxy *proxy, GAsyncResult *result, gchar ***out_strv, GError **error);
+gboolean e_gdbus_proxy_method_call_finish_uint		(GDBusProxy *proxy, GAsyncResult *result, guint *out_uint, GError **error);
+
+gboolean e_gdbus_proxy_method_call_sync_void__void	(const gchar *method_name, GDBusProxy *proxy, GCancellable *cancellable, GError **error);
+gboolean e_gdbus_proxy_method_call_sync_boolean__void	(const gchar *method_name, GDBusProxy *proxy, gboolean in_boolean, GCancellable *cancellable, GError **error);
+gboolean e_gdbus_proxy_method_call_sync_string__void	(const gchar *method_name, GDBusProxy *proxy, const gchar *in_string, GCancellable *cancellable, GError **error);
+gboolean e_gdbus_proxy_method_call_sync_strv__void	(const gchar *method_name, GDBusProxy *proxy, const gchar * const *in_strv, GCancellable *cancellable, GError **error);
+gboolean e_gdbus_proxy_method_call_sync_uint__void	(const gchar *method_name, GDBusProxy *proxy, guint in_uint, GCancellable *cancellable, GError **error);
+gboolean e_gdbus_proxy_method_call_sync_string__string	(const gchar *method_name, GDBusProxy *proxy, const gchar *in_string, gchar **out_string, GCancellable *cancellable, GError **error);
+gboolean e_gdbus_proxy_method_call_sync_strv__string	(const gchar *method_name, GDBusProxy *proxy, const gchar * const *in_strv, gchar **out_string, GCancellable *cancellable, GError **error);
+
+G_END_DECLS
+
+#endif /* E_GDBUS_TEMPLATES_H */
diff --git a/libedataserver/e-operation-pool.c b/libedataserver/e-operation-pool.c
new file mode 100644
index 0000000..edef4d6
--- /dev/null
+++ b/libedataserver/e-operation-pool.c
@@ -0,0 +1,136 @@
+/*
+ * e-operation-pool.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include <glib.h>
+
+#include "e-operation-pool.h"
+
+struct _EOperationPool {
+	GThreadPool *pool;
+
+	GMutex *ops_lock;
+	GHashTable *ops;
+	guint32 last_opid;
+};
+
+EOperationPool *
+e_operation_pool_new (guint max_threads, GFunc thread_func, gpointer user_data)
+{
+	EOperationPool *pool;
+	GThreadPool *thread_pool;
+	GError *error = NULL;
+
+	g_return_val_if_fail (thread_func != NULL, NULL);
+
+	thread_pool = g_thread_pool_new (thread_func, user_data, max_threads, FALSE, &error);
+	if (error) {
+		g_warning ("%s: Failed to create thread pool: %s", G_STRFUNC, error->message);
+		g_error_free (error);
+		return NULL;
+	}
+
+	pool = g_new0 (EOperationPool, 1);
+	pool->pool = thread_pool;
+	pool->ops_lock = g_mutex_new ();
+	pool->ops = g_hash_table_new (g_direct_hash, g_direct_equal);
+	pool->last_opid = 0;
+
+	/* Kill threads which don't do anything for 10 seconds */
+	g_thread_pool_set_max_idle_time (10 * 1000);
+
+	return pool;
+}
+
+void
+e_operation_pool_free (EOperationPool *pool)
+{
+	g_return_if_fail (pool != NULL);
+
+	g_thread_pool_free (pool->pool, FALSE, FALSE);
+	g_mutex_free (pool->ops_lock);
+	g_hash_table_destroy (pool->ops);
+	g_free (pool);
+}
+
+/* Reserves new operation ID, which is returned. This operation ID may
+   be released by e_operation_pool_release_opid() when the operation
+   is finished.
+*/
+guint32
+e_operation_pool_reserve_opid (EOperationPool *pool)
+{
+	guint32 opid;
+
+	g_return_val_if_fail (pool != NULL, 0);
+	g_return_val_if_fail (pool->ops != NULL, 0);
+	g_return_val_if_fail (pool->ops_lock != NULL, 0);
+
+	g_mutex_lock (pool->ops_lock);
+
+	pool->last_opid++;
+	if (!pool->last_opid)
+		pool->last_opid = 1;
+
+	while (pool->last_opid && g_hash_table_lookup (pool->ops, GUINT_TO_POINTER (pool->last_opid)))
+		pool->last_opid++;
+
+	opid = pool->last_opid;
+	if (opid)
+		g_hash_table_insert (pool->ops, GUINT_TO_POINTER (opid), GUINT_TO_POINTER (1));
+
+	g_mutex_unlock (pool->ops_lock);
+
+	g_return_val_if_fail (opid != 0, 0);
+
+	return opid;
+}
+
+/* Releases operation ID previously reserved by e_operation_pool_reserve_opid(). */
+void
+e_operation_pool_release_opid (EOperationPool *pool, guint32 opid)
+{
+	g_return_if_fail (pool != NULL);
+	g_return_if_fail (pool->ops != NULL);
+	g_return_if_fail (pool->ops_lock != NULL);
+
+	g_mutex_lock (pool->ops_lock);
+	g_hash_table_remove (pool->ops, GUINT_TO_POINTER (opid));
+	g_mutex_unlock (pool->ops_lock);
+}
+
+/* Pushes operation to be processed. 'opdata' is passed to the function
+   provided in e_operation_pool_new().
+*/
+void
+e_operation_pool_push (EOperationPool *pool, gpointer opdata)
+{
+	GError *error = NULL;
+
+	g_return_if_fail (pool != NULL);
+	g_return_if_fail (pool->pool != NULL);
+
+	g_thread_pool_push (pool->pool, opdata, &error);
+
+	if (error) {
+		g_warning ("%s: Failed to push to thread pool: %s", G_STRFUNC, error->message);
+		g_error_free (error);
+	}
+}
diff --git a/libedataserver/e-operation-pool.h b/libedataserver/e-operation-pool.h
new file mode 100644
index 0000000..f3f481c
--- /dev/null
+++ b/libedataserver/e-operation-pool.h
@@ -0,0 +1,36 @@
+/*
+ * e-operation-pool.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_OPERATION_POOL_H
+#define E_OPERATION_POOL_H
+
+#include <glib.h>
+#include <gio/gio.h>
+
+typedef struct _EOperationPool EOperationPool;
+
+EOperationPool *e_operation_pool_new (guint max_threads, GFunc thread_func, gpointer user_data);
+void		e_operation_pool_free (EOperationPool *pool);
+guint32		e_operation_pool_reserve_opid (EOperationPool *pool);
+void		e_operation_pool_release_opid (EOperationPool *pool, guint32 opid);
+void		e_operation_pool_push (EOperationPool *pool, gpointer data);
+
+#endif /* E_OPERATION_POOL_H */
diff --git a/libedataserverui/Makefile.am b/libedataserverui/Makefile.am
index e20028d..1fcde30 100644
--- a/libedataserverui/Makefile.am
+++ b/libedataserverui/Makefile.am
@@ -7,11 +7,14 @@ CPPFLAGS = \
 	-I$(top_srcdir)				\
 	-I$(top_srcdir)/addressbook		\
 	-I$(top_builddir)/addressbook		\
+	-I$(top_srcdir)/calendar		\
+	-I$(top_builddir)/calendar		\
 	-DG_LOG_DOMAIN=\"e-data-server-ui\"	\
 	-DE_DATA_SERVER_UI_UIDIR=\""$(uidir)"\"	\
 	$(E_DATA_SERVER_UI_CFLAGS)		\
 	$(GNOME_KEYRING_CFLAGS)			\
-	$(CAMEL_CFLAGS)
+	$(CAMEL_CFLAGS)				\
+	$(SOUP_CFLAGS)
 
 lib_LTLIBRARIES = libedataserverui-3.0.la
 
@@ -20,6 +23,7 @@ libedataserveruiinclude_HEADERS =	\
 	e-category-completion.h		\
 	e-destination-store.h		\
 	e-book-auth-util.h		\
+	e-client-authenticate.h		\
 	e-contact-store.h		\
 	e-name-selector.h		\
 	e-name-selector-dialog.h	\
@@ -47,6 +51,7 @@ libedataserverui_3_0_la_SOURCES =	\
 	e-category-completion.c		\
 	e-destination-store.c		\
 	e-book-auth-util.c		\
+	e-client-authenticate.c		\
 	e-contact-store.c		\
 	e-name-selector.c		\
 	e-name-selector-dialog.c	\
@@ -64,11 +69,13 @@ libedataserverui_3_0_la_CPPFLAGS = $(CPPFLAGS)
 
 libedataserverui_3_0_la_LIBADD = 				\
 	$(top_builddir)/addressbook/libebook/libebook-1.2.la	\
+	$(top_builddir)/calendar/libecal/libecal-1.2.la		\
 	$(top_builddir)/libedataserver/libedataserver-1.2.la	\
 	$(top_builddir)/camel/libcamel-1.2.la			\
 	$(E_DATA_SERVER_UI_LIBS)				\
 	$(GNOME_KEYRING_LIBS)					\
-	$(CAMEL_LIBS)
+	$(CAMEL_LIBS)						\
+	$(SOUP_LIBS)
 
 libedataserverui_3_0_la_LDFLAGS = \
 	-version-info $(LIBEDATASERVERUI_CURRENT):$(LIBEDATASERVERUI_REVISION):$(LIBEDATASERVERUI_AGE) $(NO_UNDEFINED)
diff --git a/libedataserverui/e-client-authenticate.c b/libedataserverui/e-client-authenticate.c
new file mode 100644
index 0000000..0063259
--- /dev/null
+++ b/libedataserverui/e-client-authenticate.c
@@ -0,0 +1,185 @@
+/*
+ * e-client-authenticate.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+#include <glib/gi18n-lib.h>
+#include <gtk/gtk.h>
+#include <libsoup/soup.h>
+
+#include <libedataserver/e-client.h>
+#include <libebook/e-book-client.h>
+#include <libecal/e-cal-client.h>
+
+#include "e-passwords.h"
+#include "e-client-authenticate.h"
+
+/* This function is suitable as a handler for EClient::authenticate signal.
+   It takes care of all the password prompt and such and returns TRUE if
+   credentials (password) were provided. Thus just connect it to that signal
+   and it'll take care of everything else.
+*/
+gboolean
+e_client_authenticate_handler (EClient *client, ECredentials *credentials)
+{
+	ESource *source;
+	gboolean is_book, is_cal, res, remember_password = FALSE;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (credentials != NULL, FALSE);
+
+	is_book = E_IS_BOOK_CLIENT (client);
+	is_cal = !is_book && E_IS_CAL_CLIENT (client);
+	g_return_val_if_fail (is_book || is_cal, FALSE);
+
+	source = e_client_get_source (client);
+	g_return_val_if_fail (source != NULL, FALSE);
+
+	if (!e_credentials_has_key (credentials, E_CREDENTIALS_KEY_USERNAME)) {
+		e_credentials_set (credentials, E_CREDENTIALS_KEY_USERNAME, e_source_get_property (source, "username"));
+
+		/* no username set on the source - deny authentication request until
+		   username will be also enterable with e-passwords */
+		if (!e_credentials_has_key (credentials, E_CREDENTIALS_KEY_USERNAME))
+			return FALSE;
+	}
+
+	if (!e_credentials_has_key (credentials, E_CREDENTIALS_KEY_AUTH_DOMAIN))
+		e_credentials_set (credentials, E_CREDENTIALS_KEY_AUTH_DOMAIN, is_book ? E_CREDENTIALS_AUTH_DOMAIN_ADDRESSBOOK : E_CREDENTIALS_AUTH_DOMAIN_CALENDAR);
+
+	if (!e_credentials_has_key (credentials, E_CREDENTIALS_KEY_PROMPT_TEXT)) {
+		gchar *prompt;
+		gchar *username_markup, *source_name_markup;
+
+		username_markup = g_markup_printf_escaped ("<b>%s</b>", e_credentials_peek (credentials, E_CREDENTIALS_KEY_USERNAME));
+		source_name_markup = g_markup_printf_escaped ("<b>%s</b>", e_source_peek_name (source));
+
+		prompt = g_strdup_printf (_("Enter password for %s (user %s)"), source_name_markup, username_markup);
+
+		e_credentials_set (credentials, E_CREDENTIALS_KEY_PROMPT_TEXT, prompt);
+
+		g_free (username_markup);
+		g_free (source_name_markup);
+		g_free (prompt);
+	}
+
+	if (!e_credentials_has_key (credentials, E_CREDENTIALS_KEY_PROMPT_KEY)) {
+		SoupURI *suri;
+		gchar *uri_str;
+
+		suri = soup_uri_new (e_client_get_uri (client));
+		g_return_val_if_fail (suri != NULL, FALSE);
+
+		soup_uri_set_user (suri, e_credentials_peek (credentials, E_CREDENTIALS_KEY_USERNAME));
+		soup_uri_set_password (suri, NULL);
+		soup_uri_set_fragment (suri, NULL);
+
+		uri_str = soup_uri_to_string (suri, FALSE);
+
+		e_credentials_set (credentials, E_CREDENTIALS_KEY_PROMPT_KEY, uri_str);
+
+		g_free (uri_str);
+		soup_uri_free (suri);
+	}
+
+	remember_password = g_strcmp0 (e_source_get_property (source, "remember_password"), "true") == 0;
+
+	res = e_credentials_authenticate_helper (credentials, NULL, &remember_password);
+
+	if (res)
+		e_source_set_property (source, "remember_password", remember_password ? "true" : NULL);
+
+	e_credentials_clear_peek (credentials);
+
+	return res;
+}
+
+/* Asks for a password based on the provided credentials information.
+   Credentials should have set following keys:
+      E_CREDENTIALS_KEY_USERNAME
+      E_CREDENTIALS_KEY_AUTH_DOMAIN
+      E_CREDENTIALS_KEY_PROMPT_TEXT
+      E_CREDENTIALS_KEY_PROMPT_KEY
+   all other keys are optional. If also E_CREDENTIALS_KEY_PASSWORD key is provided,
+   then it implies a reprompt.
+
+   When this returns TRUE, then the structure contains E_CREDENTIALS_KEY_PASSWORD set
+   as entered by a user.
+*/
+gboolean
+e_credentials_authenticate_helper (ECredentials *credentials, GtkWindow *parent, gboolean *remember_password)
+{
+	gboolean res, fake_remember_password = FALSE;
+	guint prompt_flags;
+	gchar *password = NULL;
+	const gchar *title, *auth_domain, *prompt_key;
+
+	g_return_val_if_fail (credentials != NULL, FALSE);
+	g_return_val_if_fail (e_credentials_has_key (credentials, E_CREDENTIALS_KEY_USERNAME), FALSE);
+	g_return_val_if_fail (e_credentials_has_key (credentials, E_CREDENTIALS_KEY_AUTH_DOMAIN), FALSE);
+	g_return_val_if_fail (e_credentials_has_key (credentials, E_CREDENTIALS_KEY_PROMPT_TEXT), FALSE);
+	g_return_val_if_fail (e_credentials_has_key (credentials, E_CREDENTIALS_KEY_PROMPT_KEY), FALSE);
+
+	if (e_credentials_has_key (credentials, E_CREDENTIALS_KEY_PROMPT_FLAGS)) {
+		prompt_flags = e_credentials_util_string_to_prompt_flags (e_credentials_peek (credentials, E_CREDENTIALS_KEY_PROMPT_FLAGS));
+	} else {
+		prompt_flags = E_CREDENTIALS_PROMPT_FLAG_SECRET | E_CREDENTIALS_PROMPT_FLAG_ONLINE;
+	}
+
+	if (!remember_password) {
+		prompt_flags |= E_CREDENTIALS_PROMPT_FLAG_DISABLE_REMEMBER;
+		remember_password = &fake_remember_password;
+	}
+
+	if (e_credentials_has_key (credentials, E_CREDENTIALS_KEY_PASSWORD))
+		prompt_flags |= E_CREDENTIALS_PROMPT_FLAG_REPROMPT;
+
+	if (e_credentials_has_key (credentials, E_CREDENTIALS_KEY_PROMPT_TITLE))
+		title = e_credentials_peek (credentials, E_CREDENTIALS_KEY_PROMPT_TITLE);
+	else if (prompt_flags & E_CREDENTIALS_PROMPT_FLAG_PASSPHRASE)
+		title = _("Enter Passphrase");
+	else
+		title = _("Enter Password");
+
+	auth_domain = e_credentials_peek (credentials, E_CREDENTIALS_KEY_AUTH_DOMAIN);
+	prompt_key = e_credentials_peek (credentials, E_CREDENTIALS_KEY_PROMPT_KEY);
+
+	if (!(prompt_flags & E_CREDENTIALS_PROMPT_FLAG_REPROMPT))
+		password = e_passwords_get_password (auth_domain, prompt_key);
+
+	if (!password)
+		password = e_passwords_ask_password (title, auth_domain, prompt_key,
+				e_credentials_peek (credentials, E_CREDENTIALS_KEY_PROMPT_TEXT),
+				prompt_flags, remember_password, parent);
+
+	res = password != NULL;
+
+	if (res)
+		e_credentials_set (credentials, E_CREDENTIALS_KEY_PASSWORD, password);
+
+	e_credentials_util_safe_free_string (password);
+	e_credentials_clear_peek (credentials);
+
+	return res;
+}
diff --git a/libedataserverui/e-client-authenticate.h b/libedataserverui/e-client-authenticate.h
new file mode 100644
index 0000000..2bc887f
--- /dev/null
+++ b/libedataserverui/e-client-authenticate.h
@@ -0,0 +1,37 @@
+/*
+ * e-client-authenticate.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#ifndef E_CLIENT_AUTHENTICATE_H
+#define E_CLIENT_AUTHENTICATE_H
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include <libedataserver/e-client.h>
+
+G_BEGIN_DECLS
+
+gboolean e_client_authenticate_handler (EClient *client, ECredentials *credentials);
+gboolean e_credentials_authenticate_helper (ECredentials *credentials, GtkWindow *parent, gboolean *remember_password);
+
+G_END_DECLS
+
+#endif /* E_CLIENT_AUTHENTICATE_H */
\ No newline at end of file
diff --git a/po/POTFILES.in b/po/POTFILES.in
index e1e39a0..ba78aea 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -8,6 +8,7 @@ addressbook/backends/ldap/e-book-backend-ldap.c
 addressbook/backends/vcf/e-book-backend-vcf.c
 addressbook/backends/webdav/e-book-backend-webdav.c
 addressbook/libebook/e-book.c
+addressbook/libebook/e-book-client.c
 addressbook/libebook/e-contact.c
 addressbook/libebook/e-destination.c
 addressbook/libedata-book/e-data-book-factory.c
@@ -19,6 +20,7 @@ calendar/backends/groupwise/e-cal-backend-groupwise-utils.c
 calendar/backends/groupwise/e-cal-backend-groupwise.c
 calendar/backends/http/e-cal-backend-http.c
 calendar/backends/weather/e-cal-backend-weather.c
+calendar/libecal/e-cal-client.c
 calendar/libecal/e-cal-component.c
 calendar/libecal/e-cal-recur.c
 calendar/libecal/e-cal-util.c
@@ -189,6 +191,7 @@ libedataserverui/e-book-auth-util.c
 libedataserverui/e-categories-dialog.c
 libedataserverui/e-category-completion.c
 libedataserverui/e-cell-renderer-color.c
+libedataserverui/e-client-authenticate.c
 libedataserverui/e-name-selector-dialog.c
 libedataserverui/e-name-selector-entry.c
 libedataserverui/e-name-selector-list.c
diff --git a/tests/libebook/Makefile.am b/tests/libebook/Makefile.am
index 90a1e60..ac23d45 100644
--- a/tests/libebook/Makefile.am
+++ b/tests/libebook/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = vcard
+SUBDIRS = vcard client
 
 noinst_LTLIBRARIES = libebook-test-utils.la
 libebook_test_utils_la_SOURCES = ebook-test-utils.c ebook-test-utils.h
diff --git a/tests/libebook/client/Makefile.am b/tests/libebook/client/Makefile.am
new file mode 100644
index 0000000..f895172
--- /dev/null
+++ b/tests/libebook/client/Makefile.am
@@ -0,0 +1,104 @@
+noinst_LTLIBRARIES = libclient-test-utils.la
+
+libclient_test_utils_la_SOURCES = client-test-utils.c client-test-utils.h
+
+libclient_test_utils_la_CPPFLAGS =				\
+	$(AM_CPPFLAGS)						\
+	-I$(top_srcdir)						\
+	-I$(top_builddir)					\
+	-I$(top_srcdir)/addressbook				\
+	-I$(top_builddir)/addressbook				\
+	-DSRCDIR=\""$(srcdir)"\"				\
+	$(EVOLUTION_ADDRESSBOOK_CFLAGS)				\
+	$(NULL)
+
+libclient_test_utils_la_LIBADD = 				\
+	$(top_builddir)/addressbook/libebook/libebook-1.2.la	\
+	$(EVOLUTION_ADDRESSBOOK_LIBS)				\
+	$(NULL)
+
+# Should be kept ordered approximately from least to most difficult/complex
+TESTS =								\
+	test-client-remove					\
+	test-client-get-required-fields				\
+	test-client-get-capabilities				\
+	test-client-get-supported-fields			\
+	test-client-get-supported-auth-methods			\
+	test-client-add-contact					\
+	test-client-get-contact					\
+	test-client-get-book-view				\
+	test-client-modify-contact				\
+	test-client-remove-contact				\
+	test-client-remove-contact-by-uid			\
+	test-client-remove-contacts				\
+	test-client-stress-factory--serial			\
+	test-client-stress-factory--fifo			\
+	test-client-stress-factory--single-book			\
+	$(NULL)
+
+noinst_PROGRAMS =						\
+	$(TESTS)						\
+	test-client						\
+	test-client-async					\
+	test-client-nonexistent-id				\
+	test-client-search					\
+	test-client-self					\
+	test-client-stress-views				\
+	$(NULL)
+
+TEST_CPPFLAGS =							\
+	$(libclient_test_utils_la_CPPFLAGS)			\
+	$(EVOLUTION_ADDRESSBOOK_CPPFLAGS)			\
+	$(NULL)
+
+TEST_LIBS =							\
+	$(libclient_test_utils_la_LIBS)				\
+	libclient-test-utils.la					\
+	$(top_builddir)/addressbook/libebook/libebook-1.2.la	\
+	$(EVOLUTION_ADDRESSBOOK_LIBS)				\
+	$(NULL)
+
+test_client_LDADD=$(TEST_LIBS)
+test_client_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_async_LDADD=$(TEST_LIBS)
+test_client_async_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_add_contact_LDADD=$(TEST_LIBS)
+test_client_add_contact_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_get_book_view_LDADD=$(TEST_LIBS)
+test_client_get_book_view_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_get_contact_LDADD=$(TEST_LIBS)
+test_client_get_contact_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_get_required_fields_LDADD=$(TEST_LIBS)
+test_client_get_required_fields_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_get_capabilities_LDADD=$(TEST_LIBS)
+test_client_get_capabilities_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_get_supported_auth_methods_LDADD=$(TEST_LIBS)
+test_client_get_supported_auth_methods_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_get_supported_fields_LDADD=$(TEST_LIBS)
+test_client_get_supported_fields_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_modify_contact_LDADD=$(TEST_LIBS)
+test_client_modify_contact_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_remove_LDADD=$(TEST_LIBS)
+test_client_remove_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_remove_contact_LDADD=$(TEST_LIBS)
+test_client_remove_contact_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_remove_contact_by_uid_LDADD=$(TEST_LIBS)
+test_client_remove_contact_by_uid_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_remove_contacts_LDADD=$(TEST_LIBS)
+test_client_remove_contacts_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_stress_factory__fifo_LDADD=$(TEST_LIBS)
+test_client_stress_factory__fifo_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_stress_factory__serial_LDADD=$(TEST_LIBS)
+test_client_stress_factory__serial_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_stress_factory__single_book_LDADD=$(TEST_LIBS)
+test_client_stress_factory__single_book_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_nonexistent_id_LDADD=$(TEST_LIBS)
+test_client_nonexistent_id_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_search_LDADD=$(TEST_LIBS)
+test_client_search_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_self_LDADD=$(TEST_LIBS)
+test_client_self_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_stress_views_LDADD=$(TEST_LIBS)
+test_client_stress_views_CPPFLAGS=$(TEST_CPPFLAGS)
+
+-include $(top_srcdir)/git.mk
diff --git a/tests/libebook/client/client-test-utils.c b/tests/libebook/client/client-test-utils.c
new file mode 100644
index 0000000..4b007e8
--- /dev/null
+++ b/tests/libebook/client/client-test-utils.c
@@ -0,0 +1,434 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdio.h>
+
+#include "client-test-utils.h"
+
+void
+report_error (const gchar *operation, GError **error)
+{
+	g_return_if_fail (operation != NULL);
+
+	g_printerr ("Failed to %s: %s\n", operation, (error && *error) ? (*error)->message : "Unknown error");
+
+	g_clear_error (error);
+}
+
+void
+print_email (EContact *contact)
+{
+	const gchar *file_as = e_contact_get_const (contact, E_CONTACT_FILE_AS);
+	const gchar *name_or_org = e_contact_get_const (contact, E_CONTACT_NAME_OR_ORG);
+	GList *emails, *e;
+
+	g_print ("   Contact: %s\n", file_as);
+	g_print ("   Name or org: %s\n", name_or_org);
+	g_print ("   Email addresses:\n");
+	emails = e_contact_get (contact, E_CONTACT_EMAIL);
+	for (e = emails; e; e = e->next) {
+		g_print ("\t%s\n",  (gchar *)e->data);
+	}
+	g_list_foreach (emails, (GFunc)g_free, NULL);
+	g_list_free (emails);
+
+	g_print ("\n");
+}
+
+EBookClient *
+open_system_book (gboolean only_if_exists)
+{
+	EBookClient *book_client;
+	GError *error = NULL;
+
+	main_initialize ();
+
+	book_client = e_book_client_new_system_addressbook (&error);
+	if (error) {
+		report_error ("create system addressbook", &error);
+		return NULL;
+	}
+
+	if (!e_client_open_sync (E_CLIENT (book_client), only_if_exists, NULL, &error)) {
+		g_object_unref (book_client);
+		report_error ("open client sync", &error);
+		return NULL;
+	}
+
+	return book_client;
+}
+
+void
+main_initialize (void)
+{
+	static gboolean initialized = FALSE;
+
+	if (initialized)
+		return;
+
+	g_type_init ();
+	g_thread_init (NULL);
+
+	initialized = TRUE;
+}
+
+struct IdleData {
+	GThreadFunc func;
+	gpointer data;
+	gboolean run_in_thread; /* FALSE to run in idle callback */
+};
+
+static gboolean
+idle_cb (gpointer data)
+{
+	struct IdleData *idle = data;
+
+	g_return_val_if_fail (idle != NULL, FALSE);
+	g_return_val_if_fail (idle->func != NULL, FALSE);
+
+	if (idle->run_in_thread) {
+		GError *error = NULL;
+
+		g_thread_create (idle->func, idle->data, FALSE, &error);
+
+		if (error) {
+			report_error ("create thread", &error);
+			stop_main_loop (1);
+		}
+	} else {
+		idle->func (idle->data);
+	}
+
+	g_free (idle);
+
+	return FALSE;
+}
+
+static GMainLoop *loop = NULL;
+static gint main_stop_result = 0;
+
+static void
+do_start (GThreadFunc func, gpointer data)
+{
+	main_initialize ();
+
+	g_return_if_fail (loop == NULL);
+
+	loop = g_main_loop_new (NULL, FALSE);
+
+	if (func)
+		func (data);
+
+	g_main_loop_run (loop);
+
+	g_main_loop_unref (loop);
+	loop = NULL;
+}
+
+/* Starts new main-loop, but just before that calls 'func'.
+   Main-loop is kept running, and this function blocks, 
+   until call of stop_main_loop().
+*/
+void
+start_main_loop (GThreadFunc func, gpointer data)
+{
+	g_return_if_fail (loop == NULL);
+
+	do_start (func, data);
+}
+
+/* Starts new main-loop and then invokes func in a new thread.
+   Main-loop is kept running, and this function blocks, 
+   until call of stop_main_loop().
+*/
+void
+start_in_thread_with_main_loop (GThreadFunc func, gpointer data)
+{
+	struct IdleData *idle;
+
+	g_return_if_fail (func != NULL);
+	g_return_if_fail (loop == NULL);
+
+	main_initialize ();
+
+	idle = g_new0 (struct IdleData, 1);
+	idle->func = func;
+	idle->data = data;
+	idle->run_in_thread = TRUE;
+
+	g_idle_add (idle_cb, idle);
+
+	do_start (NULL, NULL);
+}
+
+/* Starts new main-loop and then invokes func in an idle callback.
+   Main-loop is kept running, and this function blocks, 
+   until call of stop_main_loop().
+*/
+void
+start_in_idle_with_main_loop (GThreadFunc func, gpointer data)
+{
+	struct IdleData *idle;
+
+	g_return_if_fail (func != NULL);
+	g_return_if_fail (loop == NULL);
+
+	main_initialize ();
+
+	idle = g_new0 (struct IdleData, 1);
+	idle->func = func;
+	idle->data = data;
+	idle->run_in_thread = FALSE;
+
+	g_idle_add (idle_cb, idle);
+
+	do_start (NULL, NULL);
+}
+
+/* Stops main-loop previously run by start_main_loop,
+   start_in_thread_with_main_loop or start_in_idle_with_main_loop.
+*/
+void
+stop_main_loop (gint stop_result)
+{
+	g_return_if_fail (loop != NULL);
+
+	main_stop_result = stop_result;
+	g_main_loop_quit (loop);
+}
+
+/* returns value used in stop_main_loop() */
+gint
+get_main_loop_stop_result (void)
+{
+	return main_stop_result;
+}
+
+void
+foreach_configured_source (void (*func) (ESource *source))
+{
+	gpointer foreach_async_data;
+	ESource *source = NULL;
+
+	g_return_if_fail (func != NULL);
+
+	main_initialize ();
+
+	foreach_async_data = foreach_configured_source_async_start (&source);
+	if (!foreach_async_data)
+		return;
+
+	do {
+		func (source);
+	} while (foreach_configured_source_async_next (&foreach_async_data, &source));
+}
+
+struct ForeachConfiguredData
+{
+	ESourceList *source_list;
+	GSList *current_group;
+	GSList *current_source;
+};
+
+gpointer
+foreach_configured_source_async_start (ESource **source)
+{
+	struct ForeachConfiguredData *async_data;
+	ESourceList *source_list = NULL;
+	GError *error = NULL;
+
+	g_return_val_if_fail (source != NULL, NULL);
+
+	main_initialize ();
+
+	if (!e_book_client_get_sources (&source_list, &error)) {
+		report_error ("get addressbooks", &error);
+		return NULL;
+	}
+
+	g_return_val_if_fail (source_list != NULL, NULL);
+
+	async_data = g_new0 (struct ForeachConfiguredData, 1);
+	async_data->source_list = source_list;
+	async_data->current_group = e_source_list_peek_groups (source_list);
+	if (!async_data->current_group) {
+		gpointer ad = async_data;
+
+		foreach_configured_source_async_next (&ad, source);
+		return ad;
+	}
+
+	async_data->current_source = e_source_group_peek_sources (async_data->current_group->data);
+	if (!async_data->current_source) {
+		gpointer ad = async_data;
+
+		if (foreach_configured_source_async_next (&ad, source))
+			return ad;
+
+		return NULL;
+	}
+
+	*source = async_data->current_source->data;
+
+	return async_data;
+}
+
+gboolean
+foreach_configured_source_async_next (gpointer *foreach_async_data, ESource **source)
+{
+	struct ForeachConfiguredData *async_data;
+
+	g_return_val_if_fail (foreach_async_data != NULL, FALSE);
+	g_return_val_if_fail (source != NULL, FALSE);
+
+	async_data = *foreach_async_data;
+	g_return_val_if_fail (async_data != NULL, FALSE);
+	g_return_val_if_fail (async_data->source_list != NULL, FALSE);
+	g_return_val_if_fail (async_data->current_group != NULL, FALSE);
+
+	if (async_data->current_source)
+		async_data->current_source = async_data->current_source->next;
+	if (async_data->current_source) {
+		*source = async_data->current_source->data;
+		return TRUE;
+	}
+
+	do {
+		async_data->current_group = async_data->current_group->next;
+		if (async_data->current_group) {
+			async_data->current_source = e_source_group_peek_sources (async_data->current_group->data);
+		}
+	} while (async_data->current_group && !async_data->current_source);
+
+	if (async_data->current_source) {
+		*source = async_data->current_source->data;
+		return TRUE;
+	}
+
+	g_object_unref (async_data->source_list);
+	g_free (async_data);
+
+	*foreach_async_data = NULL;
+
+	return FALSE;
+}
+
+EBookClient *
+new_temp_client (gchar **uri)
+{
+	EBookClient *book_client;
+	ESource *source;
+	gchar *abs_uri, *filename;
+	gint handle;
+	GError *error = NULL;
+
+	filename = g_build_filename (g_get_tmp_dir (), "e-book-client-test-XXXXXX/", NULL);
+	handle = g_mkstemp (filename);
+
+	if (handle != -1)
+		close (handle);
+
+	g_return_val_if_fail (g_mkdir_with_parents (filename, 0700) == 0, NULL);
+
+	abs_uri = g_strconcat ("local://", filename, NULL);
+	g_free (filename);
+
+	source = e_source_new_with_absolute_uri ("Test book", abs_uri);
+	if (uri)
+		*uri = abs_uri;
+	else
+		g_free (abs_uri);
+
+	g_return_val_if_fail (source != NULL, NULL);
+
+	book_client = e_book_client_new (source, &error);
+	g_object_unref (source);
+
+	if (error)
+		report_error ("new temp client", &error);
+
+	return book_client;
+}
+
+gchar *
+new_vcard_from_test_case (const gchar *case_name)
+{
+	gchar *filename;
+	gchar *case_filename;
+	GFile* file;
+	GError *error = NULL;
+	gchar *vcard;
+
+        case_filename = g_strdup_printf ("%s.vcf", case_name);
+	filename = g_build_filename (SRCDIR, "..", "data", "vcards", case_filename, NULL);
+	file = g_file_new_for_path (filename);
+	if (!g_file_load_contents (file, NULL, &vcard, NULL, NULL, &error)) {
+                g_warning ("failed to read test contact file '%s': %s",
+				filename, error->message);
+		exit (1);
+	}
+
+	g_free (case_filename);
+	g_free (filename);
+	g_object_unref (file);
+
+	return vcard;
+}
+
+static gboolean
+contacts_are_equal_shallow (EContact *a, EContact *b)
+{
+	const gchar *uid_a, *uid_b;
+
+        /* Avoid warnings if one or more are NULL, to make this function
+         * "NULL-friendly" */
+	if (!a && !b)
+		return TRUE;
+
+	if (!E_IS_CONTACT (a) || !E_IS_CONTACT (b))
+		return FALSE;
+
+	uid_a = e_contact_get_const (a, E_CONTACT_UID);
+	uid_b = e_contact_get_const (b, E_CONTACT_UID);
+
+	return g_strcmp0 (uid_a, uid_b) == 0;
+}
+
+gboolean
+add_contact_from_test_case_verify (EBookClient *book_client, const gchar *case_name, EContact **contact)
+{
+	gchar *vcard;
+	EContact *contact_orig;
+	EContact *contact_final;
+	gchar *uid;
+	GError *error = NULL;
+
+	vcard = new_vcard_from_test_case (case_name);
+	contact_orig = e_contact_new_from_vcard (vcard);
+	g_free (vcard);
+	if (!e_book_client_add_contact_sync (book_client, contact_orig, &uid, NULL, &error)) {
+		report_error ("add contact sync", &error);
+		g_object_unref (contact_orig);
+		return FALSE;
+	}
+
+	e_contact_set (contact_orig, E_CONTACT_UID, uid);
+
+	if (!e_book_client_get_contact_sync (book_client, uid, &contact_final, NULL, &error)) {
+		report_error ("get contact sync", &error);
+		g_object_unref (contact_orig);
+		g_free (uid);
+		return FALSE;
+	}
+
+        /* verify the contact was added "successfully" (not thorough) */
+	g_assert (contacts_are_equal_shallow (contact_orig, contact_final));
+
+	if (contact)
+                *contact = contact_final;
+	else
+		g_object_unref (contact_final);
+	g_object_unref (contact_orig);
+	g_free (uid);
+
+	return TRUE;
+}
diff --git a/tests/libebook/client/client-test-utils.h b/tests/libebook/client/client-test-utils.h
new file mode 100644
index 0000000..5d33d95
--- /dev/null
+++ b/tests/libebook/client/client-test-utils.h
@@ -0,0 +1,27 @@
+#ifndef CLIENT_TEST_UTILS_H
+#define CLIENT_TEST_UTILS_H
+
+#include <glib.h>
+#include <libebook/e-book-client.h>
+#include <libebook/e-contact.h>
+
+void report_error (const gchar *operation, GError **error);
+void print_email (EContact *contact);
+EBookClient *open_system_book (gboolean only_if_exists);
+
+void main_initialize (void);
+void start_main_loop (GThreadFunc func, gpointer data);
+void start_in_thread_with_main_loop (GThreadFunc func, gpointer data);
+void start_in_idle_with_main_loop (GThreadFunc func, gpointer data);
+void stop_main_loop (gint stop_result);
+gint get_main_loop_stop_result (void);
+
+void foreach_configured_source (void (*func) (ESource *source));
+gpointer foreach_configured_source_async_start (ESource **source);
+gboolean foreach_configured_source_async_next (gpointer *foreach_async_data, ESource **source);
+
+EBookClient *new_temp_client (gchar **uri);
+gboolean add_contact_from_test_case_verify (EBookClient *book_client, const gchar *case_name, EContact **contact);
+gchar *new_vcard_from_test_case (const gchar *case_name);
+
+#endif /* CLIENT_TEST_UTILS_H */
diff --git a/tests/libebook/client/test-client-add-contact.c b/tests/libebook/client/test-client-add-contact.c
new file mode 100644
index 0000000..6da34b7
--- /dev/null
+++ b/tests/libebook/client/test-client-add-contact.c
@@ -0,0 +1,101 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libebook/e-book-client.h>
+
+#include "client-test-utils.h"
+
+static void
+add_contact_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	GError *error = NULL;
+	gchar *uid;
+
+	if (!e_book_client_add_contact_finish (E_BOOK_CLIENT (source_object), result, &uid, &error)) {
+		report_error ("add contact finish", &error);
+		stop_main_loop (1);
+		return;
+	}
+
+	printf ("Contact added as '%s'\n", uid);
+	g_free (uid);
+	stop_main_loop (0);
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	EBookClient *book_client;
+	GError *error = NULL;
+	EContact *contact;
+	gchar *vcard;
+
+	main_initialize ();
+
+	/*
+	 * Setup
+	 */
+	book_client = new_temp_client (NULL);
+	g_return_val_if_fail (book_client != NULL, 1);
+
+	if (!e_client_open_sync (E_CLIENT (book_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	/*
+	 * Sync version
+	 */
+	if (!add_contact_from_test_case_verify (book_client, "simple-1", &contact)) {
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	g_object_unref (contact);
+
+	if (!e_client_remove_sync (E_CLIENT (book_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	g_object_unref (book_client);
+
+	/*
+	 * Async version
+	 */
+	book_client = new_temp_client (NULL);
+	g_return_val_if_fail (book_client != NULL, 1);
+
+	if (!e_client_open_sync (E_CLIENT (book_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	vcard = new_vcard_from_test_case ("simple-1");
+	contact = e_contact_new_from_vcard (vcard);
+	g_free (vcard);
+
+	if (!e_book_client_add_contact (book_client, contact, NULL, add_contact_cb, NULL)) {
+		report_error ("add contact", NULL);
+		g_object_unref (contact);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	g_object_unref (contact);
+
+	start_main_loop (NULL, NULL);
+
+	if (!e_client_remove_sync (E_CLIENT (book_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	g_object_unref (book_client);
+
+	return get_main_loop_stop_result ();
+}
diff --git a/tests/libebook/client/test-client-async.c b/tests/libebook/client/test-client-async.c
new file mode 100644
index 0000000..c459b62
--- /dev/null
+++ b/tests/libebook/client/test-client-async.c
@@ -0,0 +1,130 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libebook/e-book-client.h>
+
+#include "client-test-utils.h"
+
+static void
+print_all_emails_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	EBookClient *book_client;
+	GSList *contacts = NULL, *c;
+	GError *error = NULL;
+
+	book_client = E_BOOK_CLIENT (source_object);
+	g_return_if_fail (book_client != NULL);
+
+	if (!e_book_client_get_contacts_finish (book_client, result, &contacts, &error)) {
+		report_error ("get contacts finish", &error);
+		stop_main_loop (1);
+		return;
+	}
+
+	for (c = contacts; c; c = c->next) {
+		EContact *contact = E_CONTACT (c->data);
+
+		print_email (contact);
+	}
+
+	g_slist_foreach (contacts, (GFunc) g_object_unref, NULL);
+	g_slist_free (contacts);
+
+	stop_main_loop (0);
+}
+
+static void
+print_all_emails (EBookClient *book_client)
+{
+	EBookQuery *query;
+
+	query = e_book_query_field_exists (E_CONTACT_FULL_NAME);
+
+	if (!e_book_client_get_contacts (book_client, query, NULL, print_all_emails_cb, NULL)) {
+		e_book_query_unref (query);
+		report_error ("get contacts", NULL);
+		stop_main_loop (1);
+		return;
+	}
+
+	e_book_query_unref (query);
+}
+
+static void
+print_email_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	EBookClient *book_client;
+	EContact *contact = NULL;
+	GError *error = NULL;
+
+	book_client = E_BOOK_CLIENT (source_object);
+	g_return_if_fail (book_client != NULL);
+
+	if (!e_book_client_get_contact_finish (book_client, result, &contact, &error)) {
+		report_error ("get contact finish", &error);
+	} else {
+		print_email (contact);
+		g_object_unref (contact);
+	}
+
+	printf ("printing all contacts\n");
+	print_all_emails (book_client);
+}
+
+static void
+print_one_email (EBookClient *book_client)
+{
+	if (!e_book_client_get_contact (book_client, "pas-id-0002023", NULL, print_email_cb, NULL)) {
+		report_error ("get contact", NULL);
+		stop_main_loop (1);
+		return;
+	}
+}
+
+static void
+client_loaded_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	EBookClient *book_client;
+	GError *error = NULL;
+
+	book_client = E_BOOK_CLIENT (source_object);
+	g_return_if_fail (book_client != NULL);
+
+	if (!e_client_open_finish (E_CLIENT (book_client), result, &error)) {
+		report_error ("client open finish", &error);
+		stop_main_loop (1);
+		return;
+	}
+
+	printf ("printing one contact\n");
+	print_one_email (book_client);
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	EBookClient *book_client;
+	GError *error = NULL;
+
+	main_initialize ();
+
+	book_client = e_book_client_new_system_addressbook (&error);
+	if (error) {
+		report_error ("create system addressbook", &error);
+		return 1;
+	}
+
+	printf ("loading addressbook\n");
+
+	if (!e_client_open (E_CLIENT (book_client), FALSE, NULL, client_loaded_cb, NULL)) {
+		g_object_unref (book_client);
+		report_error ("open client", NULL);
+		return 1;
+	}
+
+	start_main_loop (NULL, NULL);
+
+	g_object_unref (book_client);
+
+	return get_main_loop_stop_result ();
+}
diff --git a/tests/libebook/client/test-client-get-book-view.c b/tests/libebook/client/test-client-get-book-view.c
new file mode 100644
index 0000000..605edfb
--- /dev/null
+++ b/tests/libebook/client/test-client-get-book-view.c
@@ -0,0 +1,168 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libebook/e-book-client.h>
+
+#include "client-test-utils.h"
+
+static void
+contacts_added (EBookView *book_view, const GList *contacts)
+{
+	GList *l;
+
+	for (l = (GList*)contacts; l; l = l->next) {
+		print_email (l->data);
+	}
+}
+
+static void
+contacts_removed (EBookView *book_view, const GList *ids)
+{
+	GList *l;
+
+	for (l = (GList*)ids; l; l = l->next) {
+		printf ("   Removed contact: %s\n", (gchar *)l->data);
+	}
+}
+
+static void
+view_complete (EBookView *book_view, EBookViewStatus status, const gchar *error_msg)
+{
+	e_book_view_stop (book_view);
+	g_object_unref (book_view);
+
+	stop_main_loop (0);
+}
+
+static void
+setup_and_start_view (EBookView *view)
+{
+	g_signal_connect (view, "contacts_added", G_CALLBACK (contacts_added), NULL);
+	g_signal_connect (view, "contacts_removed", G_CALLBACK (contacts_removed), NULL);
+	g_signal_connect (view, "view_complete", G_CALLBACK (view_complete), NULL);
+
+	e_book_view_start (view);
+}
+
+static void
+get_book_view_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	EBookView *view;
+	GError *error = NULL;
+
+	if (!e_book_client_get_view_finish (E_BOOK_CLIENT (source_object), result, &view, &error)) {
+		report_error ("get book view finish", &error);
+		stop_main_loop (1);
+
+		return;
+	}
+
+	setup_and_start_view (view);
+}
+
+static gboolean
+setup_book (EBookClient **book_client)
+{
+	GError *error = NULL;
+
+	g_return_val_if_fail (book_client != NULL, FALSE);
+
+	*book_client = new_temp_client (NULL);
+	g_return_val_if_fail (*book_client != NULL, FALSE);
+
+	if (!e_client_open_sync (E_CLIENT (*book_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (*book_client);
+		return FALSE;
+	}
+
+	if (!add_contact_from_test_case_verify (*book_client, "simple-1", NULL) ||
+	    !add_contact_from_test_case_verify (*book_client, "simple-2", NULL) ||
+	    !add_contact_from_test_case_verify (*book_client, "name-only", NULL)) {
+		g_object_unref (*book_client);
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+static gpointer
+call_get_book_view (gpointer user_data)
+{
+	EBookQuery *query;
+	EBookClient *book_client = user_data;
+
+	g_return_val_if_fail (book_client != NULL, NULL);
+	g_return_val_if_fail (E_IS_BOOK_CLIENT (book_client), NULL);
+
+	query = e_book_query_any_field_contains ("");
+
+	if (!e_book_client_get_view (book_client, query, NULL, get_book_view_cb, NULL)) {
+		report_error ("get book view", NULL);
+		stop_main_loop (1);
+	}
+
+	e_book_query_unref (query);
+
+	return NULL;
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	EBookClient *book_client;
+	EBookQuery *query;
+	EBookView *view;
+	GError *error = NULL;
+
+	main_initialize ();
+
+	/*
+	 * Sync version
+	 */
+	if (!setup_book (&book_client))
+		return 1;
+
+	query = e_book_query_any_field_contains ("");
+	if (!e_book_client_get_view_sync (book_client, query, &view, NULL, &error)) {
+		report_error ("get book view sync", &error);
+		e_book_query_unref (query);
+		g_object_unref (book_client);
+
+		return 1;
+	}
+
+	setup_and_start_view (view);
+
+	start_main_loop (NULL, NULL);
+
+	if (!e_client_remove_sync (E_CLIENT (book_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		e_book_query_unref (query);
+		g_object_unref (book_client);
+
+		return 1;
+	}
+
+	e_book_query_unref (query);
+	g_object_unref (book_client);
+
+	/*
+	 * Async version
+	 */
+	if (!setup_book (&book_client))
+		return 1;
+
+	start_in_idle_with_main_loop (call_get_book_view, book_client);
+
+	if (!e_client_remove_sync (E_CLIENT (book_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (book_client);
+
+		return 1;
+	}
+
+	g_object_unref (book_client);
+
+	return get_main_loop_stop_result ();
+}
diff --git a/tests/libebook/client/test-client-get-capabilities.c b/tests/libebook/client/test-client-get-capabilities.c
new file mode 100644
index 0000000..4465c4c
--- /dev/null
+++ b/tests/libebook/client/test-client-get-capabilities.c
@@ -0,0 +1,250 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libebook/e-book-client.h>
+
+#include "client-test-utils.h"
+
+static void
+print_values (const GSList *values, EClient *client)
+{
+	printf ("\treadonly:%s online:%s\n", e_client_is_readonly (client) ? "yes" : "no", e_client_is_online (client) ? "yes" : "no");
+	printf ("\tcapabilities: ");
+	if (!values) {
+		printf ("NULL");
+		if (e_client_get_capabilities (client))
+			printf (", but client has %d capabilities", g_slist_length ((GSList *) e_client_get_capabilities (client)));
+	} else {
+		gint client_caps = g_slist_length ((GSList *) e_client_get_capabilities (client)), my_caps = g_slist_length ((GSList *) values);
+
+		while (values) {
+			const gchar *cap = values->data;
+
+			printf ("'%s'", cap);
+			if (!e_client_check_capability (client, cap))
+				printf (" (not found in EClient)");
+
+			values = values->next;
+
+			if (values)
+				printf (", ");
+		}
+
+		if (client_caps != my_caps) {
+			printf ("\n\t * has different count of capabilities in EClient (%d) and returned (%d)", client_caps, my_caps);
+		}
+
+	}
+	printf ("\n");
+}
+
+static void
+identify_source (ESource *source)
+{
+	const gchar *name, *uri;
+
+	g_return_if_fail (source != NULL);
+
+	name = e_source_peek_name (source);
+	if (!name)
+		name = "Unknown name";
+
+	uri = e_source_peek_absolute_uri (source);
+	if (!uri)
+		uri = e_source_peek_relative_uri (source);
+	if (!uri)
+		uri = "Unknown uri";
+
+	printf ("\n   Checking source '%s' (%s)\n", name, uri);
+}
+
+static void client_opened_async (GObject *source_object, GAsyncResult *result, gpointer async_data);
+
+static void
+continue_next_source (gpointer async_data)
+{
+	ESource *source = NULL;
+	EBookClient *book_client;
+	GError *error = NULL;
+
+	g_return_if_fail (async_data != NULL);
+
+	while (async_data && foreach_configured_source_async_next (&async_data, &source)) {
+		identify_source (source);
+
+		book_client = e_book_client_new (source, &error);
+		if (!book_client) {
+			report_error ("book client new", &error);
+			continue;
+		}
+
+		if (!e_client_open (E_CLIENT (book_client), TRUE, NULL, client_opened_async, async_data)) {
+			report_error ("client open", NULL);
+			g_object_unref (book_client);
+		} else {
+			break;
+		}
+	}
+
+	if (!async_data)
+		stop_main_loop (0);
+}
+
+static void
+client_got_values_async (GObject *source_object, GAsyncResult *result, gpointer async_data)
+{
+	GSList *values = NULL;
+	GError *error = NULL;
+
+	g_return_if_fail (source_object != NULL);
+	g_return_if_fail (E_IS_BOOK_CLIENT (source_object));
+	g_return_if_fail (async_data != NULL);
+
+	if (!e_book_client_get_capabilities_finish (E_BOOK_CLIENT (source_object), result, &values, &error)) {
+		report_error ("get capabilities finish", &error);
+	} else {
+		print_values (values, E_CLIENT (source_object));
+
+		e_client_util_free_string_slist (values);
+	}
+
+	g_object_unref (source_object);
+
+	continue_next_source (async_data);
+}
+
+static void
+client_opened_async (GObject *source_object, GAsyncResult *result, gpointer async_data)
+{
+	GError *error = NULL;
+
+	g_return_if_fail (source_object != NULL);
+	g_return_if_fail (E_IS_BOOK_CLIENT (source_object));
+	g_return_if_fail (async_data != NULL);
+
+	if (!e_client_open_finish (E_CLIENT (source_object), result, &error)) {
+		report_error ("client open finish", &error);
+		g_object_unref (source_object);
+		continue_next_source (async_data);
+		return;
+	}
+
+	if (!e_book_client_get_capabilities (E_BOOK_CLIENT (source_object), NULL, client_got_values_async, async_data)) {
+		report_error ("get capabilities", NULL);
+		g_object_unref (source_object);
+		continue_next_source (async_data);
+	}
+}
+
+static void
+check_source_sync (ESource *source)
+{
+	EBookClient *book_client;
+	GError *error = NULL;
+	GSList *values = NULL;
+
+	g_return_if_fail (source != NULL);
+
+	identify_source (source);
+
+	book_client = e_book_client_new (source, &error);
+	if (!book_client) {
+		report_error ("book client new", &error);
+		return;
+	}
+
+	if (!e_client_open_sync (E_CLIENT (book_client), TRUE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (book_client);
+		return;
+	}
+
+	if (!e_book_client_get_capabilities_sync (book_client, &values, NULL, &error)) {
+		report_error ("get capabilities sync", &error);
+		g_object_unref (book_client);
+		return;
+	}
+
+	print_values (values, E_CLIENT (book_client));
+
+	g_slist_foreach (values, (GFunc) g_free, NULL);
+	g_slist_free (values);
+
+	g_object_unref (book_client);
+}
+
+static gboolean
+in_main_thread_idle_cb (gpointer unused)
+{
+	gpointer async_data;
+	ESource *source = NULL;
+	EBookClient *book_client;
+	GError *error = NULL;
+
+	printf ("* run in main thread with mainloop running\n");
+	foreach_configured_source (check_source_sync);
+	printf ("---------------------------------------------------------\n\n");
+
+	async_data = foreach_configured_source_async_start (&source);
+	if (!async_data) {
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	printf ("* run in main thread async\n");
+
+	while (TRUE) {
+		identify_source (source);
+
+		while (book_client = e_book_client_new (source, &error), !book_client) {
+			report_error ("book client new", &error);
+
+			if (!foreach_configured_source_async_next (&async_data, &source)) {
+				stop_main_loop (0);
+				return FALSE;
+			}
+
+			identify_source (source);
+		}
+
+		if (!e_client_open (E_CLIENT (book_client), TRUE, NULL, client_opened_async, async_data)) {
+			report_error ("client open", NULL);
+			g_object_unref (book_client);
+
+			if (!foreach_configured_source_async_next (&async_data, &source)) {
+				stop_main_loop (0);
+				return FALSE;
+			}
+		} else {
+			break;
+		}
+	}
+
+	return FALSE;
+}
+
+static gpointer
+worker_thread (gpointer unused)
+{
+	printf ("* run in dedicated thread with mainloop running\n");
+	foreach_configured_source (check_source_sync);
+	printf ("---------------------------------------------------------\n\n");
+
+	g_idle_add (in_main_thread_idle_cb, NULL);
+
+	return NULL;
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	main_initialize ();
+
+	printf ("* run in main thread without mainloop\n");
+	foreach_configured_source (check_source_sync);
+	printf ("---------------------------------------------------------\n\n");
+
+	start_in_thread_with_main_loop (worker_thread, NULL);
+
+	return get_main_loop_stop_result ();
+}
diff --git a/tests/libebook/client/test-client-get-contact.c b/tests/libebook/client/test-client-get-contact.c
new file mode 100644
index 0000000..0a480ca
--- /dev/null
+++ b/tests/libebook/client/test-client-get-contact.c
@@ -0,0 +1,75 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libebook/e-book-client.h>
+
+#include "client-test-utils.h"
+
+static void
+contact_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	EContact *contact;
+	GError *error = NULL;
+
+	if (!e_book_client_get_contact_finish (E_BOOK_CLIENT (source_object), result, &contact, &error)) {
+		report_error ("get contact finish", &error);
+		stop_main_loop (1);
+	} else {
+		g_object_unref (contact);
+		stop_main_loop (0);
+	}
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	EBookClient *book_client;
+	EContact *contact_final;
+	GError *error = NULL;
+
+	main_initialize ();
+
+	/*
+	 * Setup
+	 */
+	book_client = new_temp_client (NULL);
+	g_return_val_if_fail (book_client != NULL, 1);
+
+	if (!e_client_open_sync (E_CLIENT (book_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	/*
+	 * Sync version
+	 */
+	if (!add_contact_from_test_case_verify (book_client, "simple-1", &contact_final)) {
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	/*
+	 * Async version
+	 */
+	if (!e_book_client_get_contact (book_client, e_contact_get_const (contact_final, E_CONTACT_UID), NULL, contact_ready_cb, NULL)) {
+		report_error ("get contact", NULL);
+		g_object_unref (contact_final);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	g_object_unref (contact_final);
+
+	start_main_loop (NULL, NULL);
+
+	if (!e_client_remove_sync (E_CLIENT (book_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	g_object_unref (book_client);
+
+	return get_main_loop_stop_result ();
+}
diff --git a/tests/libebook/client/test-client-get-required-fields.c b/tests/libebook/client/test-client-get-required-fields.c
new file mode 100644
index 0000000..d4ee401
--- /dev/null
+++ b/tests/libebook/client/test-client-get-required-fields.c
@@ -0,0 +1,235 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libebook/e-book-client.h>
+
+#include "client-test-utils.h"
+
+static void
+print_values (const GSList *values)
+{
+	printf ("\trequired fields: ");
+	if (!values) {
+		printf ("NULL");
+	} else {
+		while (values) {
+			printf ("'%s'", (const gchar *) values->data);
+			values = values->next;
+
+			if (values)
+				printf (", ");
+		}
+	}
+	printf ("\n");
+}
+
+static void
+identify_source (ESource *source)
+{
+	const gchar *name, *uri;
+
+	g_return_if_fail (source != NULL);
+
+	name = e_source_peek_name (source);
+	if (!name)
+		name = "Unknown name";
+
+	uri = e_source_peek_absolute_uri (source);
+	if (!uri)
+		uri = e_source_peek_relative_uri (source);
+	if (!uri)
+		uri = "Unknown uri";
+
+	printf ("\n   Checking source '%s' (%s)\n", name, uri);
+}
+
+static void client_opened_async (GObject *source_object, GAsyncResult *result, gpointer async_data);
+
+static void
+continue_next_source (gpointer async_data)
+{
+	ESource *source = NULL;
+	EBookClient *book_client;
+	GError *error = NULL;
+
+	g_return_if_fail (async_data != NULL);
+
+	while (async_data && foreach_configured_source_async_next (&async_data, &source)) {
+		identify_source (source);
+
+		book_client = e_book_client_new (source, &error);
+		if (!book_client) {
+			report_error ("book client new", &error);
+			continue;
+		}
+
+		if (!e_client_open (E_CLIENT (book_client), TRUE, NULL, client_opened_async, async_data)) {
+			report_error ("client open", NULL);
+			g_object_unref (book_client);
+		} else {
+			break;
+		}
+	}
+
+	if (!async_data)
+		stop_main_loop (0);
+}
+
+static void
+client_got_values_async (GObject *source_object, GAsyncResult *result, gpointer async_data)
+{
+	GSList *values = NULL;
+	GError *error = NULL;
+
+	g_return_if_fail (source_object != NULL);
+	g_return_if_fail (E_IS_BOOK_CLIENT (source_object));
+	g_return_if_fail (async_data != NULL);
+
+	if (!e_book_client_get_required_fields_finish (E_BOOK_CLIENT (source_object), result, &values, &error)) {
+		report_error ("get required fields finish", &error);
+	} else {
+		print_values (values);
+
+		e_client_util_free_string_slist (values);
+	}
+
+	g_object_unref (source_object);
+
+	continue_next_source (async_data);
+}
+
+static void
+client_opened_async (GObject *source_object, GAsyncResult *result, gpointer async_data)
+{
+	GError *error = NULL;
+
+	g_return_if_fail (source_object != NULL);
+	g_return_if_fail (E_IS_BOOK_CLIENT (source_object));
+	g_return_if_fail (async_data != NULL);
+
+	if (!e_client_open_finish (E_CLIENT (source_object), result, &error)) {
+		report_error ("client open finish", &error);
+		g_object_unref (source_object);
+		continue_next_source (async_data);
+		return;
+	}
+
+	if (!e_book_client_get_required_fields (E_BOOK_CLIENT (source_object), NULL, client_got_values_async, async_data)) {
+		report_error ("get required fields", NULL);
+		g_object_unref (source_object);
+		continue_next_source (async_data);
+	}
+}
+
+static void
+check_source_sync (ESource *source)
+{
+	EBookClient *book_client;
+	GError *error = NULL;
+	GSList *values = NULL;
+
+	g_return_if_fail (source != NULL);
+
+	identify_source (source);
+
+	book_client = e_book_client_new (source, &error);
+	if (!book_client) {
+		report_error ("book client new", &error);
+		return;
+	}
+
+	if (!e_client_open_sync (E_CLIENT (book_client), TRUE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (book_client);
+		return;
+	}
+
+	if (!e_book_client_get_required_fields_sync (book_client, &values, NULL, &error)) {
+		report_error ("get required fields sync", &error);
+		g_object_unref (book_client);
+		return;
+	}
+
+	print_values (values);
+
+	g_slist_foreach (values, (GFunc) g_free, NULL);
+	g_slist_free (values);
+
+	g_object_unref (book_client);
+}
+
+static gboolean
+in_main_thread_idle_cb (gpointer unused)
+{
+	gpointer async_data;
+	ESource *source = NULL;
+	EBookClient *book_client;
+	GError *error = NULL;
+
+	printf ("* run in main thread with mainloop running\n");
+	foreach_configured_source (check_source_sync);
+	printf ("---------------------------------------------------------\n\n");
+
+	async_data = foreach_configured_source_async_start (&source);
+	if (!async_data) {
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	printf ("* run in main thread async\n");
+
+	while (TRUE) {
+		identify_source (source);
+
+		while (book_client = e_book_client_new (source, &error), !book_client) {
+			report_error ("book client new", &error);
+
+			if (!foreach_configured_source_async_next (&async_data, &source)) {
+				stop_main_loop (0);
+				return FALSE;
+			}
+
+			identify_source (source);
+		}
+
+		if (!e_client_open (E_CLIENT (book_client), TRUE, NULL, client_opened_async, async_data)) {
+			report_error ("client open", NULL);
+			g_object_unref (book_client);
+
+			if (!foreach_configured_source_async_next (&async_data, &source)) {
+				stop_main_loop (0);
+				return FALSE;
+			}
+		} else {
+			break;
+		}
+	}
+
+	return FALSE;
+}
+
+static gpointer
+worker_thread (gpointer unused)
+{
+	printf ("* run in dedicated thread with mainloop running\n");
+	foreach_configured_source (check_source_sync);
+	printf ("---------------------------------------------------------\n\n");
+
+	g_idle_add (in_main_thread_idle_cb, NULL);
+
+	return NULL;
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	main_initialize ();
+
+	printf ("* run in main thread without mainloop\n");
+	foreach_configured_source (check_source_sync);
+	printf ("---------------------------------------------------------\n\n");
+
+	start_in_thread_with_main_loop (worker_thread, NULL);
+
+	return get_main_loop_stop_result ();
+}
diff --git a/tests/libebook/client/test-client-get-supported-auth-methods.c b/tests/libebook/client/test-client-get-supported-auth-methods.c
new file mode 100644
index 0000000..2fbb2f7
--- /dev/null
+++ b/tests/libebook/client/test-client-get-supported-auth-methods.c
@@ -0,0 +1,235 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libebook/e-book-client.h>
+
+#include "client-test-utils.h"
+
+static void
+print_values (const GSList *values)
+{
+	printf ("\tsupported auth methods: ");
+	if (!values) {
+		printf ("NULL");
+	} else {
+		while (values) {
+			printf ("'%s'", (const gchar *) values->data);
+			values = values->next;
+
+			if (values)
+				printf (", ");
+		}
+	}
+	printf ("\n");
+}
+
+static void
+identify_source (ESource *source)
+{
+	const gchar *name, *uri;
+
+	g_return_if_fail (source != NULL);
+
+	name = e_source_peek_name (source);
+	if (!name)
+		name = "Unknown name";
+
+	uri = e_source_peek_absolute_uri (source);
+	if (!uri)
+		uri = e_source_peek_relative_uri (source);
+	if (!uri)
+		uri = "Unknown uri";
+
+	printf ("\n   Checking source '%s' (%s)\n", name, uri);
+}
+
+static void client_opened_async (GObject *source_object, GAsyncResult *result, gpointer async_data);
+
+static void
+continue_next_source (gpointer async_data)
+{
+	ESource *source = NULL;
+	EBookClient *book_client;
+	GError *error = NULL;
+
+	g_return_if_fail (async_data != NULL);
+
+	while (async_data && foreach_configured_source_async_next (&async_data, &source)) {
+		identify_source (source);
+
+		book_client = e_book_client_new (source, &error);
+		if (!book_client) {
+			report_error ("book client new", &error);
+			continue;
+		}
+
+		if (!e_client_open (E_CLIENT (book_client), TRUE, NULL, client_opened_async, async_data)) {
+			report_error ("client open", NULL);
+			g_object_unref (book_client);
+		} else {
+			break;
+		}
+	}
+
+	if (!async_data)
+		stop_main_loop (0);
+}
+
+static void
+client_got_values_async (GObject *source_object, GAsyncResult *result, gpointer async_data)
+{
+	GSList *values = NULL;
+	GError *error = NULL;
+
+	g_return_if_fail (source_object != NULL);
+	g_return_if_fail (E_IS_BOOK_CLIENT (source_object));
+	g_return_if_fail (async_data != NULL);
+
+	if (!e_book_client_get_supported_auth_methods_finish (E_BOOK_CLIENT (source_object), result, &values, &error)) {
+		report_error ("get supported auth methods finish", &error);
+	} else {
+		print_values (values);
+
+		e_client_util_free_string_slist (values);
+	}
+
+	g_object_unref (source_object);
+
+	continue_next_source (async_data);
+}
+
+static void
+client_opened_async (GObject *source_object, GAsyncResult *result, gpointer async_data)
+{
+	GError *error = NULL;
+
+	g_return_if_fail (source_object != NULL);
+	g_return_if_fail (E_IS_BOOK_CLIENT (source_object));
+	g_return_if_fail (async_data != NULL);
+
+	if (!e_client_open_finish (E_CLIENT (source_object), result, &error)) {
+		report_error ("client open finish", &error);
+		g_object_unref (source_object);
+		continue_next_source (async_data);
+		return;
+	}
+
+	if (!e_book_client_get_supported_auth_methods (E_BOOK_CLIENT (source_object), NULL, client_got_values_async, async_data)) {
+		report_error ("get supported auth methods", NULL);
+		g_object_unref (source_object);
+		continue_next_source (async_data);
+	}
+}
+
+static void
+check_source_sync (ESource *source)
+{
+	EBookClient *book_client;
+	GError *error = NULL;
+	GSList *values = NULL;
+
+	g_return_if_fail (source != NULL);
+
+	identify_source (source);
+
+	book_client = e_book_client_new (source, &error);
+	if (!book_client) {
+		report_error ("book client new", &error);
+		return;
+	}
+
+	if (!e_client_open_sync (E_CLIENT (book_client), TRUE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (book_client);
+		return;
+	}
+
+	if (!e_book_client_get_supported_auth_methods_sync (book_client, &values, NULL, &error)) {
+		report_error ("get supported auth methods sync", &error);
+		g_object_unref (book_client);
+		return;
+	}
+
+	print_values (values);
+
+	g_slist_foreach (values, (GFunc) g_free, NULL);
+	g_slist_free (values);
+
+	g_object_unref (book_client);
+}
+
+static gboolean
+in_main_thread_idle_cb (gpointer unused)
+{
+	gpointer async_data;
+	ESource *source = NULL;
+	EBookClient *book_client;
+	GError *error = NULL;
+
+	printf ("* run in main thread with mainloop running\n");
+	foreach_configured_source (check_source_sync);
+	printf ("---------------------------------------------------------\n\n");
+
+	async_data = foreach_configured_source_async_start (&source);
+	if (!async_data) {
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	printf ("* run in main thread async\n");
+
+	while (TRUE) {
+		identify_source (source);
+
+		while (book_client = e_book_client_new (source, &error), !book_client) {
+			report_error ("book client new", &error);
+
+			if (!foreach_configured_source_async_next (&async_data, &source)) {
+				stop_main_loop (0);
+				return FALSE;
+			}
+
+			identify_source (source);
+		}
+
+		if (!e_client_open (E_CLIENT (book_client), TRUE, NULL, client_opened_async, async_data)) {
+			report_error ("client open", NULL);
+			g_object_unref (book_client);
+
+			if (!foreach_configured_source_async_next (&async_data, &source)) {
+				stop_main_loop (0);
+				return FALSE;
+			}
+		} else {
+			break;
+		}
+	}
+
+	return FALSE;
+}
+
+static gpointer
+worker_thread (gpointer unused)
+{
+	printf ("* run in dedicated thread with mainloop running\n");
+	foreach_configured_source (check_source_sync);
+	printf ("---------------------------------------------------------\n\n");
+
+	g_idle_add (in_main_thread_idle_cb, NULL);
+
+	return NULL;
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	main_initialize ();
+
+	printf ("* run in main thread without mainloop\n");
+	foreach_configured_source (check_source_sync);
+	printf ("---------------------------------------------------------\n\n");
+
+	start_in_thread_with_main_loop (worker_thread, NULL);
+
+	return get_main_loop_stop_result ();
+}
diff --git a/tests/libebook/client/test-client-get-supported-fields.c b/tests/libebook/client/test-client-get-supported-fields.c
new file mode 100644
index 0000000..3b29aec
--- /dev/null
+++ b/tests/libebook/client/test-client-get-supported-fields.c
@@ -0,0 +1,235 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libebook/e-book-client.h>
+
+#include "client-test-utils.h"
+
+static void
+print_values (const GSList *values)
+{
+	printf ("\tsupported fields: ");
+	if (!values) {
+		printf ("NULL");
+	} else {
+		while (values) {
+			printf ("'%s'", (const gchar *) values->data);
+			values = values->next;
+
+			if (values)
+				printf (", ");
+		}
+	}
+	printf ("\n");
+}
+
+static void
+identify_source (ESource *source)
+{
+	const gchar *name, *uri;
+
+	g_return_if_fail (source != NULL);
+
+	name = e_source_peek_name (source);
+	if (!name)
+		name = "Unknown name";
+
+	uri = e_source_peek_absolute_uri (source);
+	if (!uri)
+		uri = e_source_peek_relative_uri (source);
+	if (!uri)
+		uri = "Unknown uri";
+
+	printf ("\n   Checking source '%s' (%s)\n", name, uri);
+}
+
+static void client_opened_async (GObject *source_object, GAsyncResult *result, gpointer async_data);
+
+static void
+continue_next_source (gpointer async_data)
+{
+	ESource *source = NULL;
+	EBookClient *book_client;
+	GError *error = NULL;
+
+	g_return_if_fail (async_data != NULL);
+
+	while (async_data && foreach_configured_source_async_next (&async_data, &source)) {
+		identify_source (source);
+
+		book_client = e_book_client_new (source, &error);
+		if (!book_client) {
+			report_error ("book client new", &error);
+			continue;
+		}
+
+		if (!e_client_open (E_CLIENT (book_client), TRUE, NULL, client_opened_async, async_data)) {
+			report_error ("client open", NULL);
+			g_object_unref (book_client);
+		} else {
+			break;
+		}
+	}
+
+	if (!async_data)
+		stop_main_loop (0);
+}
+
+static void
+client_got_values_async (GObject *source_object, GAsyncResult *result, gpointer async_data)
+{
+	GSList *values = NULL;
+	GError *error = NULL;
+
+	g_return_if_fail (source_object != NULL);
+	g_return_if_fail (E_IS_BOOK_CLIENT (source_object));
+	g_return_if_fail (async_data != NULL);
+
+	if (!e_book_client_get_supported_fields_finish (E_BOOK_CLIENT (source_object), result, &values, &error)) {
+		report_error ("get supported fields finish", &error);
+	} else {
+		print_values (values);
+
+		e_client_util_free_string_slist (values);
+	}
+
+	g_object_unref (source_object);
+
+	continue_next_source (async_data);
+}
+
+static void
+client_opened_async (GObject *source_object, GAsyncResult *result, gpointer async_data)
+{
+	GError *error = NULL;
+
+	g_return_if_fail (source_object != NULL);
+	g_return_if_fail (E_IS_BOOK_CLIENT (source_object));
+	g_return_if_fail (async_data != NULL);
+
+	if (!e_client_open_finish (E_CLIENT (source_object), result, &error)) {
+		report_error ("client open finish", &error);
+		g_object_unref (source_object);
+		continue_next_source (async_data);
+		return;
+	}
+
+	if (!e_book_client_get_supported_fields (E_BOOK_CLIENT (source_object), NULL, client_got_values_async, async_data)) {
+		report_error ("get supported fields", NULL);
+		g_object_unref (source_object);
+		continue_next_source (async_data);
+	}
+}
+
+static void
+check_source_sync (ESource *source)
+{
+	EBookClient *book_client;
+	GError *error = NULL;
+	GSList *values = NULL;
+
+	g_return_if_fail (source != NULL);
+
+	identify_source (source);
+
+	book_client = e_book_client_new (source, &error);
+	if (!book_client) {
+		report_error ("book client new", &error);
+		return;
+	}
+
+	if (!e_client_open_sync (E_CLIENT (book_client), TRUE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (book_client);
+		return;
+	}
+
+	if (!e_book_client_get_supported_fields_sync (book_client, &values, NULL, &error)) {
+		report_error ("get supported fields sync", &error);
+		g_object_unref (book_client);
+		return;
+	}
+
+	print_values (values);
+
+	g_slist_foreach (values, (GFunc) g_free, NULL);
+	g_slist_free (values);
+
+	g_object_unref (book_client);
+}
+
+static gboolean
+in_main_thread_idle_cb (gpointer unused)
+{
+	gpointer async_data;
+	ESource *source = NULL;
+	EBookClient *book_client;
+	GError *error = NULL;
+
+	printf ("* run in main thread with mainloop running\n");
+	foreach_configured_source (check_source_sync);
+	printf ("---------------------------------------------------------\n\n");
+
+	async_data = foreach_configured_source_async_start (&source);
+	if (!async_data) {
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	printf ("* run in main thread async\n");
+
+	while (TRUE) {
+		identify_source (source);
+
+		while (book_client = e_book_client_new (source, &error), !book_client) {
+			report_error ("book client new", &error);
+
+			if (!foreach_configured_source_async_next (&async_data, &source)) {
+				stop_main_loop (0);
+				return FALSE;
+			}
+
+			identify_source (source);
+		}
+
+		if (!e_client_open (E_CLIENT (book_client), TRUE, NULL, client_opened_async, async_data)) {
+			report_error ("client open", NULL);
+			g_object_unref (book_client);
+
+			if (!foreach_configured_source_async_next (&async_data, &source)) {
+				stop_main_loop (0);
+				return FALSE;
+			}
+		} else {
+			break;
+		}
+	}
+
+	return FALSE;
+}
+
+static gpointer
+worker_thread (gpointer unused)
+{
+	printf ("* run in dedicated thread with mainloop running\n");
+	foreach_configured_source (check_source_sync);
+	printf ("---------------------------------------------------------\n\n");
+
+	g_idle_add (in_main_thread_idle_cb, NULL);
+
+	return NULL;
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	main_initialize ();
+
+	printf ("* run in main thread without mainloop\n");
+	foreach_configured_source (check_source_sync);
+	printf ("---------------------------------------------------------\n\n");
+
+	start_in_thread_with_main_loop (worker_thread, NULL);
+
+	return get_main_loop_stop_result ();
+}
diff --git a/tests/libebook/client/test-client-modify-contact.c b/tests/libebook/client/test-client-modify-contact.c
new file mode 100644
index 0000000..19126af
--- /dev/null
+++ b/tests/libebook/client/test-client-modify-contact.c
@@ -0,0 +1,168 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libebook/e-book-client.h>
+
+#include "client-test-utils.h"
+
+#define EMAIL_ADD "foo bar com"
+
+static void
+verify_premodify_and_prepare_contact (EContact *contact)
+{
+	EVCardAttribute *attr;
+
+	/* ensure there is no email address to begin with, then add one */
+	g_assert (!e_vcard_get_attribute (E_VCARD (contact), EVC_EMAIL));
+	attr = e_vcard_attribute_new (NULL, EVC_EMAIL);
+	e_vcard_add_attribute_with_value (E_VCARD (contact), attr, EMAIL_ADD);
+}
+
+static void
+verify_modify (EContact *contact)
+{
+	EVCardAttribute *attr;
+	gchar *email_value;
+
+	g_assert ((attr = e_vcard_get_attribute (E_VCARD (contact), EVC_EMAIL)));
+	g_assert (e_vcard_attribute_is_single_valued (attr));
+	email_value = e_vcard_attribute_get_value (attr);
+	g_assert (!g_strcmp0 (email_value, EMAIL_ADD));
+	g_free (email_value);
+}
+
+static void
+contact_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	EContact *contact;
+	GError *error = NULL;
+
+	if (!e_book_client_get_contact_finish (E_BOOK_CLIENT (source_object), result, &contact, &error)) {
+		report_error ("get contact finish", &error);
+		stop_main_loop (1);
+		return;
+	}
+
+	verify_modify (contact);
+
+	g_object_unref (contact);
+
+	stop_main_loop (0);
+}
+
+static void
+contact_modified_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	EContact *contact = user_data;
+	GError *error = NULL;
+
+	if (!e_book_client_modify_contact_finish (E_BOOK_CLIENT (source_object), result, &error)) {
+		report_error ("modify contact finish", &error);
+		stop_main_loop (1);
+		return;
+	}
+
+	if (!e_book_client_get_contact (E_BOOK_CLIENT (source_object), e_contact_get_const (contact, E_CONTACT_UID), NULL, contact_ready_cb, NULL)) {
+		report_error ("get contact", NULL);
+		stop_main_loop (1);
+		return;
+	}
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	EBookClient *book_client;
+	GError *error = NULL;
+	EContact *contact, *book_contact;
+
+	main_initialize ();
+
+	/*
+	 * Setup
+	 */
+	book_client = new_temp_client (NULL);
+	g_return_val_if_fail (book_client != NULL, 1);
+
+	if (!e_client_open_sync (E_CLIENT (book_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	/*
+	 * Sync version
+	 */
+	if (!add_contact_from_test_case_verify (book_client, "name-only", &contact)) {
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	verify_premodify_and_prepare_contact (contact);
+
+	if (!e_book_client_modify_contact_sync (book_client, contact, NULL, &error)) {
+		report_error ("modify contact sync", &error);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	if (!e_book_client_get_contact_sync (book_client, e_contact_get_const (contact, E_CONTACT_UID), &book_contact, NULL, &error)) {
+		report_error ("get contact sync", &error);
+		g_object_unref (contact);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	verify_modify (book_contact);
+
+	g_object_unref (book_contact);
+	g_object_unref (contact);
+
+	if (!e_client_remove_sync (E_CLIENT (book_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	g_object_unref (book_client);
+
+	/*
+	 * Async version
+	 */
+	book_client = new_temp_client (NULL);
+	g_return_val_if_fail (book_client != NULL, 1);
+
+	if (!e_client_open_sync (E_CLIENT (book_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	if (!add_contact_from_test_case_verify (book_client, "name-only", &contact)) {
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	verify_premodify_and_prepare_contact (contact);
+
+	if (!e_book_client_modify_contact (book_client, contact, NULL, contact_modified_cb, contact)) {
+		report_error ("modify contact", NULL);
+		g_object_unref (book_client);
+		g_object_unref (contact);
+		return 1;
+	}
+
+	start_main_loop (NULL, NULL);
+
+	g_object_unref (contact);
+
+	if (!e_client_remove_sync (E_CLIENT (book_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	g_object_unref (book_client);
+
+	return get_main_loop_stop_result ();
+}
diff --git a/tests/libebook/client/test-client-nonexistent-id.c b/tests/libebook/client/test-client-nonexistent-id.c
new file mode 100644
index 0000000..058bf94
--- /dev/null
+++ b/tests/libebook/client/test-client-nonexistent-id.c
@@ -0,0 +1,44 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <libebook/e-book-client.h>
+
+#include "client-test-utils.h"
+
+gint
+main (gint argc, gchar **argv)
+{
+	GError *error = NULL;
+	EBookClient *book_client = NULL;
+
+	main_initialize ();
+
+	printf ("loading addressbook\n");
+
+	book_client = open_system_book (FALSE);
+	if (!book_client)
+		return 1;
+
+	printf ("removing nonexistent contact\n");
+	if (!e_book_client_remove_contact_by_uid_sync (book_client, "ii", NULL, &error)) {
+		if (!g_error_matches (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_CONTACT_NOT_FOUND)) {
+			report_error ("remove contact sync", &error);
+			g_object_unref (book_client);
+			return 1;
+		}
+
+		printf ("\tOK, ended with expected Not Found error\n");
+		g_error_free (error);
+	} else if (error) {
+		report_error ("remove contact sync returned error, but success", &error);
+		g_object_unref (book_client);
+		return 1;
+	} else {
+		report_error ("remove contact sync returned success, but should return error", NULL);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	g_object_unref (book_client);
+
+	return 0;
+}
diff --git a/tests/libebook/client/test-client-remove-contact-by-uid.c b/tests/libebook/client/test-client-remove-contact-by-uid.c
new file mode 100644
index 0000000..fd571c1
--- /dev/null
+++ b/tests/libebook/client/test-client-remove-contact-by-uid.c
@@ -0,0 +1,132 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <libebook/e-book-client.h>
+
+#include "client-test-utils.h"
+
+static void
+remove_contact_by_uid_cb (GObject *source_object, GAsyncResult *result, gpointer uid)
+{
+	GError *error = NULL;
+	EContact *contact = NULL;
+
+	if (!e_book_client_remove_contact_by_uid_finish (E_BOOK_CLIENT (source_object), result, &error)) {
+		report_error ("remove contact by uid finish", &error);
+		stop_main_loop (1);
+		return;
+	}
+
+	if (!e_book_client_get_contact_sync (E_BOOK_CLIENT (source_object), uid, &contact, NULL, &error) &&
+	    g_error_matches (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_CONTACT_NOT_FOUND)) {
+		g_clear_error (&error);
+		stop_main_loop (0);
+	} else {
+		report_error ("fail with get contact on removed contact", &error);
+		if (contact)
+			g_object_unref (contact);
+		stop_main_loop (1);
+	}
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	EBookClient *book_client;
+	GError *error = NULL;
+	EContact *contact;
+	gchar *uid;
+
+	main_initialize ();
+
+        /*
+         * Setup
+         */
+	book_client = new_temp_client (NULL);
+	g_return_val_if_fail (book_client != NULL, 1);
+
+	if (!e_client_open_sync (E_CLIENT (book_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+        /*
+         * Sync version
+         */
+	if (!add_contact_from_test_case_verify (book_client, "simple-1", &contact)) {
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	uid = e_contact_get (contact, E_CONTACT_UID);
+	g_object_unref (contact);
+
+	if (!e_book_client_remove_contact_by_uid_sync (book_client, uid, NULL, &error)) {
+		report_error ("remove contact sync", &error);
+		g_object_unref (book_client);
+		g_free (uid);
+		return 1;
+	}
+
+	if (!e_book_client_get_contact_sync (book_client, uid, &contact, NULL, &error) &&
+	    g_error_matches (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_CONTACT_NOT_FOUND)) {
+		g_clear_error (&error);
+	} else {
+		report_error ("fail with get contact sync on removed contact", &error);
+		g_object_unref (book_client);
+		g_free (uid);
+		return 1;
+	}
+
+	g_free (uid);
+
+	if (!e_client_remove_sync (E_CLIENT (book_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	g_object_unref (book_client);
+
+        /*
+         * Async version
+         */
+	book_client = new_temp_client (NULL);
+	g_return_val_if_fail (book_client != NULL, 1);
+
+	if (!e_client_open_sync (E_CLIENT (book_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	contact = NULL;
+
+	if (!add_contact_from_test_case_verify (book_client, "simple-1", &contact)) {
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	uid = e_contact_get (contact, E_CONTACT_UID);
+	g_object_unref (contact);
+	if (!e_book_client_remove_contact_by_uid (book_client, uid, NULL, remove_contact_by_uid_cb, uid)) {
+		report_error ("remove contact", NULL);
+		g_free (uid);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	start_main_loop (NULL, NULL);
+
+	g_free (uid);
+
+	if (!e_client_remove_sync (E_CLIENT (book_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	g_object_unref (book_client);
+
+	return 0;
+}
diff --git a/tests/libebook/client/test-client-remove-contact.c b/tests/libebook/client/test-client-remove-contact.c
new file mode 100644
index 0000000..b948b9f
--- /dev/null
+++ b/tests/libebook/client/test-client-remove-contact.c
@@ -0,0 +1,136 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <libebook/e-book-client.h>
+
+#include "client-test-utils.h"
+
+static void
+remove_contact_cb (GObject *source_object, GAsyncResult *result, gpointer uid)
+{
+	GError *error = NULL;
+	EContact *contact = NULL;
+
+	if (!e_book_client_remove_contact_finish (E_BOOK_CLIENT (source_object), result, &error)) {
+		report_error ("remove contact finish", &error);
+		stop_main_loop (1);
+		return;
+	}
+
+	if (!e_book_client_get_contact_sync (E_BOOK_CLIENT (source_object), uid, &contact, NULL, &error) &&
+	    g_error_matches (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_CONTACT_NOT_FOUND)) {
+		g_clear_error (&error);
+		stop_main_loop (0);
+	} else {
+		report_error ("fail with get contact on removed contact", &error);
+		if (contact)
+			g_object_unref (contact);
+		stop_main_loop (1);
+	}
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	EBookClient *book_client;
+	GError *error = NULL;
+	EContact *contact;
+	gchar *uid;
+
+	main_initialize ();
+
+        /*
+         * Setup
+         */
+	book_client = new_temp_client (NULL);
+	g_return_val_if_fail (book_client != NULL, 1);
+
+	if (!e_client_open_sync (E_CLIENT (book_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+        /*
+         * Sync version
+         */
+	if (!add_contact_from_test_case_verify (book_client, "simple-1", &contact)) {
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	uid = e_contact_get (contact, E_CONTACT_UID);
+
+	if (!e_book_client_remove_contact_sync (book_client, contact, NULL, &error)) {
+		report_error ("remove contact sync", &error);
+		g_object_unref (contact);
+		g_object_unref (book_client);
+		g_free (uid);
+		return 1;
+	}
+
+	g_object_unref (contact);
+
+	if (!e_book_client_get_contact_sync (book_client, uid, &contact, NULL, &error) &&
+	    g_error_matches (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_CONTACT_NOT_FOUND)) {
+		g_clear_error (&error);
+	} else {
+		report_error ("fail with get contact sync on removed contact", &error);
+		g_object_unref (book_client);
+		g_free (uid);
+		return 1;
+	}
+
+	g_free (uid);
+
+	if (!e_client_remove_sync (E_CLIENT (book_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	g_object_unref (book_client);
+
+        /*
+         * Async version
+         */
+	book_client = new_temp_client (NULL);
+	g_return_val_if_fail (book_client != NULL, 1);
+
+	if (!e_client_open_sync (E_CLIENT (book_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	contact = NULL;
+
+	if (!add_contact_from_test_case_verify (book_client, "simple-1", &contact)) {
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	uid = e_contact_get (contact, E_CONTACT_UID);
+	if (!e_book_client_remove_contact (book_client, contact, NULL, remove_contact_cb, uid)) {
+		report_error ("remove contact", NULL);
+		g_free (uid);
+		g_object_unref (contact);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	g_object_unref (contact);
+
+	start_main_loop (NULL, NULL);
+
+	g_free (uid);
+
+	if (!e_client_remove_sync (E_CLIENT (book_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	g_object_unref (book_client);
+
+	return 0;
+}
diff --git a/tests/libebook/client/test-client-remove-contacts.c b/tests/libebook/client/test-client-remove-contacts.c
new file mode 100644
index 0000000..30fd641
--- /dev/null
+++ b/tests/libebook/client/test-client-remove-contacts.c
@@ -0,0 +1,166 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <libebook/e-book-client.h>
+
+#include "client-test-utils.h"
+
+static gboolean
+check_removed (EBookClient *book_client, const GSList *uids)
+{
+	g_return_val_if_fail (book_client != NULL, FALSE);
+	g_return_val_if_fail (uids != NULL, FALSE);
+
+	while (uids) {
+		GError *error = NULL;
+		EContact *contact = NULL;
+
+		if (!e_book_client_get_contact_sync (book_client, uids->data, &contact, NULL, &error) &&
+		    g_error_matches (error, E_BOOK_CLIENT_ERROR, E_BOOK_CLIENT_ERROR_CONTACT_NOT_FOUND)) {
+			g_clear_error (&error);
+		} else {
+			report_error ("fail with get contact on removed contact", &error);
+			if (contact)
+				g_object_unref (contact);
+			return FALSE;
+		}
+
+		uids = uids->next;
+	}
+
+	return TRUE;
+}
+
+static gboolean
+fill_book_client (EBookClient *book_client, GSList **uids)
+{
+	EContact *contact;
+
+	g_return_val_if_fail (book_client != NULL, FALSE);
+	g_return_val_if_fail (uids != NULL, FALSE);
+
+	*uids = NULL;
+
+	if (!add_contact_from_test_case_verify (book_client, "simple-1", &contact))
+		return FALSE;
+
+	*uids = g_slist_append (*uids, e_contact_get (contact, E_CONTACT_UID));
+	g_object_unref (contact);
+
+	if (!add_contact_from_test_case_verify (book_client, "simple-2", &contact))
+		return FALSE;
+
+	*uids = g_slist_append (*uids, e_contact_get (contact, E_CONTACT_UID));
+	g_object_unref (contact);
+
+	return TRUE;
+}
+
+static void
+remove_contacts_cb (GObject *source_object, GAsyncResult *result, gpointer uids)
+{
+	GError *error = NULL;
+
+	if (!e_book_client_remove_contacts_finish (E_BOOK_CLIENT (source_object), result, &error)) {
+		report_error ("remove contacts finish", &error);
+		stop_main_loop (1);
+		return;
+	}
+
+	stop_main_loop (check_removed (E_BOOK_CLIENT (source_object), uids) ? 0 : 1);
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	EBookClient *book_client;
+	GError *error = NULL;
+	GSList *uids;
+
+	main_initialize ();
+
+        /*
+         * Setup
+         */
+	book_client = new_temp_client (NULL);
+	g_return_val_if_fail (book_client != NULL, 1);
+
+	if (!e_client_open_sync (E_CLIENT (book_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+        /*
+         * Sync version
+         */
+	if (!fill_book_client (book_client, &uids)) {
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	if (!e_book_client_remove_contacts_sync (book_client, uids, NULL, &error)) {
+		report_error ("remove contact sync", &error);
+		g_object_unref (book_client);
+		g_slist_foreach (uids, (GFunc) g_free, NULL);
+		g_slist_free (uids);
+		return 1;
+	}
+
+	if (!check_removed (book_client, uids)) {
+		g_object_unref (book_client);
+		g_slist_foreach (uids, (GFunc) g_free, NULL);
+		g_slist_free (uids);
+		return 1;
+	}
+
+	g_slist_foreach (uids, (GFunc) g_free, NULL);
+	g_slist_free (uids);
+
+	if (!e_client_remove_sync (E_CLIENT (book_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	g_object_unref (book_client);
+
+        /*
+         * Async version
+         */
+	book_client = new_temp_client (NULL);
+	g_return_val_if_fail (book_client != NULL, 1);
+
+	if (!e_client_open_sync (E_CLIENT (book_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	if (!fill_book_client (book_client, &uids)) {
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	if (!e_book_client_remove_contacts (book_client, uids, NULL, remove_contacts_cb, uids)) {
+		report_error ("remove contact", NULL);
+		g_slist_foreach (uids, (GFunc) g_free, NULL);
+		g_slist_free (uids);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	start_main_loop (NULL, NULL);
+
+	g_slist_foreach (uids, (GFunc) g_free, NULL);
+	g_slist_free (uids);
+
+	if (!e_client_remove_sync (E_CLIENT (book_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	g_object_unref (book_client);
+
+	return get_main_loop_stop_result ();
+}
diff --git a/tests/libebook/client/test-client-remove.c b/tests/libebook/client/test-client-remove.c
new file mode 100644
index 0000000..7371377
--- /dev/null
+++ b/tests/libebook/client/test-client-remove.c
@@ -0,0 +1,73 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libebook/e-book-client.h>
+
+#include "client-test-utils.h"
+
+static void
+client_removed_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	GError *error = NULL;
+
+	if (!e_client_remove_finish (E_CLIENT (source_object), result, &error)) {
+		report_error ("client remove finish", &error);
+		stop_main_loop (1);
+	} else {
+		stop_main_loop (0);
+	}
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	EBookClient *book_client;
+	GError *error = NULL;
+
+	main_initialize ();
+
+	book_client = new_temp_client (NULL);
+	g_return_val_if_fail (book_client != NULL, 1);
+
+	if (!e_client_open_sync (E_CLIENT (book_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	/*
+	 * Sync version
+	 */
+	if (!e_client_remove_sync (E_CLIENT (book_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	g_object_unref (book_client);
+
+	/*
+	 * Async version
+	 */
+
+	book_client = new_temp_client (NULL);
+	g_return_val_if_fail (book_client != NULL, 1);
+
+	if (!e_client_open_sync (E_CLIENT (book_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	if (!e_client_remove (E_CLIENT (book_client), NULL, client_removed_cb, NULL)) {
+		report_error ("client remove", NULL);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	start_main_loop (NULL, NULL);
+
+	g_object_unref (book_client);
+
+	return get_main_loop_stop_result ();
+}
diff --git a/tests/libebook/client/test-client-search.c b/tests/libebook/client/test-client-search.c
new file mode 100644
index 0000000..d1900e4
--- /dev/null
+++ b/tests/libebook/client/test-client-search.c
@@ -0,0 +1,62 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libebook/e-book-client.h>
+
+#include "client-test-utils.h"
+
+gint
+main (gint argc, gchar **argv)
+{
+	EBookClient *book_client;
+	const gchar *query_string;
+	EBookQuery *query;
+	GSList *c, *contacts;
+	GError *error = NULL;
+
+	main_initialize ();
+
+	if (argc != 2) {
+		query_string = "contains \"full_name\" \"a\"";
+		printf ("usage: test-search <query>\n");
+		printf ("   using default query \"%s\"\n", query_string);
+	} else {
+		query_string = argv[1];
+	}
+
+	query = e_book_query_from_string (query_string);
+	if (!query) {
+		fprintf (stderr, " * Failed to parse query string '%s'\n", query_string);
+		return 1;
+	}
+
+	book_client = open_system_book (FALSE);
+	if (!book_client) {
+		e_book_query_unref (query);
+		return 1;
+	}
+
+	if (!e_book_client_get_contacts_sync (book_client, query, &contacts, NULL, &error)) {
+		report_error ("get contacts sync", &error);
+		e_book_query_unref (query);
+		g_object_unref (book_client);
+		return 1;
+	}
+
+	for (c = contacts; c; c = c->next) {
+		EContact *contact = E_CONTACT (c->data);
+		gchar *vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
+
+		printf ("%s\n\n", vcard);
+
+		g_free (vcard);
+	}
+
+	g_slist_foreach (contacts, (GFunc) g_object_unref, NULL);
+	g_slist_free (contacts);
+
+	e_book_query_unref (query);
+	g_object_unref (book_client);
+
+	return 0;
+}
diff --git a/tests/libebook/client/test-client-self.c b/tests/libebook/client/test-client-self.c
new file mode 100644
index 0000000..f0867a1
--- /dev/null
+++ b/tests/libebook/client/test-client-self.c
@@ -0,0 +1,46 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libebook/e-book-client.h>
+
+#include "client-test-utils.h"
+
+gint
+main (gint argc, gchar **argv)
+{
+	EBookClient *book_client = NULL;
+	EContact *contact = NULL;
+	GError *error = NULL;
+	gchar *vcard;
+
+	main_initialize ();
+
+	printf ("getting the self contact\n");
+
+	if (!e_book_client_get_self (&contact, &book_client, &error)) {
+		report_error ("get self", &error);
+		return 1;
+	}
+
+	if (!contact) {
+		fprintf (stderr, " * Self contact not set\n");
+		if (book_client)
+			g_object_unref (book_client);
+		return 0;
+	}
+
+	if (!book_client) {
+		fprintf (stderr, " * Book client for a self contact not returned\n");
+		g_object_unref (contact);
+		return 1;
+	}
+
+	vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
+	printf ("self contact = \n%s\n", vcard);
+	g_free (vcard);
+
+	g_object_unref (contact);
+	g_object_unref (book_client);
+
+	return 0;
+}
diff --git a/tests/libebook/client/test-client-stress-factory--fifo.c b/tests/libebook/client/test-client-stress-factory--fifo.c
new file mode 100644
index 0000000..240142c
--- /dev/null
+++ b/tests/libebook/client/test-client-stress-factory--fifo.c
@@ -0,0 +1,50 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libebook/e-book-client.h>
+
+#include "client-test-utils.h"
+
+#define NUM_CLIENTS 200
+
+gint
+main (gint argc, gchar **argv)
+{
+	EBookClient *book_clients[NUM_CLIENTS];
+	GError *error = NULL;
+	gint ii;
+
+	main_initialize ();
+
+	/* Create and open many books; then remove each of them */
+
+	for (ii = 0; ii < NUM_CLIENTS; ii++) {
+		book_clients[ii] = new_temp_client (NULL);
+		g_return_val_if_fail (book_clients[ii] != NULL, 1);
+
+		if (!e_client_open_sync (E_CLIENT (book_clients[ii]), FALSE, NULL, &error)) {
+			report_error ("client open sync", &error);
+			while (ii >= 0) {
+				g_object_unref (book_clients[ii]);
+				ii--;
+			}
+
+			return 1;
+		}
+	}
+
+	for (ii = 0; ii < NUM_CLIENTS; ii++) {
+		if (!e_client_remove_sync (E_CLIENT (book_clients[ii]), NULL, &error)) {
+			report_error ("client remove sync", &error);
+			while (ii < NUM_CLIENTS) {
+				g_object_unref (book_clients[ii]);
+				ii++;
+			}
+			return 1;
+		}
+
+		g_object_unref (book_clients[ii]);
+	}
+
+	return 0;
+}
diff --git a/tests/libebook/client/test-client-stress-factory--serial.c b/tests/libebook/client/test-client-stress-factory--serial.c
new file mode 100644
index 0000000..7a76ae5
--- /dev/null
+++ b/tests/libebook/client/test-client-stress-factory--serial.c
@@ -0,0 +1,37 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <libebook/e-book-client.h>
+
+#include "client-test-utils.h"
+
+#define NUM_CLIENTS 200
+
+gint
+main (gint argc, gchar **argv)
+{
+	GError *error = NULL;
+	gint ii;
+
+	main_initialize ();
+
+	/* Serially create, open, (close), and remove many books */
+	for (ii = 0; ii < NUM_CLIENTS; ii++) {
+		EBookClient *book_client = new_temp_client (NULL);
+		g_return_val_if_fail (book_client != NULL, 1);
+
+		if (!e_client_open_sync (E_CLIENT (book_client), FALSE, NULL, &error)) {
+			report_error ("client open sync", &error);
+			return 1;
+		}
+
+		if (!e_client_remove_sync (E_CLIENT (book_client), NULL, &error)) {
+			report_error ("client remove sync", &error);
+			g_object_unref (book_client);
+			return 1;
+		}
+
+		g_object_unref (book_client);
+	}
+
+	return 0;
+}
diff --git a/tests/libebook/client/test-client-stress-factory--single-book.c b/tests/libebook/client/test-client-stress-factory--single-book.c
new file mode 100644
index 0000000..919d67a
--- /dev/null
+++ b/tests/libebook/client/test-client-stress-factory--single-book.c
@@ -0,0 +1,62 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libebook/e-book-client.h>
+
+#include "client-test-utils.h"
+
+#define NUM_OPENS 200
+
+gint
+main (gint argc, gchar **argv)
+{
+	gchar *uri = NULL;
+	EBookClient *book_client;
+	GError *error = NULL;
+	gint ii;
+
+	main_initialize ();
+
+	book_client = new_temp_client (&uri);
+	g_return_val_if_fail (book_client != NULL, 1);
+	g_return_val_if_fail (uri != NULL, 1);
+
+	g_object_unref (book_client);
+
+	/* open and close the same book repeatedly */
+	for (ii = 0; ii < NUM_OPENS; ii++) {
+		book_client = e_book_client_new_from_uri (uri, &error);
+		if (!book_client) {
+			report_error ("new from uri", &error);
+			break;
+		}
+
+		if (!e_client_open_sync (E_CLIENT (book_client), FALSE, NULL, &error)) {
+			report_error ("client open sync", &error);
+			g_object_unref (book_client);
+			break;
+		}
+
+		g_object_unref (book_client);
+	}
+
+	book_client = e_book_client_new_from_uri (uri, &error);
+	if (!book_client) {
+		g_clear_error (&error);
+	} else if (!e_client_open_sync (E_CLIENT (book_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (book_client);
+		g_free (uri);
+		return 1;
+	} else 	if (!e_client_remove_sync (E_CLIENT (book_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (book_client);
+		g_free (uri);
+		return 1;
+	}
+
+	g_free (uri);
+	g_object_unref (book_client);
+
+	return ii == NUM_OPENS ? 0 : 1;
+}
diff --git a/tests/libebook/client/test-client-stress-views.c b/tests/libebook/client/test-client-stress-views.c
new file mode 100644
index 0000000..0b6116a
--- /dev/null
+++ b/tests/libebook/client/test-client-stress-views.c
@@ -0,0 +1,124 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libebook/e-book-client.h>
+
+#include "client-test-utils.h"
+
+#define NUM_VIEWS 200
+
+static void
+contacts_added (EBookView *book_view, const GList *contacts)
+{
+	GList *l;
+
+	for (l = (GList*)contacts; l; l = l->next) {
+		print_email (l->data);
+	}
+}
+
+static void
+contacts_removed (EBookView *book_view, const GList *ids)
+{
+	GList *l;
+
+	for (l = (GList*)ids; l; l = l->next) {
+		printf ("   Removed contact: %s\n", (gchar *)l->data);
+	}
+}
+
+static void
+view_complete (EBookView *book_view, EBookViewStatus status, const gchar *error_msg)
+{
+	printf ("view_complete (status == %d, error_msg == %s%s%s)\n", status, error_msg ? "'" : "", error_msg ? error_msg : "NULL", error_msg ? "'" : "");
+}
+
+static gint
+stress_book_views (EBookClient *book_client, gboolean in_thread)
+{
+	EBookQuery *query;
+	EBookView *view = NULL;
+	EBookView *new_view;
+	gint i;
+
+	g_return_val_if_fail (book_client != NULL, -1);
+	g_return_val_if_fail (E_IS_BOOK_CLIENT (book_client), -1);
+
+	query = e_book_query_any_field_contains ("");
+
+	for (i = 0; i < NUM_VIEWS; i++) {
+		GError *error = NULL;
+
+		if (!e_book_client_get_view_sync (book_client, query, &new_view, NULL, &error)) {
+			report_error ("get book view sync", &error);
+			g_object_unref (view);
+			e_book_query_unref (query);
+			return 1;
+		}
+
+		g_signal_connect (new_view, "contacts_added", G_CALLBACK (contacts_added), NULL);
+		g_signal_connect (new_view, "contacts_removed", G_CALLBACK (contacts_removed), NULL);
+		g_signal_connect (new_view, "view_complete", G_CALLBACK (view_complete), NULL);
+
+		e_book_view_start (new_view);
+
+		if (view) {
+			/* wait 100 ms when in a thread */
+			if (in_thread)
+				g_usleep (100000);
+
+			e_book_view_stop (view);
+			g_object_unref (view);
+		}
+
+		view = new_view;
+	}
+
+	e_book_view_stop (view);
+	g_object_unref (view);
+
+	e_book_query_unref (query);
+
+	return 0;
+}
+
+static gpointer
+stress_book_views_thread (gpointer user_data)
+{
+	stop_main_loop (stress_book_views (user_data, TRUE));
+
+	return NULL;
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	EBookClient *book_client;
+	GError *error = NULL;
+
+	main_initialize ();
+
+	printf ("loading addressbook\n");
+
+	book_client = e_book_client_new_system_addressbook (&error);
+	if (!book_client) {
+		report_error ("create local addressbook", &error);
+		return 1;
+	}
+
+	if (!e_client_open_sync (E_CLIENT (book_client), FALSE, NULL, &error)) {
+		g_object_unref (book_client);
+		report_error ("open client sync", &error);
+		return 1;
+	}
+
+	/* test from main thread */
+	stress_book_views (book_client, FALSE);
+
+	/* test from dedicated thread */
+	start_in_thread_with_main_loop (stress_book_views_thread, book_client);
+
+	g_object_unref (book_client);
+
+	return get_main_loop_stop_result ();
+}
diff --git a/tests/libebook/client/test-client.c b/tests/libebook/client/test-client.c
new file mode 100644
index 0000000..f4e8cfc
--- /dev/null
+++ b/tests/libebook/client/test-client.c
@@ -0,0 +1,78 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libebook/e-book-client.h>
+
+#include "client-test-utils.h"
+
+static void
+print_all_emails (EBookClient *book)
+{
+	GError *error = NULL;
+	EBookQuery *query;
+	gboolean result;
+	GSList *cards, *c;
+
+	query = e_book_query_field_exists (E_CONTACT_FULL_NAME);
+
+	result = e_book_client_get_contacts_sync (book, query, &cards, NULL, &error);
+
+	e_book_query_unref (query);
+
+	if (!result) {
+		fprintf (stderr, "Error getting card list: %s\n", error ? error->message : "Unknown error");
+		if (error)
+			g_error_free (error);
+		exit (1);
+	}
+
+	for (c = cards; c; c = c->next) {
+		EContact *contact = E_CONTACT (c->data);
+
+		print_email (contact);
+
+		g_object_unref (contact);
+	}
+
+	g_slist_free (cards);
+}
+
+static void
+print_one_email (EBookClient *book_client)
+{
+	EContact *contact;
+	GError *error = NULL;
+
+	if (!e_book_client_get_contact_sync (book_client, "pas-id-0002023", &contact, NULL, &error)) {
+		report_error ("get_contact_sync", &error);
+		return;
+	}
+
+	print_email (contact);
+
+	g_object_unref (contact);
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	EBookClient *book_client;
+
+	main_initialize ();
+
+	printf ("loading addressbook\n");
+
+	book_client = open_system_book (FALSE);
+	if (!book_client)
+		return 1;
+
+	printf ("printing one contact\n");
+	print_one_email (book_client);
+
+	printf ("printing all contacts\n");
+	print_all_emails (book_client);
+
+	g_object_unref (book_client);
+
+	return 0;
+}
diff --git a/tests/libebook/test-categories.c b/tests/libebook/test-categories.c
index bf24a74..2b73b6a 100644
--- a/tests/libebook/test-categories.c
+++ b/tests/libebook/test-categories.c
@@ -1,6 +1,6 @@
 #include <stdlib.h>
 #include <string.h>
-#include <libebook/e-book.h>
+#include <libebook/e-contact.h>
 
 gint
 main (gint argc, gchar **argv)
diff --git a/tests/libebook/test-date.c b/tests/libebook/test-date.c
index c2c6ad8..caf90a5 100644
--- a/tests/libebook/test-date.c
+++ b/tests/libebook/test-date.c
@@ -1,5 +1,5 @@
 #include <stdlib.h>
-#include <libebook/e-book.h>
+#include <libebook/e-contact.h>
 
 gint
 main (gint argc, gchar **argv)
diff --git a/tests/libebook/test-photo.c b/tests/libebook/test-photo.c
index 8848b9b..2200689 100644
--- a/tests/libebook/test-photo.c
+++ b/tests/libebook/test-photo.c
@@ -1,6 +1,6 @@
 #include <stdlib.h>
 #include <string.h>
-#include <libebook/e-book.h>
+#include <libebook/e-contact.h>
 
 static const gchar *photo_data =
 "/9j/4AAQSkZJRgABAQEARwBHAAD//gAXQ3JlYXRlZCB3aXRoIFRoZSBHSU1Q/9sAQwAIBgYHB\
diff --git a/tests/libebook/test-query.c b/tests/libebook/test-query.c
index 33c6143..44b593d 100644
--- a/tests/libebook/test-query.c
+++ b/tests/libebook/test-query.c
@@ -1,5 +1,5 @@
 #include <string.h>
-#include <libebook/e-book.h>
+#include <libebook/e-book-query.h>
 
 #define QUERY_STRING1
 #define QUERY_STRING2
diff --git a/tests/libebook/test-string.c b/tests/libebook/test-string.c
index 953802e..b958eac 100644
--- a/tests/libebook/test-string.c
+++ b/tests/libebook/test-string.c
@@ -1,6 +1,6 @@
 #include <stdlib.h>
 #include <string.h>
-#include <libebook/e-book.h>
+#include <libebook/e-contact.h>
 
 #define TEST_ID "test-uid"
 
diff --git a/tests/libebook/test-undefinedfield.c b/tests/libebook/test-undefinedfield.c
index 75e1dc0..03a393b 100644
--- a/tests/libebook/test-undefinedfield.c
+++ b/tests/libebook/test-undefinedfield.c
@@ -1,5 +1,5 @@
 #include <stdlib.h>
-#include <libebook/e-book.h>
+#include <libebook/e-contact.h>
 
 gint
 main (gint argc, gchar **argv)
diff --git a/tests/libebook/test-untyped-phones.c b/tests/libebook/test-untyped-phones.c
index 8ebb8f9..c5ef691 100644
--- a/tests/libebook/test-untyped-phones.c
+++ b/tests/libebook/test-untyped-phones.c
@@ -1,6 +1,6 @@
 #include <stdlib.h>
 #include <string.h>
-#include <libebook/e-book.h>
+#include <libebook/e-contact.h>
 
 /* TEL;WORK:... should map to PHONE_BUSINESS
    TEL;FAX:... should map to OTHER_FAX. */
diff --git a/tests/libecal/Makefile.am b/tests/libecal/Makefile.am
index e1fbff0..4227613 100644
--- a/tests/libecal/Makefile.am
+++ b/tests/libecal/Makefile.am
@@ -1,3 +1,5 @@
+SUBDIRS = client
+
 noinst_LTLIBRARIES = libecal-test-utils.la
 libecal_test_utils_la_SOURCES = ecal-test-utils.c ecal-test-utils.h
 
diff --git a/tests/libecal/client/Makefile.am b/tests/libecal/client/Makefile.am
new file mode 100644
index 0000000..9b9d08c
--- /dev/null
+++ b/tests/libecal/client/Makefile.am
@@ -0,0 +1,89 @@
+noinst_LTLIBRARIES = libclient-test-utils.la
+
+libclient_test_utils_la_SOURCES = client-test-utils.c client-test-utils.h
+
+libclient_test_utils_la_CPPFLAGS =				\
+	$(AM_CPPFLAGS)						\
+	-I$(top_srcdir)						\
+	-I$(top_builddir)					\
+	-I$(top_srcdir)/calendar				\
+	-I$(top_builddir)/calendar				\
+	-DSRCDIR=\""$(srcdir)"\"				\
+	$(EVOLUTION_CALENDAR_CFLAGS)				\
+	$(NULL)
+
+libclient_test_utils_la_LIBADD = 				\
+	$(top_builddir)/calendar/libecal/libecal-1.2.la		\
+	$(EVOLUTION_CALENDAR_LIBS)				\
+	$(NULL)
+
+# ordered by relative complexity
+TESTS = 					\
+	test-client-open			\
+	test-client-refresh			\
+	test-client-get-free-busy		\
+	test-client-add-timezone		\
+	test-client-examine			\
+	test-client-create-object		\
+	test-client-remove-object		\
+	test-client-get-object-list		\
+	test-client-modify-object		\
+	test-client-send-objects		\
+	test-client-receive-objects		\
+	test-client-get-attachment-uris		\
+	test-client-get-view			\
+	test-client-stress-views		\
+	test-client-stress-factory--serial	\
+	test-client-stress-factory--fifo	\
+	test-client-stress-factory--single-cal	\
+	$(NULL)
+
+# The test program
+noinst_PROGRAMS = $(TESTS)
+
+TEST_CPPFLAGS=					\
+	$(libclient_test_utils_la_CPPFLAGS)	\
+	$(NULL)
+
+TEST_LIBS =					\
+	$(libclient_test_utils_la_LIBS)		\
+	libclient-test-utils.la			\
+	$(NULL)
+
+# ordered alphanumerically
+test_client_add_timezone_LDADD=$(TEST_LIBS)
+test_client_add_timezone_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_create_object_LDADD=$(TEST_LIBS)
+test_client_create_object_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_examine_LDADD=$(TEST_LIBS)
+test_client_examine_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_get_attachment_uris_LDADD=$(TEST_LIBS)
+test_client_get_attachment_uris_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_get_free_busy_LDADD=$(TEST_LIBS)
+test_client_get_free_busy_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_get_object_list_LDADD=$(TEST_LIBS)
+test_client_get_object_list_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_get_view_LDADD=$(TEST_LIBS)
+test_client_get_view_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_modify_object_LDADD=$(TEST_LIBS)
+test_client_modify_object_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_open_LDADD=$(TEST_LIBS)
+test_client_open_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_receive_objects_LDADD=$(TEST_LIBS)
+test_client_receive_objects_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_refresh_LDADD=$(TEST_LIBS)
+test_client_refresh_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_remove_object_LDADD=$(TEST_LIBS)
+test_client_remove_object_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_send_objects_LDADD=$(TEST_LIBS)
+test_client_send_objects_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_stress_factory__fifo_LDADD=$(TEST_LIBS)
+test_client_stress_factory__fifo_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_stress_factory__serial_LDADD=$(TEST_LIBS)
+test_client_stress_factory__serial_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_stress_factory__single_cal_LDADD=$(TEST_LIBS)
+test_client_stress_factory__single_cal_CPPFLAGS=$(TEST_CPPFLAGS)
+test_client_stress_views_LDADD=$(TEST_LIBS)
+test_client_stress_views_CPPFLAGS=$(TEST_CPPFLAGS)
+
+-include $(top_srcdir)/git.mk
diff --git a/tests/libecal/client/client-test-utils.c b/tests/libecal/client/client-test-utils.c
new file mode 100644
index 0000000..4ff6915
--- /dev/null
+++ b/tests/libecal/client/client-test-utils.c
@@ -0,0 +1,350 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdio.h>
+
+#include "client-test-utils.h"
+
+void
+print_ecomp (ECalComponent *ecalcomp)
+{
+	const gchar *uid = NULL;
+	ECalComponentText summary = { 0 };
+
+	g_return_if_fail (ecalcomp != NULL);
+
+	e_cal_component_get_uid (ecalcomp, &uid);
+	e_cal_component_get_summary (ecalcomp, &summary);
+
+	g_print ("   Component: %s\n", uid ? uid : "no-uid");
+	g_print ("   Summary: %s\n", summary.value ? summary.value : "NULL");
+	g_print ("\n");
+}
+
+void
+print_icomp (icalcomponent *icalcomp)
+{
+	ECalComponent *ecomp;
+
+	g_return_if_fail (icalcomp != NULL);
+
+	ecomp = e_cal_component_new ();
+	icalcomp = icalcomponent_new_clone (icalcomp);
+
+	if (!e_cal_component_set_icalcomponent (ecomp, icalcomp)) {
+		icalcomponent_free (icalcomp);
+		g_object_unref (ecomp);
+		g_printerr ("%s: Failed to assing icalcomp to ECalComponent\n", G_STRFUNC);
+		g_print ("\n");
+		return;
+	}
+
+	print_ecomp (ecomp);
+
+	g_object_unref (ecomp);
+}
+
+void
+report_error (const gchar *operation, GError **error)
+{
+	g_return_if_fail (operation != NULL);
+
+	g_printerr ("Failed to %s: %s\n", operation, (error && *error) ? (*error)->message : "Unknown error");
+
+	g_clear_error (error);
+}
+
+void
+main_initialize (void)
+{
+	static gboolean initialized = FALSE;
+
+	if (initialized)
+		return;
+
+	g_type_init ();
+	g_thread_init (NULL);
+
+	initialized = TRUE;
+}
+
+struct IdleData {
+	GThreadFunc func;
+	gpointer data;
+	gboolean run_in_thread; /* FALSE to run in idle callback */
+};
+
+static gboolean
+idle_cb (gpointer data)
+{
+	struct IdleData *idle = data;
+
+	g_return_val_if_fail (idle != NULL, FALSE);
+	g_return_val_if_fail (idle->func != NULL, FALSE);
+
+	if (idle->run_in_thread) {
+		GError *error = NULL;
+
+		g_thread_create (idle->func, idle->data, FALSE, &error);
+
+		if (error) {
+			report_error ("create thread", &error);
+			stop_main_loop (1);
+		}
+	} else {
+		idle->func (idle->data);
+	}
+
+	g_free (idle);
+
+	return FALSE;
+}
+
+static GMainLoop *loop = NULL;
+static gint main_stop_result = 0;
+
+static void
+do_start (GThreadFunc func, gpointer data)
+{
+	main_initialize ();
+
+	g_return_if_fail (loop == NULL);
+
+	loop = g_main_loop_new (NULL, FALSE);
+
+	if (func)
+		func (data);
+
+	g_main_loop_run (loop);
+
+	g_main_loop_unref (loop);
+	loop = NULL;
+}
+
+/* Starts new main-loop, but just before that calls 'func'.
+   Main-loop is kept running, and this function blocks, 
+   until call of stop_main_loop().
+*/
+void
+start_main_loop (GThreadFunc func, gpointer data)
+{
+	g_return_if_fail (loop == NULL);
+
+	do_start (func, data);
+}
+
+/* Starts new main-loop and then invokes func in a new thread.
+   Main-loop is kept running, and this function blocks, 
+   until call of stop_main_loop().
+*/
+void
+start_in_thread_with_main_loop (GThreadFunc func, gpointer data)
+{
+	struct IdleData *idle;
+
+	g_return_if_fail (func != NULL);
+	g_return_if_fail (loop == NULL);
+
+	main_initialize ();
+
+	idle = g_new0 (struct IdleData, 1);
+	idle->func = func;
+	idle->data = data;
+	idle->run_in_thread = TRUE;
+
+	g_idle_add (idle_cb, idle);
+
+	do_start (NULL, NULL);
+}
+
+/* Starts new main-loop and then invokes func in an idle callback.
+   Main-loop is kept running, and this function blocks, 
+   until call of stop_main_loop().
+*/
+void
+start_in_idle_with_main_loop (GThreadFunc func, gpointer data)
+{
+	struct IdleData *idle;
+
+	g_return_if_fail (func != NULL);
+	g_return_if_fail (loop == NULL);
+
+	main_initialize ();
+
+	idle = g_new0 (struct IdleData, 1);
+	idle->func = func;
+	idle->data = data;
+	idle->run_in_thread = FALSE;
+
+	g_idle_add (idle_cb, idle);
+
+	do_start (NULL, NULL);
+}
+
+/* Stops main-loop previously run by start_main_loop,
+   start_in_thread_with_main_loop or start_in_idle_with_main_loop.
+*/
+void
+stop_main_loop (gint stop_result)
+{
+	g_return_if_fail (loop != NULL);
+
+	main_stop_result = stop_result;
+	g_main_loop_quit (loop);
+}
+
+/* returns value used in stop_main_loop() */
+gint
+get_main_loop_stop_result (void)
+{
+	return main_stop_result;
+}
+
+void
+foreach_configured_source (ECalClientSourceType source_type, void (*func) (ESource *source, ECalClientSourceType source_type))
+{
+	gpointer foreach_async_data;
+	ESource *source = NULL;
+
+	g_return_if_fail (func != NULL);
+
+	main_initialize ();
+
+	foreach_async_data = foreach_configured_source_async_start (source_type, &source);
+	if (!foreach_async_data)
+		return;
+
+	do {
+		func (source, source_type);
+	} while (foreach_configured_source_async_next (&foreach_async_data, &source));
+}
+
+struct ForeachConfiguredData
+{
+	ECalClientSourceType source_type;
+	ESourceList *source_list;
+	GSList *current_group;
+	GSList *current_source;
+};
+
+gpointer
+foreach_configured_source_async_start (ECalClientSourceType source_type, ESource **source)
+{
+	struct ForeachConfiguredData *async_data;
+	ESourceList *source_list = NULL;
+	GError *error = NULL;
+
+	g_return_val_if_fail (source != NULL, NULL);
+
+	main_initialize ();
+
+	if (!e_cal_client_get_sources (&source_list, source_type, &error)) {
+		report_error ("get addressbooks", &error);
+		return NULL;
+	}
+
+	g_return_val_if_fail (source_list != NULL, NULL);
+
+	async_data = g_new0 (struct ForeachConfiguredData, 1);
+	async_data->source_type = source_type;
+	async_data->source_list = source_list;
+	async_data->current_group = e_source_list_peek_groups (source_list);
+	if (!async_data->current_group) {
+		gpointer ad = async_data;
+
+		foreach_configured_source_async_next (&ad, source);
+		return ad;
+	}
+
+	async_data->current_source = e_source_group_peek_sources (async_data->current_group->data);
+	if (!async_data->current_source) {
+		gpointer ad = async_data;
+
+		if (foreach_configured_source_async_next (&ad, source))
+			return ad;
+
+		return NULL;
+	}
+
+	*source = async_data->current_source->data;
+
+	return async_data;
+}
+
+gboolean
+foreach_configured_source_async_next (gpointer *foreach_async_data, ESource **source)
+{
+	struct ForeachConfiguredData *async_data;
+
+	g_return_val_if_fail (foreach_async_data != NULL, FALSE);
+	g_return_val_if_fail (source != NULL, FALSE);
+
+	async_data = *foreach_async_data;
+	g_return_val_if_fail (async_data != NULL, FALSE);
+	g_return_val_if_fail (async_data->source_list != NULL, FALSE);
+	g_return_val_if_fail (async_data->current_group != NULL, FALSE);
+
+	if (async_data->current_source)
+		async_data->current_source = async_data->current_source->next;
+	if (async_data->current_source) {
+		*source = async_data->current_source->data;
+		return TRUE;
+	}
+
+	do {
+		async_data->current_group = async_data->current_group->next;
+		if (async_data->current_group) {
+			async_data->current_source = e_source_group_peek_sources (async_data->current_group->data);
+		}
+	} while (async_data->current_group && !async_data->current_source);
+
+	if (async_data->current_source) {
+		*source = async_data->current_source->data;
+		return TRUE;
+	}
+
+	g_object_unref (async_data->source_list);
+	g_free (async_data);
+
+	*foreach_async_data = NULL;
+
+	return FALSE;
+}
+
+ECalClientSourceType
+foreach_configured_source_async_get_source_type (gpointer foreach_async_data)
+{
+	struct ForeachConfiguredData *async_data = foreach_async_data;
+
+	g_return_val_if_fail (foreach_async_data != NULL, E_CAL_CLIENT_SOURCE_TYPE_LAST);
+
+	return async_data->source_type;
+}
+
+ECalClient *
+new_temp_client (ECalClientSourceType source_type, gchar **uri)
+{
+	ECalClient *cal_client;
+	ESource *source;
+	gchar *abs_uri, *filename;
+	GError *error = NULL;
+
+	filename = g_build_filename (g_get_tmp_dir (), "e-cal-client-test-XXXXXX/", NULL);
+	abs_uri = g_strconcat ("local:", filename, NULL);
+	g_free (filename);
+
+	source = e_source_new_with_absolute_uri ("Test cal", abs_uri);
+	if (uri)
+		*uri = abs_uri;
+	else
+		g_free (abs_uri);
+
+	g_return_val_if_fail (source != NULL, NULL);
+
+	cal_client = e_cal_client_new (source, source_type, &error);
+	g_object_unref (source);
+
+	if (error)
+		report_error ("new temp client", &error);
+
+	return cal_client;
+}
diff --git a/tests/libecal/client/client-test-utils.h b/tests/libecal/client/client-test-utils.h
new file mode 100644
index 0000000..127a642
--- /dev/null
+++ b/tests/libecal/client/client-test-utils.h
@@ -0,0 +1,25 @@
+#ifndef CLIENT_TEST_UTILS_H
+#define CLIENT_TEST_UTILS_H
+
+#include <glib.h>
+#include <libecal/e-cal-client.h>
+
+void print_ecomp (ECalComponent *ecalcomp);
+void print_icomp (icalcomponent *icalcomp);
+void report_error (const gchar *operation, GError **error);
+
+void main_initialize (void);
+void start_main_loop (GThreadFunc func, gpointer data);
+void start_in_thread_with_main_loop (GThreadFunc func, gpointer data);
+void start_in_idle_with_main_loop (GThreadFunc func, gpointer data);
+void stop_main_loop (gint stop_result);
+gint get_main_loop_stop_result (void);
+
+void foreach_configured_source (ECalClientSourceType source_type, void (*func) (ESource *source, ECalClientSourceType source_type));
+gpointer foreach_configured_source_async_start (ECalClientSourceType source_type, ESource **source);
+gboolean foreach_configured_source_async_next (gpointer *foreach_async_data, ESource **source);
+ECalClientSourceType foreach_configured_source_async_get_source_type (gpointer foreach_async_data);
+
+ECalClient *new_temp_client (ECalClientSourceType source_type, gchar **uri);
+
+#endif /* CLIENT_TEST_UTILS_H */
diff --git a/tests/libecal/client/test-client-add-timezone.c b/tests/libecal/client/test-client-add-timezone.c
new file mode 100644
index 0000000..caae6ed
--- /dev/null
+++ b/tests/libecal/client/test-client-add-timezone.c
@@ -0,0 +1,218 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libecal/e-cal-client.h>
+#include <libical/ical.h>
+
+#include "client-test-utils.h"
+
+#define TZID_NEW "XYZ"
+#define TZNAME_NEW "Ex Wye Zee"
+
+static gboolean
+test_zones (icaltimezone *zone1, icaltimezone *zone2)
+{
+	if (!zone2) {
+		g_printerr ("Failure: get timezone returned NULL\n");
+		return FALSE;
+	}
+
+	if (g_strcmp0 (icaltimezone_get_tzid (zone1), icaltimezone_get_tzid (zone2)) != 0) {
+		g_printerr ("Failure: tzid doesn't match, expected '%s', got '%s'\n", icaltimezone_get_tzid (zone1), icaltimezone_get_tzid (zone2));
+		return FALSE;
+	}
+
+	if (g_strcmp0 (icaltimezone_get_tznames (zone1), icaltimezone_get_tznames (zone2)) != 0) {
+		g_printerr ("Failure: tznames doesn't match, expected '%s', got '%s'\n", icaltimezone_get_tznames (zone1), icaltimezone_get_tznames (zone2));
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+static gboolean
+test_sync (icaltimezone *zone)
+{
+	ECalClient *cal_client;
+	icaltimezone *zone2 = NULL;
+	GError *error = NULL;
+	gboolean res;
+
+	g_return_val_if_fail (zone != NULL, FALSE);
+
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	g_return_val_if_fail (cal_client != NULL, FALSE);
+
+	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (cal_client);
+		return FALSE;
+	}
+
+	if (!e_cal_client_add_timezone_sync (cal_client, zone, NULL, &error)) {
+		report_error ("add timezone sync", &error);
+		g_object_unref (cal_client);
+		return FALSE;
+	}
+
+	if (!e_cal_client_get_timezone_sync (cal_client, TZID_NEW, &zone2, NULL, &error)) {
+		report_error ("get timezone sync", &error);
+		g_object_unref (cal_client);
+		return FALSE;
+	}
+
+	res = test_zones (zone, zone2);
+
+	if (!e_client_remove_sync (E_CLIENT (cal_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (cal_client);
+		return FALSE;
+	}
+
+	g_object_unref (cal_client);
+
+	return res;
+}
+
+/* asynchronous read callback with a main-loop running */
+static void
+async_read_result_ready (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+	icaltimezone *zone1 = user_data, *zone2 = NULL;
+	gboolean res;
+
+	g_return_if_fail (zone1 != NULL);
+
+	cal_client = E_CAL_CLIENT (source_object);
+
+	if (!e_cal_client_get_timezone_finish (cal_client, result, &zone2, &error)) {
+		report_error ("get timezone finish", &error);
+		g_object_unref (cal_client);
+		stop_main_loop (1);
+		return;
+	}
+
+	res = test_zones (zone1, zone2);
+
+	if (!e_client_remove_sync (E_CLIENT (cal_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+	}
+
+	g_object_unref (cal_client);
+
+	stop_main_loop (res ? 0 : 1);
+}
+
+/* asynchronous write callback with a main-loop running */
+static void
+async_write_result_ready (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+
+	g_return_if_fail (user_data != NULL);
+
+	cal_client = E_CAL_CLIENT (source_object);
+
+	if (!e_cal_client_add_timezone_finish (cal_client, result, &error)) {
+		report_error ("add timezone finish", &error);
+		g_object_unref (cal_client);
+		stop_main_loop (1);
+		return;
+	}
+
+	if (!e_cal_client_get_timezone (cal_client, TZID_NEW, NULL, async_read_result_ready, user_data)) {
+		report_error ("get timezone", NULL);
+		g_object_unref (cal_client);
+		stop_main_loop (1);
+	}
+}
+
+/* synchronously in idle with main-loop running */
+static gboolean
+test_sync_in_idle (gpointer user_data)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+	icaltimezone *zone = user_data;
+
+	g_return_val_if_fail (zone != NULL, FALSE);
+
+	if (!test_sync (zone)) {
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	g_return_val_if_fail (cal_client != NULL, FALSE);
+
+	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (cal_client);
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	if (!e_cal_client_add_timezone (cal_client, zone, NULL, async_write_result_ready, zone)) {
+		report_error ("add timezone", NULL);
+		g_object_unref (cal_client);
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	return FALSE;
+}
+
+/* synchronously in a dedicated thread with main-loop running */
+static gpointer
+test_sync_in_thread (gpointer user_data)
+{
+	icaltimezone *zone = user_data;
+
+	g_return_val_if_fail (zone != NULL, NULL);
+
+	if (!test_sync (zone)) {
+		stop_main_loop (1);
+		return NULL;
+	}
+
+	g_idle_add (test_sync_in_idle, zone);
+
+	return NULL;
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	icalproperty *property;
+	icalcomponent *component;
+	icaltimezone *zone;
+
+	main_initialize ();
+
+	/* Build up new timezone */
+	component = icalcomponent_new_vtimezone ();
+	property = icalproperty_new_tzid (TZID_NEW);
+	icalcomponent_add_property (component, property);
+	property = icalproperty_new_tzname (TZNAME_NEW);
+	icalcomponent_add_property (component, property);
+	zone = icaltimezone_new ();
+	icaltimezone_set_component (zone, component);
+
+	/* synchronously without main-loop */
+	if (!test_sync (zone)) {
+		icaltimezone_free (zone, TRUE);
+		return 1;
+	}
+
+	start_in_thread_with_main_loop (test_sync_in_thread, zone);
+
+	icaltimezone_free (zone, TRUE);
+
+	if (get_main_loop_stop_result () == 0)
+		g_print ("Test finished successfully.\n");
+
+	return get_main_loop_stop_result ();
+}
diff --git a/tests/libecal/client/test-client-create-object.c b/tests/libecal/client/test-client-create-object.c
new file mode 100644
index 0000000..8eedba2
--- /dev/null
+++ b/tests/libecal/client/test-client-create-object.c
@@ -0,0 +1,319 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libecal/e-cal-client.h>
+#include <libical/ical.h>
+
+#include "client-test-utils.h"
+
+static gboolean
+test_icalcomps (icalcomponent *icalcomp1, icalcomponent *icalcomp2)
+{
+	struct icaltimetype t1, t2;
+
+	if (!icalcomp2) {
+		g_printerr ("Failure: get object returned NULL\n");
+		return FALSE;
+	}
+
+	if (g_strcmp0 (icalcomponent_get_uid (icalcomp1), icalcomponent_get_uid (icalcomp2)) != 0) {
+		g_printerr ("Failure: uid doesn't match, expected '%s', got '%s'\n", icalcomponent_get_uid (icalcomp1), icalcomponent_get_uid (icalcomp2));
+		return FALSE;
+	}
+
+	if (g_strcmp0 (icalcomponent_get_summary (icalcomp1), icalcomponent_get_summary (icalcomp2)) != 0) {
+		g_printerr ("Failure: summary doesn't match, expected '%s', got '%s'\n", icalcomponent_get_summary (icalcomp1), icalcomponent_get_summary (icalcomp2));
+		return FALSE;
+	}
+
+	t1 = icalcomponent_get_dtstart (icalcomp1);
+	t2 = icalcomponent_get_dtstart (icalcomp2);
+
+	if (icaltime_compare (t1, t2) != 0) {
+		g_printerr ("Failure: dtend doesn't match, expected '%s', got '%s'\n", icaltime_as_ical_string (t1), icaltime_as_ical_string (t2));
+		return FALSE;
+	}
+
+	t1 = icalcomponent_get_dtend (icalcomp1);
+	t2 = icalcomponent_get_dtend (icalcomp2);
+
+	if (icaltime_compare (t1, t2) != 0) {
+		g_printerr ("Failure: dtend doesn't match, expected '%s', got '%s'\n", icaltime_as_ical_string (t1), icaltime_as_ical_string (t2));
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+static gboolean
+test_sync (icalcomponent *icalcomp)
+{
+	ECalClient *cal_client;
+	icalcomponent *icalcomp2 = NULL, *clone;
+	GError *error = NULL;
+	gchar *uid = NULL;
+	gboolean res;
+
+	g_return_val_if_fail (icalcomp != NULL, FALSE);
+
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	g_return_val_if_fail (cal_client != NULL, FALSE);
+
+	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (cal_client);
+		return FALSE;
+	}
+
+	if (!e_cal_client_create_object_sync (cal_client, icalcomp, &uid, NULL, &error)) {
+		report_error ("create object sync", &error);
+		g_object_unref (cal_client);
+		return FALSE;
+	}
+
+	if (!e_cal_client_get_object_sync (cal_client, uid, NULL, &icalcomp2, NULL, &error)) {
+		report_error ("get object sync", &error);
+		g_free (uid);
+		g_object_unref (cal_client);
+		return FALSE;
+	}
+
+	clone = icalcomponent_new_clone (icalcomp);
+	icalcomponent_set_uid (clone, uid);
+
+	res = test_icalcomps (clone, icalcomp2);
+
+	icalcomponent_free (icalcomp2);
+
+	if (res) {
+		GSList *ecalcomps = NULL;
+	
+		if (!e_cal_client_get_objects_for_uid_sync (cal_client, uid, &ecalcomps, NULL, &error)) {
+			report_error ("get objects for uid sync", &error);
+			res = FALSE;
+		}
+
+		if (g_slist_length (ecalcomps) != 1) {
+			g_printerr ("Failure: expected 1 component, bug got %d\n", g_slist_length (ecalcomps));
+			res = FALSE;
+		} else {
+			ECalComponent *ecalcomp = ecalcomps->data;
+
+			res = test_icalcomps (clone, e_cal_component_get_icalcomponent (ecalcomp));
+		}
+
+		e_cal_client_free_ecalcomp_slist (ecalcomps);
+	}
+
+	icalcomponent_free (clone);
+	g_free (uid);
+
+	if (!e_client_remove_sync (E_CLIENT (cal_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (cal_client);
+		return FALSE;
+	}
+
+	g_object_unref (cal_client);
+
+	return res;
+}
+
+/* asynchronous read2 callback with a main-loop running */
+static void
+async_read2_result_ready (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+	icalcomponent *icalcomp1 = user_data;
+	GSList *ecalcomps = NULL;
+	gboolean res;
+
+	g_return_if_fail (icalcomp1 != NULL);
+
+	cal_client = E_CAL_CLIENT (source_object);
+
+	if (!e_cal_client_get_objects_for_uid_finish (cal_client, result, &ecalcomps, &error)) {
+		report_error ("get objects for uid finish", &error);
+		g_object_unref (cal_client);
+		icalcomponent_free (icalcomp1);
+		stop_main_loop (1);
+		return;
+	}
+
+	if (g_slist_length (ecalcomps) != 1) {
+		g_printerr ("Failure: expected 1 component, bug got %d\n", g_slist_length (ecalcomps));
+		res = FALSE;
+	} else {
+		ECalComponent *ecalcomp = ecalcomps->data;
+
+		res = test_icalcomps (icalcomp1, e_cal_component_get_icalcomponent (ecalcomp));
+	}
+
+	e_cal_client_free_ecalcomp_slist (ecalcomps);
+
+	if (!e_client_remove_sync (E_CLIENT (cal_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+	}
+
+	g_object_unref (cal_client);
+	icalcomponent_free (icalcomp1);
+
+	stop_main_loop (res ? 0 : 1);
+}
+
+/* asynchronous read callback with a main-loop running */
+static void
+async_read_result_ready (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+	icalcomponent *icalcomp1 = user_data, *icalcomp2 = NULL;
+	gboolean res;
+
+	g_return_if_fail (icalcomp1 != NULL);
+
+	cal_client = E_CAL_CLIENT (source_object);
+
+	if (!e_cal_client_get_object_finish (cal_client, result, &icalcomp2, &error)) {
+		report_error ("get object finish", &error);
+		g_object_unref (cal_client);
+		icalcomponent_free (icalcomp1);
+		stop_main_loop (1);
+		return;
+	}
+
+	res = test_icalcomps (icalcomp1, icalcomp2);
+
+	icalcomponent_free (icalcomp2);
+
+	if (!e_cal_client_get_objects_for_uid (cal_client, icalcomponent_get_uid (icalcomp1), NULL, async_read2_result_ready, icalcomp1)) {
+		report_error ("get objects for uid", NULL);
+
+		if (!e_client_remove_sync (E_CLIENT (cal_client), NULL, &error)) {
+			report_error ("client remove sync", &error);
+		}
+
+		g_object_unref (cal_client);
+		icalcomponent_free (icalcomp1);
+
+		stop_main_loop (res ? 0 : 1);
+	}
+}
+
+/* asynchronous write callback with a main-loop running */
+static void
+async_write_result_ready (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+	gchar *uid = NULL;
+	icalcomponent *clone, *icalcomp = user_data;
+
+	g_return_if_fail (icalcomp != NULL);
+
+	cal_client = E_CAL_CLIENT (source_object);
+
+	if (!e_cal_client_create_object_finish (cal_client, result, &uid, &error)) {
+		report_error ("create object finish", &error);
+		g_object_unref (cal_client);
+		stop_main_loop (1);
+		return;
+	}
+
+	clone = icalcomponent_new_clone (icalcomp);
+	icalcomponent_set_uid (clone, uid);
+
+	if (!e_cal_client_get_object (cal_client, uid, NULL, NULL, async_read_result_ready, clone)) {
+		report_error ("get object", NULL);
+		g_object_unref (cal_client);
+		icalcomponent_free (clone);
+		stop_main_loop (1);
+	}
+
+	g_free (uid);
+}
+
+/* synchronously in idle with main-loop running */
+static gboolean
+test_sync_in_idle (gpointer user_data)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+	icalcomponent *icalcomp = user_data;
+
+	g_return_val_if_fail (icalcomp != NULL, FALSE);
+
+	if (!test_sync (icalcomp)) {
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	g_return_val_if_fail (cal_client != NULL, FALSE);
+
+	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (cal_client);
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	if (!e_cal_client_create_object (cal_client, icalcomp, NULL, async_write_result_ready, icalcomp)) {
+		report_error ("create object", NULL);
+		g_object_unref (cal_client);
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	return FALSE;
+}
+
+/* synchronously in a dedicated thread with main-loop running */
+static gpointer
+test_sync_in_thread (gpointer user_data)
+{
+	icalcomponent *icalcomp = user_data;
+
+	g_return_val_if_fail (icalcomp != NULL, NULL);
+
+	if (!test_sync (icalcomp)) {
+		stop_main_loop (1);
+		return NULL;
+	}
+
+	g_idle_add (test_sync_in_idle, icalcomp);
+
+	return NULL;
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	icalcomponent *icalcomp;
+	struct icaltimetype now;
+
+	main_initialize ();
+
+	/* Build up new component */
+	now = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
+	icalcomp = icalcomponent_new (ICAL_VEVENT_COMPONENT);
+	icalcomponent_set_summary (icalcomp, "Test event summary");
+	icalcomponent_set_dtstart (icalcomp, now);
+	icalcomponent_set_dtend   (icalcomp, icaltime_from_timet (icaltime_as_timet (now) + 60 * 60 * 60, 0));
+
+	/* synchronously without main-loop */
+	if (!test_sync (icalcomp)) {
+		icalcomponent_free (icalcomp);
+		return 1;
+	}
+
+	start_in_thread_with_main_loop (test_sync_in_thread, icalcomp);
+
+	icalcomponent_free (icalcomp);
+
+	if (get_main_loop_stop_result () == 0)
+		g_print ("Test finished successfully.\n");
+
+	return get_main_loop_stop_result ();
+}
diff --git a/tests/libecal/client/test-client-examine.c b/tests/libecal/client/test-client-examine.c
new file mode 100644
index 0000000..cb31bde
--- /dev/null
+++ b/tests/libecal/client/test-client-examine.c
@@ -0,0 +1,489 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <string.h>
+#include <libecal/e-cal-client.h>
+#include <libedataserver/e-source-group.h>
+
+#include "client-test-utils.h"
+
+static gint running_async = 0;
+
+typedef struct _ExtraValues {
+	gpointer async_data;
+
+	const gchar *cache_dir;
+	gchar *cal_address;
+	gchar *alarm_email_address;
+	icalcomponent *default_object;
+} ExtraValues;
+
+static void
+extra_values_free (ExtraValues *evals)
+{
+	if (!evals)
+		return;
+
+	if (evals->default_object)
+		icalcomponent_free (evals->default_object);
+	g_free (evals->cal_address);
+	g_free (evals->alarm_email_address);
+	g_free (evals);
+}
+
+static void
+print_values (const GSList *values, const ExtraValues *evals, EClient *client)
+{
+	g_return_if_fail (evals != NULL);
+
+	g_print ("\treadonly:%s online:%s\n", e_client_is_readonly (client) ? "yes" : "no", e_client_is_online (client) ? "yes" : "no");
+	g_print ("\tcal address: %s%s%s\n", evals->cal_address ? "'" : "", evals->cal_address ? evals->cal_address : "none", evals->cal_address ? "'" : "");
+	g_print ("\talarm email address: %s%s%s\n", evals->alarm_email_address ? "'" : "", evals->alarm_email_address ? evals->alarm_email_address : "none", evals->alarm_email_address ? "'" : "");
+	g_print ("\tcache dir: %s%s%s\n", evals->cache_dir ? "'" : "", evals->cache_dir ? evals->cache_dir : "none", evals->cache_dir ? "'" : "");
+	g_print ("\tcapabilities: ");
+	if (!values) {
+		g_print ("NULL");
+		if (e_client_get_capabilities (client))
+			g_print (", but client has %d capabilities", g_slist_length ((GSList *) e_client_get_capabilities (client)));
+	} else {
+		gint client_caps = g_slist_length ((GSList *) e_client_get_capabilities (client)), my_caps = g_slist_length ((GSList *) values);
+
+		while (values) {
+			const gchar *cap = values->data;
+
+			g_print ("'%s'", cap);
+			if (!e_client_check_capability (client, cap))
+				g_print (" (not found in EClient)");
+
+			values = values->next;
+
+			if (values)
+				g_print (", ");
+		}
+
+		if (client_caps != my_caps) {
+			g_print ("\n\t * has different count of capabilities in EClient (%d) and returned (%d)", client_caps, my_caps);
+		}
+
+	}
+	g_print ("\n");
+	g_print ("\tdefault object: %s\n", evals->default_object ? "" : "none");
+	if (evals->default_object) {
+		gchar *comp_str = icalcomponent_as_ical_string_r (evals->default_object);
+		const gchar *p = comp_str, *n;
+		while (n = strchr (p, '\n'), p) {
+			if (!n) {
+				g_print ("\t   %s\n", p);
+				break;
+			} else {
+				g_print ("\t   %.*s\n", (gint) (n - p), p);
+				n++;
+			}
+
+			p = n;
+		}
+
+		g_free (comp_str);
+	}
+}
+
+static void
+identify_source (ESource *source, ECalClientSourceType source_type)
+{
+	const gchar *name, *uri, *type;
+	gchar *abs_uri = NULL;
+
+	g_return_if_fail (source != NULL);
+
+	switch (source_type) {
+	case E_CAL_CLIENT_SOURCE_TYPE_EVENT:
+		type = "events";
+		break;
+	case E_CAL_CLIENT_SOURCE_TYPE_TODO:
+		type = "tasks";
+		break;
+	case E_CAL_CLIENT_SOURCE_TYPE_JOURNAL:
+		type = "memos";
+		break;
+	default:
+		type = "unknown-type";
+		break;
+	}
+
+	name = e_source_peek_name (source);
+	if (!name)
+		name = "Unknown name";
+
+	uri = e_source_peek_absolute_uri (source);
+	if (!uri) {
+		abs_uri = e_source_build_absolute_uri (source);
+		uri = abs_uri;
+	}
+	if (!uri)
+		uri = e_source_peek_relative_uri (source);
+	if (!uri)
+		uri = "Unknown uri";
+
+	g_print ("\n   Checking %s source '%s' (%s)\n", type, name, uri);
+
+	g_free (abs_uri);
+}
+
+static void
+identify_cal_client (ECalClient *cal_client)
+{
+	g_return_if_fail (cal_client != NULL);
+	g_return_if_fail (E_IS_CAL_CLIENT (cal_client));
+
+	identify_source (e_client_get_source (E_CLIENT (cal_client)), e_cal_client_get_source_type (cal_client));
+}
+
+static void client_opened_async (GObject *source_object, GAsyncResult *result, gpointer async_data);
+
+static void
+continue_next_source (gpointer async_data)
+{
+	ESource *source = NULL;
+	ECalClient *cal_client;
+	GError *error = NULL;
+
+	g_return_if_fail (async_data != NULL);
+
+	while (async_data && foreach_configured_source_async_next (&async_data, &source)) {
+		ECalClientSourceType source_type = foreach_configured_source_async_get_source_type (async_data);
+
+		cal_client = e_cal_client_new (source, source_type, &error);
+		if (!cal_client) {
+			identify_source (source, source_type);
+			report_error ("cal client new", &error);
+			continue;
+		}
+
+		if (!e_client_open (E_CLIENT (cal_client), TRUE, NULL, client_opened_async, async_data)) {
+			identify_source (source, source_type);
+			report_error ("client open", NULL);
+			g_object_unref (cal_client);
+		} else {
+			break;
+		}
+	}
+
+	if (!async_data) {
+		running_async--;
+		if (!running_async)
+			stop_main_loop (0);
+	}
+}
+
+static void
+client_got_values_async (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	ExtraValues *evals = user_data;
+	GSList *values = NULL;
+	GError *error = NULL;
+	ECalClient *cal_client;
+
+	g_return_if_fail (source_object != NULL);
+	g_return_if_fail (E_IS_CAL_CLIENT (source_object));
+	g_return_if_fail (evals != NULL);
+
+	cal_client = E_CAL_CLIENT (source_object);
+
+	if (!e_cal_client_get_capabilities_finish (cal_client, result, &values, &error)) {
+		identify_cal_client (cal_client);
+		report_error ("get capabilities finish", &error);
+	} else {
+		/* to cache them, as it can be fetched with idle as well */
+		e_client_get_capabilities (E_CLIENT (source_object));
+
+		evals->cache_dir = e_cal_client_get_local_attachment_store (cal_client);
+
+		identify_cal_client (cal_client);
+		print_values (values, evals, E_CLIENT (source_object));
+
+		e_client_util_free_string_slist (values);
+	}
+
+	g_object_unref (source_object);
+
+	continue_next_source (evals->async_data);
+	extra_values_free (evals);
+}
+
+static void
+client_got_alarm_email_address_async (GObject *source_object, GAsyncResult *result, gpointer evals_data)
+{
+	ExtraValues *evals = evals_data;
+	ECalClient *cal_client;
+	GError *error = NULL;
+
+	g_return_if_fail (source_object != NULL);
+	g_return_if_fail (E_IS_CAL_CLIENT (source_object));
+	g_return_if_fail (evals != NULL);
+
+	cal_client = E_CAL_CLIENT (source_object);
+
+	if (!e_cal_client_get_alarm_email_address_finish (cal_client, result, &evals->alarm_email_address, &error)) {
+		identify_cal_client (cal_client);
+		report_error ("get alarm email address finish", &error);
+		g_object_unref (source_object);
+		continue_next_source (evals->async_data);
+		extra_values_free (evals);
+		return;
+	}
+
+	if (!e_cal_client_get_capabilities (cal_client, NULL, client_got_values_async, evals)) {
+		identify_cal_client (cal_client);
+		report_error ("get capabilities", NULL);
+		g_object_unref (source_object);
+		continue_next_source (evals->async_data);
+		extra_values_free (evals);
+	}
+}
+
+static void
+client_got_cal_address_async (GObject *source_object, GAsyncResult *result, gpointer evals_data)
+{
+	ExtraValues *evals = evals_data;
+	ECalClient *cal_client;
+	GError *error = NULL;
+
+	g_return_if_fail (source_object != NULL);
+	g_return_if_fail (E_IS_CAL_CLIENT (source_object));
+	g_return_if_fail (evals != NULL);
+
+	cal_client = E_CAL_CLIENT (source_object);
+
+	if (!e_cal_client_get_cal_email_address_finish (cal_client, result, &evals->cal_address, &error)) {
+		identify_cal_client (cal_client);
+		report_error ("get cal address finish", &error);
+		g_object_unref (source_object);
+		continue_next_source (evals->async_data);
+		extra_values_free (evals);
+		return;
+	}
+
+	if (!e_cal_client_get_alarm_email_address (cal_client, NULL, client_got_alarm_email_address_async, evals)) {
+		identify_cal_client (cal_client);
+		report_error ("get alarm email address", NULL);
+		g_object_unref (source_object);
+		continue_next_source (evals->async_data);
+		extra_values_free (evals);
+	}
+}
+
+static void
+client_got_default_object_async (GObject *source_object, GAsyncResult *result, gpointer evals_data)
+{
+	ExtraValues *evals = evals_data;
+	ECalClient *cal_client;
+	GError *error = NULL;
+
+	g_return_if_fail (source_object != NULL);
+	g_return_if_fail (E_IS_CAL_CLIENT (source_object));
+	g_return_if_fail (evals != NULL);
+
+	cal_client = E_CAL_CLIENT (source_object);
+
+	if (!e_cal_client_get_default_object_finish (cal_client, result, &evals->default_object, &error)) {
+		identify_cal_client (cal_client);
+		report_error ("get default object finish", &error);
+	}
+
+	if (!e_cal_client_get_cal_email_address (cal_client, NULL, client_got_cal_address_async, evals)) {
+		identify_cal_client (cal_client);
+		report_error ("get cal address", NULL);
+		g_object_unref (source_object);
+		continue_next_source (evals->async_data);
+		extra_values_free (evals);
+	}
+}
+
+static void
+client_opened_async (GObject *source_object, GAsyncResult *result, gpointer async_data)
+{
+	ExtraValues *evals;
+	GError *error = NULL;
+	ECalClient *cal_client;
+
+	g_return_if_fail (source_object != NULL);
+	g_return_if_fail (E_IS_CAL_CLIENT (source_object));
+	g_return_if_fail (async_data != NULL);
+
+	cal_client = E_CAL_CLIENT (source_object);
+
+	if (!e_client_open_finish (E_CLIENT (source_object), result, &error)) {
+		identify_cal_client (cal_client);
+		report_error ("client open finish", &error);
+		g_object_unref (source_object);
+		continue_next_source (async_data);
+		return;
+	}
+
+	evals = g_new0 (ExtraValues, 1);
+	evals->async_data = async_data;
+	
+	if (!e_cal_client_get_default_object (cal_client, NULL, client_got_default_object_async, evals)) {
+		identify_cal_client (cal_client);
+		report_error ("get default object", NULL);
+		g_object_unref (source_object);
+		continue_next_source (async_data);
+		extra_values_free (evals);
+	}
+}
+
+static void
+check_source_sync (ESource *source, ECalClientSourceType source_type)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+	GSList *values = NULL;
+	ExtraValues evals = { 0 };
+
+	g_return_if_fail (source != NULL);
+
+	identify_source (source, source_type);
+
+	cal_client = e_cal_client_new (source, source_type, &error);
+	if (!cal_client) {
+		report_error ("cal client new", &error);
+		return;
+	}
+
+	if (!e_client_open_sync (E_CLIENT (cal_client), TRUE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (cal_client);
+		return;
+	}
+
+	if (!e_cal_client_get_capabilities_sync (cal_client, &values, NULL, &error)) {
+		report_error ("get capabilities sync", &error);
+		g_object_unref (cal_client);
+		return;
+	}
+
+	if (!e_cal_client_get_cal_email_address_sync (cal_client, &evals.cal_address, NULL, &error)) {
+		report_error ("get cal address sync", &error);
+	}
+
+	if (!e_cal_client_get_alarm_email_address_sync (cal_client, &evals.alarm_email_address, NULL, &error)) {
+		report_error ("get alarm email address sync", &error);
+	}
+
+	if (!e_cal_client_get_default_object_sync (cal_client, &evals.default_object, NULL, &error)) {
+		report_error ("get default object sync", &error);
+	}
+
+	evals.cache_dir = e_cal_client_get_local_attachment_store (cal_client);
+
+	print_values (values, &evals, E_CLIENT (cal_client));
+
+	g_free (evals.cal_address);
+	g_free (evals.alarm_email_address);
+	icalcomponent_free (evals.default_object);
+	e_client_util_free_string_slist (values);
+	g_object_unref (cal_client);
+}
+
+static gboolean
+foreach_async (ECalClientSourceType source_type)
+{
+	gpointer async_data;
+	ESource *source = NULL;
+	ECalClient *cal_client;
+	GError *error = NULL;
+
+	async_data = foreach_configured_source_async_start (source_type, &source);
+	if (!async_data) {
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	running_async++;
+
+	while (TRUE) {
+		while (cal_client = e_cal_client_new (source, source_type, &error), !cal_client) {
+			identify_source (source, source_type);
+			report_error ("cal client new", &error);
+
+			if (!foreach_configured_source_async_next (&async_data, &source)) {
+				running_async--;
+				if (!running_async)
+					stop_main_loop (0);
+				return FALSE;
+			}
+
+			identify_source (source, source_type);
+		}
+
+		if (!e_client_open (E_CLIENT (cal_client), TRUE, NULL, client_opened_async, async_data)) {
+			identify_source (source, source_type);
+			report_error ("client open", NULL);
+			g_object_unref (cal_client);
+
+			if (!foreach_configured_source_async_next (&async_data, &source)) {
+				running_async--;
+				if (!running_async)
+					stop_main_loop (0);
+				return FALSE;
+			}
+		} else {
+			break;
+		}
+	}
+
+	return TRUE;
+}
+
+static gboolean
+in_main_thread_idle_cb (gpointer unused)
+{
+	g_print ("* run in main thread with mainloop running\n");
+	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_EVENT, check_source_sync);
+	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_TODO, check_source_sync);
+	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_JOURNAL, check_source_sync);
+	g_print ("---------------------------------------------------------\n\n");
+
+	g_print ("* run in main thread async\n");
+
+	if (!foreach_async (E_CAL_CLIENT_SOURCE_TYPE_EVENT))
+		return FALSE;
+
+	if (!foreach_async (E_CAL_CLIENT_SOURCE_TYPE_TODO))
+		return FALSE;
+
+	if (!foreach_async (E_CAL_CLIENT_SOURCE_TYPE_JOURNAL))
+		return FALSE;
+
+	return FALSE;
+}
+
+static gpointer
+worker_thread (gpointer unused)
+{
+	g_print ("* run in dedicated thread with mainloop running\n");
+	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_EVENT, check_source_sync);
+	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_TODO, check_source_sync);
+	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_JOURNAL, check_source_sync);
+	g_print ("---------------------------------------------------------\n\n");
+
+	g_idle_add (in_main_thread_idle_cb, NULL);
+
+	return NULL;
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	main_initialize ();
+
+	g_print ("* run in main thread without mainloop\n");
+	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_EVENT, check_source_sync);
+	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_TODO, check_source_sync);
+	foreach_configured_source (E_CAL_CLIENT_SOURCE_TYPE_JOURNAL, check_source_sync);
+	g_print ("---------------------------------------------------------\n\n");
+
+	start_in_thread_with_main_loop (worker_thread, NULL);
+
+	return get_main_loop_stop_result ();
+}
diff --git a/tests/libecal/client/test-client-get-attachment-uris.c b/tests/libecal/client/test-client-get-attachment-uris.c
new file mode 100644
index 0000000..312d6de
--- /dev/null
+++ b/tests/libecal/client/test-client-get-attachment-uris.c
@@ -0,0 +1,196 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <string.h>
+#include <libecal/e-cal-client.h>
+#include <libical/ical.h>
+
+#include "client-test-utils.h"
+
+#define ATTACH1 "file:///tmp/file1.x"
+#define ATTACH2 "file:///tmp/file2"
+#define ATTACH3 "file:///tmp/dir/fileÄ?Å¡Ä?Å?žýáíé3"
+
+static gboolean
+manage_result (GSList *attachment_uris)
+{
+	gboolean res;
+
+	g_return_val_if_fail (attachment_uris != NULL, FALSE);
+	g_return_val_if_fail (g_slist_length (attachment_uris) == 3, FALSE);
+
+	res = g_slist_find_custom (attachment_uris, ATTACH1, g_str_equal)
+	   && g_slist_find_custom (attachment_uris, ATTACH2, g_str_equal)
+	   && g_slist_find_custom (attachment_uris, ATTACH3, g_str_equal);
+
+	if (!res) {
+		GSList *au;
+
+		g_printerr ("Failed: didn't return same three attachment uris, got instead:\n");
+		for (au = attachment_uris; au; au = au->next)
+			g_printerr ("\t'%s'\n", (const gchar *) au->data);
+	}
+
+	e_client_util_free_string_slist (attachment_uris);
+
+	return res;
+}
+
+static gboolean
+test_sync (ECalClient *cal_client)
+{
+	GError *error = NULL;
+	GSList *attachment_uris = NULL;
+	const gchar *uid = g_object_get_data (G_OBJECT (cal_client), "use-uid");
+
+	g_return_val_if_fail (uid != NULL, FALSE);
+
+	if (!e_cal_client_get_attachment_uris_sync (cal_client, uid, NULL, &attachment_uris, NULL, &error)) {
+		report_error ("get attachment uris sync", &error);
+		return FALSE;
+	}
+
+	return manage_result (attachment_uris);
+}
+
+/* asynchronous callback with a main-loop running */
+static void
+async_attachment_uris_result_ready (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+	GSList *attachment_uris = NULL;
+
+	cal_client = E_CAL_CLIENT (source_object);
+
+	if (!e_cal_client_get_attachment_uris_finish (cal_client, result, &attachment_uris, &error)) {
+		report_error ("get attachment uris finish", &error);
+		stop_main_loop (1);
+		return;
+	}
+
+	stop_main_loop (manage_result (attachment_uris) ? 0 : 1);
+}
+
+/* synchronously in idle with main-loop running */
+static gboolean
+test_sync_in_idle (gpointer user_data)
+{
+	ECalClient *cal_client = user_data;
+	GError *error = NULL;
+	const gchar *uid;
+
+	g_return_val_if_fail (cal_client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (cal_client), FALSE);
+
+	if (!test_sync (cal_client)) {
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	uid = g_object_get_data (G_OBJECT (cal_client), "use-uid");
+
+	if (!e_cal_client_get_attachment_uris (cal_client, uid, NULL, NULL, async_attachment_uris_result_ready, NULL)) {
+		report_error ("get attachment uris", &error);
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	return FALSE;
+}
+
+/* synchronously in a dedicated thread with main-loop running */
+static gpointer
+test_sync_in_thread (gpointer user_data)
+{
+	if (!test_sync (user_data)) {
+		stop_main_loop (1);
+		return NULL;
+	}
+
+	g_idle_add (test_sync_in_idle, user_data);
+
+	return NULL;
+}
+
+static void
+add_attach (icalcomponent *icalcomp, const gchar *uri)
+{
+	gsize buf_size;
+	gchar *buf;
+	icalproperty *prop;
+	icalattach *attach;
+
+	g_return_if_fail (icalcomp != NULL);
+	g_return_if_fail (uri != NULL);
+
+	buf_size = 2 * strlen (uri);
+	buf = g_malloc0 (buf_size);
+	icalvalue_encode_ical_string (uri, buf, buf_size);
+	attach = icalattach_new_from_url (uri);
+	prop = icalproperty_new_attach (attach);
+	icalcomponent_add_property (icalcomp, prop);
+	icalattach_unref (attach);
+	g_free (buf);
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+	icalcomponent *icalcomp;
+	struct icaltimetype now;
+	gchar *uid = NULL;
+
+	main_initialize ();
+
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	g_return_val_if_fail (cal_client != NULL, FALSE);
+
+	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (cal_client);
+		return 1;
+	}
+
+	now = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
+	icalcomp = icalcomponent_new (ICAL_VEVENT_COMPONENT);
+	icalcomponent_set_summary (icalcomp, "Test event summary");
+	icalcomponent_set_dtstart (icalcomp, now);
+	icalcomponent_set_dtend   (icalcomp, icaltime_from_timet (icaltime_as_timet (now) + 60 * 60 * 60, 0));
+	add_attach (icalcomp, ATTACH1);
+	add_attach (icalcomp, ATTACH2);
+	add_attach (icalcomp, ATTACH3);
+
+	if (!e_cal_client_create_object_sync (cal_client, icalcomp, &uid, NULL, &error)) {
+		report_error ("create object sync", &error);
+		icalcomponent_free (icalcomp);
+		g_object_unref (cal_client);
+		return 1;
+	}
+
+	icalcomponent_free (icalcomp);
+	g_object_set_data_full (G_OBJECT (cal_client), "use-uid", uid, g_free);
+
+	/* synchronously without main-loop */
+	if (!test_sync (cal_client)) {
+		g_object_unref (cal_client);
+		return 1;
+	}
+
+	start_in_thread_with_main_loop (test_sync_in_thread, cal_client);
+
+	if (!e_client_remove_sync (E_CLIENT (cal_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (cal_client);
+		return 1;
+	}
+
+	g_object_unref (cal_client);
+
+	if (get_main_loop_stop_result () == 0)
+		g_print ("Test finished successfully.\n");
+
+	return get_main_loop_stop_result ();
+}
diff --git a/tests/libecal/client/test-client-get-free-busy.c b/tests/libecal/client/test-client-get-free-busy.c
new file mode 100644
index 0000000..027be15
--- /dev/null
+++ b/tests/libecal/client/test-client-get-free-busy.c
@@ -0,0 +1,159 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libecal/e-cal-client.h>
+#include <libecal/e-cal-time-util.h>
+#include <libical/ical.h>
+
+#include "client-test-utils.h"
+
+static gboolean
+test_sync (void)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+	icaltimezone *utc;
+	GSList *users = NULL, *free_busy_ecalcomps = NULL;
+	time_t start, end;
+
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	g_return_val_if_fail (cal_client != NULL, FALSE);
+
+	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (cal_client);
+		return FALSE;
+	}
+
+	utc = icaltimezone_get_utc_timezone ();
+	start = time_from_isodate ("20040212T000000Z");
+	end = time_add_day_with_zone (start, 2, utc);
+	/* XXX: create dummy list, which the file backend will ignore */
+	users = g_slist_append (users, (gpointer) "user example com");
+
+	if (!e_cal_client_get_free_busy_sync (cal_client, start, end, users, &free_busy_ecalcomps, NULL, &error)) {
+		report_error ("get free busy sync", &error);
+		g_object_unref (cal_client);
+		g_slist_free (users);
+		return FALSE;
+	}
+
+	g_slist_free (users);
+	e_cal_client_free_ecalcomp_slist (free_busy_ecalcomps);
+
+	if (!e_client_remove_sync (E_CLIENT (cal_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (cal_client);
+		return FALSE;
+	}
+
+	g_object_unref (cal_client);
+
+	return TRUE;
+}
+
+/* asynchronous get_free_busy callback with a main-loop running */
+static void
+async_get_free_busy_result_ready (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+	GSList *free_busy_ecalcomps = NULL;
+
+	cal_client = E_CAL_CLIENT (source_object);
+
+	if (!e_cal_client_get_free_busy_finish (cal_client, result, &free_busy_ecalcomps, &error)) {
+		report_error ("create object finish", &error);
+		g_object_unref (cal_client);
+		stop_main_loop (1);
+		return;
+	}
+
+	e_cal_client_free_ecalcomp_slist (free_busy_ecalcomps);
+
+	if (!e_client_remove_sync (E_CLIENT (cal_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (cal_client);
+		stop_main_loop (1);
+		return;
+	}
+
+	g_object_unref (cal_client);
+
+	stop_main_loop (0);
+}
+
+/* synchronously in idle with main-loop running */
+static gboolean
+test_sync_in_idle (gpointer user_data)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+	icaltimezone *utc;
+	GSList *users = NULL;
+	time_t start, end;
+
+	if (!test_sync ()) {
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	g_return_val_if_fail (cal_client != NULL, FALSE);
+
+	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (cal_client);
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	utc = icaltimezone_get_utc_timezone ();
+	start = time_from_isodate ("20040212T000000Z");
+	end = time_add_day_with_zone (start, 2, utc);
+	/* XXX: create dummy list, which the file backend will ignore */
+	users = g_slist_append (users, (gpointer) "user example com");
+
+	if (!e_cal_client_get_free_busy (cal_client, start, end, users, NULL, async_get_free_busy_result_ready, NULL)) {
+		report_error ("get free busy", NULL);
+		g_object_unref (cal_client);
+		g_slist_free (users);
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	g_slist_free (users);
+
+	return FALSE;
+}
+
+/* synchronously in a dedicated thread with main-loop running */
+static gpointer
+test_sync_in_thread (gpointer user_data)
+{
+	if (!test_sync ()) {
+		stop_main_loop (1);
+		return NULL;
+	}
+
+	g_idle_add (test_sync_in_idle, NULL);
+
+	return NULL;
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	main_initialize ();
+
+	/* synchronously without main-loop */
+	if (!test_sync ())
+		return 1;
+
+	start_in_thread_with_main_loop (test_sync_in_thread, NULL);
+
+	if (get_main_loop_stop_result () == 0)
+		g_print ("Test finished successfully.\n");
+
+	return get_main_loop_stop_result ();
+}
diff --git a/tests/libecal/client/test-client-get-object-list.c b/tests/libecal/client/test-client-get-object-list.c
new file mode 100644
index 0000000..001136e
--- /dev/null
+++ b/tests/libecal/client/test-client-get-object-list.c
@@ -0,0 +1,210 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libecal/e-cal-client.h>
+#include <libical/ical.h>
+
+#include "client-test-utils.h"
+
+#define EVENT_SUMMARY "Creation of new test event"
+#define EVENT_QUERY "(contains? \"summary\" \"" EVENT_SUMMARY "\")"
+
+static gboolean
+test_result (icalcomponent *icalcomp)
+{
+	g_return_val_if_fail (icalcomp != NULL, FALSE);
+	g_return_val_if_fail (g_strcmp0 (icalcomponent_get_summary (icalcomp), EVENT_SUMMARY) == 0, FALSE);
+
+	return TRUE;
+}
+
+static gboolean
+test_sync (ECalClient *cal_client)
+{
+	GError *error = NULL;
+	GSList *icalcomps = NULL, *ecalcomps = NULL;
+	gboolean res = TRUE;
+
+	if (!e_cal_client_get_object_list_sync (cal_client, EVENT_QUERY, &icalcomps, NULL, &error)) {
+		report_error ("get object list sync", &error);
+		return FALSE;
+	}
+
+	if (g_slist_length (icalcomps) != 1) {
+		g_printerr ("Failure: expected 1 item returned in icalcomps, got %d\n", g_slist_length (icalcomps));
+		res = FALSE;
+	} else {
+		res = res && test_result (icalcomps->data);
+	}
+
+	e_cal_client_free_icalcomp_slist (icalcomps);
+
+	if (!e_cal_client_get_object_list_as_comps_sync (cal_client, EVENT_QUERY, &ecalcomps, NULL, &error)) {
+		report_error ("get object list as comps sync", &error);
+		return FALSE;
+	}
+
+	if (g_slist_length (ecalcomps) != 1) {
+		g_printerr ("Failure: expected 1 item returned in ecalcomps, got %d\n", g_slist_length (ecalcomps));
+		res = FALSE;
+	} else {
+		res = res && test_result (e_cal_component_get_icalcomponent (ecalcomps->data));
+	}
+
+	e_cal_client_free_ecalcomp_slist (ecalcomps);
+
+	return res;
+}
+
+/* asynchronous callback with a main-loop running */
+static void
+async_get_object_list_as_comps_result_ready (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+	GSList *ecalcomps = NULL;
+	gboolean res = TRUE;
+
+	cal_client = E_CAL_CLIENT (source_object);
+
+	if (!e_cal_client_get_object_list_as_comps_finish (cal_client, result, &ecalcomps, &error)) {
+		report_error ("get object list as comps finish", &error);
+		stop_main_loop (1);
+		return;
+	}
+
+	if (g_slist_length (ecalcomps) != 1) {
+		g_printerr ("Failure: expected 1 item returned in ecalcomps, got %d\n", g_slist_length (ecalcomps));
+		res = FALSE;
+	} else {
+		res = res && test_result (e_cal_component_get_icalcomponent (ecalcomps->data));
+	}
+
+	e_cal_client_free_ecalcomp_slist (ecalcomps);
+	stop_main_loop (res ? 0 : 1);
+}
+
+/* asynchronous callback with a main-loop running */
+static void
+async_get_object_list_result_ready (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+	GSList *icalcomps = NULL;
+
+	cal_client = E_CAL_CLIENT (source_object);
+
+	if (!e_cal_client_get_object_list_finish (cal_client, result, &icalcomps, &error)) {
+		report_error ("get object list finish", &error);
+		stop_main_loop (1);
+		return;
+	}
+
+	if (g_slist_length (icalcomps) != 1) {
+		g_printerr ("Failure: expected 1 item returned in icalcomps, got %d\n", g_slist_length (icalcomps));
+	} else {
+		test_result (icalcomps->data);
+	}
+
+	e_cal_client_free_icalcomp_slist (icalcomps);
+
+	if (!e_cal_client_get_object_list_as_comps (cal_client, EVENT_QUERY, NULL, async_get_object_list_as_comps_result_ready, NULL)) {
+		report_error ("get object list as comps", NULL);
+		stop_main_loop (1);
+	}
+}
+
+/* synchronously in idle with main-loop running */
+static gboolean
+test_sync_in_idle (gpointer user_data)
+{
+	ECalClient *cal_client = user_data;
+
+	g_return_val_if_fail (cal_client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (cal_client), FALSE);
+
+	if (!test_sync (cal_client)) {
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	if (!e_cal_client_get_object_list (cal_client, EVENT_QUERY, NULL, async_get_object_list_result_ready, NULL)) {
+		report_error ("get object list", NULL);
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	return FALSE;
+}
+
+/* synchronously in a dedicated thread with main-loop running */
+static gpointer
+test_sync_in_thread (gpointer user_data)
+{
+	if (!test_sync (user_data)) {
+		stop_main_loop (1);
+		return NULL;
+	}
+
+	g_idle_add (test_sync_in_idle, user_data);
+
+	return NULL;
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+	icalcomponent *icalcomp;
+	struct icaltimetype now;
+	gchar *uid = NULL;
+
+	main_initialize ();
+
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	g_return_val_if_fail (cal_client != NULL, FALSE);
+
+	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (cal_client);
+		return 1;
+	}
+
+	now = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
+	icalcomp = icalcomponent_new (ICAL_VEVENT_COMPONENT);
+	icalcomponent_set_summary (icalcomp, EVENT_SUMMARY);
+	icalcomponent_set_dtstart (icalcomp, now);
+	icalcomponent_set_dtend   (icalcomp, icaltime_from_timet (icaltime_as_timet (now) + 60 * 60 * 60, 0));
+
+	if (!e_cal_client_create_object_sync (cal_client, icalcomp, &uid, NULL, &error)) {
+		report_error ("create object sync", &error);
+		g_object_unref (cal_client);
+		icalcomponent_free (icalcomp);
+		return 1;
+	}
+
+	icalcomponent_free (icalcomp);
+	g_free (uid);
+
+	/* synchronously without main-loop */
+	if (!test_sync (cal_client)) {
+		g_object_unref (cal_client);
+		return 1;
+	}
+
+	start_in_thread_with_main_loop (test_sync_in_thread, cal_client);
+
+	if (!e_client_remove_sync (E_CLIENT (cal_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (cal_client);
+		return 1;
+	}
+
+	g_object_unref (cal_client);
+
+	if (get_main_loop_stop_result () == 0)
+		g_print ("Test finished successfully.\n");
+
+	return get_main_loop_stop_result ();
+}
diff --git a/tests/libecal/client/test-client-get-view.c b/tests/libecal/client/test-client-get-view.c
new file mode 100644
index 0000000..7c42a67
--- /dev/null
+++ b/tests/libecal/client/test-client-get-view.c
@@ -0,0 +1,227 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libecal/e-cal-client.h>
+#include <libical/ical.h>
+
+#include "client-test-utils.h"
+
+typedef enum {
+	SUBTEST_OBJECTS_ADDED,
+	SUBTEST_OBJECTS_MODIFIED,
+	SUBTEST_OBJECTS_REMOVED,
+	SUBTEST_VIEW_DONE,
+	NUM_SUBTESTS,
+	SUBTEST_RESET
+} SubTestId;
+
+static void
+subtest_passed (SubTestId id)
+{
+	static guint subtests_complete = 0;
+
+	if (id == SUBTEST_RESET) {
+		subtests_complete = 0;
+		return;
+	}
+
+	subtests_complete |= (1 << id);
+
+	if (subtests_complete == ((1 << NUM_SUBTESTS) - 1))
+		stop_main_loop (0);
+}
+
+static void
+objects_added_cb (GObject *object, GList *objects, gpointer data)
+{
+	GList *l;
+
+	for (l = objects; l; l = l->next)
+                g_print ("Object added %s (%s)\n", icalcomponent_get_uid (l->data), icalcomponent_get_summary (l->data));
+
+	subtest_passed (SUBTEST_OBJECTS_ADDED);
+}
+
+static void
+objects_modified_cb (GObject *object, GList *objects, gpointer data)
+{
+	GList *l;
+
+	for (l = objects; l; l = l->next)
+                g_print ("Object modified %s (%s)\n", icalcomponent_get_uid (l->data), icalcomponent_get_summary (l->data));
+
+	subtest_passed (SUBTEST_OBJECTS_MODIFIED);
+}
+
+static void
+objects_removed_cb (GObject *object, GList *objects, gpointer data)
+{
+	GList *l;
+
+	for (l = objects; l; l = l->next) {
+		ECalComponentId *id = l->data;
+
+                g_print ("Object removed: uid: %s, rid: %s\n", id->uid, id->rid);
+	}
+
+	subtest_passed (SUBTEST_OBJECTS_REMOVED);
+}
+
+static void
+view_complete_cb (GObject *object, ECalendarStatus status, const gchar *error_msg, gpointer data)
+{
+        g_print ("View complete (status: %d, error_msg:%s)\n", status, error_msg ? error_msg : "NULL");
+
+	subtest_passed (SUBTEST_VIEW_DONE);
+}
+
+static gpointer
+alter_cal_client (gpointer user_data)
+{
+	ECalClient *cal_client = user_data;
+	GError *error = NULL;
+	icalcomponent *icalcomp;
+	struct icaltimetype now;
+	gchar *uid = NULL;
+
+	g_return_val_if_fail (cal_client != NULL, NULL);
+
+	now = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
+	icalcomp = icalcomponent_new (ICAL_VEVENT_COMPONENT);
+	icalcomponent_set_summary (icalcomp, "Initial event summary");
+	icalcomponent_set_dtstart (icalcomp, now);
+	icalcomponent_set_dtend   (icalcomp, icaltime_from_timet (icaltime_as_timet (now) + 60 * 60 * 60, 0));
+
+	if (!e_cal_client_create_object_sync (cal_client, icalcomp, &uid, NULL, &error)) {
+		report_error ("create object sync", &error);
+		icalcomponent_free (icalcomp);
+		stop_main_loop (1);
+		return NULL;
+	}
+
+	icalcomponent_set_uid (icalcomp, uid);
+	icalcomponent_set_summary (icalcomp, "Modified event summary");
+
+	if (!e_cal_client_modify_object_sync (cal_client, icalcomp, CALOBJ_MOD_ALL, NULL, &error)) {
+		report_error ("modify object sync", &error);
+		icalcomponent_free (icalcomp);
+		g_free (uid);
+		stop_main_loop (1);
+		return NULL;
+	}
+
+	if (!e_cal_client_remove_object_sync (cal_client, uid, NULL, CALOBJ_MOD_ALL, NULL, &error)) {
+		report_error ("remove object sync", &error);
+		icalcomponent_free (icalcomp);
+		g_free (uid);
+		stop_main_loop (1);
+		return NULL;
+	}
+
+	g_free (uid);
+	icalcomponent_free (icalcomp);
+
+	return NULL;
+}
+
+static void
+async_get_view_ready (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	ECalClient *cal_client = E_CAL_CLIENT (source_object);
+	ECalView *view = NULL;
+	GError *error = NULL;
+
+	g_return_if_fail (cal_client != NULL);
+
+	if (!e_cal_client_get_view_finish (cal_client, result, &view, &error)) {
+		report_error ("get view finish", &error);
+		stop_main_loop (1);
+		return;
+	}
+
+	subtest_passed (SUBTEST_RESET);
+	g_signal_connect (view, "objects_added", G_CALLBACK (objects_added_cb), cal_client);
+	g_signal_connect (view, "objects_modified", G_CALLBACK (objects_modified_cb), cal_client);
+	g_signal_connect (view, "objects_removed", G_CALLBACK (objects_removed_cb), cal_client);
+	g_signal_connect (view, "view_complete", G_CALLBACK (view_complete_cb), cal_client);
+
+	g_object_set_data_full (G_OBJECT (cal_client), "cal-view", view, g_object_unref);
+
+	e_cal_view_start (view);
+
+	alter_cal_client (cal_client);
+}
+
+static gpointer
+get_view_async (gpointer user_data)
+{
+	ECalClient *cal_client = user_data;
+
+	g_return_val_if_fail (user_data != NULL, NULL);
+
+	if (!e_cal_client_get_view (cal_client, "(contains? \"any\" \"event\")", NULL, async_get_view_ready, NULL)) {
+		report_error ("get view", NULL);
+		stop_main_loop (1);
+	}
+
+	return NULL;
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	ECalView *view = NULL;
+	ECalClient *cal_client;
+	GError *error = NULL;
+
+	main_initialize ();
+
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	g_return_val_if_fail (cal_client != NULL, FALSE);
+
+	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (cal_client);
+		return 1;
+	}
+
+	if (!e_cal_client_get_view_sync (cal_client, "(contains? \"any\" \"event\")", &view, NULL, &error)) {
+		report_error ("get view sync", &error);
+		g_object_unref (cal_client);
+		return 1;
+	}
+
+	subtest_passed (SUBTEST_RESET);
+	g_signal_connect (view, "objects_added", G_CALLBACK (objects_added_cb), cal_client);
+	g_signal_connect (view, "objects_modified", G_CALLBACK (objects_modified_cb), cal_client);
+	g_signal_connect (view, "objects_removed", G_CALLBACK (objects_removed_cb), cal_client);
+	g_signal_connect (view, "view_complete", G_CALLBACK (view_complete_cb), cal_client);
+
+	e_cal_view_start (view);
+
+	start_in_thread_with_main_loop (alter_cal_client, cal_client);
+
+	g_object_unref (view);
+
+	if (get_main_loop_stop_result () != 0) {
+		g_object_unref (cal_client);
+		return get_main_loop_stop_result ();
+	}
+
+	start_in_idle_with_main_loop (get_view_async, cal_client);
+
+	g_object_set_data (G_OBJECT (cal_client), "cal-view", NULL);
+
+	if (!e_client_remove_sync (E_CLIENT (cal_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (cal_client);
+		return 1;
+	}
+
+	g_object_unref (cal_client);
+
+	if (get_main_loop_stop_result () == 0)
+		g_print ("Test finished successfully.\n");
+
+	return get_main_loop_stop_result ();
+}
diff --git a/tests/libecal/client/test-client-modify-object.c b/tests/libecal/client/test-client-modify-object.c
new file mode 100644
index 0000000..8ca9393
--- /dev/null
+++ b/tests/libecal/client/test-client-modify-object.c
@@ -0,0 +1,199 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libecal/e-cal-client.h>
+#include <libical/ical.h>
+
+#include "client-test-utils.h"
+
+#define EVENT_SUMMARY "Creation of new test event"
+
+static gboolean
+test_result (icalcomponent *icalcomp)
+{
+	g_return_val_if_fail (icalcomp != NULL, FALSE);
+	g_return_val_if_fail (g_strcmp0 (icalcomponent_get_summary (icalcomp), EVENT_SUMMARY) == 0, FALSE);
+
+	return TRUE;
+}
+
+static gboolean
+test_sync (ECalClient *cal_client)
+{
+	GError *error = NULL;
+	icalcomponent *icalcomp = NULL;
+	const gchar *uid = g_object_get_data (G_OBJECT (cal_client), "use-uid");
+
+	g_return_val_if_fail (uid != NULL, FALSE);
+
+	if (!e_cal_client_get_object_sync (cal_client, uid, NULL, &icalcomp, NULL, &error)) {
+		report_error ("get object sync", &error);
+		return FALSE;
+	}
+
+	icalcomponent_set_summary (icalcomp, EVENT_SUMMARY);
+
+	if (!e_cal_client_modify_object_sync (cal_client, icalcomp, CALOBJ_MOD_ALL, NULL, &error)) {
+		report_error ("modify object sync", &error);
+		icalcomponent_free (icalcomp);
+		return FALSE;
+	}
+
+	icalcomponent_free (icalcomp);
+
+	if (!e_cal_client_get_object_sync (cal_client, uid, NULL, &icalcomp, NULL, &error)) {
+		report_error ("get object sync after modification", &error);
+		return FALSE;
+	}
+
+	if (!test_result (icalcomp)) {
+		icalcomponent_free (icalcomp);
+		return FALSE;
+	}
+
+	icalcomponent_free (icalcomp);
+
+	return TRUE;
+}
+
+/* asynchronous callback with a main-loop running */
+static void
+async_modify_result_ready (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+	icalcomponent *icalcomp = NULL;
+	const gchar *uid;
+
+	cal_client = E_CAL_CLIENT (source_object);
+	uid = g_object_get_data (G_OBJECT (cal_client), "use-uid");
+
+	if (!e_cal_client_modify_object_finish (cal_client, result, &error)) {
+		report_error ("modify object finish", &error);
+		stop_main_loop (1);
+		return;
+	}
+
+	if (!e_cal_client_get_object_sync (cal_client, uid, NULL, &icalcomp, NULL, &error)) {
+		report_error ("get object sync after async modification", &error);
+		return;
+	}
+
+	if (!test_result (icalcomp)) {
+		stop_main_loop (1);
+	} else {
+		stop_main_loop (0);
+	}
+
+	icalcomponent_free (icalcomp);
+}
+
+/* synchronously in idle with main-loop running */
+static gboolean
+test_sync_in_idle (gpointer user_data)
+{
+	ECalClient *cal_client = user_data;
+	const gchar *uid = g_object_get_data (G_OBJECT (cal_client), "use-uid");
+	icalcomponent *icalcomp = NULL;
+	GError *error = NULL;
+
+	g_return_val_if_fail (cal_client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (cal_client), FALSE);
+
+	if (!test_sync (cal_client)) {
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	if (!e_cal_client_get_object_sync (cal_client, uid, NULL, &icalcomp, NULL, &error)) {
+		report_error ("get object sync", &error);
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	icalcomponent_set_summary (icalcomp, EVENT_SUMMARY);
+
+	if (!e_cal_client_modify_object (cal_client, icalcomp, CALOBJ_MOD_ALL, NULL, async_modify_result_ready, NULL)) {
+		report_error ("modify object", &error);
+		icalcomponent_free (icalcomp);
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	icalcomponent_free (icalcomp);
+
+	return FALSE;
+}
+
+/* synchronously in a dedicated thread with main-loop running */
+static gpointer
+test_sync_in_thread (gpointer user_data)
+{
+	if (!test_sync (user_data)) {
+		stop_main_loop (1);
+		return NULL;
+	}
+
+	g_idle_add (test_sync_in_idle, user_data);
+
+	return NULL;
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+	icalcomponent *icalcomp;
+	struct icaltimetype now;
+	gchar *uid = NULL;
+
+	main_initialize ();
+
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	g_return_val_if_fail (cal_client != NULL, FALSE);
+
+	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (cal_client);
+		return 1;
+	}
+
+	now = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
+	icalcomp = icalcomponent_new (ICAL_VEVENT_COMPONENT);
+	icalcomponent_set_summary (icalcomp, "Initial" EVENT_SUMMARY);
+	icalcomponent_set_dtstart (icalcomp, now);
+	icalcomponent_set_dtend   (icalcomp, icaltime_from_timet (icaltime_as_timet (now) + 60 * 60 * 60, 0));
+
+	if (!e_cal_client_create_object_sync (cal_client, icalcomp, &uid, NULL, &error)) {
+		report_error ("create object sync", &error);
+		g_object_unref (cal_client);
+		icalcomponent_free (icalcomp);
+		return 1;
+	}
+
+	icalcomponent_free (icalcomp);
+
+	g_object_set_data_full (G_OBJECT (cal_client), "use-uid", uid, g_free);
+
+	/* synchronously without main-loop */
+	if (!test_sync (cal_client)) {
+		g_object_unref (cal_client);
+		return 1;
+	}
+
+	start_in_thread_with_main_loop (test_sync_in_thread, cal_client);
+
+	if (!e_client_remove_sync (E_CLIENT (cal_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (cal_client);
+		return 1;
+	}
+
+	g_object_unref (cal_client);
+
+	if (get_main_loop_stop_result () == 0)
+		g_print ("Test finished successfully.\n");
+
+	return get_main_loop_stop_result ();
+}
diff --git a/tests/libecal/client/test-client-open.c b/tests/libecal/client/test-client-open.c
new file mode 100644
index 0000000..e1c6afb
--- /dev/null
+++ b/tests/libecal/client/test-client-open.c
@@ -0,0 +1,134 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libecal/e-cal-client.h>
+#include <libical/ical.h>
+
+#include "client-test-utils.h"
+
+static gboolean
+test_sync (void)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	g_return_val_if_fail (cal_client != NULL, FALSE);
+
+	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (cal_client);
+		return FALSE;
+	}
+
+	if (!e_client_remove_sync (E_CLIENT (cal_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (cal_client);
+		return FALSE;
+	}
+
+	g_object_unref (cal_client);
+
+	return TRUE;
+}
+
+/* asynchronous remove callback with a main-loop running */
+static void
+async_remove_ready (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+
+	cal_client = E_CAL_CLIENT (source_object);
+
+	if (!e_client_remove_finish (E_CLIENT (cal_client), result, &error)) {
+		report_error ("remove finish", &error);
+		g_object_unref (cal_client);
+		stop_main_loop (1);
+		return;
+	}
+
+	g_object_unref (cal_client);
+
+	stop_main_loop (0);
+}
+
+/* asynchronous open callback with a main-loop running */
+static void
+async_open_ready (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+
+	cal_client = E_CAL_CLIENT (source_object);
+
+	if (!e_client_open_finish (E_CLIENT (cal_client), result, &error)) {
+		report_error ("open finish", &error);
+		g_object_unref (cal_client);
+		stop_main_loop (1);
+		return;
+	}
+
+	if (!e_client_remove (E_CLIENT (cal_client), NULL, async_remove_ready, NULL)) {
+		report_error ("client remove", NULL);
+		g_object_unref (cal_client);
+		stop_main_loop (1);
+		return;
+	}
+}
+
+/* synchronously in idle with main-loop running */
+static gboolean
+test_sync_in_idle (gpointer user_data)
+{
+	ECalClient *cal_client;
+
+	if (!test_sync ()) {
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	g_return_val_if_fail (cal_client != NULL, FALSE);
+
+	if (!e_client_open (E_CLIENT (cal_client), FALSE, NULL, async_open_ready, NULL)) {
+		report_error ("client open", NULL);
+		g_object_unref (cal_client);
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	return FALSE;
+}
+
+/* synchronously in a dedicated thread with main-loop running */
+static gpointer
+test_sync_in_thread (gpointer user_data)
+{
+	if (!test_sync ()) {
+		stop_main_loop (1);
+		return NULL;
+	}
+
+	g_idle_add (test_sync_in_idle, NULL);
+
+	return NULL;
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	main_initialize ();
+
+	/* synchronously without main-loop */
+	if (!test_sync ()) {
+		return 1;
+	}
+
+	start_in_thread_with_main_loop (test_sync_in_thread, NULL);
+
+	if (get_main_loop_stop_result () == 0)
+		g_print ("Test finished successfully.\n");
+
+	return get_main_loop_stop_result ();
+}
diff --git a/tests/libecal/client/test-client-receive-objects.c b/tests/libecal/client/test-client-receive-objects.c
new file mode 100644
index 0000000..6f2f5f5
--- /dev/null
+++ b/tests/libecal/client/test-client-receive-objects.c
@@ -0,0 +1,148 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libecal/e-cal-client.h>
+#include <libical/ical.h>
+
+#include "client-test-utils.h"
+
+static icalcomponent *
+create_object (void)
+{
+	icalcomponent *icalcomp;
+	struct icaltimetype now;
+
+	now = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
+	icalcomp = icalcomponent_new (ICAL_VEVENT_COMPONENT);
+	icalcomponent_set_summary (icalcomp, "To-be-received event summary");
+	icalcomponent_set_dtstart (icalcomp, now);
+	icalcomponent_set_dtend   (icalcomp, icaltime_from_timet (icaltime_as_timet (now) + 60 * 60 * 60, 0));
+
+	return icalcomp;
+}
+
+static gboolean
+test_sync (ECalClient *cal_client)
+{
+	GError *error = NULL;
+	icalcomponent *icalcomp;
+
+	icalcomp = create_object ();
+
+	g_return_val_if_fail (icalcomp != NULL, FALSE);
+
+	if (!e_cal_client_receive_objects_sync (cal_client, icalcomp, NULL, &error)) {
+		report_error ("receive objects sync", &error);
+		icalcomponent_free (icalcomp);
+		return FALSE;
+	}
+
+	icalcomponent_free (icalcomp);
+
+	return TRUE;
+}
+
+/* asynchronous callback with a main-loop running */
+static void
+async_receive_result_ready (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+
+	cal_client = E_CAL_CLIENT (source_object);
+
+	if (!e_cal_client_receive_objects_finish (cal_client, result, &error)) {
+		report_error ("receive objects finish", &error);
+		stop_main_loop (1);
+		return;
+	}
+
+	stop_main_loop (0);
+}
+
+/* synchronously in idle with main-loop running */
+static gboolean
+test_sync_in_idle (gpointer user_data)
+{
+	ECalClient *cal_client = user_data;
+	GError *error = NULL;
+	icalcomponent *icalcomp;
+
+	g_return_val_if_fail (cal_client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (cal_client), FALSE);
+
+	if (!test_sync (cal_client)) {
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	icalcomp = create_object ();
+	if (!icalcomp) {
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	if (!e_cal_client_receive_objects (cal_client, icalcomp, NULL, async_receive_result_ready, NULL)) {
+		report_error ("receive objects", &error);
+		icalcomponent_free (icalcomp);
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	icalcomponent_free (icalcomp);
+
+	return FALSE;
+}
+
+/* synchronously in a dedicated thread with main-loop running */
+static gpointer
+test_sync_in_thread (gpointer user_data)
+{
+	if (!test_sync (user_data)) {
+		stop_main_loop (1);
+		return NULL;
+	}
+
+	g_idle_add (test_sync_in_idle, user_data);
+
+	return NULL;
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+
+	main_initialize ();
+
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	g_return_val_if_fail (cal_client != NULL, FALSE);
+
+	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (cal_client);
+		return 1;
+	}
+
+	/* synchronously without main-loop */
+	if (!test_sync (cal_client)) {
+		g_object_unref (cal_client);
+		return 1;
+	}
+
+	start_in_thread_with_main_loop (test_sync_in_thread, cal_client);
+
+	if (!e_client_remove_sync (E_CLIENT (cal_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (cal_client);
+		return 1;
+	}
+
+	g_object_unref (cal_client);
+
+	if (get_main_loop_stop_result () == 0)
+		g_print ("Test finished successfully.\n");
+
+	return get_main_loop_stop_result ();
+}
diff --git a/tests/libecal/client/test-client-refresh.c b/tests/libecal/client/test-client-refresh.c
new file mode 100644
index 0000000..1f44474
--- /dev/null
+++ b/tests/libecal/client/test-client-refresh.c
@@ -0,0 +1,135 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <string.h>
+#include <libecal/e-cal-client.h>
+#include <libical/ical.h>
+
+#include "client-test-utils.h"
+
+static gboolean
+test_sync (ECalClient *cal_client)
+{
+	GError *error = NULL;
+
+	if (!e_cal_client_refresh_sync (cal_client, NULL, &error)) {
+		report_error ("refresh sync", &error);
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+/* asynchronous callback with a main-loop running */
+static void
+async_refresh_result_ready (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+
+	cal_client = E_CAL_CLIENT (source_object);
+
+	if (!e_cal_client_refresh_finish (cal_client, result, &error)) {
+		report_error ("refresh finish", &error);
+		stop_main_loop (1);
+		return;
+	}
+
+	stop_main_loop (0);
+}
+
+/* synchronously in idle with main-loop running */
+static gboolean
+test_sync_in_idle (gpointer user_data)
+{
+	ECalClient *cal_client = user_data;
+	GError *error = NULL;
+
+	g_return_val_if_fail (cal_client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (cal_client), FALSE);
+
+	if (!test_sync (cal_client)) {
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	if (!e_cal_client_refresh (cal_client, NULL, async_refresh_result_ready, NULL)) {
+		report_error ("refresh", &error);
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	return FALSE;
+}
+
+/* synchronously in a dedicated thread with main-loop running */
+static gpointer
+test_sync_in_thread (gpointer user_data)
+{
+	if (!test_sync (user_data)) {
+		stop_main_loop (1);
+		return NULL;
+	}
+
+	g_idle_add (test_sync_in_idle, user_data);
+
+	return NULL;
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+	icalcomponent *icalcomp;
+	struct icaltimetype now;
+	gchar *uid = NULL;
+
+	main_initialize ();
+
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	g_return_val_if_fail (cal_client != NULL, FALSE);
+
+	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (cal_client);
+		return 1;
+	}
+
+	now = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
+	icalcomp = icalcomponent_new (ICAL_VEVENT_COMPONENT);
+	icalcomponent_set_summary (icalcomp, "Test event summary");
+	icalcomponent_set_dtstart (icalcomp, now);
+	icalcomponent_set_dtend   (icalcomp, icaltime_from_timet (icaltime_as_timet (now) + 60 * 60 * 60, 0));
+
+	if (!e_cal_client_create_object_sync (cal_client, icalcomp, &uid, NULL, &error)) {
+		report_error ("create object sync", &error);
+		icalcomponent_free (icalcomp);
+		g_object_unref (cal_client);
+		return 1;
+	}
+
+	icalcomponent_free (icalcomp);
+	g_free (uid);
+
+	/* synchronously without main-loop */
+	if (!test_sync (cal_client)) {
+		g_object_unref (cal_client);
+		return 1;
+	}
+
+	start_in_thread_with_main_loop (test_sync_in_thread, cal_client);
+
+	if (!e_client_remove_sync (E_CLIENT (cal_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (cal_client);
+		return 1;
+	}
+
+	g_object_unref (cal_client);
+
+	if (get_main_loop_stop_result () == 0)
+		g_print ("Test finished successfully.\n");
+
+	return get_main_loop_stop_result ();
+}
diff --git a/tests/libecal/client/test-client-remove-object.c b/tests/libecal/client/test-client-remove-object.c
new file mode 100644
index 0000000..e83f474
--- /dev/null
+++ b/tests/libecal/client/test-client-remove-object.c
@@ -0,0 +1,162 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libecal/e-cal-client.h>
+#include <libical/ical.h>
+
+#include "client-test-utils.h"
+
+static gchar *
+create_object (ECalClient *cal_client)
+{
+	icalcomponent *icalcomp;
+	struct icaltimetype now;
+	gchar *uid = NULL;
+	GError *error = NULL;
+
+	g_return_val_if_fail (cal_client != NULL, NULL);
+
+	now = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
+	icalcomp = icalcomponent_new (ICAL_VEVENT_COMPONENT);
+	icalcomponent_set_summary (icalcomp, "To-be-removed event summary");
+	icalcomponent_set_dtstart (icalcomp, now);
+	icalcomponent_set_dtend   (icalcomp, icaltime_from_timet (icaltime_as_timet (now) + 60 * 60 * 60, 0));
+
+	if (!e_cal_client_create_object_sync (cal_client, icalcomp, &uid, NULL, &error)) {
+		report_error ("create object sync", &error);
+		icalcomponent_free (icalcomp);
+		return NULL;
+	}
+
+	icalcomponent_free (icalcomp);
+
+	g_return_val_if_fail (uid != NULL, NULL);
+
+	return uid;
+}
+
+static gboolean
+test_sync (ECalClient *cal_client)
+{
+	GError *error = NULL;
+	gchar *uid;
+
+	uid = create_object (cal_client);
+
+	g_return_val_if_fail (uid != NULL, FALSE);
+
+	if (!e_cal_client_remove_object_sync (cal_client, uid, NULL, CALOBJ_MOD_ALL, NULL, &error)) {
+		report_error ("remove object sync", &error);
+		g_free (uid);
+		return FALSE;
+	}
+
+	g_free (uid);
+
+	return TRUE;
+}
+
+/* asynchronous callback with a main-loop running */
+static void
+async_remove_result_ready (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+
+	cal_client = E_CAL_CLIENT (source_object);
+
+	if (!e_cal_client_remove_object_finish (cal_client, result, &error)) {
+		report_error ("remove object finish", &error);
+		stop_main_loop (1);
+		return;
+	}
+
+	stop_main_loop (0);
+}
+
+/* synchronously in idle with main-loop running */
+static gboolean
+test_sync_in_idle (gpointer user_data)
+{
+	ECalClient *cal_client = user_data;
+	GError *error = NULL;
+	gchar *uid;
+
+	g_return_val_if_fail (cal_client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (cal_client), FALSE);
+
+	if (!test_sync (cal_client)) {
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	uid = create_object (cal_client);
+	if (!uid) {
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	if (!e_cal_client_remove_object (cal_client, uid, NULL, CALOBJ_MOD_ALL, NULL, async_remove_result_ready, NULL)) {
+		report_error ("remove object", &error);
+		g_free (uid);
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	g_free (uid);
+
+	return FALSE;
+}
+
+/* synchronously in a dedicated thread with main-loop running */
+static gpointer
+test_sync_in_thread (gpointer user_data)
+{
+	if (!test_sync (user_data)) {
+		stop_main_loop (1);
+		return NULL;
+	}
+
+	g_idle_add (test_sync_in_idle, user_data);
+
+	return NULL;
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+
+	main_initialize ();
+
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	g_return_val_if_fail (cal_client != NULL, FALSE);
+
+	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (cal_client);
+		return 1;
+	}
+
+	/* synchronously without main-loop */
+	if (!test_sync (cal_client)) {
+		g_object_unref (cal_client);
+		return 1;
+	}
+
+	start_in_thread_with_main_loop (test_sync_in_thread, cal_client);
+
+	if (!e_client_remove_sync (E_CLIENT (cal_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (cal_client);
+		return 1;
+	}
+
+	g_object_unref (cal_client);
+
+	if (get_main_loop_stop_result () == 0)
+		g_print ("Test finished successfully.\n");
+
+	return get_main_loop_stop_result ();
+}
diff --git a/tests/libecal/client/test-client-send-objects.c b/tests/libecal/client/test-client-send-objects.c
new file mode 100644
index 0000000..12332ce
--- /dev/null
+++ b/tests/libecal/client/test-client-send-objects.c
@@ -0,0 +1,175 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libecal/e-cal-client.h>
+#include <libical/ical.h>
+
+#include "client-test-utils.h"
+
+static icalcomponent *
+create_object (void)
+{
+	icalcomponent *icalcomp;
+	struct icaltimetype now;
+
+	now = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
+	icalcomp = icalcomponent_new (ICAL_VEVENT_COMPONENT);
+	icalcomponent_set_summary (icalcomp, "To-be-sent event summary");
+	icalcomponent_set_dtstart (icalcomp, now);
+	icalcomponent_set_dtend   (icalcomp, icaltime_from_timet (icaltime_as_timet (now) + 60 * 60 * 60, 0));
+
+	return icalcomp;
+}
+
+static gboolean
+manage_result (GSList *users, icalcomponent *modified_icalcomp)
+{
+	g_print ("Wishes to send to %d users", g_slist_length (users));
+	if (users) {
+		GSList *u;
+
+		g_print (": ");
+
+		for (u = users; u; u = u->next)
+			g_print ("%s%s", u == users ? "" : ", ", (const gchar *) u->data);
+	}
+	g_print ("\n");
+
+	if (!modified_icalcomp)
+		g_print ("No modified icalcomp, would send the same\n");
+	else
+		print_icomp (modified_icalcomp);
+
+	e_client_util_free_string_slist (users);
+	if (modified_icalcomp)
+		icalcomponent_free (modified_icalcomp);
+
+	return TRUE;
+}
+
+static gboolean
+test_sync (ECalClient *cal_client)
+{
+	GError *error = NULL;
+	icalcomponent *icalcomp, *modified_icalcomp = NULL;
+	GSList *users = NULL;
+
+	icalcomp = create_object ();
+
+	if (!e_cal_client_send_objects_sync (cal_client, icalcomp, &users, &modified_icalcomp, NULL, &error)) {
+		report_error ("send objects sync", &error);
+		icalcomponent_free (icalcomp);
+		return FALSE;
+	}
+
+	icalcomponent_free (icalcomp);
+
+	return manage_result (users, modified_icalcomp);
+}
+
+/* asynchronous callback with a main-loop running */
+static void
+async_send_result_ready (GObject *source_object, GAsyncResult *result, gpointer user_data)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+	GSList *users = NULL;
+	icalcomponent *modified_icalcomp = NULL;
+
+	cal_client = E_CAL_CLIENT (source_object);
+
+	if (!e_cal_client_send_objects_finish (cal_client, result, &users, &modified_icalcomp, &error)) {
+		report_error ("send objects finish", &error);
+		stop_main_loop (1);
+		return;
+	}
+
+	stop_main_loop (manage_result (users, modified_icalcomp) ? 0 : 1);
+}
+
+/* synchronously in idle with main-loop running */
+static gboolean
+test_sync_in_idle (gpointer user_data)
+{
+	ECalClient *cal_client = user_data;
+	GError *error = NULL;
+	icalcomponent *icalcomp;
+
+	g_return_val_if_fail (cal_client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (cal_client), FALSE);
+
+	if (!test_sync (cal_client)) {
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	icalcomp = create_object ();
+	if (!icalcomp) {
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	if (!e_cal_client_send_objects (cal_client, icalcomp, NULL, async_send_result_ready, NULL)) {
+		report_error ("send objects", &error);
+		icalcomponent_free (icalcomp);
+		stop_main_loop (1);
+		return FALSE;
+	}
+
+	icalcomponent_free (icalcomp);
+
+	return FALSE;
+}
+
+/* synchronously in a dedicated thread with main-loop running */
+static gpointer
+test_sync_in_thread (gpointer user_data)
+{
+	if (!test_sync (user_data)) {
+		stop_main_loop (1);
+		return NULL;
+	}
+
+	g_idle_add (test_sync_in_idle, user_data);
+
+	return NULL;
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+
+	main_initialize ();
+
+	cal_client = new_temp_client (E_CAL_CLIENT_SOURCE_TYPE_EVENT, NULL);
+	g_return_val_if_fail (cal_client != NULL, FALSE);
+
+	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (cal_client);
+		return 1;
+	}
+
+	/* synchronously without main-loop */
+	if (!test_sync (cal_client)) {
+		g_object_unref (cal_client);
+		return 1;
+	}
+
+	start_in_thread_with_main_loop (test_sync_in_thread, cal_client);
+
+	if (!e_client_remove_sync (E_CLIENT (cal_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (cal_client);
+		return 1;
+	}
+
+	g_object_unref (cal_client);
+
+	if (get_main_loop_stop_result () == 0)
+		g_print ("Test finished successfully.\n");
+
+	return get_main_loop_stop_result ();
+}
diff --git a/tests/libecal/client/test-client-stress-factory--fifo.c b/tests/libecal/client/test-client-stress-factory--fifo.c
new file mode 100644
index 0000000..70858ac
--- /dev/null
+++ b/tests/libecal/client/test-client-stress-factory--fifo.c
@@ -0,0 +1,51 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libecal/e-cal-client.h>
+
+#include "client-test-utils.h"
+
+#define NUM_CLIENTS 200
+
+gint
+main (gint argc, gchar **argv)
+{
+	ECalClientSourceType source_type = E_CAL_CLIENT_SOURCE_TYPE_EVENT;
+	ECalClient *cal_clients[NUM_CLIENTS];
+	GError *error = NULL;
+	gint ii;
+
+	main_initialize ();
+
+	/* Create and open many cals; then remove each of them */
+
+	for (ii = 0; ii < NUM_CLIENTS; ii++) {
+		cal_clients[ii] = new_temp_client (source_type, NULL);
+		g_return_val_if_fail (cal_clients[ii] != NULL, 1);
+
+		if (!e_client_open_sync (E_CLIENT (cal_clients[ii]), FALSE, NULL, &error)) {
+			report_error ("client open sync", &error);
+			while (ii >= 0) {
+				g_object_unref (cal_clients[ii]);
+				ii--;
+			}
+
+			return 1;
+		}
+	}
+
+	for (ii = 0; ii < NUM_CLIENTS; ii++) {
+		if (!e_client_remove_sync (E_CLIENT (cal_clients[ii]), NULL, &error)) {
+			report_error ("client remove sync", &error);
+			while (ii < NUM_CLIENTS) {
+				g_object_unref (cal_clients[ii]);
+				ii++;
+			}
+			return 1;
+		}
+
+		g_object_unref (cal_clients[ii]);
+	}
+
+	return 0;
+}
diff --git a/tests/libecal/client/test-client-stress-factory--serial.c b/tests/libecal/client/test-client-stress-factory--serial.c
new file mode 100644
index 0000000..a3c665e
--- /dev/null
+++ b/tests/libecal/client/test-client-stress-factory--serial.c
@@ -0,0 +1,38 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <libecal/e-cal-client.h>
+
+#include "client-test-utils.h"
+
+#define NUM_CLIENTS 200
+
+gint
+main (gint argc, gchar **argv)
+{
+	ECalClientSourceType source_type = E_CAL_CLIENT_SOURCE_TYPE_EVENT;
+	GError *error = NULL;
+	gint ii;
+
+	main_initialize ();
+
+	/* Serially create, open, (close), and remove many cals */
+	for (ii = 0; ii < NUM_CLIENTS; ii++) {
+		ECalClient *cal_client = new_temp_client (source_type, NULL);
+		g_return_val_if_fail (cal_client != NULL, 1);
+
+		if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
+			report_error ("client open sync", &error);
+			return 1;
+		}
+
+		if (!e_client_remove_sync (E_CLIENT (cal_client), NULL, &error)) {
+			report_error ("client remove sync", &error);
+			g_object_unref (cal_client);
+			return 1;
+		}
+
+		g_object_unref (cal_client);
+	}
+
+	return 0;
+}
diff --git a/tests/libecal/client/test-client-stress-factory--single-cal.c b/tests/libecal/client/test-client-stress-factory--single-cal.c
new file mode 100644
index 0000000..3c43e63
--- /dev/null
+++ b/tests/libecal/client/test-client-stress-factory--single-cal.c
@@ -0,0 +1,63 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libecal/e-cal-client.h>
+
+#include "client-test-utils.h"
+
+#define NUM_OPENS 200
+
+gint
+main (gint argc, gchar **argv)
+{
+	ECalClientSourceType source_type = E_CAL_CLIENT_SOURCE_TYPE_EVENT;
+	gchar *uri = NULL;
+	ECalClient *cal_client;
+	GError *error = NULL;
+	gint ii;
+
+	main_initialize ();
+
+	cal_client = new_temp_client (source_type, &uri);
+	g_return_val_if_fail (cal_client != NULL, 1);
+	g_return_val_if_fail (uri != NULL, 1);
+
+	g_object_unref (cal_client);
+
+	/* open and close the same cal repeatedly */
+	for (ii = 0; ii < NUM_OPENS; ii++) {
+		cal_client = e_cal_client_new_from_uri (uri, source_type, &error);
+		if (!cal_client) {
+			report_error ("new from uri", &error);
+			break;
+		}
+
+		if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
+			report_error ("client open sync", &error);
+			g_object_unref (cal_client);
+			break;
+		}
+
+		g_object_unref (cal_client);
+	}
+
+	cal_client = e_cal_client_new_from_uri (uri, source_type, &error);
+	if (!cal_client) {
+		g_clear_error (&error);
+	} else if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
+		report_error ("client open sync", &error);
+		g_object_unref (cal_client);
+		g_free (uri);
+		return 1;
+	} else 	if (!e_client_remove_sync (E_CLIENT (cal_client), NULL, &error)) {
+		report_error ("client remove sync", &error);
+		g_object_unref (cal_client);
+		g_free (uri);
+		return 1;
+	}
+
+	g_free (uri);
+	g_object_unref (cal_client);
+
+	return ii == NUM_OPENS ? 0 : 1;
+}
diff --git a/tests/libecal/client/test-client-stress-views.c b/tests/libecal/client/test-client-stress-views.c
new file mode 100644
index 0000000..a347bda
--- /dev/null
+++ b/tests/libecal/client/test-client-stress-views.c
@@ -0,0 +1,116 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libecal/e-cal-client.h>
+
+#include "client-test-utils.h"
+
+#define NUM_VIEWS 200
+
+static void
+objects_added (ECalView *cal_view, const GList *objects)
+{
+	GList *l;
+
+	for (l = (GList*)objects; l; l = l->next) {
+		print_icomp (l->data);
+	}
+}
+
+static void
+objects_removed (ECalView *cal_view, const GList *ids)
+{
+	GList *l;
+
+	for (l = (GList*)ids; l; l = l->next) {
+		printf ("   Removed contact: %s\n", (gchar *)l->data);
+	}
+}
+
+static void
+view_complete (ECalView *cal_view, ECalendarStatus status, const gchar *error_msg)
+{
+	printf ("view_complete (status == %d, error_msg == %s%s%s)\n", status, error_msg ? "'" : "", error_msg ? error_msg : "NULL", error_msg ? "'" : "");
+}
+
+static gint
+stress_cal_views (ECalClient *cal_client, gboolean in_thread)
+{
+	ECalView *view = NULL;
+	ECalView *new_view;
+	gint i;
+
+	g_return_val_if_fail (cal_client != NULL, -1);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (cal_client), -1);
+
+	for (i = 0; i < NUM_VIEWS; i++) {
+		GError *error = NULL;
+
+		if (!e_cal_client_get_view_sync (cal_client, "#t", &new_view, NULL, &error)) {
+			report_error ("get cal view sync", &error);
+			g_object_unref (view);
+			return 1;
+		}
+
+		g_signal_connect (new_view, "objects_added", G_CALLBACK (objects_added), NULL);
+		g_signal_connect (new_view, "objects_removed", G_CALLBACK (objects_removed), NULL);
+		g_signal_connect (new_view, "view_complete", G_CALLBACK (view_complete), NULL);
+
+		e_cal_view_start (new_view);
+
+		if (view) {
+			/* wait 100 ms when in a thread */
+			if (in_thread)
+				g_usleep (100000);
+
+			e_cal_view_stop (view);
+			g_object_unref (view);
+		}
+
+		view = new_view;
+	}
+
+	e_cal_view_stop (view);
+	g_object_unref (view);
+
+	return 0;
+}
+
+static gpointer
+stress_cal_views_thread (gpointer user_data)
+{
+	stop_main_loop (stress_cal_views (user_data, TRUE));
+
+	return NULL;
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+	ECalClient *cal_client;
+	GError *error = NULL;
+
+	main_initialize ();
+
+	cal_client = e_cal_client_new_system (E_CAL_CLIENT_SOURCE_TYPE_EVENT, &error);
+	if (!cal_client) {
+		report_error ("create local calendar", &error);
+		return 1;
+	}
+
+	if (!e_client_open_sync (E_CLIENT (cal_client), FALSE, NULL, &error)) {
+		g_object_unref (cal_client);
+		report_error ("open client sync", &error);
+		return 1;
+	}
+
+	/* test from main thread */
+	stress_cal_views (cal_client, FALSE);
+
+	/* test from dedicated thread */
+	start_in_thread_with_main_loop (stress_cal_views_thread, cal_client);
+
+	g_object_unref (cal_client);
+
+	return get_main_loop_stop_result ();
+}



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