Ticket #1580: 0001-Fix-displaying-of-Journal-after-Sugar-launch.patch

File 0001-Fix-displaying-of-Journal-after-Sugar-launch.patch, 2.4 KB (added by dsd, 14 years ago)
  • src/jarabe/model/shell.py

    From 435e1d4fe6198464fca6c8bc49f52252be3a0cf5 Mon Sep 17 00:00:00 2001
    From: Daniel Drake <dsd@laptop.org>
    Date: Wed, 25 Nov 2009 12:48:06 +0000
    Subject: [PATCH] Fix displaying of Journal after Sugar launch
    
    This patch fixes a bug where pressing F4 immediately after starting
    Sugar does not switch to the Journal.
    
    This happens because the Journal has not yet been activated, so when
    the desktop is hidden in response to pressing F4, there is no active
    window to take over the display.
    
    Fix this by detecting this condition and explicitly activating the
    Journal window.
    ---
     src/jarabe/model/shell.py |   16 ++++++++++++++++
     1 files changed, 16 insertions(+), 0 deletions(-)
    
    diff --git a/src/jarabe/model/shell.py b/src/jarabe/model/shell.py
    index de5a66f..efe30b4 100644
    a b class ShellModel(gobject.GObject): 
    329329        self._zoom_level = self.ZOOM_HOME
    330330        self._current_activity = None
    331331        self._activities = []
     332        self._need_window_activate = False
    332333        self._active_activity = None
    333334        self._tabbing_activity = None
    334335        self._pservice = presenceservice.get_instance()
    class ShellModel(gobject.GObject): 
    369370
    370371        show_desktop = new_level is not self.ZOOM_ACTIVITY
    371372        self._screen.toggle_showing_desktop(show_desktop)
     373        if new_level is self.ZOOM_ACTIVITY and self._need_window_activate:
     374            window = self._active_activity.get_window()
     375            if window:
     376                window.activate(gtk.get_current_event_time())
     377            self._need_window_activate = False
    372378
    373379    def _get_zoom_level(self):
    374380        return self._zoom_level
    class ShellModel(gobject.GObject): 
    425431        if self._active_activity == home_activity:
    426432            return
    427433
     434        if self._active_activity is None:
     435            # the Journal opens during startup but it doesn't gain focus, so
     436            # we end up without an active window to come up when the desktop
     437            # gets hidden. we need to record that this activity needs an
     438            # explicit activate the first time the user tries to access it
     439            # (e.g. through pressing F4)
     440            self._need_window_activate = True
     441        else:
     442            self._need_window_activate = False
     443
    428444        if home_activity:
    429445            home_activity.set_active(True)
    430446