cleanup: Use arrow notation for anonymous functions

Arrow notation is great, use it consistently through-out the code base
to bind `this` to anonymous functions, replacing the more overbose
Lang.bind(this, function() {}).

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
This commit is contained in:
Florian Müllner
2017-10-31 01:38:18 +01:00
committed by Florian Müllner
parent 76f09b1e49
commit 213e38c2ef
105 changed files with 2165 additions and 2408 deletions

View File

@ -40,17 +40,17 @@ var WindowAttentionHandler = new Lang.Class({
let [title, banner] = this._getTitleAndBanner(app, window);
let notification = new MessageTray.Notification(source, title, banner);
notification.connect('activated', function() {
notification.connect('activated', () => {
source.open();
});
notification.setForFeedback(true);
source.notify(notification);
source.signalIDs.push(window.connect('notify::title', Lang.bind(this, function() {
source.signalIDs.push(window.connect('notify::title', () => {
let [title, banner] = this._getTitleAndBanner(app, window);
notification.update(title, banner);
})));
}));
}
});
@ -65,9 +65,12 @@ var Source = new Lang.Class({
this.parent(app.get_name());
this.signalIDs = [];
this.signalIDs.push(this._window.connect('notify::demands-attention', Lang.bind(this, function() { this.destroy(); })));
this.signalIDs.push(this._window.connect('focus', Lang.bind(this, function() { this.destroy(); })));
this.signalIDs.push(this._window.connect('unmanaged', Lang.bind(this, function() { this.destroy(); })));
this.signalIDs.push(this._window.connect('notify::demands-attention',
() => { this.destroy(); }));
this.signalIDs.push(this._window.connect('focus',
() => { this.destroy(); }));
this.signalIDs.push(this._window.connect('unmanaged',
() => { this.destroy(); }));
this.connect('destroy', Lang.bind(this, this._onDestroy));
},