[gnome-shell/gbsneto/40-stuff: 40/68] viewSelector: Move showApps() to Overview




commit 9b425a695b8a0b1d07aa7202aef81aa3d053ba37
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sat Jan 2 17:28:44 2021 -0300

    viewSelector: Move showApps() to Overview
    
    Now that Overview is able to ease into any state, be it window
    picker or app grid, we can move this ViewSelector method to
    Overview itself, which is its rightful place to live.
    
    Move ViewSelector.showApps() to Overview.showApps(), and adapt
    ShellDBus to call it from overview. Also make sure the show apps
    button is correctly toggled.

 js/ui/overview.js         | 4 ++++
 js/ui/overviewControls.js | 7 +++++++
 js/ui/shellDBus.js        | 2 +-
 js/ui/viewSelector.js     | 7 +------
 4 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/js/ui/overview.js b/js/ui/overview.js
index 00d8d69212..b24aa89a67 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -603,6 +603,10 @@ var Overview = class {
             this.show();
     }
 
+    showApps() {
+        this._show(OverviewControls.ControlsState.APP_GRID);
+    }
+
     getShowAppsButton() {
         logError(new Error('Usage of Overview.\'getShowAppsButton\' is deprecated, ' +
             'use \'dash.showAppsButton\' property instead'));
diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js
index 1495a7e32e..3ce8c8894f 100644
--- a/js/ui/overviewControls.js
+++ b/js/ui/overviewControls.js
@@ -217,6 +217,8 @@ class ControlsManager extends St.Widget {
     }
 
     animateToOverview(state, onComplete) {
+        this._animating = true;
+
         this.viewSelector.prepareToEnterOverview();
 
         this._adjustment.value = ControlsState.HIDDEN;
@@ -225,6 +227,11 @@ class ControlsManager extends St.Widget {
             mode: Clutter.AnimationMode.EASE_OUT_QUAD,
             onComplete,
         });
+
+        this.dash.showAppsButton.checked =
+            state === ControlsState.APP_GRID;
+
+        this._animating = false;
     }
 
     animateFromOverview(onComplete) {
diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js
index 181bd16310..7af71af55a 100644
--- a/js/ui/shellDBus.js
+++ b/js/ui/shellDBus.js
@@ -104,7 +104,7 @@ var GnomeShell = class {
     }
 
     ShowApplications() {
-        Main.overview.viewSelector.showApps();
+        Main.overview.showApps();
     }
 
     GrabAcceleratorAsync(params, invocation) {
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index d937acbab0..836048588d 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -300,7 +300,7 @@ var ViewSelector = GObject.registerClass({
             if (Main.overview.visible)
                 Main.overview.hide();
             else
-                this.showApps();
+                Main.overview.showApps();
         });
         global.stage.add_action(gesture);
 
@@ -322,11 +322,6 @@ var ViewSelector = GObject.registerClass({
         Main.overview.show();
     }
 
-    showApps() {
-        this._showAppsButton.checked = true;
-        Main.overview.show();
-    }
-
     prepareToEnterOverview() {
         this.show();
         this.reset();


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