[evolution-data-server/account-mgmt: 12/37] Adapt libebook to the new ESource API.



commit 549d641f17c7869308f41c1cb9b9a3eaa5747b03
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Nov 12 15:46:18 2010 -0500

    Adapt libebook to the new ESource API.

 addressbook/libebook/e-book-client.c               |  247 +---------
 addressbook/libebook/e-book-client.h               |   12 +-
 addressbook/libebook/e-book.c                      |  508 +-------------------
 addressbook/libebook/e-book.h                      |   16 +-
 addressbook/libebook/e-destination.c               |    4 +-
 .../addressbook/libebook/libebook-sections.txt     |   16 -
 .../addressbook/libebook/tmpl/e-book-client.sgml   |   59 +---
 .../addressbook/libebook/tmpl/e-book.sgml          |   90 +----
 .../addressbook/libebook/tmpl/libebook-unused.sgml |  132 +++++
 tests/libebook/client/client-test-utils.c          |   85 ++---
 tests/libebook/client/client-test-utils.h          |    6 +-
 tests/libebook/client/test-client-async.c          |    4 +
 tests/libebook/client/test-client-examine.c        |   50 +--
 tests/libebook/client/test-client-nonexistent-id.c |    9 +-
 tests/libebook/client/test-client-search.c         |    7 +-
 tests/libebook/client/test-client-self.c           |    7 +-
 .../test-client-stress-factory--single-book.c      |    4 +
 tests/libebook/client/test-client-stress-views.c   |    4 +
 tests/libebook/client/test-client.c                |    8 +-
 tests/libebook/ebook-test-utils.c                  |  222 ++++-----
 tests/libebook/ebook-test-utils.h                  |    7 -
 tests/libebook/test-changes.c                      |    1 -
 tests/libebook/test-ebook-add-contact.c            |    3 -
 tests/libebook/test-ebook-async.c                  |    2 +
 tests/libebook/test-ebook-commit-contact.c         |    3 -
 tests/libebook/test-ebook-get-book-view.c          |    6 +-
 tests/libebook/test-ebook-get-contact.c            |    2 -
 tests/libebook/test-ebook-get-required-fields.c    |    2 -
 .../libebook/test-ebook-get-static-capabilities.c  |    2 -
 .../test-ebook-get-supported-auth-methods.c        |    2 -
 tests/libebook/test-ebook-get-supported-fields.c   |    2 -
 tests/libebook/test-ebook-remove-contact-by-id.c   |    1 -
 tests/libebook/test-ebook-remove-contact.c         |    4 +-
 tests/libebook/test-ebook-remove-contacts.c        |   10 +-
 tests/libebook/test-ebook-remove.c                 |    1 -
 tests/libebook/test-ebook-stress-factory--fifo.c   |    4 -
 tests/libebook/test-ebook-stress-factory--serial.c |    1 -
 .../test-ebook-stress-factory--single-book.c       |    3 -
 tests/libebook/test-ebook.c                        |    2 +
 tests/libebook/test-nonexistent-id.c               |    6 +-
 tests/libebook/test-search.c                       |    2 +
 tests/libebook/test-self.c                         |    2 +
 tests/libebook/test-stress-bookviews.c             |    2 +
 43 files changed, 386 insertions(+), 1174 deletions(-)
---
diff --git a/addressbook/libebook/e-book-client.c b/addressbook/libebook/e-book-client.c
index af19914..d85ff88 100644
--- a/addressbook/libebook/e-book-client.c
+++ b/addressbook/libebook/e-book-client.c
@@ -26,8 +26,11 @@
 #include <glib/gi18n-lib.h>
 #include <gio/gio.h>
 
+#include <gconf/gconf-client.h>
+
 #include "libedataserver/e-data-server-util.h"
 #include "libedataserver/e-client-private.h"
+#include "libedataserver/e-source-registry.h"
 
 #include "e-book-client.h"
 #include "e-contact.h"
