[gnome-tweak-tool] startup: Sort application selection list alphabetically
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tweak-tool] startup: Sort application selection list alphabetically
- Date: Fri, 14 Nov 2014 18:27:06 +0000 (UTC)
commit ecbbf97753dc66a8c0696dfb7eb4cbfe7ac47d94
Author: Rui Matos <tiagomatos gmail com>
Date: Fri Nov 14 19:18:27 2014 +0100
startup: Sort application selection list alphabetically
Note that the rows need to be added to the ListBox after adding to the
dicts so that the sort function has access to them.
https://bugzilla.gnome.org/show_bug.cgi?id=732877
gtweak/tweaks/tweak_group_startup.py | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/gtweak/tweaks/tweak_group_startup.py b/gtweak/tweaks/tweak_group_startup.py
index 5e1ca94..aef9cd0 100644
--- a/gtweak/tweaks/tweak_group_startup.py
+++ b/gtweak/tweaks/tweak_group_startup.py
@@ -50,9 +50,9 @@ class _AppChooser(Gtk.Dialog):
a,
_("running") if running else "")
if w:
- lb.add(w)
self._all[w] = a
self._running[w] = running
+ lb.add(w)
sw = Gtk.ScrolledWindow()
sw.props.hscrollbar_policy = Gtk.PolicyType.NEVER
@@ -69,9 +69,23 @@ class _AppChooser(Gtk.Dialog):
self.listbox = lb
def _sort_apps(self, a, b, user_data):
- if self._running.get(a) and not self._running.get(b):
+ arun = self._running.get(a)
+ brun = self._running.get(b)
+
+ if arun and not brun:
return -1
- return 1
+ elif not arun and brun:
+ return 1
+ else:
+ aname = self._all.get(a).get_name()
+ bname = self._all.get(b).get_name()
+
+ if aname < bname:
+ return -1
+ elif aname > bname:
+ return 1
+ else:
+ return 0
def _build_widget(self, a, extra):
row = Gtk.ListBoxRow()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]