From 1e664bf8af572395349d881de3b4cddb988817b6 Mon Sep 17 00:00:00 2001 From: Maciek Borzecki Date: Thu, 1 Jun 2017 09:08:41 +0200 Subject: [PATCH] application, devicemanager: restore devices from cache when application becomes active --- src/mconnect/application.vala | 2 ++ src/mconnect/devicemanager.vala | 7 ++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/mconnect/application.vala b/src/mconnect/application.vala index 5e1aa6c..4dc9a41 100644 --- a/src/mconnect/application.vala +++ b/src/mconnect/application.vala @@ -71,6 +71,8 @@ namespace Mconn { protected override void activate() { debug("activate"); + // reload devices from cache + manager.load_cache(); hold(); } diff --git a/src/mconnect/devicemanager.vala b/src/mconnect/devicemanager.vala index 37f5c6c..a07a34e 100644 --- a/src/mconnect/devicemanager.vala +++ b/src/mconnect/devicemanager.vala @@ -44,10 +44,6 @@ class DeviceManager : GLib.Object debug("device manager.."); this.devices = new HashMap(); - - // TODO: check for network connectivity first, possibly pass - // this through the main loop - load_cache(); } /** @@ -68,7 +64,8 @@ class DeviceManager : GLib.Object /** * Load known devices from cache and attempt pairing. */ - private void load_cache() { + [DBus (visible = false)] + public void load_cache() { debug("try loading devices from device cache"); var cache_file = get_cache_file();