[evolution-data-server/account-mgmt: 14/41] Adapt libebook to the new ESource API.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/account-mgmt: 14/41] Adapt libebook to the new ESource API.
- Date: Sat, 26 May 2012 17:32:26 +0000 (UTC)
commit 0991a2a806d3cee5bd079b18f9351c64fd82304a
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 | 295 +--------
addressbook/libebook/e-book-client.h | 12 +-
addressbook/libebook/e-book.c | 688 +-------------------
addressbook/libebook/e-book.h | 38 +-
.../addressbook/libebook/libebook-sections.txt | 16 -
tests/libebook/client/client-test-utils.c | 88 +--
tests/libebook/client/client-test-utils.h | 6 +-
tests/libebook/client/test-client-async.c | 4 +
tests/libebook/client/test-client-examine.c | 48 +-
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-bulk-methods.c | 2 +
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 +
40 files changed, 239 insertions(+), 1289 deletions(-)
---
diff --git a/addressbook/libebook/e-book-client.c b/addressbook/libebook/e-book-client.c
index 9622696..01c4ce3 100644
--- a/addressbook/libebook/e-book-client.c
+++ b/addressbook/libebook/e-book-client.c
@@ -30,6 +30,7 @@
#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"
@@ -395,25 +396,6 @@ online_cb (EGdbusBook *object,
}
static void
-auth_required_cb (EGdbusBook *object,
- const gchar * const *credentials_strv,
- EBookClient *client)
-{
- ECredentials *credentials;
-
- 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);
-}
-
-static void
opened_cb (EGdbusBook *object,
const gchar * const *error_strv,
EBookClient *client)
@@ -491,7 +473,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);
@@ -512,21 +494,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);
@@ -535,9 +509,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,
@@ -574,229 +545,12 @@ e_book_client_new (ESource *source,
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);
g_signal_connect (client->priv->gdbus_book, "opened", G_CALLBACK (opened_cb), client);
g_signal_connect (client->priv->gdbus_book, "backend-property-changed", G_CALLBACK (backend_property_changed_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_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 (E_IS_BOOK_CLIENT (client), 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_get_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 *
@@ -838,6 +592,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
@@ -850,18 +605,24 @@ 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 (E_IS_BOOK_CLIENT (client), FALSE);
- *client = e_book_client_new_system (&local_error);
+ source = e_source_registry_ref_builtin_address_book (registry);
+ *client = e_book_client_new (source, &local_error);
+ g_object_unref (source);
+
if (!*client) {
g_propagate_error (error, local_error);
return FALSE;
@@ -2623,35 +2384,6 @@ book_client_unwrap_dbus_error (EClient *client,
}
static void
-book_client_handle_authentication (EClient *client,
- const ECredentials *credentials)
-{
- EBookClient *book_client;
- GError *error = NULL;
- gchar **strv;
-
- g_return_if_fail (E_IS_BOOK_CLIENT (client));
- g_return_if_fail (credentials != NULL);
-
- book_client = E_BOOK_CLIENT (client);
-
- 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 void
book_client_retrieve_capabilities (EClient *client,
GCancellable *cancellable,
GAsyncReadyCallback callback,
@@ -2737,7 +2469,6 @@ e_book_client_class_init (EBookClientClass *class)
client_class = E_CLIENT_CLASS (class);
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->retrieve_capabilities_finish = book_client_retrieve_capabilities_finish;
client_class->retrieve_capabilities_sync = book_client_retrieve_capabilities_sync;
diff --git a/addressbook/libebook/e-book-client.h b/addressbook/libebook/e-book-client.h
index 3ebac76..aaf592c 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 7b51b1c..caa16b4 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"
@@ -81,7 +82,6 @@ struct _EBookPrivate {
guint gone_signal_id;
ESource *source;
- gchar *uri;
gboolean loaded;
gboolean writable;
gboolean connected;
@@ -201,9 +201,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);
@@ -240,15 +237,6 @@ e_book_class_init (EBookClass *e_book_class)
G_TYPE_NONE, 1,
G_TYPE_BOOLEAN);
- e_book_signals[AUTH_REQUIRED] =
- g_signal_new ("auth_required",
- G_OBJECT_CLASS_TYPE (gobject_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EBookClass, auth_required),
- NULL, NULL,
- e_book_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
e_book_signals[BACKEND_DIED] =
g_signal_new ("backend_died",
G_OBJECT_CLASS_TYPE (gobject_class),
@@ -275,7 +263,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;
@@ -397,16 +384,6 @@ online_cb (EGdbusBook *object,
g_signal_emit (G_OBJECT (book), e_book_signals[CONNECTION_STATUS], 0, is_online);
}
-static void
-auth_required_cb (EGdbusBook *object,
- const ECredentials *credentials,
- EBook *book)
-{
- g_return_if_fail (E_IS_BOOK (book));
-
- g_signal_emit (G_OBJECT (book), e_book_signals[AUTH_REQUIRED], 0);
-}
-
/**
* e_book_add_contact:
* @book: an #EBook
@@ -1199,200 +1176,6 @@ e_book_get_supported_auth_methods_async (EBook *book,
}
/**
- * e_book_authenticate_user:
- * @book: an #EBook
- * @user: a string
- * @passwd: a string
- * @auth_method: a string
- * @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.
- *
- * Returns: %TRUE if successful, %FALSE otherwise
- *
- * Deprecated: 3.2: Connect to EClient::authenticate signal instead.
- **/
-gboolean
-e_book_authenticate_user (EBook *book,
- const gchar *user,
- const gchar *passwd,
- const gchar *auth_method,
- GError **error)
-{
- GError *err = 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);
-
- 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_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);
-}
-
-static void
-authenticate_user_reply (GObject *gdbus_book,
- GAsyncResult *res,
- gpointer user_data)
-{
- GError *err = NULL, *error = NULL;
- AsyncData *data = user_data;
- EBookAsyncCallback excb = data->excallback;
- EBookCallback cb = data->callback;
-
- e_gdbus_book_call_authenticate_user_finish (G_DBUS_PROXY (gdbus_book), res, &error);
-
- unwrap_gerror (error, &err);
-
- if (cb)
- cb (data->book, err ? err->code : E_BOOK_ERROR_OK, data->closure);
- if (excb)
- excb (data->book, err, data->closure);
-
- if (err)
- g_error_free (err);
-
- g_object_unref (data->book);
- g_slice_free (AsyncData, data);
-}
-
-/**
- * e_book_async_authenticate_user:
- * @book: an #EBook
- * @user: user name
- * @passwd: password
- * @auth_method: string indicating authentication method
- * @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.
- * This function does not block.
- *
- * Returns: %FALSE if successful, %TRUE otherwise.
- *
- * Deprecated: 3.0: Use e_book_authenticate_user_async() instead.
- **/
-gboolean
-e_book_async_authenticate_user (EBook *book,
- const gchar *user,
- const gchar *passwd,
- const gchar *auth_method,
- EBookCallback cb,
- gpointer closure)
-{
- AsyncData *data;
- ECredentials *credentials;
- gchar **credentials_strv;
-
- g_return_val_if_fail (E_IS_BOOK (book), FALSE);
- g_return_val_if_fail (user != NULL, FALSE);
- g_return_val_if_fail (passwd != NULL, FALSE);
- g_return_val_if_fail (auth_method != NULL, FALSE);
-
- e_return_async_error_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;
-
- 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_strfreev (credentials_strv);
- e_credentials_free (credentials);
-
- return TRUE;
-}
-
-/**
- * e_book_authenticate_user_async:
- * @book: an #EBook
- * @user: user name
- * @passwd: password
- * @auth_method: string indicating authentication method
- * @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.
- * This function does not block.
- *
- * 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,
- const gchar *user,
- const gchar *passwd,
- const gchar *auth_method,
- EBookAsyncCallback cb,
- gpointer closure)
-{
- AsyncData *data;
- ECredentials *credentials;
- gchar **credentials_strv;
-
- g_return_val_if_fail (E_IS_BOOK (book), FALSE);
- g_return_val_if_fail (user != NULL, FALSE);
- g_return_val_if_fail (passwd != NULL, FALSE);
- g_return_val_if_fail (auth_method != NULL, FALSE);
-
- e_return_ex_async_error_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;
-
- 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_strfreev (credentials_strv);
- e_credentials_free (credentials);
-
- return TRUE;
-}
-
-/**
* e_book_get_contact:
* @book: an #EBook
* @id: a unique string ID specifying the contact
@@ -2805,24 +2588,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
*
@@ -2999,6 +2764,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
@@ -3011,16 +2777,22 @@ 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_ref_builtin_address_book (registry);
+ *book = e_book_new (source, &e);
+ g_object_unref (source);
if (!*book) {
if (error)
@@ -3131,130 +2903,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_get_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
@@ -3274,7 +2922,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);
@@ -3290,14 +2938,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);
@@ -3305,8 +2950,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,
@@ -3340,311 +2983,6 @@ e_book_new (ESource *source,
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;
-}
-
-/* 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;
}
diff --git a/addressbook/libebook/e-book.h b/addressbook/libebook/e-book.h
index 70673ef..9f13dfb 100644
--- a/addressbook/libebook/e-book.h
+++ b/addressbook/libebook/e-book.h
@@ -15,8 +15,7 @@
#ifndef E_BOOK_DISABLE_DEPRECATED
#include <libedataserver/e-list.h>
-#include <libedataserver/e-source.h>
-#include <libedataserver/e-source-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>
@@ -112,7 +111,6 @@ struct _EBookClass {
*/
void (* writable_status) (EBook *book, gboolean writable);
void (* connection_status) (EBook *book, gboolean connected);
- void (* auth_required) (EBook *book);
void (* backend_died) (EBook *book);
/* Padding for future expansion */
@@ -125,9 +123,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,
@@ -200,29 +195,6 @@ gboolean e_book_get_supported_auth_methods_async (EBook *book,
EBookEListAsyncCallback cb,
gpointer closure);
-/* User authentication. */
-gboolean e_book_authenticate_user (EBook *book,
- const gchar *user,
- const gchar *passwd,
- const gchar *auth_method,
- GError **error);
-
-#ifndef E_BOOK_DISABLE_DEPRECATED
-gboolean e_book_async_authenticate_user (EBook *book,
- const gchar *user,
- const gchar *passwd,
- const gchar *auth_method,
- EBookCallback cb,
- gpointer closure);
-#endif
-
-gboolean e_book_authenticate_user_async (EBook *book,
- const gchar *user,
- const gchar *passwd,
- const gchar *auth_method,
- EBookAsyncCallback cb,
- gpointer closure);
-
/* Fetching contacts. */
gboolean e_book_get_contact (EBook *book,
const gchar *id,
@@ -378,7 +350,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 +369,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/docs/reference/addressbook/libebook/libebook-sections.txt b/docs/reference/addressbook/libebook/libebook-sections.txt
index ede2423..aeaed44 100644
--- a/docs/reference/addressbook/libebook/libebook-sections.txt
+++ b/docs/reference/addressbook/libebook/libebook-sections.txt
@@ -23,11 +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
@@ -36,7 +31,6 @@ e_book_get_required_fields
e_book_get_source
e_book_is_online
e_book_is_opened
-e_book_authenticate_user
e_book_get_contact
e_book_remove_contact
e_book_remove_contacts
@@ -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
@@ -79,7 +71,6 @@ 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
e_book_get_contact_async
e_book_get_contacts_async
e_book_remove_contact_async
@@ -94,7 +85,6 @@ 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
e_book_async_get_contact
e_book_async_get_contacts
e_book_async_remove_contact
@@ -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/tests/libebook/client/client-test-utils.c b/tests/libebook/client/client-test-utils.c
index fd73dc6..289a969 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 <libedataserver/e-source-address-book.h>
#include <libedataserver/e-gdbus-templates.h>
@@ -38,14 +41,19 @@ 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_ref_builtin_address_book (registry);
+ book_client = e_book_client_new (source, &error);
+ g_object_unref (source);
+
if (error) {
report_error ("create system addressbook", &error);
return NULL;
@@ -208,7 +216,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;
@@ -217,7 +226,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;
@@ -226,54 +235,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;
+ async_data->list = list;
- if (foreach_configured_source_async_next (&ad, source))
- return ad;
-
- return NULL;
- }
-
- 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;
+ *source = async_data->list->data;
return async_data;
}
@@ -289,28 +273,16 @@ 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;
+ if (async_data->list) {
+ g_object_unref (async_data->list->data);
+ async_data->list = async_data->list->next;
}
-
- 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) {
+ *source = async_data->list->data;
return TRUE;
}
- g_object_unref (async_data->source_list);
g_free (async_data);
*foreach_async_data = NULL;
@@ -321,6 +293,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;
@@ -353,6 +326,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 e394bbe..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);
+ uid = e_source_get_uid (source);
name = e_source_get_display_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 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 5e3ed8e..a49aac4 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;
}
@@ -423,14 +436,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;
}
@@ -480,14 +495,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
@@ -572,14 +589,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
@@ -621,22 +640,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;
@@ -654,7 +657,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);
@@ -671,79 +676,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->cb)
- (*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-bulk-methods.c b/tests/libebook/test-bulk-methods.c
index 935bd91..be96521 100644
--- a/tests/libebook/test-bulk-methods.c
+++ b/tests/libebook/test-bulk-methods.c
@@ -168,6 +168,7 @@ test_bulk_modify (EBookClient *client,
gint main (gint argc, gchar **argv)
{
+#if 0 /* ACCOUNT_MGMT */
EBookClient *client = NULL;
const gchar
*test_vcard_str =
@@ -196,6 +197,7 @@ gint main (gint argc, gchar **argv)
g_print ("Passed.\n");
g_object_unref (client);
+#endif /* ACCOUNT_MGMT */
return 0;
}
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]