From bde38e446d076a9774b0cd8fa5d7556d34dc922e Mon Sep 17 00:00:00 2001
From: Simon Schampijer <simon@schampijer.de>
Date: Wed, 15 Sep 2010 09:58:29 +0200
Subject: [PATCH] Sugar Ad-hoc network: reconnect after suspend #2187
---
src/jarabe/model/adhoc.py | 15 +--------------
1 files changed, 1 insertions(+), 14 deletions(-)
diff --git a/src/jarabe/model/adhoc.py b/src/jarabe/model/adhoc.py
index ad0c941..0ff3e22 100644
a
|
b
|
class AdHocManager(gobject.GObject): |
134 | 134 | def _update_state(self): |
135 | 135 | self.emit('state-changed', self._current_channel, self._device_state) |
136 | 136 | |
137 | | def _have_configured_connections(self): |
138 | | return len(network.get_settings().connections) > 0 |
139 | | |
140 | 137 | def autoconnect(self): |
141 | | """Autoconnect to an Ad-hoc network""" |
142 | | if self._device_state != network.DEVICE_STATE_DISCONNECTED: |
143 | | return |
144 | | elif self._have_configured_connections(): |
145 | | self._autoconnect_adhoc_timer() |
146 | | else: |
147 | | self._autoconnect_adhoc() |
148 | | |
149 | | def _autoconnect_adhoc_timer(self): |
150 | 138 | """Start a timer which basically looks for 30 seconds of inactivity |
151 | 139 | on the device, then does autoconnect to an Ad-hoc network. |
152 | 140 | |
… |
… |
class AdHocManager(gobject.GObject): |
157 | 145 | self._AUTOCONNECT_TIMEOUT, self.__idle_check_cb) |
158 | 146 | |
159 | 147 | def __idle_check_cb(self): |
160 | | if self._device_state == network.DEVICE_STATE_DISCONNECTED: |
161 | | logging.debug("Connect to Ad-hoc network due to inactivity.") |
| 148 | if self._device_state == network.DEVICE_STATE_DISCONNECTED: |
162 | 149 | self._autoconnect_adhoc() |
163 | 150 | return False |
164 | 151 | |