From 270bb8aaf6cb1724958b6e22a05eab42de0b3368 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Thu, 6 Jul 2006 23:08:35 +0200 Subject: [PATCH] This should fix one-to-one chat, can't test now though --- activities/chat/ChatActivity.py | 17 ++++------------- sugar/activity/Activity.py | 9 +++++++++ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/activities/chat/ChatActivity.py b/activities/chat/ChatActivity.py index 694e100f..8de01bb3 100644 --- a/activities/chat/ChatActivity.py +++ b/activities/chat/ChatActivity.py @@ -50,15 +50,7 @@ class ChatShellDbusService(dbus.service.Object): def open_chat(self, serialized_service): self._parent.open_chat(Service.deserialize(serialized_service)) -class ChatShell: - instance = None - - def get_instance(): - if not ChatShell.instance: - ChatShell.instance = ChatShell() - return ChatShell.instance - get_instance = staticmethod(get_instance) - +class ChatListener: def __init__(self): ChatShellDbusService(self) @@ -104,7 +96,6 @@ class ChatShell: chat.connect_to_shell() return False -chat_shell = ChatShell.get_instance() -chat_shell.start() - -gtk.main() +def start(): + chat_listener = ChatListener() + chat_listener.start() diff --git a/sugar/activity/Activity.py b/sugar/activity/Activity.py index b9dbd44a..344e1069 100644 --- a/sugar/activity/Activity.py +++ b/sugar/activity/Activity.py @@ -42,6 +42,15 @@ class ActivityFactory(dbus.service.Object): (fp, pathname, description) = imp.find_module(module_name) module = imp.load_module(module_name, fp, pathname, description) + + try: + start = getattr(module, 'start') + except: + start = None + + if start: + start() + self._class = getattr(module, class_name) bus = dbus.SessionBus()