[evolution-data-server/openismus-work-master: 25/150] EBookBackend added new ->set_locale() API and ->get_locale() API



commit 7ef3faac7ebc02a69c25124ca37ff742ecf4bb96
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Fri May 17 20:03:45 2013 +0900

    EBookBackend added new ->set_locale() API and ->get_locale() API
    
    Use these to dynamically set the locale of a running addressbook, and also
    to fetch the currently configured locale of an addressbook at startup time

 addressbook/libedata-book/e-book-backend.c |   50 ++++++++++++++++++++++++++++
 addressbook/libedata-book/e-book-backend.h |    9 +++++
 2 files changed, 59 insertions(+), 0 deletions(-)
---
diff --git a/addressbook/libedata-book/e-book-backend.c b/addressbook/libedata-book/e-book-backend.c
index 3db105a..4541c86 100644
--- a/addressbook/libedata-book/e-book-backend.c
+++ b/addressbook/libedata-book/e-book-backend.c
@@ -3118,6 +3118,56 @@ e_book_backend_sync (EBookBackend *backend)
 }
 
 /**
+ * e_book_backend_set_locale:
+ * @backend: an #EBookbackend
+ * @locale: the new locale for the addressbook
+ *
+ * Notify the addressbook backend that the current locale has
+ * changed, this is important for backends which support
+ * ordered result lists which are locale sensitive.
+ *
+ * Since: 3.10
+ */
+void
+e_book_backend_set_locale (EBookBackend *backend,
+                          const gchar  *locale)
+{
+       g_return_if_fail (E_IS_BOOK_BACKEND (backend));
+
+       g_object_ref (backend);
+
+       if (E_BOOK_BACKEND_GET_CLASS (backend)->set_locale)
+               (* E_BOOK_BACKEND_GET_CLASS (backend)->set_locale) (backend, locale);
+
+       g_object_unref (backend);
+}
+
+/**
+ * e_book_backend_get_locale:
+ * @backend: an #EBookbackend
+ *
+ * Fetch the currently configured locale for the addressbook
+ *
+ * Since: 3.10
+ */
+const gchar *
+e_book_backend_get_locale (EBookBackend *backend)
+{
+       const 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);
+
+       g_object_unref (backend);
+
+       return locale;
+}
+
+/**
  * e_book_backend_notify_update:
  * @backend: an #EBookBackend
  * @contact: a new or modified contact
diff --git a/addressbook/libedata-book/e-book-backend.h b/addressbook/libedata-book/e-book-backend.h
index 7b5d845..3c80a39 100644
--- a/addressbook/libedata-book/e-book-backend.h
+++ b/addressbook/libedata-book/e-book-backend.h
@@ -217,6 +217,11 @@ struct _EBookBackendClass {
 
        void            (*sync)                 (EBookBackend *backend);
 
+       void            (*set_locale)           (EBookBackend *backend,
+                                                const gchar  *locale);
+       const gchar    *(*get_locale)           (EBookBackend *backend);
+
+
        /* Signals */
        void            (*closed)               (EBookBackend *backend,
                                                 const gchar *sender);
@@ -385,6 +390,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);
+const gchar    *e_book_backend_get_locale       (EBookBackend *backend);
+
 GSimpleAsyncResult *
                e_book_backend_prepare_for_completion
                                                (EBookBackend *backend,


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