hal/tools/device-manager DeviceManager.py,1.26,1.27

David Zeuthen david at freedesktop.org
Fri Jul 15 13:29:00 PDT 2005


Update of /cvs/hal/hal/tools/device-manager
In directory gabe:/tmp/cvs-serv29247/tools/device-manager

Modified Files:
	DeviceManager.py 
Log Message:
2005-07-15  David Zeuthen  <davidz at redhat.com>

	* tools/device-manager/DeviceManager.py: Here is a patch to fix up
	hal-device-manager.  This will still run with older D-BUS's but
	you will need 0.35 to get all the fixes since there were some
	problems with the signal removal code.  I am working on getting
	0.35 out the door today. Patch from John (J5) Palmieri
	<johnp at redhat.com>.



Index: DeviceManager.py
===================================================================
RCS file: /cvs/hal/hal/tools/device-manager/DeviceManager.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- DeviceManager.py	7 Jul 2005 18:37:26 -0000	1.26
+++ DeviceManager.py	15 Jul 2005 20:28:57 -0000	1.27
@@ -4,6 +4,10 @@
 import gobject
 import gtk
 import dbus
+if getattr(dbus, "version", (0,0,0)) >= (0,41,0):
+    import dbus.glib
+
+
 
 try:
     import gnome.ui
@@ -89,29 +93,17 @@
 				     "org.freedesktop.Hal.Device",
 				     "org.freedesktop.Hal",
 				     udi)
-	return
-	self.bus.add_signal_receiver(lambda *args: self.device_condition(udi, *args),
-				     "Condition",
-				     "org.freedesktop.Hal.Device",
-				     "org.freedesktop.Hal",
-				     udi)
 
     def remove_device_signal_recv (self, udi):
-	try:
-		self.bus.remove_signal_receiver(lambda *args: self.property_modified(udi, *args),
-					     "PropertyModified",
-					     "org.freedesktop.Hal.Device",
-					     "org.freedesktop.Hal",
-					     udi)
-	except:
-		print "FIXME: unknown reason for the error while removing this rule from dbus"
-	return
-	self.bus.remove_signal_receiver(lambda *args: self.device_condition(udi, *args),
-				     "Condition",
-				     "org.freedesktop.Hal.Device",
-				     "org.freedesktop.Hal",
-				     udi)
-
+        try:
+            self.bus.remove_signal_receiver(None,
+				            "PropertyModified",
+				            "org.freedesktop.Hal.Device",
+				            "org.freedesktop.Hal",
+				            udi)
+        except Exception, e:
+            print "Older versions of the D-BUS bindings have an error when removing signals. Please upgrade."
+            print e
 
     def get_current_focus_udi(self):
         """Get the UDI of the currently focused device"""




More information about the hal-commit mailing list