baseAppView: Add only non-added icons, in order

In the close future, BaseAppView will only add new icons (compared
to the remove all + readd all approach that is now). With that, the
items in the this._allItems array will be iterated multiple times,
but items can only be added once, and in the order they're in the
array.

Add the items in the this._allItems array passing the index they
should be added, and don't add icons with a parent already set.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/645
This commit is contained in:
Georges Basile Stavracas Neto 2019-07-01 23:01:59 -03:00
parent 48a2b6cb0b
commit 47d2f4dbeb
No known key found for this signature in database
GPG Key ID: 886C17EE170D1385

View File

@ -149,7 +149,15 @@ class BaseAppView {
_loadGrid() {
this._allItems.sort(this._compareItems);
this._allItems.forEach(item => this._grid.addItem(item));
this._allItems.forEach((item, index) => {
// Don't readd already added items
if (item.actor.get_parent())
return;
this._grid.addItem(item, index);
});
this.emit('view-loaded');
}