[gnome-shell] lookingGlass: Sort extensions alphabetically



commit 659df23ad35277106dfaf8194a7327349a2535ee
Author: Florijan Hamzic <fh infinicode de>
Date:   Thu Dec 3 23:36:33 2020 +0100

    lookingGlass: Sort extensions alphabetically
    
    Extensions are currently listed in random order, which is hardly
    user-friendly. Instead, sort them alphabetically to make the list
    easier to parse.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1516>

 js/ui/lookingGlass.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js
index 147e46b2eb..109c04631f 100644
--- a/js/ui/lookingGlass.js
+++ b/js/ui/lookingGlass.js
@@ -687,7 +687,10 @@ var Extensions = GObject.registerClass({
             this._extensionsList.remove_actor(this._noExtensions);
 
         this._numExtensions++;
-        this._extensionsList.add(extensionDisplay);
+        const { name } = extension.metadata;
+        const pos = [...this._extensionsList].findIndex(
+            dsp => dsp._extension.metadata.name.localeCompare(name) > 0);
+        this._extensionsList.insert_child_at_index(extensionDisplay, pos);
     }
 
     _onViewSource(actor) {
@@ -750,6 +753,7 @@ var Extensions = GObject.registerClass({
 
     _createExtensionDisplay(extension) {
         let box = new St.BoxLayout({ style_class: 'lg-extension', vertical: true });
+        box._extension = extension;
         let name = new St.Label({
             style_class: 'lg-extension-name',
             text: extension.metadata.name,


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