viewSelector: Move 'toggle-applications-view' to ControlsManager
Move the shortcut handling into ControlsManager, and reimplement the callback in such a way that it behaves correctly with the current overview machinery. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1624>
This commit is contained in:
parent
b32f414919
commit
80d258b20f
@ -1,11 +1,13 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
/* exported ControlsManager */
|
/* exported ControlsManager */
|
||||||
|
|
||||||
const { Clutter, GObject, St } = imports.gi;
|
const { Clutter, Gio, GObject, Meta, Shell, St } = imports.gi;
|
||||||
|
|
||||||
const Dash = imports.ui.dash;
|
const Dash = imports.ui.dash;
|
||||||
|
const Main = imports.ui.main;
|
||||||
const Overview = imports.ui.overview;
|
const Overview = imports.ui.overview;
|
||||||
const ViewSelector = imports.ui.viewSelector;
|
const ViewSelector = imports.ui.viewSelector;
|
||||||
|
const WindowManager = imports.ui.windowManager;
|
||||||
|
|
||||||
var SIDE_CONTROLS_ANIMATION_TIME = Overview.ANIMATION_TIME;
|
var SIDE_CONTROLS_ANIMATION_TIME = Overview.ANIMATION_TIME;
|
||||||
|
|
||||||
@ -142,6 +144,13 @@ class ControlsManager extends St.Widget {
|
|||||||
this.dash.showAppsButton.connect('notify::checked',
|
this.dash.showAppsButton.connect('notify::checked',
|
||||||
this._onShowAppsButtonToggled.bind(this));
|
this._onShowAppsButtonToggled.bind(this));
|
||||||
|
|
||||||
|
Main.wm.addKeybinding(
|
||||||
|
'toggle-application-view',
|
||||||
|
new Gio.Settings({ schema_id: WindowManager.SHELL_KEYBINDINGS_SCHEMA }),
|
||||||
|
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
||||||
|
Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
|
||||||
|
this._toggleAppsPage.bind(this));
|
||||||
|
|
||||||
this.connect('destroy', this._onDestroy.bind(this));
|
this.connect('destroy', this._onDestroy.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,6 +169,15 @@ class ControlsManager extends St.Widget {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_toggleAppsPage() {
|
||||||
|
if (Main.overview.visible) {
|
||||||
|
const checked = this.dash.showAppsButton.checked;
|
||||||
|
this.dash.showAppsButton.checked = !checked;
|
||||||
|
} else {
|
||||||
|
Main.overview.show(ControlsState.APP_GRID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_onDestroy() {
|
_onDestroy() {
|
||||||
global.workspace_manager.disconnect(this._nWorkspacesNotifyId);
|
global.workspace_manager.disconnect(this._nWorkspacesNotifyId);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
/* exported ViewSelector */
|
/* exported ViewSelector */
|
||||||
|
|
||||||
const { Clutter, Gio, GObject, Meta, Shell, St } = imports.gi;
|
const { Clutter, GObject, Meta, Shell, St } = imports.gi;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
|
|
||||||
const AppDisplay = imports.ui.appDisplay;
|
const AppDisplay = imports.ui.appDisplay;
|
||||||
@ -351,13 +351,6 @@ var ViewSelector = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Main.wm.addKeybinding('toggle-application-view',
|
|
||||||
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
|
||||||
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
|
||||||
Shell.ActionMode.NORMAL |
|
|
||||||
Shell.ActionMode.OVERVIEW,
|
|
||||||
this._toggleAppsPage.bind(this));
|
|
||||||
|
|
||||||
let side;
|
let side;
|
||||||
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
||||||
side = St.Side.RIGHT;
|
side = St.Side.RIGHT;
|
||||||
@ -386,11 +379,6 @@ var ViewSelector = GObject.registerClass({
|
|||||||
Main.overview.show();
|
Main.overview.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
_toggleAppsPage() {
|
|
||||||
this._showAppsButton.checked = !this._showAppsButton.checked;
|
|
||||||
Main.overview.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
prepareToEnterOverview() {
|
prepareToEnterOverview() {
|
||||||
this.show();
|
this.show();
|
||||||
this.reset();
|
this.reset();
|
||||||
|
Loading…
Reference in New Issue
Block a user