[evolution-kolab] ECalBackendKolab: added server sync point to start_view()
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab] ECalBackendKolab: added server sync point to start_view()
- Date: Mon, 3 Sep 2012 16:58:50 +0000 (UTC)
commit 8bf6cda5ac234116356d655b36c25d9fc331727b
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Mon Sep 3 18:55:38 2012 +0200
ECalBackendKolab: added server sync point to start_view()
* when starting a new calendar 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/calendar/e-cal-backend-kolab.c | 43 ++++++++++++++++++++++++++++++++++-
1 files changed, 41 insertions(+), 2 deletions(-)
---
diff --git a/src/calendar/e-cal-backend-kolab.c b/src/calendar/e-cal-backend-kolab.c
index 0bc65bd..d48be33 100644
--- a/src/calendar/e-cal-backend-kolab.c
+++ b/src/calendar/e-cal-backend-kolab.c
@@ -1742,7 +1742,7 @@ cal_backend_kolab_start_view (ECalBackend *backend,
GList *it = NULL;
GSList *iCal_objects = NULL;
const gchar *query = NULL;
- const gchar *foldername;
+ const gchar *foldername = NULL;
GError *tmp_err = NULL;
GError *view_err = NULL;
gboolean ok = FALSE;
@@ -1758,9 +1758,48 @@ cal_backend_kolab_start_view (ECalBackend *backend,
g_object_ref (view); /* unref()d in stop_view() */
query = e_data_cal_view_get_text (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->cal_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->cal_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;
+ }
+
ok = kolab_util_calendar_cache_update_on_query (E_CAL_BACKEND_SYNC (backend),
priv->cal_cache,
priv->cal_koma,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]