summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ibus/bus.py10
-rw-r--r--ibus/engine.py2
-rw-r--r--ibus/factory.py15
3 files changed, 11 insertions, 16 deletions
diff --git a/ibus/bus.py b/ibus/bus.py
index 0871772..e6eaf3c 100644
--- a/ibus/bus.py
+++ b/ibus/bus.py
@@ -20,7 +20,7 @@
# Boston, MA 02111-1307 USA
__all__ = (
- "Connection",
+ "IBus",
)
import dbus.connection
import ibus
@@ -30,7 +30,7 @@ dbus.mainloop.glib.DBusGMainLoop(set_as_default = True)
class IBus(dbus.connection.Connection):
def __new__(cls):
- self = super(Connection, cls).__new__(cls, ibus.IBUS_ADDR)
+ self = super(IBus, cls).__new__(cls, ibus.IBUS_ADDR)
self.__ibus = self.get_object(ibus.IBUS_NAME, ibus.IBUS_PATH)
return self
@@ -65,13 +65,13 @@ class IBus(dbus.connection.Connection):
return self.__ibus.set_capabilities(ic, caps)
def register_factories(self, object_paths):
- return self.__ibus.RegisterFactories(object_paths)
+ return self.__ibus.RegisterFactories(object_paths, **ibus.DEFAULT_ASYNC_HANDLERS)
def unregister_factories(self, object_paths):
return self.__ibus.UnregisterFactories(object_paths)
def register_panel(self, object_path, replace = False):
- return self.__ibus.RegisterPanle(object_path, replace)
+ return self.__ibus.RegisterPanel(object_path, replace)
def register_config(self, object_path, replace = False):
return self.__ibus.RegisterConfig(object_path, replace)
@@ -82,7 +82,7 @@ class IBus(dbus.connection.Connection):
def get_factory_info(self, factory_path):
return self.__ibus.GetFactoryInfo(factory_path)
- def set_factroy(self, factory_path):
+ def set_factory(self, factory_path):
return self.__ibus.SetFactory(factory_path)
def get_input_context_states(self, ic):
diff --git a/ibus/engine.py b/ibus/engine.py
index 690f62b..ceab4d6 100644
--- a/ibus/engine.py
+++ b/ibus/engine.py
@@ -139,7 +139,6 @@ class EngineBase(ibus.Object):
class EngineProxy(interface.IEngine):
def __init__(self, engine, conn, object_path):
super(EngineProxy, self).__init__(conn, object_path)
- self.__conn = conn
self.__engine = engine
def ProcessKeyEvent(self, keyval, is_press, state):
@@ -188,5 +187,4 @@ class EngineProxy(interface.IEngine):
self.__engine.destroy()
self.__engine = None
self.remove_from_connection ()
- self.__conn = None
diff --git a/ibus/factory.py b/ibus/factory.py
index dc9460a..f0b6331 100644
--- a/ibus/factory.py
+++ b/ibus/factory.py
@@ -27,11 +27,11 @@ import ibus
from ibus import interface
class EngineFactoryBase(ibus.Object):
- def __init__(self, info, engine_class, engine_path, conn, object_path):
+ def __init__(self, info, engine_class, engine_path, _ibus, object_path):
super(EngineFactoryBase, self).__init__()
- self.__proxy = EngineFactoryProxy (self, conn, object_path)
+ self.__proxy = EngineFactoryProxy (self, _ibus, object_path)
self.__info = info
- self.__conn = conn
+ self.__ibus = _ibus
self.__engine_class = engine_class
self.__engine_path = engine_path
self.__engine_id = 1
@@ -47,17 +47,16 @@ class EngineFactoryBase(ibus.Object):
pass
def register(self):
- _ibus = self.__conn.get_ibus ()
- _ibus.RegisterFactories([self.__object_path], **ibus.DEFAULT_ASYNC_HANDLERS)
+ self.__ibus.register_factories([self.__object_path])
def create_engine(self):
- engine = self.__engine_class(self.__conn, self.__engine_path + str(self.__engine_id))
+ engine = self.__engine_class(self.__ibus, self.__engine_path + str(self.__engine_id))
self.__engine_id += 1
return engine.get_dbus_object()
def do_destroy(self):
self.__proxy = None
- self.__conn = None
+ self.__ibus = None
self.__info = None
self.__engine_class = None
self.__engine_path = None
@@ -67,7 +66,6 @@ class EngineFactoryBase(ibus.Object):
class EngineFactoryProxy(interface.IEngineFactory):
def __init__(self, factory, conn, object_path):
super(EngineFactoryProxy, self).__init__(conn, object_path)
- self.__conn = conn
self.__factory = factory
def GetInfo(self):
@@ -86,5 +84,4 @@ class EngineFactoryProxy(interface.IEngineFactory):
self.__factory.destroy()
self.__factory = None
self.remove_from_connection ()
- self.__conn = None