[evolution-data-server/openismus-work-master: 82/137] Changes for Review: Changed a couple of the cursor related backend APIs



commit 91b6feea5a92026b8d871e3c284e637b5ac20855
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Sat Oct 5 01:56:36 2013 +0200

    Changes for Review: Changed a couple of the cursor related backend APIs

 addressbook/libedata-book/e-book-backend.c |   38 +++++++++++++++++----------
 addressbook/libedata-book/e-book-backend.h |   19 +++++++------
 2 files changed, 34 insertions(+), 23 deletions(-)
---
diff --git a/addressbook/libedata-book/e-book-backend.c b/addressbook/libedata-book/e-book-backend.c
index a46cbeb..a239541 100644
--- a/addressbook/libedata-book/e-book-backend.c
+++ b/addressbook/libedata-book/e-book-backend.c
@@ -3143,24 +3143,24 @@ e_book_backend_set_locale (EBookBackend *backend,
 }
 
 /**
- * e_book_backend_get_locale:
+ * e_book_backend_dup_locale:
  * @backend: an #EBookbackend
  *
- * Fetch the currently configured locale for the addressbook
+ * Fetches a copy of the currently configured locale for the addressbook
  *
  * Since: 3.10
  */
-const gchar *
-e_book_backend_get_locale (EBookBackend *backend)
+gchar *
+e_book_backend_dup_locale (EBookBackend *backend)
 {
-       const gchar *locale = NULL;
+       gchar *locale = NULL;
 
        g_return_val_if_fail (E_IS_BOOK_BACKEND (backend), NULL);
 
        g_object_ref (backend);
 
-       if (E_BOOK_BACKEND_GET_CLASS (backend)->get_locale)
-               locale = (* E_BOOK_BACKEND_GET_CLASS (backend)->get_locale) (backend);
+       if (E_BOOK_BACKEND_GET_CLASS (backend)->dup_locale)
+               locale = (* E_BOOK_BACKEND_GET_CLASS (backend)->dup_locale) (backend);
 
        g_object_unref (backend);
 
@@ -3359,7 +3359,7 @@ e_book_backend_prepare_for_completion (EBookBackend *backend,
  * e_book_backend_create_cursor:
  * @backend: an #EBookBackend
  * @sort_fields: the #EContactFields to sort by
- * @sort_types: the #EBookSortTypes for the sorted fields
+ * @sort_types: the #EBookCursorSortTypes for the sorted fields
  * @n_fields: the number of fields in the @sort_fields and @sort_types
  * @error: return location for a #GError, or %NULL
  *
@@ -3381,7 +3381,7 @@ e_book_backend_prepare_for_completion (EBookBackend *backend,
 EDataBookCursor *
 e_book_backend_create_cursor (EBookBackend *backend,
                              EContactField *sort_fields,
-                             EBookSortType *sort_types,
+                             EBookCursorSortType *sort_types,
                              guint n_fields,
                              GError **error)
 {
@@ -3412,23 +3412,33 @@ e_book_backend_create_cursor (EBookBackend *backend,
  * e_book_backend_delete_cursor:
  * @backend: an #EBookBackend
  * @cursor: the #EDataBookCursor to destroy
+ * @error: return location for a #GError, or %NULL
  *
- * Destroys @cursor
+ * Requests @backend to release and destroy @cursor, this
+ * will trigger an %E_CLIENT_ERROR_INVALID_ARG error if @cursor
+ * is not owned by @backend.
+ *
+ * Returns: Whether @cursor was successfully deleted.
  *
  * Since: 3.10
  */
-void
+gboolean
 e_book_backend_delete_cursor (EBookBackend *backend,
-                             EDataBookCursor *cursor)
+                             EDataBookCursor *cursor,
+                             GError **error)
 {
-       g_return_if_fail (E_IS_BOOK_BACKEND (backend));
+       gboolean success = FALSE;
+
+       g_return_val_if_fail (E_IS_BOOK_BACKEND (backend), FALSE);
 
        g_object_ref (backend);
 
        if (E_BOOK_BACKEND_GET_CLASS (backend)->delete_cursor)
-               (* E_BOOK_BACKEND_GET_CLASS (backend)->delete_cursor) (backend, cursor);
+               success = (* E_BOOK_BACKEND_GET_CLASS (backend)->delete_cursor) (backend, cursor, error);
        else
                g_warning ("Backend asked to delete a cursor, but does not support cursors");
 
        g_object_unref (backend);
+
+       return success;
 }
diff --git a/addressbook/libedata-book/e-book-backend.h b/addressbook/libedata-book/e-book-backend.h
index fcbe45e..e45ec6b 100644
--- a/addressbook/libedata-book/e-book-backend.h
+++ b/addressbook/libedata-book/e-book-backend.h
@@ -220,16 +220,16 @@ struct _EBookBackendClass {
 
        void            (*set_locale)           (EBookBackend *backend,
                                                 const gchar  *locale);
-       const gchar    *(*get_locale)           (EBookBackend *backend);
-
+       gchar          *(*dup_locale)           (EBookBackend *backend);
        EDataBookCursor *
                        (*create_cursor)        (EBookBackend *backend,
                                                 EContactField *sort_fields,
-                                                EBookSortType *sort_types,
+                                                EBookCursorSortType *sort_types,
                                                 guint n_fields,
                                                 GError **error);
-       void            (* delete_cursor)       (EBookBackend *backend,
-                                                EDataBookCursor *cursor);
+       gboolean        (* delete_cursor)       (EBookBackend *backend,
+                                                EDataBookCursor *cursor,
+                                                GError **error);
 
        /* Signals */
        void            (*closed)               (EBookBackend *backend,
@@ -401,16 +401,17 @@ void              e_book_backend_sync             (EBookBackend *backend);
 
 void            e_book_backend_set_locale       (EBookBackend *backend,
                                                 const gchar  *locale);
-const gchar    *e_book_backend_get_locale       (EBookBackend *backend);
+gchar          *e_book_backend_dup_locale       (EBookBackend *backend);
 
 EDataBookCursor *
                 e_book_backend_create_cursor    (EBookBackend *backend,
                                                 EContactField *sort_fields,
-                                                EBookSortType *sort_types,
+                                                EBookCursorSortType *sort_types,
                                                 guint n_fields,
                                                 GError **error);
-void            e_book_backend_delete_cursor    (EBookBackend *backend,
-                                                EDataBookCursor *cursor);
+gboolean        e_book_backend_delete_cursor    (EBookBackend *backend,
+                                                EDataBookCursor *cursor,
+                                                GError **error);
 
 GSimpleAsyncResult *
                e_book_backend_prepare_for_completion


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