[gnome-calendar] manager: make all calendars offline-sync



commit 6967c520c926e8c102df50db1919cdb079f5f519
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Oct 3 14:03:24 2016 -0300

    manager: make all calendars offline-sync
    
    This prevents downloading the same calendar (which can be huge)
    over and over, saving us some bandwidth.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=764623

 src/gcal-manager.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/gcal-manager.c b/src/gcal-manager.c
index b8ec511..735f244 100644
--- a/src/gcal-manager.c
+++ b/src/gcal-manager.c
@@ -341,6 +341,7 @@ on_client_connected (GObject      *source_object,
                      gpointer      user_data)
 {
   GcalManagerUnit *unit;
+  ESourceOffline *offline_extension;
   GcalManager *manager;
   ECalClient *client;
   ESource *source;
@@ -402,6 +403,16 @@ on_client_connected (GObject      *source_object,
     e_client_refresh (E_CLIENT (client), NULL, on_client_refreshed, user_data);
   }
 
+  /* Cache all the online calendars, so the user can see them offline */
+  offline_extension = e_source_get_extension (source, E_SOURCE_EXTENSION_OFFLINE);
+  e_source_offline_set_stay_synchronized (offline_extension, TRUE);
+
+  e_source_registry_commit_source (manager->source_registry,
+                                   source,
+                                   NULL,
+                                   NULL,
+                                   NULL);
+
   g_signal_emit (GCAL_MANAGER (user_data), signals[SOURCE_ADDED], 0, source, unit->enabled);
 
   g_clear_object (&client);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]