[evolution-ews] Add locale support for addressbook
- From: David Woodhouse <dwmw2 src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews] Add locale support for addressbook
- Date: Tue, 9 Sep 2014 11:56:18 +0000 (UTC)
commit 588f1b4478d5f72fc93d15be98a993a04065bc10
Author: David Woodhouse <David Woodhouse intel com>
Date: Fri Sep 5 15:07:15 2014 +0100
Add locale support for addressbook
When we add cursor support, it'll depend on this...
src/addressbook/e-book-backend-ews.c | 52 ++++++++++++++++++++++++++++++++++
1 files changed, 52 insertions(+), 0 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-ews.c b/src/addressbook/e-book-backend-ews.c
index 6d343e6..cf017e6 100644
--- a/src/addressbook/e-book-backend-ews.c
+++ b/src/addressbook/e-book-backend-ews.c
@@ -95,6 +95,7 @@ struct _EBookBackendEwsPrivate {
gboolean listen_notifications;
guint rev_counter;
+ gchar *locale;
};
/* using this for backward compatibility with E_DATA_BOOK_MODE */
@@ -3546,6 +3547,13 @@ book_backend_ews_initable_init (GInitable *initable,
return FALSE;
}
+ if (!e_book_sqlite_get_locale (priv->summary, &priv->locale, error)) {
+ convert_error_to_edb_error (error);
+ g_object_unref (priv->summary);
+ priv->summary = NULL;
+ return FALSE;
+ }
+
priv->marked_for_offline = FALSE;
priv->is_writable = FALSE;
@@ -4125,6 +4133,9 @@ e_book_backend_ews_dispose (GObject *object)
priv->summary = NULL;
}
+ g_free (priv->locale);
+ priv->locale = NULL;
+
G_OBJECT_CLASS (e_book_backend_ews_parent_class)->dispose (object);
}
@@ -4205,6 +4216,45 @@ book_backend_ews_try_password_sync (ESourceAuthenticator *authenticator,
return result;
}
+static gboolean
+e_book_backend_ews_set_locale (EBookBackend *backend,
+ const gchar *locale,
+ GCancellable *cancellable,
+ GError **error)
+{
+ EBookBackendEws *ebews = E_BOOK_BACKEND_EWS (backend);
+ gboolean success;
+
+ PRIV_LOCK (ebews->priv);
+
+ success = e_book_sqlite_set_locale (ebews->priv->summary, locale,
+ cancellable, error);
+ if (success) {
+ g_free (ebews->priv->locale);
+ ebews->priv->locale = g_strdup (locale);
+ }
+
+ PRIV_UNLOCK (ebews->priv);
+
+ ebews_bump_revision (ebews, error);
+
+ return success;
+}
+
+static gchar *
+e_book_backend_ews_dup_locale (EBookBackend *backend)
+{
+ EBookBackendEws *ebews = E_BOOK_BACKEND_EWS (backend);
+ EBookBackendEwsPrivate *priv = ebews->priv;
+ gchar *locale;
+
+ PRIV_LOCK (ebews->priv);
+ locale = g_strdup (priv->locale);
+ PRIV_UNLOCK (ebews->priv);
+
+ return locale;
+}
+
static void
e_book_backend_ews_class_init (EBookBackendEwsClass *klass)
{
@@ -4229,6 +4279,8 @@ e_book_backend_ews_class_init (EBookBackendEwsClass *klass)
parent_class->get_contact_list = e_book_backend_ews_get_contact_list;
parent_class->start_view = e_book_backend_ews_start_view;
parent_class->stop_view = e_book_backend_ews_stop_view;
+ parent_class->set_locale = e_book_backend_ews_set_locale;
+ parent_class->dup_locale = e_book_backend_ews_dup_locale;
backend_class->get_destination_address = e_book_backend_ews_get_destination_address;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]