[gnome-shell/gbsneto/fix-removing-pages] iconGrid: Properly remove pages
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gbsneto/fix-removing-pages] iconGrid: Properly remove pages
- Date: Thu, 13 Aug 2020 21:01:52 +0000 (UTC)
commit df35c3b8f733583b814827f28fa821b88e9ee4c1
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 | 8 ++++++++
1 file changed, 8 insertions(+)
---
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index 2d3a17a626..df6f439c1f 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -468,6 +468,14 @@ var IconGridLayout = GObject.registerClass({
this._unlinkItem(item);
});
+ // Adjust the page indexes of items after this page
+ for (let i = pageIndex + 1; i < this._pages.length; i++) {
+ this._pages[i].children.forEach(item => {
+ const itemData = this._items.get(item);
+ 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]