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>
This commit is contained in:
Georges Basile Stavracas Neto 2020-05-27 23:29:16 -03:00 committed by Marge Bot
parent b3d57dc4bd
commit be279abe9e
2 changed files with 19 additions and 6 deletions

View File

@ -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;

View File

@ -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,