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
This commit is contained in:
Georges Basile Stavracas Neto 2020-08-13 17:58:51 -03:00
parent beddbc0583
commit f541562acc

View File

@ -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');
}