[gnome-shell] iconGrid: Always call findBestModeForSize()



commit b115e07b4a73fe6f3435b239fd0d1e5e1aac4026
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Jun 9 15:40:21 2022 -0300

    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>

 js/ui/iconGrid.js | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index a5f86fc64d..ac8d3ecaaf 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -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);
     }
 


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