[gnome-shell] iconGrid/iconGridLayout: Simplify _findBestIconSize()



commit b120b17d01f91c9672f81585ca95fcdd6d4c47ea
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Dec 1 17:58:09 2020 -0300

    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>

 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 93fc6219fa..093815922c 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() {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]