New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Device change event: child devices are dropped #8

shatsky opened this Issue Aug 8, 2014 · 1 comment


None yet
2 participants

shatsky commented Aug 8, 2014

changed_device() updates device in tree by simply removing it and then adding again; treestore.remove() removes it with child devices, and subsequently called add_new_device() doesn't add them back.
My quick&dirty solution is to use treestore.set() instead of removing and re-adding:

@@ -340,12 +343,20 @@ class UDevDiscoverGUI(GConfStore):
         if self.rows.has_key(device.path):
             # Remove from tree first
             ref_row = self.rows[device.path]
             treeiter = self.devices_treestore.get_iter(ref_row.get_path())
-            self.devices_treestore.remove(treeiter)
-            del(self.rows[device.path])
+            # treestore.remove(treeiter) removes node with all children; we need to update without removing or move children to a new node first
+            self.devices_treestore.set(treeiter, range(6), [device.path, 
+                device_icon, device.nice_label, device.subsystem, False, 
+      ])

             # Add again
-            row_ref = self.add_new_device(device)
+            row_ref = self.rows[device.path]

             if self.options['expanded']:
                 iter_path = row_ref.get_path()

I consider making add_new_device handle both adding and updating: it will check whether device.path is in self.rows, then update existing device row if it is or add a now one it if not.

@shatsky shatsky changed the title from Child devices are dropped if device is changed to Device change event: child devices are dropped Aug 8, 2014

@fontanon fontanon closed this in 320cd33 Aug 9, 2014


This comment has been minimized.

Show comment
Hide comment

fontanon Aug 9, 2014


Change integrated in udev-discover-0.2.3


fontanon commented Aug 9, 2014

Change integrated in udev-discover-0.2.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment