[gnome-shell/gbsneto/custom-icon-positions: 63/72] appDisplay: Bind compare function



commit 07154aa0eecd758a59e3553998be987b04696ffb
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue May 26 01:40:44 2020 -0300

    appDisplay: Bind compare function
    
    So that we can use 'this' inside the compare functions.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284

 js/ui/appDisplay.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index f00eb16753..afc27370eb 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -278,7 +278,7 @@ var BaseAppView = GObject.registerClass({
         let oldApps = this._orderedItems.slice();
         let oldAppIds = oldApps.map(icon => icon.id);
 
-        let newApps = this._loadApps().sort(this._compareItems);
+        let newApps = this._loadApps().sort(this._compareItems.bind(this));
         let newAppIds = newApps.map(icon => icon.id);
 
         let addedApps = newApps.filter(icon => !oldAppIds.includes(icon.id));
@@ -749,7 +749,7 @@ class AppDisplay extends BaseAppView {
         // supposed to be and reinsert it where it's sorted.
         let oldIdx = this._orderedItems.indexOf(item);
         this._orderedItems.splice(oldIdx, 1);
-        let newIdx = Util.insertSorted(this._orderedItems, item, this._compareItems);
+        let newIdx = Util.insertSorted(this._orderedItems, item, this._compareItems.bind(this));
 
         this._grid.removeItem(item);
 


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