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
This commit is contained in:
Florian Müllner 2019-06-29 17:37:59 +02:00 committed by Georges Basile Stavracas Neto
parent 6ed5bc2f6c
commit 8fcd6c7153
11 changed files with 30 additions and 50 deletions

View File

@ -295,8 +295,7 @@ var AuthPrompt = class {
time: DEFAULT_BUTTON_WELL_ANIMATION_TIME, time: DEFAULT_BUTTON_WELL_ANIMATION_TIME,
delay: DEFAULT_BUTTON_WELL_ANIMATION_DELAY, delay: DEFAULT_BUTTON_WELL_ANIMATION_DELAY,
transition: 'linear', transition: 'linear',
onCompleteScope: this, onComplete: () => {
onComplete() {
if (wasSpinner) { if (wasSpinner) {
if (this._spinner) if (this._spinner)
this._spinner.stop(); this._spinner.stop();

View File

@ -913,7 +913,7 @@ var LoginDialog = GObject.registerClass({
{ opacity: 255, { opacity: 255,
time: _FADE_ANIMATION_TIME, time: _FADE_ANIMATION_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onUpdate() { onUpdate: () => {
let children = Main.layoutManager.uiGroup.get_children(); let children = Main.layoutManager.uiGroup.get_children();
for (let i = 0; i < children.length; i++) { for (let i = 0; i < children.length; i++) {
@ -921,12 +921,10 @@ var LoginDialog = GObject.registerClass({
children[i].opacity = this.opacity; children[i].opacity = this.opacity;
} }
}, },
onUpdateScope: this, onComplete: () => {
onComplete() {
if (this._authPrompt.verificationStatus != AuthPrompt.AuthPromptStatus.NOT_VERIFYING) if (this._authPrompt.verificationStatus != AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
this._authPrompt.reset(); this._authPrompt.reset();
}, } });
onCompleteScope: this });
} }
_gotGreeterSessionProxy(proxy) { _gotGreeterSessionProxy(proxy) {
@ -943,7 +941,7 @@ var LoginDialog = GObject.registerClass({
{ opacity: 0, { opacity: 0,
time: _FADE_ANIMATION_TIME, time: _FADE_ANIMATION_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onUpdate() { onUpdate: () => {
let children = Main.layoutManager.uiGroup.get_children(); let children = Main.layoutManager.uiGroup.get_children();
for (let i = 0; i < children.length; i++) { for (let i = 0; i < children.length; i++) {
@ -951,11 +949,9 @@ var LoginDialog = GObject.registerClass({
children[i].opacity = this.opacity; children[i].opacity = this.opacity;
} }
}, },
onUpdateScope: this, onComplete: () => {
onComplete() {
this._greeter.call_start_session_when_ready_sync(serviceName, true, null); this._greeter.call_start_session_when_ready_sync(serviceName, true, null);
}, } });
onCompleteScope: this });
} }
_onSessionOpened(client, serviceName) { _onSessionOpened(client, serviceName) {

View File

@ -434,14 +434,13 @@ var _Draggable = class _Draggable {
scale_y: scale * origScale, scale_y: scale * origScale,
time: SCALE_ANIMATION_TIME, time: SCALE_ANIMATION_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onUpdate() { onUpdate: () => {
let currentScale = this._dragActor.scale_x / origScale; let currentScale = this._dragActor.scale_x / origScale;
this._dragOffsetX = currentScale * origDragOffsetX; this._dragOffsetX = currentScale * origDragOffsetX;
this._dragOffsetY = currentScale * origDragOffsetY; this._dragOffsetY = currentScale * origDragOffsetY;
this._dragActor.set_position(this._dragX + this._dragOffsetX, this._dragActor.set_position(this._dragX + this._dragOffsetX,
this._dragY + this._dragOffsetY); this._dragY + this._dragOffsetY);
}, } });
onUpdateScope: this });
} }
} }
} }

View File

@ -469,8 +469,7 @@ var Message = class Message {
{ scale_y: 0, { scale_y: 0,
time: MessageTray.ANIMATION_TIME, time: MessageTray.ANIMATION_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onCompleteScope: this, onComplete: () => {
onComplete() {
this._actionBin.hide(); this._actionBin.hide();
this.expanded = false; this.expanded = false;
} }); } });

View File

