|
|
2b55cd |
From b2bee94b2e17a5f34c289c12f232fcd413738bf0 Mon Sep 17 00:00:00 2001
|
|
|
2b55cd |
From: Rui Matos <tiagomatos@gmail.com>
|
|
|
2b55cd |
Date: Wed, 8 Apr 2015 11:52:36 +0200
|
|
|
2b55cd |
Subject: [PATCH 08/12] shell_extensions: Add a sort func to keep the list
|
|
|
2b55cd |
ordered
|
|
|
2b55cd |
|
|
|
2b55cd |
---
|
|
|
2b55cd |
gtweak/tweaks/tweak_group_shell_extensions.py | 15 ++++++++++++---
|
|
|
2b55cd |
1 file changed, 12 insertions(+), 3 deletions(-)
|
|
|
2b55cd |
|
|
|
2b55cd |
diff --git a/gtweak/tweaks/tweak_group_shell_extensions.py b/gtweak/tweaks/tweak_group_shell_extensions.py
|
|
|
2b55cd |
index 25bfaf4..c8af468 100644
|
|
|
2b55cd |
--- a/gtweak/tweaks/tweak_group_shell_extensions.py
|
|
|
2b55cd |
+++ b/gtweak/tweaks/tweak_group_shell_extensions.py
|
|
|
2b55cd |
@@ -304,16 +304,17 @@ class ShellExtensionTweakGroup(ListBoxTweakGroup):
|
|
|
2b55cd |
logging.warning("Error listing extensions", exc_info=True)
|
|
|
2b55cd |
except:
|
|
|
2b55cd |
logging.warning("Error detecting shell", exc_info=True)
|
|
|
2b55cd |
-
|
|
|
2b55cd |
+
|
|
|
2b55cd |
#add the extension installer
|
|
|
2b55cd |
extension_tweaks.append(
|
|
|
2b55cd |
_ShellExtensionInstallerTweak(shell, size_group=sg))
|
|
|
2b55cd |
-
|
|
|
2b55cd |
+
|
|
|
2b55cd |
ListBoxTweakGroup.__init__(self,
|
|
|
2b55cd |
_("Extensions"),
|
|
|
2b55cd |
*extension_tweaks)
|
|
|
2b55cd |
-
|
|
|
2b55cd |
+
|
|
|
2b55cd |
self.set_header_func(self._list_header_func, None)
|
|
|
2b55cd |
+ self.set_sort_func(self._list_sort_func, None)
|
|
|
2b55cd |
|
|
|
2b55cd |
def _got_info(self, ego, resp, uuid, extension, widget):
|
|
|
2b55cd |
if uuid == extension["uuid"]:
|
|
|
2b55cd |
@@ -335,6 +336,14 @@ class ShellExtensionTweakGroup(ListBoxTweakGroup):
|
|
|
2b55cd |
if before and not row.get_header():
|
|
|
2b55cd |
row.set_header (Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL))
|
|
|
2b55cd |
|
|
|
2b55cd |
+ def _list_sort_func(self, row1, row2, user_data):
|
|
|
2b55cd |
+ if isinstance(row1.get_child(), _ShellExtensionInstallerTweak):
|
|
|
2b55cd |
+ return 1
|
|
|
2b55cd |
+ if isinstance(row2.get_child(), _ShellExtensionInstallerTweak):
|
|
|
2b55cd |
+ return -1
|
|
|
2b55cd |
+
|
|
|
2b55cd |
+ return cmp(row1.name, row2.name)
|
|
|
2b55cd |
+
|
|
|
2b55cd |
def _on_extension_status_changed(self, shell, uuid, state, error):
|
|
|
2b55cd |
if uuid not in self._uuids:
|
|
|
2b55cd |
self._add_extension(uuid)
|
|
|
2b55cd |
--
|
|
|
2b55cd |
2.3.6
|
|
|
2b55cd |
|