diff --git a/src/mconnect/devicemanager-proxy.vala b/src/mconnect/devicemanager-proxy.vala index 061f4e5..22de62c 100644 --- a/src/mconnect/devicemanager-proxy.vala +++ b/src/mconnect/devicemanager-proxy.vala @@ -68,6 +68,25 @@ class DeviceManagerDBusProxy : Object this.manager.allow_device(dev_proxy.device); } + /** + * disallow_device: + * @path: device object path + * + * Disallow given device + */ + public void disallow_device(string path) { + debug("disallow device %s", path); + + var dev_proxy = this.devices.@get(path); + + if (dev_proxy == null) { + warning("no device under path %s", path); + return; + } + + this.manager.disallow_device(dev_proxy.device); + } + /** * list_devices: * @@ -143,4 +162,4 @@ class DeviceManagerDBusProxy : Object return path; } -} \ No newline at end of file +} diff --git a/src/mconnect/devicemanager.vala b/src/mconnect/devicemanager.vala index df01a50..4463f37 100644 --- a/src/mconnect/devicemanager.vala +++ b/src/mconnect/devicemanager.vala @@ -252,4 +252,17 @@ class DeviceManager : GLib.Object // maybe activate if needed activate_device(dev); } -} \ No newline at end of file + + /** + * disallow_device: + * @path: device object path + * + * Disallow given device + */ + public void disallow_device(Device dev) { + dev.allowed = false; + + // update device cache + update_cache(); + } +}