Remove our custom launch timeout. The dbus timeout

is enough.
This commit is contained in:
Marco Pesenti Gritti 2007-06-01 10:24:13 +02:00
parent d271e1f481
commit 38c0cf411c
4 changed files with 3 additions and 57 deletions

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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()