[gnome-todo/gnome-3-26] provider-eds: Make tasklists synchronize offline
- From: Gitlab Administrative User <gitlab src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo/gnome-3-26] provider-eds: Make tasklists synchronize offline
- Date: Thu, 26 Oct 2017 01:28:29 +0000 (UTC)
commit 55a02ee233ae0ef8a928d7c09e27b1847a88ad0c
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Oct 25 23:26:52 2017 -0200
provider-eds: Make tasklists synchronize offline
This prevents downloading the same tasklist (which can be huge)
over and over, saving us some bandwidth.
plugins/eds/gtd-provider-eds.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
---
diff --git a/plugins/eds/gtd-provider-eds.c b/plugins/eds/gtd-provider-eds.c
index b7b33e7..f1d998b 100644
--- a/plugins/eds/gtd-provider-eds.c
+++ b/plugins/eds/gtd-provider-eds.c
@@ -74,6 +74,21 @@ task_data_new (GtdProviderEds *provider,
}
static void
+ensure_offline_sync (GtdProviderEds *self,
+ ESource *source)
+{
+ GtdProviderEdsPrivate *priv;
+ ESourceOffline *extension;
+
+ priv = gtd_provider_eds_get_instance_private (self);
+
+ extension = e_source_get_extension (source, E_SOURCE_EXTENSION_OFFLINE);
+ e_source_offline_set_stay_synchronized (extension, TRUE);
+
+ e_source_registry_commit_source (priv->source_registry, source, NULL, NULL, NULL);
+}
+
+static void
gtd_provider_eds_set_default (GtdProviderEds *self,
GtdTaskList *list)
{
@@ -191,6 +206,9 @@ gtd_provider_eds_on_client_connected (GObject *source_object,
/* creates a new task list */
list = gtd_task_list_eds_new (GTD_PROVIDER (self), source);
+ /* ensure tasklist is cached offline */
+ ensure_offline_sync (self, source);
+
/* it's not ready until we fetch the list of tasks from client */
gtd_object_set_ready (GTD_OBJECT (list), FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]