summaryrefslogtreecommitdiff
path: root/setup/prefs.py
diff options
context:
space:
mode:
authorfujiwarat <takao.fujiwara1@gmail.com>2012-09-11 18:40:29 +0900
committerfujiwarat <takao.fujiwara1@gmail.com>2012-09-11 18:40:29 +0900
commitca75b950777a27b7244e028b5874db0ffc33f1ac (patch)
treed1329dbdc15619a8ec7d150f5d3abb3afc38949c /setup/prefs.py
parent6fbeb9223b4fa942933f4ceaea0c25161b1e6e55 (diff)
downloadibus-anthy-ca75b950777a27b7244e028b5874db0ffc33f1ac.tar.gz
Used ibus_config_get_values
Diffstat (limited to 'setup/prefs.py')
-rw-r--r--setup/prefs.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/setup/prefs.py b/setup/prefs.py
index eff483b..ab5dffb 100644
--- a/setup/prefs.py
+++ b/setup/prefs.py
@@ -39,6 +39,9 @@ class Prefs(object):
bus.get_config() if bus else \
IBus.Bus().get_config()
+ # ibus_config_get_values enhances the performance.
+ self.__has_config_get_values = hasattr(self._config, 'get_values')
+
def __log_handler(self, domain, level, message, data):
if not data:
return
@@ -115,8 +118,17 @@ class Prefs(object):
self.fetch_section(s)
def fetch_section(self, section):
- for k in self.keys(section):
- self.fetch_item(section, k)
+ if not self.__has_config_get_values:
+ for k in self.keys(section):
+ self.fetch_item(section, k)
+ return
+
+ s = '/'.join(
+ [s for s in '/'.join([self._prefix, section]).split('/') if s])
+ variant = self._config.get_values(s)
+ for key in variant.keys():
+ v = variant[key]
+ self.modified.setdefault(section, {})[key] = v if v != [''] else []
def fetch_item(self, section, key, readonly=False):
s = '/'.join(