[gnome-shell/gbsneto/remove-favorites: 19/19] appDisplay: Merge AppDisplay in AllView



commit 246679cd9cdfddda65dcf3502b393e2982a56805
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Dec 4 13:43:57 2019 -0300

    appDisplay: Merge AppDisplay in AllView
    
    Now that AllView is the only actor that AppDisplay creates,
    we can actually merge them together.
    
    Merge AllView in AppDisplay, remove what used to be AppDisplay,
    and rename AllView to AppDisplay.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/879

 data/theme/gnome-shell-sass/_common.scss |   1 -
 js/ui/appDisplay.js                      | 102 +++++++++++++------------------
 2 files changed, 41 insertions(+), 62 deletions(-)
---
diff --git a/data/theme/gnome-shell-sass/_common.scss b/data/theme/gnome-shell-sass/_common.scss
index 03605e666a..3a19b77995 100644
--- a/data/theme/gnome-shell-sass/_common.scss
+++ b/data/theme/gnome-shell-sass/_common.scss
@@ -1442,7 +1442,6 @@ StScrollBar {
 
     .overview-icon { icon-size: 96px; }
   }
-  //.app-display { spacing: 20px; }
 
   .system-action-icon {
     background-color: black;
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index a250421ca3..6047f3262b 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -293,9 +293,9 @@ var BaseAppView = GObject.registerClass({
     }
 });
 
-var AllView = GObject.registerClass({
+var AppDisplay = GObject.registerClass({
     Signals: { 'space-ready': {} },
-}, class AllView extends BaseAppView {
+}, class AppDisplay extends BaseAppView {
     _init() {
         super._init({
             layout_manager: new Clutter.BinLayout(),
@@ -404,6 +404,43 @@ var AllView = GObject.registerClass({
 
         Main.overview.connect('item-drag-begin', this._onDragBegin.bind(this));
         Main.overview.connect('item-drag-end', this._onDragEnd.bind(this));
+
+        Gio.DBus.system.watch_name(SWITCHEROO_BUS_NAME,
+            Gio.BusNameWatcherFlags.NONE,
+            this._switcherooProxyAppeared.bind(this),
+            () => {
+                this._switcherooProxy = null;
+                this._updateDiscreteGpuAvailable();
+            });
+    }
+
+    _updateDiscreteGpuAvailable() {
+        if (!this._switcherooProxy)
+            discreteGpuAvailable = false;
+        else
+            discreteGpuAvailable = this._switcherooProxy.HasDualGpu;
+    }
+
+    _switcherooProxyAppeared() {
+        this._switcherooProxy = new SwitcherooProxy(Gio.DBus.system,
+            SWITCHEROO_BUS_NAME,
+            SWITCHEROO_OBJECT_PATH,
+            (proxy, error) => {
+                if (error) {
+                    log(error.message);
+                    return;
+                }
+                this._updateDiscreteGpuAvailable();
+            });
+    }
+
+    vfunc_allocate(box, flags) {
+        box = this.get_theme_node().get_content_box(box);
+        let availWidth = box.get_width();
+        let availHeight = box.get_height();
+        this.adaptToSize(availWidth, availHeight);
+
+        super.vfunc_allocate(box, flags);
     }
 
     vfunc_map() {
@@ -929,63 +966,6 @@ var AllView = GObject.registerClass({
     }
 });
 
-var AppDisplay = GObject.registerClass(
-class AppDisplay extends St.Widget {
-    _init() {
-        super._init({
-            style_class: 'app-display',
-            x_expand: true,
-            y_expand: true,
-        });
-
-        this._view = new AllView();
-        this.add_actor(this._view);
-
-        Gio.DBus.system.watch_name(SWITCHEROO_BUS_NAME,
-                                   Gio.BusNameWatcherFlags.NONE,
-                                   this._switcherooProxyAppeared.bind(this),
-                                   () => {
-                                       this._switcherooProxy = null;
-                                       this._updateDiscreteGpuAvailable();
-                                   });
-    }
-
-    _updateDiscreteGpuAvailable() {
-        if (!this._switcherooProxy)
-            discreteGpuAvailable = false;
-        else
-            discreteGpuAvailable = this._switcherooProxy.HasDualGpu;
-    }
-
-    _switcherooProxyAppeared() {
-        this._switcherooProxy = new SwitcherooProxy(Gio.DBus.system, SWITCHEROO_BUS_NAME, 
SWITCHEROO_OBJECT_PATH,
-            (proxy, error) => {
-                if (error) {
-                    log(error.message);
-                    return;
-                }
-                this._updateDiscreteGpuAvailable();
-            });
-    }
-
-    animate(animationDirection, onComplete) {
-        this._view.animate(animationDirection, onComplete);
-    }
-
-    selectApp(id) {
-        this._view.selectApp(id);
-    }
-
-    vfunc_allocate(box, flags) {
-        box = this.get_theme_node().get_content_box(box);
-        let availWidth = box.get_width();
-        let availHeight = box.get_height();
-        this._view.adaptToSize(availWidth, availHeight);
-
-        this._view.allocate(box, flags);
-    }
-});
-
 var AppSearchProvider = class AppSearchProvider {
     constructor() {
         this._appSys = Shell.AppSystem.get_default();
@@ -1385,7 +1365,7 @@ var FolderIcon = GObject.registerClass({
             return false;
 
         let view = _getViewFromIcon(source);
-        if (!view || !(view instanceof AllView))
+        if (!view || !(view instanceof AppDisplay))
             return false;
 
         if (this._folder.get_strv('apps').includes(source.id))
@@ -2194,7 +2174,7 @@ var AppIcon = GObject.registerClass({
 
         return source != this &&
                (source instanceof this.constructor) &&
-               (view instanceof AllView);
+               (view instanceof AppDisplay);
     }
 
     _setHoveringByDnd(hovering) {


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