Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2010-08-30 17:16:11 (GMT)
committer Simon Schampijer <simon@schampijer.de>2010-08-30 17:16:11 (GMT)
commitf62a0e51bc85f93cf4620b21bfcddd046949a2df (patch)
treed9cf76b9d450dfc356c0c8f7ddc5a1313baf570e
parent770f90037a174f1cefa76fbef4c242f6030099ee (diff)
AP: signal strength update not seperate from state change #2246
-rw-r--r--src/jarabe/desktop/networkviews.py41
1 files changed, 20 insertions, 21 deletions
diff --git a/src/jarabe/desktop/networkviews.py b/src/jarabe/desktop/networkviews.py
index 121c817..87f182f 100644
--- a/src/jarabe/desktop/networkviews.py
+++ b/src/jarabe/desktop/networkviews.py
@@ -159,6 +159,7 @@ class WirelessNetworkView(CanvasPulsingIcon):
def __device_state_changed_cb(self, new_state, old_state, reason):
self._device_state = new_state
self._update_state()
+ self._update_icon()
def __update_active_ap(self, ap_path):
if ap_path in self._access_points:
@@ -166,12 +167,10 @@ class WirelessNetworkView(CanvasPulsingIcon):
# strength of that one
self._active_ap = self._access_points[ap_path]
self.update_strength()
- self._update_state()
elif self._active_ap is not None:
# revert to showing state of strongest AP again
self._active_ap = None
self.update_strength()
- self._update_state()
def __wireless_properties_changed_cb(self, properties):
if 'ActiveAccessPoint' in properties:
@@ -191,26 +190,19 @@ class WirelessNetworkView(CanvasPulsingIcon):
def __get_device_state_reply_cb(self, state):
self._device_state = state
- self._update()
-
- def __get_device_state_error_cb(self, err):
- logging.error('Error getting the device state: %s', err)
-
- def _update(self):
self._update_state()
self._update_color()
- def _update_state(self):
- if self._active_ap is not None:
- state = self._device_state
- else:
- state = network.DEVICE_STATE_UNKNOWN
+ def __get_device_state_error_cb(self, err):
+ logging.error('Error getting the device state: %s', err)
+ def _update_icon(self):
if self._mode == network.NM_802_11_MODE_ADHOC and \
network.is_sugar_adhoc_network(self._name):
channel = max([1] + [ap.channel for ap in
self._access_points.values()])
- if state == network.DEVICE_STATE_ACTIVATED:
+ if self._device_state == network.DEVICE_STATE_ACTIVATED and \
+ self._active_ap is not None:
icon_name = 'network-adhoc-%s-connected' % channel
else:
icon_name = 'network-adhoc-%s' % channel
@@ -218,11 +210,8 @@ class WirelessNetworkView(CanvasPulsingIcon):
icon = self._palette.props.icon
icon.props.icon_name = icon_name
else:
- if state == network.DEVICE_STATE_ACTIVATED:
- connection = network.find_connection_by_ssid(self._name)
- if connection is not None:
- if self._mode == network.NM_802_11_MODE_INFRA:
- connection.set_connected()
+ if self._device_state == network.DEVICE_STATE_ACTIVATED and \
+ self._active_ap is not None:
icon_name = '%s-connected' % _AP_ICON_NAME
else:
icon_name = _AP_ICON_NAME
@@ -233,6 +222,12 @@ class WirelessNetworkView(CanvasPulsingIcon):
icon = self._palette.props.icon
icon.props.icon_name = icon_name
+ def _update_state(self):
+ if self._active_ap is not None:
+ state = self._device_state
+ else:
+ state = network.DEVICE_STATE_UNKNOWN
+
if state == network.DEVICE_STATE_PREPARE or \
state == network.DEVICE_STATE_CONFIG or \
state == network.DEVICE_STATE_NEED_AUTH or \
@@ -243,6 +238,10 @@ class WirelessNetworkView(CanvasPulsingIcon):
self._palette.props.secondary_text = _('Connecting...')
self.props.pulsing = True
elif state == network.DEVICE_STATE_ACTIVATED:
+ connection = network.find_connection_by_ssid(self._name)
+ if connection is not None:
+ if self._mode == network.NM_802_11_MODE_INFRA:
+ connection.set_connected()
if self._disconnect_item:
self._disconnect_item.show()
self._connect_item.hide()
@@ -376,7 +375,7 @@ class WirelessNetworkView(CanvasPulsingIcon):
def set_filter(self, query):
self._greyed_out = self._name.lower().find(query) == -1
- self._update_state()
+ self._update_icon()
self._update_color()
def create_keydialog(self, settings, response):
@@ -395,7 +394,7 @@ class WirelessNetworkView(CanvasPulsingIcon):
if new_strength != self._strength:
self._strength = new_strength
- self._update_state()
+ self._update_icon()
def add_ap(self, ap):
self._access_points[ap.model.object_path] = ap