iconGrid/iconGridLayout: Simplify _findBestIconSize()

The 'bestSize' variable isn't necessary anymore, remove it in favor of
simply returning the 'size' or, if no suitable size found, IconSize.TINY.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1518>
This commit is contained in:
Georges Basile Stavracas Neto 2020-12-01 17:58:09 -03:00 committed by Marge Bot
parent 7d4ac04a78
commit b120b17d01

View File

@ -403,7 +403,6 @@ var IconGridLayout = GObject.registerClass({
if (this._fixedIconSize !== -1)
return this._fixedIconSize;
let bestSize;
const iconSizes = Object.values(IconSize).sort((a, b) => b - a);
for (const size of iconSizes) {
let usedWidth, usedHeight;
@ -429,13 +428,11 @@ var IconGridLayout = GObject.registerClass({
this._pageHeight - usedHeight - rowSpacingPerPage -
this._pagePadding.top - this._pagePadding.bottom;
bestSize = size;
if (emptyHSpace >= 0 && emptyVSpace > 0)
break;
return size;
}
return bestSize;
return IconSize.TINY;
}
_getChildrenMaxSize() {