Stop the default profile/layout from being editable
This commit is contained in:
parent
0501ceb8d4
commit
f1fe0bbf20
|
@ -2,12 +2,6 @@
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="2.16"/>
|
<requires lib="gtk+" version="2.16"/>
|
||||||
<!-- interface-naming-policy project-wide -->
|
<!-- interface-naming-policy project-wide -->
|
||||||
<object class="GtkListStore" id="ProfilesListStore">
|
|
||||||
<columns>
|
|
||||||
<!-- column-name Profile -->
|
|
||||||
<column type="gchararray"/>
|
|
||||||
</columns>
|
|
||||||
</object>
|
|
||||||
<object class="GtkListStore" id="FocusListStore">
|
<object class="GtkListStore" id="FocusListStore">
|
||||||
<columns>
|
<columns>
|
||||||
<!-- column-name focustype -->
|
<!-- column-name focustype -->
|
||||||
|
@ -197,10 +191,20 @@
|
||||||
<column type="guint"/>
|
<column type="guint"/>
|
||||||
</columns>
|
</columns>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="GtkListStore" id="ProfilesListStore">
|
||||||
|
<columns>
|
||||||
|
<!-- column-name Profile -->
|
||||||
|
<column type="gchararray"/>
|
||||||
|
<!-- column-name editable -->
|
||||||
|
<column type="gboolean"/>
|
||||||
|
</columns>
|
||||||
|
</object>
|
||||||
<object class="GtkListStore" id="LayoutListStore">
|
<object class="GtkListStore" id="LayoutListStore">
|
||||||
<columns>
|
<columns>
|
||||||
<!-- column-name Layout -->
|
<!-- column-name Layout -->
|
||||||
<column type="gchararray"/>
|
<column type="gchararray"/>
|
||||||
|
<!-- column-name editable -->
|
||||||
|
<column type="gboolean"/>
|
||||||
</columns>
|
</columns>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkDialog" id="prefswin">
|
<object class="GtkDialog" id="prefswin">
|
||||||
|
@ -443,10 +447,10 @@
|
||||||
<property name="clickable">True</property>
|
<property name="clickable">True</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkCellRendererText" id="cellrenderertext3">
|
<object class="GtkCellRendererText" id="cellrenderertext3">
|
||||||
<property name="editable">True</property>
|
|
||||||
<signal name="edited" handler="on_profile_name_edited"/>
|
<signal name="edited" handler="on_profile_name_edited"/>
|
||||||
</object>
|
</object>
|
||||||
<attributes>
|
<attributes>
|
||||||
|
<attribute name="editable">1</attribute>
|
||||||
<attribute name="text">0</attribute>
|
<attribute name="text">0</attribute>
|
||||||
</attributes>
|
</attributes>
|
||||||
</child>
|
</child>
|
||||||
|
@ -2062,10 +2066,10 @@
|
||||||
<property name="clickable">True</property>
|
<property name="clickable">True</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkCellRendererText" id="cellrenderertext12">
|
<object class="GtkCellRendererText" id="cellrenderertext12">
|
||||||
<property name="editable">True</property>
|
|
||||||
<signal name="edited" handler="on_layout_name_edited"/>
|
<signal name="edited" handler="on_layout_name_edited"/>
|
||||||
</object>
|
</object>
|
||||||
<attributes>
|
<attributes>
|
||||||
|
<attribute name="editable">1</attribute>
|
||||||
<attribute name="text">0</attribute>
|
<attribute name="text">0</attribute>
|
||||||
</attributes>
|
</attributes>
|
||||||
</child>
|
</child>
|
||||||
|
|
|
@ -178,7 +178,11 @@ class PrefsEditor:
|
||||||
profiles = self.config.list_profiles()
|
profiles = self.config.list_profiles()
|
||||||
self.profileiters = {}
|
self.profileiters = {}
|
||||||
for profile in profiles:
|
for profile in profiles:
|
||||||
self.profileiters[profile] = liststore.append([profile])
|
if profile == 'default':
|
||||||
|
editable = False
|
||||||
|
else:
|
||||||
|
editable = True
|
||||||
|
self.profileiters[profile] = liststore.append([profile, editable])
|
||||||
selection = widget.get_selection()
|
selection = widget.get_selection()
|
||||||
selection.connect('changed', self.on_profile_selection_changed)
|
selection.connect('changed', self.on_profile_selection_changed)
|
||||||
selection.select_iter(self.profileiters['default'])
|
selection.select_iter(self.profileiters['default'])
|
||||||
|
@ -189,7 +193,11 @@ class PrefsEditor:
|
||||||
layouts = self.config.list_layouts()
|
layouts = self.config.list_layouts()
|
||||||
self.layoutiters = {}
|
self.layoutiters = {}
|
||||||
for layout in layouts:
|
for layout in layouts:
|
||||||
self.layoutiters[layout] = liststore.append([layout])
|
if layout == 'default':
|
||||||
|
editable = False
|
||||||
|
else:
|
||||||
|
editable = True
|
||||||
|
self.layoutiters[layout] = liststore.append([layout, editable])
|
||||||
selection = widget.get_selection()
|
selection = widget.get_selection()
|
||||||
selection.connect('changed', self.on_layout_selection_changed)
|
selection.connect('changed', self.on_layout_selection_changed)
|
||||||
selection.select_iter(self.layoutiters['default'])
|
selection.select_iter(self.layoutiters['default'])
|
||||||
|
@ -267,7 +275,7 @@ class PrefsEditor:
|
||||||
self.store_profile_values()
|
self.store_profile_values()
|
||||||
|
|
||||||
## Layouts tab
|
## Layouts tab
|
||||||
# FIXME: Implement this
|
self.store_layout()
|
||||||
|
|
||||||
## Keybindings tab
|
## Keybindings tab
|
||||||
keybindings = self.config['keybindings']
|
keybindings = self.config['keybindings']
|
||||||
|
@ -607,6 +615,10 @@ class PrefsEditor:
|
||||||
value = 'escape-sequence'
|
value = 'escape-sequence'
|
||||||
self.config['delete_binding'] = value
|
self.config['delete_binding'] = value
|
||||||
|
|
||||||
|
def set_layout(self, layout):
|
||||||
|
"""Set a layout"""
|
||||||
|
pass
|
||||||
|
|
||||||
def store_layout(self, layout):
|
def store_layout(self, layout):
|
||||||
"""Store a layout"""
|
"""Store a layout"""
|
||||||
pass
|
pass
|
||||||
|
@ -627,7 +639,7 @@ class PrefsEditor:
|
||||||
newprofile = '%s %d' % (_('New Profile'), i)
|
newprofile = '%s %d' % (_('New Profile'), i)
|
||||||
|
|
||||||
if self.config.add_profile(newprofile):
|
if self.config.add_profile(newprofile):
|
||||||
model.append([newprofile])
|
model.append([newprofile, True])
|
||||||
|
|
||||||
def on_profileremovebutton_clicked(self, _button):
|
def on_profileremovebutton_clicked(self, _button):
|
||||||
"""Remove a profile from the list"""
|
"""Remove a profile from the list"""
|
||||||
|
@ -663,7 +675,7 @@ class PrefsEditor:
|
||||||
newlayout = '%s %d' % (_('New Layout'), i)
|
newlayout = '%s %d' % (_('New Layout'), i)
|
||||||
|
|
||||||
if self.config.add_layout(newlayout):
|
if self.config.add_layout(newlayout):
|
||||||
model.append([newlayout])
|
model.append([newlayout, True])
|
||||||
|
|
||||||
def on_layoutremovebutton_clicked(self, _button):
|
def on_layoutremovebutton_clicked(self, _button):
|
||||||
"""Remove a layout from the list"""
|
"""Remove a layout from the list"""
|
||||||
|
@ -771,7 +783,7 @@ class PrefsEditor:
|
||||||
def on_profile_name_edited(self, cell, path, newtext):
|
def on_profile_name_edited(self, cell, path, newtext):
|
||||||
"""Update a profile name"""
|
"""Update a profile name"""
|
||||||
oldname = cell.get_property('text')
|
oldname = cell.get_property('text')
|
||||||
if oldname == newtext:
|
if oldname == newtext or oldname == 'default':
|
||||||
return
|
return
|
||||||
dbg('PrefsEditor::on_profile_name_edited: Changing %s to %s' %
|
dbg('PrefsEditor::on_profile_name_edited: Changing %s to %s' %
|
||||||
(oldname, newtext))
|
(oldname, newtext))
|
||||||
|
@ -799,7 +811,7 @@ class PrefsEditor:
|
||||||
selection.select_iter(liststore.get_iter_first())
|
selection.select_iter(liststore.get_iter_first())
|
||||||
return
|
return
|
||||||
layout = listmodel.get_value(rowiter, 0)
|
layout = listmodel.get_value(rowiter, 0)
|
||||||
self.set_profile_values(layout)
|
self.set_layout(layout)
|
||||||
self.previous_selection = layout
|
self.previous_selection = layout
|
||||||
|
|
||||||
widget = self.builder.get_object('layoutremovebutton')
|
widget = self.builder.get_object('layoutremovebutton')
|
||||||
|
@ -811,7 +823,7 @@ class PrefsEditor:
|
||||||
def on_layout_name_edited(self, cell, path, newtext):
|
def on_layout_name_edited(self, cell, path, newtext):
|
||||||
"""Update a layout name"""
|
"""Update a layout name"""
|
||||||
oldname = cell.get_property('text')
|
oldname = cell.get_property('text')
|
||||||
if oldname == newtext:
|
if oldname == newtext or oldname == 'default':
|
||||||
return
|
return
|
||||||
dbg('Changing %s to %s' % (oldname, newtext))
|
dbg('Changing %s to %s' % (oldname, newtext))
|
||||||
self.config.rename_layout(oldname, newtext)
|
self.config.rename_layout(oldname, newtext)
|
||||||
|
|
Loading…
Reference in New Issue