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



commit ca01b0287ebb66fb35778f41004d8fb59002dc14
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 | 23 -----------------------
 1 file changed, 23 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 5c8d05bb2..9ad947fbc 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -151,13 +151,7 @@ class BaseAppView {
         return this._allItems;
     }
 
-    _compareItems(a, b) {
-        return a.name.localeCompare(b.name);
-    }
-
     _loadGrid() {
-        this._allItems.sort(this._compareItems);
-
         this._allItems.forEach((item, index) => {
             // Don't readd already added items
             if (item.actor.get_parent())
@@ -349,17 +343,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);
 
@@ -412,7 +395,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._redisplay.bind(this));
             }
             newApps.push(icon);
@@ -821,11 +803,6 @@ var FrequentView = class FrequentView extends BaseAppView {
         return this._usage.get_most_used().length >= MIN_FREQUENT_APPS_COUNT;
     }
 
-    _compareItems() {
-        // The FrequentView does not need to be sorted alphabetically
-        return 0;
-    }
-
     _loadApps() {
         let apps = [];
         let mostUsed = this._usage.get_most_used();


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