[gnome-shell/gbsneto/custom-icon-positions: 9/20] appDisplay: Bind compare function



commit 3b04e30fa54043994cda6d56a57b7cc5cc707272
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 6e784a35a6..b265857045 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));
@@ -693,7 +693,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]