Make launching a property of the activity model

This commit is contained in:
Marco Pesenti Gritti
2007-06-01 11:03:18 +02:00
parent e1f27fcd34
commit 2f6790105d
4 changed files with 52 additions and 32 deletions
+17 -1
View File
@@ -33,6 +33,13 @@ class HomeActivity(gobject.GObject):
accomplish its tasks.
"""
__gtype_name__ = 'SugarHomeActivity'
__gproperties__ = {
'launching' : (bool, None, None, False,
gobject.PARAM_READWRITE),
}
def __init__(self, bundle, activity_id):
"""Initialise the HomeActivity
@@ -44,13 +51,14 @@ class HomeActivity(gobject.GObject):
of the activity type
"""
gobject.GObject.__init__(self)
self._window = None
self._xid = None
self._service = None
self._activity_id = activity_id
self._bundle = bundle
self._launch_time = time.time()
self._launching = False
logging.debug("Activity %s (%s) launching..." %
(self._activity_id, self.get_type()))
@@ -144,3 +152,11 @@ class HomeActivity(gobject.GObject):
(seconds since the epoch)
"""
return self._launch_time
def do_set_property(self, pspec, value):
if pspec.name == 'launching':
self._launching = value
def do_get_property(self, pspec):
if pspec.name == 'launching':
return self._launching
+7 -4
View File
@@ -43,10 +43,10 @@ class HomeModel(gobject.GObject):
the activity factories have set up.
"""
__gsignals__ = {
'activity-launched': (gobject.SIGNAL_RUN_FIRST,
'activity-added': (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE,
([gobject.TYPE_PYOBJECT])),
'activity-added': (gobject.SIGNAL_RUN_FIRST,
'activity-started': (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE,
([gobject.TYPE_PYOBJECT])),
'activity-removed': (gobject.SIGNAL_RUN_FIRST,
@@ -219,10 +219,12 @@ class HomeModel(gobject.GObject):
return
activity = HomeActivity(bundle, act_id)
self._activities[act_id] = activity
self.emit('activity-added', activity)
activity.set_service(service)
activity.set_window(window)
self.emit('activity-added', activity)
self.emit('activity-started', activity)
def _internal_remove_activity(self, activity):
if activity == self._current_activity:
@@ -244,8 +246,9 @@ class HomeModel(gobject.GObject):
if not bundle:
raise ValueError("Activity service name '%s' was not found in the bundle registry." % service_name)
activity = HomeActivity(bundle, activity_id)
activity.props.launching = True
self._activities[activity_id] = activity
self.emit('activity-launched', activity)
self.emit('activity-added', activity)
def notify_activity_launch_failed(self, activity_id):
if self._activities.has_key(activity_id):