From 6967c520c926e8c102df50db1919cdb079f5f519 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Mon, 3 Oct 2016 14:03:24 -0300 Subject: [PATCH] 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 file changed, 11 insertions(+) diff --git a/src/gcal-manager.c b/src/gcal-manager.c index b8ec5117..735f244a 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);