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>
This commit is contained in:
Georges Basile Stavracas Neto 2021-01-02 17:28:44 -03:00 committed by Marge Bot
parent 8089d7cbf7
commit b32f414919
4 changed files with 14 additions and 7 deletions

View File

@ -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'));

View File

@ -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) {

View File

@ -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) {

View File

@ -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();