From d748682ef776b3413fe99fd6f458f2647318e5ea Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Fri, 2 Mar 2007 15:56:06 +0100 Subject: [PATCH] Handle the case where we get an Activating event but we don't have an active device yet. --- shell/hardware/nmclient.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/shell/hardware/nmclient.py b/shell/hardware/nmclient.py index 491f6864..a3826216 100644 --- a/shell/hardware/nmclient.py +++ b/shell/hardware/nmclient.py @@ -286,6 +286,8 @@ class Device(gobject.GObject): self.emit('ssid-changed') def set_active_network(self, network): + if self._active_network == network: + return if self._active_network: self._active_network.disconnect(self._ssid_sid) @@ -301,12 +303,15 @@ class Device(gobject.GObject): def set_state(self, state): self._state = state - if state == DEVICE_STATE_ACTIVATING: - obj = sys_bus.get_object(NM_SERVICE, self._op) - dev = dbus.Interface(obj, NM_IFACE_DEVICES) + 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() - self.set_active_network(self._networks[network]) + if self._networks.has_key(network): + self.set_active_network(self._networks[network]) + else: + self.set_active_network(None) _device_to_network_state = { DEVICE_STATE_ACTIVATING : NETWORK_STATE_CONNECTING,