Blame SOURCES/0001-tuned-gui-Sort-plugins-based-on-their-name.patch

1bfeda
From d46834808c3226b3a6e48649df65befc399c21cd Mon Sep 17 00:00:00 2001
1bfeda
From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= <olysonek@redhat.com>
1bfeda
Date: Wed, 11 Jul 2018 00:41:45 +0200
1bfeda
Subject: [PATCH] tuned-gui: Sort plugins based on their name
1bfeda
MIME-Version: 1.0
1bfeda
Content-Type: text/plain; charset=UTF-8
1bfeda
Content-Transfer-Encoding: 8bit
1bfeda
1bfeda
Previously the sorting was done by comparing the objects themselves,
1bfeda
which is not what we want and it doesn't work in Python 3 - TypeError
1bfeda
is raised, e.g:
1bfeda
TypeError: '<' not supported between instances of 'BootloaderPlugin' and 'MountsPlugin'
1bfeda
1bfeda
Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
1bfeda
---
1bfeda
 tuned-gui.py | 3 ++-
1bfeda
 1 file changed, 2 insertions(+), 1 deletion(-)
1bfeda
1bfeda
diff --git a/tuned-gui.py b/tuned-gui.py
1bfeda
index 8f72fd5..e486687 100755
1bfeda
--- a/tuned-gui.py
1bfeda
+++ b/tuned-gui.py
1bfeda
@@ -278,7 +278,8 @@ class Base(object):
1bfeda
 		self.treestore_profiles = Gtk.ListStore(GObject.TYPE_STRING,
1bfeda
 				GObject.TYPE_STRING)
1bfeda
 		self.treestore_plugins = Gtk.ListStore(GObject.TYPE_STRING)
1bfeda
-		for plugin in sorted(self.plugin_loader.plugins):
1bfeda
+		for plugin in sorted(self.plugin_loader.plugins,
1bfeda
+				key = lambda plugin: plugin.name):
1bfeda
 			self.treestore_plugins.append([plugin.name])
1bfeda
 		self.combobox_plugins = \
1bfeda
 			self.builder.get_object('comboboxPlugins')
1bfeda
-- 
1bfeda
2.14.4
1bfeda