Fix the renaming of Layouts/Profiles sometimes corrupting what appears in the config file

This commit is contained in:
Stephen Boddy 2015-08-21 00:15:05 +02:00
parent d61b86caa7
commit de637d98d1
1 changed files with 24 additions and 2 deletions

View File

@ -1337,7 +1337,18 @@ class PrefsEditor:
def on_profile_name_edited(self, cell, path, newtext):
"""Update a profile name"""
oldname = cell.get_property('text')
oldname_broken = cell.get_property('text')
guiget = self.builder.get_object
treeview = guiget('profilelist')
treeselection = treeview.get_selection()
treeselection.select_path(path)
(model, pathlist) = treeselection.get_selected_rows()
tree_iter = model.get_iter(pathlist[0])
oldname = model.get_value(tree_iter,0)
if oldname != oldname_broken:
dbg('edited signal provides the wrong cell: %s != %s' %(oldname, oldname_broken))
if oldname == newtext or oldname == 'default':
return
dbg('PrefsEditor::on_profile_name_edited: Changing %s to %s' %
@ -1375,7 +1386,18 @@ class PrefsEditor:
def on_layout_name_edited(self, cell, path, newtext):
"""Update a layout name"""
oldname = cell.get_property('text')
oldname_broken = cell.get_property('text')
guiget = self.builder.get_object
treeview = guiget('layoutlist')
treeselection = treeview.get_selection()
treeselection.select_path(path)
(model, pathlist) = treeselection.get_selected_rows()
tree_iter = model.get_iter(pathlist[0])
oldname = model.get_value(tree_iter,0)
if oldname != oldname_broken:
dbg('edited signal provides the wrong cell: %s != %s' %(oldname, oldname_broken))
if oldname == newtext or oldname == 'default':
return
dbg('Changing %s to %s' % (oldname, newtext))