diff options
author | Marco Pesenti Gritti <mpg@redhat.com> | 2006-05-05 19:37:56 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <mpg@redhat.com> | 2006-05-05 19:37:56 (GMT) |
commit | f86977781e1885ca4e34b265181dfebff65ca347 (patch) | |
tree | 22a5122898fe4639a11d65da8b4f23b1efae4e78 /chat/chat.py | |
parent | d0613d2a42a062cf4d0b0c9c6ea32bfbb01f278d (diff) |
Add a share button to the browser.
Diffstat (limited to 'chat/chat.py')
-rwxr-xr-x | chat/chat.py | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/chat/chat.py b/chat/chat.py index f4716ed..4201158 100755 --- a/chat/chat.py +++ b/chat/chat.py @@ -346,16 +346,37 @@ class GroupChat(Chat): chat.activity_connect_to_shell() chat.recv_message(sender, msg) - def run(self): - try: - gtk.main() - except KeyboardInterrupt: - pass +class ChatShell(dbus.service.Object): + instance = None + def get_instance(): + if not ChatShell.instance: + ChatShell.instance = ChatShell() + return ChatShell.instance + + get_instance = staticmethod(get_instance) + + def __init__(self): + session_bus = dbus.SessionBus() + bus_name = dbus.service.BusName('com.redhat.Sugar.Chat', bus=session_bus) + object_path = '/com/redhat/Sugar/Chat' + + dbus.service.Object.__init__(self, bus_name, object_path) + + def open_group_chat(self): + group_chat = GroupChat() + group_chat.activity_connect_to_shell() + + @dbus.service.method('com.redhat.Sugar.ChatShell') + def send_message(self, message): + pass + def main(): - app = GroupChat() - app.activity_connect_to_shell() - app.run() + ChatShell.get_instance().open_group_chat() + try: + gtk.main() + except KeyboardInterrupt: + pass if __name__ == "__main__": main() |