[evolution-data-server/account-mgmt: 9/28] Adapt libedata-book to the new ESource API.



commit 42dc72ba3658dba1df6b452799c1bb0e53b2f790
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Nov 12 16:48:26 2010 -0500

    Adapt libedata-book to the new ESource API.

 .../libedata-book/e-book-backend-db-cache.c        |    5 +-
 addressbook/libedata-book/e-book-backend-sync.c    |   37 ----
 addressbook/libedata-book/e-book-backend-sync.h    |    2 -
 addressbook/libedata-book/e-book-backend.c         |   45 +++--
 addressbook/libedata-book/e-book-backend.h         |    7 +-
 addressbook/libedata-book/e-data-book-factory.c    |  192 ++++++++++++++------
 addressbook/libedata-book/e-data-book.c            |   23 ---
 addressbook/libedata-book/e-data-book.h            |    3 -
 addressbook/libedata-book/e-data-book.xml          |    5 -
 addressbook/libegdbus/e-gdbus-egdbusbook.c         |  138 --------------
 addressbook/libegdbus/e-gdbus-egdbusbook.h         |   26 +---
 .../libedata-book/libedata-book-sections.txt       |    2 -
 .../libedata-book/tmpl/e-book-backend-sync.sgml    |   11 -
 .../libedata-book/tmpl/e-book-backend.sgml         |    4 +-
 .../libedata-book/tmpl/e-data-book.sgml            |   10 -
 .../libedata-book/tmpl/libedata-book-unused.sgml   |   19 ++
 16 files changed, 189 insertions(+), 340 deletions(-)
---
diff --git a/addressbook/libedata-book/e-book-backend-db-cache.c b/addressbook/libedata-book/e-book-backend-db-cache.c
index fa22c87..1a8e532 100644
--- a/addressbook/libedata-book/e-book-backend-db-cache.c
+++ b/addressbook/libedata-book/e-book-backend-db-cache.c
@@ -19,11 +19,10 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
-
+#include <stdlib.h>
 #include <string.h>
+
 #include <libedataserver/e-data-server-util.h>
 #include "e-book-backend-db-cache.h"
 #include "e-book-backend.h"
diff --git a/addressbook/libedata-book/e-book-backend-sync.c b/addressbook/libedata-book/e-book-backend-sync.c
index 4492441..04297ba 100644
--- a/addressbook/libedata-book/e-book-backend-sync.c
+++ b/addressbook/libedata-book/e-book-backend-sync.c
@@ -64,30 +64,6 @@ e_book_backend_sync_create_contact (EBookBackendSync *backend,
 }
 
 /**
- * e_book_backend_sync_remove:
- * @backend: an #EBookBackendSync
- * @book: an #EDataBook
- * @opid: the unique ID of the operation
- * @error: #GError to set, when something fails
- *
- * Remove @book's database and storage overhead from the storage
- * medium. This will delete all contacts in @book.
- **/
-void
-e_book_backend_sync_remove (EBookBackendSync *backend,
-			    EDataBook *book,
-			    guint32 opid,
-			    GError **error)
-{
-	e_return_data_book_error_if_fail (E_IS_BOOK_BACKEND_SYNC (backend), E_DATA_BOOK_STATUS_INVALID_ARG);
-	e_return_data_book_error_if_fail (E_IS_DATA_BOOK (book), E_DATA_BOOK_STATUS_INVALID_ARG);
-
-	g_assert (E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->remove_sync);
-
-	(* E_BOOK_BACKEND_SYNC_GET_CLASS (backend)->remove_sync) (backend, book, opid, error);
-}
-
-/**
  * e_book_backend_sync_remove_contacts:
  * @backend: an #EBookBackendSync
  * @book: an #EDataBook
@@ -352,18 +328,6 @@ e_book_backend_sync_get_supported_auth_methods (EBookBackendSync *backend,
 }
 
 static void
-_e_book_backend_remove (EBookBackend *backend,
-			EDataBook    *book,
-			guint32       opid)
-{
-	GError *error = NULL;;
-
-	e_book_backend_sync_remove (E_BOOK_BACKEND_SYNC (backend), book, opid, &error);
-
-	e_data_book_respond_remove (book, opid, error);
-}
-
-static void
 _e_book_backend_create_contact (EBookBackend *backend,
 				EDataBook    *book,
 				guint32       opid,
@@ -564,7 +528,6 @@ e_book_backend_sync_class_init (EBookBackendSyncClass *klass)
 
 	object_class = (GObjectClass *) klass;
 
-	backend_class->remove = _e_book_backend_remove;
 	backend_class->create_contact = _e_book_backend_create_contact;
 	backend_class->remove_contacts = _e_book_backend_remove_contacts;
 	backend_class->modify_contact = _e_book_backend_modify_contact;
diff --git a/addressbook/libedata-book/e-book-backend-sync.h b/addressbook/libedata-book/e-book-backend-sync.h
index 16fb4fb..a0e21d5 100644
--- a/addressbook/libedata-book/e-book-backend-sync.h
+++ b/addressbook/libedata-book/e-book-backend-sync.h
@@ -29,7 +29,6 @@ struct _EBookBackendSyncClass {
 	EBookBackendClass parent_class;
 
 	/* Virtual methods */
