From 38c0cf411c5be352631b94ca9c670089318baad4 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Fri, 1 Jun 2007 10:24:13 +0200 Subject: [PATCH] Remove our custom launch timeout. The dbus timeout is enough. --- shell/model/homeactivity.py | 37 ------------------------------------ shell/model/homemodel.py | 18 +++--------------- shell/model/homerawwindow.py | 3 --- shell/view/Shell.py | 2 -- 4 files changed, 3 insertions(+), 57 deletions(-) diff --git a/shell/model/homeactivity.py b/shell/model/homeactivity.py index 15204274..2be6148b 100644 --- a/shell/model/homeactivity.py +++ b/shell/model/homeactivity.py @@ -32,11 +32,6 @@ class HomeActivity(gobject.GObject): the sugar.activity.* modules extensively in order to accomplish its tasks. """ - __gsignals__ = { - 'launch-timeout': (gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, - ([])), - } def __init__(self, bundle, activity_id): """Initialise the HomeActivity @@ -56,34 +51,14 @@ class HomeActivity(gobject.GObject): self._bundle = bundle self._launch_time = time.time() - self._launched = False - self._launch_timeout_id = gobject.timeout_add( - 20000, self._launch_timeout_cb) logging.debug("Activity %s (%s) launching..." % (self._activity_id, self.get_type())) - def __del__(self): - gobject.source_remove(self._launch_timeout_id) - self._launch_timeout_id = 0 - - def _launch_timeout_cb(self, user_data=None): - """Callback for launch operation timeouts - """ - logging.debug("Activity %s (%s) launch timed out" % - (self._activity_id, self.get_type())) - self._launch_timeout_id = 0 - self.emit('launch-timeout') - return False - def set_window(self, window): """An activity is 'launched' once we get its window.""" logging.debug("Activity %s (%s) finished launching" % (self._activity_id, self.get_type())) - self._launched = True - gobject.source_remove(self._launch_timeout_id) - self._launch_timeout_id = 0 - if self._window or self._xid: raise RuntimeError("Activity is already launched!") if not window: @@ -106,8 +81,6 @@ class HomeActivity(gobject.GObject): def get_title(self): """Retrieve the application's root window's suggested title""" - if not self._launched: - raise RuntimeError("Activity is still launching.") return self._window.get_name() def get_icon_name(self): @@ -140,8 +113,6 @@ class HomeActivity(gobject.GObject): def get_xid(self): """Retrieve the X-windows ID of our root window""" - if not self._launched: - raise RuntimeError("Activity is still launching.") return self._xid def get_window(self): @@ -156,8 +127,6 @@ class HomeActivity(gobject.GObject): activity to determine to which HomeActivity the newly launched window belongs. """ - if not self._launched: - raise RuntimeError("Activity is still launching.") return self._window def get_type(self): @@ -166,8 +135,6 @@ class HomeActivity(gobject.GObject): def get_shared(self): """Return whether this activity is using Presence service sharing""" - if not self._launched: - raise RuntimeError("Activity is still launching.") return self._service.get_shared() def get_launch_time(self): @@ -177,7 +144,3 @@ class HomeActivity(gobject.GObject): (seconds since the epoch) """ return self._launch_time - - def get_launched(self): - """Return whether we have bound our top-level window yet""" - return self._launched diff --git a/shell/model/homemodel.py b/shell/model/homemodel.py index 9b995180..b2329b48 100644 --- a/shell/model/homemodel.py +++ b/shell/model/homemodel.py @@ -134,7 +134,7 @@ class HomeModel(gobject.GObject): def _get_activity_by_xid(self, xid): for act in self._activities.values(): - if act.get_launched() and act.get_xid() == xid: + if act.get_xid() == xid: return act return None @@ -164,13 +164,8 @@ class HomeModel(gobject.GObject): xid = window.get_xid() act = self._get_activity_by_xid(window.get_xid()) if act: - if act.get_launched() == True: - self._notify_activity_activation(self._current_activity, act) - self._current_activity = act - else: - self._notify_activity_activation(self._current_activity, None) - self._current_activity = None - logging.error('Activity for window %d was not yet launched.' % xid) + self._notify_activity_activation(self._current_activity, act) + self._current_activity = act else: self._notify_activity_activation(self._current_activity, None) self._current_activity = None @@ -244,18 +239,11 @@ class HomeModel(gobject.GObject): else: logging.error('Model for window %d does not exist.' % xid) - def _activity_launch_timeout_cb(self, activity): - act_id = activity.get_activity_id() - if not act_id in self._activities.keys(): - return - self._internal_remove_activity(activity) - def notify_activity_launch(self, activity_id, service_name): bundle = self._bundle_registry.get_bundle(service_name) if not bundle: raise ValueError("Activity service name '%s' was not found in the bundle registry." % service_name) activity = HomeActivity(bundle, activity_id) - activity.connect('launch-timeout', self._activity_launch_timeout_cb) self._activities[activity_id] = activity self.emit('activity-launched', activity) diff --git a/shell/model/homerawwindow.py b/shell/model/homerawwindow.py index 027d8551..363e407e 100644 --- a/shell/model/homerawwindow.py +++ b/shell/model/homerawwindow.py @@ -55,8 +55,5 @@ class HomeRawWindow(object): def get_shared(self): return False - def get_launched(self): - return True - def get_launch_time(self): return self._launch_time diff --git a/shell/view/Shell.py b/shell/view/Shell.py index 0f3b629f..d88ec500 100644 --- a/shell/view/Shell.py +++ b/shell/view/Shell.py @@ -70,8 +70,6 @@ class Shell(gobject.GObject): 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() if self._hosts.has_key(xid): self._hosts[xid].destroy()