From f541562acc3c5c8845d30692daafe4063d805ff5 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Thu, 13 Aug 2020 17:58:51 -0300 Subject: [PATCH] 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 2d3a17a62..12a4aed9b 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'); }