strange dbus/python callback behavior

Richard Ferguson gnome at fergusnet.com
Sun Apr 30 04:32:38 PDT 2006


A while back I wrote a small app that just sits and listens to
NetworkManager's dbus signals.  When a device would come up it would start
Gaim, and when a device would go down it would close Gaim.  Not very
complex but handy when suspending all the time.

After recently upgrading to Ubuntu Dapper, my app started showing some
strange behavior with one of its call backs.

I have attached my app, but here is my code that connects to dbus.

----

bus = dbus.SystemBus()
proxy_obj = bus.get_object('org.freedesktop.NetworkManager',
'/org/freedesktop/NetworkManager')
dbus_iface = dbus.Interface(proxy_obj, 'org.freedesktop.NetworkManager')

# Listen for NetworkManager signals
dbus_iface.connect_to_signal('DeviceNowActive', gc.nm_device_active_cb)
dbus_iface.connect_to_signal('DeviceNoLongerActive',
gc.nm_device_notactive_cb)

----

The problem is, sometimes the 'DeviceNowActive' callback,
gc.nm_device_active_cb, gets called with 2 arguments, and sometimes with 3
arguments.  I think its 2 for wireline and 3 for wireless.

Any ideas on why this would happen?  or how to handle it properly?
Thanks for your help

richard ferguson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nm-gaim-dbus.py
Type: text/x-python
Size: 1404 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20060430/69cc4bff/nm-gaim-dbus.py


More information about the dbus mailing list