[pitivi] prefs: Simplify the sections treeview model



commit 66f3a08ea2c0f201b80d9ce3eab17eb75dfd6c02
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Tue Oct 20 16:43:58 2015 +0200

    prefs: Simplify the sections treeview model
    
    This is possible because the first column is never used.
    
    Differential Revision: https://phabricator.freedesktop.org/D509
    Reviewed-by: Thibault Saunier <tsaunier gnome org>

 data/ui/preferences.ui  |    3 ---
 pitivi/dialogs/prefs.py |    6 ++++--
 pitivi/settings.py      |    3 +++
 3 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/data/ui/preferences.ui b/data/ui/preferences.ui
index 8c7e0ad..ebc9004 100644
--- a/data/ui/preferences.ui
+++ b/data/ui/preferences.ui
@@ -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>
diff --git a/pitivi/dialogs/prefs.py b/pitivi/dialogs/prefs.py
index ba0e361..f3ea877 100644
--- a/pitivi/dialogs/prefs.py
+++ b/pitivi/dialogs/prefs.py
@@ -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()
diff --git a/pitivi/settings.py b/pitivi/settings.py
index 1c26c24..c38f764 100644
--- a/pitivi/settings.py
+++ b/pitivi/settings.py
@@ -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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]