From e623294eaab90af4549e730c1bf038ac29a2682b Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Sat, 07 Jun 2008 10:10:22 +0000 Subject: Shell service notify launch status directly to the model. The shell view listen to the model. --- (limited to 'src') diff --git a/src/model/homemodel.py b/src/model/homemodel.py index cae961e..fa7a635 100644 --- a/src/model/homemodel.py +++ b/src/model/homemodel.py @@ -224,7 +224,7 @@ class HomeModel(gobject.GObject): else: logging.error('Model for window %d does not exist.' % xid) - def notify_activity_launch(self, activity_id, service_name): + def notify_launch(self, activity_id, service_name): registry = activity.get_registry() activity_info = registry.get_activity(service_name) if not activity_info: @@ -241,7 +241,7 @@ class HomeModel(gobject.GObject): # Now just check whether an activity has a window after ~90sec gobject.timeout_add(90000, self._check_activity_launched, activity_id) - def notify_activity_launch_failed(self, activity_id): + def notify_launch_failed(self, activity_id): home_activity = self._get_activity_by_id(activity_id) if home_activity: logging.debug("Activity %s (%s) launch failed" % \ @@ -259,5 +259,5 @@ class HomeModel(gobject.GObject): if home_activity and home_activity.props.launching: logging.debug('Activity %s still launching, assuming it failed...' % activity_id) - self.notify_activity_launch_failed(activity_id) + self.notify_launch_failed(activity_id) return False diff --git a/src/shellservice.py b/src/shellservice.py index 3d90779..706f2f2 100644 --- a/src/shellservice.py +++ b/src/shellservice.py @@ -79,12 +79,14 @@ class ShellService(dbus.service.Object): @dbus.service.method(_DBUS_SHELL_IFACE, in_signature="ss", out_signature="") def NotifyLaunch(self, bundle_id, activity_id): - self._shell.notify_launch(bundle_id, activity_id) + home = self._shell.get_model().get_home() + home.notify_launch(activity_id, bundle_id) @dbus.service.method(_DBUS_SHELL_IFACE, in_signature="s", out_signature="") def NotifyLaunchFailure(self, activity_id): - self._shell.notify_launch_failure(activity_id) + home = self._shell.get_model().get_home() + home.notify_launch_failed(activity_id) @dbus.service.signal(_DBUS_OWNER_IFACE, signature="s") def ColorChanged(self, color): diff --git a/src/view/Shell.py b/src/view/Shell.py index 9fdd928..41f83a3 100644 --- a/src/view/Shell.py +++ b/src/view/Shell.py @@ -66,7 +66,8 @@ class Shell(gobject.GObject): self._home_window.show() home_model = self._model.get_home() - home_model.connect('launch-completed', self._launch_completed_cb) + home_model.connect('launch-started', self.__launch_started_cb) + home_model.connect('launch-completed', self.__launch_completed_cb) home_model.connect('activity-removed', self._activity_removed_cb) home_model.connect('active-activity-changed', self._active_activity_changed_cb) @@ -92,7 +93,11 @@ class Shell(gobject.GObject): if registry.get_activity('org.laptop.JournalActivity'): self.start_activity('org.laptop.JournalActivity') - def _launch_completed_cb(self, home_model, home_activity): + def __launch_started_cb(self, home_model, home_activity): + # Zoom to Home for launch feedback + self.set_zoom_level(shellmodel.ShellModel.ZOOM_HOME) + + 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: @@ -141,17 +146,6 @@ class Shell(gobject.GObject): handle = ActivityHandle(activity_id) activityfactory.create(bundle_id, handle) - def notify_launch(self, bundle_id, activity_id): - # Zoom to Home for launch feedback - self.set_zoom_level(shellmodel.ShellModel.ZOOM_HOME) - - home_model = self._model.get_home() - home_model.notify_activity_launch(activity_id, bundle_id) - - def notify_launch_failure(self, activity_id): - home_model = self._model.get_home() - home_model.notify_activity_launch_failed(activity_id) - def start_activity(self, activity_type): if activity_type in self._activities_starting: logging.debug("This activity is still launching.") -- cgit v0.9.1