[gnome-todo] provider-eds: Make tasklists synchronize offline
- From: Gitlab Administrative User <gitlab src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo] provider-eds: Make tasklists synchronize offline
- Date: Thu, 26 Oct 2017 01:28:34 +0000 (UTC)
commit 60f70c02f410f964363566e3dc38a85ec49adc6a
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 000e847..b17b3d7 100644
--- a/plugins/eds/gtd-provider-eds.c
+++ b/plugins/eds/gtd-provider-eds.c
@@ -75,6 +75,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)
{
@@ -192,6 +207,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]