[gnome-tweak-tool] xkb: Sort options by their description



commit 72d6126bd53403e95cbf116e2f8ea45f8b35f328
Author: Rui Matos <tiagomatos gmail com>
Date:   Thu Apr 14 20:12:45 2016 +0200

    xkb: Sort options by their description
    
    https://bugzilla.gnome.org/show_bug.cgi?id=740914

 gtweak/tweaks/tweak_group_xkb.py |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/gtweak/tweaks/tweak_group_xkb.py b/gtweak/tweaks/tweak_group_xkb.py
index 68a971b..6e1b497 100644
--- a/gtweak/tweaks/tweak_group_xkb.py
+++ b/gtweak/tweaks/tweak_group_xkb.py
@@ -59,6 +59,15 @@ class _XkbOption(Gtk.Expander, Tweak):
             model_values.append((option_id, desc))
             self._possible_values.append(option_id)
 
+        def values_cmp((av, ad), (bv, bd)):
+            if not av:
+                return -1
+            elif not bv:
+                return 1
+            else:
+                return cmp(ad, bd)
+        model_values.sort(cmp=values_cmp)
+
         self._widgets = dict()
         for (val, name) in model_values:
             w = None


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