[gnome-shell/gbsneto/icon-grid-dnd: 8/18] allView: Don't sort icons



commit 362e8c925a9c82e84345c47c2569100e7780cc8c
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Jul 2 13:31:43 2019 -0300

    allView: Don't sort icons
    
    We are moving towards being able to move icons to custom
    positions. To achieve that, the icon grid should stop
    sort its icons.
    
    Remove the sorting code from AllView and BaseAppView.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/603

 js/ui/appDisplay.js | 18 ------------------
 1 file changed, 18 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 1e5094613..5d5f78b96 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -146,13 +146,7 @@ class BaseAppView {
         return this._allItems;
     }
 
-    _compareItems(a, b) {
-        return a.name.localeCompare(b.name);
-    }
-
     _loadGrid() {
-        this._allItems.sort(this._compareItems);
-
         for (let i = 0; i < this._allItems.length; i++) {
             let item = this._allItems[i];
 
@@ -345,17 +339,6 @@ var AllView = class AllView extends BaseAppView {
         this._nEventBlockerInhibits = 0;
     }
 
-    _itemNameChanged(item) {
-        // If an item's name changed, we can pluck it out of where it's
-        // supposed to be and reinsert it where it's sorted.
-        let oldIdx = this._allItems.indexOf(item);
-        this._allItems.splice(oldIdx, 1);
-        let newIdx = Util.insertSorted(this._allItems, item, this._compareItems);
-
-        this._grid.removeItem(item);
-        this._grid.addItem(item, newIdx);
-    }
-
     _refilterApps() {
         let filteredApps = this._allItems.filter(icon => !icon.actor.visible);
 
@@ -408,7 +391,6 @@ var AllView = class AllView extends BaseAppView {
             let icon = this._items[id];
             if (!icon) {
                 icon = new FolderIcon(id, path, this);
-                icon.connect('name-changed', this._itemNameChanged.bind(this));
                 icon.connect('apps-changed', this._refilterApps.bind(this));
             }
             newApps.push(icon);


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