Catch GetActiveNetwork exceptions.

Listen for activation failures.
This commit is contained in:
Marco Pesenti Gritti 2007-03-02 16:45:09 +01:00
parent d748682ef7
commit 7b89672604
2 changed files with 16 additions and 5 deletions

View File

@ -303,11 +303,14 @@ class Device(gobject.GObject):
def set_state(self, state):
self._state = state
obj = sys_bus.get_object(NM_SERVICE, self._op)
dev = dbus.Interface(obj, NM_IFACE_DEVICES)
if self._type == DEVICE_TYPE_802_11_WIRELESS:
network = dev.getActiveNetwork()
try:
obj = sys_bus.get_object(NM_SERVICE, self._op)
dev = dbus.Interface(obj, NM_IFACE_DEVICES)
network = dev.getActiveNetwork()
except dbus.DBusException:
network = None
if self._networks.has_key(network):
self.set_active_network(self._networks[network])
else:
@ -428,6 +431,7 @@ class NMClient(gobject.GObject):
'DeviceActivating': self.device_activating_sig_handler,
'DeviceNowActive': self.device_now_active_sig_handler,
'DeviceNoLongerActive': self.device_no_longer_active_sig_handler,
'DeviceActivationFailed': self.device_activation_failed_sig_handler,
'DeviceCarrierOn': self.device_carrier_on_sig_handler,
'DeviceCarrierOff': self.device_carrier_off_sig_handler,
'DeviceStrengthChanged': self.wireless_device_strength_changed_sig_handler,
@ -544,6 +548,13 @@ class NMClient(gobject.GObject):
return
self._devices[device].set_state(DEVICE_STATE_INACTIVE)
def device_activation_failed_sig_handler(self, device):
logging.debug('DeviceActivationFailed for %s' % (device))
if not self._devices.has_key(device):
logging.debug('DeviceActivationFailed, device %s does not exist' % (device))
return
self._devices[device].set_state(DEVICE_STATE_INACTIVE)
def name_owner_changed_sig_handler(self, name, old, new):
if name != NM_SERVICE:
return

View File

@ -1,6 +1,6 @@
VERSION=0.63
DATE=`date +%Y%m%d`
RELEASE=2.32
RELEASE=2.34
TARBALL=sugar-$VERSION-$RELEASE.${DATE}git.tar.bz2
rm sugar-$VERSION.tar.bz2