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

@ -92,10 +92,10 @@ var GnomeShell = new Lang.Class({
this._grabbedAccelerators = new Map();
this._grabbers = new Map();
global.display.connect('accelerator-activated', Lang.bind(this,
function(display, action, deviceid, timestamp) {
global.display.connect('accelerator-activated',
(display, action, deviceid, timestamp) => {
this._emitAcceleratorActivated(action, deviceid, timestamp);
}));
});
this._cachedOverviewVisible = false;
Main.overview.connect('showing',
@ -357,7 +357,7 @@ var GnomeShellExtensions = new Lang.Class({
// Only serialize the properties that we actually need.
const serializedProperties = ["type", "state", "path", "error", "hasPrefs"];
serializedProperties.forEach(function(prop) {
serializedProperties.forEach(prop => {
obj[prop] = extension[prop];
});
@ -439,12 +439,12 @@ var ScreenSaverDBus = new Lang.Class({
this.parent();
this._screenShield = screenShield;
screenShield.connect('active-changed', Lang.bind(this, function(shield) {
screenShield.connect('active-changed', shield => {
this._dbusImpl.emit_signal('ActiveChanged', GLib.Variant.new('(b)', [shield.active]));
}));
screenShield.connect('wake-up-screen', Lang.bind(this, function(shield) {
});
screenShield.connect('wake-up-screen', shield => {
this._dbusImpl.emit_signal('WakeUpScreen', null);
}));
});
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(ScreenSaverIface, this);
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/ScreenSaver');
@ -453,11 +453,11 @@ var ScreenSaverDBus = new Lang.Class({
},
LockAsync(parameters, invocation) {
let tmpId = this._screenShield.connect('lock-screen-shown', Lang.bind(this, function() {
let tmpId = this._screenShield.connect('lock-screen-shown', () => {
this._screenShield.disconnect(tmpId);
invocation.return_value(null);
}));
});
this._screenShield.lock(true);
},