diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2008-07-14 10:49:46 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2008-07-14 10:49:46 (GMT) |
commit | bea4ef2677afd4cae602442ab6461d3285acfb2d (patch) | |
tree | 71c19498ee52b6534a3afae94cda752fae0f756f /src | |
parent | 9ad66ce6572aeec341d55dfba6056c4e0191dabd (diff) |
HomeWindow listen to the model, launcher is a transient state which is cancelled
by any zoom level change. Also drop the lunch limit in the shell while I'm at it.
Fix #7354
Diffstat (limited to 'src')
-rw-r--r-- | src/view/Shell.py | 28 | ||||
-rw-r--r-- | src/view/home/HomeWindow.py | 49 |
2 files changed, 33 insertions, 44 deletions
diff --git a/src/view/Shell.py b/src/view/Shell.py index 5414dfa..1c90c40 100644 --- a/src/view/Shell.py +++ b/src/view/Shell.py @@ -51,7 +51,6 @@ class Shell(gobject.GObject): def __init__(self): gobject.GObject.__init__(self) - self._activities_starting = Set() self._model = shellmodel.get_instance() self._hosts = {} self._screen = wnck.screen_get_default() @@ -92,26 +91,17 @@ class Shell(gobject.GObject): self.start_activity('org.laptop.JournalActivity') def __launch_started_cb(self, home_model, home_activity): - if home_activity.get_type() == 'org.laptop.JournalActivity': - return - - self._screen.toggle_showing_desktop(True) - self._home_window.set_zoom_level(shellmodel.ShellModel.ZOOM_ACTIVITY) - self._home_window.launch_box.zoom_in() + if home_activity.get_type() != 'org.laptop.JournalActivity': + self._home_window.show_launcher() def __launch_failed_cb(self, home_model, home_activity): - if self._screen.get_showing_desktop(): - self._home_window.set_zoom_level(shellmodel.ShellModel.ZOOM_HOME) + self._home_window.hide_launcher() def __launch_completed_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()) xid = home_activity.get_xid() if self._hosts.has_key(xid): del self._hosts[xid] @@ -149,19 +139,9 @@ class Shell(gobject.GObject): activityfactory.create(bundle_id, handle) def start_activity(self, activity_type): - if activity_type in self._activities_starting: - logging.debug("This activity is still launching.") - return - - self._activities_starting.add(activity_type) activityfactory.create(activity_type) def start_activity_with_uri(self, activity_type, uri): - if activity_type in self._activities_starting: - logging.debug("This activity is still launching.") - return - - self._activities_starting.add(activity_type) activityfactory.create_with_uri(activity_type, uri) def take_activity_screenshot(self): @@ -190,11 +170,9 @@ class Shell(gobject.GObject): host = self.get_current_activity() if host is not None: host.present() - self._screen.toggle_showing_desktop(False) else: self._model.set_zoom_level(level) self._screen.toggle_showing_desktop(True) - self._home_window.set_zoom_level(level) def toggle_activity_fullscreen(self): if self._model.get_zoom_level() == shellmodel.ShellModel.ZOOM_ACTIVITY: diff --git a/src/view/home/HomeWindow.py b/src/view/home/HomeWindow.py index 3382c4c..9c5180c 100644 --- a/src/view/home/HomeWindow.py +++ b/src/view/home/HomeWindow.py @@ -25,6 +25,7 @@ from view.home.FriendsBox import FriendsBox from view.home.transitionbox import TransitionBox from view.home.launchbox import LaunchBox from model.shellmodel import ShellModel +from model import shellmodel _HOME_PAGE = 0 _FRIENDS_PAGE = 1 @@ -62,7 +63,7 @@ class HomeWindow(gtk.Window): self._friends_box = FriendsBox() self._mesh_box = MeshBox() self._transition_box = TransitionBox() - self.launch_box = LaunchBox() + self._launch_box = LaunchBox() self._activate_view() self.add(self._home_box) @@ -71,6 +72,9 @@ class HomeWindow(gtk.Window): self._transition_box.connect('completed', self._transition_completed_cb) + model = shellmodel.get_instance() + model.connect('notify::zoom-level', self.__zoom_level_changed_cb) + def _enter_notify_event_cb(self, window, event): if event.x != gtk.gdk.screen_width() / 2 or \ event.y != gtk.gdk.screen_height() / 2: @@ -97,16 +101,12 @@ class HomeWindow(gtk.Window): self._home_box.suspend() elif self._level == ShellModel.ZOOM_MESH: self._mesh_box.suspend() - elif self._level == ShellModel.ZOOM_ACTIVITY: - self.launch_box.suspend() def _activate_view(self): if self._level == ShellModel.ZOOM_HOME: self._home_box.resume() elif self._level == ShellModel.ZOOM_MESH: self._mesh_box.resume() - elif self._level == ShellModel.ZOOM_ACTIVITY: - self.launch_box.resume() def _visibility_notify_event_cb(self, window, event): if event.state == gtk.gdk.VISIBILITY_FULLY_OBSCURED: @@ -114,7 +114,11 @@ class HomeWindow(gtk.Window): else: self._activate_view() - def set_zoom_level(self, level): + def __zoom_level_changed_cb(self, model, pspec): + level = model.props.zoom_level + if level == ShellModel.ZOOM_ACTIVITY: + return + self._deactivate_view() self._level = level self._activate_view() @@ -123,35 +127,42 @@ class HomeWindow(gtk.Window): self.add(self._transition_box) self._transition_box.show() - if level == ShellModel.ZOOM_HOME: + if self._level == ShellModel.ZOOM_HOME: size = style.XLARGE_ICON_SIZE - elif level == ShellModel.ZOOM_FRIENDS: + elif self._level == ShellModel.ZOOM_FRIENDS: size = style.LARGE_ICON_SIZE - elif level == ShellModel.ZOOM_MESH: + elif self._level == ShellModel.ZOOM_MESH: size = style.STANDARD_ICON_SIZE - elif level == ShellModel.ZOOM_ACTIVITY: - size = style.XLARGE_ICON_SIZE self._transition_box.set_size(size) def _transition_completed_cb(self, transition_box): + self._sync_view() + + def _sync_view(self): + current_child = self.get_child() + self.remove(current_child) + if self._level == ShellModel.ZOOM_HOME: - self.remove(self.get_child()) self.add(self._home_box) self._home_box.show() elif self._level == ShellModel.ZOOM_FRIENDS: - self.remove(self.get_child()) self.add(self._friends_box) self._friends_box.show() elif self._level == ShellModel.ZOOM_MESH: - self.remove(self.get_child()) self.add(self._mesh_box) self._mesh_box.show() self._mesh_box.focus_search_entry() - elif self._level == ShellModel.ZOOM_ACTIVITY: - self.remove(self.get_child()) - self.add(self.launch_box) - self.launch_box.show() def get_home_box(self): - return self._home_box + return self._home_box + + def show_launcher(self): + self.remove(self.get_child()) + self.add(self._launch_box) + self._launch_box.show() + + self._launch_box.zoom_in() + + def hide_launcher(self): + self._sync_view() |