@@ -473,7 +476,7 @@ e_book_client_new (ESource *source,
 	EBookClient *client;
 	GError *err = NULL;
 	GDBusConnection *connection;
-	gchar *xml, *gdbus_xml = NULL;
+	const gchar *uid;
 	gchar *path = NULL;
 
 	g_return_val_if_fail (source != NULL, NULL);
@@ -494,21 +497,13 @@ e_book_client_new (ESource *source,
 		return NULL;
 	}
 
-	xml = e_source_to_standalone_xml (source);
-	if (!xml || !*xml) {
-		UNLOCK_FACTORY ();
-		g_free (xml);
-		g_set_error_literal (error, E_CLIENT_ERROR, E_CLIENT_ERROR_INVALID_ARG, _("Invalid source"));
-		return NULL;
-	}
+	uid = e_source_get_uid (source);
 
 	client = g_object_new (E_TYPE_BOOK_CLIENT, "source", source, NULL);
 	UNLOCK_FACTORY ();
 
-	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)) {
+	if (!e_gdbus_book_factory_call_get_book_sync (G_DBUS_PROXY (book_factory_proxy), uid, &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);
@@ -517,9 +512,6 @@ e_book_client_new (ESource *source,
 		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,
@@ -563,224 +555,6 @@ e_book_client_new (ESource *source,
 	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_CLIENT_ERROR, E_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:
- * @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 (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:
- * @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 (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_CLIENT_ERROR, E_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 *
@@ -822,6 +596,7 @@ make_me_card (void)
 
 /**
  * e_book_client_get_self:
+ * @registry: an #ESourceRegistry
  * @contact: (out): an #EContact pointer to set
  * @client: (out): an #EBookClient pointer to set
  * @error: a #GError to set on failure
@@ -834,18 +609,22 @@ make_me_card (void)
  * Since: 3.2
  **/
 gboolean
-e_book_client_get_self (EContact **contact,
+e_book_client_get_self (ESourceRegistry *registry,
+                        EContact **contact,
                         EBookClient **client,
                         GError **error)
 {
+	ESource *source;
 	GError *local_error = NULL;
 	GConfClient *gconf;
 	gchar *uid;
 
+	g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FALSE);
 	g_return_val_if_fail (contact != NULL, FALSE);
 	g_return_val_if_fail (client != NULL, FALSE);
 
-	*client = e_book_client_new_system (&local_error);
+	source = e_source_registry_lookup_by_uid (registry, "system");
+	*client = e_book_client_new (source, &local_error);
 	if (!*client) {
 		g_propagate_error (error, local_error);
 		return FALSE;
diff --git a/addressbook/libebook/e-book-client.h b/addressbook/libebook/e-book-client.h
index 1435ce8..08b33d9 100644
--- a/addressbook/libebook/e-book-client.h
+++ b/addressbook/libebook/e-book-client.h
@@ -25,7 +25,7 @@
 #include <gio/gio.h>
 
 #include <libedataserver/e-client.h>
-#include <libedataserver/e-source-list.h>
+#include <libedataserver/e-source-registry.h>
 #include <libebook/e-book-client-view.h>
 #include <libebook/e-contact.h>
 
@@ -121,17 +121,9 @@ 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			(GError **error);
-EBookClient *	e_book_client_new_default			(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_get_self				(ESourceRegistry *registry, 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);
 
diff --git a/addressbook/libebook/e-book.c b/addressbook/libebook/e-book.c
index b7479a6..8da43c0 100644
--- a/addressbook/libebook/e-book.c
+++ b/addressbook/libebook/e-book.c
@@ -39,6 +39,7 @@
 #include <string.h>
 #include <glib/gi18n-lib.h>
 #include <gconf/gconf-client.h>
+#include <libedataserver/e-source-registry.h>
 #include <libedataserver/e-data-server-util.h>
 #include "e-book.h"
 #include "e-error.h"
@@ -79,7 +80,6 @@ struct _EBookPrivate {
 	guint gone_signal_id;
 
 	ESource *source;
-	gchar *uri;
 	gboolean loaded;
 	gboolean writable;
 	gboolean connected;
@@ -199,9 +199,6 @@ e_book_finalize (GObject *object)
 {
 	EBook *book = E_BOOK (object);
 
-	if (book->priv->uri)
-		g_free (book->priv->uri);
-
 	if (book->priv->cap)
 		g_free (book->priv->cap);
 
@@ -277,7 +274,6 @@ e_book_init (EBook *book)
 
 	book->priv->gdbus_book = NULL;
 	book->priv->source = NULL;
-	book->priv->uri = NULL;
 	book->priv->loaded = FALSE;
 	book->priv->writable = FALSE;
 	book->priv->connected = FALSE;
@@ -1180,14 +1176,13 @@ e_book_get_supported_auth_methods_async (EBook *book,
 /**
  * e_book_authenticate_user:
  * @book: an #EBook
- * @user: a string
+ * @user: a string (no longer used)
  * @passwd: a string
- * @auth_method: a string
+ * @auth_method: a string (no longer used)
  * @error: a #GError to set on failure
  *
- * Authenticates @user with @passwd, using the auth method
- * @auth_method.  @auth_method must be one of the authentication
- * methods returned using e_book_get_supported_auth_methods.
+ * Authenticates @book with @passwd.  The @user and @auth_method arguments
+ * are no longer used -- you can safely pass %NULL for these.
  *
  * Returns: %TRUE if successful, %FALSE otherwise
  *
@@ -1210,9 +1205,7 @@ e_book_authenticate_user (EBook *book,
 		book->priv->gdbus_book, E_BOOK_ERROR_REPOSITORY_OFFLINE);
 
 	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);
@@ -1254,15 +1247,15 @@ authenticate_user_reply (GObject *gdbus_book,
 /**
  * e_book_async_authenticate_user:
  * @book: an #EBook
- * @user: user name
+ * @user: user name (no longer used)
  * @passwd: password
- * @auth_method: string indicating authentication method
+ * @auth_method: string indicating authentication method (no longer used)
  * @cb: (scope async): function to call when the operation finishes
  * @closure: data to pass to callback function
  *
- * Authenticate @user with @passwd, using the auth method
- * @auth_method. @auth_method must be one of the authentication
- * methods returned using e_book_get_supported_auth_methods.
+ * Authenticate @book with @passwd.  The @user and @auth_method arguments
+ * are no longer used -- you can safely pass %NULL for these.
+ *
  * This function does not block.
  *
  * Returns: %FALSE if successful, %TRUE otherwise.
@@ -1295,9 +1288,7 @@ e_book_async_authenticate_user (EBook *book,
 	data->closure = closure;
 
 	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);
@@ -1313,15 +1304,15 @@ e_book_async_authenticate_user (EBook *book,
 /**
  * e_book_authenticate_user_async:
  * @book: an #EBook
- * @user: user name
+ * @user: user name (no longer used)
  * @passwd: password
- * @auth_method: string indicating authentication method
+ * @auth_method: string indicating authentication method (no longer used)
  * @cb: (scope async): function to call when the operation finishes
  * @closure: data to pass to callback function
  *
- * Authenticate @user with @passwd, using the auth method
- * @auth_method. @auth_method must be one of the authentication
- * methods returned using e_book_get_supported_auth_methods.
+ * Authenticate @book with @passwd.  The @user and @auth_method arguments
+ * are no longer used -- you can safely pass %NULL for these.
+ *
  * This function does not block.
  *
  * Returns: %FALSE if successful, %TRUE otherwise.
@@ -1356,9 +1347,7 @@ e_book_authenticate_user_async (EBook *book,
 	data->closure = closure;
 
 	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);
@@ -2784,24 +2773,6 @@ e_book_remove_async (EBook *book,
 }
 
 /**
- * e_book_get_uri:
- * @book: an #EBook
- *
- * 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)
-{
-	g_return_val_if_fail (E_IS_BOOK (book), NULL);
-
-	return book->priv->uri;
-}
-
-/**
  * e_book_get_source:
  * @book: an #EBook
  *
@@ -2978,6 +2949,7 @@ make_me_card (void)
 
 /**
  * e_book_get_self:
+ * @registry: an #ESourceRegistry
  * @contact: (out): an #EContact pointer to set
  * @book: (out): an #EBook pointer to set
  * @error: a #GError to set on failure
@@ -2990,16 +2962,21 @@ make_me_card (void)
  * Deprecated: 3.2: Use e_book_client_get_self() instead.
  **/
 gboolean
-e_book_get_self (EContact **contact,
+e_book_get_self (ESourceRegistry *registry,
+                 EContact **contact,
                  EBook **book,
                  GError **error)
 {
+	ESource *source;
 	GError *e = NULL;
 	GConfClient *gconf;
 	gboolean status;
 	gchar *uid;
 
-	*book = e_book_new_system_addressbook (&e);
+	g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FALSE);
+
+	source = e_source_registry_lookup_by_uid (registry, "system");
+	*book = e_book_new (source, &e);
 
 	if (!*book) {
 		if (error)
@@ -3110,130 +3087,6 @@ e_book_is_self (EContact *contact)
 }
 
 /**
- * e_book_set_default_addressbook:
- * @book: An #EBook pointer
- * @error: A #GError pointer
- *
- * sets the #ESource of the #EBook as the "default" addressbook.  This is the source
- * 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)
-{
-	ESource *source;
-
-	g_return_val_if_fail (E_IS_BOOK (book), FALSE);
-
-	e_return_error_if_fail (
-		book->priv->loaded == FALSE,
-		E_BOOK_ERROR_SOURCE_ALREADY_LOADED);
-
-	source = e_book_get_source (book);
-
-	return e_book_set_default_source (source, error);
-}
-
-/**
- * e_book_set_default_source:
- * @source: an #ESource
- * @error: return location for a #GError, or %NULL
- *
- * Sets @source as the default address book.  This is the source 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_source() instead.
- */
-gboolean
-e_book_set_default_source (ESource *source,
-                           GError **error)
-{
-	ESourceList *sources;
-	const gchar *uid;
-	GError *err = NULL;
-	GSList *g;
-
-	g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
-
-	uid = e_source_peek_uid (source);
-
-	if (!e_book_get_addressbooks (&sources, &err)) {
-		if (error)
-			g_propagate_error (error, err);
-		return FALSE;
-	}
-
-	/* 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 (sources, uid);
-	if (!source) {
-		g_set_error (error, E_BOOK_ERROR, E_BOOK_ERROR_NO_SUCH_SOURCE,
-			     _("%s: there was no source for UID '%s' stored in GConf."), "e_book_set_default_source", uid);
-		g_object_unref (sources);
-		return FALSE;
-	}
-
-	/* loop over all the sources clearing out any "default"
-	 * properties we find */
-	for (g = e_source_list_peek_groups (sources); 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");
-
-	if (!e_source_list_sync (sources, &err)) {
-		if (error)
-			g_propagate_error (error, err);
-
-		g_object_unref (sources);
-
-		return FALSE;
-	}
-
-	g_object_unref (sources);
-
-	return TRUE;
-}
-
-/**
- * e_book_get_addressbooks:
- * @addressbook_sources: (out): A pointer to a #ESourceList to set
- * @error: A pointer to a GError to set on error
- *
- * Populate *addressbook_sources with the list of all sources which have been
- * 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)
-{
-	GConfClient *gconf;
-
-	g_return_val_if_fail (addressbook_sources != NULL, FALSE);
-
-	gconf = gconf_client_get_default ();
-	*addressbook_sources = e_source_list_new_for_gconf (gconf, "/apps/evolution/addressbook/sources");
-	g_object_unref (gconf);
-
-	return TRUE;
-}
-
-/**
  * e_book_new:
  * @source: an #ESource
  * @error: return location for a #GError, or %NULL
@@ -3253,7 +3106,7 @@ e_book_new (ESource *source,
 	GError *err = NULL;
 	EBook *book;
 	gchar *path = NULL;
-	gchar *xml, *gdbus_xml = NULL;
+	const gchar *uid;
 	GDBusConnection *connection;
 
 	g_return_val_if_fail (E_IS_SOURCE (source), NULL);
@@ -3269,14 +3122,11 @@ e_book_new (ESource *source,
 	book = g_object_new (E_TYPE_BOOK, NULL);
 
 	book->priv->source = g_object_ref (source);
-	book->priv->uri = e_source_get_uri (source);
 
-	xml = e_source_to_standalone_xml (source);
+	uid = e_source_get_uid (source);
 
-	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)) {
+	if (!e_gdbus_book_factory_call_get_book_sync (G_DBUS_PROXY (book_factory_proxy), uid, &path, NULL, &err)) {
 		unwrap_gerror (err, &err);
-		g_free (xml);
-		g_free (gdbus_xml);
 		g_warning (G_STRLOC ": cannot get book from factory: %s", err ? err->message : "[no error]");
 		if (err)
 			g_propagate_error (error, err);
@@ -3284,8 +3134,6 @@ e_book_new (ESource *source,
 
 		return NULL;
 	}
-	g_free (xml);
-	g_free (gdbus_xml);
 
 	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,
@@ -3324,310 +3172,6 @@ e_book_new (ESource *source,
 	return book;
 }
 
-/* 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 (gboolean (*check_func)(ESource *source,
-                                             gpointer user_data),
-                      gpointer user_data,
-                      ESourceList **sources,
-                      GError **error)
-{
-	ESource *res = NULL;
-	GSList *g;
-	GError *err = NULL;
-
-	g_return_val_if_fail (check_func != NULL, NULL);
-	g_return_val_if_fail (sources != NULL, NULL);
-
-	if (!e_book_get_addressbooks (sources, &err)) {
-		g_propagate_error (error, err);
-		return 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;
-	} else {
-		gboolean ret;
-		gchar *suri2;
-
-		suri2 = e_source_get_uri (source);
-		ret = !g_ascii_strcasecmp (suri2, uri);
-		g_free (suri2);
-
-		return ret;
-	}
-}
-
-/**
- * e_book_new_from_uri:
- * @uri: the URI to load
- * @error: A #GError pointer
- *
- * Creates a new #EBook corresponding to the given uri.  See the
- * 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)
-{
-	ESourceList *sources = NULL;
-	ESource *source;
-	EBook *book;
-	GError *err = NULL;
-
-	g_return_val_if_fail (uri != NULL, NULL);
-
-	source = search_known_sources (check_uri, (gpointer) uri, &sources, &err);
-	if (err) {
-		g_propagate_error (error, err);
-		if (sources)
-			g_object_unref (sources);
-		return NULL;
-	}
-
-	if (!source)
-		source = e_source_new_with_absolute_uri ("", uri);
-
-	book = e_book_new (source, &err);
-	if (err)
-		g_propagate_error (error, err);
-
-	g_object_unref (source);
-	if (sources)
-		g_object_unref (sources);
-
-	return book;
-}
-
-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;
-}
-
-static EBook *
-get_local_source (GError **error)
-{
-	ESourceGroup *on_this_computer;
-	ESourceList *sources;
-	GSList *local_sources, *iter;
-	ESource *personal = NULL;
-	const gchar *name;
-	gchar *source_uri = NULL;
-	EBook *book;
-
-	if (e_book_get_addressbooks (&sources, error)) {
-		on_this_computer = e_source_list_ensure_group (
-		        sources, _("On This Computer"), "local:", TRUE);
-
-		if (on_this_computer) {
-			local_sources = e_source_group_peek_sources (on_this_computer);
-
-			/* Make sure this group includes a "Personal" source. */
-			for (iter = local_sources; iter != NULL; iter = iter->next) {
-				ESource *source = iter->data;
-				const gchar *relative_uri;
-
-				relative_uri = e_source_peek_relative_uri (source);
-				if (g_strcmp0 (relative_uri, "system") == 0) {
-					personal = source;
-					break;
-				}
-			}
-
-			name = _("Personal");
-
-			if (personal == NULL) {
-				ESource *source;
-
-				/* Create the default Personal address book. */
-				source = e_source_new (name, "system");
-				e_source_group_add_source (on_this_computer, source, -1);
-				e_source_set_property (source, "completion", "true");
-
-				source_uri = e_source_get_uri (source);
-				g_object_unref (source);
-			} else {
-				/* Force the source name to the current locale. */
-				e_source_set_name (personal, name);
-
-				source_uri = e_source_get_uri (personal);
-			}
-
-			g_object_unref (on_this_computer);
-		}
-
-		g_object_unref (sources);
-	}
-
-	book = e_book_new_from_uri (source_uri?:"local:system", error);
-	g_free (source_uri);
-
-	return book;
-}
-
-/**
- * e_book_new_system_addressbook:
- * @error: A #GError pointer
- *
- * Creates a new #EBook corresponding to the user's system address book.
- * See the documentation for e_book_new() for further information.
- *
- * Returns: a new but unopened #EBook.
- *
- * Deprecated: 3.2: Use e_book_client_new_system() instead.
- */
-EBook *
-e_book_new_system_addressbook (GError **error)
-{
-	GError *err = NULL;
-	ESourceList *sources = NULL;
-	ESource *system_source = NULL;
-	EBook *book;
-	struct check_system_data csd;
-
-	csd.uri = "local:system";
-	csd.uri_source = NULL;
-
-	system_source = search_known_sources (check_system, &csd, &sources, &err);
-	if (err) {
-		g_propagate_error (error, err);
-		if (sources)
-			g_object_unref (sources);
-		return NULL;
-	}
-
-	if (!system_source) {
-		system_source = csd.uri_source;
-		csd.uri_source = NULL;
-	}
-
-	if (system_source) {
-		book = e_book_new (system_source, &err);
-		g_object_unref (system_source);
-	} else {
-		book = get_local_source (&err);
-	}
-
-	if (csd.uri_source)
-		g_object_unref (csd.uri_source);
-	if (sources)
-		g_object_unref (sources);
-
-	if (err)
-		g_propagate_error (error, err);
-
-	return book;
-}
-
-/**
- * e_book_new_default_addressbook:
- * @error: return location for a #GError, or %NULL
- *
- * Creates a new #EBook corresponding to the user's default address book.
- * See the documentation for e_book_new() for further information.
- *
- * Returns: a new but unopened #EBook
- *
- * Deprecated: 3.2: Use e_book_client_new_default() instead.
- */
-EBook *
-e_book_new_default_addressbook (GError **error)
-{
-	ESourceList *source_list;
-	ESource *source;
-	EBook *book;
-
-	if (!e_book_get_addressbooks (&source_list, error))
-		return NULL;
-
-	source = e_source_list_peek_default_source (source_list);
-	if (!source) {
-		g_set_error_literal (error, E_BOOK_ERROR, E_BOOK_ERROR_NO_SUCH_BOOK,
-			     _("Address book does not exist"));
-		g_object_unref (source_list);
-		return NULL;
-	}
-
-	book = e_book_new (source, error);
-
-	g_object_unref (source_list);
-
-	return book;
-}
-
 /**
  * If the GError is a remote error, extract the EBookStatus embedded inside.
  * Otherwise return DBUS_EXCEPTION (I know this is DBus...).
diff --git a/addressbook/libebook/e-book.h b/addressbook/libebook/e-book.h
index f632d2b..69e2a22 100644
--- a/addressbook/libebook/e-book.h
+++ b/addressbook/libebook/e-book.h
@@ -14,9 +14,8 @@
 /* e-book deprecated since 3.2, use e-book-client instead */
 #ifndef E_BOOK_DISABLE_DEPRECATED
 
-#include "libedataserver/e-list.h"
-#include "libedataserver/e-source.h"
-#include "libedataserver/e-source-list.h"
+#include <libedataserver/e-list.h>
+#include <libedataserver/e-source-registry.h>
 #include <libebook/e-contact.h>
 #include <libebook/e-book-query.h>
 #include <libebook/e-book-view.h>
@@ -125,9 +124,6 @@ struct _EBookClass {
 
 /* Creating a new addressbook. */
 EBook    *e_book_new                       (ESource *source, GError **error);
-EBook    *e_book_new_from_uri              (const gchar *uri, GError **error);
-EBook    *e_book_new_system_addressbook    (GError **error);
-EBook    *e_book_new_default_addressbook   (GError **error);
 
 /* loading addressbooks */
 gboolean e_book_open                       (EBook       *book,
@@ -378,7 +374,6 @@ gboolean e_book_get_changes_async       (EBook                 *book,
 
 void     e_book_free_change_list           (GList       *change_list);
 
-const gchar *e_book_get_uri                 (EBook       *book);
 ESource    *e_book_get_source              (EBook       *book);
 
 const gchar *e_book_get_static_capabilities (EBook    *book,
@@ -398,15 +393,10 @@ gboolean    e_book_cancel_async_op	   (EBook   *book,
 					    GError **error);
 
 /* Identity */
-gboolean    e_book_get_self                (EContact **contact, EBook **book, GError **error);
+gboolean    e_book_get_self                (ESourceRegistry *registry, EContact **contact, EBook **book, GError **error);
 gboolean    e_book_set_self                (EBook *book, EContact *contact, GError **error);
 gboolean    e_book_is_self                 (EContact *contact);
 
-/* Addressbook Discovery */
-gboolean    e_book_set_default_addressbook (EBook  *book, GError **error);
-gboolean    e_book_set_default_source      (ESource *source, GError **error);
-gboolean    e_book_get_addressbooks        (ESourceList ** addressbook_sources, GError **error);
-
 GType        e_book_get_type                  (void);
 
 G_END_DECLS
diff --git a/addressbook/libebook/e-destination.c b/addressbook/libebook/e-destination.c
index 9d0253e..09ce334 100644
--- a/addressbook/libebook/e-destination.c
+++ b/addressbook/libebook/e-destination.c
@@ -566,7 +566,7 @@ e_destination_set_book (EDestination *dest,
 	g_return_if_fail (book && E_IS_BOOK (book));
 
 	source = e_book_get_source (book);
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 	g_return_if_fail (uid != NULL);
 
 	if (!dest->priv->source_uid || strcmp (uid, dest->priv->source_uid)) {
@@ -598,7 +598,7 @@ e_destination_set_client (EDestination *dest,
 	g_return_if_fail (client && E_IS_BOOK_CLIENT (client));
 
 	source = e_client_get_source (E_CLIENT (client));
-	uid = e_source_peek_uid (source);
+	uid = e_source_get_uid (source);
 	g_return_if_fail (uid != NULL);
 
 	if (!dest->priv->source_uid || strcmp (uid, dest->priv->source_uid)) {
diff --git a/docs/reference/addressbook/libebook/libebook-sections.txt b/docs/reference/addressbook/libebook/libebook-sections.txt
index 8658b1f..5da08e2 100644
--- a/docs/reference/addressbook/libebook/libebook-sections.txt
+++ b/docs/reference/addressbook/libebook/libebook-sections.txt
@@ -23,12 +23,6 @@ EBookViewPrivate
 <TITLE>EBook</TITLE>
 EBook
 e_book_new
-e_book_new_default_addressbook
-e_book_new_from_uri
-e_book_new_system_addressbook
-e_book_set_default_addressbook
-e_book_set_default_source
-e_book_remove
 e_book_open
 e_book_get_supported_fields
 e_book_get_supported_auth_methods
@@ -46,7 +40,6 @@ e_book_get_book_view
 e_book_get_contacts
 e_book_get_changes
 e_book_free_change_list
-e_book_get_uri
 e_book_get_static_capabilities
 e_book_check_static_capability
 e_book_is_writable
@@ -55,7 +48,6 @@ e_book_cancel_async_op
 e_book_get_self
 e_book_set_self
 e_book_is_self
-e_book_get_addressbooks
 e_return_error_if_fail
 e_return_async_error_if_fail
 e_return_async_error_val_if_fail
@@ -76,7 +68,6 @@ EBookListCallback
 EBookContactCallback
 EBookBookViewCallback
 e_book_open_async
-e_book_remove_async
 e_book_get_supported_fields_async
 e_book_get_supported_auth_methods_async
 e_book_authenticate_user_async
@@ -91,7 +82,6 @@ e_book_get_book_view_async
 e_book_get_changes_async
 e_book_get_required_fields_async
 e_book_async_open
-e_book_async_remove
 e_book_async_get_supported_fields
 e_book_async_get_supported_auth_methods
 e_book_async_authenticate_user
@@ -130,12 +120,6 @@ e_book_client_error_to_string
 e_book_client_error_create
 EBookClient
 e_book_client_new
-e_book_client_new_from_uri
-e_book_client_new_system
-e_book_client_new_default
-e_book_client_set_default
-e_book_client_set_default_source
-e_book_client_get_sources
 e_book_client_get_self
 e_book_client_set_self
 e_book_client_is_self
diff --git a/docs/reference/addressbook/libebook/tmpl/e-book-client.sgml b/docs/reference/addressbook/libebook/tmpl/e-book-client.sgml
index 5ba515c..965ea85 100644
--- a/docs/reference/addressbook/libebook/tmpl/e-book-client.sgml
+++ b/docs/reference/addressbook/libebook/tmpl/e-book-client.sgml
@@ -94,69 +94,12 @@ EBookClient
 @Returns: 
 
 
-<!-- ##### FUNCTION e_book_client_new_from_uri ##### -->
-<para>
-
-</para>
-
- uri: 
- error: 
- Returns: 
-
-
-<!-- ##### FUNCTION e_book_client_new_system ##### -->
-<para>
-
-</para>
-
- error: 
- Returns: 
-
-
-<!-- ##### FUNCTION e_book_client_new_default ##### -->
-<para>
-
-</para>
-
- error: 
- Returns: 
-
-
-<!-- ##### FUNCTION e_book_client_set_default ##### -->
-<para>
-
-</para>
-
- client: 
- error: 
- Returns: 
-
-
-<!-- ##### FUNCTION e_book_client_set_default_source ##### -->
-<para>
-
-</para>
-
- source: 
- error: 
- Returns: 
-
-
-<!-- ##### FUNCTION e_book_client_get_sources ##### -->
-<para>
-
-</para>
-
- sources: 
- error: 
- Returns: 
-
-
 <!-- ##### FUNCTION e_book_client_get_self ##### -->
 <para>
 
 </para>
 
+ registry: 
 @contact: 
 @client: 
 @error: 
diff --git a/docs/reference/addressbook/libebook/tmpl/e-book.sgml b/docs/reference/addressbook/libebook/tmpl/e-book.sgml
index e6f4b0b..c96875d 100644
--- a/docs/reference/addressbook/libebook/tmpl/e-book.sgml
+++ b/docs/reference/addressbook/libebook/tmpl/e-book.sgml
@@ -68,64 +68,6 @@ The writable status for this book is being reported.
 @Returns: 
 
 
-<!-- ##### FUNCTION e_book_new_default_addressbook ##### -->
-<para>
-
-</para>
-
- error: 
- Returns: 
-
-
-<!-- ##### FUNCTION e_book_new_from_uri ##### -->
-<para>
-
-</para>
-
- uri: 
- error: 
- Returns: 
-
-
-<!-- ##### FUNCTION e_book_new_system_addressbook ##### -->
-<para>
-
-</para>
-
- error: 
- Returns: 
-
-
-<!-- ##### FUNCTION e_book_set_default_addressbook ##### -->
-<para>
-
-</para>
-
- book: 
- error: 
- Returns: 
-
-
-<!-- ##### FUNCTION e_book_set_default_source ##### -->
-<para>
-
-</para>
-
- source: 
- error: 
- Returns: 
-
-
-<!-- ##### FUNCTION e_book_remove ##### -->
-<para>
-
-</para>
-
- book: 
- error: 
- Returns: 
-
-
 <!-- ##### FUNCTION e_book_open ##### -->
 <para>
 
@@ -312,15 +254,6 @@ The writable status for this book is being reported.
 @change_list: 
 
 
-<!-- ##### FUNCTION e_book_get_uri ##### -->
-<para>
-
-</para>
-
- book: 
- Returns: 
-
-
 <!-- ##### FUNCTION e_book_get_static_capabilities ##### -->
 <para>
 
@@ -375,6 +308,7 @@ The writable status for this book is being reported.
 
 </para>
 
+ registry: 
 @contact: 
 @book: 
 @error: 
@@ -610,17 +544,6 @@ The writable status for this book is being reported.
 @Returns: 
 
 
-<!-- ##### FUNCTION e_book_remove_async ##### -->
-<para>
-
-</para>
-
- book: 
- cb: 
- closure: 
- Returns: 
-
-
 <!-- ##### FUNCTION e_book_get_supported_fields_async ##### -->
 <para>
 
@@ -790,17 +713,6 @@ The writable status for this book is being reported.
 @Returns: 
 
 
-<!-- ##### FUNCTION e_book_async_remove ##### -->
-<para>
-
-</para>
-
- book: 
- cb: 
- closure: 
- Returns: 
-
-
 <!-- ##### FUNCTION e_book_async_get_supported_fields ##### -->
 <para>
 
diff --git a/docs/reference/addressbook/libebook/tmpl/libebook-unused.sgml b/docs/reference/addressbook/libebook/tmpl/libebook-unused.sgml
index e8fe0b8..852ae62 100644
--- a/docs/reference/addressbook/libebook/tmpl/libebook-unused.sgml
+++ b/docs/reference/addressbook/libebook/tmpl/libebook-unused.sgml
@@ -443,6 +443,16 @@ Data sent back to the e-book object.
 @closure: 
 @Returns: 
 
+<!-- ##### FUNCTION e_book_async_remove ##### -->
+<para>
+
+</para>
+
+ book: 
+ cb: 
+ closure: 
+ Returns: 
+
 <!-- ##### FUNCTION e_book_async_remove_contact_by_id_ex ##### -->
 <para>
 
@@ -493,6 +503,58 @@ Data sent back to the e-book object.
 
 @book: 
 
+<!-- ##### FUNCTION e_book_client_get_sources ##### -->
+<para>
+
+</para>
+
+ sources: 
+ error: 
+ Returns: 
+
+<!-- ##### FUNCTION e_book_client_new_default ##### -->
+<para>
+
+</para>
+
+ error: 
+ Returns: 
+
+<!-- ##### FUNCTION e_book_client_new_from_uri ##### -->
+<para>
+
+</para>
+
+ uri: 
+ error: 
+ Returns: 
+
+<!-- ##### FUNCTION e_book_client_new_system ##### -->
+<para>
+
+</para>
+
+ error: 
+ Returns: 
+
+<!-- ##### FUNCTION e_book_client_set_default ##### -->
+<para>
+
+</para>
+
+ client: 
+ error: 
+ Returns: 
+
+<!-- ##### FUNCTION e_book_client_set_default_source ##### -->
+<para>
+
+</para>
+
+ source: 
+ error: 
+ Returns: 
+
 <!-- ##### FUNCTION e_book_get_addressbooks ##### -->
 <para>
 
@@ -511,6 +573,14 @@ Data sent back to the e-book object.
 @error: 
 @Returns: 
 
+<!-- ##### FUNCTION e_book_get_uri ##### -->
+<para>
+
+</para>
+
+ book: 
+ Returns: 
+
 <!-- ##### FUNCTION e_book_listener_new ##### -->
 <para>
 
@@ -616,6 +686,68 @@ Data sent back to the e-book object.
 </para>
 
 
+<!-- ##### FUNCTION e_book_new_default_addressbook ##### -->
+<para>
+
+</para>
+
+ error: 
+ Returns: 
+
+<!-- ##### FUNCTION e_book_new_from_uri ##### -->
+<para>
+
+</para>
+
+ uri: 
+ error: 
+ Returns: 
+
+<!-- ##### FUNCTION e_book_new_system_addressbook ##### -->
+<para>
+
+</para>
+
+ error: 
+ Returns: 
+
+<!-- ##### FUNCTION e_book_remove ##### -->
+<para>
+
+</para>
+
+ book: 
+ error: 
+ Returns: 
+
+<!-- ##### FUNCTION e_book_remove_async ##### -->
+<para>
+
+</para>
+
+ book: 
+ cb: 
+ closure: 
+ Returns: 
+
+<!-- ##### FUNCTION e_book_set_default_addressbook ##### -->
+<para>
+
+</para>
+
+ book: 
+ error: 
+ Returns: 
+
+<!-- ##### FUNCTION e_book_set_default_source ##### -->
+<para>
+
+</para>
+
+ source: 
+ error: 
+ Returns: 
+
 <!-- ##### FUNCTION e_book_unload_uri ##### -->
 <para>
 
diff --git a/tests/libebook/client/client-test-utils.c b/tests/libebook/client/client-test-utils.c
index 710ba25..6d751a8 100644
--- a/tests/libebook/client/client-test-utils.c
+++ b/tests/libebook/client/client-test-utils.c
@@ -1,6 +1,9 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 
 #include <stdio.h>
+#include <stdlib.h>
+#include <libedataserver/e-source-registry.h>
+#include <libebook/e-source-address-book.h>
 
 #include "client-test-utils.h"
 
@@ -36,14 +39,18 @@ print_email (EContact *contact)
 }
 
 EBookClient *
-open_system_book (gboolean only_if_exists)
+open_system_book (ESourceRegistry *registry,
+                  gboolean only_if_exists)
 {
+	ESource *source;
 	EBookClient *book_client;
 	GError *error = NULL;
 
 	main_initialize ();
 
-	book_client = e_book_client_new_system (&error);
+	source = e_source_registry_lookup_by_uid (registry, "system");
+
+	book_client = e_book_client_new (source, &error);
 	if (error) {
 		report_error ("create system addressbook", &error);
 		return NULL;
@@ -206,7 +213,8 @@ get_main_loop_stop_result (void)
 }
 
 void
-foreach_configured_source (void (*func) (ESource *source))
+foreach_configured_source (ESourceRegistry *registry,
+                           void (*func) (ESource *source))
 {
 	gpointer foreach_async_data;
 	ESource *source = NULL;
@@ -215,7 +223,7 @@ foreach_configured_source (void (*func) (ESource *source))
 
 	main_initialize ();
 
-	foreach_async_data = foreach_configured_source_async_start (&source);
+	foreach_async_data = foreach_configured_source_async_start (registry, &source);
 	if (!foreach_async_data)
 		return;
 
@@ -224,52 +232,29 @@ foreach_configured_source (void (*func) (ESource *source))
 	} while (foreach_configured_source_async_next (&foreach_async_data, &source));
 }
 
-struct ForeachConfiguredData
-{
-	ESourceList *source_list;
-	GSList *current_group;
-	GSList *current_source;
+struct ForeachConfiguredData {
+	GList *list;
 };
 
 gpointer
-foreach_configured_source_async_start (ESource **source)
+foreach_configured_source_async_start (ESourceRegistry *registry,
+                                       ESource **source)
 {
 	struct ForeachConfiguredData *async_data;
-	ESourceList *source_list = NULL;
-	GError *error = NULL;
+	const gchar *extension_name;
+	GList *list;
 
 	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);
+	extension_name = E_SOURCE_EXTENSION_ADDRESS_BOOK;
+	list = e_source_registry_list_sources (registry, extension_name);
 
 	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;
+	async_data->list = list;
 
-		if (foreach_configured_source_async_next (&ad, source))
-			return ad;
-
-		return NULL;
-	}
-
-	*source = async_data->current_source->data;
+	*source = async_data->list->data;
 
 	return async_data;
 }
@@ -285,28 +270,14 @@ foreach_configured_source_async_next (gpointer *foreach_async_data,
 
 	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;
+	if (async_data->list)
+		async_data->list = async_data->list->next;
+	if (async_data->list) {
+		*source = async_data->list->data;
 		return TRUE;
 	}
 
-	g_object_unref (async_data->source_list);
 	g_free (async_data);
 
 	*foreach_async_data = NULL;
@@ -317,6 +288,7 @@ foreach_configured_source_async_next (gpointer *foreach_async_data,
 EBookClient *
 new_temp_client (gchar **uri)
 {
+#if 0  /* ACCOUNT_MGMT */
 	EBookClient *book_client;
 	ESource *source;
 	gchar *abs_uri, *filename;
@@ -349,6 +321,9 @@ new_temp_client (gchar **uri)
 		report_error ("new temp client", &error);
 
 	return book_client;
+#endif /* ACCOUNT_MGMT */
+
+	return NULL;
 }
 
 gchar *
diff --git a/tests/libebook/client/client-test-utils.h b/tests/libebook/client/client-test-utils.h
index 514880a..953cc86 100644
--- a/tests/libebook/client/client-test-utils.h
+++ b/tests/libebook/client/client-test-utils.h
@@ -6,7 +6,7 @@
 
 void report_error (const gchar *operation, GError **error);
 void print_email (EContact *contact);
-EBookClient *open_system_book (gboolean only_if_exists);
+EBookClient *open_system_book (ESourceRegistry *registry, gboolean only_if_exists);
 
 void main_initialize (void);
 void start_main_loop (GThreadFunc func, gpointer data);
@@ -15,8 +15,8 @@ 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);
+void foreach_configured_source (ESourceRegistry *registry, void (*func) (ESource *source));
+gpointer foreach_configured_source_async_start (ESourceRegistry *registry, ESource **source);
 gboolean foreach_configured_source_async_next (gpointer *foreach_async_data, ESource **source);
 
 EBookClient *new_temp_client (gchar **uri);
diff --git a/tests/libebook/client/test-client-async.c b/tests/libebook/client/test-client-async.c
index d6b730f..d4833e3 100644
--- a/tests/libebook/client/test-client-async.c
+++ b/tests/libebook/client/test-client-async.c
@@ -143,6 +143,7 @@ gint
 main (gint argc,
       gchar **argv)
 {
+#if 0  /* ACCOUNT_MGMT */
 	EBookClient *book_client;
 	GError *error = NULL;
 
@@ -163,4 +164,7 @@ main (gint argc,
 	g_object_unref (book_client);
 
 	return get_main_loop_stop_result ();
+#endif /* ACCOUNT_MGMT */
+
+	return 0;
 }
diff --git a/tests/libebook/client/test-client-examine.c b/tests/libebook/client/test-client-examine.c
index 1124d50..a1425e6 100644
--- a/tests/libebook/client/test-client-examine.c
+++ b/tests/libebook/client/test-client-examine.c
@@ -3,7 +3,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <libebook/e-book-client.h>
-#include <libedataserver/e-source-group.h>
 
 #include "client-test-utils.h"
 
@@ -118,28 +117,14 @@ print_values (const ExtraValues *evals,
 static void
 identify_source (ESource *source)
 {
-	const gchar *name, *uri;
-	gchar *abs_uri = NULL;
+	const gchar *name, *uid;
 
 	g_return_if_fail (source != NULL);
 
-	name = e_source_peek_name (source);
-	if (!name)
-		name = "Unknown name";
+	uid = e_source_get_uid (source);
+	name = e_source_get_display_name (source);
 
-	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 source '%s' (%s)\n", name, uri);
-
-	g_free (abs_uri);
+	g_print ("\n   Checking source '%s' (%s)\n", name, uid);
 }
 
 static void
@@ -331,14 +316,14 @@ check_source_sync (ESource *source)
 }
 
 static gboolean
-foreach_async (void)
+foreach_async (ESourceRegistry *registry)
 {
 	gpointer async_data;
 	ESource *source = NULL;
 	EBookClient *book_client;
 	GError *error = NULL;
 
-	async_data = foreach_configured_source_async_start (&source);
+	async_data = foreach_configured_source_async_start (registry, &source);
 	if (!async_data) {
 		stop_main_loop (1);
 		return FALSE;
@@ -366,28 +351,28 @@ foreach_async (void)
 }
 
 static gboolean
-in_main_thread_idle_cb (gpointer unused)
+in_main_thread_idle_cb (ESourceRegistry *registry)
 {
 	g_print ("* run in main thread with mainloop running\n");
-	foreach_configured_source (check_source_sync);
+	foreach_configured_source (registry, check_source_sync);
 	g_print ("---------------------------------------------------------\n\n");
 
 	g_print ("* run in main thread async\n");
 
-	if (!foreach_async ())
+	if (!foreach_async (registry))
 		return FALSE;
 
 	return FALSE;
 }
 
 static gpointer
-worker_thread (gpointer unused)
+worker_thread (ESourceRegistry *registry)
 {
 	g_print ("* run in dedicated thread with mainloop running\n");
-	foreach_configured_source (check_source_sync);
+	foreach_configured_source (registry, check_source_sync);
 	g_print ("---------------------------------------------------------\n\n");
 
-	g_idle_add (in_main_thread_idle_cb, NULL);
+	g_idle_add ((GSourceFunc) in_main_thread_idle_cb, registry);
 
 	return NULL;
 }
@@ -396,13 +381,20 @@ gint
 main (gint argc,
       gchar **argv)
 {
+	ESourceRegistry *registry;
+	GError *error = NULL;
+
 	main_initialize ();
 
+	registry = e_source_registry_new_sync (NULL, &error);
+	if (error != NULL)
+		g_error ("%s", error->message);
+
 	g_print ("* run in main thread without mainloop\n");
-	foreach_configured_source (check_source_sync);
+	foreach_configured_source (registry, check_source_sync);
 	g_print ("---------------------------------------------------------\n\n");
 
-	start_in_thread_with_main_loop (worker_thread, NULL);
+	start_in_thread_with_main_loop ((GThreadFunc) worker_thread, registry);
 
 	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
index 9dd229e..f3c44f7 100644
--- a/tests/libebook/client/test-client-nonexistent-id.c
+++ b/tests/libebook/client/test-client-nonexistent-id.c
@@ -8,14 +8,19 @@ gint
 main (gint argc,
       gchar **argv)
 {
-	GError *error = NULL;
 	EBookClient *book_client = NULL;
+	ESourceRegistry *registry;
+	GError *error = NULL;
 
 	main_initialize ();
 
+	registry = e_source_registry_new_sync (NULL, &error);
+	if (error != NULL)
+		g_error ("%s", error->message);
+
 	printf ("loading addressbook\n");
 
-	book_client = open_system_book (FALSE);
+	book_client = open_system_book (registry, FALSE);
 	if (!book_client)
 		return 1;
 
diff --git a/tests/libebook/client/test-client-search.c b/tests/libebook/client/test-client-search.c
index 0b9386a..5a9e287 100644
--- a/tests/libebook/client/test-client-search.c
+++ b/tests/libebook/client/test-client-search.c
@@ -11,6 +11,7 @@ main (gint argc,
       gchar **argv)
 {
 	EBookClient *book_client;
+	ESourceRegistry *registry;
 	const gchar *query_string;
 	EBookQuery *query;
 	gchar *sexp;
@@ -27,6 +28,10 @@ main (gint argc,
 		query_string = argv[1];
 	}
 
+	registry = e_source_registry_new_sync (NULL, &error);
+	if (error != NULL)
+		g_error ("%s", error->message);
+
 	query = e_book_query_from_string (query_string);
 	if (!query) {
 		fprintf (stderr, " * Failed to parse query string '%s'\n", query_string);
@@ -36,7 +41,7 @@ main (gint argc,
 	sexp = e_book_query_to_string (query);
 	e_book_query_unref (query);
 
-	book_client = open_system_book (FALSE);
+	book_client = open_system_book (registry, FALSE);
 	if (!book_client) {
 		g_free (sexp);
 		return 1;
diff --git a/tests/libebook/client/test-client-self.c b/tests/libebook/client/test-client-self.c
index fa2ed48..eeec99b 100644
--- a/tests/libebook/client/test-client-self.c
+++ b/tests/libebook/client/test-client-self.c
@@ -10,6 +10,7 @@ main (gint argc,
       gchar **argv)
 {
 	EBookClient *book_client = NULL;
+	ESourceRegistry *registry;
 	EContact *contact = NULL;
 	GError *error = NULL;
 	gchar *vcard;
@@ -18,7 +19,11 @@ main (gint argc,
 
 	printf ("getting the self contact\n");
 
-	if (!e_book_client_get_self (&contact, &book_client, &error)) {
+	registry = e_source_registry_new_sync (NULL, &error);
+	if (error != NULL)
+		g_error ("%s", error->message);
+
+	if (!e_book_client_get_self (registry, &contact, &book_client, &error)) {
 		report_error ("get self", &error);
 		return 1;
 	}
diff --git a/tests/libebook/client/test-client-stress-factory--single-book.c b/tests/libebook/client/test-client-stress-factory--single-book.c
index 561190f..3a8e3f5 100644
--- a/tests/libebook/client/test-client-stress-factory--single-book.c
+++ b/tests/libebook/client/test-client-stress-factory--single-book.c
@@ -11,6 +11,7 @@ gint
 main (gint argc,
       gchar **argv)
 {
+#if 0  /* ACCOUNT_MGMT */
 	gchar *uri = NULL;
 	EBookClient *book_client;
 	GError *error = NULL;
@@ -60,4 +61,7 @@ main (gint argc,
 	g_object_unref (book_client);
 
 	return ii == NUM_OPENS ? 0 : 1;
+#endif  /* ACCOUNT_MGMT */
+
+	return 0;
 }
diff --git a/tests/libebook/client/test-client-stress-views.c b/tests/libebook/client/test-client-stress-views.c
index f919f19..fd24b68 100644
--- a/tests/libebook/client/test-client-stress-views.c
+++ b/tests/libebook/client/test-client-stress-views.c
@@ -102,6 +102,7 @@ gint
 main (gint argc,
       gchar **argv)
 {
+#if 0  /* ACCOUNT_MGMT */
 	EBookClient *book_client;
 	GError *error = NULL;
 
@@ -130,4 +131,7 @@ main (gint argc,
 	g_object_unref (book_client);
 
 	return get_main_loop_stop_result ();
+#endif /* ACCOUNT_MGMT */
+
+	return 0;
 }
diff --git a/tests/libebook/client/test-client.c b/tests/libebook/client/test-client.c
index 4d98005..ec54a8e 100644
--- a/tests/libebook/client/test-client.c
+++ b/tests/libebook/client/test-client.c
@@ -96,12 +96,18 @@ main (gint argc,
       gchar **argv)
 {
 	EBookClient *book_client;
+	ESourceRegistry *registry;
+	GError *error = NULL;
 
 	main_initialize ();
 
+	registry = e_source_registry_new_sync (NULL, &error);
+	if (error != NULL)
+		g_error ("%s", error->message);
+
 	printf ("loading addressbook\n");
 
-	book_client = open_system_book (FALSE);
+	book_client = open_system_book (registry, FALSE);
 	if (!book_client)
 		return 1;
 
diff --git a/tests/libebook/ebook-test-utils.c b/tests/libebook/ebook-test-utils.c
index 7b9c074..9cb3473 100644
--- a/tests/libebook/ebook-test-utils.c
+++ b/tests/libebook/ebook-test-utils.c
@@ -116,14 +116,16 @@ ebook_test_utils_book_add_contact (EBook *book,
 {
 	GError *error = NULL;
 
-	if (!e_book_add_contact (book, contact, &error)) {
-		const gchar *uri;
+        if (!e_book_add_contact (book, contact, &error)) {
+                ESource *source;
+                const gchar *name;
 
-		uri = e_book_get_uri (book);
+                source = e_book_get_source (book);
+                name = e_source_get_display_name (source);
                 g_warning ("failed to add contact to addressbook: `%s': %s",
-				uri, error->message);
-		exit (1);
-	}
+                                name, error->message);
+                exit (1);
+        }
 
 	return e_contact_get_const (contact, E_CONTACT_UID);
 }
@@ -172,16 +174,19 @@ ebook_test_utils_book_commit_contact (EBook *book,
 {
 	GError *error = NULL;
 
-	if (!e_book_commit_contact (book, contact, &error)) {
-		const gchar *uid;
-		const gchar *uri;
+        if (!e_book_commit_contact (book, contact, &error)) {
+                ESource *source;
+                const gchar *name;
+                const gchar *uid;
+
+                uid = (const gchar *) e_contact_get_const (contact, E_CONTACT_UID);
 
-		uid = (const gchar *) e_contact_get_const (contact, E_CONTACT_UID);
-		uri = e_book_get_uri (book);
+                source = e_book_get_source (book);
+                name = e_source_get_display_name (source);
                 g_warning ("failed to commit changes to contact '%s' to addressbook: `%s': %s",
-				uid, uri, error->message);
-		exit (1);
-	}
+                                uid, name, error->message);
+                exit (1);
+        }
 }
 
 static void
@@ -228,14 +233,16 @@ ebook_test_utils_book_get_contact (EBook *book,
 	EContact *contact = NULL;
 	GError *error = NULL;
 
-	if (!e_book_get_contact (book, uid, &contact, &error)) {
-		const gchar *uri;
+        if (!e_book_get_contact (book, uid, &contact, &error)) {
+                ESource *source;
+                const gchar *name;
 
-		uri = e_book_get_uri (book);
+                source = e_book_get_source (book);
+                name = e_source_get_display_name (source);
                 g_warning ("failed to get contact '%s' in addressbook: `%s': "
-                                "%s", uid, uri, error->message);
-		exit (1);
-	}
+                                "%s", uid, name, error->message);
+                exit (1);
+        }
 
 	return contact;
 }
@@ -289,14 +296,16 @@ ebook_test_utils_book_get_required_fields (EBook *book)
 	GList *fields = NULL;
 	GError *error = NULL;
 
-	if (!e_book_get_required_fields (book, &fields, &error)) {
-		const gchar *uri;
+        if (!e_book_get_required_fields (book, &fields, &error)) {
+                ESource *source;
+                const gchar *name;
 
-		uri = e_book_get_uri (book);
+                source = e_book_get_source (book);
+                name = e_source_get_display_name (source);
                 g_warning ("failed to get required fields for addressbook "
-                                "`%s': %s", uri, error->message);
-		exit (1);
-	}
+                                "`%s': %s", name, error->message);
+                exit (1);
+        }
 
 	return fields;
 }
@@ -347,14 +356,16 @@ ebook_test_utils_book_get_static_capabilities (EBook *book)
 	GError *error = NULL;
 	const gchar *caps;
 
-	if (!(caps = e_book_get_static_capabilities (book, &error))) {
-		const gchar *uri;
+        if (!(caps = e_book_get_static_capabilities (book, &error))) {
+                ESource *source;
+                const gchar *name;
 
-		uri = e_book_get_uri (book);
+                source = e_book_get_source (book);
+                name = e_source_get_display_name (source);
                 g_warning ("failed to get capabilities for addressbook: `%s': "
-                                "%s", uri, error->message);
-		exit (1);
-	}
+                                "%s", name, error->message);
+                exit (1);
+        }
 
 	return caps;
 }
@@ -365,14 +376,16 @@ ebook_test_utils_book_get_supported_auth_methods (EBook *book)
 	GList *fields = NULL;
 	GError *error = NULL;
 
-	if (!e_book_get_supported_auth_methods (book, &fields, &error)) {
-		const gchar *uri;
+        if (!e_book_get_supported_auth_methods (book, &fields, &error)) {
+                ESource *source;
+                const gchar *name;
 
-		uri = e_book_get_uri (book);
+                source = e_book_get_source (book);
+                name = e_source_get_display_name (source);
                 g_warning ("failed to get supported auth methods for "
-                                "addressbook `%s': %s", uri, error->message);
-		exit (1);
-	}
+                                "addressbook `%s': %s", name, error->message);
+                exit (1);
+        }
 
 	return fields;
 }
@@ -424,14 +437,16 @@ ebook_test_utils_book_get_supported_fields (EBook *book)
 	GList *fields = NULL;
 	GError *error = NULL;
 
-	if (!e_book_get_supported_fields (book, &fields, &error)) {
-		const gchar *uri;
+        if (!e_book_get_supported_fields (book, &fields, &error)) {
+                ESource *source;
+                const gchar *name;
 
-		uri = e_book_get_uri (book);
+                source = e_book_get_source (book);
+                name = e_source_get_display_name (source);
                 g_warning ("failed to get supported fields for addressbook "
-                                "`%s': %s", uri, error->message);
-		exit (1);
-	}
+                                "`%s': %s", name, error->message);
+                exit (1);
+        }
 
 	return fields;
 }
@@ -482,14 +497,16 @@ ebook_test_utils_book_remove_contact (EBook *book,
 {
 	GError *error = NULL;
 
-	if (!e_book_remove_contact (book, uid, &error)) {
-		const gchar *uri;
+        if (!e_book_remove_contact (book, uid, &error)) {
+                ESource *source;
+                const gchar *name;
 
-		uri = e_book_get_uri (book);
+                source = e_book_get_source (book);
+                name = e_source_get_display_name (source);
                 g_warning ("failed to remove contact '%s' from addressbook: `%s': %s",
-				uid, uri, error->message);
-		exit (1);
-	}
+                                uid, name, error->message);
+                exit (1);
+        }
 }
 
 static void
@@ -574,14 +591,16 @@ ebook_test_utils_book_remove_contacts (EBook *book,
 {
 	GError *error = NULL;
 
-	if (!e_book_remove_contacts (book, ids, &error)) {
-		const gchar *uri;
+        if (!e_book_remove_contacts (book, ids, &error)) {
+                ESource *source;
+                const gchar *name;
 
-		uri = e_book_get_uri (book);
+                source = e_book_get_source (book);
+                name = e_source_get_display_name (source);
                 g_warning ("failed to remove contacts from addressbook: `%s': %s",
-				uri, error->message);
-		exit (1);
-	}
+                                name, error->message);
+                exit (1);
+        }
 }
 
 static void
@@ -623,22 +642,6 @@ ebook_test_utils_book_async_remove_contacts (EBook *book,
 }
 
 EBook *
-ebook_test_utils_book_new_from_uri (const gchar *uri)
-{
-	EBook *book;
-	GError *error = NULL;
-
-	test_print ("loading addressbook\n");
-	book = e_book_new_from_uri (uri, &error);
-	if (!book) {
-                g_error ("failed to create addressbook: `%s': %s", uri,
-				error->message);
-	}
-
-	return book;
-}
-
-EBook *
 ebook_test_utils_book_new_temp (gchar **uri)
 {
 	EBook *book;
@@ -656,7 +659,9 @@ ebook_test_utils_book_new_temp (gchar **uri)
 	}
 	g_free (file_template);
 
-	book = ebook_test_utils_book_new_from_uri (uri_result);
+	/* FIXME We don't build EBooks from URIs anymore. */
+	/* book = ebook_test_utils_book_new_from_uri (uri_result); */
+	book = NULL;
 
 	if (uri)
                 *uri = g_strdup (uri_result);
@@ -673,79 +678,36 @@ ebook_test_utils_book_open (EBook *book,
 	GError *error = NULL;
 
 	if (!e_book_open (book, only_if_exists, &error)) {
-		const gchar *uri;
+		ESource *source;
+		const gchar *name;
 
-		uri = e_book_get_uri (book);
+		source = e_book_get_source (book);
+		name = e_source_get_display_name (source);
 
-                g_warning ("failed to open addressbook: `%s': %s", uri,
+                g_warning ("failed to open addressbook: `%s': %s", name,
 				error->message);
 		exit (1);
 	}
 }
 
 void
-ebook_test_utils_book_remove (EBook *book)
-{
-	GError *error = NULL;
-
-	if (!e_book_remove (book, &error)) {
-                g_warning ("failed to remove book; %s\n", error->message);
-		exit (1);
-	}
-        test_print ("successfully removed the temporary addressbook\n");
-
-	g_object_unref (book);
-}
-
-static void
-remove_cb (EBook *book,
-           const GError *error,
-           EBookTestClosure *closure)
-{
-	if (error) {
-                g_warning ("failed to asynchronously remove the book: "
-                                "status %d (%s)", error->code, error->message);
-		exit (1);
-	}
-
-        test_print ("successfully asynchronously removed the temporary "
-                        "addressbook\n");
-	if (closure)
-		(*closure->cb) (closure);
-}
-
-void
-ebook_test_utils_book_async_remove (EBook *book,
-                                    GSourceFunc callback,
-                                    gpointer user_data)
-{
-	EBookTestClosure *closure;
-
-	closure = g_new0 (EBookTestClosure, 1);
-	closure->cb = callback;
-	closure->user_data = user_data;
-	if (!e_book_remove_async (book, (EBookAsyncCallback) remove_cb, closure)) {
-                g_warning ("failed to set up book removal");
-		exit (1);
-	}
-}
-
-void
 ebook_test_utils_book_get_book_view (EBook *book,
                                      EBookQuery *query,
                                      EBookView **view)
 {
 	GError *error = NULL;
 
-	if (!e_book_get_book_view (book, query, NULL, -1, view, &error)) {
-		const gchar *uri;
+        if (!e_book_get_book_view (book, query, NULL, -1, view, &error)) {
+                ESource *source;
+                const gchar *name;
 
-		uri = e_book_get_uri (book);
+                source = e_book_get_source (book);
+                name = e_source_get_display_name (source);
 
-                g_warning ("failed to get view for addressbook: `%s': %s", uri,
-				error->message);
-		exit (1);
-	}
+                g_warning ("failed to get view for addressbook: `%s': %s",
+                                name, error->message);
+                exit (1);
+        }
 }
 
 static void
diff --git a/tests/libebook/ebook-test-utils.h b/tests/libebook/ebook-test-utils.h
index 78c2256..ad1be19 100644
--- a/tests/libebook/ebook-test-utils.h
+++ b/tests/libebook/ebook-test-utils.h
@@ -138,13 +138,6 @@ ebook_test_utils_book_open (EBook    *book,
                             gboolean  only_if_exists);
 
 void
-ebook_test_utils_book_remove (EBook *book);
-void
-ebook_test_utils_book_async_remove (EBook          *book,
-                                    GSourceFunc     callback,
-                                    gpointer        user_data);
-
-void
 ebook_test_utils_book_get_book_view (EBook       *book,
                                      EBookQuery  *query,
                                      EBookView  **view);
diff --git a/tests/libebook/test-changes.c b/tests/libebook/test-changes.c
index 49a8aac..424c5bf 100644
--- a/tests/libebook/test-changes.c
+++ b/tests/libebook/test-changes.c
@@ -61,7 +61,6 @@ main (gint argc,
 	e_book_free_change_list (changes);
 
 	g_object_unref (contact);
-	ebook_test_utils_book_remove (book);
 
 	return 0;
 }
diff --git a/tests/libebook/test-ebook-add-contact.c b/tests/libebook/test-ebook-add-contact.c
index 1cc86a5..d79719c 100644
--- a/tests/libebook/test-ebook-add-contact.c
+++ b/tests/libebook/test-ebook-add-contact.c
@@ -32,8 +32,6 @@ main (gint argc,
 	test_print ("successfully added and retrieved contact '%s'\n", uid);
 	g_object_unref (contact_final);
 
-	ebook_test_utils_book_remove (book);
-
 	/*
 	 * Async version
 	 */
@@ -49,7 +47,6 @@ main (gint argc,
 	g_free (uid);
 	g_main_loop_run (loop);
 
-	ebook_test_utils_book_remove (book);
 	g_free (vcard);
 
 	return 0;
diff --git a/tests/libebook/test-ebook-async.c b/tests/libebook/test-ebook-async.c
index 7ea42a8..7d3b018 100644
--- a/tests/libebook/test-ebook-async.c
+++ b/tests/libebook/test-ebook-async.c
@@ -97,6 +97,7 @@ gint
 main (gint argc,
       gchar **argv)
 {
+#if 0  /* ACCOUNT_MGMT */
 	EBook *book;
 
 	g_type_init ();
@@ -112,6 +113,7 @@ main (gint argc,
 	e_book_open_async (book, FALSE, book_loaded_cb, book);
 
 	g_main_loop_run (loop);
+#endif /* ACCOUNT_MGMT */
 
 	return 0;
 }
diff --git a/tests/libebook/test-ebook-commit-contact.c b/tests/libebook/test-ebook-commit-contact.c
index a04e37a..0fcf16c 100644
--- a/tests/libebook/test-ebook-commit-contact.c
+++ b/tests/libebook/test-ebook-commit-contact.c
@@ -74,8 +74,6 @@ main (gint argc,
 	g_object_unref (contact);
 	g_free (uid);
 
-	ebook_test_utils_book_remove (book);
-
 	/*
 	 * Async version
 	 */
@@ -92,7 +90,6 @@ main (gint argc,
 	g_main_loop_run (loop);
 
 	g_free (uid);
-	ebook_test_utils_book_remove (book);
 
 	return 0;
 }
diff --git a/tests/libebook/test-ebook-get-book-view.c b/tests/libebook/test-ebook-get-book-view.c
index 9dec7e4..3c78074 100644
--- a/tests/libebook/test-ebook-get-book-view.c
+++ b/tests/libebook/test-ebook-get-book-view.c
@@ -114,8 +114,7 @@ main (gint argc,
 	loop = g_main_loop_new (NULL, TRUE);
 	g_main_loop_run (loop);
 
-	e_book_query_unref (query);
-	ebook_test_utils_book_remove (book);
+        e_book_query_unref (query);
 
 	/*
 	 * Async version
@@ -129,8 +128,7 @@ main (gint argc,
 
 	g_main_loop_run (loop);
 
-	e_book_query_unref (query);
-	ebook_test_utils_book_remove (book);
+        e_book_query_unref (query);
 
 	return 0;
 }
diff --git a/tests/libebook/test-ebook-get-contact.c b/tests/libebook/test-ebook-get-contact.c
index d476022..0bb2005 100644
--- a/tests/libebook/test-ebook-get-contact.c
+++ b/tests/libebook/test-ebook-get-contact.c
@@ -39,7 +39,5 @@ main (gint argc,
 
 	g_main_loop_run (loop);
 
-	ebook_test_utils_book_remove (book);
-
 	return 0;
 }
diff --git a/tests/libebook/test-ebook-get-required-fields.c b/tests/libebook/test-ebook-get-required-fields.c
index f66ac55..6c3cea3 100644
--- a/tests/libebook/test-ebook-get-required-fields.c
+++ b/tests/libebook/test-ebook-get-required-fields.c
@@ -71,7 +71,5 @@ main (gint argc,
 
 	g_main_loop_run (loop);
 
-	ebook_test_utils_book_remove (book);
-
 	return 0;
 }
diff --git a/tests/libebook/test-ebook-get-static-capabilities.c b/tests/libebook/test-ebook-get-static-capabilities.c
index fe553eb..f9a8500 100644
--- a/tests/libebook/test-ebook-get-static-capabilities.c
+++ b/tests/libebook/test-ebook-get-static-capabilities.c
@@ -27,7 +27,5 @@ main (gint argc,
 
 	test_print ("successfully retrieved static capabilities: '%s'\n", caps);
 
-	ebook_test_utils_book_remove (book);
-
 	return 0;
 }
diff --git a/tests/libebook/test-ebook-get-supported-auth-methods.c b/tests/libebook/test-ebook-get-supported-auth-methods.c
index 49f05f1..9248478 100644
--- a/tests/libebook/test-ebook-get-supported-auth-methods.c
+++ b/tests/libebook/test-ebook-get-supported-auth-methods.c
@@ -71,7 +71,5 @@ main (gint argc,
 
 	g_main_loop_run (loop);
 
-	ebook_test_utils_book_remove (book);
-
 	return 0;
 }
diff --git a/tests/libebook/test-ebook-get-supported-fields.c b/tests/libebook/test-ebook-get-supported-fields.c
index 7213235..d2b576d 100644
--- a/tests/libebook/test-ebook-get-supported-fields.c
+++ b/tests/libebook/test-ebook-get-supported-fields.c
@@ -71,7 +71,5 @@ main (gint argc,
 
 	g_main_loop_run (loop);
 
-	ebook_test_utils_book_remove (book);
-
 	return 0;
 }
diff --git a/tests/libebook/test-ebook-remove-contact-by-id.c b/tests/libebook/test-ebook-remove-contact-by-id.c
index 35bc3ac..faa76c9 100644
--- a/tests/libebook/test-ebook-remove-contact-by-id.c
+++ b/tests/libebook/test-ebook-remove-contact-by-id.c
@@ -28,7 +28,6 @@ main (gint argc,
 
 	g_main_loop_run (loop);
 
-	ebook_test_utils_book_remove (book);
 	g_free (uid);
 
 	return 0;
diff --git a/tests/libebook/test-ebook-remove-contact.c b/tests/libebook/test-ebook-remove-contact.c
index 4c0f9a0..69d09a2 100644
--- a/tests/libebook/test-ebook-remove-contact.c
+++ b/tests/libebook/test-ebook-remove-contact.c
@@ -32,8 +32,7 @@ main (gint argc,
 	g_assert (contact_final == NULL);
         test_print ("successfully added and removed contact '%s'\n", uid);
 
-	ebook_test_utils_book_remove (book);
-	g_free (uid);
+        g_free (uid);
 
         /*
          * Async version
@@ -52,7 +51,6 @@ main (gint argc,
 
 	g_main_loop_run (loop);
 
-	ebook_test_utils_book_remove (book);
 	g_object_unref (contact_final);
 	g_free (uid);
 
diff --git a/tests/libebook/test-ebook-remove-contacts.c b/tests/libebook/test-ebook-remove-contacts.c
index 1e26917..c4d0e27 100644
--- a/tests/libebook/test-ebook-remove-contacts.c
+++ b/tests/libebook/test-ebook-remove-contacts.c
@@ -40,9 +40,8 @@ main (gint argc,
 
         test_print ("successfully added and removed contacts\n");
 
-	ebook_test_utils_book_remove (book);
-	g_free (uid_1);
-	g_free (uid_2);
+        g_free (uid_1);
+        g_free (uid_2);
 	g_list_free (uids);
 
         /*
@@ -63,9 +62,8 @@ main (gint argc,
 
 	g_main_loop_run (loop);
 
-	ebook_test_utils_book_remove (book);
-	g_free (uid_1);
-	g_free (uid_2);
+        g_free (uid_1);
+        g_free (uid_2);
 	g_list_free (uids);
 
 	return 0;
diff --git a/tests/libebook/test-ebook-remove.c b/tests/libebook/test-ebook-remove.c
index 978df54..876e62a 100644
--- a/tests/libebook/test-ebook-remove.c
+++ b/tests/libebook/test-ebook-remove.c
@@ -18,7 +18,6 @@ main (gint argc,
 	/* Sync version */
 	book = ebook_test_utils_book_new_temp (&uri);
 	ebook_test_utils_book_open (book, FALSE);
-	ebook_test_utils_book_remove (book);
 
 	/* Async version */
 	book = ebook_test_utils_book_new_temp (&uri);
diff --git a/tests/libebook/test-ebook-stress-factory--fifo.c b/tests/libebook/test-ebook-stress-factory--fifo.c
index f020dba..5b45955 100644
--- a/tests/libebook/test-ebook-stress-factory--fifo.c
+++ b/tests/libebook/test-ebook-stress-factory--fifo.c
@@ -26,9 +26,5 @@ main (gint argc,
 		g_free (uri);
 	}
 
-	for (i = 0; i < NUM_BOOKS; i++) {
-		ebook_test_utils_book_remove (books[i]);
-	}
-
 	return 0;
 }
diff --git a/tests/libebook/test-ebook-stress-factory--serial.c b/tests/libebook/test-ebook-stress-factory--serial.c
index afbddf6..4086bd6 100644
--- a/tests/libebook/test-ebook-stress-factory--serial.c
+++ b/tests/libebook/test-ebook-stress-factory--serial.c
@@ -21,7 +21,6 @@ main (gint argc,
 
 		book = ebook_test_utils_book_new_temp (&uri);
 		ebook_test_utils_book_open (book, FALSE);
-		ebook_test_utils_book_remove (book);
 
 		g_free (uri);
 	}
diff --git a/tests/libebook/test-ebook-stress-factory--single-book.c b/tests/libebook/test-ebook-stress-factory--single-book.c
index 136113f..6d54f83 100644
--- a/tests/libebook/test-ebook-stress-factory--single-book.c
+++ b/tests/libebook/test-ebook-stress-factory--single-book.c
@@ -27,9 +27,6 @@ main (gint argc,
 		g_object_unref (book);
 	}
 
-	book = ebook_test_utils_book_new_from_uri (uri);
-	ebook_test_utils_book_remove (book);
-
 	g_free (uri);
 
 	return 0;
diff --git a/tests/libebook/test-ebook.c b/tests/libebook/test-ebook.c
index 2383364..e9a0d0b 100644
--- a/tests/libebook/test-ebook.c
+++ b/tests/libebook/test-ebook.c
@@ -74,6 +74,7 @@ gint
 main (gint argc,
       gchar **argv)
 {
+#if 0  /* ACCOUNT_MGMT */
 	EBook *book;
 
 	g_type_init ();
@@ -98,6 +99,7 @@ main (gint argc,
 	print_all_emails (book);
 
 	g_object_unref (book);
+#endif /* ACCOUNT_MGMT */
 
 	return 0;
 }
diff --git a/tests/libebook/test-nonexistent-id.c b/tests/libebook/test-nonexistent-id.c
index 821fb5c..32dfaae 100644
--- a/tests/libebook/test-nonexistent-id.c
+++ b/tests/libebook/test-nonexistent-id.c
@@ -1,7 +1,10 @@
+#include <stdlib.h>
 #include <libebook/e-book.h>
 
-gint main (gint argc, gchar **argv)
+gint
+main (gint argc, gchar **argv)
 {
+#if 0  /* ACCOUNT_MGMT */
 	GError *err = NULL;
 	EBook *book = NULL;
 
@@ -22,6 +25,7 @@ gint main (gint argc, gchar **argv)
 		printf ("error %d removing contact: %s\n", err->code, err->message);
 		g_clear_error (&err);
 	}
+#endif /* ACCOUNT_MGMT */
 
 	return 0;
 }
diff --git a/tests/libebook/test-search.c b/tests/libebook/test-search.c
index cf309d0..0b1da27 100644
--- a/tests/libebook/test-search.c
+++ b/tests/libebook/test-search.c
@@ -7,6 +7,7 @@ gint
 main (gint argc,
       gchar **argv)
 {
+#if 0  /* ACCOUNT_MGMT */
 	EBook *book;
 	gboolean status;
 	EBookQuery *query;
@@ -54,6 +55,7 @@ main (gint argc,
 	g_list_free (contacts);
 
 	g_object_unref (book);
+#endif /* ACCOUNT_MGMT */
 
 	return 0;
 }
diff --git a/tests/libebook/test-self.c b/tests/libebook/test-self.c
index 0a875ac..c456eb7 100644
--- a/tests/libebook/test-self.c
+++ b/tests/libebook/test-self.c
@@ -7,6 +7,7 @@ gint
 main (gint argc,
       gchar **argv)
 {
+#if 0  /* ACCOUNT_MGMT */
 	EBook *book;
 	EContact *contact;
 	GError *error = NULL;
@@ -28,6 +29,7 @@ main (gint argc,
 
 	g_object_unref (contact);
 	g_object_unref (book);
+#endif /* ACCOUNT_MGMT */
 
 	return 0;
 }
diff --git a/tests/libebook/test-stress-bookviews.c b/tests/libebook/test-stress-bookviews.c
index 1048813..022629c 100644
--- a/tests/libebook/test-stress-bookviews.c
+++ b/tests/libebook/test-stress-bookviews.c
@@ -56,6 +56,7 @@ gint
 main (gint argc,
       gchar **argv)
 {
+#if 0  /* ACCOUNT_MGMT */
 	EBook *book;
 	gboolean status;
 	EBookQuery *query;
@@ -106,6 +107,7 @@ main (gint argc,
 
 	e_book_query_unref (query);
 	g_object_unref (book);
+#endif /* ACCOUNT_MGMT */
 
 	return 0;
 }



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