[gnome-shell/gbsneto/custom-icon-positions: 5/16] appDisplay: Bind compare function



commit 2a7fcf38ef426463acc508d2d4b33529ef467317
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 8801c6e2f8..0b28f64628 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -301,7 +301,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));
@@ -689,7 +689,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]