Skip to content

Commit

Permalink
Fixed SEGV when key tables are customized in new gconf.
Browse files Browse the repository at this point in the history
  • Loading branch information
fujiwarat committed Nov 15, 2010
1 parent fec83a2 commit aaa2f6a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
18 changes: 0 additions & 18 deletions setup/main.py
Expand Up @@ -695,24 +695,14 @@ def __update_dict_values(self, new, id, short_label, long_label, embed, single,
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):
Expand Down Expand Up @@ -887,10 +877,6 @@ def on_btn_add_custom_key(self, widget, user_data):
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:
Expand Down Expand Up @@ -921,10 +907,6 @@ def on_btn_remove_custom_key(self, widget, user_data):
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, '')
Expand Down
4 changes: 4 additions & 0 deletions setup/prefs.py
Expand Up @@ -57,6 +57,10 @@ def get_value(self, section, key):
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

Expand Down

0 comments on commit aaa2f6a

Please sign in to comment.