[evolution-data-server/openismus-work: 19/52] First mega-patch in libebook --> libebook-contacts split/migration
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/openismus-work: 19/52] First mega-patch in libebook --> libebook-contacts split/migration
- Date: Thu, 22 Nov 2012 04:28:40 +0000 (UTC)
commit ea9b5794b1f3e007b63323fa8b6586a9dfe4ae83
Author: Tristan Van Berkom <tristanvb openismus com>
Date: Mon Nov 12 16:54:16 2012 +0900
First mega-patch in libebook --> libebook-contacts split/migration
addressbook/Makefile.am | 2 +-
addressbook/backends/file/Makefile.am | 1 +
addressbook/backends/google/Makefile.am | 1 +
addressbook/backends/ldap/Makefile.am | 1 +
addressbook/backends/vcf/Makefile.am | 1 +
addressbook/backends/webdav/Makefile.am | 1 +
.../e-address-western.c | 0
.../e-address-western.h | 0
.../{libebook => libebook-contacts}/e-book-query.c | 0
.../{libebook => libebook-contacts}/e-book-query.h | 0
.../{libebook => libebook-contacts}/e-contact.c | 0
.../{libebook => libebook-contacts}/e-contact.h | 0
.../e-name-western-tables.h | 0
.../e-name-western-tables.h.in | 0
.../e-name-western.c | 0
.../e-name-western.h | 0
.../{libebook => libebook-contacts}/e-vcard.c | 0
.../{libebook => libebook-contacts}/e-vcard.h | 0
.../gen-western-table.py | 0
addressbook/libebook/Makefile.am | 20 +---
addressbook/libebook/e-book-client.c | 132 ++++++++++++++------
addressbook/libebook/e-book-client.h | 2 +-
addressbook/libebook/e-book-types.h | 58 +---------
addressbook/libebook/e-book.c | 2 -
addressbook/libebook/e-book.h | 3 +-
addressbook/libebook/e-destination.h | 2 +-
.../libebook/e-source-address-book-config.h | 2 +-
addressbook/libebook/libebook.h | 5 -
addressbook/libedata-book/Makefile.am | 2 +-
addressbook/libedata-book/e-data-book.c | 62 +++++++++
addressbook/libedata-book/e-data-book.h | 1 +
configure.ac | 9 ++
32 files changed, 182 insertions(+), 125 deletions(-)
---
diff --git a/addressbook/Makefile.am b/addressbook/Makefile.am
index f61358d..62414f6 100644
--- a/addressbook/Makefile.am
+++ b/addressbook/Makefile.am
@@ -1,3 +1,3 @@
-SUBDIRS = libegdbus libebook libedata-book backends
+SUBDIRS = libegdbus libebook-contacts libedata-book libebook backends
-include $(top_srcdir)/git.mk
diff --git a/addressbook/backends/file/Makefile.am b/addressbook/backends/file/Makefile.am
index 92ca13d..de53c5d 100644
--- a/addressbook/backends/file/Makefile.am
+++ b/addressbook/backends/file/Makefile.am
@@ -21,6 +21,7 @@ libebookbackendfile_la_SOURCES = \
e-book-backend-file-factory.c
libebookbackendfile_la_LIBADD = \
+ $(top_builddir)/addressbook/libebook-contacts/libebook-contacts-1.2.la \
$(top_builddir)/addressbook/libebook/libebook-1.2.la \
$(top_builddir)/addressbook/libedata-book/libedata-book-1.2.la \
$(top_builddir)/libedataserver/libedataserver-1.2.la \
diff --git a/addressbook/backends/google/Makefile.am b/addressbook/backends/google/Makefile.am
index 0138234..4d79155 100644
--- a/addressbook/backends/google/Makefile.am
+++ b/addressbook/backends/google/Makefile.am
@@ -33,6 +33,7 @@ libebookbackendgoogle_la_SOURCES = \
$(GOA_SOURCES)
libebookbackendgoogle_la_LIBADD = \
+ $(top_builddir)/addressbook/libebook-contacts/libebook-contacts-1.2.la \
$(top_builddir)/addressbook/libedata-book/libedata-book-1.2.la \
$(top_builddir)/addressbook/libebook/libebook-1.2.la \
$(top_builddir)/libedataserver/libedataserver-1.2.la \
diff --git a/addressbook/backends/ldap/Makefile.am b/addressbook/backends/ldap/Makefile.am
index 5effe35..c0d9c7a 100644
--- a/addressbook/backends/ldap/Makefile.am
+++ b/addressbook/backends/ldap/Makefile.am
@@ -21,6 +21,7 @@ libebookbackendldap_la_SOURCES = \
e-source-ldap.h
libebookbackendldap_la_LIBADD = \
+ $(top_builddir)/addressbook/libebook-contacts/libebook-contacts-1.2.la \
$(top_builddir)/addressbook/libebook/libebook-1.2.la \
$(top_builddir)/addressbook/libedata-book/libedata-book-1.2.la \
$(top_builddir)/libedataserver/libedataserver-1.2.la \
diff --git a/addressbook/backends/vcf/Makefile.am b/addressbook/backends/vcf/Makefile.am
index 321dcd0..6e04de7 100644
--- a/addressbook/backends/vcf/Makefile.am
+++ b/addressbook/backends/vcf/Makefile.am
@@ -20,6 +20,7 @@ libebookbackendvcf_la_SOURCES = \
e-source-vcf.h
libebookbackendvcf_la_LIBADD = \
+ $(top_builddir)/addressbook/libebook-contacts/libebook-contacts-1.2.la \
$(top_builddir)/addressbook/libebook/libebook-1.2.la \
$(top_builddir)/addressbook/libedata-book/libedata-book-1.2.la \
$(top_builddir)/libedataserver/libedataserver-1.2.la \
diff --git a/addressbook/backends/webdav/Makefile.am b/addressbook/backends/webdav/Makefile.am
index 4c6d554..58ded89 100644
--- a/addressbook/backends/webdav/Makefile.am
+++ b/addressbook/backends/webdav/Makefile.am
@@ -19,6 +19,7 @@ libebookbackendwebdav_la_SOURCES = \
e-book-backend-webdav.c
libebookbackendwebdav_la_LIBADD = \
+ $(top_builddir)/addressbook/libebook-contacts/libebook-contacts-1.2.la \
$(top_builddir)/addressbook/libebook/libebook-1.2.la \
$(top_builddir)/addressbook/libedata-book/libedata-book-1.2.la \
$(top_builddir)/libedataserver/libedataserver-1.2.la \
diff --git a/addressbook/libebook/e-address-western.c b/addressbook/libebook-contacts/e-address-western.c
similarity index 100%
rename from addressbook/libebook/e-address-western.c
rename to addressbook/libebook-contacts/e-address-western.c
diff --git a/addressbook/libebook/e-address-western.h b/addressbook/libebook-contacts/e-address-western.h
similarity index 100%
rename from addressbook/libebook/e-address-western.h
rename to addressbook/libebook-contacts/e-address-western.h
diff --git a/addressbook/libebook/e-book-query.c b/addressbook/libebook-contacts/e-book-query.c
similarity index 100%
rename from addressbook/libebook/e-book-query.c
rename to addressbook/libebook-contacts/e-book-query.c
diff --git a/addressbook/libebook/e-book-query.h b/addressbook/libebook-contacts/e-book-query.h
similarity index 100%
rename from addressbook/libebook/e-book-query.h
rename to addressbook/libebook-contacts/e-book-query.h
diff --git a/addressbook/libebook/e-contact.c b/addressbook/libebook-contacts/e-contact.c
similarity index 100%
rename from addressbook/libebook/e-contact.c
rename to addressbook/libebook-contacts/e-contact.c
diff --git a/addressbook/libebook/e-contact.h b/addressbook/libebook-contacts/e-contact.h
similarity index 100%
rename from addressbook/libebook/e-contact.h
rename to addressbook/libebook-contacts/e-contact.h
diff --git a/addressbook/libebook/e-name-western-tables.h b/addressbook/libebook-contacts/e-name-western-tables.h
similarity index 100%
rename from addressbook/libebook/e-name-western-tables.h
rename to addressbook/libebook-contacts/e-name-western-tables.h
diff --git a/addressbook/libebook/e-name-western-tables.h.in b/addressbook/libebook-contacts/e-name-western-tables.h.in
similarity index 100%
rename from addressbook/libebook/e-name-western-tables.h.in
rename to addressbook/libebook-contacts/e-name-western-tables.h.in
diff --git a/addressbook/libebook/e-name-western.c b/addressbook/libebook-contacts/e-name-western.c
similarity index 100%
rename from addressbook/libebook/e-name-western.c
rename to addressbook/libebook-contacts/e-name-western.c
diff --git a/addressbook/libebook/e-name-western.h b/addressbook/libebook-contacts/e-name-western.h
similarity index 100%
rename from addressbook/libebook/e-name-western.h
rename to addressbook/libebook-contacts/e-name-western.h
diff --git a/addressbook/libebook/e-vcard.c b/addressbook/libebook-contacts/e-vcard.c
similarity index 100%
rename from addressbook/libebook/e-vcard.c
rename to addressbook/libebook-contacts/e-vcard.c
diff --git a/addressbook/libebook/e-vcard.h b/addressbook/libebook-contacts/e-vcard.h
similarity index 100%
rename from addressbook/libebook/e-vcard.h
rename to addressbook/libebook-contacts/e-vcard.h
diff --git a/addressbook/libebook/gen-western-table.py b/addressbook/libebook-contacts/gen-western-table.py
similarity index 100%
rename from addressbook/libebook/gen-western-table.py
rename to addressbook/libebook-contacts/gen-western-table.py
diff --git a/addressbook/libebook/Makefile.am b/addressbook/libebook/Makefile.am
index 5177934..c060c7c 100644
--- a/addressbook/libebook/Makefile.am
+++ b/addressbook/libebook/Makefile.am
@@ -38,23 +38,19 @@ libebook_1_2_la_CPPFLAGS = \
libebook_1_2_la_SOURCES = \
$(ENUM_GENERATED) \
$(MARSHAL_GENERATED) \
- e-address-western.c \
e-book-client.c \
e-book-client-view.c \
e-book-client-view-private.h \
- e-book-query.c \
e-book-view-private.h \
e-book-view.c \
e-book.c \
- e-contact.c \
e-destination.c \
- e-name-western.c \
- e-name-western-tables.h \
e-source-address-book-config.c \
- e-vcard.c \
e-error.h
libebook_1_2_la_LIBADD = \
+ $(top_builddir)/addressbook/libebook-contacts/libebook-contacts-1.2.la \
+ $(top_builddir)/addressbook/libedata-book/libedata-book-1.2.la \
$(top_builddir)/addressbook/libegdbus/libegdbus-book.la \
$(top_builddir)/camel/libcamel-1.2.la \
$(top_builddir)/libedataserver/libedataserver-1.2.la \
@@ -72,28 +68,18 @@ libebookincludedir = $(privincludedir)/libebook
libebookinclude_HEADERS = \
libebook.h \
- e-address-western.h \
e-book-client.h \
e-book-client-view.h \
e-book-enumtypes.h \
- e-book-query.h \
e-book-view.h \
e-book-types.h \
e-book.h \
- e-contact.h \
e-destination.h \
- e-name-western.h \
- e-source-address-book-config.h \
- e-vcard.h
+ e-source-address-book-config.h
%-$(API_VERSION).pc: %.pc
cp $< $@
-e-name-western-tables.h: e-name-western-tables.h.in
- $(AM_V_GEN) ($(PYTHON) ${srcdir}/gen-western-table.py < $< > $ tmp && mv $ tmp $@) || rm -f $ tmp
-
-BUILT_SOURCES += e-name-western-tables.h
-
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libebook-$(API_VERSION).pc
diff --git a/addressbook/libebook/e-book-client.c b/addressbook/libebook/e-book-client.c
index 609a7e7..9b19ffb 100644
--- a/addressbook/libebook/e-book-client.c
+++ b/addressbook/libebook/e-book-client.c
@@ -33,8 +33,6 @@
#include <libedata-book/libedata-book.h>
#include "e-book-client.h"
-#include "e-contact.h"
-#include "e-name-western.h"
#include "e-book-client-view-private.h"
#include "e-gdbus-book.h"
@@ -50,9 +48,7 @@ struct _EBookClientPrivate {
GDBusProxy *gdbus_book;
guint gone_signal_id;
- EModule *direct_module;
EDataBook *direct_book;
- EBookBackend *direct_backend;
};
G_DEFINE_TYPE (EBookClient, e_book_client, E_TYPE_CLIENT)
@@ -580,9 +576,6 @@ e_book_client_new_direct (ESourceRegistry *registry,
GError **error)
{
EBookClient *client;
- GType factory_type;
- GType backend_type;
- GTypeClass *factory_class;
const gchar *backend_path;
const gchar *backend_name;
@@ -595,24 +588,9 @@ e_book_client_new_direct (ESourceRegistry *registry,
backend_path = "/opt/devel/lib64/evolution-data-server/addressbook-backends/libebookbackendfile.so";
backend_name = "EBookBackendFileFactory";
- client->priv->direct_module = e_module_new (backend_path);
- g_type_module_use (G_TYPE_MODULE (client->priv->direct_module));
-
- factory_type = g_type_from_name (backend_name);
-
- factory_class = g_type_class_ref (factory_type);
- backend_type = E_BOOK_BACKEND_FACTORY_CLASS (factory_class)->backend_type;
-
- g_print ("Direct backend type name: %s\n", g_type_name (backend_type));
-
- g_type_class_unref (factory_class);
-
- client->priv->direct_backend =
- g_object_new (backend_type,
- "registry", registry,
- "source", source, NULL);
-
- client->priv->direct_book = e_data_book_new (client->priv->direct_backend);
+ client->priv->direct_book =
+ e_data_book_new_direct (registry, source,
+ backend_path, backend_name);
return client;
}
@@ -1848,6 +1826,63 @@ e_book_client_remove_contacts_sync (EBookClient *client,
return res;
}
+
+typedef struct {
+ EBookClient *client;
+ GAsyncReadyCallback callback;
+ gpointer user_data;
+ gpointer source_tag;
+} PropagateReadyData;
+
+static PropagateReadyData *
+propagate_ready_data_new (EBookClient *client,
+ GAsyncReadyCallback callback,
+ gpointer user_data,
+ gpointer source_tag)
+{
+ PropagateReadyData *data = g_slice_new (PropagateReadyData);
+
+ data->client = g_object_ref (client);
+ data->callback = callback;
+ data->user_data = user_data;
+ data->source_tag = source_tag;
+
+ return data;
+}
+
+static void
+propagate_ready_data_free (PropagateReadyData *data)
+{
+ if (data) {
+ g_object_unref (data->client);
+ g_slice_free (PropagateReadyData, data);
+ }
+
+}
+
+static void
+propagate_direct_book_async_ready (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ GSimpleAsyncResult *result;
+ PropagateReadyData *data = (PropagateReadyData *)user_data;
+
+ result = g_simple_async_result_new (G_OBJECT (data->client),
+ data->callback,
+ data->user_data,
+ data->source_tag);
+
+ g_object_ref (res);
+ g_simple_async_result_set_op_res_gpointer (result, res, g_object_unref);
+
+ g_simple_async_result_complete (result);
+ g_object_unref (result);
+
+ propagate_ready_data_free (data);
+}
+
+
/**
* e_book_client_get_contact:
* @client: an #EBookClient
@@ -1875,8 +1910,10 @@ e_book_client_get_contact (EBookClient *client,
g_return_if_fail (uid != NULL);
if (client->priv->direct_book) {
- e_data_book_get_contact (client->priv->direct_book,
- uid, cancellable, callback, user_data);
+ PropagateReadyData *data = propagate_ready_data_new (client, callback, user_data, e_book_client_get_contact);
+
+ e_data_book_get_contact (client->priv->direct_book, uid, cancellable,
+ propagate_direct_book_async_ready, data);
return;
}
@@ -1917,8 +1954,11 @@ e_book_client_get_contact_finish (EBookClient *client,
g_return_val_if_fail (contact != NULL, FALSE);
- if (client->priv->direct_book)
- return e_data_book_get_contact_finish (client->priv->direct_book, result, contact, error);
+ if (client->priv->direct_book) {
+ GAsyncResult *res = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (result));
+
+ return e_data_book_get_contact_finish (client->priv->direct_book, res, contact, error);
+ }
res = e_client_proxy_call_finish_string (E_CLIENT (client), result, &vcard, error, e_book_client_get_contact);
@@ -2016,8 +2056,10 @@ e_book_client_get_contacts (EBookClient *client,
g_return_if_fail (sexp != NULL);
if (client->priv->direct_book) {
- e_data_book_get_contacts (client->priv->direct_book,
- sexp, cancellable, callback, user_data);
+ PropagateReadyData *data = propagate_ready_data_new (client, callback, user_data, e_book_client_get_contacts);
+
+ e_data_book_get_contacts (client->priv->direct_book, sexp, cancellable,
+ propagate_direct_book_async_ready, data);
return;
}
@@ -2055,8 +2097,11 @@ e_book_client_get_contacts_finish (EBookClient *client,
g_return_val_if_fail (contacts != NULL, FALSE);
- if (client->priv->direct_book)
- return e_data_book_get_contacts_finish (client->priv->direct_book, result, contacts, error);
+ if (client->priv->direct_book) {
+ GAsyncResult *direct_res = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (result));
+
+ return e_data_book_get_contacts_finish (client->priv->direct_book, direct_res, contacts, error);
+ }
res = e_client_proxy_call_finish_strv (E_CLIENT (client), result, &vcards, error, e_book_client_get_contacts);
@@ -2170,8 +2215,10 @@ e_book_client_get_contacts_uids (EBookClient *client,
g_return_if_fail (sexp != NULL);
if (client->priv->direct_book) {
- e_data_book_get_contacts_uids (client->priv->direct_book,
- sexp, cancellable, callback, user_data);
+ PropagateReadyData *data = propagate_ready_data_new (client, callback, user_data, e_book_client_get_contacts_uids);
+
+ e_data_book_get_contacts_uids (client->priv->direct_book, sexp, cancellable,
+ propagate_direct_book_async_ready, data);
return;
}
@@ -2209,8 +2256,11 @@ e_book_client_get_contacts_uids_finish (EBookClient *client,
g_return_val_if_fail (contacts_uids != NULL, FALSE);
- if (client->priv->direct_book)
- return e_data_book_get_contacts_uids_finish (client->priv->direct_book, result, contacts_uids, error);
+ if (client->priv->direct_book) {
+ GAsyncResult *direct_res = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (result));
+
+ return e_data_book_get_contacts_uids_finish (client->priv->direct_book, direct_res, contacts_uids, error);
+ }
res = e_client_proxy_call_finish_strv (E_CLIENT (client), result, &uids, error, e_book_client_get_contacts_uids);
@@ -2519,13 +2569,21 @@ static void
book_client_dispose (GObject *object)
{
EClient *client;
+ EBookClient *book_client;
client = E_CLIENT (object);
+ book_client = E_BOOK_CLIENT (object);
e_client_cancel_all (client);
gdbus_book_client_disconnect (E_BOOK_CLIENT (client));
+ if (book_client->priv->direct_book) {
+ e_data_book_close_sync (book_client->priv->direct_book, NULL, NULL);
+ g_object_unref (book_client->priv->direct_book);
+ book_client->priv->direct_book = NULL;
+ }
+
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (e_book_client_parent_class)->dispose (object);
}
diff --git a/addressbook/libebook/e-book-client.h b/addressbook/libebook/e-book-client.h
index 6e8ba48..12cc404 100644
--- a/addressbook/libebook/e-book-client.h
+++ b/addressbook/libebook/e-book-client.h
@@ -27,9 +27,9 @@
#define E_BOOK_CLIENT_H
#include <libedataserver/libedataserver.h>
+#include <libebook-contacts/libebook-contacts.h>
#include <libebook/e-book-client-view.h>
-#include <libebook/e-contact.h>
G_BEGIN_DECLS
diff --git a/addressbook/libebook/e-book-types.h b/addressbook/libebook/e-book-types.h
index f78ba32..b7ef69d 100644
--- a/addressbook/libebook/e-book-types.h
+++ b/addressbook/libebook/e-book-types.h
@@ -16,7 +16,7 @@
#ifndef __E_BOOK_TYPES_H__
#define __E_BOOK_TYPES_H__
-#include <libebook/e-contact.h>
+#include <libebook-contacts/libebook-contacts.h>
G_BEGIN_DECLS
@@ -52,66 +52,10 @@ typedef enum {
E_BOOK_ERROR_NOT_SUPPORTED
} EBookStatus;
-/**
- * EDataBookStatus:
- *
- * XXX Document me!
- *
- * Since: 3.6
- **/
-typedef enum {
- E_DATA_BOOK_STATUS_SUCCESS,
- E_DATA_BOOK_STATUS_BUSY,
- E_DATA_BOOK_STATUS_REPOSITORY_OFFLINE,
- E_DATA_BOOK_STATUS_PERMISSION_DENIED,
- E_DATA_BOOK_STATUS_CONTACT_NOT_FOUND,
- E_DATA_BOOK_STATUS_CONTACTID_ALREADY_EXISTS,
- E_DATA_BOOK_STATUS_AUTHENTICATION_FAILED,
- E_DATA_BOOK_STATUS_AUTHENTICATION_REQUIRED,
- E_DATA_BOOK_STATUS_UNSUPPORTED_FIELD,
- E_DATA_BOOK_STATUS_UNSUPPORTED_AUTHENTICATION_METHOD,
- E_DATA_BOOK_STATUS_TLS_NOT_AVAILABLE,
- E_DATA_BOOK_STATUS_NO_SUCH_BOOK,
- E_DATA_BOOK_STATUS_BOOK_REMOVED,
- E_DATA_BOOK_STATUS_OFFLINE_UNAVAILABLE,
- E_DATA_BOOK_STATUS_SEARCH_SIZE_LIMIT_EXCEEDED,
- E_DATA_BOOK_STATUS_SEARCH_TIME_LIMIT_EXCEEDED,
- E_DATA_BOOK_STATUS_INVALID_QUERY,
- E_DATA_BOOK_STATUS_QUERY_REFUSED,
- E_DATA_BOOK_STATUS_COULD_NOT_CANCEL,
- E_DATA_BOOK_STATUS_OTHER_ERROR,
- E_DATA_BOOK_STATUS_INVALID_SERVER_VERSION,
- E_DATA_BOOK_STATUS_NO_SPACE,
- E_DATA_BOOK_STATUS_INVALID_ARG,
- E_DATA_BOOK_STATUS_NOT_SUPPORTED,
- E_DATA_BOOK_STATUS_NOT_OPENED,
- E_DATA_BOOK_STATUS_BAD_REVISION
-} EDataBookStatus;
-
#ifndef E_BOOK_DISABLE_DEPRECATED
#define E_BOOK_ERROR_CORBA_EXCEPTION E_BOOK_ERROR_DBUS_EXCEPTION
#endif
-typedef enum {
- E_BOOK_VIEW_STATUS_OK,
- E_BOOK_VIEW_STATUS_TIME_LIMIT_EXCEEDED,
- E_BOOK_VIEW_STATUS_SIZE_LIMIT_EXCEEDED,
- E_BOOK_VIEW_ERROR_INVALID_QUERY,
- E_BOOK_VIEW_ERROR_QUERY_REFUSED,
- E_BOOK_VIEW_ERROR_OTHER_ERROR
-} EBookViewStatus;
-
-typedef enum {
- E_BOOK_CHANGE_CARD_ADDED,
- E_BOOK_CHANGE_CARD_DELETED,
- E_BOOK_CHANGE_CARD_MODIFIED
-} EBookChangeType;
-
-typedef struct {
- EBookChangeType change_type;
- EContact *contact;
-} EBookChange;
-
/**
* EBookIndexType:
* @E_BOOK_INDEX_PREFIX: An index suitable for searching contacts with a prefix pattern
diff --git a/addressbook/libebook/e-book.c b/addressbook/libebook/e-book.c
index 17193e5..9aa6bc7 100644
--- a/addressbook/libebook/e-book.c
+++ b/addressbook/libebook/e-book.c
@@ -40,8 +40,6 @@
#include <glib/gi18n-lib.h>
#include "e-book.h"
#include "e-error.h"
-#include "e-contact.h"
-#include "e-name-western.h"
#include "e-book-view-private.h"
#include "e-book-marshal.h"
diff --git a/addressbook/libebook/e-book.h b/addressbook/libebook/e-book.h
index 7782d25..3c85310 100644
--- a/addressbook/libebook/e-book.h
+++ b/addressbook/libebook/e-book.h
@@ -19,9 +19,8 @@
#ifndef E_BOOK_DISABLE_DEPRECATED
#include <libedataserver/libedataserver.h>
+#include <libebook-contacts/libebook-contacts.h>
-#include <libebook/e-contact.h>
-#include <libebook/e-book-query.h>
#include <libebook/e-book-view.h>
#include <libebook/e-book-types.h>
diff --git a/addressbook/libebook/e-destination.h b/addressbook/libebook/e-destination.h
index 197733f..048c18b 100644
--- a/addressbook/libebook/e-destination.h
+++ b/addressbook/libebook/e-destination.h
@@ -32,7 +32,7 @@
#ifndef __E_DESTINATION_H__
#define __E_DESTINATION_H__
-#include <libebook/e-contact.h>
+#include <libebook-contacts/libebook-contacts.h>
#include <libebook/e-book-client.h>
#include <libxml/tree.h>
diff --git a/addressbook/libebook/e-source-address-book-config.h b/addressbook/libebook/e-source-address-book-config.h
index af611cf..16cfa3c 100644
--- a/addressbook/libebook/e-source-address-book-config.h
+++ b/addressbook/libebook/e-source-address-book-config.h
@@ -29,7 +29,7 @@
#define E_SOURCE_ADDRESS_BOOK_CONFIG_H
#include <libedataserver/libedataserver.h>
-#include <libebook/e-contact.h>
+#include <libebook-contacts/libebook-contacts.h>
#include <libebook/e-book-types.h>
/* Standard GObject macros */
diff --git a/addressbook/libebook/libebook.h b/addressbook/libebook/libebook.h
index fec9f57..e8524c1 100644
--- a/addressbook/libebook/libebook.h
+++ b/addressbook/libebook/libebook.h
@@ -23,19 +23,14 @@
#include <libedataserver/libedataserver.h>
-#include <libebook/e-address-western.h>
#include <libebook/e-book-client-view.h>
#include <libebook/e-book-client.h>
#include <libebook/e-book-enumtypes.h>
-#include <libebook/e-book-query.h>
#include <libebook/e-book-types.h>
#include <libebook/e-book-view.h>
#include <libebook/e-book.h>
-#include <libebook/e-contact.h>
#include <libebook/e-destination.h>
-#include <libebook/e-name-western.h>
#include <libebook/e-source-address-book-config.h>
-#include <libebook/e-vcard.h>
#undef __LIBEBOOK_H_INSIDE__
diff --git a/addressbook/libedata-book/Makefile.am b/addressbook/libedata-book/Makefile.am
index 0b70f44..51001e4 100644
--- a/addressbook/libedata-book/Makefile.am
+++ b/addressbook/libedata-book/Makefile.am
@@ -34,7 +34,7 @@ libedata_book_1_2_la_SOURCES = \
ximian-vcard.h
libedata_book_1_2_la_LIBADD = \
- $(top_builddir)/addressbook/libebook/libebook-1.2.la \
+ $(top_builddir)/addressbook/libebook-contacts/libebook-contacts-1.2.la \
$(top_builddir)/addressbook/libegdbus/libegdbus-book.la \
$(top_builddir)/libedataserver/libedataserver-1.2.la \
$(top_builddir)/libebackend/libebackend-1.2.la \
diff --git a/addressbook/libedata-book/e-data-book.c b/addressbook/libedata-book/e-data-book.c
index 5be234d..808ba76 100644
--- a/addressbook/libedata-book/e-data-book.c
+++ b/addressbook/libedata-book/e-data-book.c
@@ -31,6 +31,7 @@
#include "e-data-book.h"
#include "e-data-book-view.h"
#include "e-book-backend.h"
+#include "e-book-backend-factory.h"
#include "e-book-backend-sexp.h"
#include "e-gdbus-book.h"
@@ -42,6 +43,7 @@
struct _EDataBookPrivate
{
EGdbusBook *gdbus_object;
+ EModule *direct_module;
EBookBackend *backend;
@@ -1531,6 +1533,12 @@ data_book_dispose (GObject *object)
priv->backend = NULL;
}
+ if (priv->direct_module) {
+ g_type_module_unuse (G_TYPE_MODULE (priv->direct_module));
+ g_object_unref (priv->direct_module);
+ priv->direct_module = NULL;
+ }
+
/* Chain up to parent's dispose() metnod. */
G_OBJECT_CLASS (e_data_book_parent_class)->dispose (object);
}
@@ -1662,6 +1670,60 @@ e_data_book_new (EBookBackend *backend)
return g_object_new (E_TYPE_DATA_BOOK, "backend", backend, NULL);
}
+EDataBook *
+e_data_book_new_direct (ESourceRegistry *registry,
+ ESource *source,
+ const gchar *backend_path,
+ const gchar *backend_factory_name)
+{
+ EDataBook *book;
+ EModule *module;
+ EBookBackend *backend;
+ GType backend_type;
+ GType factory_type;
+ GTypeClass *factory_class;
+
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
+ g_return_val_if_fail (E_IS_SOURCE (source), NULL);
+ g_return_val_if_fail (backend_path && backend_path[0], NULL);
+ g_return_val_if_fail (backend_factory_name && backend_factory_name[0], NULL);
+
+ module = e_module_new (backend_path);
+ if (!module) {
+ g_warning ("Failed to open EModule at path: %s", backend_path);
+ return NULL;
+ }
+
+ if (!g_type_module_use (G_TYPE_MODULE (module))) {
+ g_warning ("Failed to load EModule at path: %s", backend_path);
+ g_object_unref (module);
+ return NULL;
+ }
+
+ factory_type = g_type_from_name (backend_factory_name);
+ if (factory_type == 0) {
+ g_warning ("Failed to get backend factory '%s' from EModule at path: %s",
+ backend_factory_name, backend_path);
+ g_type_module_unuse (G_TYPE_MODULE (module));
+ g_object_unref (module);
+ return NULL;
+ }
+
+ factory_class = g_type_class_ref (factory_type);
+ backend_type = E_BOOK_BACKEND_FACTORY_CLASS (factory_class)->backend_type;
+ g_type_class_unref (factory_class);
+
+ backend = g_object_new (backend_type,
+ "registry", registry,
+ "source", source, NULL);
+
+
+ book = e_data_book_new (backend);
+ book->priv->direct_module = module;
+
+ return book;
+}
+
EBookBackend *
e_data_book_get_backend (EDataBook *book)
{
diff --git a/addressbook/libedata-book/e-data-book.h b/addressbook/libedata-book/e-data-book.h
index 01d9fcb..9961785 100644
--- a/addressbook/libedata-book/e-data-book.h
+++ b/addressbook/libedata-book/e-data-book.h
@@ -129,6 +129,7 @@ const gchar *e_data_book_status_to_string (EDataBookStatus status);
GType e_data_book_get_type (void);
EDataBook * e_data_book_new (struct _EBookBackend *backend);
+EDataBook * e_data_book_new_direct (ESourceRegistry *registry, ESource *source, const gchar *backend_path, const gchar *backend_factory_name);
struct _EBookBackend *
e_data_book_get_backend (EDataBook *book);
diff --git a/configure.ac b/configure.ac
index 5dd0644..e47c02f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,6 +112,10 @@ LIBEBOOK_CURRENT=17
LIBEBOOK_REVISION=1
LIBEBOOK_AGE=3
+LIBEBOOK_CONTACTS_CURRENT=0
+LIBEBOOK_CONTACTS_REVISION=0
+LIBEBOOK_CONTACTS_AGE=0
+
LIBCAMEL_CURRENT=40
LIBCAMEL_REVISION=0
LIBCAMEL_AGE=0
@@ -135,6 +139,9 @@ AC_SUBST(LIBECAL_AGE)
AC_SUBST(LIBEDATACAL_CURRENT)
AC_SUBST(LIBEDATACAL_REVISION)
AC_SUBST(LIBEDATACAL_AGE)
+AC_SUBST(LIBEBOOK_CONTACTS_CURRENT)
+AC_SUBST(LIBEBOOK_CONTACTS_REVISION)
+AC_SUBST(LIBEBOOK_CONTACTS_AGE)
AC_SUBST(LIBEBOOK_CURRENT)
AC_SUBST(LIBEBOOK_REVISION)
AC_SUBST(LIBEBOOK_AGE)
@@ -1570,6 +1577,8 @@ evolution-data-server.pc
addressbook/Makefile
addressbook/libebook/Makefile
addressbook/libebook/libebook.pc
+addressbook/libebook-contacts/Makefile
+addressbook/libebook-contacts/libebook-contacts.pc
addressbook/libedata-book/Makefile
addressbook/libedata-book/libedata-book.pc
addressbook/libegdbus/Makefile
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]