[evolution-kolab] EBookBackendKolab: added server sync point to start_view()
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab] EBookBackendKolab: added server sync point to start_view()
- Date: Mon, 3 Sep 2012 16:58:45 +0000 (UTC)
commit 333e3415527e9f718cb02467b719d5a913d0f9f2
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Mon Sep 3 18:53:58 2012 +0200
EBookBackendKolab: added server sync point to start_view()
* when starting a new address book view, do
a server synchronization
* we're trying to go online when starting a
new view (which may fail, but we try nonetheless)
src/addressbook/e-book-backend-kolab.c | 42 ++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-kolab.c b/src/addressbook/e-book-backend-kolab.c
index 6043487..affaf49 100644
--- a/src/addressbook/e-book-backend-kolab.c
+++ b/src/addressbook/e-book-backend-kolab.c
@@ -967,6 +967,7 @@ book_backend_kolab_start_book_view (EBookBackend *backend,
GList *econtact_list = NULL;
GList *it = NULL;
const gchar *query = NULL;
+ const gchar *foldername = NULL;
gboolean ok = FALSE;
GError *tmp_err = NULL;
GError *notify_err = NULL;
@@ -982,6 +983,47 @@ book_backend_kolab_start_book_view (EBookBackend *backend,
g_object_ref (book_view); /* unref()d in stop_view() */
query = e_data_book_view_get_card_query (book_view);
+ foldername = kolab_util_backend_get_foldername (E_BACKEND (backend));
+
+ /* try to switch into online mode. if that fails,
+ * we assume there's no network or service available
+ * and continue in offline mode.
+ *
+ * FIXME we need some error reporting here. Going
+ * online may block for any kind of reasons, in which
+ * case the view will never get started...
+ */
+ ok = kolab_util_backend_deploy_mode_by_backend (priv->book_koma,
+ TRUE, /* go online */
+ NULL, /* FIXME: GCancellable */
+ &tmp_err);
+ if (! ok) {
+ g_warning ("%s()[%u]: %s", __func__, __LINE__, tmp_err->message);
+ g_error_free (tmp_err);
+ tmp_err = NULL;
+ }
+
+ /* Up to 3.4, we've been synchronizing folder metadata and
+ * PIM payload data with the Kolab server when going online.
+ * This can now be done in a separate synchronization function, which
+ * can be called upon per user request or at any place internally
+ * where it seems fit (e.g. when switching views - but beware,
+ * that operation can become quite bulky and time consuming).
+ * Until we get a synchronize() backend API function, we will
+ * put a sync point here to mimick the previous behaviour.
+ *
+ * We just pretend that going online went okay.
+ */
+ ok = kolab_mail_access_synchronize (priv->book_koma,
+ foldername,
+ TRUE, /* full sync */
+ NULL, /* FIXME: GCancellable */
+ &tmp_err);
+ if (! ok) {
+ g_warning ("%s()[%u]: %s", __func__, __LINE__, tmp_err->message);
+ g_error_free (tmp_err);
+ tmp_err = NULL;
+ }
/* First update the BackendCache to the current situation. */
ok = kolab_util_contact_cache_update_on_query (E_BOOK_BACKEND_SYNC (backend),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]