-	void (*remove_sync) (EBookBackendSync *backend, EDataBook *book, guint32 opid, GError **perror);
 	void (*create_contact_sync)  (EBookBackendSync *backend, EDataBook *book,
 							guint32 opid,
 							const gchar *vcard, EContact **contact, GError **perror);
@@ -78,7 +77,6 @@ gboolean    e_book_backend_sync_construct                (EBookBackendSync
 
 GType       e_book_backend_sync_get_type                 (void);
 
-void e_book_backend_sync_remove  (EBookBackendSync *backend, EDataBook *book, guint32 opid, GError **perror);
 void e_book_backend_sync_create_contact  (EBookBackendSync *backend, EDataBook *book, guint32 opid, const gchar *vcard, EContact **contact, GError **perror);
 void e_book_backend_sync_remove_contacts (EBookBackendSync *backend, EDataBook *book, guint32 opid, GList *id_list, GList **removed_ids, GError **perror);
 void e_book_backend_sync_modify_contact  (EBookBackendSync *backend, EDataBook *book, guint32 opid, const gchar *vcard, EContact **contact, GError **perror);
diff --git a/addressbook/libedata-book/e-book-backend.c b/addressbook/libedata-book/e-book-backend.c
index 2c0be6a..4605997 100644
--- a/addressbook/libedata-book/e-book-backend.c
+++ b/addressbook/libedata-book/e-book-backend.c
@@ -54,23 +54,19 @@ book_backend_set_default_cache_dir (EBookBackend *backend)
 {
 	ESource *source;
 	const gchar *user_cache_dir;
-	gchar *mangled_uri;
+	const gchar *uid;
 	gchar *filename;
 
 	user_cache_dir = e_get_user_cache_dir ();
-
 	source = e_book_backend_get_source (backend);
-	g_return_if_fail (source != NULL);
 
-	/* Mangle the URI to not contain invalid characters. */
-	mangled_uri = g_strdelimit (e_source_get_uri (source), ":/", '_');
+	uid = e_source_get_uid (source);
+	g_return_if_fail (uid != NULL);
 
 	filename = g_build_filename (
-		user_cache_dir, "addressbook", mangled_uri, NULL);
+		user_cache_dir, "addressbook", uid, NULL);
 	e_book_backend_set_cache_dir (backend, filename);
 	g_free (filename);
-
-	g_free (mangled_uri);
 }
 
 static void
@@ -147,6 +143,14 @@ book_backend_finalize (GObject *object)
 	G_OBJECT_CLASS (e_book_backend_parent_class)->finalize (object);
 }
 
