[gnome-shell] appDisplay: Make the app grid horizontal



commit be279abe9e08cd74299de59c692f536fbb66121d
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed May 27 23:29:16 2020 -0300

    appDisplay: Make the app grid horizontal
    
    Horizontal pagination is more natural than vertical, but for
    historical reasons we ended up with a vertically paginated
    app grid.
    
    Make the app grid horizontal.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1554>

 js/ui/appDisplay.js | 23 ++++++++++++++++++-----
 js/ui/iconGrid.js   |  2 +-
 2 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 09e035d6e4..58817c7f3a 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -126,7 +126,7 @@ var BaseAppView = GObject.registerClass({
         'view-loaded': {},
     },
 }, class BaseAppView extends St.Widget {
-    _init(params = {}, orientation = Clutter.Orientation.VERTICAL) {
+    _init(params = {}, orientation = Clutter.Orientation.HORIZONTAL) {
         params = Params.parse(params, { animateIndicators: true }, true);
 
         const animateIndicators = params.animateIndicators;
@@ -969,9 +969,15 @@ class AppDisplay extends BaseAppView {
             y_expand: true,
         });
         this.add_actor(this._stack);
-        this._stack.add_actor(this._scrollView);
 
-        this.add_actor(this._pageIndicators);
+        const box = new St.BoxLayout({
+            x_expand: true,
+            y_expand: true,
+            vertical: true,
+        });
+        this._stack.add_child(box);
+        box.add_child(this._scrollView);
+        box.add_child(this._pageIndicators);
 
         this._folderIcons = [];
 
@@ -1042,6 +1048,13 @@ class AppDisplay extends BaseAppView {
         super._redisplay();
     }
 
+    adaptToSize(width, height) {
+        const [, indicatorHeight] = this._pageIndicators.get_preferred_height(-1);
+        height -= indicatorHeight;
+
+        super.adaptToSize(width, height);
+    }
+
     _savePages() {
         const pages = [];
 
@@ -1693,7 +1706,6 @@ class FolderGrid extends IconGrid.IconGrid {
     _init() {
         super._init({
             allow_incomplete_pages: false,
-            orientation: Clutter.Orientation.HORIZONTAL,
             columns_per_page: 3,
             rows_per_page: 3,
             page_halign: Clutter.ActorAlign.CENTER,
@@ -1714,11 +1726,12 @@ class FolderView extends BaseAppView {
             x_expand: true,
             y_expand: true,
             animateIndicators: false,
-        }, Clutter.Orientation.HORIZONTAL);
+        });
 
         // If it not expand, the parent doesn't take into account its preferred_width when allocating
         // the second time it allocates, so we apply the "Standard hack for ClutterBinLayout"
         this._grid.x_expand = true;
+        this._pageIndicators.y_expand = false;
         this._id = id;
         this._folder = folder;
         this._parentView = parentView;
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index b7c8db5936..2e7b1bee27 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -1334,7 +1334,7 @@ var IconGrid = GObject.registerClass({
     _init(layoutParams = {}) {
         layoutParams = Params.parse(layoutParams, {
             allow_incomplete_pages: false,
-            orientation: Clutter.Orientation.VERTICAL,
+            orientation: Clutter.Orientation.HORIZONTAL,
             columns_per_page: 6,
             rows_per_page: 4,
             page_halign: Clutter.ActorAlign.FILL,


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