[gnome-shell/gbsneto/pagination: 45/53] appDisplay: Add items in order
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gbsneto/pagination: 45/53] appDisplay: Add items in order
- Date: Thu, 4 Jun 2020 18:42:39 +0000 (UTC)
commit dd92b18bc12502db4b2f2001bda563ae0993d024
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue May 19 21:31:45 2020 -0300
appDisplay: Add items in order
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1271
js/ui/appDisplay.js | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 7239a03d91..ac6dba8599 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -162,12 +162,16 @@ var BaseAppView = GObject.registerClass({
});
// Add new app icons
+ const itemsPerPage = this._grid.itemsPerPage;
addedApps.forEach(icon => {
let iconIndex = newApps.indexOf(icon);
this._orderedItems.splice(iconIndex, 0, icon);
- this._grid.addItem(icon);
this._items.set(icon.id, icon);
+
+ const page = Math.floor(iconIndex / itemsPerPage);
+ const position = iconIndex % itemsPerPage;
+ this._grid.addItem(icon, position, page);
});
this._viewIsReady = true;
@@ -468,7 +472,12 @@ class AppDisplay extends BaseAppView {
let newIdx = Util.insertSorted(this._orderedItems, item, this._compareItems);
this._grid.removeItem(item);
- this._grid.addItem(item, newIdx);
+
+ const itemsPerPage = this._grid.itemsPerPage;
+ const page = Math.floor(newIdx / itemsPerPage);
+ const position = newIdx % itemsPerPage;
+ this._grid.addItem(item, position, page);
+
this.selectApp(item.id);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]