[gnome-shell] viewSelector: Remove showApps()



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

    viewSelector: Remove showApps()
    
    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.
    
    Remove ViewSelector.showApps(), and make all callers call
    Main.overview.show(ControlsState.APP_GRID). Also make sure the
    show apps button is correctly toggled.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1624>

 js/ui/overview.js         | 4 ++++
 js/ui/overviewControls.js | 7 +++++++
 js/ui/shellDBus.js        | 3 ++-
 js/ui/viewSelector.js     | 7 +------
 4 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/js/ui/overview.js b/js/ui/overview.js
index 0020dcd4f2..6f838db6b7 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -605,6 +605,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 2f584d2090..f836f822ea 100644
--- a/js/ui/overviewControls.js
+++ b/js/ui/overviewControls.js
@@ -178,6 +178,8 @@ class ControlsManager extends St.Widget {
     }
 
     animateToOverview(state, callback) {
+        this._ignoreShowAppsButtonToggle = true;
+
         this.viewSelector.prepareToEnterOverview();
 
         this._stateAdjustment.value = ControlsState.HIDDEN;
@@ -189,6 +191,11 @@ class ControlsManager extends St.Widget {
                     callback();
             },
         });
+
+        this.dash.showAppsButton.checked =
+            state === ControlsState.APP_GRID;
+
+        this._ignoreShowAppsButtonToggle = false;
     }
 
     animateFromOverview(callback) {
diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js
index 181bd16310..14e449f748 100644
--- a/js/ui/shellDBus.js
+++ b/js/ui/shellDBus.js
@@ -10,6 +10,7 @@ const Main = imports.ui.main;
 const Screenshot = imports.ui.screenshot;
 
 const { loadInterfaceXML } = imports.misc.fileUtils;
+const { ControlsState } = imports.ui.overviewControls;
 
 const GnomeShellIface = loadInterfaceXML('org.gnome.Shell');
 const ScreenSaverIface = loadInterfaceXML('org.gnome.ScreenSaver');
@@ -104,7 +105,7 @@ var GnomeShell = class {
     }
 
     ShowApplications() {
-        Main.overview.viewSelector.showApps();
+        Main.overview.show(ControlsState.APP_GRID);
     }
 
     GrabAcceleratorAsync(params, invocation) {
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index bbd412ff05..1abdf9cff2 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -369,7 +369,7 @@ var ViewSelector = GObject.registerClass({
             if (Main.overview.visible)
                 Main.overview.hide();
             else
-                this.showApps();
+                Main.overview.show(ControlsState.APP_GRID);
         });
         global.stage.add_action(gesture);
 
@@ -391,11 +391,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]