Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu.vizoso@collabora.co.uk>2010-08-16 13:08:04 (GMT)
committer Tomeu Vizoso <tomeu.vizoso@collabora.co.uk>2010-08-16 13:08:04 (GMT)
commit168a2ed0117ad891ca9e13a22cac15213fece2a8 (patch)
tree0639c8a6ca1fffbdcfbe8fe80f9ed39220044116
parent23966c81e22ff68f2204c5ced9518e9932b13b69 (diff)
Don't try to autoconnect to a Sugar ad-hoc network if the wifi device
isn't in the DISCONNECTED state.
-rw-r--r--src/jarabe/model/adhoc.py17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/jarabe/model/adhoc.py b/src/jarabe/model/adhoc.py
index 65dac01..ad0c941 100644
--- a/src/jarabe/model/adhoc.py
+++ b/src/jarabe/model/adhoc.py
@@ -82,11 +82,8 @@ class AdHocManager(gobject.GObject):
' only be called once.')
self._device = device
- props = dbus.Interface(device,
- 'org.freedesktop.DBus.Properties')
- props.Get(_NM_DEVICE_IFACE, 'State',
- reply_handler=self.__get_device_state_reply_cb,
- error_handler=self.__get_state_error_cb)
+ props = dbus.Interface(device, 'org.freedesktop.DBus.Properties')
+ self._device_state = props.Get(_NM_DEVICE_IFACE, 'State')
self._bus.add_signal_receiver(self.__device_state_changed_cb,
signal_name='StateChanged',
@@ -108,12 +105,6 @@ class AdHocManager(gobject.GObject):
path=self._device.object_path,
dbus_interface=_NM_WIRELESS_IFACE)
- def __get_state_error_cb(self, err):
- logging.debug('Error getting the device state: %s', err)
-
- def __get_device_state_reply_cb(self, state):
- self._device_state = state
-
def __device_state_changed_cb(self, new_state, old_state, reason):
self._device_state = new_state
self._update_state()
@@ -148,7 +139,9 @@ class AdHocManager(gobject.GObject):
def autoconnect(self):
"""Autoconnect to an Ad-hoc network"""
- if self._have_configured_connections():
+ if self._device_state != network.DEVICE_STATE_DISCONNECTED:
+ return
+ elif self._have_configured_connections():
self._autoconnect_adhoc_timer()
else:
self._autoconnect_adhoc()