Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@tomeuvizoso.net>2007-03-15 15:21:37 (GMT)
committer Tomeu Vizoso <tomeu@tomeuvizoso.net>2007-03-15 15:21:37 (GMT)
commit0fe529b78aeaeeefeb179ab70833119bfabd9d12 (patch)
tree7686470027b797b4a41c5a93e281b167dd65788c /shell
parenta83211dbb9f10ed94c7fa8d9799b763891272277 (diff)
Avoid multiple simultaneous launches of the same activity.
Diffstat (limited to 'shell')
-rw-r--r--shell/model/homemodel.py2
-rw-r--r--shell/view/Shell.py12
2 files changed, 13 insertions, 1 deletions
diff --git a/shell/model/homemodel.py b/shell/model/homemodel.py
index 9d7d68c..598562b 100644
--- a/shell/model/homemodel.py
+++ b/shell/model/homemodel.py
@@ -110,7 +110,7 @@ class HomeModel(gobject.GObject):
self._current_activity = act
else:
self._current_activity = None
- logging.error('Actiivty for window %d was not yet launched.' % xid)
+ logging.error('Activity for window %d was not yet launched.' % xid)
else:
self._current_activity = None
logging.error('Model for window %d does not exist.' % xid)
diff --git a/shell/view/Shell.py b/shell/view/Shell.py
index 3f0ef8f..b8678dd 100644
--- a/shell/view/Shell.py
+++ b/shell/view/Shell.py
@@ -14,6 +14,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+from sets import Set
import logging
import gobject
@@ -32,6 +33,7 @@ class Shell(gobject.GObject):
def __init__(self, model):
gobject.GObject.__init__(self)
+ self._activities_starting = Set()
self._model = model
self._hosts = {}
self._screen = wnck.screen_get_default()
@@ -60,8 +62,12 @@ class Shell(gobject.GObject):
def _activity_added_cb(self, home_model, home_activity):
activity_host = ActivityHost(home_activity)
self._hosts[activity_host.get_xid()] = activity_host
+ if home_activity.get_type() in self._activities_starting:
+ self._activities_starting.remove(home_activity.get_type())
def _activity_removed_cb(self, home_model, home_activity):
+ if home_activity.get_type() in self._activities_starting:
+ self._activities_starting.remove(home_activity.get_type())
if not home_activity.get_launched():
return
xid = home_activity.get_xid()
@@ -127,8 +133,14 @@ class Shell(gobject.GObject):
home_model.notify_activity_launch_failed(handler.get_activity_id())
def start_activity(self, activity_type):
+ if activity_type in self._activities_starting:
+ logging.debug("This activity is still launching.")
+ return
+
logging.debug('Shell.start_activity')
+ self._activities_starting.add(activity_type)
+
handler = activityfactory.create(activity_type)
home_model = self._model.get_home()