From 44d2605c0b6409bd4a3277f41e1994b00a15cf7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20F=C3=A9lix=20Onta=C3=B1=C3=B3n?= Date: Sun, 10 Aug 2014 00:47:26 +0200 Subject: [PATCH] Device change event: properties are not updated. Fixes #9 (thanks @shatsky) --- udev-discover.in | 3 +-- udevdiscover/devicefinder.py | 8 +++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/udev-discover.in b/udev-discover.in index d8252b3..20c4b55 100644 --- a/udev-discover.in +++ b/udev-discover.in @@ -334,8 +334,7 @@ class UDevDiscoverGUI(GConfStore): self.logger.info(_('Device removed: %s') % device.nice_label) - def changed_device(self, device_finder, device): - old_device = self.device_finder.get_devices_tree()[device.path] + def changed_device(self, device_finder, device, old_device): if self.rows.has_key(device.path): # Remove from tree first diff --git a/udevdiscover/devicefinder.py b/udevdiscover/devicefinder.py index dc94598..eb2fe6b 100644 --- a/udevdiscover/devicefinder.py +++ b/udevdiscover/devicefinder.py @@ -48,8 +48,8 @@ class DeviceFinder(GObject.GObject): (GObject.TYPE_PYOBJECT,)), 'removed': (GObject.SignalFlags.RUN_LAST, None, (GObject.TYPE_PYOBJECT,)), - 'changed': (GObject.SignalFlags.RUN_LAST, None, - (GObject.TYPE_PYOBJECT,)), + 'changed': (GObject.SignalFlags.RUN_LAST, None, + (GObject.TYPE_PYOBJECT, GObject.TYPE_PYOBJECT,)), } def __init__(self, subsystems='', parent_tree=False): @@ -143,7 +143,9 @@ def device_changed(self, gudevice, subsystem): '''Called when a device has been updated''' dev = device.get_device_object(gudevice) - self.emit('changed', dev) + old_dev = self.devices_tree[dev.path] + self.devices_tree[dev.path] = dev + self.emit('changed', dev, old_dev) GObject.type_register(DeviceFinder)