diff --git a/shell/view/Shell.py b/shell/view/Shell.py index f95cf313..9eb8d469 100644 --- a/shell/view/Shell.py +++ b/shell/view/Shell.py @@ -81,10 +81,7 @@ class Shell(gobject.GObject): def __active_window_changed_cb(self, screen): window = screen.get_active_window() - if window == None: - self._model.set_current_activity(None) - self.emit('activity-changed', None) - elif window.get_window_type() == wnck.WINDOW_NORMAL: + if window and window.get_window_type() == wnck.WINDOW_NORMAL: activity_host = self._hosts[window.get_xid()] current = self._model.get_current_activity() @@ -101,6 +98,10 @@ class Shell(gobject.GObject): self.emit('activity-closed', host) del self._hosts[window.get_xid()] + if len(self._hosts) == 0: + self._model.set_current_activity(None) + self.emit('activity-changed', None) + def get_model(self): return self._model