From b32f4149195ca864d6dfb70bcf2b8e615c620f85 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Sat, 2 Jan 2021 17:28:44 -0300 Subject: [PATCH] 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: --- 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 0020dcd4f..6f838db6b 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 2f584d209..f836f822e 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 181bd1631..14e449f74 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 bbd412ff0..1abdf9cff 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();