EBookBackend: e_book_backend_set_locale() now has GCancellable
authorTristan Van Berkom <tristanvb@openismus.com>
Fri, 29 Nov 2013 12:23:34 +0000 (21:23 +0900)
committerTristan Van Berkom <tristanvb@openismus.com>
Fri, 29 Nov 2013 13:08:03 +0000 (22:08 +0900)
addressbook/libedata-book/e-book-backend.c
addressbook/libedata-book/e-book-backend.h

index ce5afc3..2e312c5 100644 (file)
@@ -3288,25 +3288,34 @@ e_book_backend_sync (EBookBackend *backend)
  * e_book_backend_set_locale:
  * @backend: an #EBookbackend
  * @locale: the new locale for the addressbook
+ * @cancellable: optional #GCancellable object, or %NULL
+ * @error: return location for a #GError, or %NULL
  *
  * Notify the addressbook backend that the current locale has
  * changed, this is important for backends which support
  * ordered result lists which are locale sensitive.
  *
+ * Returns: %TRUE on success, %FALSE on failure
+ *
  * Since: 3.12
  */
-void
+gboolean
 e_book_backend_set_locale (EBookBackend *backend,
-                          const gchar  *locale)
+                          const gchar  *locale,
+                          GCancellable *cancellable,
+                          GError      **error)
 {
-       g_return_if_fail (E_IS_BOOK_BACKEND (backend));
+       g_return_val_if_fail (E_IS_BOOK_BACKEND (backend), FALSE);
 
        g_object_ref (backend);
 
        if (E_BOOK_BACKEND_GET_CLASS (backend)->set_locale)
-               (* E_BOOK_BACKEND_GET_CLASS (backend)->set_locale) (backend, locale);
-
+               return (* E_BOOK_BACKEND_GET_CLASS (backend)->set_locale) (backend, locale,
+                                                                          cancellable, error);
        g_object_unref (backend);
+
+       /* Backend does not support locales, just happily return */
+       return TRUE;
 }
 
 /**
index 43594cb..d3230b0 100644 (file)
@@ -218,8 +218,10 @@ struct _EBookBackendClass {
 
        void            (*sync)                 (EBookBackend *backend);
 
-       void            (*set_locale)           (EBookBackend *backend,
-                                                const gchar  *locale);
+       gboolean        (*set_locale)           (EBookBackend *backend,
+                                                const gchar  *locale,
+                                                GCancellable *cancellable,
+                                                GError **error);
        gchar          *(*dup_locale)           (EBookBackend *backend);
        EDataBookCursor *
                        (*create_cursor)        (EBookBackend *backend,
@@ -402,8 +404,10 @@ void               e_book_backend_configure_direct (EBookBackend *backend,
 
 void           e_book_backend_sync             (EBookBackend *backend);
 
-void            e_book_backend_set_locale       (EBookBackend *backend,
-                                                const gchar  *locale);
+gboolean        e_book_backend_set_locale       (EBookBackend *backend,
+                                                const gchar  *locale,
+                                                GCancellable *cancellable,
+                                                GError      **error);
 gchar          *e_book_backend_dup_locale       (EBookBackend *backend);
 
 EDataBookCursor *