Ticket #2082: 0001-Fix-duplication-of-OLPC-mesh-icons.patch

File 0001-Fix-duplication-of-OLPC-mesh-icons.patch, 3.3 KB (added by dsd, 14 years ago)

fix

  • src/jarabe/desktop/meshbox.py

    From 9082631642b84270f4825bcf420eb7447b0fc91e Mon Sep 17 00:00:00 2001
    From: Martin Abente <mabente@paraguayeduca.org>
    Date: Wed, 9 Jun 2010 16:31:29 -0400
    Subject: [PATCH] Fix duplication of OLPC mesh icons
    Organization: Paraguay Educa
    
    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>
    ---
     src/jarabe/desktop/meshbox.py |   17 +++++++++--------
     1 files changed, 9 insertions(+), 8 deletions(-)
    
    diff --git a/src/jarabe/desktop/meshbox.py b/src/jarabe/desktop/meshbox.py
    index a04922b..eabc737 100644
    a b class OlpcMeshView(CanvasPulsingIcon): 
    574574        self._update_color()
    575575
    576576    def disconnect(self):
     577        device_object_path = self._mesh_mgr.mesh_device.object_path
     578
    577579        self._bus.remove_signal_receiver(self.__device_state_changed_cb,
    578580                                         signal_name='StateChanged',
    579                                          path=self._device.object_path,
     581                                         path=device_object_path,
    580582                                         dbus_interface=_NM_DEVICE_IFACE)
    581583        self._bus.remove_signal_receiver(self.__wireless_properties_changed_cb,
    582584                                         signal_name='PropertiesChanged',
    583                                          path=self._device.object_path,
     585                                         path=device_object_path,
    584586                                         dbus_interface=_NM_OLPC_MESH_IFACE)
    585587
    586588
    class NetworkManagerObserver(object): 
    821823        self._bus = None
    822824        self._devices = {}
    823825        self._netmgr = None
     826        self._olpc_mesh_device_o = None
    824827
    825828    def listen(self):
    826829        try:
    class NetworkManagerObserver(object): 
    885888        if device_type == network.DEVICE_TYPE_802_11_WIRELESS:
    886889            self._devices[device_o] = DeviceObserver(self._box, device)
    887890        elif device_type == network.DEVICE_TYPE_802_11_OLPC_MESH:
     891            self._olpc_mesh_device_o = device_o
    888892            self._box.enable_olpc_mesh(device)
    889893
    890894    def _get_device_path_error_cb(self, err):
    class NetworkManagerObserver(object): 
    899903            observer.disconnect()
    900904            del self._devices[device_o]
    901905            return
    902            
    903         device = self._bus.get_object(_NM_SERVICE, device_o)
    904         props = dbus.Interface(device, 'org.freedesktop.DBus.Properties')
    905         device_type = props.Get(_NM_DEVICE_IFACE, 'DeviceType')
    906         if device_type == network.DEVICE_TYPE_802_11_OLPC_MESH:
    907             self._box.disable_olpc_mesh(device)
     906
     907        if self._olpc_mesh_device_o == device_o:
     908            self._box.disable_olpc_mesh(device_o)
    908909
    909910class MeshBox(gtk.VBox):
    910911    __gtype_name__ = 'SugarMeshBox'