+static gboolean
+book_backend_remove (EBookBackend *backend,
+                     GError **error)
+{
+	/* Default implementation assumes no caching. */
+	return TRUE;
+}
+
 static void
 e_book_backend_class_init (EBookBackendClass *class)
 {
@@ -160,6 +164,8 @@ e_book_backend_class_init (EBookBackendClass *class)
 	object_class->dispose = book_backend_dispose;
 	object_class->finalize = book_backend_finalize;
 
+	class->remove = book_backend_remove;
+
 	g_object_class_install_property (
 		object_class,
 		PROP_CACHE_DIR,
@@ -336,23 +342,24 @@ e_book_backend_open (EBookBackend *backend,
 /**
  * e_book_backend_remove:
  * @backend: an #EBookBackend
- * @book: an #EDataBook
- * @opid: the ID to use for this operation
+ * @error: return location for a #GError, or %NULL
+ *
+ * Removes all of @backend's data.
  *
- * Executes a 'remove' request to remove all of @backend's data,
- * specified by @opid on @book.
+ * Returns: %TRUE on success, %FALSE on failure
  **/
-void
+gboolean
 e_book_backend_remove (EBookBackend *backend,
-		       EDataBook    *book,
-		       guint32       opid)
+                       GError **error)
 {
-	g_return_if_fail (E_IS_BOOK_BACKEND (backend));
-	g_return_if_fail (E_IS_DATA_BOOK (book));
+	EBookBackendClass *class;
+
+	g_return_val_if_fail (E_IS_BOOK_BACKEND (backend), FALSE);
 
-	g_assert (E_BOOK_BACKEND_GET_CLASS (backend)->remove);
+	class = E_BOOK_BACKEND_GET_CLASS (backend);
+	g_return_val_if_fail (class->remove != NULL, FALSE);
 
-	(* E_BOOK_BACKEND_GET_CLASS (backend)->remove) (backend, book, opid);
+	return class->remove (backend, error);
 }
 
 /**
diff --git a/addressbook/libedata-book/e-book-backend.h b/addressbook/libedata-book/e-book-backend.h
index 6d96b1a..7322066 100644
--- a/addressbook/libedata-book/e-book-backend.h
+++ b/addressbook/libedata-book/e-book-backend.h
@@ -51,7 +51,7 @@ struct _EBookBackendClass {
 
 	/* Virtual methods */
 	void (*load_source) (EBookBackend *backend, ESource *source, gboolean only_if_exists, GError **error);
-	void (*remove) (EBookBackend *backend, EDataBook *book, guint32 opid);
+	gboolean (*remove) (EBookBackend *backend, GError **error);
         gchar *(*get_static_capabilities) (EBookBackend *backend);
 
 	void (*create_contact)  (EBookBackend *backend, EDataBook *book, guint32 opid, const gchar *vcard);
@@ -89,6 +89,8 @@ void        e_book_backend_load_source              (EBookBackend             *b
 						     ESource                  *source,
 						     gboolean                  only_if_exists,
 						     GError		     **error);
+gboolean    e_book_backend_remove                   (EBookBackend             *backend,
+						     GError                  **error);
 ESource    *e_book_backend_get_source               (EBookBackend             *backend);
 
 gboolean    e_book_backend_add_client               (EBookBackend             *backend,
@@ -108,9 +110,6 @@ void        e_book_backend_open                     (EBookBackend             *b
 						     EDataBook                *book,
 						     guint32                   opid,
 						     gboolean                  only_if_exists);
-void        e_book_backend_remove                   (EBookBackend             *backend,
-						     EDataBook                *book,
-						     guint32                   opid);
 void        e_book_backend_create_contact           (EBookBackend             *backend,
 						     EDataBook                *book,
 						     guint32                   opid,
diff --git a/addressbook/libedata-book/e-data-book-factory.c b/addressbook/libedata-book/e-data-book-factory.c
index c5c6998..f8fa3eb 100644
--- a/addressbook/libedata-book/e-data-book-factory.c
+++ b/addressbook/libedata-book/e-data-book-factory.c
@@ -26,8 +26,10 @@
 #include <unistd.h>
 #include <glib-object.h>
 #include <glib/gi18n.h>
+#include <libedataserver/e-source-registry.h>
 #include <libebackend/e-data-server-module.h>
 #include <libebackend/e-offline-listener.h>
+#include <libebook/e-source-address-book.h>
 #include "e-book-backend-factory.h"
 #include "e-data-book-factory.h"
 #include "e-data-book.h"
@@ -70,11 +72,11 @@ G_DEFINE_TYPE (EDataBookFactory, e_data_book_factory, G_TYPE_OBJECT);
 struct _EDataBookFactoryPrivate {
 	EGdbusBookFactory *gdbus_object;
 
-	/* 'protocol' -> EBookBackendFactory hash table */
+	/* 'backend name' -> EBookBackendFactory hash table */
 	GHashTable *factories;
 
 	GMutex *backends_lock;
-	/* 'uri' -> EBookBackend */
+	/* 'UID' -> EBookBackend */
 	GHashTable *backends;
 
 	GMutex *books_lock;
@@ -189,42 +191,6 @@ e_data_book_factory_set_backend_mode (EDataBookFactory *factory,
 	g_mutex_unlock (factory->priv->backends_lock);
 }
 
-/* TODO: write dispose to kill hash */
-static gchar *
-e_data_book_factory_extract_proto_from_uri (const gchar *uri)
-{
-	gchar *proto, *p;
-	p = strchr (uri, ':');
-	if (p == NULL)
-		return NULL;
-	proto = g_malloc0 (p - uri + 1);
-	strncpy (proto, uri, p - uri);
-	return proto;
-}
-
-static EBookBackendFactory*
-e_data_book_factory_lookup_backend_factory (EDataBookFactory *factory,
-                                            const gchar *uri)
-{
-	EBookBackendFactory *backend_factory;
-	gchar *proto;
-
-	g_return_val_if_fail (E_IS_DATA_BOOK_FACTORY (factory), NULL);
-	g_return_val_if_fail (uri != NULL, NULL);
-
-	proto = e_data_book_factory_extract_proto_from_uri (uri);
-	if (proto == NULL) {
-		g_warning ("Cannot extract protocol from URI %s", uri);
-		return NULL;
-	}
-
-	backend_factory = g_hash_table_lookup (factory->priv->factories, proto);
-
-	g_free (proto);
-
-	return backend_factory;
-}
-
 static gchar *
 construct_book_factory_path (void)
 {
@@ -289,19 +255,27 @@ backend_gone_cb (EDataBookFactory *factory, GObject *dead)
 }
 
 static gboolean
-impl_BookFactory_getBook (EGdbusBookFactory *object, GDBusMethodInvocation *invocation, const gchar *in_source, EDataBookFactory *factory)
+impl_BookFactory_getBook (EGdbusBookFactory *object,
+                          GDBusMethodInvocation *invocation,
+                          const gchar *uid,
+                          EDataBookFactory *factory)
 {
 	EDataBook *book;
 	EBookBackend *backend;
 	EDataBookFactoryPrivate *priv = factory->priv;
+	ESourceRegistry *registry;
 	ESource *source;
-	gchar *uri, *path;
+	gchar *path;
+	const gchar *backend_name;
 	const gchar *sender;
 	GList *list;
 	GError *error = NULL;
 
-	if (in_source == NULL || in_source[0] == '\0') {
-		error = g_error_new (E_DATA_BOOK_ERROR, E_DATA_BOOK_STATUS_NO_SUCH_BOOK, _("Empty URI"));
+	if (uid == NULL || *uid == '\0') {
+		error = g_error_new_literal (
+			E_DATA_BOOK_ERROR,
+			E_DATA_BOOK_STATUS_NO_SUCH_BOOK,
+			_("Missing source UID"));
 		g_dbus_method_invocation_return_gerror (invocation, error);
 		g_error_free (error);
 
@@ -316,49 +290,70 @@ impl_BookFactory_getBook (EGdbusBookFactory *object, GDBusMethodInvocation *invo
 
 	g_mutex_lock (priv->backends_lock);
 
-	source = e_source_new_from_standalone_xml (in_source);
-	if (!source) {
+	registry = e_source_registry_get_default ();
+	source = e_source_registry_lookup_by_uid (registry, uid);
+
+	if (source == NULL) {
 		g_mutex_unlock (priv->backends_lock);
 
-		error = g_error_new (E_DATA_BOOK_ERROR, E_DATA_BOOK_STATUS_NO_SUCH_BOOK, _("Invalid source"));
+		error = g_error_new (
+			E_DATA_BOOK_ERROR,
+			E_DATA_BOOK_STATUS_NO_SUCH_BOOK,
+			_("No such source for UID '%s'"), uid);
 		g_dbus_method_invocation_return_gerror (invocation, error);
 		g_error_free (error);
 
 		return TRUE;
 	}
 
-	uri = e_source_get_uri (source);
+	backend_name = e_source_get_backend_name (source);
+	if (backend_name == NULL || *backend_name == '\0') {
+		g_mutex_unlock (priv->backends_lock);
+
+		error = g_error_new (
+			E_DATA_BOOK_ERROR,
+			E_DATA_BOOK_STATUS_NO_SUCH_BOOK,
+			_("No backend specified in source UID '%s'"), uid);
+		g_dbus_method_invocation_return_gerror (invocation, error);
+		g_error_free (error);
+
+		return TRUE;
+	}
 
 	g_mutex_lock (priv->books_lock);
-	backend = g_hash_table_lookup (priv->backends, uri);
+	backend = g_hash_table_lookup (priv->backends, uid);
 
 	if (backend == NULL) {
 		EBookBackendFactory *backend_factory;
 
-		backend_factory =
-			e_data_book_factory_lookup_backend_factory (factory, uri);
+		backend_factory = g_hash_table_lookup (
+			factory->priv->factories, backend_name);
 		if (backend_factory != NULL)
 			backend = e_book_backend_factory_new_backend (backend_factory);
 
 		if (backend != NULL) {
-			gchar *uri_key = g_strdup (uri);
-
 			g_hash_table_insert (
-				priv->backends, uri_key, backend);
-			g_object_weak_ref (G_OBJECT (backend), (GWeakNotify) backend_gone_cb, factory);
-			g_signal_connect (backend, "last-client-gone", G_CALLBACK (g_object_unref), NULL);
+				priv->backends, g_strdup (uid), backend);
+			g_object_weak_ref (
+				G_OBJECT (backend), (GWeakNotify)
+				backend_gone_cb, factory);
+			g_signal_connect (
+				backend, "last-client-gone",
+				G_CALLBACK (g_object_unref), NULL);
 			e_book_backend_set_mode (backend, priv->mode);
 		}
 	}
 
 	if (backend == NULL) {
-		g_free (uri);
 		g_object_unref (source);
 
 		g_mutex_unlock (priv->books_lock);
 		g_mutex_unlock (priv->backends_lock);
 
-		error = g_error_new (E_DATA_BOOK_ERROR, E_DATA_BOOK_STATUS_NO_SUCH_BOOK, _("Invalid source"));
+		error = g_error_new (
+			E_DATA_BOOK_ERROR,
+			E_DATA_BOOK_STATUS_NO_SUCH_BOOK,
+			_("No such book: %s"), uid);
 		g_dbus_method_invocation_return_gerror (invocation, error);
 		g_error_free (error);
 
@@ -386,7 +381,6 @@ impl_BookFactory_getBook (EGdbusBookFactory *object, GDBusMethodInvocation *invo
 	g_mutex_unlock (priv->backends_lock);
 
 	g_object_unref (source);
-	g_free (uri);
 
 	if (error) {
 		g_dbus_method_invocation_return_gerror (invocation, error);
@@ -590,6 +584,64 @@ setup_quit_signal (void)
 }
 #endif
 
+static void
+source_load_error (ESourceRegistry *registry,
+                   GFile *file,
+                   const GError *error)
+{
+	gchar *basename;
+
+	basename = g_file_get_basename (file);
+	g_critical ("Failed to load source '%s': %s", basename, error->message);
+	g_free (basename);
+}
+
+static void
+source_added (ESourceRegistry *registry,
+              ESource *source,
+              EDataBookFactory *factory)
+{
+	const gchar *display_name;
+	const gchar *uid;
+
+	uid = e_source_get_uid (source);
+	display_name = e_source_get_display_name (source);
+
+	g_message ("Source '%s' added (uid:%s)", display_name, uid);
+}
+
+static void
+source_removed (ESourceRegistry *registry,
+                ESource *source,
+                EDataBookFactory *factory)
+{
+	EBookBackend *backend;
+	const gchar *display_name;
+	const gchar *uid;
+	GError *error = NULL;
+
+	uid = e_source_get_uid (source);
+	display_name = e_source_get_display_name (source);
+
+	g_message ("Source '%s' removed (uid:%s)", display_name, uid);
+
+	backend = g_hash_table_lookup (factory->priv->backends, uid);
+
+	if (backend == NULL) {
+		g_message ("No corresponding backend found");
+		return;
+	}
+
+	g_message ("Notifying backend of removal");
+
+	if (e_book_backend_remove (backend, &error))
+		g_message ("Backend cleanup was successful");
+	else {
+		g_message ("Backend cleanup failed: %s", error->message);
+		g_error_free (error);
+	}
+}
+
 static GOptionEntry entries[] = {
 
 	/* FIXME Have the description translated for 3.2, but this
@@ -606,6 +658,7 @@ main (gint argc, gchar **argv)
 	EOfflineListener *eol;
 	GOptionContext *context;
 	EDataBookFactory *factory;
+	ESourceRegistry *registry;
 	guint owner_id;
 	GError *error = NULL;
 
@@ -645,8 +698,30 @@ main (gint argc, gchar **argv)
 		exit (EXIT_FAILURE);
 	}
 
+	/* Register ESource extensions we'll need. */
+	E_TYPE_SOURCE_ADDRESS_BOOK;
+
+	registry = e_source_registry_get_default ();
 	factory = g_object_new (E_TYPE_DATA_BOOK_FACTORY, NULL);
 
+	g_signal_connect (
+		registry, "load-error",
+		G_CALLBACK (source_load_error), NULL);
+
+	g_signal_connect (
+		registry, "source-added",
+		G_CALLBACK (source_added), factory);
+
+	g_signal_connect (
+		registry, "source-removed",
+		G_CALLBACK (source_removed), factory);
+
+	/* Failure here is fatal.  Don't even try to keep going. */
+	if (!e_source_registry_load_sources (registry, &error)) {
+		g_error ("%s", error->message);
+		g_assert_not_reached ();
+	}
+
 	loop = g_main_loop_new (NULL, FALSE);
 
 	eol = e_offline_listener_new ();
@@ -655,7 +730,8 @@ main (gint argc, gchar **argv)
 		eol, "changed",
 		G_CALLBACK (offline_state_changed_cb), factory);
 
-	owner_id = g_bus_own_name (G_BUS_TYPE_SESSION,
+	owner_id = g_bus_own_name (
+		G_BUS_TYPE_SESSION,
 		ADDRESS_BOOK_DBUS_SERVICE_NAME,
 		G_BUS_NAME_OWNER_FLAGS_NONE,
 		on_bus_acquired,
diff --git a/addressbook/libedata-book/e-data-book.c b/addressbook/libedata-book/e-data-book.c
index a7ce338..f9425b9 100644
--- a/addressbook/libedata-book/e-data-book.c
+++ b/addressbook/libedata-book/e-data-book.c
@@ -330,28 +330,6 @@ e_data_book_respond_open (EDataBook *book, guint opid, GError *error)
 }
 
 static gboolean
-impl_Book_remove (EGdbusBook *object, GDBusMethodInvocation *invocation, EDataBook *book)
-{
-	e_book_backend_remove (book->priv->backend, book, opid_store (invocation));
-
-	return TRUE;
-}
-
-void
-e_data_book_respond_remove (EDataBook *book, guint opid, GError *error)
-{
-	GDBusMethodInvocation *invocation = opid_fetch (opid);
-
-	if (error) {
-		/* Translators: The '%s' is replaced with a detailed error message */
-		data_book_return_error (invocation, error, _("Cannot remove book: %s"));
-		g_error_free (error);
-	} else {
-		e_gdbus_book_complete_remove (book->priv->gdbus_object, invocation);
-	}
-}
-
-static gboolean
 impl_Book_getContact (EGdbusBook *object, GDBusMethodInvocation *invocation, const gchar *IN_uid, EDataBook *book)
 {
 	OperationData *op;
@@ -856,7 +834,6 @@ e_data_book_init (EDataBook *ebook)
 
 	gdbus_object = ebook->priv->gdbus_object;
 	g_signal_connect (gdbus_object, "handle-open", G_CALLBACK (impl_Book_open), ebook);
-	g_signal_connect (gdbus_object, "handle-remove", G_CALLBACK (impl_Book_remove), ebook);
 	g_signal_connect (gdbus_object, "handle-get-contact", G_CALLBACK (impl_Book_getContact), ebook);
 	g_signal_connect (gdbus_object, "handle-get-contact-list", G_CALLBACK (impl_Book_getContactList), ebook);
 	g_signal_connect (gdbus_object, "handle-authenticate-user", G_CALLBACK (impl_Book_authenticateUser), ebook);
diff --git a/addressbook/libedata-book/e-data-book.h b/addressbook/libedata-book/e-data-book.h
index 5ea18a0..4ee2b99 100644
--- a/addressbook/libedata-book/e-data-book.h
+++ b/addressbook/libedata-book/e-data-book.h
@@ -111,9 +111,6 @@ ESource			*e_data_book_get_source             (EDataBook *book);
 void                    e_data_book_respond_open           (EDataBook *book,
 							    guint32 opid,
 							    GError *error);
-void                    e_data_book_respond_remove         (EDataBook *book,
-							    guint32 opid,
-							    GError *error);
 void                    e_data_book_respond_create         (EDataBook *book,
 							    guint32 opid,
 							    GError *error,
diff --git a/addressbook/libedata-book/e-data-book.xml b/addressbook/libedata-book/e-data-book.xml
index 8be711e..d43ac01 100644
--- a/addressbook/libedata-book/e-data-book.xml
+++ b/addressbook/libedata-book/e-data-book.xml
@@ -25,11 +25,6 @@
       <arg name="only_if_exists" type="b" direction="in"/>
     </method>
 
-    <method name="remove">
-      <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_AddressBook_Book_remove"/>
-      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
-    </method>
-
     <method name="getContact">
       <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_AddressBook_Book_getContact"/>
       <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
diff --git a/addressbook/libegdbus/e-gdbus-egdbusbook.c b/addressbook/libegdbus/e-gdbus-egdbusbook.c
index e037ab8..432f241 100644
--- a/addressbook/libegdbus/e-gdbus-egdbusbook.c
+++ b/addressbook/libegdbus/e-gdbus-egdbusbook.c
@@ -70,7 +70,6 @@ enum
   __CONNECTION_SIGNAL,
   __AUTH_REQUIRED_SIGNAL,
   __OPEN_METHOD,
-  __REMOVE_METHOD,
   __GET_CONTACT_METHOD,
   __GET_CONTACT_LIST_METHOD,
   __AUTHENTICATE_USER_METHOD,
@@ -261,7 +260,6 @@ e_gdbus_book_default_init (EGdbusBookIface *iface)
   _property_gname_to_name = g_hash_table_new (g_str_hash, g_str_equal);
   _property_name_to_gname = g_hash_table_new (g_str_hash, g_str_equal);
   g_hash_table_insert (_method_name_to_id, (gpointer) "open", GUINT_TO_POINTER (__OPEN_METHOD));
-  g_hash_table_insert (_method_name_to_id, (gpointer) "remove", GUINT_TO_POINTER (__REMOVE_METHOD));
   g_hash_table_insert (_method_name_to_id, (gpointer) "getContact", GUINT_TO_POINTER (__GET_CONTACT_METHOD));
   g_hash_table_insert (_method_name_to_id, (gpointer) "getContactList", GUINT_TO_POINTER (__GET_CONTACT_LIST_METHOD));
   g_hash_table_insert (_method_name_to_id, (gpointer) "authenticateUser", GUINT_TO_POINTER (__AUTHENTICATE_USER_METHOD));
@@ -397,30 +395,6 @@ e_gdbus_book_default_init (EGdbusBookIface *iface)
 		  G_TYPE_DBUS_METHOD_INVOCATION,
 		  G_TYPE_BOOLEAN);
   /**
-   * EGdbusBook::handle-remove:
-   * @object: The exported object emitting the signal.
-   * @invocation: A #GDBusMethodInvocation object that can be used to return a value or error.
-   *
-   * On exported objects, this signal is emitted when a remote process (identified by @invocation) invokes the <literal>remove</literal> D-Bus method on @object. Use e_gdbus_book_complete_remove() to return a value or g_dbus_method_invocation_return_error() to return an error.
-   *
-   * The signal is emitted in the thread-default main loop of the thread that e_gdbus_book_register_object() was called from.
-   *
-   * On proxies, this signal is never emitted.
-   *
-   * Returns: %TRUE if you want to handle the method call (will stop further handlers from being called), %FALSE otherwise.
-   */
-  signals[__REMOVE_METHOD] =
-    g_signal_new ("handle-remove",
-		  G_TYPE_FROM_INTERFACE (iface),
-		  G_SIGNAL_RUN_LAST,
-		  G_STRUCT_OFFSET (EGdbusBookIface, handle_remove),
-		  g_signal_accumulator_true_handled,
-		  NULL,
-		  _e_gdbus_gdbus_cclosure_marshaller_BOOLEAN__OBJECT,
-		  G_TYPE_BOOLEAN,
-		  1,
-		  G_TYPE_DBUS_METHOD_INVOCATION);
-  /**
    * EGdbusBook::handle-get-contact:
    * @object: The exported object emitting the signal.
    * @invocation: A #GDBusMethodInvocation object that can be used to return a value or error.
@@ -891,106 +865,6 @@ _out:
 }
 
 /**
- * e_gdbus_book_call_remove:
- * @proxy: A #EGdbusBook.
- * @cancellable: A #GCancellable or %NULL.
- * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL if you don't care about the result of the method invocation.
- * @user_data: Data to pass to @callback.
- *
- * Invokes the <literal>org.gnome.evolution.dataserver.AddressBook.remove</literal>
- * D-Bus method on the remote object represented by @proxy.
- *
- * This is an asynchronous method. When the operation is finished,
- * callback will be invoked in the thread-default main loop of the
- * thread you are calling this method from. You can then call
- * e_gdbus_book_call_remove_finish() to get the result of the operation.
- *
- * See e_gdbus_book_call_remove_sync() for the synchronous version of this method.
- */
-void e_gdbus_book_call_remove (
-        EGdbusBook *proxy,
-        GCancellable *cancellable,
-        GAsyncReadyCallback callback,
-        gpointer user_data)
-{
-  GVariant *_params;
-  _params = NULL;
-  g_dbus_proxy_call (G_DBUS_PROXY (proxy),
-                     "remove",
-		     _params,
-		     G_DBUS_CALL_FLAGS_NONE,
-		     e_data_server_util_get_dbus_call_timeout (),
-		     cancellable,
-		     callback,
-		     user_data);
-}
-
-/**
- * e_gdbus_book_call_remove_finish:
- * @proxy: A #EGdbusBook.
- * @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to e_gdbus_book_call_remove().
- * @error: Return location for error or %NULL.
- *
- * Finishes invoking the <literal>org.gnome.evolution.dataserver.AddressBook.remove</literal>
- * D-Bus method on the remote object represented by @proxy.
- *
- * Returns: %TRUE if the call succeeded, %FALSE if @error is set.
- */
-gboolean e_gdbus_book_call_remove_finish (
-        EGdbusBook *proxy,
-        GAsyncResult *res,
-        GError **error)
-{
-  gboolean _ret = FALSE;
-  GVariant *_result;
-  _result = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
-  if (_result == NULL)
-    goto _out;
-  g_variant_unref (_result);
-  _ret = TRUE;
-_out:
-  return _ret;
-}
-
-/**
- * e_gdbus_book_call_remove_sync:
- * @proxy: A #EGdbusBook.
- * @cancellable: A #GCancellable or %NULL.
- * @error: Return location for error or %NULL.
- *
- * Synchronously invokes the <literal>org.gnome.evolution.dataserver.AddressBook.remove</literal>
- * D-Bus method on the remote object represented by @proxy.
- *
- * The calling thread is blocked until a reply is received. See
- * e_gdbus_book_call_remove() for the asynchronous version of this method.
- *
- * Returns: %TRUE if the call succeeded, %FALSE if @error is set.
- */
-gboolean e_gdbus_book_call_remove_sync (
-        EGdbusBook *proxy,
-        GCancellable *cancellable,
-        GError **error)
-{
-  gboolean _ret = FALSE;
-  GVariant *_params;
-  GVariant *_result;
-  _params = NULL;
-  _result = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
-                                   "remove",
-				   _params,
-				   G_DBUS_CALL_FLAGS_NONE,
-				   e_data_server_util_get_dbus_call_timeout (),
-				   cancellable,
-				   error);
-  if (_result == NULL)
-    goto _out;
-  g_variant_unref (_result);
-  _ret = TRUE;
-_out:
-  return _ret;
-}
-
-/**
  * e_gdbus_book_call_get_contact:
  * @proxy: A #EGdbusBook.
  * @in_uid: Method parameter.
@@ -3510,18 +3384,6 @@ handle_method_call (GDBusConnection       *connection,
       }
       break;
 
-    case __REMOVE_METHOD:
-      {
-	EGdbusBook *object = E_GDBUS_BOOK (user_data);
-	gboolean handled;
-	g_signal_emit (object,
-		       signals[method_id],
-		       0, invocation, &handled);
-	if (!handled)
-	  goto not_implemented;
-      }
-      break;
-
     case __GET_CONTACT_METHOD:
       {
 	EGdbusBook *object = E_GDBUS_BOOK (user_data);
diff --git a/addressbook/libegdbus/e-gdbus-egdbusbook.h b/addressbook/libegdbus/e-gdbus-egdbusbook.h
index c64db8f..86a7f90 100644
--- a/addressbook/libegdbus/e-gdbus-egdbusbook.h
+++ b/addressbook/libegdbus/e-gdbus-egdbusbook.h
@@ -32,7 +32,6 @@ typedef struct _EGdbusBook EGdbusBook; /* Dummy typedef */
  * @connection: Handler for the #EGdbusBook::connection signal.
  * @auth_required: Handler for the #EGdbusBook::auth-required signal.
  * @handle_open: Handler for the #EGdbusBook::handle-open signal.
- * @handle_remove: Handler for the #EGdbusBook::handle-remove signal.
  * @handle_get_contact: Handler for the #EGdbusBook::handle-get-contact signal.
  * @handle_get_contact_list: Handler for the #EGdbusBook::handle-get-contact-list signal.
  * @handle_authenticate_user: Handler for the #EGdbusBook::handle-authenticate-user signal.
@@ -187,12 +186,9 @@ struct _EGdbusBookIface
 
   /* Signal handlers for handling D-Bus method calls: */
   gboolean (*handle_open) (
-	EGdbusBook *object,
-	GDBusMethodInvocation *invocation,
-	gboolean in_only_if_exists);
-  gboolean (*handle_remove) (
-	EGdbusBook *object,
-	GDBusMethodInvocation *invocation);
+        EGdbusBook *object,
+        GDBusMethodInvocation *invocation,
+        gboolean in_only_if_exists);
   gboolean (*handle_get_contact) (
 	EGdbusBook *object,
 	GDBusMethodInvocation *invocation,
@@ -269,22 +265,6 @@ gboolean e_gdbus_book_call_open_sync (
         GCancellable *cancellable,
         GError **error);
 
-void e_gdbus_book_call_remove (
-        EGdbusBook *proxy,
-        GCancellable *cancellable,
-        GAsyncReadyCallback callback,
-        gpointer user_data);
-
-gboolean e_gdbus_book_call_remove_finish (
-        EGdbusBook *proxy,
-        GAsyncResult *res,
-        GError **error);
-
-gboolean e_gdbus_book_call_remove_sync (
-        EGdbusBook *proxy,
-        GCancellable *cancellable,
-        GError **error);
-
 void e_gdbus_book_call_get_contact (
         EGdbusBook *proxy,
         const gchar *in_uid,
diff --git a/docs/reference/addressbook/libedata-book/libedata-book-sections.txt b/docs/reference/addressbook/libedata-book/libedata-book-sections.txt
index 97336bf..891deb3 100644
--- a/docs/reference/addressbook/libedata-book/libedata-book-sections.txt
+++ b/docs/reference/addressbook/libedata-book/libedata-book-sections.txt
@@ -3,7 +3,6 @@
 <TITLE>EBookBackendSync</TITLE>
 EBookBackendSync
 e_book_backend_sync_construct
-e_book_backend_sync_remove
 e_book_backend_sync_create_contact
 e_book_backend_sync_remove_contacts
 e_book_backend_sync_modify_contact
@@ -197,7 +196,6 @@ e_data_book_register_gdbus_object
 e_data_book_get_backend
 e_data_book_get_source
 e_data_book_respond_open
-e_data_book_respond_remove
 e_data_book_respond_create
 e_data_book_respond_remove_contacts
 e_data_book_respond_modify
diff --git a/docs/reference/addressbook/libedata-book/tmpl/e-book-backend-sync.sgml b/docs/reference/addressbook/libedata-book/tmpl/e-book-backend-sync.sgml
index ece2e2a..4d83230 100644
--- a/docs/reference/addressbook/libedata-book/tmpl/e-book-backend-sync.sgml
+++ b/docs/reference/addressbook/libedata-book/tmpl/e-book-backend-sync.sgml
@@ -35,17 +35,6 @@ EBookBackendSync
 @Returns: 
 
 
-<!-- ##### FUNCTION e_book_backend_sync_remove ##### -->
-<para>
-
-</para>
-
- backend: 
- book: 
- opid: 
- perror: 
-
-
 <!-- ##### FUNCTION e_book_backend_sync_create_contact ##### -->
 <para>
 
diff --git a/docs/reference/addressbook/libedata-book/tmpl/e-book-backend.sgml b/docs/reference/addressbook/libedata-book/tmpl/e-book-backend.sgml
index 3dbea7d..597b835 100644
--- a/docs/reference/addressbook/libedata-book/tmpl/e-book-backend.sgml
+++ b/docs/reference/addressbook/libedata-book/tmpl/e-book-backend.sgml
@@ -157,8 +157,8 @@ EBookBackend
 </para>
 
 @backend: 
- book: 
- opid: 
+ error: 
+ Returns: 
 
 
 <!-- ##### FUNCTION e_book_backend_create_contact ##### -->
diff --git a/docs/reference/addressbook/libedata-book/tmpl/e-data-book.sgml b/docs/reference/addressbook/libedata-book/tmpl/e-data-book.sgml
index b278aad..f1dfca3 100644
--- a/docs/reference/addressbook/libedata-book/tmpl/e-data-book.sgml
+++ b/docs/reference/addressbook/libedata-book/tmpl/e-data-book.sgml
@@ -122,16 +122,6 @@ EDataBook
 @error: 
 
 
-<!-- ##### FUNCTION e_data_book_respond_remove ##### -->
-<para>
-
-</para>
-
- book: 
- opid: 
- error: 
-
-
 <!-- ##### FUNCTION e_data_book_respond_create ##### -->
 <para>
 
diff --git a/docs/reference/addressbook/libedata-book/tmpl/libedata-book-unused.sgml b/docs/reference/addressbook/libedata-book/tmpl/libedata-book-unused.sgml
index cb02c64..7d08d82 100644
--- a/docs/reference/addressbook/libedata-book/tmpl/libedata-book-unused.sgml
+++ b/docs/reference/addressbook/libedata-book/tmpl/libedata-book-unused.sgml
@@ -250,6 +250,16 @@ e-data-book-types
 @backend: 
 @Returns: 
 
+<!-- ##### FUNCTION e_book_backend_sync_remove ##### -->
+<para>
+
+</para>
+
+ backend: 
+ book: 
+ opid: 
+ perror: 
+
 <!-- ##### FUNCTION e_data_book_factory_activate ##### -->
 <para>
 
@@ -338,6 +348,15 @@ e-data-book-types
 @status: 
 @book_view: 
 
+<!-- ##### FUNCTION e_data_book_respond_remove ##### -->
+<para>
+
+</para>
+
+ book: 
+ opid: 
+ error: 
+
 <!-- ##### FUNCTION e_data_book_view_get_listener ##### -->
 <para>
 



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