iconGrid: Always call findBestModeForSize()

The API surface of IconGrid was originally meant to be only
setGridModes(), however findBestModeForSize() ended up being
called by AppDisplay code. Now that FolderGrid sets the modes
correctly, we don't need to skip calling findBestModeForSize()
anymore.

Always call findBestModeForSize() during IconGrid's allocation.
Add an underscore to findBestModeForSize() since it's now back
to be a private method of IconGrid.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
This commit is contained in:
Georges Basile Stavracas Neto 2022-06-09 15:40:21 -03:00 committed by Marge Bot
parent 113130552f
commit b115e07b4a

View File

@ -1180,7 +1180,7 @@ var IconGrid = GObject.registerClass({
}
}
findBestModeForSize(width, height) {
_findBestModeForSize(width, height) {
const { pagePadding } = this.layout_manager;
width -= pagePadding.left + pagePadding.right;
height -= pagePadding.top + pagePadding.bottom;
@ -1208,7 +1208,9 @@ var IconGrid = GObject.registerClass({
}
vfunc_allocate(box) {
this.layout_manager.adaptToSize(...box.get_size());
const [width, height] = box.get_size();
this._findBestModeForSize(width, height);
this.layout_manager.adaptToSize(width, height);
super.vfunc_allocate(box);
}