[gnome-shell/T27795: 97/138] appDisplay: Move actor's hierarchy for AllView out to a separate class



commit 4680c78b7dbfd5d485a3710373cf76026aecd58c
Author: Mario Sanchez Prada <mario endlessm com>
Date:   Wed Jun 14 18:04:48 2017 +0100

    appDisplay: Move actor's hierarchy for AllView out to a separate class
    
    This will be useful to create the cloned version of the destkop later
    on, where we will want to create this AllViewContainer passing an actor
    with a desaturated version of the main grid's actor.
    
    https://phabricator.endlessm.com/T17662
    https://phabricator.endlessm.com/T17658
    https://phabricator.endlessm.com/T17840

 data/theme/gnome-shell-sass/_endless.scss | 13 +++++++
 js/ui/appDisplay.js                       | 63 +++++++++++++++++++++----------
 2 files changed, 57 insertions(+), 19 deletions(-)
---
diff --git a/data/theme/gnome-shell-sass/_endless.scss b/data/theme/gnome-shell-sass/_endless.scss
index 9e0ce0e546..9e416e85a7 100644
--- a/data/theme/gnome-shell-sass/_endless.scss
+++ b/data/theme/gnome-shell-sass/_endless.scss
@@ -377,6 +377,19 @@ popup-separator-menu-item {
     }
 }
 
+// Icon Grid
+
+.all-apps {
+    -natural-padding-top: 25px;
+    /* We set the padding to zero to prevent inconsistencies with clones */
+    padding: 0px;
+ }
+
+.all-apps-scroller {
+    /* horizontal padding to make sure page indicators don't overlap content */
+    & > StBoxLayout { padding: 0px 70px; }
+}
+
 // Desktop Search (text entry widget)
 
 #searchEntry {
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index c821e36524..79734d1f88 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -300,23 +300,54 @@ class BaseAppView {
 }
 Signals.addSignalMethods(BaseAppView.prototype);
 
+var AllViewContainer = GObject.registerClass(
+class AllViewContainer extends St.Widget {
+    _init(gridActor) {
+        super._init({
+            layout_manager: new Clutter.BinLayout(),
+            x_expand: true,
+            y_expand: true,
+        });
+
+        this.gridActor = gridActor;
+
+        gridActor.y_expand = true;
+        gridActor.y_align = Clutter.ActorAlign.START;
+
+        this.scrollView = new St.ScrollView({
+            style_class: 'all-apps-scroller',
+            x_expand: true,
+            y_expand: true,
+            x_fill: true,
+            y_fill: false,
+            reactive: true,
+            hscrollbar_policy: St.PolicyType.NEVER,
+            vscrollbar_policy: St.PolicyType.EXTERNAL,
+            y_align: Clutter.ActorAlign.START,
+        });
+
+        this.stack = new St.Widget({ layout_manager: new Clutter.BinLayout() });
+        let box = new St.BoxLayout({ vertical: true });
+
+        this.stack.add_child(gridActor);
+        box.add_child(this.stack);
+
+        // For some reason I couldn't investigate yet using add_child()
+        // here makes the icon grid not to show up on the desktop.
+        this.scrollView.add_actor(box);
+
+        this.add_child(this.scrollView);
+    }
+});
+
 var AllView = class AllView extends BaseAppView {
     constructor() {
         super({ usePagination: true }, null);
-        this._scrollView = new St.ScrollView({ style_class: 'all-apps',
-                                               x_expand: true,
-                                               y_expand: true,
-                                               x_fill: true,
-                                               y_fill: false,
-                                               reactive: true,
-                                               y_align: St.Align.START });
-        this.actor = new St.Widget({ layout_manager: new Clutter.BinLayout(),
-                                     x_expand: true, y_expand: true });
-        this.actor.add_actor(this._scrollView);
+        this.actor = new AllViewContainer(this._grid);
+        this._scrollView = this.actor.scrollView;
+        this._stack = this.actor.stack;
         this._grid._delegate = this;
 
-        this._scrollView.set_policy(St.PolicyType.NEVER,
-                                    St.PolicyType.EXTERNAL);
         this._adjustment = this._scrollView.vscroll.adjustment;
 
         this._pageIndicators = new PageIndicators.AnimatedPageIndicators();
@@ -329,17 +360,10 @@ var AllView = class AllView extends BaseAppView {
 
         this.folderIcons = [];
 
-        this._stack = new St.Widget({ layout_manager: new Clutter.BinLayout() });
-        let box = new St.BoxLayout({ vertical: true });
-
         this._grid.currentPage = 0;
-        this._stack.add_actor(this._grid);
         this._eventBlocker = new St.Widget({ x_expand: true, y_expand: true });
         this._stack.add_actor(this._eventBlocker);
 
-        box.add_actor(this._stack);
-        this._scrollView.add_actor(box);
-
         this._scrollView.connect('scroll-event', this._onScroll.bind(this));
 
         let panAction = new Clutter.PanAction({ interpolate: false });
@@ -897,6 +921,7 @@ var AppDisplay = class AppDisplay {
         this._allView = new AllView();
 
         this.actor = new St.Widget({
+            style_class: 'all-apps',
             x_expand: true,
             y_expand: true,
             layout_manager: new Clutter.BinLayout(),


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