diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-08-11 22:29:32 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-08-11 22:29:32 (GMT) |
commit | c5fb39875c9a6609868ef7295193840df183a6f4 (patch) | |
tree | 985631a58e94173bb1a45c8c66545ceaca4f3a72 /shell/Shell.py | |
parent | 72bf63709136bf26d73e43023b9b95af2e5737e9 (diff) |
Do not open multiple copies of the same activity
Diffstat (limited to 'shell/Shell.py')
-rwxr-xr-x | shell/Shell.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/shell/Shell.py b/shell/Shell.py index bf0d89b..db21135 100755 --- a/shell/Shell.py +++ b/shell/Shell.py @@ -90,7 +90,7 @@ class Shell(gobject.GObject): del self._hosts[xid] def get_activity(self, activity_id): - for host in self._hosts: + for host in self._hosts.values(): if host.get_id() == activity_id: return host return None @@ -128,15 +128,20 @@ class Shell(gobject.GObject): info = self._registry.get_activity(service.get_type()) activity_id = service.get_activity_id() - pservice = PresenceService() - activity_ps = pservice.get_activity(activity_id) - if activity_ps: - activity = ActivityFactory.create(info.get_id()) - activity.set_default_type(service.get_type()) - activity.join(activity_ps.object_path()) + activity = self.get_activity(activity_id) + if activity: + activity.present() else: - logging.error('Cannot start activity.') + pservice = PresenceService() + activity_ps = pservice.get_activity(activity_id) + + if activity_ps: + activity = ActivityFactory.create(info.get_id()) + activity.set_default_type(service.get_type()) + activity.join(activity_ps.object_path()) + else: + logging.error('Cannot start activity.') def start_activity(self, activity_name): activity = ActivityFactory.create(activity_name) |