[sugar] [PATCH 1/6] Add functionallity for tabbing trough activities.

Benjamin Berg benjamin
Thu Jun 19 15:08:17 EDT 2008


To be able to raise activity windows on a delay, the homemodel needs to
be set directly. It also needs to ignore window raises while the user is
tabbing.
---

 src/model/homemodel.py |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/model/homemodel.py b/src/model/homemodel.py
index a75adcf..be46ffb 100644
--- a/src/model/homemodel.py
+++ b/src/model/homemodel.py
@@ -64,6 +64,7 @@ class HomeModel(gobject.GObject):
 
         self._activities = []
         self._active_activity = None
+        self._tabbing = False
 
         screen = wnck.screen_get_default()
         screen.connect('window-opened', self._window_opened_cb)
@@ -102,6 +103,15 @@ class HomeModel(gobject.GObject):
         """Returns the activity that the user is currently working in"""
         return self._active_activity
 
+    def tabbing_set_activity(self, activity):
+        self._set_active_activity(activity)
+
+    def tabbing_start(self):
+        self._tabbing = True
+
+    def tabbing_stop(self):
+        self._tabbing = False
+
     def _set_active_activity(self, home_activity):
         if self._active_activity == home_activity:
             return
@@ -185,6 +195,11 @@ class HomeModel(gobject.GObject):
         logging.error("set_active() failed: %s" % err)
 
     def _active_window_changed_cb(self, screen, previous_window=None):
+        if self._tabbing:
+            # Ignore any window changes when tabbing, as these are comming
+            # in delayed.
+            return    
+
         window = screen.get_active_window()
         if window is None:
             return




More information about the Sugar-devel mailing list