[gnome-shell/gbsneto/icon-grid-dnd] baseAppView: Add only non-added icons, in order
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gbsneto/icon-grid-dnd] baseAppView: Add only non-added icons, in order
- Date: Tue, 2 Jul 2019 02:26:35 +0000 (UTC)
commit d6a2e8cdad1cbb2caf41e06cd79e466408da4589
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Jul 1 23:01:59 2019 -0300
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/603
js/ui/appDisplay.js | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 35cca0a05..a8a4d59ed 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -147,7 +147,17 @@ class BaseAppView {
_loadGrid() {
this._allItems.sort(this._compareItems);
- this._allItems.forEach(item => { this._grid.addItem(item); });
+
+ for (let i = 0; i < this._allItems.length; i++) {
+ let item = this._allItems[i];
+
+ // Don't readd already added items
+ if (item.actor.get_parent())
+ continue;
+
+ this._grid.addItem(item, i);
+ }
+
this.emit('view-loaded');
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]