[gnome-shell/gbsneto/40-stuff: 31/68] viewSelector: Use state adjustment for apps page
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gbsneto/40-stuff: 31/68] viewSelector: Use state adjustment for apps page
- Date: Wed, 20 Jan 2021 22:41:07 +0000 (UTC)
commit 9fd336233cb9c04b8f6c5bb7e00ac755aba199d2
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Dec 30 17:45:09 2020 -0300
viewSelector: Use state adjustment for apps page
Currently, AppsPageContainer reacts to showAppsButton and
transitions between app grid and window picking states on
its own. In the future, we want full control over this.
ControlsManager already has a state adjustment that represents
all possible overview states. Progragate this adjustment up
to AppsPageContainer, and use it to drive the transition.
This requires moving the callback to the showAppsButton to
ControlsManager, since now it control the state adjustment
itself, not AppsPageContainer's adjustment.
js/ui/overviewControls.js | 19 ++++++++++++++++++-
js/ui/viewSelector.js | 22 ++++++----------------
2 files changed, 24 insertions(+), 17 deletions(-)
---
diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js
index 5a606ba977..58442e9b5b 100644
--- a/js/ui/overviewControls.js
+++ b/js/ui/overviewControls.js
@@ -165,7 +165,9 @@ class ControlsManager extends St.Widget {
this._updateAdjustment.bind(this));
this.viewSelector = new ViewSelector.ViewSelector(this._searchEntry,
- this._workspaceAdjustment, this.dash.showAppsButton);
+ this._workspaceAdjustment,
+ this.dash.showAppsButton,
+ this._adjustment);
this.add_child(searchEntryBin);
this.add_child(this._dashFader);
@@ -174,9 +176,24 @@ class ControlsManager extends St.Widget {
this.layout_manager = new ControlsManagerLayout(searchEntryBin,
this.viewSelector, this._dashFader, this._adjustment);
+ this.dash.showAppsButton.connect('notify::checked',
+ this._onShowAppsButtonToggled.bind(this));
+
this.connect('destroy', this._onDestroy.bind(this));
}
+ _onShowAppsButtonToggled() {
+ const checked = this.dash.showAppsButton.checked;
+
+ const value = checked
+ ? ControlsState.APP_GRID : ControlsState.WINDOW_PICKER;
+ this._adjustment.remove_transition('value');
+ this._adjustment.ease(value, {
+ duration: SIDE_CONTROLS_ANIMATION_TIME,
+ mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+ });
+ }
+
_onDestroy() {
global.workspace_manager.disconnect(this._nWorkspacesNotifyId);
}
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index cb293a326b..a5a896a407 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -122,7 +122,7 @@ var ShowOverviewAction = GObject.registerClass({
var AppsPageContainer = GObject.registerClass(
class AppsPageContainer extends St.Widget {
- _init(workspacesDisplay, appDisplay, showAppsButton) {
+ _init(workspacesDisplay, appDisplay, overviewAdjustment) {
super._init();
// 0 for window picker, 1 for app grid
@@ -137,9 +137,9 @@ class AppsPageContainer extends St.Widget {
this.queue_relayout();
});
- this._showAppsButton = showAppsButton;
- showAppsButton.connect('notify::checked',
- this._onShowAppsButtonToggled.bind(this));
+ overviewAdjustment.connect('notify::value', () => {
+ this._adjustment.value = Math.max(overviewAdjustment.value - 1, 0);
+ });
this._appDisplay = appDisplay;
this.add_child(appDisplay);
@@ -154,16 +154,6 @@ class AppsPageContainer extends St.Widget {
this._update();
}
- _onShowAppsButtonToggled() {
- const checked = this._showAppsButton.checked;
-
- const value = checked ? 1 : 0;
- this._adjustment.ease(value, {
- duration: OverviewControls.SIDE_CONTROLS_ANIMATION_TIME,
- mode: Clutter.AnimationMode.EASE_OUT_QUAD,
- });
- }
-
_update() {
const progress = this._adjustment.value;
@@ -207,7 +197,7 @@ var ViewSelector = GObject.registerClass({
'page-empty': {},
},
}, class ViewSelector extends Shell.Stack {
- _init(searchEntry, workspaceAdjustment, showAppsButton) {
+ _init(searchEntry, workspaceAdjustment, showAppsButton, overviewAdjustment) {
super._init({
name: 'viewSelector',
x_expand: true,
@@ -256,7 +246,7 @@ var ViewSelector = GObject.registerClass({
this.appDisplay = new AppDisplay.AppDisplay();
const appsContainer = new AppsPageContainer(
- this._workspacesDisplay, this.appDisplay, showAppsButton);
+ this._workspacesDisplay, this.appDisplay, overviewAdjustment);
this._appsPage =
this._addPage(appsContainer, _('Applications'), 'view-app-grid-symbolic');
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]