diff options
author | fujiwarat <takao.fujiwara1@gmail.com> | 2010-11-15 13:25:11 +0900 |
---|---|---|
committer | fujiwarat <takao.fujiwara1@gmail.com> | 2010-11-15 13:25:11 +0900 |
commit | aaa2f6ad0ff5da7915b33b5d30ded25def187e7c (patch) | |
tree | c3ca301f181d2fdebe4ae114cc8f0bbfa3fab6dc | |
parent | fec83a2862a021a4cda94a07abd16b151c5f1525 (diff) | |
download | ibus-anthy-aaa2f6ad0ff5da7915b33b5d30ded25def187e7c.tar.gz |
Fixed SEGV when key tables are customized in new gconf.
-rw-r--r-- | setup/main.py | 18 | ||||
-rw-r--r-- | setup/prefs.py | 4 |
2 files changed, 4 insertions, 18 deletions
diff --git a/setup/main.py b/setup/main.py index f341cc1..6093d43 100644 --- a/setup/main.py +++ b/setup/main.py @@ -695,24 +695,14 @@ class AnthySetup(object): l[i] = [id, short_label, long_label, embed, single, reverse] key = 'short_label' - if key not in prefs.keys(section): - prefs.set_new_key(section, key) prefs.set_value(section, key, short_label) key = 'long_label' - if key not in prefs.keys(section): - prefs.set_new_key(section, key) prefs.set_value(section, key, long_label) key = 'embed' - if key not in prefs.keys(section): - prefs.set_new_key(section, key) prefs.set_value(section, key, embed) key = 'single' - if key not in prefs.keys(section): - prefs.set_new_key(section, key) prefs.set_value(section, key, single) key = 'reverse' - if key not in prefs.keys(section): - prefs.set_new_key(section, key) prefs.set_value(section, key, reverse) def __text_cell_data_cb(self, layout, renderer, model, iter, id): @@ -887,10 +877,6 @@ class AnthySetup(object): if section == None: self.__run_message_dialog(_("Your custom key is not assigned in any sections. Maybe a bug.")) return - if section not in prefs.sections(): - prefs.set_new_section(section) - if key not in prefs.keys(section): - prefs.set_new_key(section, key) if type != 'thumb': prefs.set_value(section, key, value) else: @@ -921,10 +907,6 @@ class AnthySetup(object): if section == None: self.__run_message_dialog(_("Your custom key is not assigned in any sections. Maybe a bug.")) return - if section not in prefs.sections(): - prefs.set_new_section(section) - if key not in prefs.keys(section): - prefs.set_new_key(section, key) # config.set_value(key, None) is not supported. if type != 'thumb': prefs.set_value(section, key, '') diff --git a/setup/prefs.py b/setup/prefs.py index f3f0781..66f2cd6 100644 --- a/setup/prefs.py +++ b/setup/prefs.py @@ -57,6 +57,10 @@ class Prefs(object): return self.default[section][key] def set_value(self, section, key, value): + if section not in self.sections(): + self.set_new_section(section) + if key not in self.keys(section): + self.set_new_key(section, key) self.default[section][key] self.new.setdefault(section, {})[key] = value |