[gnome-shell/gbsneto/fix-removing-pages] iconGrid: Properly remove pages




commit f541562acc3c5c8845d30692daafe4063d805ff5
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Aug 13 17:58:51 2020 -0300

    iconGrid: Properly remove pages
    
    When the last item of an IconGridLayout page is removed,
    the page itself is removed too. However, the indexes of
    items of next pages are not updated, which mess up the
    layout manager state.
    
    Update the page index of the items at forward pages when
    removing a page.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1406

 js/ui/iconGrid.js | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index 2d3a17a626..12a4aed9bd 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -468,6 +468,12 @@ var IconGridLayout = GObject.registerClass({
             this._unlinkItem(item);
         });
 
+        // Adjust the page indexes of items after this page
+        for (const itemData of this._items.values()) {
+            if (itemData.pageIndex > pageIndex)
+                itemData.pageIndex--;
+        }
+
         this._pages.splice(pageIndex, 1);
         this.emit('pages-changed');
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]