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>
This commit is contained in:
Florijan Hamzic 2020-12-03 23:36:33 +01:00 committed by Marge Bot
parent 3e74b5ae9b
commit 659df23ad3

View File

@ -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,