[gnome-tweak-tool] Sort tweak groups alphabetically



commit 39c8d43f1ce9ffd77317861fbe694377fa679967
Author: John Stowers <john stowers gmail com>
Date:   Wed May 11 08:14:21 2011 +1200

    Sort tweak groups alphabetically

 gtweak/tweakmodel.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/gtweak/tweakmodel.py b/gtweak/tweakmodel.py
index 0167ab2..7e97501 100644
--- a/gtweak/tweakmodel.py
+++ b/gtweak/tweakmodel.py
@@ -76,6 +76,12 @@ class TweakModel(Gtk.ListStore):
         self._tweak_dir = gtweak.TWEAK_DIR
         assert(os.path.exists(self._tweak_dir))
 
+        self.set_sort_func(self.COLUMN_NAME, self._sort_tweak_groups)
+        self.set_sort_column_id(self.COLUMN_NAME, Gtk.SortType.ASCENDING)
+
+    def _sort_tweak_groups(self, model, iter1, iter2, user_data):
+        return cmp(model.get_value(iter1, self.COLUMN_NAME), model.get_value(iter2, self.COLUMN_NAME))
+
     @property
     def tweaks(self):
         return [t for row in self for t in row[TweakModel.COLUMN_TWEAK].tweaks]



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