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
This commit is contained in:
Georges Basile Stavracas Neto 2019-07-02 13:31:43 -03:00
parent 37aa5d0faf
commit ca01b0287e
No known key found for this signature in database
GPG Key ID: 886C17EE170D1385

View File

@ -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();