From b120b17d01f91c9672f81585ca95fcdd6d4c47ea Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Tue, 1 Dec 2020 17:58:09 -0300 Subject: [PATCH] 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: --- js/ui/iconGrid.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js index 93fc6219f..093815922 100644 --- a/js/ui/iconGrid.js +++ b/js/ui/iconGrid.js @@ -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() {