Commit 66f3a08e authored by Alexandru Băluț's avatar Alexandru Băluț Committed by Thibault Saunier

prefs: Simplify the sections treeview model

This is possible because the first column is never used.

Differential Revision: https://phabricator.freedesktop.org/D509Reviewed-by: Thibault Saunier's avatarThibault Saunier <tsaunier@gnome.org>
parent 6e967151
......@@ -6,13 +6,10 @@
<columns>
<!-- column-name column1 -->
<column type="gchararray"/>
<!-- column-name column2 -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkDialog" id="dialog1">
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Preferences</property>
<property name="resizable">False</property>
<property name="type_hint">dialog</property>
......
......@@ -99,6 +99,8 @@ class PreferencesDialog(object):
to guess the appropriate widget to use based on the type of the
option, but you can override this by specifying a custom class.
@param attrname: the id of the setting holding the preference
@type attrname: C{str}
@param label: user-visible name for this option
@type label: C{str}
@param description: a user-visible description documenting this option
......@@ -258,7 +260,7 @@ class PreferencesDialog(object):
def __fillContents(self):
for section in sorted(self.prefs):
options = self.prefs[section]
self.model.append((_(section), section))
self.model.append((section,))
grid = Gtk.Grid()
grid.set_border_width(SPACING)
grid.props.column_spacing = SPACING
......@@ -322,7 +324,7 @@ class PreferencesDialog(object):
def _treeSelectionChangedCb(self, selection):
""" Update current when selection changed"""
model, _iter = selection.get_selected()
section = self.sections[model[_iter][1]]
section = self.sections[model[_iter][0]]
if self._current != section:
if self._current:
self._current.hide()
......
......@@ -258,6 +258,9 @@ class GlobalSettings(GObject.Object, Loggable):
return getattr(self, attrname) == self.defaults[attrname]
def setDefault(self, attrname):
"""
Reset the specified setting to its default value.
"""
setattr(self, attrname, self.defaults[attrname])
@classmethod
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment