From 80ff27e165389fe490305d05e2e01708d113ddc2 Mon Sep 17 00:00:00 2001 From: Eitan Isaacson Date: Wed, 8 Jun 2011 12:53:10 -0700 Subject: Use generic keyboard service name. - Have it replaceable by a service that is activated later. - Have Antler quit if the generic name is acquired by a new service. - Keep non-replaceable implementation specific name on bus. https://bugzilla.gnome.org/show_bug.cgi?id=651702 --- caribou/antler/main.py | 5 +++++ caribou/daemon/main.py | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'caribou') diff --git a/caribou/antler/main.py b/caribou/antler/main.py index ce0eca3..d5d9a1b 100644 --- a/caribou/antler/main.py +++ b/caribou/antler/main.py @@ -2,6 +2,7 @@ from gi.repository import Caribou from window import AntlerWindowEntry from keyboard_view import AntlerKeyboardView import gobject +import sys class AntlerKeyboardService(Caribou.KeyboardService): def __init__(self): @@ -25,6 +26,10 @@ class AntlerKeyboardService(Caribou.KeyboardService): def do_set_entry_location (self, x, y, w, h): self.window.set_entry_location(x, y, w, h) + def do_name_lost (self, name): + sys.stderr.write("Another service acquired %s, quitting..\n") + sys.exit(0) + if __name__ == "__main__": antler_keyboard_service = AntlerKeyboardService() antler_keyboard_service.run() diff --git a/caribou/daemon/main.py b/caribou/daemon/main.py index 4f3def9..63eb444 100644 --- a/caribou/daemon/main.py +++ b/caribou/daemon/main.py @@ -9,13 +9,13 @@ from caribou import APP_NAME debug = False class CaribouDaemon: - def __init__(self, keyboard_name="Antler"): + def __init__(self): if not self._get_a11y_enabled(): self._show_no_a11y_dialogs() bus = dbus.SessionBus() try: - dbus_obj = bus.get_object("org.gnome.Caribou.%s" % keyboard_name, - "/org/gnome/Caribou/%s" % keyboard_name) + dbus_obj = bus.get_object("org.gnome.Caribou.Keyboard", + "/org/gnome/Caribou/Keyboard") except dbus.DBusException, e: self._show_error_dialog(e.message) self.keyboard_proxy = dbus.Interface(dbus_obj, "org.gnome.Caribou.Keyboard") -- cgit v1.2.1