266 lines
12 KiB
Diff
266 lines
12 KiB
Diff
From e2f0647091b2475f78c0a52c0acef5f1be4d52d9 Mon Sep 17 00:00:00 2001
|
|
From: rpm-build <rpm-build>
|
|
Date: Tue, 30 Mar 2021 14:42:11 +0800
|
|
Subject: [PATCH] cleanup: Use arrow functions for tweener callbacks
|
|
|
|
While it is legal to use method syntax for the function properties
|
|
here, arrow notation is less unexpected and allows us to drop the
|
|
separate scope properties.
|
|
|
|
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/608
|
|
|
|
---
|
|
js/gdm/authPrompt.js | 3 +--
|
|
js/gdm/loginDialog.js | 16 ++++++----------
|
|
js/ui/dnd.js | 5 ++---
|
|
js/ui/messageList.js | 3 +--
|
|
js/ui/panel.js | 8 +++-----
|
|
js/ui/popupMenu.js | 12 ++++--------
|
|
js/ui/screenShield.js | 15 ++++++---------
|
|
js/ui/workspaceSwitcherPopup.js | 3 +--
|
|
js/ui/workspaceThumbnail.js | 5 ++---
|
|
9 files changed, 26 insertions(+), 44 deletions(-)
|
|
|
|
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
|
|
index a0a4a21..a6a0374 100644
|
|
--- a/js/gdm/authPrompt.js
|
|
+++ b/js/gdm/authPrompt.js
|
|
@@ -302,8 +302,7 @@ var AuthPrompt = new Lang.Class({
|
|
time: DEFAULT_BUTTON_WELL_ANIMATION_TIME,
|
|
delay: DEFAULT_BUTTON_WELL_ANIMATION_DELAY,
|
|
transition: 'linear',
|
|
- onCompleteScope: this,
|
|
- onComplete() {
|
|
+ onComplete: () => {
|
|
if (wasSpinner) {
|
|
if (this._spinner)
|
|
this._spinner.stop();
|
|
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
|
|
index bf79677..0e0001f 100644
|
|
--- a/js/gdm/loginDialog.js
|
|
+++ b/js/gdm/loginDialog.js
|
|
@@ -926,7 +926,7 @@ var LoginDialog = new Lang.Class({
|
|
{ opacity: 255,
|
|
time: _FADE_ANIMATION_TIME,
|
|
transition: 'easeOutQuad',
|
|
- onUpdate() {
|
|
+ onUpdate: () => {
|
|
let children = Main.layoutManager.uiGroup.get_children();
|
|
|
|
for (let i = 0; i < children.length; i++) {
|
|
@@ -934,12 +934,10 @@ var LoginDialog = new Lang.Class({
|
|
children[i].opacity = this.actor.opacity;
|
|
}
|
|
},
|
|
- onUpdateScope: this,
|
|
- onComplete() {
|
|
+ onComplete: () => {
|
|
if (this._authPrompt.verificationStatus != AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
|
|
this._authPrompt.reset();
|
|
- },
|
|
- onCompleteScope: this });
|
|
+ } });
|
|
},
|
|
|
|
_gotGreeterSessionProxy(proxy) {
|
|
@@ -956,7 +954,7 @@ var LoginDialog = new Lang.Class({
|
|
{ opacity: 0,
|
|
time: _FADE_ANIMATION_TIME,
|
|
transition: 'easeOutQuad',
|
|
- onUpdate() {
|
|
+ onUpdate: () => {
|
|
let children = Main.layoutManager.uiGroup.get_children();
|
|
|
|
for (let i = 0; i < children.length; i++) {
|
|
@@ -964,11 +962,9 @@ var LoginDialog = new Lang.Class({
|
|
children[i].opacity = this.actor.opacity;
|
|
}
|
|
},
|
|
- onUpdateScope: this,
|
|
- onComplete() {
|
|
+ onComplete: () => {
|
|
this._greeter.call_start_session_when_ready_sync(serviceName, true, null);
|
|
- },
|
|
- onCompleteScope: this });
|
|
+ } });
|
|
},
|
|
|
|
_onSessionOpened(client, serviceName) {
|
|
diff --git a/js/ui/dnd.js b/js/ui/dnd.js
|
|
index 8483e89..83778e0 100644
|
|
--- a/js/ui/dnd.js
|
|
+++ b/js/ui/dnd.js
|
|
@@ -385,14 +385,13 @@ var _Draggable = new Lang.Class({
|
|
scale_y: scale * origScale,
|
|
time: SCALE_ANIMATION_TIME,
|
|
transition: 'easeOutQuad',
|
|
- onUpdate() {
|
|
+ onUpdate: () => {
|
|
let currentScale = this._dragActor.scale_x / origScale;
|
|
this._dragOffsetX = currentScale * origDragOffsetX;
|
|
this._dragOffsetY = currentScale * origDragOffsetY;
|
|
this._dragActor.set_position(this._dragX + this._dragOffsetX,
|
|
this._dragY + this._dragOffsetY);
|
|
- },
|
|
- onUpdateScope: this });
|
|
+ } });
|
|
}
|
|
}
|
|
},
|
|
diff --git a/js/ui/messageList.js b/js/ui/messageList.js
|
|
index 547135a..91670ba 100644
|
|
--- a/js/ui/messageList.js
|
|
+++ b/js/ui/messageList.js
|
|
@@ -483,8 +483,7 @@ var Message = new Lang.Class({
|
|
{ scale_y: 0,
|
|
time: MessageTray.ANIMATION_TIME,
|
|
transition: 'easeOutQuad',
|
|
- onCompleteScope: this,
|
|
- onComplete() {
|
|
+ onComplete: () => {
|
|
this._actionBin.hide();
|
|
this.expanded = false;
|
|
}});
|
|
diff --git a/js/ui/panel.js b/js/ui/panel.js
|
|
index 3726b84..318ca52 100644
|
|
--- a/js/ui/panel.js
|
|
+++ b/js/ui/panel.js
|
|
@@ -174,10 +174,9 @@ var AppMenuButton = new Lang.Class({
|
|
{ opacity: 0,
|
|
time: Overview.ANIMATION_TIME,
|
|
transition: 'easeOutQuad',
|
|
- onComplete() {
|
|
+ onComplete: () => {
|
|
this.actor.hide();
|
|
- },
|
|
- onCompleteScope: this });
|
|
+ } });
|
|
},
|
|
|
|
_onStyleChanged(actor) {
|
|
@@ -219,8 +218,7 @@ var AppMenuButton = new Lang.Class({
|
|
{ opacity: 0,
|
|
time: SPINNER_ANIMATION_TIME,
|
|
transition: "easeOutQuad",
|
|
- onCompleteScope: this,
|
|
- onComplete() {
|
|
+ onComplete: () => {
|
|
this._spinner.stop();
|
|
this._spinner.actor.opacity = 255;
|
|
this._spinner.actor.hide();
|
|
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
|
|
index f449d6e..3d92a1a 100644
|
|
--- a/js/ui/popupMenu.js
|
|
+++ b/js/ui/popupMenu.js
|
|
@@ -1004,12 +1004,10 @@ var PopupSubMenu = new Lang.Class({
|
|
{ _arrowRotation: targetAngle,
|
|
height: naturalHeight,
|
|
time: 0.25,
|
|
- onUpdateScope: this,
|
|
- onUpdate() {
|
|
+ onUpdate: () => {
|
|
this._arrow.rotation_angle_z = this.actor._arrowRotation;
|
|
},
|
|
- onCompleteScope: this,
|
|
- onComplete() {
|
|
+ onComplete: () => {
|
|
this.actor.set_height(-1);
|
|
}
|
|
});
|
|
@@ -1037,12 +1035,10 @@ var PopupSubMenu = new Lang.Class({
|
|
{ _arrowRotation: 0,
|
|
height: 0,
|
|
time: 0.25,
|
|
- onUpdateScope: this,
|
|
- onUpdate() {
|
|
+ onUpdate: () => {
|
|
this._arrow.rotation_angle_z = this.actor._arrowRotation;
|
|
},
|
|
- onCompleteScope: this,
|
|
- onComplete() {
|
|
+ onComplete: () => {
|
|
this.actor.hide();
|
|
this.actor.set_height(-1);
|
|
},
|
|
diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
|
|
index dee290b..72d1317 100644
|
|
--- a/js/ui/screenShield.js
|
|
+++ b/js/ui/screenShield.js
|
|
@@ -265,11 +265,10 @@ var NotificationsBox = new Lang.Class({
|
|
{ height: natHeight,
|
|
transition: 'easeOutQuad',
|
|
time: 0.25,
|
|
- onComplete() {
|
|
+ onComplete: () => {
|
|
this._scrollView.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
|
|
widget.set_height(-1);
|
|
- },
|
|
- onCompleteScope: this
|
|
+ }
|
|
});
|
|
|
|
this._updateVisibility();
|
|
@@ -795,11 +794,10 @@ var ScreenShield = new Lang.Class({
|
|
{ y: 0,
|
|
time: time,
|
|
transition: 'easeInQuad',
|
|
- onComplete() {
|
|
+ onComplete: () => {
|
|
this._lockScreenGroup.fixed_position_set = false;
|
|
this._lockScreenState = MessageTray.State.SHOWN;
|
|
- },
|
|
- onCompleteScope: this,
|
|
+ }
|
|
});
|
|
|
|
this._maybeCancelDialog();
|
|
@@ -1020,11 +1018,10 @@ var ScreenShield = new Lang.Class({
|
|
{ y: 0,
|
|
time: MANUAL_FADE_TIME,
|
|
transition: 'easeOutQuad',
|
|
- onComplete() {
|
|
+ onComplete: () => {
|
|
this._lockScreenShown({ fadeToBlack: fadeToBlack,
|
|
animateFade: true });
|
|
- },
|
|
- onCompleteScope: this
|
|
+ }
|
|
});
|
|
} else {
|
|
this._lockScreenGroup.fixed_position_set = false;
|
|
diff --git a/js/ui/workspaceSwitcherPopup.js b/js/ui/workspaceSwitcherPopup.js
|
|
index 351a907..49caabc 100644
|
|
--- a/js/ui/workspaceSwitcherPopup.js
|
|
+++ b/js/ui/workspaceSwitcherPopup.js
|
|
@@ -159,8 +159,7 @@ var WorkspaceSwitcherPopup = new Lang.Class({
|
|
Tweener.addTween(this._container, { opacity: 0.0,
|
|
time: ANIMATION_TIME,
|
|
transition: 'easeOutQuad',
|
|
- onComplete() { this.destroy(); },
|
|
- onCompleteScope: this
|
|
+ onComplete: () => this.destroy()
|
|
});
|
|
return GLib.SOURCE_REMOVE;
|
|
},
|
|
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
|
|
index 76a7416..dc1a749 100644
|
|
--- a/js/ui/workspaceThumbnail.js
|
|
+++ b/js/ui/workspaceThumbnail.js
|
|
@@ -1347,11 +1347,10 @@ var ThumbnailsBox = new Lang.Class({
|
|
{ indicatorY: thumbnail.actor.allocation.y1,
|
|
time: WorkspacesView.WORKSPACE_SWITCH_TIME,
|
|
transition: 'easeOutQuad',
|
|
- onComplete() {
|
|
+ onComplete: () => {
|
|
this._animatingIndicator = false;
|
|
this._queueUpdateStates();
|
|
- },
|
|
- onCompleteScope: this
|
|
+ }
|
|
});
|
|
}
|
|
});
|
|
--
|
|
2.23.0
|
|
|