hal/tools/device-manager DeviceManager.py,1.17,1.18
David Zeuthen
david at freedesktop.org
Mon Feb 14 10:20:07 PST 2005
Update of /cvs/hal/hal/tools/device-manager
In directory gabe:/tmp/cvs-serv18090/tools/device-manager
Modified Files:
DeviceManager.py
Log Message:
2005-02-14 David Zeuthen <davidz at redhat.com>
* configure.in: Require dbus >= 0.30
2005-02-11 John (J5) Palmieri <johnp at redhat.com>
* hald/device.c, hald/device_info.c, hald/property.c, hald/property.h,
tools/hal_set_property.c, tools/hal_get_property.c:
s/HAL_PROPERTY_TYPE_NIL/HAL_PROPERTY_TYPE_INVALID
* hald/hald_dbus.c: ported to new dbus-0.30 API
(foreach_property_append): implemented real string lists
and got rid of the \tval\tval\tval\t hack
* libhal/libhal.c: ported to new dbus-0.30 API
s/HAL_PROPERTY_TYPE_NIL/HAL_PROPERTY_TYPE_INVALID
(libhal_get_string_array_from_iter): new helper function to create
string arrays from dbus arrays
(libhal_property_fill_value_from_variant): new helper function
that fills in properties from variants. Used when getting
a hash of properties from hald
* libhal/libhal.h: s/HAL_PROPERTY_TYPE_NIL/HAL_PROPERTY_TYPE_INVALID
HAL_PROPERTY_TYPE_INVALID = DBUS_TYPE_INVALID
* hald/hald_test_libhal.c: ported to new dbus-0.30 API
Added success messages and more detailed failed messages
* hald/util.c (hal_util_compute_udi): Change all illegal characters
to underscores '_'
* tools/device-manager/DeviceManager.py
(DeviceManager::__init__, add_device_signal_recv):
change add_signal_receiver calls to add expand_args=False parameter.
(DeviceManager::device_changed, gdl_changed): changed handlers
to conform with the new way we call signal handlers
Index: DeviceManager.py
===================================================================
RCS file: /cvs/hal/hal/tools/device-manager/DeviceManager.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- DeviceManager.py 19 Jan 2005 22:26:47 -0000 1.17
+++ DeviceManager.py 14 Feb 2005 18:20:05 -0000 1.18
@@ -7,6 +7,7 @@
try:
import gnome.ui
+
except ImportError:
gnome_imported = 0
else:
@@ -51,17 +52,20 @@
"DeviceAdded",
"org.freedesktop.Hal.Manager",
"org.freedesktop.Hal",
- "/org/freedesktop/Hal/Manager")
+ "/org/freedesktop/Hal/Manager",
+ expand_args=False)
self.bus.add_signal_receiver(self.gdl_changed,
"DeviceRemoved",
"org.freedesktop.Hal.Manager",
"org.freedesktop.Hal",
- "/org/freedesktop/Hal/Manager")
+ "/org/freedesktop/Hal/Manager",
+ expand_args=False)
self.bus.add_signal_receiver(self.gdl_changed,
"NewCapability",
"org.freedesktop.Hal.Manager",
"org.freedesktop.Hal",
- "/org/freedesktop/Hal/Manager")
+ "/org/freedesktop/Hal/Manager",
+ expand_args=False)
# Add listeners for all devices
try:
@@ -86,13 +90,13 @@
"PropertyModified",
"org.freedesktop.Hal.Device",
"org.freedesktop.Hal",
- udi)
+ udi, expand_args=False)
return
self.bus.add_signal_receiver(self.device_changed,
"Condition",
"org.freedesktop.Hal.Device",
"org.freedesktop.Hal",
- udi)
+ udi, expand_args=False)
def remove_device_signal_recv (self, udi):
self.bus.remove_signal_receiver(self.device_changed,
@@ -125,19 +129,18 @@
self.update_device_notebook(device)
- def device_changed(self, dbus_if, dbus_member, dbus_svc,
- dbus_obj_path, dbus_message):
+ def device_changed(self, sender, device):
"""This method is called when signals on the Device interface is
received"""
- if dbus_member=="Condition":
- args = dbus_message.get_args_list()
- print "\nCondition %s, device=%s"%(args[0], dbus_obj_path)
+
+ print "device_changed: " + sender.signal_name
+ if sender.signal_name=="Condition":
+ print "\nCondition %s, device=%s"%(device, sender.path)
print " message = ", args
- elif dbus_member=="PropertyModified":
- args = dbus_message.get_args_list()
- num_modifications = args[0]
- print "\nPropertyModified, device=%s"%dbus_obj_path
- #print "dbus_obj_path", dbus_obj_path
+ elif sender.signal_name=="PropertyModified":
+ num_modifications = device
+ print "\nPropertyModified, device=%s"%sender.path
+ #print "dbus_obj_path", sender.path
for i in range(0, num_modifications):
property_name = args[1+3*i]
removed = args[2+3*i]
@@ -169,24 +172,24 @@
self.update_device_notebook(device)
- def gdl_changed(self, dbus_if, dbus_member, dbus_svc, dbus_obj_path, dbus_message):
+ def gdl_changed(self, sender):
"""This method is called when a HAL device is added or removed."""
- if dbus_member=="DeviceAdded":
- [device_udi] = dbus_message.get_args_list()
+ if sender.signal_name=="DeviceAdded":
+ [device_udi] = sender.message.get_args_list()
print "\nDeviceAdded, udi=%s"%(device_udi)
self.add_device_signal_recv (device_udi)
self.update_device_list()
- elif dbus_member=="DeviceRemoved":
- [device_udi] = dbus_message.get_args_list()
+ elif sender.signal_name=="DeviceRemoved":
+ [device_udi] = sender.message.get_args_list()
print "\nDeviceRemoved, udi=%s"%(device_udi)
self.remove_device_signal_recv (device_udi)
self.update_device_list()
- elif dbus_member=="NewCapability":
- [device_udi, cap] = dbus_message.get_args_list()
+ elif sender.signal_name=="NewCapability":
+ [device_udi, cap] = sender.message.get_args_list()
print "\nNewCapability, cap=%s, udi=%s"%(cap, device_udi)
else:
- print "*** Unknown signal %s"%dbus_member
+ print "*** Unknown signal %s"% sender.signal_name
def update_device_list(self):
More information about the hal-commit
mailing list