[evolution-data-server/openismus-work: 27/52] client-test-utils.c: Modified to use the ESourceDirectAccess extension to setup the test case books
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/openismus-work: 27/52] client-test-utils.c: Modified to use the ESourceDirectAccess extension to setup the test case books
- Date: Thu, 22 Nov 2012 04:05:05 +0000 (UTC)
commit 765100d4c5632339c2c3e59cd5bf70cca809a844
Author: Tristan Van Berkom <tristanvb openismus com>
Date: Tue Nov 6 16:18:56 2012 +0900
client-test-utils.c: Modified to use the ESourceDirectAccess extension to setup the test case books to use direct access.
tests/libebook/client/Makefile.am | 1 +
tests/libebook/client/client-test-utils.c | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/tests/libebook/client/Makefile.am b/tests/libebook/client/Makefile.am
index 72c4b21..4831265 100644
--- a/tests/libebook/client/Makefile.am
+++ b/tests/libebook/client/Makefile.am
@@ -8,6 +8,7 @@ libclient_test_utils_la_CPPFLAGS = \
-I$(top_builddir) \
-I$(top_srcdir)/addressbook \
-I$(top_builddir)/addressbook \
+ -DBACKENDDIR=\"$(ebook_backenddir)\" \
-DSRCDIR=\""$(srcdir)"\" \
$(EVOLUTION_ADDRESSBOOK_CFLAGS) \
$(CAMEL_CFLAGS) \
diff --git a/tests/libebook/client/client-test-utils.c b/tests/libebook/client/client-test-utils.c
index 3d85f93..30553ef 100644
--- a/tests/libebook/client/client-test-utils.c
+++ b/tests/libebook/client/client-test-utils.c
@@ -7,6 +7,12 @@
#include "client-test-utils.h"
+/* This forces the GType to be registered in a way that
+ * avoids a "statement with no effect" compiler warning.
+ * FIXME Use g_type_ensure() once we require GLib 2.34. */
+#define REGISTER_TYPE(type) \
+ (g_type_class_unref (g_type_class_ref (type)))
+
void
report_error (const gchar *operation,
GError **error)
@@ -329,6 +335,8 @@ register_source_idle (CreateBookData *data)
{
GError *error = NULL;
ESourceBackend *backend;
+ ESourceDirectAccess *direct;
+ gchar *backend_path;
data->registry = e_source_registry_new_sync (NULL, &error);
if (!data->registry)
@@ -341,6 +349,14 @@ register_source_idle (CreateBookData *data)
backend = e_source_get_extension (data->scratch, E_SOURCE_EXTENSION_ADDRESS_BOOK);
e_source_backend_set_backend_name (backend, "local");
+ /* Configure for direct access */
+ REGISTER_TYPE (E_TYPE_SOURCE_DIRECT_ACCESS);
+ direct = e_source_get_extension (data->scratch, E_SOURCE_EXTENSION_DIRECT_ACCESS);
+ backend_path = g_build_filename (BACKENDDIR, "libebookbackendfile.so", NULL);
+ e_source_direct_access_set_backend_path (direct, backend_path);
+ e_source_direct_access_set_backend_name (direct, "EBookBackendFileFactory");
+ g_free (backend_path);
+
if (!e_source_registry_commit_source_sync (data->registry, data->scratch, NULL, &error))
g_error ("Unable to add new source to the registry for uid %s: %s", data->uid, error->message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]