[evolution-data-server/openismus-work-3-8] Changes for Review: Changed a couple of the cursor related backend APIs
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/openismus-work-3-8] Changes for Review: Changed a couple of the cursor related backend APIs
- Date: Sat, 5 Oct 2013 00:07:25 +0000 (UTC)
commit e682a3f643746f3419e2046c409d3a2e423f3ee1
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 | 18 +++++++------
2 files changed, 34 insertions(+), 22 deletions(-)
---
diff --git a/addressbook/libedata-book/e-book-backend.c b/addressbook/libedata-book/e-book-backend.c
index bd48a07..fe4513b 100644
--- a/addressbook/libedata-book/e-book-backend.c
+++ b/addressbook/libedata-book/e-book-backend.c
@@ -1227,24 +1227,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);
@@ -1511,7 +1511,7 @@ e_book_backend_respond_opened (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
*
@@ -1533,7 +1533,7 @@ e_book_backend_respond_opened (EBookBackend *backend,
EDataBookCursor *
e_book_backend_create_cursor (EBookBackend *backend,
EContactField *sort_fields,
- EBookSortType *sort_types,
+ EBookCursorSortType *sort_types,
guint n_fields,
GError **error)
{
@@ -1564,23 +1564,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
+ *
+ * Requests @backend to release and destroy @cursor, this
+ * will trigger an %E_CLIENT_ERROR_INVALID_ARG error if @cursor
+ * is not owned by @backend.
*
- * Destroys @cursor
+ * 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 a623693..d8b8edb 100644
--- a/addressbook/libedata-book/e-book-backend.h
+++ b/addressbook/libedata-book/e-book-backend.h
@@ -205,15 +205,16 @@ struct _EBookBackendClass {
const gchar *config);
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);
/* Notification signals */
void (*sync) (EBookBackend *backend);
@@ -317,16 +318,17 @@ void e_book_backend_configure_direct (EBookBackend *backend, const gc
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);
/* protected functions for subclasses */
void e_book_backend_set_is_removed (EBookBackend *backend,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]