From bb45b127514293d22482296646d570734e07773e Mon Sep 17 00:00:00 2001 From: Maciek Borzecki Date: Thu, 1 Jun 2017 22:19:04 +0200 Subject: [PATCH] devicemanager, proxy: proper 'new device' signal --- src/mconnect/devicemanager-proxy.vala | 2 +- src/mconnect/devicemanager.vala | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mconnect/devicemanager-proxy.vala b/src/mconnect/devicemanager-proxy.vala index 5682a5c..9a962f4 100644 --- a/src/mconnect/devicemanager-proxy.vala +++ b/src/mconnect/devicemanager-proxy.vala @@ -36,7 +36,7 @@ class DeviceManagerDBusProxy : Object this.bus = bus; this.devices = new HashMap(); - manager.found_device.connect((d) => { + manager.found_new_device.connect((d) => { this.add_device(d); }); } diff --git a/src/mconnect/devicemanager.vala b/src/mconnect/devicemanager.vala index 7738d52..ef01211 100644 --- a/src/mconnect/devicemanager.vala +++ b/src/mconnect/devicemanager.vala @@ -21,7 +21,7 @@ using Gee; class DeviceManager : GLib.Object { - public signal void found_device(Device dev); + public signal void found_new_device(Device dev); public const string DEVICES_CACHE_FILE = "devices"; @@ -67,7 +67,7 @@ class DeviceManager : GLib.Object var dev = Device.new_from_cache(kf, group); if (dev != null) { debug("device %s from cache", dev.to_string()); - found_device(dev); + handle_new_device(dev); } } } catch (Error e) { @@ -133,6 +133,11 @@ class DeviceManager : GLib.Object } else { message("skipping device %s activation, device not allowed", dev.to_string()); } + + // notify everyone that a new device appeared + if (is_new) { + found_new_device(dev); + } } private void activate_device(Device dev) {