Commit f44aa895 authored by Tristan Van Berkom's avatar Tristan Van Berkom
Browse files

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
parent f48972a6
......@@ -1199,6 +1199,56 @@ e_book_backend_sync (EBookBackend *backend)
g_object_unref (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
......
......@@ -200,6 +200,9 @@ struct _EBookBackendClass {
(*get_direct_book) (EBookBackend *backend);
void (*configure_direct) (EBookBackend *backend,
const gchar *config);
void (*set_locale) (EBookBackend *backend,
const gchar *locale);
const gchar *(*get_locale) (EBookBackend *backend);
/* Notification signals */
void (*sync) (EBookBackend *backend);
......@@ -301,6 +304,9 @@ EDataBookDirect *
void e_book_backend_configure_direct (EBookBackend *backend, const gchar *config);
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);
/* protected functions for subclasses */
void e_book_backend_set_is_removed (EBookBackend *backend,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment