diff options
author | Marco Pesenti Gritti <mpg@redhat.com> | 2007-04-08 17:20:59 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <mpg@redhat.com> | 2007-04-08 17:20:59 (GMT) |
commit | 09304e8e5acc0d178bbb64f3f72f3515e2f81989 (patch) | |
tree | a911b94748bec04c27cf86c052f78c93677a6f89 /shell/model/homeactivity.py | |
parent | 3da95e92361145b3d001302d9444a1f340818079 (diff) |
Accept raw X windows in the shell
Diffstat (limited to 'shell/model/homeactivity.py')
-rw-r--r-- | shell/model/homeactivity.py | 44 |
1 files changed, 18 insertions, 26 deletions
diff --git a/shell/model/homeactivity.py b/shell/model/homeactivity.py index f823f59..8772888 100644 --- a/shell/model/homeactivity.py +++ b/shell/model/homeactivity.py @@ -24,9 +24,6 @@ from sugar.graphics.xocolor import XoColor from sugar.presence import PresenceService from sugar import profile -_ACTIVITY_SERVICE_NAME = "org.laptop.Activity" -_ACTIVITY_SERVICE_PATH = "/org/laptop/Activity" - class HomeActivity(gobject.GObject): __gsignals__ = { 'launch-timeout': (gobject.SIGNAL_RUN_FIRST, @@ -39,29 +36,32 @@ class HomeActivity(gobject.GObject): self._window = None self._xid = None self._service = None - self._id = activity_id - self._type = bundle.get_service_name() - self._icon_name = bundle.get_icon() + self._activity_id = activity_id + self._bundle = bundle self._launch_time = time.time() self._launched = False - self._launch_timeout_id = gobject.timeout_add(20000, self._launch_timeout_cb) + self._launch_timeout_id = gobject.timeout_add( + 20000, self._launch_timeout_cb) - logging.debug("Activity %s (%s) launching..." % (self._id, self._type)) + 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): - logging.debug("Activity %s (%s) launch timed out" % (self._id, self._type)) + 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._id, self._type)) + 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 @@ -74,17 +74,8 @@ class HomeActivity(gobject.GObject): self._window = window self._xid = window.get_xid() - bus = dbus.SessionBus() - self._service = bus.get_object(_ACTIVITY_SERVICE_NAME + '%d' % self._xid, - _ACTIVITY_SERVICE_PATH + "/%s" % self._xid) - - # verify id and type details - act_id = self._service.get_id() - if act_id != self._id: - raise RuntimeError("Activity's real ID (%s) didn't match expected (%s)." % (act_id, self._id)) - act_type = self._service.get_service_name() - if act_type != self._type: - raise RuntimeError("Activity's real type (%s) didn't match expected (%s)." % (act_type, self._type)) + def set_service(self, service): + self._service = service def get_service(self): return self._service @@ -95,17 +86,18 @@ class HomeActivity(gobject.GObject): return self._window.get_name() def get_icon_name(self): - return self._icon_name + return self._bundle.get_icon() def get_icon_color(self): - activity = PresenceService.get_instance().get_activity(self._id) + pservice = PresenceService.get_instance() + activity = pservice.get_activity(self._activity_id) if activity != None: return XoColor(activity.get_color()) else: return profile.get_color() - def get_id(self): - return self._id + def get_activity_id(self): + return self._activity_id def get_xid(self): if not self._launched: @@ -118,7 +110,7 @@ class HomeActivity(gobject.GObject): return self._window def get_type(self): - return self._type + return self._bundle.get_service_name() def get_shared(self): if not self._launched: |