Blame SOURCES/apps-menu-follow-sort-order.patch

689e29
From d19a80a7e7b7a19a723365bae85cc99ebd5bc25b Mon Sep 17 00:00:00 2001
689e29
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
689e29
Date: Fri, 13 Oct 2017 00:30:31 +0200
689e29
Subject: [PATCH 1/2] apps-menu: Don't override sort order
689e29
689e29
Keep the order in which GMenu returns loaded apps, so users can
689e29
reorder entries in Alacarte.
689e29
689e29
https://bugzilla.gnome.org/show_bug.cgi?id=788939
689e29
---
689e29
 extensions/apps-menu/extension.js | 3 ---
689e29
 1 file changed, 3 deletions(-)
689e29
689e29
diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
689e29
index e430140..dba31e7 100644
689e29
--- a/extensions/apps-menu/extension.js
689e29
+++ b/extensions/apps-menu/extension.js
689e29
@@ -745,9 +745,6 @@ const ApplicationsButton = new Lang.Class({
689e29
 
689e29
         if (category_menu_id) {
689e29
             applist = this.applicationsByCategory[category_menu_id];
689e29
-            applist.sort(function(a,b) {
689e29
-                return a.get_name().toLowerCase() > b.get_name().toLowerCase();
689e29
-            });
689e29
         } else {
689e29
             applist = new Array();
689e29
             let favorites = global.settings.get_strv('favorite-apps');
689e29
-- 
689e29
2.14.2
689e29
689e29
689e29
From a9d09c692cfb2944cdfd5b5c61140b3f9aa4b250 Mon Sep 17 00:00:00 2001
689e29
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
689e29
Date: Fri, 13 Oct 2017 01:43:20 +0200
689e29
Subject: [PATCH 2/2] apps-menu: Reload on tree changes
689e29
689e29
Now that we respect the sort order defined in the .menu file, make
689e29
sure to reload the menu on those changes as well, not just when
689e29
the installed apps themselves change.
689e29
689e29
https://bugzilla.gnome.org/show_bug.cgi?id=788939
689e29
---
689e29
 extensions/apps-menu/extension.js | 30 +++++++++++++++++++-----------
689e29
 1 file changed, 19 insertions(+), 11 deletions(-)
689e29
689e29
diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
689e29
index dba31e7..600eda3 100644
689e29
--- a/extensions/apps-menu/extension.js
689e29
+++ b/extensions/apps-menu/extension.js
689e29
@@ -466,18 +466,25 @@ const ApplicationsButton = new Lang.Class({
689e29
             });
689e29
         });
689e29
 
689e29
+        this._tree = new GMenu.Tree({ menu_basename: 'applications.menu' });
689e29
+        this._treeChangedId = this._tree.connect('changed',
689e29
+                                                 Lang.bind(this, this._onTreeChanged));
689e29
+
689e29
         this._applicationsButtons = new Map();
689e29
         this.reloadFlag = false;
689e29
         this._createLayout();
689e29
         this._display();
689e29
-        this._installedChangedId = appSys.connect('installed-changed', Lang.bind(this, function() {
689e29
-            if (this.menu.isOpen) {
689e29
-                this._redisplay();
689e29
-                this.mainBox.show();
689e29
-            } else {
689e29
-                this.reloadFlag = true;
689e29
-            }
689e29
-        }));
689e29
+        this._installedChangedId = appSys.connect('installed-changed',
689e29
+                                                  Lang.bind(this, this._onTreeChanged));
689e29
+    },
689e29
+
689e29
+    _onTreeChanged: function() {
689e29
+        if (this.menu.isOpen) {
689e29
+            this._redisplay();
689e29
+            this.mainBox.show();
689e29
+        } else {
689e29
+            this.reloadFlag = true;
689e29
+        }
689e29
     },
689e29
 
689e29
     get hotCorner() {
689e29
@@ -495,6 +502,8 @@ const ApplicationsButton = new Lang.Class({
689e29
         Main.overview.disconnect(this._showingId);
689e29
         Main.overview.disconnect(this._hidingId);
689e29
         appSys.disconnect(this._installedChangedId);
689e29
+        this._tree.disconnect(this._treeChangedId);
689e29
+        this._tree = null;
689e29
 
689e29
         Main.wm.setCustomKeybindingHandler('panel-main-menu',
689e29
                                            Shell.ActionMode.NORMAL |
689e29
@@ -675,9 +684,8 @@ const ApplicationsButton = new Lang.Class({
689e29
 
689e29
         //Load categories
689e29
         this.applicationsByCategory = {};
689e29
-        let tree = new GMenu.Tree({ menu_basename: 'applications.menu' });
689e29
-        tree.load_sync();
689e29
-        let root = tree.get_root_directory();
689e29
+        this._tree.load_sync();
689e29
+        let root = this._tree.get_root_directory();
689e29
         let categoryMenuItem = new CategoryMenuItem(this, null);
689e29
         this.categoriesBox.add_actor(categoryMenuItem.actor);
689e29
         let iter = root.iter();
689e29
-- 
689e29
2.14.2
689e29