Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Abente <mabente@paraguayeduca.org>2010-06-09 20:31:29 (GMT)
committer Daniel Drake <dsd@laptop.org>2010-07-07 15:26:08 (GMT)
commit5e3f4439fca3610561cad3365d8ba14a4021e5bd (patch)
treeddfa596f80e4985158e0f30868742d68224ccaf2
parentc1f2b0d5c865133f612fe462fe52a3d30777f90d (diff)
Fix duplication of OLPC mesh icons
Three or more mesh icons were being added after every suspend/resume. There was already code present to detect when the device goes away and remove the icons, but it was not working. NetworkManagerObserver was attempting to look at the properties of the gone-away device in order to see if it is a mesh device, but this was failing because the device has already been destroyed at this point. Solve this by recording the device path of the mesh device when it is detected, so that we can later determine if the gone-away device is the mesh device. Signed-off-by: Martin Abente <mabente@paraguayeduca.org>
-rw-r--r--src/jarabe/desktop/meshbox.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/jarabe/desktop/meshbox.py b/src/jarabe/desktop/meshbox.py
index 29a9cf1..a3965f7 100644
--- a/src/jarabe/desktop/meshbox.py
+++ b/src/jarabe/desktop/meshbox.py
@@ -599,13 +599,15 @@ class OlpcMeshView(CanvasPulsingIcon):
self._update_color()
def disconnect(self):
+ device_object_path = self._mesh_mgr.mesh_device.object_path
+
self._bus.remove_signal_receiver(self.__device_state_changed_cb,
signal_name='StateChanged',
- path=self._device.object_path,
+ path=device_object_path,
dbus_interface=_NM_DEVICE_IFACE)
self._bus.remove_signal_receiver(self.__wireless_properties_changed_cb,
signal_name='PropertiesChanged',
- path=self._device.object_path,
+ path=device_object_path,
dbus_interface=_NM_OLPC_MESH_IFACE)
@@ -846,6 +848,7 @@ class NetworkManagerObserver(object):
self._bus = dbus.SystemBus()
self._devices = {}
self._netmgr = None
+ self._olpc_mesh_device_o = None
def listen(self):
try:
@@ -908,6 +911,7 @@ class NetworkManagerObserver(object):
if device_type == network.DEVICE_TYPE_802_11_WIRELESS:
self._devices[device_o] = DeviceObserver(self._box, device)
elif device_type == network.DEVICE_TYPE_802_11_OLPC_MESH:
+ self._olpc_mesh_device_o = device_o
self._box.enable_olpc_mesh(device)
def _get_device_path_error_cb(self, err):
@@ -923,11 +927,8 @@ class NetworkManagerObserver(object):
del self._devices[device_o]
return
- device = self._bus.get_object(_NM_SERVICE, device_o)
- props = dbus.Interface(device, 'org.freedesktop.DBus.Properties')
- device_type = props.Get(_NM_DEVICE_IFACE, 'DeviceType')
- if device_type == network.DEVICE_TYPE_802_11_OLPC_MESH:
- self._box.disable_olpc_mesh(device)
+ if self._olpc_mesh_device_o == device_o:
+ self._box.disable_olpc_mesh(device_o)
class MeshBox(gtk.VBox):