|
|
891583 |
From eb13e65fbd898fca6c4e8f49c278d014a492bbe5 Mon Sep 17 00:00:00 2001
|
|
|
2b55cd |
From: Rui Matos <tiagomatos@gmail.com>
|
|
|
2b55cd |
Date: Wed, 8 Apr 2015 11:52:36 +0200
|
|
|
891583 |
Subject: [PATCH 4/8] 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
|
|
|
891583 |
index fce8abf..c1f41d9 100644
|
|
|
2b55cd |
--- a/gtweak/tweaks/tweak_group_shell_extensions.py
|
|
|
2b55cd |
+++ b/gtweak/tweaks/tweak_group_shell_extensions.py
|
|
|
891583 |
@@ -301,16 +301,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"]:
|
|
|
891583 |
@@ -332,6 +333,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 |
--
|
|
|
891583 |
2.9.3
|
|
|
2b55cd |
|