[evolution-data-server] EBookBackend: Added apis for backends to support Direct Read Access



commit 384d6f5684e2b83b8582642867cc8809c26ae3c8
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Fri Feb 15 17:54:24 2013 +0900

    EBookBackend: Added apis for backends to support Direct Read Access
    
    e_book_backend_get_direct_book:
      A backend can return an EDataBookDirect from here to indicate
      that it supports direct read access, the properties of the EDataBookDirect
      are used by the client to access the book directly
    
    e_book_backend_configure_direct:
      A backend opened in direct read access mode can be configured with
      the string that it's server side counterpart provided, this string
      belongs to the backend; for the local file backend it is used as
      a path to ensure the same SQLite DB is opened by the client as the
      one running in the server.

 addressbook/libedata-book/e-book-backend.c |   48 ++++++++++++++++++++++++++++
 addressbook/libedata-book/e-book-backend.h |   10 ++++++
 configure.ac                               |    2 +-
 3 files changed, 59 insertions(+), 1 deletions(-)
---
diff --git a/addressbook/libedata-book/e-book-backend.c b/addressbook/libedata-book/e-book-backend.c
index 200d8e2..7eaf505 100644
--- a/addressbook/libedata-book/e-book-backend.c
+++ b/addressbook/libedata-book/e-book-backend.c
@@ -1098,6 +1098,54 @@ e_book_backend_set_is_removed (EBookBackend *backend,
 }
 
 /**
+ * e_book_backend_get_direct_book:
+ * @backend: an #EBookBackend
+ *
+ * Tries to create an #EDataBookDirect for @backend if
+ * backend supports direct read access.
+ *
+ * Returns: (transfer full): A new #EDataBookDirect object, or %NULL if @backend does not support direct 
access
+ *
+ * Since: 3.8
+ */
+EDataBookDirect *
+e_book_backend_get_direct_book (EBookBackend *backend)
+{
+       g_return_val_if_fail (E_IS_BOOK_BACKEND (backend), NULL);
+
+       if (E_BOOK_BACKEND_GET_CLASS (backend)->get_direct_book)
+               return E_BOOK_BACKEND_GET_CLASS (backend)->get_direct_book (backend);
+
+       return NULL;
+}
+
+/**
+ * e_book_backend_configure_direct:
+ * @backend: an #EBookBackend
+ * @config: The configuration string for the given backend
+ *
+ * This method is called on @backend in direct read access mode.
+ * The @config argument is the same configuration string which
+ * the same backend reported in the #EDataBookDirect returned
+ * by e_book_backend_get_direct_book().
+ *
+ * The configuration string is optional and is used to ensure
+ * that direct access backends are properly configured to
+ * interface with the same data as the running server side backend.
+ *
+ * Since: 3.8
+ */
+void
+e_book_backend_configure_direct (EBookBackend *backend,
+                                const gchar *config)
+{
+       g_return_if_fail (E_IS_BOOK_BACKEND (backend));
+
+       if (E_BOOK_BACKEND_GET_CLASS (backend)->configure_direct)
+               E_BOOK_BACKEND_GET_CLASS (backend)->configure_direct (backend, config);
+}
+
+/**
  * e_book_backend_sync:
  * @backend: an #EBookbackend
  *
diff --git a/addressbook/libedata-book/e-book-backend.h b/addressbook/libedata-book/e-book-backend.h
index 272e911..62430b8 100644
--- a/addressbook/libedata-book/e-book-backend.h
+++ b/addressbook/libedata-book/e-book-backend.h
@@ -31,6 +31,7 @@
 
 #include <libedata-book/e-data-book.h>
 #include <libedata-book/e-data-book-view.h>
+#include <libedata-book/e-data-book-direct.h>
 
 /* Standard GObject macros */
 #define E_TYPE_BOOK_BACKEND \
@@ -195,6 +196,11 @@ struct _EBookBackendClass {
        void            (*notify_update)        (EBookBackend *backend,
                                                 const EContact *contact);
 
+
+       EDataBookDirect *
+               (* get_direct_book)             (EBookBackend *backend);
+       void    (* configure_direct)            (EBookBackend *backend, const gchar *config);
+
        /* Notification signals */
        void            (*sync)                 (EBookBackend *backend);
 };
@@ -290,6 +296,10 @@ void               e_book_backend_notify_property_changed
                                                 const gchar *prop_name,
                                                 const gchar *prop_value);
 
+EDataBookDirect *
+                e_book_backend_get_direct_book  (EBookBackend *backend);
+void            e_book_backend_configure_direct (EBookBackend *backend, const gchar *config);
+
 void           e_book_backend_sync             (EBookBackend *backend);
 
 /* protected functions for subclasses */
diff --git a/configure.ac b/configure.ac
index 2a012dd..0dbb3f4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -118,7 +118,7 @@ LIBEDATACAL_CURRENT=20
 LIBEDATACAL_REVISION=0
 LIBEDATACAL_AGE=0
 
-LIBEDATABOOK_CURRENT=16
+LIBEDATABOOK_CURRENT=17
 LIBEDATABOOK_REVISION=0
 LIBEDATABOOK_AGE=0
 


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