[Dextrose] [PATCH][Sugar] Fix globalkey touchpad corner case

Martin Abente martin.abente.lahaye at gmail.com
Wed Feb 16 16:15:12 EST 2011

This patch is not intended for upstream. Is just a minimal
hack to fix a corner case, where the palette must be created
before the tray icon or global can toggle the touchpad mode.

A serious fix could consist on moving the mode-switching
code from extensions/deviceicon/touchpad.py to a touchpad
module at src/jarabe/model.

This model should provide a public mode_toggle method and 
also emit proper signals when it occurs. This way different
pieces of sugar code will be able to interact with the touchpad
properly without repeating code all over.

 extensions/deviceicon/touchpad.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/extensions/deviceicon/touchpad.py b/extensions/deviceicon/touchpad.py
index 357bdd6..366bf74 100644
--- a/extensions/deviceicon/touchpad.py
+++ b/extensions/deviceicon/touchpad.py
@@ -52,13 +52,14 @@ class DeviceView(TrayIcon):
         color = XoColor(client.get_string('/desktop/sugar/user/color'))
         TrayIcon.__init__(self, icon_name=icon_name, xo_color=color)
+        self._palette = ResourcePalette(_('My touchpad'), self.icon)
+        self._palette.set_group_id('frame')
         self.connect('button-release-event', self.__button_release_event_cb)
     def create_palette(self):
         """ On create, set the current mode. """
-        self._palette = ResourcePalette(_('My touchpad'), self.icon)
-        self._palette.set_group_id('frame')
         return self._palette
     def __button_release_event_cb(self, widget, event):

More information about the Dextrose mailing list