[gnome-shell/gbsneto/pagination: 7/15] 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: 7/15] appDisplay: Add items in order
- Date: Mon, 25 May 2020 19:56:28 +0000 (UTC)
commit fe6cd029f2d171a4d21183d06dfba5f59ae4217c
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 33b2edbdd4..d93a839b9c 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -166,12 +166,16 @@ var BaseAppView = GObject.registerClass({
         });
 
         // Add new app icons
+        const appsPerPage = this._grid.appsPerPage;
         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 / appsPerPage);
+            const position = iconIndex % appsPerPage;
+            this._grid.addItem(icon, position, page);
         });
 
         this._viewIsReady = true;
@@ -472,7 +476,12 @@ class AppDisplay extends BaseAppView {
         let newIdx = Util.insertSorted(this._orderedItems, item, this._compareItems);
 
         this._grid.removeItem(item);
-        this._grid.addItem(item, newIdx);
+
+        const appsPerPage = this._grid.appsPerPage;
+        const page = Math.floor(newIdx / appsPerPage);
+        const position = newIdx % appsPerPage;
+        this._grid.addItem(item, position, page);
+
         this.selectApp(item.id);
     }
 
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]