@ -283,10 +283,9 @@ var AppMenuButton = GObject.registerClass({
{ opacity: 0, { opacity: 0,
time: Overview.ANIMATION_TIME, time: Overview.ANIMATION_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete() { onComplete: () => {
this.hide(); this.hide();
}, } });
onCompleteScope: this });
} }
_onStyleChanged(actor) { _onStyleChanged(actor) {
@ -328,8 +327,7 @@ var AppMenuButton = GObject.registerClass({
{ opacity: 0, { opacity: 0,
time: SPINNER_ANIMATION_TIME, time: SPINNER_ANIMATION_TIME,
transition: "easeOutQuad", transition: "easeOutQuad",
onCompleteScope: this, onComplete: () => {
onComplete() {
this._spinner.stop(); this._spinner.stop();
this._spinner.actor.opacity = 255; this._spinner.actor.opacity = 255;
this._spinner.actor.hide(); this._spinner.actor.hide();

View File

@ -66,10 +66,8 @@ class PieTimer extends St.DrawingArea {
{ opacity: 255, { opacity: 255,
time: duration / 1000, time: duration / 1000,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onUpdateScope: this, onUpdate: () => this.queue_repaint(),
onUpdate() { this.queue_repaint(); }, onComplete: () => this.stop()
onCompleteScope: this,
onComplete() { this.stop(); }
}); });
} }

View File

@ -1015,12 +1015,10 @@ var PopupSubMenu = class extends PopupMenuBase {
{ _arrowRotation: targetAngle, { _arrowRotation: targetAngle,
height: naturalHeight, height: naturalHeight,
time: 0.25, time: 0.25,
onUpdateScope: this, onUpdate: () => {
onUpdate() {
this._arrow.rotation_angle_z = this.actor._arrowRotation; this._arrow.rotation_angle_z = this.actor._arrowRotation;
}, },
onCompleteScope: this, onComplete: () => {
onComplete() {
this.actor.set_height(-1); this.actor.set_height(-1);
} }
}); });
@ -1048,12 +1046,10 @@ var PopupSubMenu = class extends PopupMenuBase {
{ _arrowRotation: 0, { _arrowRotation: 0,
height: 0, height: 0,
time: 0.25, time: 0.25,
onUpdateScope: this, onUpdate: () => {
onUpdate() {
this._arrow.rotation_angle_z = this.actor._arrowRotation; this._arrow.rotation_angle_z = this.actor._arrowRotation;
}, },
onCompleteScope: this, onComplete: () => {
onComplete() {
this.actor.hide(); this.actor.hide();
this.actor.set_height(-1); this.actor.set_height(-1);
}, },

View File

@ -56,8 +56,8 @@ var Ripples = class Ripples {
delay: delay, delay: delay,
time: time, time: time,
transition: 'linear', transition: 'linear',
onUpdate() { ripple.opacity = 255 * Math.sqrt(ripple._opacity); }, onUpdate: () => ripple.opacity = 255 * Math.sqrt(ripple._opacity),
onComplete() { ripple.visible = false; } }); onComplete: () => ripple.visible = false });
} }
addTo(stage) { addTo(stage) {

View File

@ -255,11 +255,10 @@ var NotificationsBox = class {
{ height: natHeight, { height: natHeight,
transition: 'easeOutQuad', transition: 'easeOutQuad',
time: 0.25, time: 0.25,
onComplete() { onComplete: () => {
this._scrollView.vscrollbar_policy = St.PolicyType.AUTOMATIC; this._scrollView.vscrollbar_policy = St.PolicyType.AUTOMATIC;
widget.set_height(-1); widget.set_height(-1);
}, }
onCompleteScope: this
}); });
this._updateVisibility(); this._updateVisibility();
@ -791,11 +790,10 @@ var ScreenShield = class {
{ y: 0, { y: 0,
time: time, time: time,
transition: 'easeInQuad', transition: 'easeInQuad',
onComplete() { onComplete: () => {
this._lockScreenGroup.fixed_position_set = false; this._lockScreenGroup.fixed_position_set = false;
this._lockScreenState = MessageTray.State.SHOWN; this._lockScreenState = MessageTray.State.SHOWN;
}, }
onCompleteScope: this,
}); });
this._maybeCancelDialog(); this._maybeCancelDialog();
@ -1008,11 +1006,10 @@ var ScreenShield = class {
{ y: 0, { y: 0,
time: MANUAL_FADE_TIME, time: MANUAL_FADE_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete() { onComplete: () => {
this._lockScreenShown({ fadeToBlack: fadeToBlack, this._lockScreenShown({ fadeToBlack: fadeToBlack,
animateFade: true }); animateFade: true });
}, }
onCompleteScope: this
}); });
} else { } else {
this._lockScreenGroup.fixed_position_set = false; this._lockScreenGroup.fixed_position_set = false;

View File

@ -161,8 +161,7 @@ class WorkspaceSwitcherPopup extends St.Widget {
Tweener.addTween(this._container, { opacity: 0.0, Tweener.addTween(this._container, { opacity: 0.0,
time: ANIMATION_TIME, time: ANIMATION_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete() { this.destroy(); }, onComplete: () => this.destroy()
onCompleteScope: this
}); });
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
} }

View File

@ -1318,11 +1318,10 @@ class ThumbnailsBox extends St.Widget {
{ indicatorY: thumbnail.actor.allocation.y1, { indicatorY: thumbnail.actor.allocation.y1,
time: WorkspacesView.WORKSPACE_SWITCH_TIME, time: WorkspacesView.WORKSPACE_SWITCH_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete() { onComplete: () => {
this._animatingIndicator = false; this._animatingIndicator = false;
this._queueUpdateStates(); this._queueUpdateStates();
}, }
onCompleteScope: this
}); });
} }
}); });