[sugar] [PATCH 4/6] Ignore "click" events during the activity_changed_cb.

Benjamin Berg benjamin at sipsolutions.net
Thu Jun 19 15:10:21 EDT 2008


It is neccessary to ignore any "click" events that happen as a result of the
activity_changed_cb. If these were not ignored they would cause an instant
activity switch to the new activity.
---

 src/view/frame/activitiestray.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/view/frame/activitiestray.py b/src/view/frame/activitiestray.py
index 0c5b3f8..03a523e 100644
--- a/src/view/frame/activitiestray.py
+++ b/src/view/frame/activitiestray.py
@@ -302,6 +302,7 @@ class ActivitiesTray(HTray):
 
         self._buttons = {}
         self._invite_to_item = {}
+        self._freeze_button_clicks = False
 
         self._home_model = shellmodel.get_instance().get_home()
         self._home_model.connect('activity-added', self.__activity_added_cb)
@@ -336,11 +337,14 @@ class ActivitiesTray(HTray):
 
     def __activity_changed_cb(self, home_model, home_activity):
         logging.debug('__activity_changed_cb: %r' % home_activity)
+
         button = self._buttons[home_activity.get_activity_id()]
+        self._freeze_button_clicks = True
         button.props.active = True
+        self._freeze_button_clicks = True
 
     def __activity_clicked_cb(self, button, home_activity):
-        if button.props.active:
+        if not self._freeze_button_clicks and button.props.active:
             logging.debug('ActivitiesTray.__activity_clicked_cb')
             window = home_activity.get_window()
             if window:



More information about the Sugar mailing list