summaryrefslogtreecommitdiffstats
path: root/daemon/factorymanager.py
diff options
context:
space:
mode:
authorHuang Peng <shawn.p.huang@gmail.com>2008-08-30 19:21:06 +0800
committerHuang Peng <shawn.p.huang@gmail.com>2008-08-30 19:21:06 +0800
commitff15b28272e8930f512a9f098b6c9970e4ae12e4 (patch)
treea95d2b669378235147c873fca4a5679758f71c62 /daemon/factorymanager.py
parentdc0cf118d0ec4733ce9b12244a2e40f271195278 (diff)
downloadibus-ff15b28272e8930f512a9f098b6c9970e4ae12e4.tar.gz
ibus-ff15b28272e8930f512a9f098b6c9970e4ae12e4.tar.xz
ibus-ff15b28272e8930f512a9f098b6c9970e4ae12e4.zip
Save default input engine and restore it when start ibus.
Diffstat (limited to 'daemon/factorymanager.py')
-rw-r--r--daemon/factorymanager.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/daemon/factorymanager.py b/daemon/factorymanager.py
index f7d90fa..1a7dc23 100644
--- a/daemon/factorymanager.py
+++ b/daemon/factorymanager.py
@@ -30,6 +30,11 @@ class FactoryManager(ibus.Object):
gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE,
(gobject.TYPE_PYOBJECT, )
+ ),
+ 'default-factory-changed' : (
+ gobject.SIGNAL_RUN_FIRST,
+ gobject.TYPE_NONE,
+ (gobject.TYPE_PYOBJECT, )
)
}
@@ -65,13 +70,15 @@ class FactoryManager(ibus.Object):
if self.__default_factory == None:
factories = self.__get_sorted_factories()
if factories:
- self.__default_factory = factories[0]
+ self.set_default_factory(factories[0])
return self.__default_factory
def set_default_factory(self, factory):
- if factory in self.__get_sorted_factories():
- self.__default_factory = factory
+ if factory in self.__get_sorted_factories() or factory == None:
+ if self.__default_factory != factory:
+ self.__default_factory = factory
+ self.emit("default-factory-changed", self.__default_factory)
else:
print "unknown factory"
@@ -91,7 +98,7 @@ class FactoryManager(ibus.Object):
return factory.get_info()
def get_factory(self, factory_path):
- factory = self.__factories[factory_path]
+ factory = self.__factories.get(factory_path, None)
return factory
def __get_sorted_factories(self, resort = False):
@@ -107,7 +114,7 @@ class FactoryManager(ibus.Object):
for object_path in self.__ibusconn_factory_dict[ibusconn]:
factory = self.__factories[object_path]
if factory == self.__default_factory:
- self.__default_factory = None
+ self.set_default_factory(None)
del self.__factories[object_path]
del self.__ibusconn_factory_dict[ibusconn]