[gnome-shell/gbsneto/random-cleanups-pt2: 1/4] appDisplay: Bind compare function



commit c7b528fe44fd3635e2ed3e9f547f7dddbc119145
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/1332

 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 ff813f3954..cc3763064b 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));
@@ -585,7 +585,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]