[gnome-shell/T27795: 110/138] iconGrid: Don't consider unused vertical space for preferred height



commit 50450e8914a863eb7608308e353f1f9dc4448451
Author: Mario Sanchez Prada <mario endlessm com>
Date:   Tue Jun 20 15:48:08 2017 +0100

    iconGrid: Don't consider unused vertical space for preferred height
    
    Upstream always considers all the space to report the preferred
    height, even if there are no enough icons to fill it. This causes
    problems with our desired layout where we want to pack the icon
    grid centered under the desktop search actor, since the grid will
    try to take up all the possible allocation, pushing the search
    entry to the top of the desktop.
    
    This fixes this situation by not requesting more height than what
    is actually needed. This means that icons will be pushed outside
    of the allocated space for the grid when opening a folder, which
    is not ideal, but probably good enough for now (and something that
    can be fixed as a separate ticket). To prevent some too extreme
    situations, though, we set the minimum amount of rows to 2, so that
    we always leave space for folders in case we only have one row.
    
    https://phabricator.endlessm.com/T17658

 js/ui/appDisplay.js | 7 +++++--
 js/ui/iconGrid.js   | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 20d7e8978f..6432b26fd7 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -26,7 +26,7 @@ const { loadInterfaceXML } = imports.misc.fileUtils;
 var MENU_POPUP_TIMEOUT = 600;
 var MAX_COLUMNS = 7;
 var MIN_COLUMNS = 4;
-var MIN_ROWS = 4;
+var MIN_ROWS = 1;
 
 var INACTIVE_GRID_OPACITY = 77;
 // This time needs to be less than IconGrid.EXTRA_SPACE_ANIMATION_TIME
@@ -53,6 +53,8 @@ let discreteGpuAvailable = false;
 
 // Endless-specific definitions below this point
 
+const EOS_DESKTOP_MIN_ROWS = 2;
+
 const EOS_LINK_PREFIX = 'eos-link-';
 
 const EOS_APP_CENTER_ID = 'org.gnome.Software.desktop';
@@ -345,7 +347,8 @@ class AllViewContainer extends St.Widget {
 
 var AllView = class AllView extends BaseAppView {
     constructor() {
-        super({ usePagination: true }, null);
+        super({ usePagination: true },
+              { minRows: EOS_DESKTOP_MIN_ROWS });
         this.actor = new AllViewContainer(this._grid);
         this._scrollView = this.actor.scrollView;
         this._stack = this.actor.stack;
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index ed5dd1eb91..42136d1df6 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -789,7 +789,7 @@ var PaginatedIconGrid = GObject.registerClass({
             nRows = Math.min(nRows, this._rowLimit);
 
         // We want to contain the grid inside the parent box with padding
-        this._rowsPerPage = this.rowsForHeight(availHeightPerPage);
+        this._rowsPerPage = Math.min(Math.max (this._minRows, nRows), 
this.rowsForHeight(availHeightPerPage));
         this._nPages = Math.ceil(nRows / this._rowsPerPage);
 
         if (this._nPages > 1)


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