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

@ -127,9 +127,7 @@ var Application = new Lang.Class({
errortext += 'Stack trace:\n'; errortext += 'Stack trace:\n';
// Indent stack trace. // Indent stack trace.
errortext += exc.stack.split('\n').map(function(line) { errortext += exc.stack.split('\n').map(line => ' ' + line).join('\n');
return ' ' + line;
}).join('\n');
let scroll = new Gtk.ScrolledWindow({ vexpand: true }); let scroll = new Gtk.ScrolledWindow({ vexpand: true });
let buffer = new Gtk.TextBuffer({ text: errortext }); let buffer = new Gtk.TextBuffer({ text: errortext });
@ -171,10 +169,10 @@ var Application = new Lang.Class({
this._shellProxy = new GnomeShellProxy(Gio.DBus.session, 'org.gnome.Shell', '/org/gnome/Shell'); this._shellProxy = new GnomeShellProxy(Gio.DBus.session, 'org.gnome.Shell', '/org/gnome/Shell');
this._shellProxy.connectSignal('ExtensionStatusChanged', Lang.bind(this, function(proxy, senderName, [uuid, state, error]) { this._shellProxy.connectSignal('ExtensionStatusChanged', (proxy, senderName, [uuid, state, error]) => {
if (ExtensionUtils.extensions[uuid] !== undefined) if (ExtensionUtils.extensions[uuid] !== undefined)
this._scanExtensions(); this._scanExtensions();
})); });
this._window.show_all(); this._window.show_all();
}, },
@ -204,10 +202,9 @@ var Application = new Lang.Class({
let row = new ExtensionRow(extension.uuid); let row = new ExtensionRow(extension.uuid);
row.prefsButton.visible = this._extensionAvailable(row.uuid); row.prefsButton.visible = this._extensionAvailable(row.uuid);
row.prefsButton.connect('clicked', Lang.bind(this, row.prefsButton.connect('clicked', () => {
function() { this._selectExtension(row.uuid);
this._selectExtension(row.uuid); });
}));
row.show_all(); row.show_all();
this._extensionSelector.add(row); this._extensionSelector.add(row);
@ -275,18 +272,17 @@ var ExtensionRow = new Lang.Class({
this.uuid = uuid; this.uuid = uuid;
this._settings = new Gio.Settings({ schema_id: 'org.gnome.shell' }); this._settings = new Gio.Settings({ schema_id: 'org.gnome.shell' });
this._settings.connect('changed::enabled-extensions', Lang.bind(this, this._settings.connect('changed::enabled-extensions', () => {
function() { this._switch.state = this._isEnabled();
this._switch.state = this._isEnabled(); });
}));
this._settings.connect('changed::disable-extension-version-validation', this._settings.connect('changed::disable-extension-version-validation',
Lang.bind(this, function() { () => {
this._switch.sensitive = this._canEnable(); this._switch.sensitive = this._canEnable();
})); });
this._settings.connect('changed::disable-user-extensions', this._settings.connect('changed::disable-user-extensions',
Lang.bind(this, function() { () => {
this._switch.sensitive = this._canEnable(); this._switch.sensitive = this._canEnable();
})); });
this._buildUI(); this._buildUI();
}, },
@ -328,14 +324,13 @@ var ExtensionRow = new Lang.Class({
this._switch = new Gtk.Switch({ valign: Gtk.Align.CENTER, this._switch = new Gtk.Switch({ valign: Gtk.Align.CENTER,
sensitive: this._canEnable(), sensitive: this._canEnable(),
state: this._isEnabled() }); state: this._isEnabled() });
this._switch.connect('notify::active', Lang.bind(this, this._switch.connect('notify::active', () => {
function() { if (this._switch.active)
if (this._switch.active) this._enable();
this._enable(); else
else this._disable();
this._disable(); });
})); this._switch.connect('state-set', () => true);
this._switch.connect('state-set', function() { return true; });
hbox.add(this._switch); hbox.add(this._switch);
}, },

View File

@ -64,26 +64,24 @@ var AuthPrompt = new Lang.Class({
this._userVerifier.connect('ovirt-user-authenticated', Lang.bind(this, this._onOVirtUserAuthenticated)); this._userVerifier.connect('ovirt-user-authenticated', Lang.bind(this, this._onOVirtUserAuthenticated));
this.smartcardDetected = this._userVerifier.smartcardDetected; this.smartcardDetected = this._userVerifier.smartcardDetected;
this.connect('next', Lang.bind(this, function() { this.connect('next', () => {
this.updateSensitivity(false); this.updateSensitivity(false);
this.startSpinning(); this.startSpinning();
if (this._queryingService) { if (this._queryingService) {
this._userVerifier.answerQuery(this._queryingService, this._entry.text); this._userVerifier.answerQuery(this._queryingService, this._entry.text);
} else { } else {
this._preemptiveAnswer = this._entry.text; this._preemptiveAnswer = this._entry.text;
} }
})); });
this.actor = new St.BoxLayout({ style_class: 'login-dialog-prompt-layout', this.actor = new St.BoxLayout({ style_class: 'login-dialog-prompt-layout',
vertical: true }); vertical: true });
this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
this.actor.connect('key-press-event', this.actor.connect('key-press-event', (actor, event) => {
Lang.bind(this, function(actor, event) { if (event.get_key_symbol() == Clutter.KEY_Escape)
if (event.get_key_symbol() == Clutter.KEY_Escape) { this.cancel();
this.cancel(); return Clutter.EVENT_PROPAGATE;
} });
return Clutter.EVENT_PROPAGATE;
}));
this._userWell = new St.Bin({ x_fill: true, this._userWell = new St.Bin({ x_fill: true,
x_align: St.Align.START }); x_align: St.Align.START });
@ -147,10 +145,7 @@ var AuthPrompt = new Lang.Class({
reactive: true, reactive: true,
can_focus: true, can_focus: true,
label: _("Cancel") }); label: _("Cancel") });
this.cancelButton.connect('clicked', this.cancelButton.connect('clicked', () => { this.cancel(); });
Lang.bind(this, function() {
this.cancel();
}));
this._buttonBox.add(this.cancelButton, this._buttonBox.add(this.cancelButton,
{ expand: false, { expand: false,
x_fill: false, x_fill: false,
@ -169,10 +164,7 @@ var AuthPrompt = new Lang.Class({
reactive: true, reactive: true,
can_focus: true, can_focus: true,
label: _("Next") }); label: _("Next") });
this.nextButton.connect('clicked', this.nextButton.connect('clicked', () => { this.emit('next'); });
Lang.bind(this, function() {
this.emit('next');
}));
this.nextButton.add_style_pseudo_class('default'); this.nextButton.add_style_pseudo_class('default');
this._buttonBox.add(this.nextButton, this._buttonBox.add(this.nextButton,
{ expand: false, { expand: false,
@ -183,17 +175,16 @@ var AuthPrompt = new Lang.Class({
this._updateNextButtonSensitivity(this._entry.text.length > 0); this._updateNextButtonSensitivity(this._entry.text.length > 0);
this._entry.clutter_text.connect('text-changed', this._entry.clutter_text.connect('text-changed', () => {
Lang.bind(this, function() { if (!this._userVerifier.hasPendingMessages)
if (!this._userVerifier.hasPendingMessages) this._fadeOutMessage();
this._fadeOutMessage();
this._updateNextButtonSensitivity(this._entry.text.length > 0 || this.verificationStatus == AuthPromptStatus.VERIFYING); this._updateNextButtonSensitivity(this._entry.text.length > 0 || this.verificationStatus == AuthPromptStatus.VERIFYING);
})); });
this._entry.clutter_text.connect('activate', Lang.bind(this, function() { this._entry.clutter_text.connect('activate', () => {
if (this.nextButton.reactive) if (this.nextButton.reactive)
this.emit('next'); this.emit('next');
})); });
}, },
_onAskQuestion(verifier, serviceName, question, passwordChar) { _onAskQuestion(verifier, serviceName, question, passwordChar) {
@ -509,12 +500,11 @@ var AuthPrompt = new Lang.Class({
return; return;
} }
let signalId = this._userVerifier.connect('no-more-messages', let signalId = this._userVerifier.connect('no-more-messages', () => {
Lang.bind(this, function() { this._userVerifier.disconnect(signalId);
this._userVerifier.disconnect(signalId); this._userVerifier.clear();
this._userVerifier.clear(); onComplete();
onComplete(); });
}));
}, },
cancel() { cancel() {

View File

@ -73,9 +73,7 @@ var Hold = new Lang.Class({
Extends: Task, Extends: Task,
_init() { _init() {
this.parent(this, function () { this.parent(this, () => this);
return this;
});
this._acquisitions = 1; this._acquisitions = 1;
}, },
@ -91,10 +89,10 @@ var Hold = new Lang.Class({
return; return;
this.acquire(); this.acquire();
let signalId = hold.connect('release', Lang.bind(this, function() { let signalId = hold.connect('release', () => {
hold.disconnect(signalId); hold.disconnect(signalId);
this.release(); this.release();
})); });
}, },
release() { release() {
@ -214,11 +212,10 @@ var ConsecutiveBatch = new Lang.Class({
if (hold && hold.isAcquired()) { if (hold && hold.isAcquired()) {
// This task is inhibiting the batch. Wait on it // This task is inhibiting the batch. Wait on it
// before processing the next one. // before processing the next one.
let signalId = hold.connect('release', let signalId = hold.connect('release', () => {
Lang.bind(this, function() { hold.disconnect(signalId);
hold.disconnect(signalId); this.nextTask();
this.nextTask(); });
}));
return; return;
} else { } else {
// This task finished, process the next one // This task finished, process the next one

View File

@ -129,20 +129,19 @@ var UserListItem = new Lang.Class({
let startTime = GLib.get_monotonic_time(); let startTime = GLib.get_monotonic_time();
this._timedLoginTimeoutId = GLib.timeout_add (GLib.PRIORITY_DEFAULT, this._timedLoginTimeoutId = GLib.timeout_add (GLib.PRIORITY_DEFAULT, 33,
33, () => {
Lang.bind(this, function() { let currentTime = GLib.get_monotonic_time();
let currentTime = GLib.get_monotonic_time(); let elapsedTime = (currentTime - startTime) / GLib.USEC_PER_SEC;
let elapsedTime = (currentTime - startTime) / GLib.USEC_PER_SEC; this._timedLoginIndicator.scale_x = elapsedTime / time;
this._timedLoginIndicator.scale_x = elapsedTime / time; if (elapsedTime >= time) {
if (elapsedTime >= time) { this._timedLoginTimeoutId = 0;
this._timedLoginTimeoutId = 0; hold.release();
hold.release(); return GLib.SOURCE_REMOVE;
return GLib.SOURCE_REMOVE; }
}
return GLib.SOURCE_CONTINUE; return GLib.SOURCE_CONTINUE;
})); });
GLib.Source.set_name_by_id(this._timedLoginTimeoutId, '[gnome-shell] this._timedLoginTimeoutId'); GLib.Source.set_name_by_id(this._timedLoginTimeoutId, '[gnome-shell] this._timedLoginTimeoutId');
@ -188,10 +187,10 @@ var UserList = new Lang.Class({
let focusSet = this.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false); let focusSet = this.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
if (!focusSet) { if (!focusSet) {
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() { Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
this._moveFocusToItems(); this._moveFocusToItems();
return false; return false;
})); });
} }
}, },
@ -275,11 +274,7 @@ var UserList = new Lang.Class({
Lang.bind(this, this._onItemActivated)); Lang.bind(this, this._onItemActivated));
// Try to keep the focused item front-and-center // Try to keep the focused item front-and-center
item.actor.connect('key-focus-in', item.actor.connect('key-focus-in', () => { this.scrollToItem(item); });
Lang.bind(this,
function() {
this.scrollToItem(item);
}));
this._moveFocusToItems(); this._moveFocusToItems();
@ -338,20 +333,17 @@ var SessionMenuButton = new Lang.Class({
Main.uiGroup.add_actor(this._menu.actor); Main.uiGroup.add_actor(this._menu.actor);
this._menu.actor.hide(); this._menu.actor.hide();
this._menu.connect('open-state-changed', this._menu.connect('open-state-changed', (menu, isOpen) => {
Lang.bind(this, function(menu, isOpen) { if (isOpen)
if (isOpen) this._button.add_style_pseudo_class('active');
this._button.add_style_pseudo_class('active'); else
else this._button.remove_style_pseudo_class('active');
this._button.remove_style_pseudo_class('active'); });
}));
this._manager = new PopupMenu.PopupMenuManager({ actor: this._button }); this._manager = new PopupMenu.PopupMenuManager({ actor: this._button });
this._manager.addMenu(this._menu); this._manager.addMenu(this._menu);
this._button.connect('clicked', Lang.bind(this, function() { this._button.connect('clicked', () => { this._menu.toggle(); });
this._menu.toggle();
}));
this._items = {}; this._items = {};
this._activeSessionId = null; this._activeSessionId = null;
@ -403,10 +395,10 @@ var SessionMenuButton = new Lang.Class({
this._menu.addMenuItem(item); this._menu.addMenuItem(item);
this._items[id] = item; this._items[id] = item;
item.connect('activate', Lang.bind(this, function() { item.connect('activate', () => {
this.setActiveSession(id); this.setActiveSession(id);
this.emit('session-activated', this._activeSessionId); this.emit('session-activated', this._activeSessionId);
})); });
} }
} }
}); });
@ -506,17 +498,16 @@ var LoginDialog = new Lang.Class({
this.actor.add_child(this._logoBin); this.actor.add_child(this._logoBin);
this._updateLogo(); this._updateLogo();
this._userList.connect('activate', this._userList.connect('activate', (userList, item) => {
Lang.bind(this, function(userList, item) { this._onUserListActivated(item);
this._onUserListActivated(item); });
}));
this._sessionMenuButton = new SessionMenuButton(); this._sessionMenuButton = new SessionMenuButton();
this._sessionMenuButton.connect('session-activated', this._sessionMenuButton.connect('session-activated',
Lang.bind(this, function(list, sessionId) { (list, sessionId) => {
this._greeter.call_select_session_sync (sessionId, null); this._greeter.call_select_session_sync (sessionId, null);
})); });
this._sessionMenuButton.actor.opacity = 0; this._sessionMenuButton.actor.opacity = 0;
this._sessionMenuButton.actor.show(); this._sessionMenuButton.actor.show();
this._authPrompt.addActorToDefaultButtonWell(this._sessionMenuButton.actor); this._authPrompt.addActorToDefaultButtonWell(this._sessionMenuButton.actor);
@ -724,13 +715,13 @@ var LoginDialog = new Lang.Class({
_ensureUserListLoaded() { _ensureUserListLoaded() {
if (!this._userManager.is_loaded) { if (!this._userManager.is_loaded) {
this._userManagerLoadedId = this._userManager.connect('notify::is-loaded', this._userManagerLoadedId = this._userManager.connect('notify::is-loaded',
Lang.bind(this, function() { () => {
if (this._userManager.is_loaded) { if (this._userManager.is_loaded) {
this._loadUserList(); this._loadUserList();
this._userManager.disconnect(this._userManagerLoadedId); this._userManager.disconnect(this._userManagerLoadedId);
this._userManagerLoadedId = 0; this._userManagerLoadedId = 0;
} }
})); });
} else { } else {
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, this._loadUserList)); let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, this._loadUserList));
GLib.Source.set_name_by_id(id, '[gnome-shell] _loadUserList'); GLib.Source.set_name_by_id(id, '[gnome-shell] _loadUserList');
@ -907,17 +898,17 @@ var LoginDialog = new Lang.Class({
if (this._nextSignalId) if (this._nextSignalId)
this._authPrompt.disconnect(this._nextSignalId); this._authPrompt.disconnect(this._nextSignalId);
this._nextSignalId = this._authPrompt.connect('next', this._nextSignalId = this._authPrompt.connect('next',
Lang.bind(this, function() { () => {
this._authPrompt.disconnect(this._nextSignalId); this._authPrompt.disconnect(this._nextSignalId);
this._nextSignalId = 0; this._nextSignalId = 0;
this._authPrompt.updateSensitivity(false); this._authPrompt.updateSensitivity(false);
let answer = this._authPrompt.getAnswer(); let answer = this._authPrompt.getAnswer();
this._user = this._userManager.get_user(answer); this._user = this._userManager.get_user(answer);
this._authPrompt.clear(); this._authPrompt.clear();
this._authPrompt.startSpinning(); this._authPrompt.startSpinning();
this._authPrompt.begin({ userName: answer }); this._authPrompt.begin({ userName: answer });
this._updateCancelButton(); this._updateCancelButton();
})); });
this._updateCancelButton(); this._updateCancelButton();
this._sessionMenuButton.updateSensitivity(false); this._sessionMenuButton.updateSensitivity(false);
@ -952,10 +943,10 @@ var LoginDialog = new Lang.Class({
_gotGreeterSessionProxy(proxy) { _gotGreeterSessionProxy(proxy) {
this._greeterSessionProxy = proxy; this._greeterSessionProxy = proxy;
this._greeterSessionProxyChangedId = this._greeterSessionProxyChangedId =
proxy.connect('g-properties-changed', Lang.bind(this, function() { proxy.connect('g-properties-changed', () => {
if (proxy.Active) if (proxy.Active)
this._loginScreenSessionActivated(); this._loginScreenSessionActivated();
})); });
}, },
_startSession(serviceName) { _startSession(serviceName) {
@ -979,9 +970,7 @@ var LoginDialog = new Lang.Class({
}, },
_onSessionOpened(client, serviceName) { _onSessionOpened(client, serviceName) {
this._authPrompt.finish(Lang.bind(this, function() { this._authPrompt.finish(() => { this._startSession(serviceName); });
this._startSession(serviceName);
}));
}, },
_waitForItemForUser(userName) { _waitForItemForUser(userName) {
@ -992,16 +981,14 @@ var LoginDialog = new Lang.Class({
let hold = new Batch.Hold(); let hold = new Batch.Hold();
let signalId = this._userList.connect('item-added', let signalId = this._userList.connect('item-added',
Lang.bind(this, function() { () => {
let item = this._userList.getItemFromUserName(userName); let item = this._userList.getItemFromUserName(userName);
if (item) if (item)
hold.release(); hold.release();
})); });
hold.connect('release', Lang.bind(this, function() { hold.connect('release', () => { this._userList.disconnect(signalId); });
this._userList.disconnect(signalId);
}));
return hold; return hold;
}, },
@ -1024,11 +1011,11 @@ var LoginDialog = new Lang.Class({
let hold = new Batch.Hold(); let hold = new Batch.Hold();
this._timedLoginIdleTimeOutId = Mainloop.timeout_add_seconds(_TIMED_LOGIN_IDLE_THRESHOLD, this._timedLoginIdleTimeOutId = Mainloop.timeout_add_seconds(_TIMED_LOGIN_IDLE_THRESHOLD,
function() { () => {
this._timedLoginAnimationTime -= _TIMED_LOGIN_IDLE_THRESHOLD; this._timedLoginAnimationTime -= _TIMED_LOGIN_IDLE_THRESHOLD;
hold.release(); hold.release();
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
}); });
GLib.Source.set_name_by_id(this._timedLoginIdleTimeOutId, '[gnome-shell] this._timedLoginAnimationTime'); GLib.Source.set_name_by_id(this._timedLoginIdleTimeOutId, '[gnome-shell] this._timedLoginAnimationTime');
return hold; return hold;
}, },
@ -1038,15 +1025,13 @@ var LoginDialog = new Lang.Class({
this._timedLoginDelay = delay; this._timedLoginDelay = delay;
this._timedLoginAnimationTime = delay; this._timedLoginAnimationTime = delay;
let tasks = [function() { let tasks = [() => this._waitForItemForUser(userName),
return this._waitForItemForUser(userName);
},
function() { () => {
this._timedLoginItem = this._userList.getItemFromUserName(userName); this._timedLoginItem = this._userList.getItemFromUserName(userName);
}, },
function() { () => {
// If we're just starting out, start on the right // If we're just starting out, start on the right
// item. // item.
if (!this._userManager.is_loaded) { if (!this._userManager.is_loaded) {
@ -1056,13 +1041,13 @@ var LoginDialog = new Lang.Class({
this._blockTimedLoginUntilIdle, this._blockTimedLoginUntilIdle,
function() { () => {
this._userList.scrollToItem(this._timedLoginItem); this._userList.scrollToItem(this._timedLoginItem);
}, },
this._showTimedLoginAnimation, this._showTimedLoginAnimation,
function() { () => {
this._timedLoginBatch = null; this._timedLoginBatch = null;
this._greeter.call_begin_auto_login_sync(userName, null); this._greeter.call_begin_auto_login_sync(userName, null);
}]; }];
@ -1090,24 +1075,23 @@ var LoginDialog = new Lang.Class({
_onTimedLoginRequested(client, userName, seconds) { _onTimedLoginRequested(client, userName, seconds) {
this._startTimedLogin(userName, seconds); this._startTimedLogin(userName, seconds);
global.stage.connect('captured-event', global.stage.connect('captured-event', (actor, event) => {
Lang.bind(this, function(actor, event) { if (this._timedLoginDelay == undefined)
if (this._timedLoginDelay == undefined) return Clutter.EVENT_PROPAGATE;
return Clutter.EVENT_PROPAGATE;
if (event.type() == Clutter.EventType.KEY_PRESS || if (event.type() == Clutter.EventType.KEY_PRESS ||
event.type() == Clutter.EventType.BUTTON_PRESS) { event.type() == Clutter.EventType.BUTTON_PRESS) {
if (this._timedLoginBatch) { if (this._timedLoginBatch) {
this._timedLoginBatch.cancel(); this._timedLoginBatch.cancel();
this._timedLoginBatch = null; this._timedLoginBatch = null;
} }
} else if (event.type() == Clutter.EventType.KEY_RELEASE || } else if (event.type() == Clutter.EventType.KEY_RELEASE ||
event.type() == Clutter.EventType.BUTTON_RELEASE) { event.type() == Clutter.EventType.BUTTON_RELEASE) {
this._resetTimedLogin(); this._resetTimedLogin();
} }
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
})); });
}, },
_setUserListExpanded(expanded) { _setUserListExpanded(expanded) {
@ -1218,25 +1202,25 @@ var LoginDialog = new Lang.Class({
this._updateDisableUserList(); this._updateDisableUserList();
this._userAddedId = this._userManager.connect('user-added', this._userAddedId = this._userManager.connect('user-added',
Lang.bind(this, function(userManager, user) { (userManager, user) => {
this._userList.addUser(user); this._userList.addUser(user);
this._updateDisableUserList(); this._updateDisableUserList();
})); });
this._userRemovedId = this._userManager.connect('user-removed', this._userRemovedId = this._userManager.connect('user-removed',
Lang.bind(this, function(userManager, user) { (userManager, user) => {
this._userList.removeUser(user); this._userList.removeUser(user);
this._updateDisableUserList(); this._updateDisableUserList();
})); });
this._userChangedId = this._userManager.connect('user-changed', this._userChangedId = this._userManager.connect('user-changed',
Lang.bind(this, function(userManager, user) { (userManager, user) => {
if (this._userList.containsUser(user) && user.locked) if (this._userList.containsUser(user) && user.locked)
this._userList.removeUser(user); this._userList.removeUser(user);
else if (!this._userList.containsUser(user) && !user.locked) else if (!this._userList.containsUser(user) && !user.locked)
this._userList.addUser(user); this._userList.addUser(user);
this._updateDisableUserList(); this._updateDisableUserList();
})); });
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
}, },

View File

@ -70,10 +70,10 @@ var Manager = new Lang.Class({
this._realms = {}; this._realms = {};
this._signalId = this._aggregateProvider.connect('g-properties-changed', this._signalId = this._aggregateProvider.connect('g-properties-changed',
Lang.bind(this, function(proxy, properties) { (proxy, properties) => {
if ('Realms' in properties.deep_unpack()) if ('Realms' in properties.deep_unpack())
this._reloadRealms(); this._reloadRealms();
})); });
}, },
_reloadRealms() { _reloadRealms() {
@ -109,11 +109,10 @@ var Manager = new Lang.Class({
this._reloadRealm(realm); this._reloadRealm(realm);
realm.connect('g-properties-changed', realm.connect('g-properties-changed', (proxy, properties) => {
Lang.bind(this, function(proxy, properties) { if ('Configured' in properties.deep_unpack())
if ('Configured' in properties.deep_unpack()) this._reloadRealm(realm);
this._reloadRealm(realm); });
}));
}, },
_updateLoginFormat() { _updateLoginFormat() {
@ -146,9 +145,7 @@ var Manager = new Lang.Class({
Service(Gio.DBus.system, Service(Gio.DBus.system,
'org.freedesktop.realmd', 'org.freedesktop.realmd',
'/org/freedesktop/realmd', '/org/freedesktop/realmd',
function(service) { service => { service.ReleaseRemote(); });
service.ReleaseRemote();
});
this._aggregateProvider.disconnect(this._signalId); this._aggregateProvider.disconnect(this._signalId);
this._realms = { }; this._realms = { };
this._updateLoginFormat(); this._updateLoginFormat();

View File

@ -230,11 +230,10 @@ var ShellUserVerifier = new Lang.Class({
if (!this.hasPendingMessages) { if (!this.hasPendingMessages) {
this._userVerifier.call_answer_query(serviceName, answer, this._cancellable, null); this._userVerifier.call_answer_query(serviceName, answer, this._cancellable, null);
} else { } else {
let signalId = this.connect('no-more-messages', let signalId = this.connect('no-more-messages', () => {
Lang.bind(this, function() { this.disconnect(signalId);
this.disconnect(signalId); this._userVerifier.call_answer_query(serviceName, answer, this._cancellable, null);
this._userVerifier.call_answer_query(serviceName, answer, this._cancellable, null); });
}));
} }
}, },
@ -268,11 +267,11 @@ var ShellUserVerifier = new Lang.Class({
this._messageQueueTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, this._messageQueueTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
message.interval, message.interval,
Lang.bind(this, function() { () => {
this._messageQueueTimeoutId = 0; this._messageQueueTimeoutId = 0;
this._queueMessageTimeout(); this._queueMessageTimeout();
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); });
GLib.Source.set_name_by_id(this._messageQueueTimeoutId, '[gnome-shell] this._queueMessageTimeout'); GLib.Source.set_name_by_id(this._messageQueueTimeoutId, '[gnome-shell] this._queueMessageTimeout');
}, },
@ -303,13 +302,13 @@ var ShellUserVerifier = new Lang.Class({
return; return;
} }
this._fprintManager.GetDefaultDeviceRemote(Gio.DBusCallFlags.NONE, this._cancellable, Lang.bind(this, this._fprintManager.GetDefaultDeviceRemote(Gio.DBusCallFlags.NONE, this._cancellable,
function(device, error) { (device, error) => {
if (!error && device) { if (!error && device) {
this._haveFingerprintReader = true; this._haveFingerprintReader = true;
this._updateDefaultService(); this._updateDefaultService();
} }
})); });
}, },
_oVirtUserAuthenticated(token) { _oVirtUserAuthenticated(token) {
@ -432,7 +431,7 @@ var ShellUserVerifier = new Lang.Class({
this._userVerifier.call_begin_verification_for_user(serviceName, this._userVerifier.call_begin_verification_for_user(serviceName,
this._userName, this._userName,
this._cancellable, this._cancellable,
Lang.bind(this, function(obj, result) { (obj, result) => {
try { try {
obj.call_begin_verification_for_user_finish(result); obj.call_begin_verification_for_user_finish(result);
} catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) { } catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
@ -443,11 +442,11 @@ var ShellUserVerifier = new Lang.Class({
} }
this._hold.release(); this._hold.release();
})); });
} else { } else {
this._userVerifier.call_begin_verification(serviceName, this._userVerifier.call_begin_verification(serviceName,
this._cancellable, this._cancellable,
Lang.bind(this, function(obj, result) { (obj, result) => {
try { try {
obj.call_begin_verification_finish(result); obj.call_begin_verification_finish(result);
} catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) { } catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
@ -458,7 +457,7 @@ var ShellUserVerifier = new Lang.Class({
} }
this._hold.release(); this._hold.release();
})); });
} }
}, },
@ -546,22 +545,20 @@ var ShellUserVerifier = new Lang.Class({
if (!this.hasPendingMessages) { if (!this.hasPendingMessages) {
this._retry(); this._retry();
} else { } else {
let signalId = this.connect('no-more-messages', let signalId = this.connect('no-more-messages', () => {
Lang.bind(this, function() { this.disconnect(signalId);
this.disconnect(signalId); if (this._cancellable && !this._cancellable.is_cancelled())
if (this._cancellable && !this._cancellable.is_cancelled()) this._retry();
this._retry(); });
}));
} }
} else { } else {
if (!this.hasPendingMessages) { if (!this.hasPendingMessages) {
this._cancelAndReset(); this._cancelAndReset();
} else { } else {
let signalId = this.connect('no-more-messages', let signalId = this.connect('no-more-messages', () => {
Lang.bind(this, function() { this.disconnect(signalId);
this.disconnect(signalId); this._cancelAndReset();
this._cancelAndReset(); });
}));
} }
} }

View File

@ -126,7 +126,7 @@ var IBusManager = new Lang.Class({
} catch (e) { } catch (e) {
} }
// If an engine is already active we need to get its properties // If an engine is already active we need to get its properties
this._ibus.get_global_engine_async(-1, null, Lang.bind(this, function(i, result) { this._ibus.get_global_engine_async(-1, null, (i, result) => {
let engine; let engine;
try { try {
engine = this._ibus.get_global_engine_async_finish(result); engine = this._ibus.get_global_engine_async_finish(result);
@ -136,7 +136,7 @@ var IBusManager = new Lang.Class({
return; return;
} }
this._engineChanged(this._ibus, engine.get_name()); this._engineChanged(this._ibus, engine.get_name());
})); });
this._updateReadiness(); this._updateReadiness();
} else { } else {
this._clear(); this._clear();
@ -159,7 +159,7 @@ var IBusManager = new Lang.Class({
return; return;
this._registerPropertiesId = this._registerPropertiesId =
this._panelService.connect('register-properties', Lang.bind(this, function(p, props) { this._panelService.connect('register-properties', (p, props) => {
if (!props.get(0)) if (!props.get(0))
return; return;
@ -167,7 +167,7 @@ var IBusManager = new Lang.Class({
this._registerPropertiesId = 0; this._registerPropertiesId = 0;
this.emit('properties-registered', this._currentEngineName, props); this.emit('properties-registered', this._currentEngineName, props);
})); });
}, },
_updateProperty(panel, prop) { _updateProperty(panel, prop) {
@ -214,7 +214,7 @@ var IBusManager = new Lang.Class({
this._preloadEnginesId = this._preloadEnginesId =
Mainloop.timeout_add_seconds(this._PRELOAD_ENGINES_DELAY_TIME, Mainloop.timeout_add_seconds(this._PRELOAD_ENGINES_DELAY_TIME,
Lang.bind(this, function() { () => {
this._ibus.preload_engines_async( this._ibus.preload_engines_async(
ids, ids,
-1, -1,
@ -222,7 +222,7 @@ var IBusManager = new Lang.Class({
null); null);
this._preloadEnginesId = 0; this._preloadEnginesId = 0;
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); });
}, },
}); });
Signals.addSignalMethods(IBusManager.prototype); Signals.addSignalMethods(IBusManager.prototype);

View File

@ -59,8 +59,8 @@ var InputMethod = new Lang.Class({
_setContext(bus, res) { _setContext(bus, res) {
this._context = this._ibus.create_input_context_async_finish(res); this._context = this._ibus.create_input_context_async_finish(res);
this._context.connect('enabled', Lang.bind(this, function () { this._enabled = true })); this._context.connect('enabled', () => { this._enabled = true });
this._context.connect('disabled', Lang.bind(this, function () { this._enabled = false })); this._context.connect('disabled', () => { this._enabled = false });
this._context.connect('commit-text', Lang.bind(this, this._onCommitText)); this._context.connect('commit-text', Lang.bind(this, this._onCommitText));
this._context.connect('delete-surrounding-text', Lang.bind(this, this._onDeleteSurroundingText)); this._context.connect('delete-surrounding-text', Lang.bind(this, this._onDeleteSurroundingText));
this._context.connect('update-preedit-text', Lang.bind(this, this._onUpdatePreeditText)); this._context.connect('update-preedit-text', Lang.bind(this, this._onUpdatePreeditText));
@ -201,14 +201,14 @@ var InputMethod = new Lang.Class({
this._context.process_key_event_async(event.get_key_symbol(), this._context.process_key_event_async(event.get_key_symbol(),
event.get_key_code() - 8, // Convert XKB keycodes to evcodes event.get_key_code() - 8, // Convert XKB keycodes to evcodes
state, -1, null, state, -1, null,
Lang.bind(this, (context, res) => { (context, res) => {
try { try {
let retval = context.process_key_event_async_finish(res); let retval = context.process_key_event_async_finish(res);
this.notify_key_event(event, retval); this.notify_key_event(event, retval);
} catch (e) { } catch (e) {
log('Error processing key on IM: ' + e.message); log('Error processing key on IM: ' + e.message);
} }
})); });
return true; return true;
}, },
}); });

View File

@ -23,9 +23,9 @@ function getCompletions(text, commandHeader, globalCompletionList) {
if (matches) { if (matches) {
[expr, base, attrHead] = matches; [expr, base, attrHead] = matches;
methods = getPropertyNamesFromExpression(base, commandHeader).filter(function(attr) { methods = getPropertyNamesFromExpression(base, commandHeader).filter(
return attr.slice(0, attrHead.length) == attrHead; attr => attr.slice(0, attrHead.length) == attrHead
}); );
} }
// Look for the empty expression or partially entered words // Look for the empty expression or partially entered words
@ -33,9 +33,9 @@ function getCompletions(text, commandHeader, globalCompletionList) {
matches = text.match(/^(\w*)$/); matches = text.match(/^(\w*)$/);
if (text == '' || matches) { if (text == '' || matches) {
[expr, attrHead] = matches; [expr, attrHead] = matches;
methods = globalCompletionList.filter(function(attr) { methods = globalCompletionList.filter(
return attr.slice(0, attrHead.length) == attrHead; attr => attr.slice(0, attrHead.length) == attrHead
}); );
} }
} }
@ -175,7 +175,7 @@ function getPropertyNamesFromExpression(expr, commandHeader) {
// Make sure propsUnique contains one key for every // Make sure propsUnique contains one key for every
// property so we end up with a unique list of properties // property so we end up with a unique list of properties
allProps.map(function(p){ propsUnique[p] = null; }); allProps.map(p => propsUnique[p] = null);
} }
return Object.keys(propsUnique).sort(); return Object.keys(propsUnique).sort();
} }
@ -233,7 +233,7 @@ function isUnsafeExpression(str) {
// Returns a list of global keywords derived from str // Returns a list of global keywords derived from str
function getDeclaredConstants(str) { function getDeclaredConstants(str) {
let ret = []; let ret = [];
str.split(';').forEach(function(s) { str.split(';').forEach(s => {
let base, keyword; let base, keyword;
let match = s.match(/const\s+(\w+)\s*=/); let match = s.match(/const\s+(\w+)\s*=/);
if (match) { if (match) {

View File

@ -138,8 +138,8 @@ var KeyboardManager = new Lang.Class({
_buildGroupStrings(_group) { _buildGroupStrings(_group) {
let group = _group.concat(this._localeLayoutInfo); let group = _group.concat(this._localeLayoutInfo);
let layouts = group.map(function(g) { return g.layout; }).join(','); let layouts = group.map(g => g.layout).join(',');
let variants = group.map(function(g) { return g.variant; }).join(','); let variants = group.map(g => g.variant).join(',');
return [layouts, variants]; return [layouts, variants];
}, },

View File

@ -125,21 +125,20 @@ var LoginManagerSystemd = new Lang.Class({
return; return;
} }
this._proxy.GetSessionRemote(sessionId, Lang.bind(this, this._proxy.GetSessionRemote(sessionId, (result, error) => {
function(result, error) { if (error) {
if (error) { logError(error, 'Could not get a proxy for the current session');
logError(error, 'Could not get a proxy for the current session'); } else {
} else { this._currentSession = new SystemdLoginSession(Gio.DBus.system,
this._currentSession = new SystemdLoginSession(Gio.DBus.system, 'org.freedesktop.login1',
'org.freedesktop.login1', result[0]);
result[0]); callback(this._currentSession);
callback(this._currentSession); }
} });
}));
}, },
canSuspend(asyncCallback) { canSuspend(asyncCallback) {
this._proxy.CanSuspendRemote(function(result, error) { this._proxy.CanSuspendRemote((result, error) => {
if (error) { if (error) {
asyncCallback(false, false); asyncCallback(false, false);
} else { } else {
@ -151,7 +150,7 @@ var LoginManagerSystemd = new Lang.Class({
}, },
listSessions(asyncCallback) { listSessions(asyncCallback) {
this._proxy.ListSessionsRemote(function(result, error) { this._proxy.ListSessionsRemote((result, error) => {
if (error) if (error)
asyncCallback([]); asyncCallback([]);
else else
@ -170,7 +169,7 @@ var LoginManagerSystemd = new Lang.Class({
reason, reason,
'delay']); 'delay']);
this._proxy.call_with_unix_fd_list('Inhibit', inVariant, 0, -1, null, null, this._proxy.call_with_unix_fd_list('Inhibit', inVariant, 0, -1, null, null,
Lang.bind(this, function(proxy, result) { (proxy, result) => {
let fd = -1; let fd = -1;
try { try {
let [outVariant, fdList] = proxy.call_with_unix_fd_list_finish(result); let [outVariant, fdList] = proxy.call_with_unix_fd_list_finish(result);
@ -180,7 +179,7 @@ var LoginManagerSystemd = new Lang.Class({
logError(e, "Error getting systemd inhibitor"); logError(e, "Error getting systemd inhibitor");
callback(null); callback(null);
} }
})); });
}, },
_prepareForSleep(proxy, sender, [aboutToSuspend]) { _prepareForSleep(proxy, sender, [aboutToSuspend]) {

View File

@ -140,15 +140,15 @@ var ModemGsm = new Lang.Class({
this.operator_name = null; this.operator_name = null;
// Code is duplicated because the function have different signatures // Code is duplicated because the function have different signatures
this._proxy.connectSignal('SignalQuality', Lang.bind(this, function(proxy, sender, [quality]) { this._proxy.connectSignal('SignalQuality', (proxy, sender, [quality]) => {
this.signal_quality = quality; this.signal_quality = quality;
this.emit('notify::signal-quality'); this.emit('notify::signal-quality');
})); });
this._proxy.connectSignal('RegistrationInfo', Lang.bind(this, function(proxy, sender, [status, code, name]) { this._proxy.connectSignal('RegistrationInfo', (proxy, sender, [status, code, name]) => {
this.operator_name = _findProviderForMccMnc(name, code); this.operator_name = _findProviderForMccMnc(name, code);
this.emit('notify::operator-name'); this.emit('notify::operator-name');
})); });
this._proxy.GetRegistrationInfoRemote(Lang.bind(this, function([result], err) { this._proxy.GetRegistrationInfoRemote(([result], err) => {
if (err) { if (err) {
log(err); log(err);
return; return;
@ -157,8 +157,8 @@ var ModemGsm = new Lang.Class({
let [status, code, name] = result; let [status, code, name] = result;
this.operator_name = _findProviderForMccMnc(name, code); this.operator_name = _findProviderForMccMnc(name, code);
this.emit('notify::operator-name'); this.emit('notify::operator-name');
})); });
this._proxy.GetSignalQualityRemote(Lang.bind(this, function(result, err) { this._proxy.GetSignalQualityRemote((result, err) => {
if (err) { if (err) {
// it will return an error if the device is not connected // it will return an error if the device is not connected
this.signal_quality = 0; this.signal_quality = 0;
@ -167,7 +167,7 @@ var ModemGsm = new Lang.Class({
this.signal_quality = quality; this.signal_quality = quality;
} }
this.emit('notify::signal-quality'); this.emit('notify::signal-quality');
})); });
} }
}); });
Signals.addSignalMethods(ModemGsm.prototype); Signals.addSignalMethods(ModemGsm.prototype);
@ -180,7 +180,7 @@ var ModemCdma = new Lang.Class({
this.signal_quality = 0; this.signal_quality = 0;
this.operator_name = null; this.operator_name = null;
this._proxy.connectSignal('SignalQuality', Lang.bind(this, function(proxy, sender, params) { this._proxy.connectSignal('SignalQuality', (proxy, sender, params) => {
this.signal_quality = params[0]; this.signal_quality = params[0];
this.emit('notify::signal-quality'); this.emit('notify::signal-quality');
@ -188,8 +188,8 @@ var ModemCdma = new Lang.Class({
// and we can finally call GetServingSystem // and we can finally call GetServingSystem
if (this.operator_name == null) if (this.operator_name == null)
this._refreshServingSystem(); this._refreshServingSystem();
})); });
this._proxy.GetSignalQualityRemote(Lang.bind(this, function(result, err) { this._proxy.GetSignalQualityRemote((result, err) => {
if (err) { if (err) {
// it will return an error if the device is not connected // it will return an error if the device is not connected
this.signal_quality = 0; this.signal_quality = 0;
@ -198,11 +198,11 @@ var ModemCdma = new Lang.Class({
this.signal_quality = quality; this.signal_quality = quality;
} }
this.emit('notify::signal-quality'); this.emit('notify::signal-quality');
})); });
}, },
_refreshServingSystem() { _refreshServingSystem() {
this._proxy.GetServingSystemRemote(Lang.bind(this, function([result], err) { this._proxy.GetServingSystemRemote(([result], err) => {
if (err) { if (err) {
// it will return an error if the device is not connected // it will return an error if the device is not connected
this.operator_name = null; this.operator_name = null;
@ -212,7 +212,7 @@ var ModemCdma = new Lang.Class({
this.operator_name = _findProviderForSid(sid) this.operator_name = _findProviderForSid(sid)
} }
this.emit('notify::operator-name'); this.emit('notify::operator-name');
})); });
} }
}); });
Signals.addSignalMethods(ModemCdma.prototype); Signals.addSignalMethods(ModemCdma.prototype);
@ -253,24 +253,24 @@ var BroadbandModem = new Lang.Class({
this._proxy_cdma = new BroadbandModemCdmaProxy(Gio.DBus.system, 'org.freedesktop.ModemManager1', path); this._proxy_cdma = new BroadbandModemCdmaProxy(Gio.DBus.system, 'org.freedesktop.ModemManager1', path);
this._capabilities = capabilities; this._capabilities = capabilities;
this._proxy.connect('g-properties-changed', Lang.bind(this, function(proxy, properties) { this._proxy.connect('g-properties-changed', (proxy, properties) => {
if ('SignalQuality' in properties.deep_unpack()) if ('SignalQuality' in properties.deep_unpack())
this._reloadSignalQuality(); this._reloadSignalQuality();
})); });
this._reloadSignalQuality(); this._reloadSignalQuality();
this._proxy_3gpp.connect('g-properties-changed', Lang.bind(this, function(proxy, properties) { this._proxy_3gpp.connect('g-properties-changed', (proxy, properties) => {
let unpacked = properties.deep_unpack(); let unpacked = properties.deep_unpack();
if ('OperatorName' in unpacked || 'OperatorCode' in unpacked) if ('OperatorName' in unpacked || 'OperatorCode' in unpacked)
this._reload3gppOperatorName(); this._reload3gppOperatorName();
})); });
this._reload3gppOperatorName(); this._reload3gppOperatorName();
this._proxy_cdma.connect('g-properties-changed', Lang.bind(this, function(proxy, properties) { this._proxy_cdma.connect('g-properties-changed', (proxy, properties) => {
let unpacked = properties.deep_unpack(); let unpacked = properties.deep_unpack();
if ('Nid' in unpacked || 'Sid' in unpacked) if ('Nid' in unpacked || 'Sid' in unpacked)
this._reloadCdmaOperatorName(); this._reloadCdmaOperatorName();
})); });
this._reloadCdmaOperatorName(); this._reloadCdmaOperatorName();
}, },

View File

@ -93,7 +93,7 @@ var ObjectManager = new Lang.Class({
proxy.init_async(GLib.PRIORITY_DEFAULT, proxy.init_async(GLib.PRIORITY_DEFAULT,
this._cancellable, this._cancellable,
Lang.bind(this, function(initable, result) { (initable, result) => {
let error = null; let error = null;
try { try {
initable.init_finish(result); initable.init_finish(result);
@ -127,7 +127,7 @@ var ObjectManager = new Lang.Class({
if (onFinished) if (onFinished)
onFinished(); onFinished();
})); });
}, },
_removeInterface(objectPath, interfaceName) { _removeInterface(objectPath, interfaceName) {
@ -168,35 +168,35 @@ var ObjectManager = new Lang.Class({
} }
this._managerProxy.connectSignal('InterfacesAdded', this._managerProxy.connectSignal('InterfacesAdded',
Lang.bind(this, function(objectManager, sender, [objectPath, interfaces]) { (objectManager, sender, [objectPath, interfaces]) => {
let interfaceNames = Object.keys(interfaces); let interfaceNames = Object.keys(interfaces);
for (let i = 0; i < interfaceNames.length; i++) for (let i = 0; i < interfaceNames.length; i++)
this._addInterface(objectPath, interfaceNames[i]); this._addInterface(objectPath, interfaceNames[i]);
})); });
this._managerProxy.connectSignal('InterfacesRemoved', this._managerProxy.connectSignal('InterfacesRemoved',
Lang.bind(this, function(objectManager, sender, [objectPath, interfaceNames]) { (objectManager, sender, [objectPath, interfaceNames]) => {
for (let i = 0; i < interfaceNames.length; i++) for (let i = 0; i < interfaceNames.length; i++)
this._removeInterface(objectPath, interfaceNames[i]); this._removeInterface(objectPath, interfaceNames[i]);
})); });
if (Object.keys(this._interfaceInfos).length == 0) { if (Object.keys(this._interfaceInfos).length == 0) {
this._tryToCompleteLoad(); this._tryToCompleteLoad();
return; return;
} }
this._managerProxy.connect('notify::g-name-owner', Lang.bind(this, function() { this._managerProxy.connect('notify::g-name-owner', () => {
if (this._managerProxy.g_name_owner) if (this._managerProxy.g_name_owner)
this._onNameAppeared(); this._onNameAppeared();
else else
this._onNameVanished(); this._onNameVanished();
})); });
if (this._managerProxy.g_name_owner) if (this._managerProxy.g_name_owner)
this._onNameAppeared(); this._onNameAppeared();
}, },
_onNameAppeared() { _onNameAppeared() {
this._managerProxy.GetManagedObjectsRemote(Lang.bind(this, function(result, error) { this._managerProxy.GetManagedObjectsRemote((result, error) => {
if (!result) { if (!result) {
if (error) { if (error) {
logError(error, 'could not get remote objects for service ' + this._serviceName + ' path ' + this._managerPath); logError(error, 'could not get remote objects for service ' + this._serviceName + ' path ' + this._managerPath);
@ -230,7 +230,7 @@ var ObjectManager = new Lang.Class({
} }
} }
this._tryToCompleteLoad(); this._tryToCompleteLoad();
})); });
}, },
_onNameVanished() { _onNameVanished() {

View File

@ -43,15 +43,15 @@ var SmartcardManager = new Lang.Class({
for (let i = 0; i < tokens.length; i++) for (let i = 0; i < tokens.length; i++)
this._addToken(tokens[i]); this._addToken(tokens[i]);
this._objectManager.connect('interface-added', Lang.bind(this, function(objectManager, interfaceName, proxy) { this._objectManager.connect('interface-added', (objectManager, interfaceName, proxy) => {
if (interfaceName == 'org.gnome.SettingsDaemon.Smartcard.Token') if (interfaceName == 'org.gnome.SettingsDaemon.Smartcard.Token')
this._addToken(proxy); this._addToken(proxy);
})); });
this._objectManager.connect('interface-removed', Lang.bind(this, function(objectManager, interfaceName, proxy) { this._objectManager.connect('interface-removed', (objectManager, interfaceName, proxy) => {
if (interfaceName == 'org.gnome.SettingsDaemon.Smartcard.Token') if (interfaceName == 'org.gnome.SettingsDaemon.Smartcard.Token')
this._removeToken(proxy); this._removeToken(proxy);
})); });
}, },
_updateToken(token) { _updateToken(token) {
@ -69,18 +69,17 @@ var SmartcardManager = new Lang.Class({
_addToken(token) { _addToken(token) {
this._updateToken(token); this._updateToken(token);
token.connect('g-properties-changed', token.connect('g-properties-changed', (proxy, properties) => {
Lang.bind(this, function(proxy, properties) { if ('IsInserted' in properties.deep_unpack()) {
if ('IsInserted' in properties.deep_unpack()) { this._updateToken(token);
this._updateToken(token);
if (token.IsInserted) { if (token.IsInserted) {
this.emit('smartcard-inserted', token); this.emit('smartcard-inserted', token);
} else { } else {
this.emit('smartcard-removed', token); this.emit('smartcard-removed', token);
} }
} }
})); });
// Emit a smartcard-inserted at startup if it's already plugged in // Emit a smartcard-inserted at startup if it's already plugged in
if (token.IsInserted) if (token.IsInserted)

View File

@ -410,7 +410,7 @@ const SystemActions = new Lang.Class({
if (Main.screenShield) if (Main.screenShield)
Main.screenShield.lock(false); Main.screenShield.lock(false);
Clutter.threads_add_repaint_func_full(Clutter.RepaintFlags.POST_PAINT, function() { Clutter.threads_add_repaint_func_full(Clutter.RepaintFlags.POST_PAINT, () => {
Gdm.goto_login_session_sync(null); Gdm.goto_login_session_sync(null);
return false; return false;
}); });

View File

@ -136,7 +136,7 @@ function trySpawn(argv)
// Dummy child watch; we don't want to double-fork internally // Dummy child watch; we don't want to double-fork internally
// because then we lose the parent-child relationship, which // because then we lose the parent-child relationship, which
// can break polkit. See https://bugzilla.redhat.com//show_bug.cgi?id=819275 // can break polkit. See https://bugzilla.redhat.com//show_bug.cgi?id=819275
GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid, function () {}); GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid, () => {});
} }
// trySpawnCommandLine: // trySpawnCommandLine:
@ -291,12 +291,10 @@ function createTimeLabel(date, params) {
_desktopSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' }); _desktopSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' });
let label = new St.Label({ text: formatTime(date, params) }); let label = new St.Label({ text: formatTime(date, params) });
let id = _desktopSettings.connect('changed::clock-format', function() { let id = _desktopSettings.connect('changed::clock-format', () => {
label.text = formatTime(date, params); label.text = formatTime(date, params);
}); });
label.connect('destroy', function() { label.connect('destroy', () => { _desktopSettings.disconnect(id); });
_desktopSettings.disconnect(id);
});
return label; return label;
} }
@ -316,7 +314,7 @@ function createTimeLabel(date, params) {
function lowerBound(array, val, cmp) { function lowerBound(array, val, cmp) {
let min, max, mid, v; let min, max, mid, v;
cmp = cmp || function(a, b) { return a - b; }; cmp = cmp || ((a, b) => a - b);
if (array.length == 0) if (array.length == 0)
return 0; return 0;

View File

@ -75,9 +75,9 @@ function run() {
// Enable recording of timestamps for different points in the frame cycle // Enable recording of timestamps for different points in the frame cycle
global.frame_timestamps = true; global.frame_timestamps = true;
Main.overview.connect('shown', function() { Main.overview.connect('shown', () => {
Scripting.scriptEvent('overviewShowDone'); Scripting.scriptEvent('overviewShowDone');
}); });
yield Scripting.sleep(1000); yield Scripting.sleep(1000);

View File

@ -42,35 +42,29 @@ function waitAndDraw(milliseconds) {
let timeline = new Clutter.Timeline({ duration: milliseconds }); let timeline = new Clutter.Timeline({ duration: milliseconds });
timeline.start(); timeline.start();
timeline.connect('new-frame', timeline.connect('new-frame', (timeline, frame) => {
function(timeline, frame) { global.stage.queue_redraw();
global.stage.queue_redraw(); });
});
timeline.connect('completed', timeline.connect('completed', () => {
function() { timeline.stop();
timeline.stop(); if (cb)
if (cb) cb();
cb(); });
});
return function(callback) { return callback => { cb = callback; };
cb = callback;
};
} }
function waitSignal(object, signal) { function waitSignal(object, signal) {
let cb; let cb;
let id = object.connect(signal, function() { let id = object.connect(signal, () => {
object.disconnect(id); object.disconnect(id);
if (cb) if (cb)
cb(); cb();
}); });
return function(callback) { return callback => { cb = callback; };
cb = callback;
};
} }
function extractBootTimestamp() { function extractBootTimestamp() {
@ -270,7 +264,7 @@ function script_redrawTestDone(time) {
function script_collectTimings(time) { function script_collectTimings(time) {
for (let timing in redrawTimes) { for (let timing in redrawTimes) {
let times = redrawTimes[timing]; let times = redrawTimes[timing];
times.sort(function(a, b) { return a - b }); times.sort((a, b) => a - b);
let len = times.length; let len = times.length;
let median; let median;

View File

@ -357,9 +357,9 @@ var WebPortalHelper = new Lang.Class({
if (top.window != null) if (top.window != null)
return; return;
top.window = new PortalWindow(this, top.url, top.timestamp, Lang.bind(this, function(result) { top.window = new PortalWindow(this, top.url, top.timestamp, result => {
this._dbusImpl.emit_signal('Done', new GLib.Variant('(ou)', [top.connection, result])); this._dbusImpl.emit_signal('Done', new GLib.Variant('(ou)', [top.connection, result]));
})); });
}, },
}); });

View File

@ -372,10 +372,10 @@ var AppSwitcherPopup = new Lang.Class({
{ opacity: 0, { opacity: 0,
time: THUMBNAIL_FADE_TIME, time: THUMBNAIL_FADE_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete: Lang.bind(this, function() { onComplete: () => {
thumbnailsActor.destroy(); thumbnailsActor.destroy();
this.thumbnailsVisible = false; this.thumbnailsVisible = false;
}) }
}); });
this._thumbnails = null; this._thumbnails = null;
if (this._switcherList._items[this._selectedIndex]) if (this._switcherList._items[this._selectedIndex])
@ -403,7 +403,7 @@ var AppSwitcherPopup = new Lang.Class({
{ opacity: 255, { opacity: 255,
time: THUMBNAIL_FADE_TIME, time: THUMBNAIL_FADE_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete: Lang.bind(this, function () { this.thumbnailsVisible = true; }) onComplete: () => { this.thumbnailsVisible = true; }
}); });
this._switcherList._items[this._selectedIndex].add_accessible_state (Atk.StateType.EXPANDED); this._switcherList._items[this._selectedIndex].add_accessible_state (Atk.StateType.EXPANDED);
@ -678,9 +678,9 @@ var AppSwitcher = new Lang.Class({
let appIcon = new AppIcon(apps[i]); let appIcon = new AppIcon(apps[i]);
// Cache the window list now; we don't handle dynamic changes here, // Cache the window list now; we don't handle dynamic changes here,
// and we don't want to be continually retrieving it // and we don't want to be continually retrieving it
appIcon.cachedWindows = allWindows.filter(function(w) { appIcon.cachedWindows = allWindows.filter(
return windowTracker.get_window_app (w) == appIcon.app; w => windowTracker.get_window_app (w) == appIcon.app
}); );
if (appIcon.cachedWindows.length > 0) if (appIcon.cachedWindows.length > 0)
this._addIcon(appIcon); this._addIcon(appIcon);
} }
@ -721,9 +721,7 @@ var AppSwitcher = new Lang.Class({
let availWidth = primary.width - parentPadding - this.actor.get_theme_node().get_horizontal_padding(); let availWidth = primary.width - parentPadding - this.actor.get_theme_node().get_horizontal_padding();
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor; let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
let iconSizes = baseIconSizes.map(function(s) { let iconSizes = baseIconSizes.map(s => s * scaleFactor);
return s * scaleFactor;
});
if (this._items.length == 1) { if (this._items.length == 1) {
this._iconSize = baseIconSizes[0]; this._iconSize = baseIconSizes[0];
@ -775,11 +773,11 @@ var AppSwitcher = new Lang.Class({
Mainloop.source_remove(this._mouseTimeOutId); Mainloop.source_remove(this._mouseTimeOutId);
if (this._altTabPopup.thumbnailsVisible) { if (this._altTabPopup.thumbnailsVisible) {
this._mouseTimeOutId = Mainloop.timeout_add(APP_ICON_HOVER_TIMEOUT, this._mouseTimeOutId = Mainloop.timeout_add(APP_ICON_HOVER_TIMEOUT,
Lang.bind(this, function () { () => {
this._enterItem(index); this._enterItem(index);
this._mouseTimeOutId = 0; this._mouseTimeOutId = 0;
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); });
GLib.Source.set_name_by_id(this._mouseTimeOutId, '[gnome-shell] this._enterItem'); GLib.Source.set_name_by_id(this._mouseTimeOutId, '[gnome-shell] this._enterItem');
} else } else
this._itemEntered(index); this._itemEntered(index);
@ -829,7 +827,7 @@ var AppSwitcher = new Lang.Class({
let n = this._arrows.length; let n = this._arrows.length;
let arrow = new St.DrawingArea({ style_class: 'switcher-arrow' }); let arrow = new St.DrawingArea({ style_class: 'switcher-arrow' });
arrow.connect('repaint', function() { SwitcherPopup.drawArrow(arrow, St.Side.BOTTOM); }); arrow.connect('repaint', () => { SwitcherPopup.drawArrow(arrow, St.Side.BOTTOM); });
this._list.add_actor(arrow); this._list.add_actor(arrow);
this._arrows.push(arrow); this._arrows.push(arrow);

View File

@ -129,9 +129,9 @@ var BaseAppView = new Lang.Class({
else else
this._grid = new IconGrid.IconGrid(gridParams); this._grid = new IconGrid.IconGrid(gridParams);
this._grid.connect('key-focus-in', Lang.bind(this, function(grid, actor) { this._grid.connect('key-focus-in', (grid, actor) => {
this._keyFocusIn(actor); this._keyFocusIn(actor);
})); });
// Standard hack for ClutterBinLayout // Standard hack for ClutterBinLayout
this._grid.actor.x_expand = true; this._grid.actor.x_expand = true;
@ -173,9 +173,7 @@ var BaseAppView = new Lang.Class({
loadGrid() { loadGrid() {
this._allItems.sort(this._compareItems); this._allItems.sort(this._compareItems);
this._allItems.forEach(Lang.bind(this, function(item) { this._allItems.forEach(item => { this._grid.addItem(item); });
this._grid.addItem(item);
}));
this.emit('view-loaded'); this.emit('view-loaded');
}, },
@ -191,18 +189,19 @@ var BaseAppView = new Lang.Class({
this._selectAppInternal(id); this._selectAppInternal(id);
} else if (this._items[id]) { } else if (this._items[id]) {
// Need to wait until the view is mapped // Need to wait until the view is mapped
let signalId = this._items[id].actor.connect('notify::mapped', Lang.bind(this, function(actor) { let signalId = this._items[id].actor.connect('notify::mapped',
if (actor.mapped) { actor => {
actor.disconnect(signalId); if (actor.mapped) {
this._selectAppInternal(id); actor.disconnect(signalId);
} this._selectAppInternal(id);
})); }
});
} else { } else {
// Need to wait until the view is built // Need to wait until the view is built
let signalId = this.connect('view-loaded', Lang.bind(this, function() { let signalId = this.connect('view-loaded', () => {
this.disconnect(signalId); this.disconnect(signalId);
this.selectApp(id); this.selectApp(id);
})); });
} }
}, },
@ -214,11 +213,10 @@ var BaseAppView = new Lang.Class({
animate(animationDirection, onComplete) { animate(animationDirection, onComplete) {
if (onComplete) { if (onComplete) {
let animationDoneId = this._grid.connect('animation-done', Lang.bind(this, let animationDoneId = this._grid.connect('animation-done', () => {
function () { this._grid.disconnect(animationDoneId);
this._grid.disconnect(animationDoneId); onComplete();
onComplete(); });
}));
} }
if (animationDirection == IconGrid.AnimationDirection.IN) { if (animationDirection == IconGrid.AnimationDirection.IN) {
@ -244,7 +242,7 @@ var BaseAppView = new Lang.Class({
} else { } else {
params.opacity = 0; params.opacity = 0;
params.delay = 0; params.delay = 0;
params.onComplete = Lang.bind(this, function() { this.actor.hide() }); params.onComplete = () => { this.actor.hide(); };
} }
Tweener.addTween(this._grid.actor, params); Tweener.addTween(this._grid.actor, params);
@ -284,11 +282,9 @@ var PageIndicators = new Lang.Class({
this._nPages = 0; this._nPages = 0;
this._currentPage = undefined; this._currentPage = undefined;
this.actor.connect('notify::mapped', this.actor.connect('notify::mapped', () => {
Lang.bind(this, function() { this.animateIndicators(IconGrid.AnimationDirection.IN);
this.animateIndicators(IconGrid.AnimationDirection.IN); });
})
);
}, },
setNPages(nPages) { setNPages(nPages) {
@ -306,10 +302,9 @@ var PageIndicators = new Lang.Class({
toggle_mode: true, toggle_mode: true,
checked: pageIndex == this._currentPage }); checked: pageIndex == this._currentPage });
indicator.child = new St.Widget({ style_class: 'page-indicator-icon' }); indicator.child = new St.Widget({ style_class: 'page-indicator-icon' });
indicator.connect('clicked', Lang.bind(this, indicator.connect('clicked', () => {
function() { this.emit('page-activated', pageIndex);
this.emit('page-activated', pageIndex); });
}));
this.actor.add_actor(indicator); this.actor.add_actor(indicator);
} }
} else { } else {
@ -391,10 +386,10 @@ var AllView = new Lang.Class({
this._adjustment = this._scrollView.vscroll.adjustment; this._adjustment = this._scrollView.vscroll.adjustment;
this._pageIndicators = new PageIndicators(); this._pageIndicators = new PageIndicators();
this._pageIndicators.connect('page-activated', Lang.bind(this, this._pageIndicators.connect('page-activated',
function(indicators, pageIndex) { (indicators, pageIndex) => {
this.goToPage(pageIndex); this.goToPage(pageIndex);
})); });
this._pageIndicators.actor.connect('scroll-event', Lang.bind(this, this._onScroll)); this._pageIndicators.actor.connect('scroll-event', Lang.bind(this, this._onScroll));
this.actor.add_actor(this._pageIndicators.actor); this.actor.add_actor(this._pageIndicators.actor);
@ -421,7 +416,7 @@ var AllView = new Lang.Class({
this._scrollView.add_action(panAction); this._scrollView.add_action(panAction);
this._panning = false; this._panning = false;
this._clickAction = new Clutter.ClickAction(); this._clickAction = new Clutter.ClickAction();
this._clickAction.connect('clicked', Lang.bind(this, function() { this._clickAction.connect('clicked', () => {
if (!this._currentPopup) if (!this._currentPopup)
return; return;
@ -429,7 +424,7 @@ var AllView = new Lang.Class({
let actor = global.stage.get_actor_at_pos(Clutter.PickMode.ALL, x, y); let actor = global.stage.get_actor_at_pos(Clutter.PickMode.ALL, x, y);
if (!this._currentPopup.actor.contains(actor)) if (!this._currentPopup.actor.contains(actor))
this._currentPopup.popdown(); this._currentPopup.popdown();
})); });
this._eventBlocker.add_action(this._clickAction); this._eventBlocker.add_action(this._clickAction);
this._displayingPopup = false; this._displayingPopup = false;
@ -437,45 +432,39 @@ var AllView = new Lang.Class({
this._availWidth = 0; this._availWidth = 0;
this._availHeight = 0; this._availHeight = 0;
Main.overview.connect('hidden', Lang.bind(this, Main.overview.connect('hidden', () => { this.goToPage(0); });
function() { this._grid.connect('space-opened', () => {
this.goToPage(0); let fadeEffect = this._scrollView.get_effect('fade');
})); if (fadeEffect)
this._grid.connect('space-opened', Lang.bind(this, fadeEffect.enabled = false;
function() {
let fadeEffect = this._scrollView.get_effect('fade');
if (fadeEffect)
fadeEffect.enabled = false;
this.emit('space-ready'); this.emit('space-ready');
})); });
this._grid.connect('space-closed', Lang.bind(this, this._grid.connect('space-closed', () => {
function() { this._displayingPopup = false;
this._displayingPopup = false; });
}));
this.actor.connect('notify::mapped', Lang.bind(this, this.actor.connect('notify::mapped', () => {
function() { if (this.actor.mapped) {
if (this.actor.mapped) { this._keyPressEventId =
this._keyPressEventId = global.stage.connect('key-press-event',
global.stage.connect('key-press-event', Lang.bind(this, this._onKeyPressEvent));
Lang.bind(this, this._onKeyPressEvent)); } else {
} else { if (this._keyPressEventId)
if (this._keyPressEventId) global.stage.disconnect(this._keyPressEventId);
global.stage.disconnect(this._keyPressEventId); this._keyPressEventId = 0;
this._keyPressEventId = 0; }
} });
}));
this._redisplayWorkId = Main.initializeDeferredWork(this.actor, Lang.bind(this, this._redisplay)); this._redisplayWorkId = Main.initializeDeferredWork(this.actor, Lang.bind(this, this._redisplay));
Shell.AppSystem.get_default().connect('installed-changed', Lang.bind(this, function() { Shell.AppSystem.get_default().connect('installed-changed', () => {
Main.queueDeferredWork(this._redisplayWorkId); Main.queueDeferredWork(this._redisplayWorkId);
})); });
this._folderSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.app-folders' }); this._folderSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.app-folders' });
this._folderSettings.connect('changed::folder-children', Lang.bind(this, function() { this._folderSettings.connect('changed::folder-children', () => {
Main.queueDeferredWork(this._redisplayWorkId); Main.queueDeferredWork(this._redisplayWorkId);
})); });
}, },
removeAll() { removeAll() {
@ -495,43 +484,41 @@ var AllView = new Lang.Class({
}, },
_refilterApps() { _refilterApps() {
this._allItems.forEach(function(icon) { this._allItems.forEach(icon => {
if (icon instanceof AppIcon) if (icon instanceof AppIcon)
icon.actor.visible = true; icon.actor.visible = true;
}); });
this.folderIcons.forEach(Lang.bind(this, function(folder) { this.folderIcons.forEach(folder => {
let folderApps = folder.getAppIds(); let folderApps = folder.getAppIds();
folderApps.forEach(Lang.bind(this, function(appId) { folderApps.forEach(appId => {
let appIcon = this._items[appId]; let appIcon = this._items[appId];
appIcon.actor.visible = false; appIcon.actor.visible = false;
})); });
})); });
}, },
_loadApps() { _loadApps() {
let apps = Gio.AppInfo.get_all().filter(function(appInfo) { let apps = Gio.AppInfo.get_all().filter(appInfo => {
try { try {
let id = appInfo.get_id(); // catch invalid file encodings let id = appInfo.get_id(); // catch invalid file encodings
} catch(e) { } catch(e) {
return false; return false;
} }
return appInfo.should_show(); return appInfo.should_show();
}).map(function(app) { }).map(app => app.get_id());
return app.get_id();
});
let appSys = Shell.AppSystem.get_default(); let appSys = Shell.AppSystem.get_default();
let folders = this._folderSettings.get_strv('folder-children'); let folders = this._folderSettings.get_strv('folder-children');
folders.forEach(Lang.bind(this, function(id) { folders.forEach(id => {
let path = this._folderSettings.path + 'folders/' + id + '/'; let path = this._folderSettings.path + 'folders/' + id + '/';
let icon = new FolderIcon(id, path, this); let icon = new FolderIcon(id, path, this);
icon.connect('name-changed', Lang.bind(this, this._itemNameChanged)); icon.connect('name-changed', Lang.bind(this, this._itemNameChanged));
icon.connect('apps-changed', Lang.bind(this, this._refilterApps)); icon.connect('apps-changed', Lang.bind(this, this._refilterApps));
this.addItem(icon); this.addItem(icon);
this.folderIcons.push(icon); this.folderIcons.push(icon);
})); });
// Allow dragging of the icon only if the Dash would accept a drop to // Allow dragging of the icon only if the Dash would accept a drop to
// change favorite-apps. There are no other possible drop targets from // change favorite-apps. There are no other possible drop targets from
@ -541,13 +528,13 @@ var AllView = new Lang.Class({
// but we hope that is not used much. // but we hope that is not used much.
let favoritesWritable = global.settings.is_writable('favorite-apps'); let favoritesWritable = global.settings.is_writable('favorite-apps');
apps.forEach(Lang.bind(this, function(appId) { apps.forEach(appId => {
let app = appSys.lookup_app(appId); let app = appSys.lookup_app(appId);
let icon = new AppIcon(app, let icon = new AppIcon(app,
{ isDraggable: favoritesWritable }); { isDraggable: favoritesWritable });
this.addItem(icon); this.addItem(icon);
})); });
this.loadGrid(); this.loadGrid();
this._refilterApps(); this._refilterApps();
@ -556,24 +543,23 @@ var AllView = new Lang.Class({
// Overriden from BaseAppView // Overriden from BaseAppView
animate(animationDirection, onComplete) { animate(animationDirection, onComplete) {
this._scrollView.reactive = false; this._scrollView.reactive = false;
let completionFunc = Lang.bind(this, function() { let completionFunc = () => {
this._scrollView.reactive = true; this._scrollView.reactive = true;
if (onComplete) if (onComplete)
onComplete(); onComplete();
}); };
if (animationDirection == IconGrid.AnimationDirection.OUT && if (animationDirection == IconGrid.AnimationDirection.OUT &&
this._displayingPopup && this._currentPopup) { this._displayingPopup && this._currentPopup) {
this._currentPopup.popdown(); this._currentPopup.popdown();
let spaceClosedId = this._grid.connect('space-closed', Lang.bind(this, let spaceClosedId = this._grid.connect('space-closed', () => {
function() { this._grid.disconnect(spaceClosedId);
this._grid.disconnect(spaceClosedId); // Given that we can't call this.parent() inside the
// Given that we can't call this.parent() inside the // signal handler, call again animate which will
// signal handler, call again animate which will // call the parent given that popup is already
// call the parent given that popup is already // closed.
// closed. this.animate(animationDirection, completionFunc);
this.animate(animationDirection, completionFunc); });
}));
} else { } else {
this.parent(animationDirection, completionFunc); this.parent(animationDirection, completionFunc);
if (animationDirection == IconGrid.AnimationDirection.OUT) if (animationDirection == IconGrid.AnimationDirection.OUT)
@ -725,14 +711,13 @@ var AllView = new Lang.Class({
addFolderPopup(popup) { addFolderPopup(popup) {
this._stack.add_actor(popup.actor); this._stack.add_actor(popup.actor);
popup.connect('open-state-changed', Lang.bind(this, popup.connect('open-state-changed', (popup, isOpen) => {
function(popup, isOpen) { this._eventBlocker.reactive = isOpen;
this._eventBlocker.reactive = isOpen; this._currentPopup = isOpen ? popup : null;
this._currentPopup = isOpen ? popup : null; this._updateIconOpacities(isOpen);
this._updateIconOpacities(isOpen); if(!isOpen)
if(!isOpen) this._closeSpaceForPopup();
this._closeSpaceForPopup(); });
}));
}, },
_keyFocusIn(icon) { _keyFocusIn(icon) {
@ -779,11 +764,10 @@ var AllView = new Lang.Class({
if (this._availWidth != availWidth || this._availHeight != availHeight || oldNPages != this._grid.nPages()) { if (this._availWidth != availWidth || this._availHeight != availHeight || oldNPages != this._grid.nPages()) {
this._adjustment.value = 0; this._adjustment.value = 0;
this._grid.currentPage = 0; this._grid.currentPage = 0;
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
function() { this._pageIndicators.setNPages(this._grid.nPages());
this._pageIndicators.setNPages(this._grid.nPages()); this._pageIndicators.setCurrentPage(0);
this._pageIndicators.setCurrentPage(0); });
}));
} }
this._availWidth = availWidth; this._availWidth = availWidth;
@ -821,10 +805,10 @@ var FrequentView = new Lang.Class({
this._usage = Shell.AppUsage.get_default(); this._usage = Shell.AppUsage.get_default();
this.actor.connect('notify::mapped', Lang.bind(this, function() { this.actor.connect('notify::mapped', () => {
if (this.actor.mapped) if (this.actor.mapped)
this._redisplay(); this._redisplay();
})); });
}, },
hasUsefulData() { hasUsefulData() {
@ -951,18 +935,17 @@ var AppDisplay = new Lang.Class({
let layout = new ControlsBoxLayout({ homogeneous: true }); let layout = new ControlsBoxLayout({ homogeneous: true });
this._controls = new St.Widget({ style_class: 'app-view-controls', this._controls = new St.Widget({ style_class: 'app-view-controls',
layout_manager: layout }); layout_manager: layout });
this._controls.connect('notify::mapped', Lang.bind(this, this._controls.connect('notify::mapped', () => {
function() { // controls are faded either with their parent or
// controls are faded either with their parent or // explicitly in animate(); we can't know how they'll be
// explicitly in animate(); we can't know how they'll be // shown next, so make sure to restore their opacity
// shown next, so make sure to restore their opacity // when they are hidden
// when they are hidden if (this._controls.mapped)
if (this._controls.mapped) return;
return;
Tweener.removeTweens(this._controls); Tweener.removeTweens(this._controls);
this._controls.opacity = 255; this._controls.opacity = 255;
})); });
layout.hookup_style(this._controls); layout.hookup_style(this._controls);
this.actor.add_actor(new St.Bin({ child: this._controls })); this.actor.add_actor(new St.Bin({ child: this._controls }));
@ -972,11 +955,10 @@ var AppDisplay = new Lang.Class({
this._controls.add_actor(this._views[i].control); this._controls.add_actor(this._views[i].control);
let viewIndex = i; let viewIndex = i;
this._views[i].control.connect('clicked', Lang.bind(this, this._views[i].control.connect('clicked', actor => {
function(actor) { this._showView(viewIndex);
this._showView(viewIndex); global.settings.set_uint('app-picker-view', viewIndex);
global.settings.set_uint('app-picker-view', viewIndex); });
}));
} }
let initialView = Math.min(global.settings.get_uint('app-picker-view'), let initialView = Math.min(global.settings.get_uint('app-picker-view'),
this._views.length - 1); this._views.length - 1);
@ -989,10 +971,10 @@ var AppDisplay = new Lang.Class({
Gio.DBus.system.watch_name(SWITCHEROO_BUS_NAME, Gio.DBus.system.watch_name(SWITCHEROO_BUS_NAME,
Gio.BusNameWatcherFlags.NONE, Gio.BusNameWatcherFlags.NONE,
Lang.bind(this, this._switcherooProxyAppeared), Lang.bind(this, this._switcherooProxyAppeared),
Lang.bind(this, function() { () => {
this._switcherooProxy = null; this._switcherooProxy = null;
this._updateDiscreteGpuAvailable(); this._updateDiscreteGpuAvailable();
})); });
}, },
_updateDiscreteGpuAvailable() { _updateDiscreteGpuAvailable() {
@ -1004,13 +986,13 @@ var AppDisplay = new Lang.Class({
_switcherooProxyAppeared() { _switcherooProxyAppeared() {
this._switcherooProxy = new SwitcherooProxy(Gio.DBus.system, SWITCHEROO_BUS_NAME, SWITCHEROO_OBJECT_PATH, this._switcherooProxy = new SwitcherooProxy(Gio.DBus.system, SWITCHEROO_BUS_NAME, SWITCHEROO_OBJECT_PATH,
Lang.bind(this, function(proxy, error) { (proxy, error) => {
if (error) { if (error) {
log(error.message); log(error.message);
return; return;
} }
this._updateDiscreteGpuAvailable(); this._updateDiscreteGpuAvailable();
})); });
}, },
animate(animationDirection, onComplete) { animate(animationDirection, onComplete) {
@ -1053,9 +1035,7 @@ var AppDisplay = new Lang.Class({
let enabled = this._privacySettings.get_boolean('remember-app-usage'); let enabled = this._privacySettings.get_boolean('remember-app-usage');
this._views[Views.FREQUENT].control.visible = enabled; this._views[Views.FREQUENT].control.visible = enabled;
let visibleViews = this._views.filter(function(v) { let visibleViews = this._views.filter(v => v.control.visible);
return v.control.visible;
});
this._controls.visible = visibleViews.length > 1; this._controls.visible = visibleViews.length > 1;
if (!enabled && this._views[Views.FREQUENT].view.actor.visible) if (!enabled && this._views[Views.FREQUENT].view.actor.visible)
@ -1129,14 +1109,14 @@ var AppSearchProvider = new Lang.Class({
let groups = Shell.AppSystem.search(query); let groups = Shell.AppSystem.search(query);
let usage = Shell.AppUsage.get_default(); let usage = Shell.AppUsage.get_default();
let results = []; let results = [];
groups.forEach(function(group) { groups.forEach(group => {
group = group.filter(function(appID) { group = group.filter(appID => {
let app = Gio.DesktopAppInfo.new(appID); let app = Gio.DesktopAppInfo.new(appID);
return app && app.should_show(); return app && app.should_show();
}); });
results = results.concat(group.sort(function(a, b) { results = results.concat(group.sort(
return usage.compare('', a, b); (a, b) => usage.compare('', a, b)
})); ));
}); });
results = results.concat(this._systemActions.getMatchingActions(terms)); results = results.concat(this._systemActions.getMatchingActions(terms));
@ -1295,26 +1275,22 @@ var FolderIcon = new Lang.Class({
this.view = new FolderView(); this.view = new FolderView();
this.actor.connect('clicked', Lang.bind(this, this.actor.connect('clicked', () => {
function() { this._ensurePopup();
this._ensurePopup(); this.view.actor.vscroll.adjustment.value = 0;
this.view.actor.vscroll.adjustment.value = 0; this._openSpaceForPopup();
this._openSpaceForPopup(); });
})); this.actor.connect('notify::mapped', () => {
this.actor.connect('notify::mapped', Lang.bind(this, if (!this.actor.mapped && this._popup)
function() { this._popup.popdown();
if (!this.actor.mapped && this._popup) });
this._popup.popdown();
}));
this._folder.connect('changed', Lang.bind(this, this._redisplay)); this._folder.connect('changed', Lang.bind(this, this._redisplay));
this._redisplay(); this._redisplay();
}, },
getAppIds() { getAppIds() {
return this.view.getAllItems().map(function(item) { return this.view.getAllItems().map(item => item.id);
return item.id;
});
}, },
_updateName() { _updateName() {
@ -1334,7 +1310,7 @@ var FolderIcon = new Lang.Class({
let excludedApps = this._folder.get_strv('excluded-apps'); let excludedApps = this._folder.get_strv('excluded-apps');
let appSys = Shell.AppSystem.get_default(); let appSys = Shell.AppSystem.get_default();
let addAppId = (function addAppId(appId) { let addAppId = appId => {
if (excludedApps.indexOf(appId) >= 0) if (excludedApps.indexOf(appId) >= 0)
return; return;
@ -1347,13 +1323,13 @@ var FolderIcon = new Lang.Class({
let icon = new AppIcon(app); let icon = new AppIcon(app);
this.view.addItem(icon); this.view.addItem(icon);
}).bind(this); };
let folderApps = this._folder.get_strv('apps'); let folderApps = this._folder.get_strv('apps');
folderApps.forEach(addAppId); folderApps.forEach(addAppId);
let folderCategories = this._folder.get_strv('categories'); let folderCategories = this._folder.get_strv('categories');
Gio.AppInfo.get_all().forEach(function(appInfo) { Gio.AppInfo.get_all().forEach(appInfo => {
let appCategories = _getCategories(appInfo); let appCategories = _getCategories(appInfo);
if (!_listsIntersect(folderCategories, appCategories)) if (!_listsIntersect(folderCategories, appCategories))
return; return;
@ -1379,12 +1355,11 @@ var FolderIcon = new Lang.Class({
}, },
_openSpaceForPopup() { _openSpaceForPopup() {
let id = this._parentView.connect('space-ready', Lang.bind(this, let id = this._parentView.connect('space-ready', () => {
function() { this._parentView.disconnect(id);
this._parentView.disconnect(id); this._popup.popup();
this._popup.popup(); this._updatePopupPosition();
this._updatePopupPosition(); });
}));
this._parentView.openSpaceForPopup(this, this._boxPointerArrowside, this.view.nRowsDisplayedAtOnce()); this._parentView.openSpaceForPopup(this, this._boxPointerArrowside, this.view.nRowsDisplayedAtOnce());
}, },
@ -1424,11 +1399,10 @@ var FolderIcon = new Lang.Class({
if (!this._popup) { if (!this._popup) {
this._popup = new AppFolderPopup(this, this._boxPointerArrowside); this._popup = new AppFolderPopup(this, this._boxPointerArrowside);
this._parentView.addFolderPopup(this._popup); this._parentView.addFolderPopup(this._popup);
this._popup.connect('open-state-changed', Lang.bind(this, this._popup.connect('open-state-changed', (popup, isOpen) => {
function(popup, isOpen) { if (!isOpen)
if (!isOpen) this.actor.checked = false;
this.actor.checked = false; });
}));
} else { } else {
this._popup.updateArrowSide(this._boxPointerArrowside); this._popup.updateArrowSide(this._boxPointerArrowside);
} }
@ -1490,10 +1464,7 @@ var AppFolderPopup = new Lang.Class({
global.focus_manager.add_group(this.actor); global.focus_manager.add_group(this.actor);
source.actor.connect('destroy', Lang.bind(this, source.actor.connect('destroy', () => { this.actor.destroy(); });
function() {
this.actor.destroy();
}));
this._grabHelper = new GrabHelper.GrabHelper(this.actor); this._grabHelper = new GrabHelper.GrabHelper(this.actor);
this._grabHelper.addActor(Main.layoutManager.overviewGroup); this._grabHelper.addActor(Main.layoutManager.overviewGroup);
this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPress)); this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPress));
@ -1569,11 +1540,10 @@ var AppFolderPopup = new Lang.Class({
this._view.actor.opacity = 0; this._view.actor.opacity = 0;
this._boxPointer.show(BoxPointer.PopupAnimation.FADE | this._boxPointer.show(BoxPointer.PopupAnimation.FADE |
BoxPointer.PopupAnimation.SLIDE, BoxPointer.PopupAnimation.SLIDE,
Lang.bind(this, () => {
function() {
this._view.actor.opacity = 255; this._view.actor.opacity = 255;
this._view.animate(IconGrid.AnimationDirection.IN); this._view.animate(IconGrid.AnimationDirection.IN);
})); });
this.emit('open-state-changed', true); this.emit('open-state-changed', true);
}, },
@ -1663,28 +1633,24 @@ var AppIcon = new Lang.Class({
if (isDraggable) { if (isDraggable) {
this._draggable = DND.makeDraggable(this.actor); this._draggable = DND.makeDraggable(this.actor);
this._draggable.connect('drag-begin', Lang.bind(this, this._draggable.connect('drag-begin', () => {
function () { this._removeMenuTimeout();
this._removeMenuTimeout(); Main.overview.beginItemDrag(this);
Main.overview.beginItemDrag(this); });
})); this._draggable.connect('drag-cancelled', () => {
this._draggable.connect('drag-cancelled', Lang.bind(this, Main.overview.cancelledItemDrag(this);
function () { });
Main.overview.cancelledItemDrag(this); this._draggable.connect('drag-end', () => {
})); Main.overview.endItemDrag(this);
this._draggable.connect('drag-end', Lang.bind(this, });
function () {
Main.overview.endItemDrag(this);
}));
} }
this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
this._menuTimeoutId = 0; this._menuTimeoutId = 0;
this._stateChangedId = this.app.connect('notify::state', Lang.bind(this, this._stateChangedId = this.app.connect('notify::state', () => {
function () { this._updateRunningStyle();
this._updateRunningStyle(); });
}));
this._updateRunningStyle(); this._updateRunningStyle();
}, },
@ -1715,12 +1681,11 @@ var AppIcon = new Lang.Class({
_setPopupTimeout() { _setPopupTimeout() {
this._removeMenuTimeout(); this._removeMenuTimeout();
this._menuTimeoutId = Mainloop.timeout_add(MENU_POPUP_TIMEOUT, this._menuTimeoutId = Mainloop.timeout_add(MENU_POPUP_TIMEOUT, () => {
Lang.bind(this, function() { this._menuTimeoutId = 0;
this._menuTimeoutId = 0; this.popupMenu();
this.popupMenu(); return GLib.SOURCE_REMOVE;
return GLib.SOURCE_REMOVE; });
}));
GLib.Source.set_name_by_id(this._menuTimeoutId, '[gnome-shell] this.popupMenu'); GLib.Source.set_name_by_id(this._menuTimeoutId, '[gnome-shell] this.popupMenu');
}, },
@ -1770,15 +1735,17 @@ var AppIcon = new Lang.Class({
if (!this._menu) { if (!this._menu) {
this._menu = new AppIconMenu(this); this._menu = new AppIconMenu(this);
this._menu.connect('activate-window', Lang.bind(this, function (menu, window) { this._menu.connect('activate-window', (menu, window) => {
this.activateWindow(window); this.activateWindow(window);
})); });
this._menu.connect('open-state-changed', Lang.bind(this, function (menu, isPoppedUp) { this._menu.connect('open-state-changed', (menu, isPoppedUp) => {
if (!isPoppedUp) if (!isPoppedUp)
this._onMenuPoppedDown(); this._onMenuPoppedDown();
})); });
let id = Main.overview.connect('hiding', Lang.bind(this, function () { this._menu.close(); })); let id = Main.overview.connect('hiding', () => {
this.actor.connect('destroy', function() { this._menu.close();
});
this.actor.connect('destroy', () => {
Main.overview.disconnect(id); Main.overview.disconnect(id);
}); });
@ -1888,9 +1855,9 @@ var AppIconMenu = new Lang.Class({
_redisplay() { _redisplay() {
this.removeAll(); this.removeAll();
let windows = this._source.app.get_windows().filter(function(w) { let windows = this._source.app.get_windows().filter(
return !w.skip_taskbar; w => !w.skip_taskbar
}); );
// Display the app windows menu items and the separator between windows // Display the app windows menu items and the separator between windows
// of the current desktop and other windows. // of the current desktop and other windows.
@ -1904,9 +1871,9 @@ var AppIconMenu = new Lang.Class({
separatorShown = true; separatorShown = true;
} }
let item = this._appendMenuItem(window.title); let item = this._appendMenuItem(window.title);
item.connect('activate', Lang.bind(this, function() { item.connect('activate', () => {
this.emit('activate-window', window); this.emit('activate-window', window);
})); });
} }
if (!this._source.app.is_window_backed()) { if (!this._source.app.is_window_backed()) {
@ -1917,13 +1884,13 @@ var AppIconMenu = new Lang.Class({
if (this._source.app.can_open_new_window() && if (this._source.app.can_open_new_window() &&
actions.indexOf('new-window') == -1) { actions.indexOf('new-window') == -1) {
this._newWindowMenuItem = this._appendMenuItem(_("New Window")); this._newWindowMenuItem = this._appendMenuItem(_("New Window"));
this._newWindowMenuItem.connect('activate', Lang.bind(this, function() { this._newWindowMenuItem.connect('activate', () => {
if (this._source.app.state == Shell.AppState.STOPPED) if (this._source.app.state == Shell.AppState.STOPPED)
this._source.animateLaunch(); this._source.animateLaunch();
this._source.app.open_new_window(-1); this._source.app.open_new_window(-1);
this.emit('activate-window', null); this.emit('activate-window', null);
})); });
this._appendSeparator(); this._appendSeparator();
} }
@ -1931,22 +1898,22 @@ var AppIconMenu = new Lang.Class({
this._source.app.state == Shell.AppState.STOPPED && this._source.app.state == Shell.AppState.STOPPED &&
actions.indexOf('activate-discrete-gpu') == -1) { actions.indexOf('activate-discrete-gpu') == -1) {
this._onDiscreteGpuMenuItem = this._appendMenuItem(_("Launch using Dedicated Graphics Card")); this._onDiscreteGpuMenuItem = this._appendMenuItem(_("Launch using Dedicated Graphics Card"));
this._onDiscreteGpuMenuItem.connect('activate', Lang.bind(this, function() { this._onDiscreteGpuMenuItem.connect('activate', () => {
if (this._source.app.state == Shell.AppState.STOPPED) if (this._source.app.state == Shell.AppState.STOPPED)
this._source.animateLaunch(); this._source.animateLaunch();
this._source.app.launch(0, -1, true); this._source.app.launch(0, -1, true);
this.emit('activate-window', null); this.emit('activate-window', null);
})); });
} }
for (let i = 0; i < actions.length; i++) { for (let i = 0; i < actions.length; i++) {
let action = actions[i]; let action = actions[i];
let item = this._appendMenuItem(appInfo.get_action_name(action)); let item = this._appendMenuItem(appInfo.get_action_name(action));
item.connect('activate', Lang.bind(this, function(emitter, event) { item.connect('activate', (emitter, event) => {
this._source.app.launch_action(action, event.get_time(), -1); this._source.app.launch_action(action, event.get_time(), -1);
this.emit('activate-window', null); this.emit('activate-window', null);
})); });
} }
let canFavorite = global.settings.is_writable('favorite-apps'); let canFavorite = global.settings.is_writable('favorite-apps');
@ -1958,37 +1925,36 @@ var AppIconMenu = new Lang.Class({
if (isFavorite) { if (isFavorite) {
let item = this._appendMenuItem(_("Remove from Favorites")); let item = this._appendMenuItem(_("Remove from Favorites"));
item.connect('activate', Lang.bind(this, function() { item.connect('activate', () => {
let favs = AppFavorites.getAppFavorites(); let favs = AppFavorites.getAppFavorites();
favs.removeFavorite(this._source.app.get_id()); favs.removeFavorite(this._source.app.get_id());
})); });
} else { } else {
let item = this._appendMenuItem(_("Add to Favorites")); let item = this._appendMenuItem(_("Add to Favorites"));
item.connect('activate', Lang.bind(this, function() { item.connect('activate', () => {
let favs = AppFavorites.getAppFavorites(); let favs = AppFavorites.getAppFavorites();
favs.addFavorite(this._source.app.get_id()); favs.addFavorite(this._source.app.get_id());
})); });
} }
} }
if (Shell.AppSystem.get_default().lookup_app('org.gnome.Software.desktop')) { if (Shell.AppSystem.get_default().lookup_app('org.gnome.Software.desktop')) {
this._appendSeparator(); this._appendSeparator();
let item = this._appendMenuItem(_("Show Details")); let item = this._appendMenuItem(_("Show Details"));
item.connect('activate', Lang.bind(this, function() { item.connect('activate', () => {
let id = this._source.app.get_id(); let id = this._source.app.get_id();
let args = GLib.Variant.new('(ss)', [id, '']); let args = GLib.Variant.new('(ss)', [id, '']);
Gio.DBus.get(Gio.BusType.SESSION, null, Gio.DBus.get(Gio.BusType.SESSION, null, (o, res) => {
function(o, res) { let bus = Gio.DBus.get_finish(res);
let bus = Gio.DBus.get_finish(res); bus.call('org.gnome.Software',
bus.call('org.gnome.Software', '/org/gnome/Software',
'/org/gnome/Software', 'org.gtk.Actions', 'Activate',
'org.gtk.Actions', 'Activate', GLib.Variant.new('(sava{sv})',
GLib.Variant.new('(sava{sv})', ['details', [args], null]),
['details', [args], null]), null, 0, -1, null, null);
null, 0, -1, null, null); Main.overview.hide();
Main.overview.hide(); });
}); });
}));
} }
} }
}, },

View File

@ -66,7 +66,7 @@ var AppFavorites = new Lang.Class({
// Map old desktop file names to the current ones // Map old desktop file names to the current ones
let updated = false; let updated = false;
ids = ids.map(function (id) { ids = ids.map(id => {
let newId = RENAMED_DESKTOP_IDS[id]; let newId = RENAMED_DESKTOP_IDS[id];
if (newId !== undefined && if (newId !== undefined &&
appSys.lookup_app(newId) != null) { appSys.lookup_app(newId) != null) {
@ -79,11 +79,8 @@ var AppFavorites = new Lang.Class({
if (updated) if (updated)
global.settings.set_strv(this.FAVORITE_APPS_KEY, ids); global.settings.set_strv(this.FAVORITE_APPS_KEY, ids);
let apps = ids.map(function (id) { let apps = ids.map(id => appSys.lookup_app(id))
return appSys.lookup_app(id); .filter(app => app != null);
}).filter(function (app) {
return app != null;
});
this._favorites = {}; this._favorites = {};
for (let i = 0; i < apps.length; i++) { for (let i = 0; i < apps.length; i++) {
let app = apps[i]; let app = apps[i];
@ -140,9 +137,9 @@ var AppFavorites = new Lang.Class({
Main.overview.setMessage(_("%s has been added to your favorites.").format(app.get_name()), Main.overview.setMessage(_("%s has been added to your favorites.").format(app.get_name()),
{ forFeedback: true, { forFeedback: true,
undoCallback: Lang.bind(this, function () { undoCallback: () => {
this._removeFavorite(appId); this._removeFavorite(appId);
}) }
}); });
}, },
@ -159,7 +156,7 @@ var AppFavorites = new Lang.Class({
if (!appId in this._favorites) if (!appId in this._favorites)
return false; return false;
let ids = this._getIds().filter(function (id) { return id != appId; }); let ids = this._getIds().filter(id => id != appId);
global.settings.set_strv(this.FAVORITE_APPS_KEY, ids); global.settings.set_strv(this.FAVORITE_APPS_KEY, ids);
return true; return true;
}, },
@ -174,9 +171,9 @@ var AppFavorites = new Lang.Class({
Main.overview.setMessage(_("%s has been removed from your favorites.").format(app.get_name()), Main.overview.setMessage(_("%s has been removed from your favorites.").format(app.get_name()),
{ forFeedback: true, { forFeedback: true,
undoCallback: Lang.bind(this, function () { undoCallback: () => {
this._addFavorite(appId, pos); this._addFavorite(appId, pos);
}) }
}); });
} }
}); });

View File

@ -101,13 +101,11 @@ var AudioDeviceSelectionDialog = new Lang.Class({
_addDevice(device) { _addDevice(device) {
let box = new St.BoxLayout({ style_class: 'audio-selection-device-box', let box = new St.BoxLayout({ style_class: 'audio-selection-device-box',
vertical: true }); vertical: true });
box.connect('notify::height', box.connect('notify::height', () => {
function() { Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, box.width = box.height;
function() {
box.width = box.height;
});
}); });
});
let icon = new St.Icon({ style_class: 'audio-selection-device-icon', let icon = new St.Icon({ style_class: 'audio-selection-device-icon',
icon_name: this._getDeviceIcon(device) }); icon_name: this._getDeviceIcon(device) });
@ -123,12 +121,11 @@ var AudioDeviceSelectionDialog = new Lang.Class({
child: box }); child: box });
this._selectionBox.add(button); this._selectionBox.add(button);
button.connect('clicked', Lang.bind(this, button.connect('clicked', () => {
function() { this.emit('device-selected', device);
this.emit('device-selected', device); this.close();
this.close(); Main.overview.hide();
Main.overview.hide(); });
}));
}, },
_openSettings() { _openSettings() {
@ -166,9 +163,8 @@ var AudioDeviceSelectionDBus = new Lang.Class({
let connection = this._dbusImpl.get_connection(); let connection = this._dbusImpl.get_connection();
let info = this._dbusImpl.get_info(); let info = this._dbusImpl.get_info();
let deviceName = Object.keys(AudioDevice).filter( let deviceName = Object.keys(AudioDevice).filter(
function(dev) { dev => AudioDevice[dev] == device
return AudioDevice[dev] == device; )[0].toLowerCase();
})[0].toLowerCase();
connection.emit_signal(this._audioSelectionDialog._sender, connection.emit_signal(this._audioSelectionDialog._sender,
this._dbusImpl.get_object_path(), this._dbusImpl.get_object_path(),
info ? info.name : null, info ? info.name : null,
@ -184,9 +180,7 @@ var AudioDeviceSelectionDBus = new Lang.Class({
let [deviceNames] = params; let [deviceNames] = params;
let devices = 0; let devices = 0;
deviceNames.forEach(function(n) { deviceNames.forEach(n => { devices |= AudioDevice[n.toUpperCase()]; });
devices |= AudioDevice[n.toUpperCase()];
});
let dialog; let dialog;
try { try {

View File

@ -154,13 +154,13 @@ var BackgroundCache = new Lang.Class({
let monitor = file.monitor(Gio.FileMonitorFlags.NONE, null); let monitor = file.monitor(Gio.FileMonitorFlags.NONE, null);
monitor.connect('changed', monitor.connect('changed',
Lang.bind(this, function(obj, file, otherFile, eventType) { (obj, file, otherFile, eventType) => {
// Ignore CHANGED and CREATED events, since in both cases // Ignore CHANGED and CREATED events, since in both cases
// we'll get a CHANGES_DONE_HINT event when done. // we'll get a CHANGES_DONE_HINT event when done.
if (eventType != Gio.FileMonitorEvent.CHANGED && if (eventType != Gio.FileMonitorEvent.CHANGED &&
eventType != Gio.FileMonitorEvent.CREATED) eventType != Gio.FileMonitorEvent.CREATED)
this.emit('file-changed', file); this.emit('file-changed', file);
})); });
this._fileMonitors[key] = monitor; this._fileMonitors[key] = monitor;
}, },
@ -173,10 +173,10 @@ var BackgroundCache = new Lang.Class({
let animation = this._animations[params.settingsSchema]; let animation = this._animations[params.settingsSchema];
if (animation && _fileEqual0(animation.file, params.file)) { if (animation && _fileEqual0(animation.file, params.file)) {
if (params.onLoaded) { if (params.onLoaded) {
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, function() { let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
params.onLoaded(this._animations[params.settingsSchema]); params.onLoaded(this._animations[params.settingsSchema]);
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); });
GLib.Source.set_name_by_id(id, '[gnome-shell] params.onLoaded'); GLib.Source.set_name_by_id(id, '[gnome-shell] params.onLoaded');
} }
return; return;
@ -184,17 +184,17 @@ var BackgroundCache = new Lang.Class({
animation = new Animation({ file: params.file }); animation = new Animation({ file: params.file });
animation.load(Lang.bind(this, function() { animation.load(() => {
this._animations[params.settingsSchema] = animation; this._animations[params.settingsSchema] = animation;
if (params.onLoaded) { if (params.onLoaded) {
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, function() { let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
params.onLoaded(this._animations[params.settingsSchema]); params.onLoaded(this._animations[params.settingsSchema]);
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); });
GLib.Source.set_name_by_id(id, '[gnome-shell] params.onLoaded'); GLib.Source.set_name_by_id(id, '[gnome-shell] params.onLoaded');
} }
})); });
}, },
getBackgroundSource(layoutManager, settingsSchema) { getBackgroundSource(layoutManager, settingsSchema) {
@ -254,10 +254,10 @@ var Background = new Lang.Class({
this._clock = new GnomeDesktop.WallClock(); this._clock = new GnomeDesktop.WallClock();
this._timezoneChangedId = this._clock.connect('notify::timezone', this._timezoneChangedId = this._clock.connect('notify::timezone',
Lang.bind(this, function() { () => {
if (this._animation) if (this._animation)
this._loadAnimation(this._animation.file); this._loadAnimation(this._animation.file);
})); });
let loginManager = LoginManager.getLoginManager(); let loginManager = LoginManager.getLoginManager();
this._prepareForSleepId = loginManager.connect('prepare-for-sleep', this._prepareForSleepId = loginManager.connect('prepare-for-sleep',
@ -267,9 +267,9 @@ var Background = new Lang.Class({
this._refreshAnimation(); this._refreshAnimation();
}); });
this._settingsChangedSignalId = this._settings.connect('changed', Lang.bind(this, function() { this._settingsChangedSignalId = this._settings.connect('changed', () => {
this.emit('changed'); this.emit('changed');
})); });
this._load(); this._load();
}, },
@ -319,10 +319,10 @@ var Background = new Lang.Class({
this.isLoaded = true; this.isLoaded = true;
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, function() { let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
this.emit('loaded'); this.emit('loaded');
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); });
GLib.Source.set_name_by_id(id, '[gnome-shell] this.emit'); GLib.Source.set_name_by_id(id, '[gnome-shell] this.emit');
}, },
@ -349,13 +349,13 @@ var Background = new Lang.Class({
this._cache.monitorFile(file); this._cache.monitorFile(file);
let signalId = this._cache.connect('file-changed', let signalId = this._cache.connect('file-changed',
Lang.bind(this, function(cache, changedFile) { (cache, changedFile) => {
if (changedFile.equal(file)) { if (changedFile.equal(file)) {
let imageCache = Meta.BackgroundImageCache.get_default(); let imageCache = Meta.BackgroundImageCache.get_default();
imageCache.purge(changedFile); imageCache.purge(changedFile);
this.emit('changed'); this.emit('changed');
} }
})); });
this._fileWatches[key] = signalId; this._fileWatches[key] = signalId;
}, },
@ -372,7 +372,7 @@ var Background = new Lang.Class({
this._animation.update(this._layoutManager.monitors[this._monitorIndex]); this._animation.update(this._layoutManager.monitors[this._monitorIndex]);
let files = this._animation.keyFrameFiles; let files = this._animation.keyFrameFiles;
let finish = Lang.bind(this, function() { let finish = () => {
this._setLoaded(); this._setLoaded();
if (files.length > 1) { if (files.length > 1) {
this.background.set_blend(files[0], files[1], this.background.set_blend(files[0], files[1],
@ -384,7 +384,7 @@ var Background = new Lang.Class({
this.background.set_file(null, this._style); this.background.set_file(null, this._style);
} }
this._queueUpdateAnimation(); this._queueUpdateAnimation();
}); };
let cache = Meta.BackgroundImageCache.get_default(); let cache = Meta.BackgroundImageCache.get_default();
let numPendingImages = files.length; let numPendingImages = files.length;
@ -396,13 +396,12 @@ var Background = new Lang.Class({
if (numPendingImages == 0) if (numPendingImages == 0)
finish(); finish();
} else { } else {
let id = image.connect('loaded', let id = image.connect('loaded', () => {
Lang.bind(this, function() { image.disconnect(id);
image.disconnect(id); numPendingImages--;
numPendingImages--; if (numPendingImages == 0)
if (numPendingImages == 0) finish();
finish(); });
}));
} }
} }
}, },
@ -428,18 +427,18 @@ var Background = new Lang.Class({
this._updateAnimationTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, this._updateAnimationTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
interval, interval,
Lang.bind(this, function() { () => {
this._updateAnimationTimeoutId = 0; this._updateAnimationTimeoutId = 0;
this._updateAnimation(); this._updateAnimation();
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); });
GLib.Source.set_name_by_id(this._updateAnimationTimeoutId, '[gnome-shell] this._updateAnimation'); GLib.Source.set_name_by_id(this._updateAnimationTimeoutId, '[gnome-shell] this._updateAnimation');
}, },
_loadAnimation(file) { _loadAnimation(file) {
this._cache.getAnimation({ file: file, this._cache.getAnimation({ file: file,
settingsSchema: this._settings.schema_id, settingsSchema: this._settings.schema_id,
onLoaded: Lang.bind(this, function(animation) { onLoaded: animation => {
this._animation = animation; this._animation = animation;
if (!this._animation || this._cancellable.is_cancelled()) { if (!this._animation || this._cancellable.is_cancelled()) {
@ -449,7 +448,7 @@ var Background = new Lang.Class({
this._updateAnimation(); this._updateAnimation();
this._watchFile(file); this._watchFile(file);
}) }
}); });
}, },
@ -462,11 +461,10 @@ var Background = new Lang.Class({
if (image.is_loaded()) if (image.is_loaded())
this._setLoaded(); this._setLoaded();
else { else {
let id = image.connect('loaded', let id = image.connect('loaded', () => {
Lang.bind(this, function() { this._setLoaded();
this._setLoaded(); image.disconnect(id);
image.disconnect(id); });
}));
} }
}, },
@ -514,18 +512,17 @@ var SystemBackground = new Lang.Class({
let image = cache.load(file); let image = cache.load(file);
if (image.is_loaded()) { if (image.is_loaded()) {
image = null; image = null;
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, function() { let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
this.emit('loaded'); this.emit('loaded');
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); });
GLib.Source.set_name_by_id(id, '[gnome-shell] SystemBackground.loaded'); GLib.Source.set_name_by_id(id, '[gnome-shell] SystemBackground.loaded');
} else { } else {
let id = image.connect('loaded', let id = image.connect('loaded', () => {
Lang.bind(this, function() { this.emit('loaded');
this.emit('loaded'); image.disconnect(id);
image.disconnect(id); image = null;
image = null; });
}));
} }
}, },
}); });
@ -594,11 +591,11 @@ var BackgroundSource = new Lang.Class({
style: style style: style
}); });
background._changedId = background.connect('changed', Lang.bind(this, function() { background._changedId = background.connect('changed', () => {
background.disconnect(background._changedId); background.disconnect(background._changedId);
background.destroy(); background.destroy();
delete this._backgrounds[monitorIndex]; delete this._backgrounds[monitorIndex];
})); });
this._backgrounds[monitorIndex] = background; this._backgrounds[monitorIndex] = background;
} }
@ -635,13 +632,11 @@ var Animation = new Lang.Class({
load(callback) { load(callback) {
this._show = new GnomeDesktop.BGSlideShow({ filename: this.file.get_path() }); this._show = new GnomeDesktop.BGSlideShow({ filename: this.file.get_path() });
this._show.load_async(null, this._show.load_async(null, (object, result) => {
Lang.bind(this, this.loaded = true;
function(object, result) { if (callback)
this.loaded = true; callback();
if (callback) });
callback();
}));
}, },
update(monitor) { update(monitor) {
@ -745,13 +740,12 @@ var BackgroundManager = new Lang.Class({
this._swapBackgroundActor(); this._swapBackgroundActor();
} else { } else {
newBackgroundActor.loadedSignalId = background.connect('loaded', newBackgroundActor.loadedSignalId = background.connect('loaded',
Lang.bind(this, function() { () => {
background.disconnect(newBackgroundActor.loadedSignalId); background.disconnect(newBackgroundActor.loadedSignalId);
newBackgroundActor.loadedSignalId = 0; newBackgroundActor.loadedSignalId = 0;
this._swapBackgroundActor(); this._swapBackgroundActor();
});
}));
} }
}, },
@ -775,19 +769,19 @@ var BackgroundManager = new Lang.Class({
backgroundActor.lower_bottom(); backgroundActor.lower_bottom();
} }
let changeSignalId = background.connect('changed', Lang.bind(this, function() { let changeSignalId = background.connect('changed', () => {
background.disconnect(changeSignalId); background.disconnect(changeSignalId);
changeSignalId = null; changeSignalId = null;
this._updateBackgroundActor(); this._updateBackgroundActor();
})); });
backgroundActor.connect('destroy', Lang.bind(this, function() { backgroundActor.connect('destroy', () => {
if (changeSignalId) if (changeSignalId)
background.disconnect(changeSignalId); background.disconnect(changeSignalId);
if (backgroundActor.loadedSignalId) if (backgroundActor.loadedSignalId)
background.disconnect(backgroundActor.loadedSignalId); background.disconnect(backgroundActor.loadedSignalId);
})); });
return backgroundActor; return backgroundActor;
}, },

View File

@ -40,7 +40,7 @@ function addBackgroundMenu(actor, layoutManager) {
} }
let clickAction = new Clutter.ClickAction(); let clickAction = new Clutter.ClickAction();
clickAction.connect('long-press', function(action, actor, state) { clickAction.connect('long-press', (action, actor, state) => {
if (state == Clutter.LongPressState.QUERY) if (state == Clutter.LongPressState.QUERY)
return ((action.get_button() == 0 || return ((action.get_button() == 0 ||
action.get_button() == 1) && action.get_button() == 1) &&
@ -52,7 +52,7 @@ function addBackgroundMenu(actor, layoutManager) {
} }
return true; return true;
}); });
clickAction.connect('clicked', function(action) { clickAction.connect('clicked', action => {
if (action.get_button() == 3) { if (action.get_button() == 3) {
let [x, y] = action.get_coords(); let [x, y] = action.get_coords();
openMenu(x, y); openMenu(x, y);
@ -60,11 +60,11 @@ function addBackgroundMenu(actor, layoutManager) {
}); });
actor.add_action(clickAction); actor.add_action(clickAction);
let grabOpBeginId = global.display.connect('grab-op-begin', function () { let grabOpBeginId = global.display.connect('grab-op-begin', () => {
clickAction.release(); clickAction.release();
}); });
actor.connect('destroy', function() { actor.connect('destroy', () => {
actor._backgroundMenu.destroy(); actor._backgroundMenu.destroy();
actor._backgroundMenu = null; actor._backgroundMenu = null;
actor._backgroundManager = null; actor._backgroundManager = null;

View File

@ -69,7 +69,7 @@ var BoxPointer = new Lang.Class({
_muteInput() { _muteInput() {
if (this._capturedEventId == 0) if (this._capturedEventId == 0)
this._capturedEventId = this.actor.connect('captured-event', this._capturedEventId = this.actor.connect('captured-event',
function() { return Clutter.EVENT_STOP; }); () => Clutter.EVENT_STOP);
}, },
_unmuteInput() { _unmuteInput() {
@ -112,11 +112,11 @@ var BoxPointer = new Lang.Class({
xOffset: 0, xOffset: 0,
yOffset: 0, yOffset: 0,
transition: 'linear', transition: 'linear',
onComplete: Lang.bind(this, function() { onComplete: () => {
this._unmuteInput(); this._unmuteInput();
if (onComplete) if (onComplete)
onComplete(); onComplete();
}), },
time: animationTime }); time: animationTime });
}, },
@ -156,14 +156,14 @@ var BoxPointer = new Lang.Class({
yOffset: yOffset, yOffset: yOffset,
transition: 'linear', transition: 'linear',
time: animationTime, time: animationTime,
onComplete: Lang.bind(this, function () { onComplete: () => {
this.actor.hide(); this.actor.hide();
this.opacity = 0; this.opacity = 0;
this.xOffset = 0; this.xOffset = 0;
this.yOffset = 0; this.yOffset = 0;
if (onComplete) if (onComplete)
onComplete(); onComplete();
}) }
}); });
}, },
@ -623,10 +623,10 @@ var BoxPointer = new Lang.Class({
if (this._arrowSide != arrowSide) { if (this._arrowSide != arrowSide) {
this._arrowSide = arrowSide; this._arrowSide = arrowSide;
this._reposition(); this._reposition();
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() { Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
this._container.queue_relayout(); this._container.queue_relayout();
return false; return false;
})); });
this.emit('arrow-side-changed'); this.emit('arrow-side-changed');
} }

View File

@ -21,7 +21,7 @@ var ELLIPSIS_CHAR = '\u2026';
var MESSAGE_ICON_SIZE = -1; // pick up from CSS var MESSAGE_ICON_SIZE = -1; // pick up from CSS
var NC_ = function(context, str) { return context + '\u0004' + str; }; var NC_ = (context, str) => context + '\u0004' + str;
function sameYear(dateA, dateB) { function sameYear(dateA, dateB) {
return (dateA.getYear() == dateB.getYear()); return (dateA.getYear() == dateB.getYear());
@ -188,14 +188,13 @@ var DBusEventSource = new Lang.Class({
let savedState = global.get_persistent_state('as', 'ignored_events'); let savedState = global.get_persistent_state('as', 'ignored_events');
if (savedState) if (savedState)
savedState.deep_unpack().forEach(Lang.bind(this, savedState.deep_unpack().forEach(eventId => {
function(eventId) { this._ignoredEvents.set(eventId, true);
this._ignoredEvents.set(eventId, true); });
}));
this._initialized = false; this._initialized = false;
this._dbusProxy = new CalendarServer(); this._dbusProxy = new CalendarServer();
this._dbusProxy.init_async(GLib.PRIORITY_DEFAULT, null, Lang.bind(this, function(object, result) { this._dbusProxy.init_async(GLib.PRIORITY_DEFAULT, null, (object, result) => {
let loaded = false; let loaded = false;
try { try {
@ -218,23 +217,23 @@ var DBusEventSource = new Lang.Class({
this._dbusProxy.connectSignal('Changed', Lang.bind(this, this._onChanged)); this._dbusProxy.connectSignal('Changed', Lang.bind(this, this._onChanged));
this._dbusProxy.connect('notify::g-name-owner', Lang.bind(this, function() { this._dbusProxy.connect('notify::g-name-owner', () => {
if (this._dbusProxy.g_name_owner) if (this._dbusProxy.g_name_owner)
this._onNameAppeared(); this._onNameAppeared();
else else
this._onNameVanished(); this._onNameVanished();
})); });
this._dbusProxy.connect('g-properties-changed', Lang.bind(this, function() { this._dbusProxy.connect('g-properties-changed', () => {
this.emit('notify::has-calendars'); this.emit('notify::has-calendars');
})); });
this._initialized = loaded; this._initialized = loaded;
if (loaded) { if (loaded) {
this.emit('notify::has-calendars'); this.emit('notify::has-calendars');
this._onNameAppeared(); this._onNameAppeared();
} }
})); });
}, },
destroy() { destroy() {
@ -283,9 +282,7 @@ var DBusEventSource = new Lang.Class({
let event = new CalendarEvent(id, date, end, summary, allDay); let event = new CalendarEvent(id, date, end, summary, allDay);
newEvents.push(event); newEvents.push(event);
} }
newEvents.sort(function(event1, event2) { newEvents.sort((ev1, ev2) => ev1.date.getTime() - ev2.date.getTime());
return event1.date.getTime() - event2.date.getTime();
});
} }
this._events = newEvents; this._events = newEvents;
@ -340,7 +337,7 @@ var DBusEventSource = new Lang.Class({
result.push(event); result.push(event);
} }
} }
result.sort(function(event1, event2) { result.sort((event1, event2) => {
// sort events by end time on ending day // sort events by end time on ending day
let d1 = event1.date < begin && event1.end <= end ? event1.end : event1.date; let d1 = event1.date < begin && event1.end <= end ? event1.end : event1.date;
let d2 = event2.date < begin && event2.end <= end ? event2.end : event2.date; let d2 = event2.date < begin && event2.end <= end ? event2.end : event2.date;
@ -410,10 +407,10 @@ var Calendar = new Lang.Class({
// requestRange(), getEvents(), hasEvents() methods and the ::changed signal. // requestRange(), getEvents(), hasEvents() methods and the ::changed signal.
setEventSource(eventSource) { setEventSource(eventSource) {
this._eventSource = eventSource; this._eventSource = eventSource;
this._eventSource.connect('changed', Lang.bind(this, function() { this._eventSource.connect('changed', () => {
this._rebuildCalendar(); this._rebuildCalendar();
this._update(); this._update();
})); });
this._rebuildCalendar(); this._rebuildCalendar();
this._update(); this._update();
}, },
@ -617,11 +614,11 @@ var Calendar = new Lang.Class({
button.reactive = false; button.reactive = false;
button._date = new Date(iter); button._date = new Date(iter);
button.connect('clicked', Lang.bind(this, function() { button.connect('clicked', () => {
this._shouldDateGrabFocus = true; this._shouldDateGrabFocus = true;
this.setDate(button._date); this.setDate(button._date);
this._shouldDateGrabFocus = false; this._shouldDateGrabFocus = false;
})); });
let hasEvents = this._eventSource.hasEvents(iter); let hasEvents = this._eventSource.hasEvents(iter);
let styleClass = 'calendar-day-base calendar-day'; let styleClass = 'calendar-day-base calendar-day';
@ -691,7 +688,7 @@ var Calendar = new Lang.Class({
if (!this._calendarBegin || !sameMonth(this._selectedDate, this._calendarBegin) || !sameDay(now, this._markedAsToday)) if (!this._calendarBegin || !sameMonth(this._selectedDate, this._calendarBegin) || !sameDay(now, this._markedAsToday))
this._rebuildCalendar(); this._rebuildCalendar();
this._buttons.forEach(Lang.bind(this, function(button) { this._buttons.forEach(button => {
if (sameDay(button._date, this._selectedDate)) { if (sameDay(button._date, this._selectedDate)) {
button.add_style_pseudo_class('selected'); button.add_style_pseudo_class('selected');
if (this._shouldDateGrabFocus) if (this._shouldDateGrabFocus)
@ -699,7 +696,7 @@ var Calendar = new Lang.Class({
} }
else else
button.remove_style_pseudo_class('selected'); button.remove_style_pseudo_class('selected');
})); });
} }
}); });
Signals.addSignalMethods(Calendar.prototype); Signals.addSignalMethods(Calendar.prototype);
@ -773,16 +770,14 @@ var NotificationMessage = new Lang.Class({
this.setIcon(this._getIcon()); this.setIcon(this._getIcon());
this.connect('close', Lang.bind(this, this.connect('close', () => {
function() { this._closed = true;
this._closed = true; this.notification.destroy(MessageTray.NotificationDestroyedReason.DISMISSED);
this.notification.destroy(MessageTray.NotificationDestroyedReason.DISMISSED); });
})); this._destroyId = notification.connect('destroy', () => {
this._destroyId = notification.connect('destroy', Lang.bind(this, if (!this._closed)
function() { this.close();
if (!this._closed) });
this.close();
}));
this._updatedId = notification.connect('updated', this._updatedId = notification.connect('updated',
Lang.bind(this, this._onUpdated)); Lang.bind(this, this._onUpdated));
}, },
@ -890,9 +885,9 @@ var EventsSection = new Lang.Class({
let event = events[i]; let event = events[i];
let message = new EventMessage(event, this._date); let message = new EventMessage(event, this._date);
message.connect('close', Lang.bind(this, function() { message.connect('close', () => {
this._ignoreEvent(event); this._ignoreEvent(event);
})); });
this.addMessage(message, false); this.addMessage(message, false);
} }
@ -912,7 +907,7 @@ var EventsSection = new Lang.Class({
let apps = Gio.AppInfo.get_recommended_for_type('text/calendar'); let apps = Gio.AppInfo.get_recommended_for_type('text/calendar');
if (apps && (apps.length > 0)) { if (apps && (apps.length > 0)) {
let app = Gio.AppInfo.get_default_for_type('text/calendar', false); let app = Gio.AppInfo.get_default_for_type('text/calendar', false);
let defaultInRecommended = apps.some(function(a) { return a.equal(app); }); let defaultInRecommended = apps.some(a => a.equal(app));
this._calendarApp = defaultInRecommended ? app : apps[0]; this._calendarApp = defaultInRecommended ? app : apps[0];
} else { } else {
this._calendarApp = null; this._calendarApp = null;
@ -959,9 +954,9 @@ var NotificationSection = new Lang.Class({
this._nUrgent = 0; this._nUrgent = 0;
Main.messageTray.connect('source-added', Lang.bind(this, this._sourceAdded)); Main.messageTray.connect('source-added', Lang.bind(this, this._sourceAdded));
Main.messageTray.getSources().forEach(Lang.bind(this, function(source) { Main.messageTray.getSources().forEach(source => {
this._sourceAdded(Main.messageTray, source); this._sourceAdded(Main.messageTray, source);
})); });
this.actor.connect('notify::mapped', Lang.bind(this, this._onMapped)); this.actor.connect('notify::mapped', Lang.bind(this, this._onMapped));
}, },
@ -988,9 +983,9 @@ var NotificationSection = new Lang.Class({
notificationAddedId: 0, notificationAddedId: 0,
}; };
obj.destroyId = source.connect('destroy', Lang.bind(this, function(source) { obj.destroyId = source.connect('destroy', source => {
this._onSourceDestroy(source, obj); this._onSourceDestroy(source, obj);
})); });
obj.notificationAddedId = source.connect('notification-added', obj.notificationAddedId = source.connect('notification-added',
Lang.bind(this, this._onNotificationAdded)); Lang.bind(this, this._onNotificationAdded));
@ -1003,18 +998,16 @@ var NotificationSection = new Lang.Class({
let isUrgent = notification.urgency == MessageTray.Urgency.CRITICAL; let isUrgent = notification.urgency == MessageTray.Urgency.CRITICAL;
let updatedId = notification.connect('updated', Lang.bind(this, let updatedId = notification.connect('updated', () => {
function() { message.setSecondaryActor(this._createTimeLabel(notification.datetime));
message.setSecondaryActor(this._createTimeLabel(notification.datetime)); this.moveMessage(message, isUrgent ? 0 : this._nUrgent, this.actor.mapped);
this.moveMessage(message, isUrgent ? 0 : this._nUrgent, this.actor.mapped); });
})); let destroyId = notification.connect('destroy', () => {
let destroyId = notification.connect('destroy', Lang.bind(this, notification.disconnect(destroyId);
function() { notification.disconnect(updatedId);
notification.disconnect(destroyId); if (isUrgent)
notification.disconnect(updatedId); this._nUrgent--;
if (isUrgent) });
this._nUrgent--;
}));
if (isUrgent) { if (isUrgent) {
// Keep track of urgent notifications to keep them on top // Keep track of urgent notifications to keep them on top
@ -1157,10 +1150,9 @@ var CalendarMessageList = new Lang.Class({
canClearChangedId: 0, canClearChangedId: 0,
keyFocusId: 0 keyFocusId: 0
}; };
obj.destroyId = section.actor.connect('destroy', Lang.bind(this, obj.destroyId = section.actor.connect('destroy', () => {
function() { this._removeSection(section);
this._removeSection(section); });
}));
obj.visibleId = section.actor.connect('notify::visible', obj.visibleId = section.actor.connect('notify::visible',
Lang.bind(this, this._sync)); Lang.bind(this, this._sync));
obj.emptyChangedId = section.connect('empty-changed', obj.emptyChangedId = section.connect('empty-changed',
@ -1194,22 +1186,16 @@ var CalendarMessageList = new Lang.Class({
_sync() { _sync() {
let sections = [...this._sections.keys()]; let sections = [...this._sections.keys()];
let visible = sections.some(function(s) { let visible = sections.some(s => s.allowed);
return s.allowed;
});
this.actor.visible = visible; this.actor.visible = visible;
if (!visible) if (!visible)
return; return;
let empty = sections.every(function(s) { let empty = sections.every(s => s.empty || !s.actor.visible);
return s.empty || !s.actor.visible;
});
this._placeholder.actor.visible = empty; this._placeholder.actor.visible = empty;
this._clearButton.visible = !empty; this._clearButton.visible = !empty;
let canClear = sections.some(function(s) { let canClear = sections.some(s => s.canClear && s.actor.visible);
return s.canClear && s.actor.visible;
});
this._clearButton.reactive = canClear; this._clearButton.reactive = canClear;
}, },

View File

@ -107,9 +107,9 @@ var CloseDialog = new Lang.Class({
{ scale_y: 1, { scale_y: 1,
transition: 'linear', transition: 'linear',
time: DIALOG_TRANSITION_TIME, time: DIALOG_TRANSITION_TIME,
onComplete: Lang.bind(this, function () { onComplete: () => {
Main.layoutManager.trackChrome(this._dialog, { affectsInputRegion: true }); Main.layoutManager.trackChrome(this._dialog, { affectsInputRegion: true });
}) }
}); });
}, },
@ -125,9 +125,9 @@ var CloseDialog = new Lang.Class({
{ scale_y: 0, { scale_y: 0,
transition: 'linear', transition: 'linear',
time: DIALOG_TRANSITION_TIME, time: DIALOG_TRANSITION_TIME,
onComplete: Lang.bind(this, function () { onComplete: () => {
dialog.destroy(); dialog.destroy();
}) }
}); });
}, },

View File

@ -16,17 +16,17 @@ var ComponentManager = new Lang.Class({
_sessionUpdated() { _sessionUpdated() {
let newEnabledComponents = Main.sessionMode.components; let newEnabledComponents = Main.sessionMode.components;
newEnabledComponents.filter(Lang.bind(this, function(name) { newEnabledComponents.filter(
return this._enabledComponents.indexOf(name) == -1; name => this._enabledComponents.indexOf(name) == -1
})).forEach(Lang.bind(this, function(name) { ).forEach(name => {
this._enableComponent(name); this._enableComponent(name);
})); });
this._enabledComponents.filter(Lang.bind(this, function(name) { this._enabledComponents.filter(
return newEnabledComponents.indexOf(name) == -1; name => newEnabledComponents.indexOf(name) == -1
})).forEach(Lang.bind(this, function(name) { ).forEach(name => {
this._disableComponent(name); this._disableComponent(name);
})); });
this._enabledComponents = newEnabledComponents; this._enabledComponents = newEnabledComponents;
}, },

View File

@ -61,21 +61,20 @@ var AutomountManager = new Lang.Class({
_InhibitorsChanged(object, senderName, [inhibtor]) { _InhibitorsChanged(object, senderName, [inhibtor]) {
this._session.IsInhibitedRemote(GNOME_SESSION_AUTOMOUNT_INHIBIT, this._session.IsInhibitedRemote(GNOME_SESSION_AUTOMOUNT_INHIBIT,
Lang.bind(this, (result, error) => {
function(result, error) { if (!error) {
if (!error) { this._inhibited = result[0];
this._inhibited = result[0]; }
} });
}));
}, },
_startupMountAll() { _startupMountAll() {
let volumes = this._volumeMonitor.get_volumes(); let volumes = this._volumeMonitor.get_volumes();
volumes.forEach(Lang.bind(this, function(volume) { volumes.forEach(volume => {
this._checkAndMountVolume(volume, { checkSession: false, this._checkAndMountVolume(volume, { checkSession: false,
useMountOp: false, useMountOp: false,
allowAutorun: false }); allowAutorun: false });
})); });
this._mountAllId = 0; this._mountAllId = 0;
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
@ -114,23 +113,23 @@ var AutomountManager = new Lang.Class({
if (drive.can_stop()) { if (drive.can_stop()) {
drive.stop drive.stop
(Gio.MountUnmountFlags.FORCE, null, null, (Gio.MountUnmountFlags.FORCE, null, null,
Lang.bind(this, function(drive, res) { (drive, res) => {
try { try {
drive.stop_finish(res); drive.stop_finish(res);
} catch (e) { } catch (e) {
log("Unable to stop the drive after drive-eject-button " + e.toString()); log("Unable to stop the drive after drive-eject-button " + e.toString());
} }
})); });
} else if (drive.can_eject()) { } else if (drive.can_eject()) {
drive.eject_with_operation drive.eject_with_operation
(Gio.MountUnmountFlags.FORCE, null, null, (Gio.MountUnmountFlags.FORCE, null, null,
Lang.bind(this, function(drive, res) { (drive, res) => {
try { try {
drive.eject_with_operation_finish(res); drive.eject_with_operation_finish(res);
} catch (e) { } catch (e) {
log("Unable to eject the drive after drive-eject-button " + e.toString()); log("Unable to eject the drive after drive-eject-button " + e.toString());
} }
})); });
} }
}, },
@ -212,9 +211,7 @@ var AutomountManager = new Lang.Class({
_onVolumeRemoved(monitor, volume) { _onVolumeRemoved(monitor, volume) {
this._volumeQueue = this._volumeQueue =
this._volumeQueue.filter(function(element) { this._volumeQueue.filter(element => (element != volume));
return (element != volume);
});
}, },
_reaskPassword(volume) { _reaskPassword(volume) {
@ -235,7 +232,7 @@ var AutomountManager = new Lang.Class({
}, },
_allowAutorunExpire(volume) { _allowAutorunExpire(volume) {
let id = Mainloop.timeout_add_seconds(AUTORUN_EXPIRE_TIMEOUT_SECS, function() { let id = Mainloop.timeout_add_seconds(AUTORUN_EXPIRE_TIMEOUT_SECS, () => {
volume.allowAutorun = false; volume.allowAutorun = false;
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
}); });

View File

@ -129,9 +129,9 @@ var ContentTypeDiscoverer = new Lang.Class({
let hotplugSniffer = new HotplugSniffer(); let hotplugSniffer = new HotplugSniffer();
hotplugSniffer.SniffURIRemote(root.get_uri(), hotplugSniffer.SniffURIRemote(root.get_uri(),
Lang.bind(this, function([contentTypes]) { ([contentTypes]) => {
this._emitCallback(mount, contentTypes); this._emitCallback(mount, contentTypes);
})); });
} }
}, },
@ -140,12 +140,12 @@ var ContentTypeDiscoverer = new Lang.Class({
contentTypes = []; contentTypes = [];
// we're not interested in win32 software content types here // we're not interested in win32 software content types here
contentTypes = contentTypes.filter(function(type) { contentTypes = contentTypes.filter(
return (type != 'x-content/win32-software'); type => (type != 'x-content/win32-software')
}); );
let apps = []; let apps = [];
contentTypes.forEach(function(type) { contentTypes.forEach(type => {
let app = Gio.app_info_get_default_for_type(type, false); let app = Gio.app_info_get_default_for_type(type, false);
if (app) if (app)
@ -185,9 +185,9 @@ var AutorunManager = new Lang.Class({
if (!this._session.SessionIsActive) if (!this._session.SessionIsActive)
return; return;
let discoverer = new ContentTypeDiscoverer(Lang.bind(this, function(mount, apps, contentTypes) { let discoverer = new ContentTypeDiscoverer((mount, apps, contentTypes) => {
this._dispatcher.addMount(mount, apps, contentTypes); this._dispatcher.addMount(mount, apps, contentTypes);
})); });
discoverer.guessContentTypes(mount); discoverer.guessContentTypes(mount);
}, },
@ -222,10 +222,7 @@ var AutorunDispatcher = new Lang.Class({
}, },
_getSourceForMount(mount) { _getSourceForMount(mount) {
let filtered = let filtered = this._sources.filter(source => (source.mount == mount));
this._sources.filter(function (source) {
return (source.mount == mount);
});
// we always make sure not to add two sources for the same // we always make sure not to add two sources for the same
// mount in addMount(), so it's safe to assume filtered.length // mount in addMount(), so it's safe to assume filtered.length
@ -337,12 +334,12 @@ var AutorunNotification = new Lang.Class({
createBanner() { createBanner() {
let banner = new MessageTray.NotificationBanner(this); let banner = new MessageTray.NotificationBanner(this);
this.source.apps.forEach(Lang.bind(this, function (app) { this.source.apps.forEach(app => {
let actor = this._buttonForApp(app); let actor = this._buttonForApp(app);
if (actor) if (actor)
banner.addButton(actor); banner.addButton(actor);
})); });
return banner; return banner;
}, },
@ -366,10 +363,10 @@ var AutorunNotification = new Lang.Class({
button_mask: St.ButtonMask.ONE, button_mask: St.ButtonMask.ONE,
style_class: 'hotplug-notification-item button' }); style_class: 'hotplug-notification-item button' });
button.connect('clicked', Lang.bind(this, function() { button.connect('clicked', () => {
startAppForMount(app, this._mount); startAppForMount(app, this._mount);
this.destroy(); this.destroy();
})); });
return button; return button;
}, },

View File

@ -279,13 +279,12 @@ var KeyringPrompter = new Lang.Class({
_init() { _init() {
this._prompter = new Gcr.SystemPrompter(); this._prompter = new Gcr.SystemPrompter();
this._prompter.connect('new-prompt', Lang.bind(this, this._prompter.connect('new-prompt', () => {
function() { let dialog = this._enabled ? new KeyringDialog()
let dialog = this._enabled ? new KeyringDialog() : new KeyringDummyDialog();
: new KeyringDummyDialog(); this._currentPrompt = dialog.prompt;
this._currentPrompt = dialog.prompt; return this._currentPrompt;
return this._currentPrompt; });
}));
this._dbusId = null; this._dbusId = null;
this._registered = false; this._registered = false;
this._enabled = false; this._enabled = false;

View File

@ -83,14 +83,14 @@ var NetworkSecretDialog = new Lang.Class({
} }
secret.entry.clutter_text.connect('activate', Lang.bind(this, this._onOk)); secret.entry.clutter_text.connect('activate', Lang.bind(this, this._onOk));
secret.entry.clutter_text.connect('text-changed', Lang.bind(this, function() { secret.entry.clutter_text.connect('text-changed', () => {
secret.value = secret.entry.get_text(); secret.value = secret.entry.get_text();
if (secret.validate) if (secret.validate)
secret.valid = secret.validate(secret); secret.valid = secret.validate(secret);
else else
secret.valid = secret.value.length > 0; secret.valid = secret.value.length > 0;
this._updateOkButton(); this._updateOkButton();
})); });
} else } else
secret.valid = true; secret.valid = true;
@ -464,7 +464,7 @@ var VPNRequestHandler = new Lang.Class({
}, },
_readStdoutOldStyle() { _readStdoutOldStyle() {
this._dataStdout.read_line_async(GLib.PRIORITY_DEFAULT, null, Lang.bind(this, function(stream, result) { this._dataStdout.read_line_async(GLib.PRIORITY_DEFAULT, null, (stream, result) => {
let [line, len] = this._dataStdout.read_line_finish_utf8(result); let [line, len] = this._dataStdout.read_line_finish_utf8(result);
if (line == null) { if (line == null) {
@ -477,11 +477,11 @@ var VPNRequestHandler = new Lang.Class({
// try to read more! // try to read more!
this._readStdoutOldStyle(); this._readStdoutOldStyle();
})); });
}, },
_readStdoutNewStyle() { _readStdoutNewStyle() {
this._dataStdout.fill_async(-1, GLib.PRIORITY_DEFAULT, null, Lang.bind(this, function(stream, result) { this._dataStdout.fill_async(-1, GLib.PRIORITY_DEFAULT, null, (stream, result) => {
let cnt = this._dataStdout.fill_finish(result); let cnt = this._dataStdout.fill_finish(result);
if (cnt == 0) { if (cnt == 0) {
@ -495,7 +495,7 @@ var VPNRequestHandler = new Lang.Class({
// Try to read more // Try to read more
this._dataStdout.set_buffer_size(2 * this._dataStdout.get_buffer_size()); this._dataStdout.set_buffer_size(2 * this._dataStdout.get_buffer_size());
this._readStdoutNewStyle(); this._readStdoutNewStyle();
})); });
}, },
_showNewStyleDialog() { _showNewStyleDialog() {
@ -562,14 +562,14 @@ var VPNRequestHandler = new Lang.Class({
let vpnSetting = this._connection.get_setting_vpn(); let vpnSetting = this._connection.get_setting_vpn();
try { try {
vpnSetting.foreach_data_item(Lang.bind(this, function(key, value) { vpnSetting.foreach_data_item((key, value) => {
this._stdin.write('DATA_KEY=' + key + '\n', null); this._stdin.write('DATA_KEY=' + key + '\n', null);
this._stdin.write('DATA_VAL=' + (value || '') + '\n\n', null); this._stdin.write('DATA_VAL=' + (value || '') + '\n\n', null);
})); });
vpnSetting.foreach_secret(Lang.bind(this, function(key, value) { vpnSetting.foreach_secret((key, value) => {
this._stdin.write('SECRET_KEY=' + key + '\n', null); this._stdin.write('SECRET_KEY=' + key + '\n', null);
this._stdin.write('SECRET_VAL=' + (value || '') + '\n\n', null); this._stdin.write('SECRET_VAL=' + (value || '') + '\n\n', null);
})); });
this._stdin.write('DONE\n\n', null); this._stdin.write('DONE\n\n', null);
} catch(e) { } catch(e) {
logError(e, 'internal error while writing connection to helper'); logError(e, 'internal error while writing connection to helper');
@ -688,17 +688,17 @@ var NetworkAgent = new Lang.Class({
let notification = new MessageTray.Notification(source, title, body); let notification = new MessageTray.Notification(source, title, body);
notification.connect('activated', Lang.bind(this, function() { notification.connect('activated', () => {
notification.answered = true; notification.answered = true;
this._handleRequest(requestId, connection, settingName, hints, flags); this._handleRequest(requestId, connection, settingName, hints, flags);
})); });
this._notifications[requestId] = notification; this._notifications[requestId] = notification;
notification.connect('destroy', Lang.bind(this, function() { notification.connect('destroy', () => {
if (!notification.answered) if (!notification.answered)
this._native.respond(requestId, Shell.NetworkAgentResponse.USER_CANCELED); this._native.respond(requestId, Shell.NetworkAgentResponse.USER_CANCELED);
delete this._notifications[requestId]; delete this._notifications[requestId];
})); });
Main.messageTray.add(source); Main.messageTray.add(source);
source.notify(notification); source.notify(notification);
@ -718,9 +718,9 @@ var NetworkAgent = new Lang.Class({
} }
let dialog = new NetworkSecretDialog(this._native, requestId, connection, settingName, hints); let dialog = new NetworkSecretDialog(this._native, requestId, connection, settingName, hints);
dialog.connect('destroy', Lang.bind(this, function() { dialog.connect('destroy', () => {
delete this._dialogs[requestId]; delete this._dialogs[requestId];
})); });
this._dialogs[requestId] = dialog; this._dialogs[requestId] = dialog;
dialog.open(global.get_current_time()); dialog.open(global.get_current_time());
}, },
@ -752,9 +752,9 @@ var NetworkAgent = new Lang.Class({
} }
let vpnRequest = new VPNRequestHandler(this._native, requestId, binary, serviceType, connection, hints, flags); let vpnRequest = new VPNRequestHandler(this._native, requestId, binary, serviceType, connection, hints, flags);
vpnRequest.connect('destroy', Lang.bind(this, function() { vpnRequest.connect('destroy', () => {
delete this._vpnRequests[requestId]; delete this._vpnRequests[requestId];
})); });
this._vpnRequests[requestId] = vpnRequest; this._vpnRequests[requestId] = vpnRequest;
}, },

View File

@ -47,7 +47,7 @@ var NotificationDirection = {
RECEIVED: 'chat-received' RECEIVED: 'chat-received'
}; };
var N_ = function(s) { return s; }; var N_ = s => s;
function makeMessageFromTpMessage(tpMessage, direction) { function makeMessageFromTpMessage(tpMessage, direction) {
let [text, flags] = tpMessage.to_text(); let [text, flags] = tpMessage.to_text();
@ -188,10 +188,9 @@ var TelepathyClient = HAVE_TP ? new Lang.Class({
let source = new ChatSource(account, conn, channel, contact, this); let source = new ChatSource(account, conn, channel, contact, this);
this._chatSources[channel.get_object_path()] = source; this._chatSources[channel.get_object_path()] = source;
source.connect('destroy', Lang.bind(this, source.connect('destroy', () => {
function() { delete this._chatSources[channel.get_object_path()];
delete this._chatSources[channel.get_object_path()]; });
}));
}, },
vfunc_handle_channels(account, conn, channels, requests, vfunc_handle_channels(account, conn, channels, requests,
@ -262,14 +261,14 @@ var TelepathyClient = HAVE_TP ? new Lang.Class({
} }
// Approve private text channels right away as we are going to handle it // Approve private text channels right away as we are going to handle it
dispatchOp.claim_with_async(this, Lang.bind(this, function(dispatchOp, result) { dispatchOp.claim_with_async(this, (dispatchOp, result) => {
try { try {
dispatchOp.claim_with_finish(result); dispatchOp.claim_with_finish(result);
this._handlingChannels(account, conn, [channel], false); this._handlingChannels(account, conn, [channel], false);
} catch (err) { } catch (err) {
log('Failed to Claim channel: ' + err); log('Failed to Claim channel: ' + err);
} }
})); });
context.accept(); context.accept();
}, },
@ -322,15 +321,13 @@ var ChatSource = new Lang.Class({
this._notification = new ChatNotification(this); this._notification = new ChatNotification(this);
this._notification.connect('activated', Lang.bind(this, this.open)); this._notification.connect('activated', Lang.bind(this, this.open));
this._notification.connect('updated', Lang.bind(this, this._notification.connect('updated', () => {
function() { if (this._banner && this._banner.expanded)
if (this._banner && this._banner.expanded) this._ackMessages();
this._ackMessages(); });
})); this._notification.connect('destroy', () => {
this._notification.connect('destroy', Lang.bind(this, this._notification = null;
function() { });
this._notification = null;
}));
this.pushNotification(this._notification); this.pushNotification(this._notification);
}, },
@ -345,11 +342,10 @@ var ChatSource = new Lang.Class({
// We ack messages when the user expands the new notification // We ack messages when the user expands the new notification
let id = this._banner.connect('expanded', Lang.bind(this, this._ackMessages)); let id = this._banner.connect('expanded', Lang.bind(this, this._ackMessages));
this._banner.actor.connect('destroy', Lang.bind(this, this._banner.actor.connect('destroy', () => {
function() { this._banner.disconnect(id);
this._banner.disconnect(id); this._banner = null;
this._banner = null; });
}));
return this._banner; return this._banner;
}, },
@ -504,7 +500,7 @@ var ChatSource = new Lang.Class({
this._ackMessages(); this._ackMessages();
// The chat box has been destroyed so it can't // The chat box has been destroyed so it can't
// handle the channel any more. // handle the channel any more.
this._channel.close_async(function(channel, result) { this._channel.close_async((channel, result) => {
channel.close_finish(result); channel.close_finish(result);
}); });
} else { } else {
@ -602,9 +598,9 @@ var ChatSource = new Lang.Class({
} }
let msg = Tp.ClientMessage.new_text(type, text); let msg = Tp.ClientMessage.new_text(type, text);
this._channel.send_message_async(msg, 0, Lang.bind(this, function (src, result) { this._channel.send_message_async(msg, 0, (src, result) => {
this._channel.send_message_finish(result); this._channel.send_message_finish(result);
})); });
}, },
setChatState(state) { setChatState(state) {
@ -722,7 +718,7 @@ var ChatNotification = new Lang.Class({
let maxLength = (lastMessageTime < currentTime - SCROLLBACK_RECENT_TIME) ? let maxLength = (lastMessageTime < currentTime - SCROLLBACK_RECENT_TIME) ?
SCROLLBACK_IDLE_LENGTH : SCROLLBACK_RECENT_LENGTH; SCROLLBACK_IDLE_LENGTH : SCROLLBACK_RECENT_LENGTH;
let filteredHistory = this.messages.filter(function(item) { return item.realMessage }); let filteredHistory = this.messages.filter(item => item.realMessage);
if (filteredHistory.length > maxLength) { if (filteredHistory.length > maxLength) {
let lastMessageToKeep = filteredHistory[maxLength]; let lastMessageToKeep = filteredHistory[maxLength];
let expired = this.messages.splice(this.messages.indexOf(lastMessageToKeep)); let expired = this.messages.splice(this.messages.indexOf(lastMessageToKeep));
@ -830,13 +826,13 @@ var ChatNotificationBanner = new Lang.Class({
this._responseEntry.clutter_text.connect('text-changed', Lang.bind(this, this._onEntryChanged)); this._responseEntry.clutter_text.connect('text-changed', Lang.bind(this, this._onEntryChanged));
this.setActionArea(this._responseEntry); this.setActionArea(this._responseEntry);
this._responseEntry.clutter_text.connect('key-focus-in', Lang.bind(this, function() { this._responseEntry.clutter_text.connect('key-focus-in', () => {
this.focused = true; this.focused = true;
})); });
this._responseEntry.clutter_text.connect('key-focus-out', Lang.bind(this, function() { this._responseEntry.clutter_text.connect('key-focus-out', () => {
this.focused = false; this.focused = false;
this.emit('unfocused'); this.emit('unfocused');
})); });
this._scrollArea = new St.ScrollView({ style_class: 'chat-scrollview vfade', this._scrollArea = new St.ScrollView({ style_class: 'chat-scrollview vfade',
vscrollbar_policy: Gtk.PolicyType.AUTOMATIC, vscrollbar_policy: Gtk.PolicyType.AUTOMATIC,
@ -855,11 +851,11 @@ var ChatNotificationBanner = new Lang.Class({
// force a scroll to the bottom if things change while we were at the // force a scroll to the bottom if things change while we were at the
// bottom // bottom
this._oldMaxScrollValue = this._scrollArea.vscroll.adjustment.value; this._oldMaxScrollValue = this._scrollArea.vscroll.adjustment.value;
this._scrollArea.vscroll.adjustment.connect('changed', Lang.bind(this, function(adjustment) { this._scrollArea.vscroll.adjustment.connect('changed', adjustment => {
if (adjustment.value == this._oldMaxScrollValue) if (adjustment.value == this._oldMaxScrollValue)
this.scrollTo(St.Side.BOTTOM); this.scrollTo(St.Side.BOTTOM);
this._oldMaxScrollValue = Math.max(adjustment.lower, adjustment.upper - adjustment.page_size); this._oldMaxScrollValue = Math.max(adjustment.lower, adjustment.upper - adjustment.page_size);
})); });
this._inputHistory = new History.HistoryManager({ entry: this._responseEntry.clutter_text }); this._inputHistory = new History.HistoryManager({ entry: this._responseEntry.clutter_text });
@ -868,19 +864,19 @@ var ChatNotificationBanner = new Lang.Class({
this._messageActors = new Map(); this._messageActors = new Map();
this._messageAddedId = this.notification.connect('message-added', this._messageAddedId = this.notification.connect('message-added',
Lang.bind(this, function(n, message) { (n, message) => {
this._addMessage(message); this._addMessage(message);
})); });
this._messageRemovedId = this.notification.connect('message-removed', this._messageRemovedId = this.notification.connect('message-removed',
Lang.bind(this, function(n, message) { (n, message) => {
let actor = this._messageActors.get(message); let actor = this._messageActors.get(message);
if (this._messageActors.delete(message)) if (this._messageActors.delete(message))
actor.destroy(); actor.destroy();
})); });
this._timestampChangedId = this.notification.connect('timestamp-changed', this._timestampChangedId = this.notification.connect('timestamp-changed',
Lang.bind(this, function(n, message) { (n, message) => {
this._updateTimestamp(message); this._updateTimestamp(message);
})); });
for (let i = this.notification.messages.length - 1; i >= 0; i--) for (let i = this.notification.messages.length - 1; i >= 0; i--)
this._addMessage(this.notification.messages[i]); this._addMessage(this.notification.messages[i]);

View File

@ -41,7 +41,7 @@ var CtrlAltTabManager = new Lang.Class({
item.iconName = icon; item.iconName = icon;
this._items.push(item); this._items.push(item);
root.connect('destroy', Lang.bind(this, function() { this.removeGroup(root); })); root.connect('destroy', () => { this.removeGroup(root); });
if (root instanceof St.Widget) if (root instanceof St.Widget)
global.focus_manager.add_group(root); global.focus_manager.add_group(root);
}, },
@ -81,7 +81,7 @@ var CtrlAltTabManager = new Lang.Class({
popup(backward, binding, mask) { popup(backward, binding, mask) {
// Start with the set of focus groups that are currently mapped // Start with the set of focus groups that are currently mapped
let items = this._items.filter(function (item) { return item.proxy.mapped; }); let items = this._items.filter(item => item.proxy.mapped);
// And add the windows metacity would show in its Ctrl-Alt-Tab list // And add the windows metacity would show in its Ctrl-Alt-Tab list
if (Main.sessionMode.hasWindows && !Main.overview.visible) { if (Main.sessionMode.hasWindows && !Main.overview.visible) {
@ -125,9 +125,9 @@ var CtrlAltTabManager = new Lang.Class({
this._popup.show(backward, binding, mask); this._popup.show(backward, binding, mask);
this._popup.actor.connect('destroy', this._popup.actor.connect('destroy',
Lang.bind(this, function() { () => {
this._popup = null; this._popup = null;
})); });
} }
}, },

View File

@ -148,9 +148,9 @@ var DashItemContainer = new Lang.Class({
{ opacity: 0, { opacity: 0,
time: DASH_ITEM_LABEL_HIDE_TIME, time: DASH_ITEM_LABEL_HIDE_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete: Lang.bind(this, function() { onComplete: () => {
this.label.hide(); this.label.hide();
}) }
}); });
}, },
@ -195,9 +195,9 @@ var DashItemContainer = new Lang.Class({
childOpacity: 0, childOpacity: 0,
time: DASH_ANIMATION_TIME, time: DASH_ANIMATION_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete: Lang.bind(this, function() { onComplete: () => {
this.destroy(); this.destroy();
}) }
}); });
}, },
@ -301,11 +301,10 @@ var ShowAppsIcon = new Lang.Class({
let id = app.get_id(); let id = app.get_id();
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
function () { AppFavorites.getAppFavorites().removeFavorite(id);
AppFavorites.getAppFavorites().removeFavorite(id); return false;
return false; });
}));
return true; return true;
} }
@ -415,21 +414,20 @@ var Dash = new Lang.Class({
this._container.add_actor(this._showAppsIcon); this._container.add_actor(this._showAppsIcon);
this.actor = new St.Bin({ child: this._container }); this.actor = new St.Bin({ child: this._container });
this.actor.connect('notify::height', Lang.bind(this, this.actor.connect('notify::height', () => {
function() { if (this._maxHeight != this.actor.height)
if (this._maxHeight != this.actor.height) this._queueRedisplay();
this._queueRedisplay(); this._maxHeight = this.actor.height;
this._maxHeight = this.actor.height; });
}));
this._workId = Main.initializeDeferredWork(this._box, Lang.bind(this, this._redisplay)); this._workId = Main.initializeDeferredWork(this._box, Lang.bind(this, this._redisplay));
this._appSystem = Shell.AppSystem.get_default(); this._appSystem = Shell.AppSystem.get_default();
this._appSystem.connect('installed-changed', Lang.bind(this, function() { this._appSystem.connect('installed-changed', () => {
AppFavorites.getAppFavorites().reload(); AppFavorites.getAppFavorites().reload();
this._queueRedisplay(); this._queueRedisplay();
})); });
AppFavorites.getAppFavorites().connect('changed', Lang.bind(this, this._queueRedisplay)); AppFavorites.getAppFavorites().connect('changed', Lang.bind(this, this._queueRedisplay));
this._appSystem.connect('app-state-changed', Lang.bind(this, this._queueRedisplay)); this._appSystem.connect('app-state-changed', Lang.bind(this, this._queueRedisplay));
@ -509,22 +507,22 @@ var Dash = new Lang.Class({
}, },
_hookUpLabel(item, appIcon) { _hookUpLabel(item, appIcon) {
item.child.connect('notify::hover', Lang.bind(this, function() { item.child.connect('notify::hover', () => {
this._syncLabel(item, appIcon); this._syncLabel(item, appIcon);
})); });
let id = Main.overview.connect('hiding', Lang.bind(this, function() { let id = Main.overview.connect('hiding', () => {
this._labelShowing = false; this._labelShowing = false;
item.hideLabel(); item.hideLabel();
})); });
item.child.connect('destroy', function() { item.child.connect('destroy', () => {
Main.overview.disconnect(id); Main.overview.disconnect(id);
}); });
if (appIcon) { if (appIcon) {
appIcon.connect('sync-tooltip', Lang.bind(this, function() { appIcon.connect('sync-tooltip', () => {
this._syncLabel(item, appIcon); this._syncLabel(item, appIcon);
})); });
} }
}, },
@ -534,19 +532,19 @@ var Dash = new Lang.Class({
showLabel: false }); showLabel: false });
if (appIcon._draggable) { if (appIcon._draggable) {
appIcon._draggable.connect('drag-begin', appIcon._draggable.connect('drag-begin',
Lang.bind(this, function() { () => {
appIcon.actor.opacity = 50; appIcon.actor.opacity = 50;
})); });
appIcon._draggable.connect('drag-end', appIcon._draggable.connect('drag-end',
Lang.bind(this, function() { () => {
appIcon.actor.opacity = 255; appIcon.actor.opacity = 255;
})); });
} }
appIcon.connect('menu-state-changed', appIcon.connect('menu-state-changed',
Lang.bind(this, function(appIcon, opened) { (appIcon, opened) => {
this._itemMenuStateChanged(item, opened); this._itemMenuStateChanged(item, opened);
})); });
let item = new DashItemContainer(); let item = new DashItemContainer();
item.setChild(appIcon.actor); item.setChild(appIcon.actor);
@ -582,12 +580,12 @@ var Dash = new Lang.Class({
if (this._showLabelTimeoutId == 0) { if (this._showLabelTimeoutId == 0) {
let timeout = this._labelShowing ? 0 : DASH_ITEM_HOVER_TIMEOUT; let timeout = this._labelShowing ? 0 : DASH_ITEM_HOVER_TIMEOUT;
this._showLabelTimeoutId = Mainloop.timeout_add(timeout, this._showLabelTimeoutId = Mainloop.timeout_add(timeout,
Lang.bind(this, function() { () => {
this._labelShowing = true; this._labelShowing = true;
item.showLabel(); item.showLabel();
this._showLabelTimeoutId = 0; this._showLabelTimeoutId = 0;
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); });
GLib.Source.set_name_by_id(this._showLabelTimeoutId, '[gnome-shell] item.showLabel'); GLib.Source.set_name_by_id(this._showLabelTimeoutId, '[gnome-shell] item.showLabel');
if (this._resetHoverTimeoutId > 0) { if (this._resetHoverTimeoutId > 0) {
Mainloop.source_remove(this._resetHoverTimeoutId); Mainloop.source_remove(this._resetHoverTimeoutId);
@ -601,11 +599,11 @@ var Dash = new Lang.Class({
item.hideLabel(); item.hideLabel();
if (this._labelShowing) { if (this._labelShowing) {
this._resetHoverTimeoutId = Mainloop.timeout_add(DASH_ITEM_HOVER_TIMEOUT, this._resetHoverTimeoutId = Mainloop.timeout_add(DASH_ITEM_HOVER_TIMEOUT,
Lang.bind(this, function() { () => {
this._labelShowing = false; this._labelShowing = false;
this._resetHoverTimeoutId = 0; this._resetHoverTimeoutId = 0;
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); });
GLib.Source.set_name_by_id(this._resetHoverTimeoutId, '[gnome-shell] this._labelShowing'); GLib.Source.set_name_by_id(this._resetHoverTimeoutId, '[gnome-shell] this._labelShowing');
} }
} }
@ -616,7 +614,7 @@ var Dash = new Lang.Class({
// icons (i.e. ignoring drag placeholders) and which are not // icons (i.e. ignoring drag placeholders) and which are not
// animating out (which means they will be destroyed at the end of // animating out (which means they will be destroyed at the end of
// the animation) // the animation)
let iconChildren = this._box.get_children().filter(function(actor) { let iconChildren = this._box.get_children().filter(actor => {
return actor.child && return actor.child &&
actor.child._delegate && actor.child._delegate &&
actor.child._delegate.icon && actor.child._delegate.icon &&
@ -655,9 +653,7 @@ var Dash = new Lang.Class({
let availSize = availHeight / iconChildren.length; let availSize = availHeight / iconChildren.length;
let iconSizes = baseIconSizes.map(function(s) { let iconSizes = baseIconSizes.map(s => s * scaleFactor);
return s * scaleFactor;
});
let newIconSize = baseIconSizes[0]; let newIconSize = baseIconSizes[0];
for (let i = 0; i < iconSizes.length; i++) { for (let i = 0; i < iconSizes.length; i++) {
@ -708,15 +704,13 @@ var Dash = new Lang.Class({
let running = this._appSystem.get_running(); let running = this._appSystem.get_running();
let children = this._box.get_children().filter(function(actor) { let children = this._box.get_children().filter(actor => {
return actor.child && return actor.child &&
actor.child._delegate && actor.child._delegate &&
actor.child._delegate.app; actor.child._delegate.app;
}); });
// Apps currently in the dash // Apps currently in the dash
let oldApps = children.map(function(actor) { let oldApps = children.map(actor => actor.child._delegate.app);
return actor.child._delegate.app;
});
// Apps supposed to be in the dash // Apps supposed to be in the dash
let newApps = []; let newApps = [];
@ -782,7 +776,7 @@ var Dash = new Lang.Class({
let nextApp = newApps.length > newIndex + 1 ? newApps[newIndex + 1] let nextApp = newApps.length > newIndex + 1 ? newApps[newIndex + 1]
: null; : null;
let insertHere = nextApp && nextApp == oldApp; let insertHere = nextApp && nextApp == oldApp;
let alreadyRemoved = removedActors.reduce(function(result, actor) { let alreadyRemoved = removedActors.reduce((result, actor) => {
let removedApp = actor.child._delegate.app; let removedApp = actor.child._delegate.app;
return result || removedApp == newApp; return result || removedApp == newApp;
}, false); }, false);
@ -838,10 +832,9 @@ var Dash = new Lang.Class({
if (this._dragPlaceholder) { if (this._dragPlaceholder) {
this._animatingPlaceholdersCount++; this._animatingPlaceholdersCount++;
this._dragPlaceholder.animateOutAndDestroy(); this._dragPlaceholder.animateOutAndDestroy();
this._dragPlaceholder.connect('destroy', this._dragPlaceholder.connect('destroy', () => {
Lang.bind(this, function() { this._animatingPlaceholdersCount--;
this._animatingPlaceholdersCount--; });
}));
this._dragPlaceholder = null; this._dragPlaceholder = null;
} }
this._dragPlaceholderPos = -1; this._dragPlaceholderPos = -1;
@ -968,15 +961,14 @@ var Dash = new Lang.Class({
if (!this._dragPlaceholder) if (!this._dragPlaceholder)
return true; return true;
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
function () { let appFavorites = AppFavorites.getAppFavorites();
let appFavorites = AppFavorites.getAppFavorites(); if (srcIsFavorite)
if (srcIsFavorite) appFavorites.moveFavoriteToPos(id, favPos);
appFavorites.moveFavoriteToPos(id, favPos); else
else appFavorites.addFavoriteAtPos(id, favPos);
appFavorites.addFavoriteAtPos(id, favPos); return false;
return false; });
}));
return true; return true;
} }

View File

@ -43,10 +43,9 @@ var TodayButton = new Lang.Class({
can_focus: true, can_focus: true,
reactive: false reactive: false
}); });
this.actor.connect('clicked', Lang.bind(this, this.actor.connect('clicked', () => {
function() { this._calendar.setDate(new Date(), false);
this._calendar.setDate(new Date(), false); });
}));
let hbox = new St.BoxLayout({ vertical: true }); let hbox = new St.BoxLayout({ vertical: true });
this.actor.add_actor(hbox); this.actor.add_actor(hbox);
@ -59,12 +58,11 @@ var TodayButton = new Lang.Class({
hbox.add_actor(this._dateLabel); hbox.add_actor(this._dateLabel);
this._calendar = calendar; this._calendar = calendar;
this._calendar.connect('selected-date-changed', Lang.bind(this, this._calendar.connect('selected-date-changed', (calendar, date) => {
function(calendar, date) { // Make the button reactive only if the selected date is not the
// Make the button reactive only if the selected date is not the // current date.
// current date. this.actor.reactive = !_isToday(date)
this.actor.reactive = !_isToday(date) });
}));
}, },
setDate(date) { setDate(date) {
@ -97,13 +95,12 @@ var WorldClocksSection = new Lang.Class({
this.actor = new St.Button({ style_class: 'world-clocks-button', this.actor = new St.Button({ style_class: 'world-clocks-button',
x_fill: true, x_fill: true,
can_focus: true }); can_focus: true });
this.actor.connect('clicked', Lang.bind(this, this.actor.connect('clicked', () => {
function() { this._clockAppMon.activateApp();
this._clockAppMon.activateApp();
Main.overview.hide(); Main.overview.hide();
Main.panel.closeCalendar(); Main.panel.closeCalendar();
})); });
let layout = new Clutter.GridLayout({ orientation: Clutter.Orientation.VERTICAL }); let layout = new Clutter.GridLayout({ orientation: Clutter.Orientation.VERTICAL });
this._grid = new St.Widget({ style_class: 'world-clocks-grid', this._grid = new St.Widget({ style_class: 'world-clocks-grid',
@ -139,7 +136,7 @@ var WorldClocksSection = new Lang.Class({
this._locations.push({ location: l }); this._locations.push({ location: l });
} }
this._locations.sort(function(a, b) { this._locations.sort((a, b) => {
return a.location.get_timezone().get_offset() - return a.location.get_timezone().get_offset() -
b.location.get_timezone().get_offset(); b.location.get_timezone().get_offset();
}); });
@ -355,7 +352,7 @@ var MessagesIndicator = new Lang.Class({
Main.messageTray.connect('queue-changed', Lang.bind(this, this._updateCount)); Main.messageTray.connect('queue-changed', Lang.bind(this, this._updateCount));
let sources = Main.messageTray.getSources(); let sources = Main.messageTray.getSources();
sources.forEach(Lang.bind(this, function(source) { this._onSourceAdded(null, source); })); sources.forEach(source => { this._onSourceAdded(null, source); });
}, },
_onSourceAdded(tray, source) { _onSourceAdded(tray, source) {
@ -371,10 +368,7 @@ var MessagesIndicator = new Lang.Class({
_updateCount() { _updateCount() {
let count = 0; let count = 0;
this._sources.forEach(Lang.bind(this, this._sources.forEach(source => { count += source.unseenCount; });
function(source) {
count += source.unseenCount;
}));
count -= Main.messageTray.queueCount; count -= Main.messageTray.queueCount;
this.actor.visible = (count > 0); this.actor.visible = (count > 0);
@ -500,12 +494,12 @@ var DateMenuButton = new Lang.Class({
this._calendar = new Calendar.Calendar(); this._calendar = new Calendar.Calendar();
this._calendar.connect('selected-date-changed', this._calendar.connect('selected-date-changed',
Lang.bind(this, function(calendar, date) { (calendar, date) => {
layout.frozen = !_isToday(date); layout.frozen = !_isToday(date);
this._messageList.setDate(date); this._messageList.setDate(date);
})); });
this.menu.connect('open-state-changed', Lang.bind(this, function(menu, isOpen) { this.menu.connect('open-state-changed', (menu, isOpen) => {
// Whenever the menu is opened, select today // Whenever the menu is opened, select today
if (isOpen) { if (isOpen) {
let now = new Date(); let now = new Date();
@ -513,7 +507,7 @@ var DateMenuButton = new Lang.Class({
this._date.setDate(now); this._date.setDate(now);
this._messageList.setDate(now); this._messageList.setDate(now);
} }
})); });
// Fill up the first column // Fill up the first column
this._messageList = new Calendar.CalendarMessageList(); this._messageList = new Calendar.CalendarMessageList();

View File

@ -49,10 +49,9 @@ function _getEventHandlerActor() {
Main.uiGroup.add_actor(eventHandlerActor); Main.uiGroup.add_actor(eventHandlerActor);
// We connect to 'event' rather than 'captured-event' because the capturing phase doesn't happen // We connect to 'event' rather than 'captured-event' because the capturing phase doesn't happen
// when you've grabbed the pointer. // when you've grabbed the pointer.
eventHandlerActor.connect('event', eventHandlerActor.connect('event', (actor, event) => {
function(actor, event) { return currentDraggable._onEvent(actor, event);
return currentDraggable._onEvent(actor, event); });
});
} }
return eventHandlerActor; return eventHandlerActor;
} }
@ -86,13 +85,13 @@ var _Draggable = new Lang.Class({
Lang.bind(this, this._onTouchEvent)); Lang.bind(this, this._onTouchEvent));
} }
this.actor.connect('destroy', Lang.bind(this, function() { this.actor.connect('destroy', () => {
this._actorDestroyed = true; this._actorDestroyed = true;
if (this._dragInProgress && this._dragCancellable) if (this._dragInProgress && this._dragCancellable)
this._cancelDrag(global.get_current_time()); this._cancelDrag(global.get_current_time());
this.disconnectAll(); this.disconnectAll();
})); });
this._onEventId = null; this._onEventId = null;
this._touchSequence = null; this._touchSequence = null;

View File

@ -22,9 +22,7 @@ var EdgeDragAction = new Lang.Class({
this._allowedModes = allowedModes; this._allowedModes = allowedModes;
this.set_n_touch_points(1); this.set_n_touch_points(1);
global.display.connect('grab-op-begin', Lang.bind(this, function() { global.display.connect('grab-op-begin', () => { this.cancel(); });
this.cancel();
}));
}, },
_getMonitorRect(x, y) { _getMonitorRect(x, y) {

View File

@ -290,14 +290,14 @@ var EndSessionDialog = new Lang.Class({
this._pkOfflineProxy = new PkOfflineProxy(Gio.DBus.system, this._pkOfflineProxy = new PkOfflineProxy(Gio.DBus.system,
'org.freedesktop.PackageKit', 'org.freedesktop.PackageKit',
'/org/freedesktop/PackageKit', '/org/freedesktop/PackageKit',
Lang.bind(this, function(proxy, error) { (proxy, error) => {
if (error) if (error)
log(error.message); log(error.message);
})); });
this._powerProxy = new UPowerProxy(Gio.DBus.system, this._powerProxy = new UPowerProxy(Gio.DBus.system,
'org.freedesktop.UPower', 'org.freedesktop.UPower',
'/org/freedesktop/UPower', '/org/freedesktop/UPower',
Lang.bind(this, function(proxy, error) { (proxy, error) => {
if (error) { if (error) {
log(error.message); log(error.message);
return; return;
@ -305,7 +305,7 @@ var EndSessionDialog = new Lang.Class({
this._powerProxy.connect('g-properties-changed', this._powerProxy.connect('g-properties-changed',
Lang.bind(this, this._sync)); Lang.bind(this, this._sync));
this._sync(); this._sync();
})); });
this._secondsLeft = 0; this._secondsLeft = 0;
this._totalSecondsToStayOpen = 0; this._totalSecondsToStayOpen = 0;
@ -485,14 +485,13 @@ var EndSessionDialog = new Lang.Class({
for (let i = 0; i < dialogContent.confirmButtons.length; i++) { for (let i = 0; i < dialogContent.confirmButtons.length; i++) {
let signal = dialogContent.confirmButtons[i].signal; let signal = dialogContent.confirmButtons[i].signal;
let label = dialogContent.confirmButtons[i].label; let label = dialogContent.confirmButtons[i].label;
buttons.push({ action: Lang.bind(this, function() { buttons.push({ action: () => {
this.close(true); this.close(true);
let signalId = this.connect('closed', let signalId = this.connect('closed', () => {
Lang.bind(this, function() { this.disconnect(signalId);
this.disconnect(signalId); this._confirm(signal);
this._confirm(signal); });
})); },
}),
label: label }); label: label });
} }
@ -513,11 +512,11 @@ var EndSessionDialog = new Lang.Class({
}, },
_confirm(signal) { _confirm(signal) {
let callback = Lang.bind(this, function() { let callback = () => {
this._fadeOutDialog(); this._fadeOutDialog();
this._stopTimer(); this._stopTimer();
this._dbusImpl.emit_signal(signal, null); this._dbusImpl.emit_signal(signal, null);
}); };
// Offline update not available; just emit the signal // Offline update not available; just emit the signal
if (!this._checkBox.actor.visible) { if (!this._checkBox.actor.visible) {
@ -552,8 +551,7 @@ var EndSessionDialog = new Lang.Class({
}, },
_triggerOfflineUpdateReboot(callback) { _triggerOfflineUpdateReboot(callback) {
this._pkOfflineProxy.TriggerRemote('reboot', this._pkOfflineProxy.TriggerRemote('reboot', (result, error) => {
function (result, error) {
if (error) if (error)
log(error.message); log(error.message);
@ -562,8 +560,7 @@ var EndSessionDialog = new Lang.Class({
}, },
_triggerOfflineUpdateShutdown(callback) { _triggerOfflineUpdateShutdown(callback) {
this._pkOfflineProxy.TriggerRemote('power-off', this._pkOfflineProxy.TriggerRemote('power-off', (result, error) => {
function (result, error) {
if (error) if (error)
log(error.message); log(error.message);
@ -572,7 +569,7 @@ var EndSessionDialog = new Lang.Class({
}, },
_triggerOfflineUpdateCancel(callback) { _triggerOfflineUpdateCancel(callback) {
this._pkOfflineProxy.CancelRemote(function (result, error) { this._pkOfflineProxy.CancelRemote((result, error) => {
if (error) if (error)
log(error.message); log(error.message);
@ -584,24 +581,23 @@ var EndSessionDialog = new Lang.Class({
let startTime = GLib.get_monotonic_time(); let startTime = GLib.get_monotonic_time();
this._secondsLeft = this._totalSecondsToStayOpen; this._secondsLeft = this._totalSecondsToStayOpen;
this._timerId = Mainloop.timeout_add_seconds(1, Lang.bind(this, this._timerId = Mainloop.timeout_add_seconds(1, () => {
function() { let currentTime = GLib.get_monotonic_time();
let currentTime = GLib.get_monotonic_time(); let secondsElapsed = ((currentTime - startTime) / 1000000);
let secondsElapsed = ((currentTime - startTime) / 1000000);
this._secondsLeft = this._totalSecondsToStayOpen - secondsElapsed; this._secondsLeft = this._totalSecondsToStayOpen - secondsElapsed;
if (this._secondsLeft > 0) { if (this._secondsLeft > 0) {
this._sync(); this._sync();
return GLib.SOURCE_CONTINUE; return GLib.SOURCE_CONTINUE;
} }
let dialogContent = DialogContent[this._type]; let dialogContent = DialogContent[this._type];
let button = dialogContent.confirmButtons[dialogContent.confirmButtons.length - 1]; let button = dialogContent.confirmButtons[dialogContent.confirmButtons.length - 1];
this._confirm(button.signal); this._confirm(button.signal);
this._timerId = 0; this._timerId = 0;
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); });
GLib.Source.set_name_by_id(this._timerId, '[gnome-shell] this._confirm'); GLib.Source.set_name_by_id(this._timerId, '[gnome-shell] this._confirm');
}, },
@ -689,7 +685,7 @@ var EndSessionDialog = new Lang.Class({
}, },
_loadSessions() { _loadSessions() {
this._loginManager.listSessions(Lang.bind(this, function(result) { this._loginManager.listSessions(result => {
let n = 0; let n = 0;
for (let i = 0; i < result.length; i++) { for (let i = 0; i < result.length; i++) {
let[id, uid, userName, seat, sessionPath] = result[i]; let[id, uid, userName, seat, sessionPath] = result[i];
@ -720,7 +716,7 @@ var EndSessionDialog = new Lang.Class({
} }
this._sync(); this._sync();
})); });
}, },
OpenAsync(parameters, invocation) { OpenAsync(parameters, invocation) {
@ -750,9 +746,9 @@ var EndSessionDialog = new Lang.Class({
let dialogContent = DialogContent[this._type]; let dialogContent = DialogContent[this._type];
for (let i = 0; i < inhibitorObjectPaths.length; i++) { for (let i = 0; i < inhibitorObjectPaths.length; i++) {
let inhibitor = new GnomeSession.Inhibitor(inhibitorObjectPaths[i], Lang.bind(this, function(proxy, error) { let inhibitor = new GnomeSession.Inhibitor(inhibitorObjectPaths[i], (proxy, error) => {
this._onInhibitorLoaded(proxy); this._onInhibitorLoaded(proxy);
})); });
this._applications.push(inhibitor); this._applications.push(inhibitor);
} }
@ -787,11 +783,10 @@ var EndSessionDialog = new Lang.Class({
this._sync(); this._sync();
let signalId = this.connect('opened', let signalId = this.connect('opened', () => {
Lang.bind(this, function() { invocation.return_value(null);
invocation.return_value(null); this.disconnect(signalId);
this.disconnect(signalId); });
}));
}, },
Close(parameters, invocation) { Close(parameters, invocation) {

View File

@ -47,14 +47,14 @@ function _patchContainerClass(containerClass) {
function _patchLayoutClass(layoutClass, styleProps) { function _patchLayoutClass(layoutClass, styleProps) {
if (styleProps) if (styleProps)
layoutClass.prototype.hookup_style = function(container) { layoutClass.prototype.hookup_style = function(container) {
container.connect('style-changed', Lang.bind(this, function() { container.connect('style-changed', () => {
let node = container.get_theme_node(); let node = container.get_theme_node();
for (let prop in styleProps) { for (let prop in styleProps) {
let [found, length] = node.lookup_length(styleProps[prop], false); let [found, length] = node.lookup_length(styleProps[prop], false);
if (found) if (found)
this[prop] = length; this[prop] = length;
} }
})); });
}; };
layoutClass.prototype.child_set = function(actor, props) { layoutClass.prototype.child_set = function(actor, props) {
let meta = this.get_child_meta(actor.get_parent(), actor); let meta = this.get_child_meta(actor.get_parent(), actor);
@ -88,7 +88,7 @@ function init() {
window._ = Gettext.gettext; window._ = Gettext.gettext;
window.C_ = Gettext.pgettext; window.C_ = Gettext.pgettext;
window.ngettext = Gettext.ngettext; window.ngettext = Gettext.ngettext;
window.N_ = function(s) { return s; }; window.N_ = s => s;
// Miscellaneous monkeypatching // Miscellaneous monkeypatching
_patchContainerClass(St.BoxLayout); _patchContainerClass(St.BoxLayout);

View File

@ -30,7 +30,7 @@ function installExtension(uuid, invocation) {
let message = Soup.form_request_new_from_hash('GET', REPOSITORY_URL_INFO, params); let message = Soup.form_request_new_from_hash('GET', REPOSITORY_URL_INFO, params);
_httpSession.queue_message(message, function(session, message) { _httpSession.queue_message(message, (session, message) => {
if (message.status_code != Soup.KnownStatusCode.OK) { if (message.status_code != Soup.KnownStatusCode.OK) {
ExtensionSystem.logExtensionError(uuid, 'downloading info: ' + message.status_code); ExtensionSystem.logExtensionError(uuid, 'downloading info: ' + message.status_code);
invocation.return_dbus_error('org.gnome.Shell.DownloadInfoError', message.status_code.toString()); invocation.return_dbus_error('org.gnome.Shell.DownloadInfoError', message.status_code.toString());
@ -96,7 +96,7 @@ function gotExtensionZipFile(session, message, uuid, dir, callback, errback) {
return; return;
} }
GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid, function(pid, status) { GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid, (pid, status) => {
GLib.spawn_close_pid(pid); GLib.spawn_close_pid(pid);
if (status != 0) if (status != 0)
@ -119,8 +119,8 @@ function updateExtension(uuid) {
let url = REPOSITORY_URL_DOWNLOAD.format(uuid); let url = REPOSITORY_URL_DOWNLOAD.format(uuid);
let message = Soup.form_request_new_from_hash('GET', url, params); let message = Soup.form_request_new_from_hash('GET', url, params);
_httpSession.queue_message(message, Lang.bind(this, function(session, message) { _httpSession.queue_message(message, (session, message) => {
gotExtensionZipFile(session, message, uuid, newExtensionTmpDir, function() { gotExtensionZipFile(session, message, uuid, newExtensionTmpDir, () => {
let oldExtension = ExtensionUtils.extensions[uuid]; let oldExtension = ExtensionUtils.extensions[uuid];
let extensionDir = oldExtension.dir; let extensionDir = oldExtension.dir;
@ -151,10 +151,10 @@ function updateExtension(uuid) {
} }
FileUtils.recursivelyDeleteDir(oldExtensionTmpDir, true); FileUtils.recursivelyDeleteDir(oldExtensionTmpDir, true);
}, function(code, message) { }, (code, message) => {
log('Error while updating extension %s: %s (%s)'.format(uuid, code, message ? message : '')); log('Error while updating extension %s: %s (%s)'.format(uuid, code, message ? message : ''));
}); });
})); });
} }
function checkForUpdates() { function checkForUpdates() {
@ -168,7 +168,7 @@ function checkForUpdates() {
let url = REPOSITORY_URL_UPDATE; let url = REPOSITORY_URL_UPDATE;
let message = Soup.form_request_new_from_hash('GET', url, params); let message = Soup.form_request_new_from_hash('GET', url, params);
_httpSession.queue_message(message, function(session, message) { _httpSession.queue_message(message, (session, message) => {
if (message.status_code != Soup.KnownStatusCode.OK) if (message.status_code != Soup.KnownStatusCode.OK)
return; return;
@ -258,9 +258,9 @@ var InstallExtensionDialog = new Lang.Class({
invocation.return_value(GLib.Variant.new('(s)', ['successful'])); invocation.return_value(GLib.Variant.new('(s)', ['successful']));
} }
_httpSession.queue_message(message, Lang.bind(this, function(session, message) { _httpSession.queue_message(message, (session, message) => {
gotExtensionZipFile(session, message, uuid, dir, callback, errback); gotExtensionZipFile(session, message, uuid, dir, callback, errback);
})); });
this.close(); this.close();
} }

View File

@ -273,17 +273,17 @@ function onEnabledExtensionsChanged() {
// Find and enable all the newly enabled extensions: UUIDs found in the // Find and enable all the newly enabled extensions: UUIDs found in the
// new setting, but not in the old one. // new setting, but not in the old one.
newEnabledExtensions.filter(function(uuid) { newEnabledExtensions.filter(
return enabledExtensions.indexOf(uuid) == -1; uuid => !enabledExtensions.includes(uuid)
}).forEach(function(uuid) { ).forEach(uuid => {
enableExtension(uuid); enableExtension(uuid);
}); });
// Find and disable all the newly disabled extensions: UUIDs found in the // Find and disable all the newly disabled extensions: UUIDs found in the
// old setting, but not in the new one. // old setting, but not in the new one.
enabledExtensions.filter(function(item) { enabledExtensions.filter(
return newEnabledExtensions.indexOf(item) == -1; item => !newEnabledExtensions.includes(item)
}).forEach(function(uuid) { ).forEach(uuid => {
disableExtension(uuid); disableExtension(uuid);
}); });
@ -300,7 +300,7 @@ function _onVersionValidationChanged() {
enabledExtensions = getEnabledExtensions(); enabledExtensions = getEnabledExtensions();
if (Main.sessionMode.allowExtensions) { if (Main.sessionMode.allowExtensions) {
enabledExtensions.forEach(function(uuid) { enabledExtensions.forEach(uuid => {
enableExtension(uuid); enableExtension(uuid);
}); });
} }
@ -314,7 +314,7 @@ function _loadExtensions() {
enabledExtensions = getEnabledExtensions(); enabledExtensions = getEnabledExtensions();
let finder = new ExtensionUtils.ExtensionFinder(); let finder = new ExtensionUtils.ExtensionFinder();
finder.connect('extension-found', function(finder, extension) { finder.connect('extension-found', (finder, extension) => {
loadExtension(extension); loadExtension(extension);
}); });
finder.scanExtensions(); finder.scanExtensions();
@ -328,7 +328,7 @@ function enableAllExtensions() {
_loadExtensions(); _loadExtensions();
initted = true; initted = true;
} else { } else {
enabledExtensions.forEach(function(uuid) { enabledExtensions.forEach(uuid => {
enableExtension(uuid); enableExtension(uuid);
}); });
} }
@ -340,7 +340,7 @@ function disableAllExtensions() {
return; return;
if (initted) { if (initted) {
extensionOrder.slice().reverse().forEach(function(uuid) { extensionOrder.slice().reverse().forEach(uuid => {
disableExtension(uuid); disableExtension(uuid);
}); });
} }

View File

@ -67,7 +67,9 @@ var GrabHelper = new Lang.Class({
// Adds @actor to the set of actors that are allowed to process events // Adds @actor to the set of actors that are allowed to process events
// during a grab. // during a grab.
addActor(actor) { addActor(actor) {
actor.__grabHelperDestroyId = actor.connect('destroy', Lang.bind(this, function() { this.removeActor(actor); })); actor.__grabHelperDestroyId = actor.connect('destroy', () => {
this.removeActor(actor);
});
this._actors.push(actor); this._actors.push(actor);
}, },

View File

@ -34,13 +34,13 @@ var CandidateArea = new Lang.Class({
this.actor.add(box); this.actor.add(box);
let j = i; let j = i;
box.connect('button-release-event', Lang.bind(this, function(actor, event) { box.connect('button-release-event', (actor, event) => {
this.emit('candidate-clicked', j, event.get_button(), event.get_state()); this.emit('candidate-clicked', j, event.get_button(), event.get_state());
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
})); });
} }
this.actor.connect('scroll-event', Lang.bind(this, function(actor, event) { this.actor.connect('scroll-event', (actor, event) => {
let direction = event.get_scroll_direction(); let direction = event.get_scroll_direction();
switch(direction) { switch(direction) {
case Clutter.ScrollDirection.UP: case Clutter.ScrollDirection.UP:
@ -51,7 +51,7 @@ var CandidateArea = new Lang.Class({
break; break;
}; };
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
})); });
this._buttonBox = new St.BoxLayout({ style_class: 'candidate-page-button-box' }); this._buttonBox = new St.BoxLayout({ style_class: 'candidate-page-button-box' });
@ -65,12 +65,12 @@ var CandidateArea = new Lang.Class({
this.actor.add(this._buttonBox); this.actor.add(this._buttonBox);
this._previousButton.connect('clicked', Lang.bind(this, function() { this._previousButton.connect('clicked', () => {
this.emit('previous-page'); this.emit('previous-page');
})); });
this._nextButton.connect('clicked', Lang.bind(this, function() { this._nextButton.connect('clicked', () => {
this.emit('next-page'); this.emit('next-page');
})); });
this._orientation = -1; this._orientation = -1;
this._cursorPosition = 0; this._cursorPosition = 0;
@ -152,23 +152,23 @@ var CandidatePopup = new Lang.Class({
this._candidateArea = new CandidateArea(); this._candidateArea = new CandidateArea();
box.add(this._candidateArea.actor); box.add(this._candidateArea.actor);
this._candidateArea.connect('previous-page', Lang.bind(this, function() { this._candidateArea.connect('previous-page', () => {
this._panelService.page_up(); this._panelService.page_up();
})); });
this._candidateArea.connect('next-page', Lang.bind(this, function() { this._candidateArea.connect('next-page', () => {
this._panelService.page_down(); this._panelService.page_down();
})); });
this._candidateArea.connect('cursor-up', Lang.bind(this, function() { this._candidateArea.connect('cursor-up', () => {
this._panelService.cursor_up(); this._panelService.cursor_up();
})); });
this._candidateArea.connect('cursor-down', Lang.bind(this, function() { this._candidateArea.connect('cursor-down', () => {
this._panelService.cursor_down(); this._panelService.cursor_down();
})); });
this._candidateArea.connect('candidate-clicked', Lang.bind(this, function(ca, index, button, state) { this._candidateArea.connect('candidate-clicked', () => {
this._panelService.candidate_clicked(index, button, state); this._panelService.candidate_clicked(index, button, state);
})); });
this._panelService = null; this._panelService = null;
}, },
@ -178,115 +178,103 @@ var CandidatePopup = new Lang.Class({
if (!panelService) if (!panelService)
return; return;
panelService.connect('set-cursor-location', panelService.connect('set-cursor-location', (ps, x, y, w, h) => {
Lang.bind(this, function(ps, x, y, w, h) { this._setDummyCursorGeometry(x, y, w, h);
this._setDummyCursorGeometry(x, y, w, h); });
}));
try { try {
panelService.connect('set-cursor-location-relative', panelService.connect('set-cursor-location-relative', (ps, x, y, w, h) => {
Lang.bind(this, function(ps, x, y, w, h) { if (!global.display.focus_window)
if (!global.display.focus_window) return;
return; let window = global.display.focus_window.get_compositor_private();
let window = global.display.focus_window.get_compositor_private(); this._setDummyCursorGeometry(window.x + x, window.y + y, w, h);
this._setDummyCursorGeometry(window.x + x, window.y + y, w, h); });
}));
} catch(e) { } catch(e) {
// Only recent IBus versions have support for this signal // Only recent IBus versions have support for this signal
// which is used for wayland clients. In order to work // which is used for wayland clients. In order to work
// with older IBus versions we can silently ignore the // with older IBus versions we can silently ignore the
// signal's absence. // signal's absence.
} }
panelService.connect('update-preedit-text', panelService.connect('update-preedit-text', (ps, text, cursorPosition, visible) => {
Lang.bind(this, function(ps, text, cursorPosition, visible) { this._preeditText.visible = visible;
this._preeditText.visible = visible; this._updateVisibility();
this._updateVisibility();
this._preeditText.text = text.get_text(); this._preeditText.text = text.get_text();
let attrs = text.get_attributes(); let attrs = text.get_attributes();
if (attrs) if (attrs)
this._setTextAttributes(this._preeditText.clutter_text, this._setTextAttributes(this._preeditText.clutter_text,
attrs); attrs);
})); });
panelService.connect('show-preedit-text', panelService.connect('show-preedit-text', ps => {
Lang.bind(this, function(ps) { this._preeditText.show();
this._preeditText.show(); this._updateVisibility();
this._updateVisibility(); });
})); panelService.connect('hide-preedit-text', ps => {
panelService.connect('hide-preedit-text', this._preeditText.hide();
Lang.bind(this, function(ps) { this._updateVisibility();
this._preeditText.hide(); });
this._updateVisibility(); panelService.connect('update-auxiliary-text', (ps, text, visible) => {
})); this._auxText.visible = visible;
panelService.connect('update-auxiliary-text', this._updateVisibility();
Lang.bind(this, function(ps, text, visible) {
this._auxText.visible = visible;
this._updateVisibility();
this._auxText.text = text.get_text(); this._auxText.text = text.get_text();
})); });
panelService.connect('show-auxiliary-text', panelService.connect('show-auxiliary-text', ps => {
Lang.bind(this, function(ps) { this._auxText.show();
this._auxText.show(); this._updateVisibility();
this._updateVisibility(); });
})); panelService.connect('hide-auxiliary-text', ps => {
panelService.connect('hide-auxiliary-text', this._auxText.hide();
Lang.bind(this, function(ps) { this._updateVisibility();
this._auxText.hide(); });
this._updateVisibility(); panelService.connect('update-lookup-table', (ps, lookupTable, visible) => {
})); this._candidateArea.actor.visible = visible;
panelService.connect('update-lookup-table', this._updateVisibility();
Lang.bind(this, function(ps, lookupTable, visible) {
this._candidateArea.actor.visible = visible;
this._updateVisibility();
let nCandidates = lookupTable.get_number_of_candidates(); let nCandidates = lookupTable.get_number_of_candidates();
let cursorPos = lookupTable.get_cursor_pos(); let cursorPos = lookupTable.get_cursor_pos();
let pageSize = lookupTable.get_page_size(); let pageSize = lookupTable.get_page_size();
let nPages = Math.ceil(nCandidates / pageSize); let nPages = Math.ceil(nCandidates / pageSize);
let page = ((cursorPos == 0) ? 0 : Math.floor(cursorPos / pageSize)); let page = ((cursorPos == 0) ? 0 : Math.floor(cursorPos / pageSize));
let startIndex = page * pageSize; let startIndex = page * pageSize;
let endIndex = Math.min((page + 1) * pageSize, nCandidates); let endIndex = Math.min((page + 1) * pageSize, nCandidates);
let indexes = []; let indexes = [];
let indexLabel; let indexLabel;
for (let i = 0; indexLabel = lookupTable.get_label(i); ++i) for (let i = 0; indexLabel = lookupTable.get_label(i); ++i)
indexes.push(indexLabel.get_text()); indexes.push(indexLabel.get_text());
Main.keyboard.resetSuggestions(); Main.keyboard.resetSuggestions();
let candidates = []; let candidates = [];
for (let i = startIndex; i < endIndex; ++i) { for (let i = startIndex; i < endIndex; ++i) {
candidates.push(lookupTable.get_candidate(i).get_text()); candidates.push(lookupTable.get_candidate(i).get_text());
Main.keyboard.addSuggestion(lookupTable.get_candidate(i).get_text(), Lang.bind(this, function() { Main.keyboard.addSuggestion(lookupTable.get_candidate(i).get_text(), () => {
let index = i; let index = i;
this._panelService.candidate_clicked(index, 1, 0); this._panelService.candidate_clicked(index, 1, 0);
})); });
} }
this._candidateArea.setCandidates(indexes, this._candidateArea.setCandidates(indexes,
candidates, candidates,
cursorPos % pageSize, cursorPos % pageSize,
lookupTable.is_cursor_visible()); lookupTable.is_cursor_visible());
this._candidateArea.setOrientation(lookupTable.get_orientation()); this._candidateArea.setOrientation(lookupTable.get_orientation());
this._candidateArea.updateButtons(lookupTable.is_round(), page, nPages); this._candidateArea.updateButtons(lookupTable.is_round(), page, nPages);
})); });
panelService.connect('show-lookup-table', panelService.connect('show-lookup-table', ps => {
Lang.bind(this, function(ps) { this._candidateArea.actor.show();
this._candidateArea.actor.show(); this._updateVisibility();
this._updateVisibility(); });
})); panelService.connect('hide-lookup-table', ps => {
panelService.connect('hide-lookup-table', this._candidateArea.actor.hide();
Lang.bind(this, function(ps) { this._updateVisibility();
this._candidateArea.actor.hide(); });
this._updateVisibility(); panelService.connect('focus-out', ps => {
})); this._boxPointer.hide(BoxPointer.PopupAnimation.NONE);
panelService.connect('focus-out', Main.keyboard.resetSuggestions();
Lang.bind(this, function(ps) { });
this._boxPointer.hide(BoxPointer.PopupAnimation.NONE);
Main.keyboard.resetSuggestions();
}));
}, },
_setDummyCursorGeometry(x, y, w, h) { _setDummyCursorGeometry(x, y, w, h) {

View File

@ -321,11 +321,7 @@ var IconGrid = new Lang.Class({
}, },
_getVisibleChildren() { _getVisibleChildren() {
let children = this._grid.get_children(); return this._grid.get_children().filter(actor => actor.visible);
children = children.filter(function(actor) {
return actor.visible;
});
return children;
}, },
_getPreferredHeight(grid, forWidth, alloc) { _getPreferredHeight(grid, forWidth, alloc) {
@ -462,19 +458,19 @@ var IconGrid = new Lang.Class({
delay: delay, delay: delay,
scale_x: ANIMATION_BOUNCE_ICON_SCALE, scale_x: ANIMATION_BOUNCE_ICON_SCALE,
scale_y: ANIMATION_BOUNCE_ICON_SCALE, scale_y: ANIMATION_BOUNCE_ICON_SCALE,
onComplete: Lang.bind(this, function() { onComplete: () => {
Tweener.addTween(actor, Tweener.addTween(actor,
{ time: ANIMATION_TIME_IN - bounceUpTime, { time: ANIMATION_TIME_IN - bounceUpTime,
transition: 'easeInOutQuad', transition: 'easeInOutQuad',
scale_x: 1, scale_x: 1,
scale_y: 1, scale_y: 1,
onComplete: Lang.bind(this, function() { onComplete: () => {
if (isLastItem) if (isLastItem)
this._animationDone(); this._animationDone();
actor.reactive = true; actor.reactive = true;
}) }
}); });
}) }
}); });
} }
}, },
@ -495,15 +491,15 @@ var IconGrid = new Lang.Class({
// Design decision, 1/2 of the source actor size. // Design decision, 1/2 of the source actor size.
let [sourceScaledWidth, sourceScaledHeight] = [sourceWidth / 2, sourceHeight / 2]; let [sourceScaledWidth, sourceScaledHeight] = [sourceWidth / 2, sourceHeight / 2];
actors.forEach(function(actor) { actors.forEach(actor => {
let [actorX, actorY] = actor._transformedPosition = actor.get_transformed_position(); let [actorX, actorY] = actor._transformedPosition = actor.get_transformed_position();
let [x, y] = [actorX - sourceX, actorY - sourceY]; let [x, y] = [actorX - sourceX, actorY - sourceY];
actor._distance = Math.sqrt(x * x + y * y); actor._distance = Math.sqrt(x * x + y * y);
}); });
let maxDist = actors.reduce(function(prev, cur) { let maxDist = actors.reduce((prev, cur) => {
return Math.max(prev, cur._distance); return Math.max(prev, cur._distance);
}, 0); }, 0);
let minDist = actors.reduce(function(prev, cur) { let minDist = actors.reduce((prev, cur) => {
return Math.min(prev, cur._distance); return Math.min(prev, cur._distance);
}, Infinity); }, Infinity);
let normalization = maxDist - minDist; let normalization = maxDist - minDist;
@ -541,14 +537,14 @@ var IconGrid = new Lang.Class({
y: finalY, y: finalY,
scale_x: 1, scale_x: 1,
scale_y: 1, scale_y: 1,
onComplete: Lang.bind(this, function() { onComplete: () => {
if (isLastItem) if (isLastItem)
this._animationDone(); this._animationDone();
actor.opacity = 255; actor.opacity = 255;
actor.reactive = true; actor.reactive = true;
actorClone.destroy(); actorClone.destroy();
})}; }};
fadeParams = { time: ANIMATION_FADE_IN_TIME_FOR_ITEM, fadeParams = { time: ANIMATION_FADE_IN_TIME_FOR_ITEM,
transition: 'easeInOutQuad', transition: 'easeInOutQuad',
delay: delay, delay: delay,
@ -567,14 +563,14 @@ var IconGrid = new Lang.Class({
y: adjustedSourcePositionY, y: adjustedSourcePositionY,
scale_x: scaleX, scale_x: scaleX,
scale_y: scaleY, scale_y: scaleY,
onComplete: Lang.bind(this, function() { onComplete: () => {
if (isLastItem) { if (isLastItem) {
this._animationDone(); this._animationDone();
this._restoreItemsOpacity(); this._restoreItemsOpacity();
} }
actor.reactive = true; actor.reactive = true;
actorClone.destroy(); actorClone.destroy();
})}; }};
fadeParams = { time: ANIMATION_FADE_IN_TIME_FOR_ITEM, fadeParams = { time: ANIMATION_FADE_IN_TIME_FOR_ITEM,
transition: 'easeInOutQuad', transition: 'easeInOutQuad',
delay: ANIMATION_TIME_OUT + delay - ANIMATION_FADE_IN_TIME_FOR_ITEM, delay: ANIMATION_TIME_OUT + delay - ANIMATION_FADE_IN_TIME_FOR_ITEM,
@ -1000,10 +996,7 @@ var PaginatedIconGrid = new Lang.Class({
transition: 'easeInOutQuad' transition: 'easeInOutQuad'
}; };
if (i == (children.length - 1)) if (i == (children.length - 1))
params.onComplete = Lang.bind(this, params.onComplete = () => { this.emit('space-opened'); };
function() {
this.emit('space-opened');
});
Tweener.addTween(children[i], params); Tweener.addTween(children[i], params);
} }
}, },
@ -1021,10 +1014,7 @@ var PaginatedIconGrid = new Lang.Class({
{ translation_y: 0, { translation_y: 0,
time: EXTRA_SPACE_ANIMATION_TIME, time: EXTRA_SPACE_ANIMATION_TIME,
transition: 'easeInOutQuad', transition: 'easeInOutQuad',
onComplete: Lang.bind(this, onComplete: () => { this.emit('space-closed'); }
function() {
this.emit('space-closed');
})
}); });
} }
} }

View File

@ -189,19 +189,19 @@ var LanguageSelectionPopup = new Lang.Class({
for (let i in inputSources) { for (let i in inputSources) {
let is = inputSources[i]; let is = inputSources[i];
this.addAction(is.displayName, Lang.bind(this, () => { this.addAction(is.displayName, () => {
inputSourceManager.activateInputSource(is, true); inputSourceManager.activateInputSource(is, true);
})); });
} }
this.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); this.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
this.addAction(_("Region & Language Settings"), Lang.bind(this, this._launchSettings)); this.addAction(_("Region & Language Settings"), Lang.bind(this, this._launchSettings));
this._capturedEventId = 0; this._capturedEventId = 0;
this._unmapId = actor.connect('notify::mapped', Lang.bind(this, function() { this._unmapId = actor.connect('notify::mapped', () => {
if (!actor.is_mapped()) if (!actor.is_mapped())
this.close(true); this.close(true);
})); });
}, },
_launchSettings() { _launchSettings() {
@ -304,7 +304,7 @@ var Key = new Lang.Class({
if (key == this.key) { if (key == this.key) {
this._pressTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, this._pressTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
KEY_LONG_PRESS_TIME, KEY_LONG_PRESS_TIME,
Lang.bind(this, function() { () => {
this._longPress = true; this._longPress = true;
this._pressTimeoutId = 0; this._pressTimeoutId = 0;
@ -319,7 +319,7 @@ var Key = new Lang.Class({
} }
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); });
} }
}, },
@ -358,10 +358,10 @@ var Key = new Lang.Class({
this._boxPointer.show(BoxPointer.PopupAnimation.FULL); this._boxPointer.show(BoxPointer.PopupAnimation.FULL);
this._capturedEventId = global.stage.connect('captured-event', this._capturedEventId = global.stage.connect('captured-event',
Lang.bind(this, this._onCapturedEvent)); Lang.bind(this, this._onCapturedEvent));
this._unmapId = this.keyButton.connect('notify::mapped', Lang.bind(this, function() { this._unmapId = this.keyButton.connect('notify::mapped', () => {
if (!this.keyButton.is_mapped()) if (!this.keyButton.is_mapped())
this._hideSubkeys(); this._hideSubkeys();
})); });
}, },
_hideSubkeys() { _hideSubkeys() {
@ -384,45 +384,42 @@ var Key = new Lang.Class({
style_class: 'keyboard-key' }); style_class: 'keyboard-key' });
button.keyWidth = 1; button.keyWidth = 1;
button.connect('button-press-event', Lang.bind(this, button.connect('button-press-event', () => {
function () { this._press(key);
return Clutter.EVENT_PROPAGATE;
});
button.connect('button-release-event', () => {
this._release(key);
return Clutter.EVENT_PROPAGATE;
});
button.connect('touch-event', (actor, event) => {
let device = event.get_device();
let sequence = event.get_event_sequence();
// We only handle touch events here on wayland. On X11
// we do get emulated pointer events, which already works
// for single-touch cases. Besides, the X11 passive touch grab
// set up by Mutter will make us see first the touch events
// and later the pointer events, so it will look like two
// unrelated series of events, we want to avoid double handling
// in these cases.
if (!Meta.is_wayland_compositor())
return Clutter.EVENT_PROPAGATE;
if (!this._touchPressed &&
event.type() == Clutter.EventType.TOUCH_BEGIN) {
device.sequence_grab(sequence, actor);
this._touchPressed = true;
this._press(key); this._press(key);
return Clutter.EVENT_PROPAGATE; } else if (this._touchPressed &&
})); event.type() == Clutter.EventType.TOUCH_END &&
button.connect('button-release-event', Lang.bind(this, device.sequence_get_grabbed_actor(sequence) == actor) {
function () { device.sequence_ungrab(sequence);
this._touchPressed = false;
this._release(key); this._release(key);
return Clutter.EVENT_PROPAGATE; }
})); return Clutter.EVENT_PROPAGATE;
button.connect('touch-event', Lang.bind(this, });
function (actor, event) {
let device = event.get_device();
let sequence = event.get_event_sequence();
// We only handle touch events here on wayland. On X11
// we do get emulated pointer events, which already works
// for single-touch cases. Besides, the X11 passive touch grab
// set up by Mutter will make us see first the touch events
// and later the pointer events, so it will look like two
// unrelated series of events, we want to avoid double handling
// in these cases.
if (!Meta.is_wayland_compositor())
return Clutter.EVENT_PROPAGATE;
if (!this._touchPressed &&
event.type() == Clutter.EventType.TOUCH_BEGIN) {
device.sequence_grab(sequence, actor);
this._touchPressed = true;
this._press(key);
} else if (this._touchPressed &&
event.type() == Clutter.EventType.TOUCH_END &&
device.sequence_get_grabbed_actor(sequence) == actor) {
device.sequence_ungrab(sequence);
this._touchPressed = false;
this._release(key);
}
return Clutter.EVENT_PROPAGATE;
}));
return button; return button;
}, },
@ -513,8 +510,8 @@ var Keyboard = new Lang.Class({
this._lastDeviceId = null; this._lastDeviceId = null;
this._suggestions = null; this._suggestions = null;
Meta.get_backend().connect('last-device-changed', Lang.bind(this, Meta.get_backend().connect('last-device-changed',
function (backend, deviceId) { (backend, deviceId) => {
let manager = Clutter.DeviceManager.get_default(); let manager = Clutter.DeviceManager.get_default();
let device = manager.get_device(deviceId); let device = manager.get_device(deviceId);
@ -522,26 +519,26 @@ var Keyboard = new Lang.Class({
this._lastDeviceId = deviceId; this._lastDeviceId = deviceId;
this._syncEnabled(); this._syncEnabled();
} }
})); });
this._syncEnabled(); this._syncEnabled();
this._showIdleId = 0; this._showIdleId = 0;
this._keyboardVisible = false; this._keyboardVisible = false;
Main.layoutManager.connect('keyboard-visible-changed', Lang.bind(this, function(o, visible) { Main.layoutManager.connect('keyboard-visible-changed', (o, visible) => {
this._keyboardVisible = visible; this._keyboardVisible = visible;
})); });
this._keyboardRequested = false; this._keyboardRequested = false;
this._keyboardRestingId = 0; this._keyboardRestingId = 0;
Main.layoutManager.connect('monitors-changed', Lang.bind(this, this._relayout)); Main.layoutManager.connect('monitors-changed', Lang.bind(this, this._relayout));
//Main.inputMethod.connect('cursor-location-changed', Lang.bind(this, function(o, rect) { //Main.inputMethod.connect('cursor-location-changed', (o, rect) => {
// if (this._keyboardVisible) { // if (this._keyboardVisible) {
// let currentWindow = global.screen.get_display().focus_window; // let currentWindow = global.screen.get_display().focus_window;
// this.setCursorLocation(currentWindow, rect.get_x(), rect.get_y(), // this.setCursorLocation(currentWindow, rect.get_x(), rect.get_y(),
// rect.get_width(), rect.get_height()); // rect.get_width(), rect.get_height());
// } // }
//})); //});
}, },
get visible() { get visible() {
@ -568,7 +565,7 @@ var Keyboard = new Lang.Class({
GLib.source_remove(this._updateCaretPositionId); GLib.source_remove(this._updateCaretPositionId);
if (!this._keyboardRequested) if (!this._keyboardRequested)
return; return;
this._updateCaretPositionId = GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, Lang.bind(this, function() { this._updateCaretPositionId = GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
this._updateCaretPositionId = 0; this._updateCaretPositionId = 0;
let currentWindow = global.screen.get_display().focus_window; let currentWindow = global.screen.get_display().focus_window;
@ -595,7 +592,7 @@ var Keyboard = new Lang.Class({
} }
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); });
GLib.Source.set_name_by_id(this._updateCaretPositionId, '[gnome-shell] this._updateCaretPosition'); GLib.Source.set_name_by_id(this._updateCaretPositionId, '[gnome-shell] this._updateCaretPosition');
}, },
@ -694,9 +691,9 @@ var Keyboard = new Lang.Class({
this._current_page = null; this._current_page = null;
this._suggestions = new Suggestions(); this._suggestions = new Suggestions();
this._suggestions.connect('suggestion-clicked', Lang.bind(this, function(suggestions, str) { this._suggestions.connect('suggestion-clicked', (suggestions, str) => {
this._keyboardController.commitString(str); this._keyboardController.commitString(str);
})); });
this.actor.add(this._suggestions.actor, this.actor.add(this._suggestions.actor,
{ x_align: St.Align.MIDDLE, { x_align: St.Align.MIDDLE,
x_fill: false }); x_fill: false });
@ -734,11 +731,10 @@ var Keyboard = new Lang.Class({
} }
if (!this._showIdleId) { if (!this._showIdleId) {
this._showIdleId = GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, this._showIdleId = GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
Lang.bind(this, function() { this.show(Main.layoutManager.focusIndex);
this.show(Main.layoutManager.focusIndex); return GLib.SOURCE_REMOVE;
return GLib.SOURCE_REMOVE; });
}));
GLib.Source.set_name_by_id(this._showIdleId, '[gnome-shell] this.show'); GLib.Source.set_name_by_id(this._showIdleId, '[gnome-shell] this.show');
} }
}, },
@ -782,7 +778,7 @@ var Keyboard = new Lang.Class({
if (button.key == ' ') if (button.key == ' ')
button.setWidth(keys.length <= 3 ? 5 : 3); button.setWidth(keys.length <= 3 ? 5 : 3);
button.connect('pressed', Lang.bind(this, function(actor, keyval, str) { button.connect('pressed', (actor, keyval, str) => {
if (!Main.inputMethod.currentFocus || if (!Main.inputMethod.currentFocus ||
!this._keyboardController.commitString(str, true)) { !this._keyboardController.commitString(str, true)) {
if (keyval != 0) { if (keyval != 0) {
@ -790,8 +786,8 @@ var Keyboard = new Lang.Class({
button._keyvalPress = true; button._keyvalPress = true;
} }
} }
})); });
button.connect('released', Lang.bind(this, function(actor, keyval, str) { button.connect('released', (actor, keyval, str) => {
if (keyval != 0) { if (keyval != 0) {
if (button._keyvalPress) if (button._keyvalPress)
this._keyboardController.keyvalRelease(keyval); this._keyboardController.keyvalRelease(keyval);
@ -800,7 +796,7 @@ var Keyboard = new Lang.Class({
if (!this._latched) if (!this._latched)
this._setActiveLayer(0); this._setActiveLayer(0);
})); });
layout.appendKey(button.actor, button.keyButton.keyWidth); layout.appendKey(button.actor, button.keyButton.keyWidth);
} }
@ -833,7 +829,7 @@ var Keyboard = new Lang.Class({
let actor = extraButton.keyButton; let actor = extraButton.keyButton;
extraButton.connect('pressed', Lang.bind(this, function() { extraButton.connect('pressed', () => {
if (switchToLevel != null) { if (switchToLevel != null) {
this._setActiveLayer(switchToLevel); this._setActiveLayer(switchToLevel);
// Shift only gets latched on long press // Shift only gets latched on long press
@ -841,23 +837,23 @@ var Keyboard = new Lang.Class({
} else if (keyval != null) { } else if (keyval != null) {
this._keyboardController.keyvalPress(keyval); this._keyboardController.keyvalPress(keyval);
} }
})); });
extraButton.connect('released', Lang.bind(this, function() { extraButton.connect('released', () => {
if (keyval != null) if (keyval != null)
this._keyboardController.keyvalRelease(keyval); this._keyboardController.keyvalRelease(keyval);
else if (action == 'hide') else if (action == 'hide')
this.hide(); this.hide();
else if (action == 'languageMenu') else if (action == 'languageMenu')
this._popupLanguageMenu(actor); this._popupLanguageMenu(actor);
})); });
if (switchToLevel == 0) { if (switchToLevel == 0) {
layout.shiftKeys.push(extraButton); layout.shiftKeys.push(extraButton);
} else if (switchToLevel == 1) { } else if (switchToLevel == 1) {
extraButton.connect('long-press', Lang.bind(this, function() { extraButton.connect('long-press', () => {
this._latched = true; this._latched = true;
this._setCurrentLevelLatched(this._current_page, this._latched); this._setCurrentLevelLatched(this._current_page, this._latched);
})); });
} }
/* Fixup default keys based on the number of levels/keys */ /* Fixup default keys based on the number of levels/keys */
@ -1019,11 +1015,11 @@ var Keyboard = new Lang.Class({
this._clearKeyboardRestTimer(); this._clearKeyboardRestTimer();
this._keyboardRestingId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, this._keyboardRestingId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
KEYBOARD_REST_TIME, KEYBOARD_REST_TIME,
Lang.bind(this, function() { () => {
this._clearKeyboardRestTimer(); this._clearKeyboardRestTimer();
this._show(monitor); this._show(monitor);
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); });
GLib.Source.set_name_by_id(this._keyboardRestingId, '[gnome-shell] this._clearKeyboardRestTimer'); GLib.Source.set_name_by_id(this._keyboardRestingId, '[gnome-shell] this._clearKeyboardRestTimer');
}, },
@ -1051,11 +1047,11 @@ var Keyboard = new Lang.Class({
this._clearKeyboardRestTimer(); this._clearKeyboardRestTimer();
this._keyboardRestingId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, this._keyboardRestingId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
KEYBOARD_REST_TIME, KEYBOARD_REST_TIME,
Lang.bind(this, function() { () => {
this._clearKeyboardRestTimer(); this._clearKeyboardRestTimer();
this._hide(); this._hide();
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); });
GLib.Source.set_name_by_id(this._keyboardRestingId, '[gnome-shell] this._clearKeyboardRestTimer'); GLib.Source.set_name_by_id(this._keyboardRestingId, '[gnome-shell] this._clearKeyboardRestTimer');
}, },
@ -1177,7 +1173,9 @@ var KeyboardController = new Lang.Class({
Main.inputMethod.connect('notify::content-purpose', Lang.bind(this, this._onContentPurposeHintsChanged)); Main.inputMethod.connect('notify::content-purpose', Lang.bind(this, this._onContentPurposeHintsChanged));
Main.inputMethod.connect('notify::content-hints', Lang.bind(this, this._onContentPurposeHintsChanged)); Main.inputMethod.connect('notify::content-hints', Lang.bind(this, this._onContentPurposeHintsChanged));
Main.inputMethod.connect('input-panel-state', Lang.bind(this, function(o, state) { this.emit('panel-state', state); })); Main.inputMethod.connect('input-panel-state', (o, state) => {
this.emit('panel-state', state);
});
}, },
_onSourcesModified() { _onSourcesModified() {

View File

@ -101,16 +101,18 @@ var MonitorConstraint = new Lang.Class({
vfunc_set_actor(actor) { vfunc_set_actor(actor) {
if (actor) { if (actor) {
if (!this._monitorsChangedId) { if (!this._monitorsChangedId) {
this._monitorsChangedId = Main.layoutManager.connect('monitors-changed', Lang.bind(this, function() { this._monitorsChangedId =
this.actor.queue_relayout(); Main.layoutManager.connect('monitors-changed', () => {
})); this.actor.queue_relayout();
});
} }
if (!this._workareasChangedId) { if (!this._workareasChangedId) {
this._workareasChangedId = global.screen.connect('workareas-changed', Lang.bind(this, function() { this._workareasChangedId =
if (this._workArea) global.screen.connect('workareas-changed', () => {
this.actor.queue_relayout(); if (this._workArea)
})); this.actor.queue_relayout();
});
} }
} else { } else {
if (this._monitorsChangedId) if (this._monitorsChangedId)
@ -201,22 +203,19 @@ var LayoutManager = new Lang.Class({
// Set up stage hierarchy to group all UI actors under one container. // Set up stage hierarchy to group all UI actors under one container.
this.uiGroup = new Shell.GenericContainer({ name: 'uiGroup' }); this.uiGroup = new Shell.GenericContainer({ name: 'uiGroup' });
this.uiGroup.connect('allocate', this.uiGroup.connect('allocate', (actor, box, flags) => {
function (actor, box, flags) { let children = actor.get_children();
let children = actor.get_children(); for (let i = 0; i < children.length; i++)
for (let i = 0; i < children.length; i++) children[i].allocate_preferred_size(flags);
children[i].allocate_preferred_size(flags); });
}); this.uiGroup.connect('get-preferred-width', (actor, forHeight, alloc) => {
this.uiGroup.connect('get-preferred-width', let width = global.stage.width;
function(actor, forHeight, alloc) { [alloc.min_size, alloc.natural_size] = [width, width];
let width = global.stage.width; });
[alloc.min_size, alloc.natural_size] = [width, width]; this.uiGroup.connect('get-preferred-height', (actor, forWidth, alloc) => {
}); let height = global.stage.height;
this.uiGroup.connect('get-preferred-height', [alloc.min_size, alloc.natural_size] = [height, height];
function(actor, forWidth, alloc) { });
let height = global.stage.height;
[alloc.min_size, alloc.natural_size] = [height, height];
});
global.stage.remove_actor(global.window_group); global.stage.remove_actor(global.window_group);
this.uiGroup.add_actor(global.window_group); this.uiGroup.add_actor(global.window_group);
@ -285,11 +284,11 @@ var LayoutManager = new Lang.Class({
// https://bugzilla.gnome.org/show_bug.cgi?id=739178 // https://bugzilla.gnome.org/show_bug.cgi?id=739178
if (Shell.util_need_background_refresh()) { if (Shell.util_need_background_refresh()) {
LoginManager.getLoginManager().connect('prepare-for-sleep', LoginManager.getLoginManager().connect('prepare-for-sleep',
function(lm, suspending) { (lm, suspending) => {
if (suspending) if (suspending)
return; return;
Meta.Background.refresh_all(); Meta.Background.refresh_all();
}); });
} }
}, },
@ -359,7 +358,7 @@ var LayoutManager = new Lang.Class({
_updateHotCorners() { _updateHotCorners() {
// destroy old hot corners // destroy old hot corners
this.hotCorners.forEach(function(corner) { this.hotCorners.forEach(corner => {
if (corner) if (corner)
corner.destroy(); corner.destroy();
}); });
@ -487,7 +486,7 @@ var LayoutManager = new Lang.Class({
this._updatePanelBarrier(); this._updatePanelBarrier();
let size = this.panelBox.height; let size = this.panelBox.height;
this.hotCorners.forEach(function(corner) { this.hotCorners.forEach(corner => {
if (corner) if (corner)
corner.setBarrierSize(size); corner.setBarrierSize(size);
}); });
@ -584,13 +583,13 @@ var LayoutManager = new Lang.Class({
coordinate: Clutter.BindCoordinate.ALL }); coordinate: Clutter.BindCoordinate.ALL });
this._systemBackground.actor.add_constraint(constraint); this._systemBackground.actor.add_constraint(constraint);
let signalId = this._systemBackground.connect('loaded', Lang.bind(this, function() { let signalId = this._systemBackground.connect('loaded', () => {
this._systemBackground.disconnect(signalId); this._systemBackground.disconnect(signalId);
this._systemBackground.actor.show(); this._systemBackground.actor.show();
global.stage.show(); global.stage.show();
this._prepareStartupAnimation(); this._prepareStartupAnimation();
})); });
}, },
// Startup Animations // Startup Animations
@ -652,10 +651,10 @@ var LayoutManager = new Lang.Class({
// until the event loop is uncontended and idle. // until the event loop is uncontended and idle.
// This helps to prevent us from running the animation // This helps to prevent us from running the animation
// when the system is bogged down // when the system is bogged down
let id = GLib.idle_add(GLib.PRIORITY_LOW, Lang.bind(this, function() { let id = GLib.idle_add(GLib.PRIORITY_LOW, () => {
this._startupAnimation(); this._startupAnimation();
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); });
GLib.Source.set_name_by_id(id, '[gnome-shell] this._startupAnimation'); GLib.Source.set_name_by_id(id, '[gnome-shell] this._startupAnimation');
}, },
@ -727,9 +726,9 @@ var LayoutManager = new Lang.Class({
// anchor point changes // anchor point changes
this._updateRegions(); this._updateRegions();
this._keyboardHeightNotifyId = this.keyboardBox.connect('notify::height', Lang.bind(this, function () { this._keyboardHeightNotifyId = this.keyboardBox.connect('notify::height', () => {
this.keyboardBox.anchor_y = this.keyboardBox.height; this.keyboardBox.anchor_y = this.keyboardBox.height;
})); });
}, },
hideKeyboard(immediate) { hideKeyboard(immediate) {
@ -940,7 +939,7 @@ var LayoutManager = new Lang.Class({
}, },
_getWindowActorsForWorkspace(workspace) { _getWindowActorsForWorkspace(workspace) {
return global.get_window_actors().filter(function (actor) { return global.get_window_actors().filter(actor => {
let win = actor.meta_window; let win = actor.meta_window;
return win.located_on_workspace(workspace); return win.located_on_workspace(workspace);
}); });
@ -1359,7 +1358,7 @@ var PressureBarrier = new Lang.Class({
_onBarrierLeft(barrier, event) { _onBarrierLeft(barrier, event) {
barrier._isHit = false; barrier._isHit = false;
if (this._barriers.every(function(b) { return !b._isHit; })) { if (this._barriers.every(b => !b._isHit)) {
this._reset(); this._reset();
this._isTriggered = false; this._isTriggered = false;
} }

View File

@ -171,20 +171,20 @@ var Lightbox = new Lang.Class({
vignetteSharpness: VIGNETTE_SHARPNESS, vignetteSharpness: VIGNETTE_SHARPNESS,
time: fadeInTime, time: fadeInTime,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete: Lang.bind(this, function() { onComplete: () => {
this.shown = true; this.shown = true;
this.emit('shown'); this.emit('shown');
}) }
}); });
} else { } else {
Tweener.addTween(this.actor, Tweener.addTween(this.actor,
{ opacity: 255 * this._fadeFactor, { opacity: 255 * this._fadeFactor,
time: fadeInTime, time: fadeInTime,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete: Lang.bind(this, function() { onComplete: () => {
this.shown = true; this.shown = true;
this.emit('shown'); this.emit('shown');
}) }
}); });
} }
@ -203,18 +203,18 @@ var Lightbox = new Lang.Class({
opacity: 0, opacity: 0,
time: fadeOutTime, time: fadeOutTime,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete: Lang.bind(this, function() { onComplete: () => {
this.actor.hide(); this.actor.hide();
}) }
}); });
} else { } else {
Tweener.addTween(this.actor, Tweener.addTween(this.actor,
{ opacity: 0, { opacity: 0,
time: fadeOutTime, time: fadeOutTime,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete: Lang.bind(this, function() { onComplete: () => {
this.actor.hide(); this.actor.hide();
}) }
}); });
} }
}, },

View File

@ -53,7 +53,9 @@ var AUTO_COMPLETE_GLOBAL_KEYWORDS = _getAutoCompleteGlobalKeywords();
function _getAutoCompleteGlobalKeywords() { function _getAutoCompleteGlobalKeywords() {
const keywords = ['true', 'false', 'null', 'new']; const keywords = ['true', 'false', 'null', 'new'];
// Don't add the private properties of window (i.e., ones starting with '_') // Don't add the private properties of window (i.e., ones starting with '_')
const windowProperties = Object.getOwnPropertyNames(window).filter(function(a){ return a.charAt(0) != '_' }); const windowProperties = Object.getOwnPropertyNames(window).filter(
a => a.charAt(0) != '_'
);
const headerProperties = JsParse.getDeclaredConstants(commandHeader); const headerProperties = JsParse.getDeclaredConstants(commandHeader);
return keywords.concat(windowProperties).concat(headerProperties); return keywords.concat(windowProperties).concat(headerProperties);
@ -142,10 +144,10 @@ var Notebook = new Lang.Class({
reactive: true, reactive: true,
track_hover: true }); track_hover: true });
let label = new St.Button({ label: name }); let label = new St.Button({ label: name });
label.connect('clicked', Lang.bind(this, function () { label.connect('clicked', () => {
this.selectChild(child); this.selectChild(child);
return true; return true;
})); });
labelBox.add(label, { expand: true }); labelBox.add(label, { expand: true });
this.tabControls.add(labelBox); this.tabControls.add(labelBox);
@ -163,8 +165,8 @@ var Notebook = new Lang.Class({
this.actor.add(scrollview, { expand: true }); this.actor.add(scrollview, { expand: true });
let vAdjust = scrollview.vscroll.adjustment; let vAdjust = scrollview.vscroll.adjustment;
vAdjust.connect('changed', Lang.bind(this, function () { this._onAdjustScopeChanged(tabData); })); vAdjust.connect('changed', () => { this._onAdjustScopeChanged(tabData); });
vAdjust.connect('notify::value', Lang.bind(this, function() { this._onAdjustValueChanged(tabData); })); vAdjust.connect('notify::value', () => { this._onAdjustValueChanged(tabData); });
if (this._selectedIndex == -1) if (this._selectedIndex == -1)
this.selectIndex(0); this.selectIndex(0);
@ -821,34 +823,34 @@ var LookingGlass = new Lang.Class({
icon_size: 24 }); icon_size: 24 });
toolbar.add_actor(inspectIcon); toolbar.add_actor(inspectIcon);
inspectIcon.reactive = true; inspectIcon.reactive = true;
inspectIcon.connect('button-press-event', Lang.bind(this, function () { inspectIcon.connect('button-press-event', () => {
let inspector = new Inspector(this); let inspector = new Inspector(this);
inspector.connect('target', Lang.bind(this, function(i, target, stageX, stageY) { inspector.connect('target', (i, target, stageX, stageY) => {
this._pushResult('inspect(' + Math.round(stageX) + ', ' + Math.round(stageY) + ')', target); this._pushResult('inspect(' + Math.round(stageX) + ', ' + Math.round(stageY) + ')', target);
})); });
inspector.connect('closed', Lang.bind(this, function() { inspector.connect('closed', () => {
this.actor.show(); this.actor.show();
global.stage.set_key_focus(this._entry); global.stage.set_key_focus(this._entry);
})); });
this.actor.hide(); this.actor.hide();
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
})); });
let gcIcon = new St.Icon({ icon_name: 'user-trash-full', let gcIcon = new St.Icon({ icon_name: 'user-trash-full',
icon_size: 24 }); icon_size: 24 });
toolbar.add_actor(gcIcon); toolbar.add_actor(gcIcon);
gcIcon.reactive = true; gcIcon.reactive = true;
gcIcon.connect('button-press-event', Lang.bind(this, function () { gcIcon.connect('button-press-event', () => {
gcIcon.icon_name = 'user-trash'; gcIcon.icon_name = 'user-trash';
System.gc(); System.gc();
this._timeoutId = Mainloop.timeout_add(500, Lang.bind(this, function () { this._timeoutId = Mainloop.timeout_add(500, () => {
gcIcon.icon_name = 'user-trash-full'; gcIcon.icon_name = 'user-trash-full';
this._timeoutId = 0; this._timeoutId = 0;
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); });
GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] gcIcon.icon_name = \'user-trash-full\''); GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] gcIcon.icon_name = \'user-trash-full\'');
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
})); });
let notebook = new Notebook(); let notebook = new Notebook();
this._notebook = notebook; this._notebook = notebook;
@ -880,7 +882,7 @@ var LookingGlass = new Lang.Class({
this._extensions = new Extensions(this); this._extensions = new Extensions(this);
notebook.appendPage('Extensions', this._extensions.actor); notebook.appendPage('Extensions', this._extensions.actor);
this._entry.clutter_text.connect('activate', Lang.bind(this, function (o, e) { this._entry.clutter_text.connect('activate', (o, e) => {
// Hide any completions we are currently showing // Hide any completions we are currently showing
this._hideCompletions(); this._hideCompletions();
@ -894,21 +896,21 @@ var LookingGlass = new Lang.Class({
return true; return true;
this._evaluate(text); this._evaluate(text);
return true; return true;
})); });
this._history = new History.HistoryManager({ gsettingsKey: HISTORY_KEY, this._history = new History.HistoryManager({ gsettingsKey: HISTORY_KEY,
entry: this._entry.clutter_text }); entry: this._entry.clutter_text });
this._autoComplete = new AutoComplete(this._entry); this._autoComplete = new AutoComplete(this._entry);
this._autoComplete.connect('suggest', Lang.bind(this, function(a,e) { this._autoComplete.connect('suggest', (a, e) => {
this._showCompletions(e.completions); this._showCompletions(e.completions);
})); });
// If a completion is completed unambiguously, the currently-displayed completion // If a completion is completed unambiguously, the currently-displayed completion
// suggestions become irrelevant. // suggestions become irrelevant.
this._autoComplete.connect('completion', Lang.bind(this, function(a,e) { this._autoComplete.connect('completion', (a, e) => {
if (e.type == 'whole-word') if (e.type == 'whole-word')
this._hideCompletions(); this._hideCompletions();
})); });
this._resize(); this._resize();
}, },
@ -987,9 +989,9 @@ var LookingGlass = new Lang.Class({
transition: 'easeOutQuad', transition: 'easeOutQuad',
height: 0, height: 0,
opacity: 0, opacity: 0,
onComplete: Lang.bind(this, function () { onComplete: () => {
this._completionActor.hide(); this._completionActor.hide();
}) }
}); });
} }
}, },
@ -1030,8 +1032,7 @@ var LookingGlass = new Lang.Class({
}, },
_queueResize() { _queueResize() {
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => { this._resize(); });
Lang.bind(this, function () { this._resize(); }));
}, },
_resize() { _resize() {
@ -1120,9 +1121,9 @@ var LookingGlass = new Lang.Class({
Tweener.addTween(this.actor, { time: Math.min(0.5 / St.get_slow_down_factor(), 0.5), Tweener.addTween(this.actor, { time: Math.min(0.5 / St.get_slow_down_factor(), 0.5),
transition: 'easeOutQuad', transition: 'easeOutQuad',
y: this._hiddenY, y: this._hiddenY,
onComplete: Lang.bind(this, function () { onComplete: () => {
this.actor.hide(); this.actor.hide();
}) }
}); });
} }
}); });

View File

@ -111,7 +111,7 @@ var Magnifier = new Lang.Class({
setActive(activate) { setActive(activate) {
let isActive = this.isActive(); let isActive = this.isActive();
this._zoomRegions.forEach (function(zoomRegion, index, array) { this._zoomRegions.forEach ((zoomRegion, index, array) => {
zoomRegion.setActive(activate); zoomRegion.setActive(activate);
}); });
@ -189,7 +189,7 @@ var Magnifier = new Lang.Class({
this.yMouse = yMouse; this.yMouse = yMouse;
let sysMouseOverAny = false; let sysMouseOverAny = false;
this._zoomRegions.forEach(function(zoomRegion, index, array) { this._zoomRegions.forEach((zoomRegion, index, array) => {
if (zoomRegion.scrollToMousePos()) if (zoomRegion.scrollToMousePos())
sysMouseOverAny = true; sysMouseOverAny = true;
}); });
@ -287,7 +287,7 @@ var Magnifier = new Lang.Class({
this.setCrosshairsClip(clip); this.setCrosshairsClip(clip);
let theCrossHairs = this._crossHairs; let theCrossHairs = this._crossHairs;
this._zoomRegions.forEach (function(zoomRegion, index, array) { this._zoomRegions.forEach ((zoomRegion, index, array) => {
zoomRegion.addCrosshairs(theCrossHairs); zoomRegion.addCrosshairs(theCrossHairs);
}); });
}, },
@ -447,10 +447,9 @@ var Magnifier = new Lang.Class({
this._appSettings = new Gio.Settings({ schema_id: APPLICATIONS_SCHEMA }); this._appSettings = new Gio.Settings({ schema_id: APPLICATIONS_SCHEMA });
this._settings = new Gio.Settings({ schema_id: MAGNIFIER_SCHEMA }); this._settings = new Gio.Settings({ schema_id: MAGNIFIER_SCHEMA });
this._appSettings.connect('changed::' + SHOW_KEY, this._appSettings.connect('changed::' + SHOW_KEY, () => {
Lang.bind(this, function() {
this.setActive(this._appSettings.get_boolean(SHOW_KEY)); this.setActive(this._appSettings.get_boolean(SHOW_KEY));
})); });
this._settings.connect('changed::' + SCREEN_POSITION_KEY, this._settings.connect('changed::' + SCREEN_POSITION_KEY,
Lang.bind(this, this._updateScreenPosition)); Lang.bind(this, this._updateScreenPosition));
@ -486,35 +485,29 @@ var Magnifier = new Lang.Class({
this._settings.connect('changed::' + CONTRAST_BLUE_KEY, this._settings.connect('changed::' + CONTRAST_BLUE_KEY,
Lang.bind(this, this._updateContrast)); Lang.bind(this, this._updateContrast));
this._settings.connect('changed::' + SHOW_CROSS_HAIRS_KEY, this._settings.connect('changed::' + SHOW_CROSS_HAIRS_KEY, () => {
Lang.bind(this, function() {
this.setCrosshairsVisible(this._settings.get_boolean(SHOW_CROSS_HAIRS_KEY)); this.setCrosshairsVisible(this._settings.get_boolean(SHOW_CROSS_HAIRS_KEY));
})); });
this._settings.connect('changed::' + CROSS_HAIRS_THICKNESS_KEY, this._settings.connect('changed::' + CROSS_HAIRS_THICKNESS_KEY, () => {
Lang.bind(this, function() {
this.setCrosshairsThickness(this._settings.get_int(CROSS_HAIRS_THICKNESS_KEY)); this.setCrosshairsThickness(this._settings.get_int(CROSS_HAIRS_THICKNESS_KEY));
})); });
this._settings.connect('changed::' + CROSS_HAIRS_COLOR_KEY, this._settings.connect('changed::' + CROSS_HAIRS_COLOR_KEY, () => {
Lang.bind(this, function() {
this.setCrosshairsColor(this._settings.get_string(CROSS_HAIRS_COLOR_KEY)); this.setCrosshairsColor(this._settings.get_string(CROSS_HAIRS_COLOR_KEY));
})); });
this._settings.connect('changed::' + CROSS_HAIRS_OPACITY_KEY, this._settings.connect('changed::' + CROSS_HAIRS_OPACITY_KEY, () => {
Lang.bind(this, function() {
this.setCrosshairsOpacity(this._settings.get_double(CROSS_HAIRS_OPACITY_KEY)); this.setCrosshairsOpacity(this._settings.get_double(CROSS_HAIRS_OPACITY_KEY));
})); });
this._settings.connect('changed::' + CROSS_HAIRS_LENGTH_KEY, this._settings.connect('changed::' + CROSS_HAIRS_LENGTH_KEY, () => {
Lang.bind(this, function() {
this.setCrosshairsLength(this._settings.get_int(CROSS_HAIRS_LENGTH_KEY)); this.setCrosshairsLength(this._settings.get_int(CROSS_HAIRS_LENGTH_KEY));
})); });
this._settings.connect('changed::' + CROSS_HAIRS_CLIP_KEY, this._settings.connect('changed::' + CROSS_HAIRS_CLIP_KEY, () => {
Lang.bind(this, function() {
this.setCrosshairsClip(this._settings.get_boolean(CROSS_HAIRS_CLIP_KEY)); this.setCrosshairsClip(this._settings.get_boolean(CROSS_HAIRS_CLIP_KEY));
})); });
if (zoomRegion) { if (zoomRegion) {
// Mag factor is accurate to two decimal places. // Mag factor is accurate to two decimal places.
@ -1088,10 +1081,10 @@ var ZoomRegion = new Lang.Class({
} }
this._clearScrollContentsTimer(); this._clearScrollContentsTimer();
this._scrollContentsTimerId = Mainloop.timeout_add(POINTER_REST_TIME, Lang.bind(this, function() { this._scrollContentsTimerId = Mainloop.timeout_add(POINTER_REST_TIME, () => {
this._scrollContentsToDelayed(x, y); this._scrollContentsToDelayed(x, y);
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); });
}, },
/** /**

View File

@ -203,7 +203,7 @@ var ShellMagnifier = new Lang.Class({
let zoomRegions = Main.magnifier.getZoomRegions(); let zoomRegions = Main.magnifier.getZoomRegions();
let objectPaths = []; let objectPaths = [];
let thoseZoomers = this._zoomers; let thoseZoomers = this._zoomers;
zoomRegions.forEach (function(aZoomRegion, index, array) { zoomRegions.forEach ((aZoomRegion, index, array) => {
let found = false; let found = false;
for (let objectPath in thoseZoomers) { for (let objectPath in thoseZoomers) {
let proxyAndZoomRegion = thoseZoomers[objectPath]; let proxyAndZoomRegion = thoseZoomers[objectPath];

View File

@ -119,7 +119,9 @@ function start() {
global.log = window.log; global.log = window.log;
// Chain up async errors reported from C // Chain up async errors reported from C
global.connect('notify-error', function (global, msg, detail) { notifyError(msg, detail); }); global.connect('notify-error', (global, msg, detail) => {
notifyError(msg, detail);
});
Gio.DesktopAppInfo.set_desktop_env('GNOME'); Gio.DesktopAppInfo.set_desktop_env('GNOME');
@ -190,17 +192,17 @@ function _initializeUI() {
_a11ySettings = new Gio.Settings({ schema_id: A11Y_SCHEMA }); _a11ySettings = new Gio.Settings({ schema_id: A11Y_SCHEMA });
global.display.connect('overlay-key', Lang.bind(overview, function () { global.display.connect('overlay-key', () => {
if (!_a11ySettings.get_boolean (STICKY_KEYS_ENABLE)) if (!_a11ySettings.get_boolean (STICKY_KEYS_ENABLE))
overview.toggle(); overview.toggle();
})); });
global.display.connect('show-restart-message', function(display, message) { global.display.connect('show-restart-message', (display, message) => {
showRestartMessage(message); showRestartMessage(message);
return true; return true;
}); });
global.display.connect('restart', function() { global.display.connect('restart', () => {
global.reexec_self(); global.reexec_self();
return true; return true;
}); });
@ -227,12 +229,12 @@ function _initializeUI() {
ExtensionSystem.init(); ExtensionSystem.init();
if (sessionMode.isGreeter && screenShield) { if (sessionMode.isGreeter && screenShield) {
layoutManager.connect('startup-prepared', function() { layoutManager.connect('startup-prepared', () => {
screenShield.showDialog(); screenShield.showDialog();
}); });
} }
layoutManager.connect('startup-complete', function() { layoutManager.connect('startup-complete', () => {
if (actionMode == Shell.ActionMode.NONE) { if (actionMode == Shell.ActionMode.NONE) {
actionMode = Shell.ActionMode.NORMAL; actionMode = Shell.ActionMode.NORMAL;
} }
@ -423,7 +425,7 @@ function pushModal(actor, params) {
} }
modalCount += 1; modalCount += 1;
let actorDestroyId = actor.connect('destroy', function() { let actorDestroyId = actor.connect('destroy', () => {
let index = _findModal(actor); let index = _findModal(actor);
if (index >= 0) if (index >= 0)
popModal(actor); popModal(actor);
@ -432,7 +434,7 @@ function pushModal(actor, params) {
let prevFocus = global.stage.get_key_focus(); let prevFocus = global.stage.get_key_focus();
let prevFocusDestroyId; let prevFocusDestroyId;
if (prevFocus != null) { if (prevFocus != null) {
prevFocusDestroyId = prevFocus.connect('destroy', function() { prevFocusDestroyId = prevFocus.connect('destroy', () => {
let index = _findModal(actor); let index = _findModal(actor);
if (index >= 0) if (index >= 0)
modalActorFocusStack[index].prevFocus = null; modalActorFocusStack[index].prevFocus = null;
@ -606,7 +608,7 @@ function _runBeforeRedrawQueue() {
function _queueBeforeRedraw(workId) { function _queueBeforeRedraw(workId) {
_beforeRedrawQueue.push(workId); _beforeRedrawQueue.push(workId);
if (_beforeRedrawQueue.length == 1) { if (_beforeRedrawQueue.length == 1) {
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, function () { Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
_runBeforeRedrawQueue(); _runBeforeRedrawQueue();
return false; return false;
}); });
@ -636,12 +638,12 @@ function initializeDeferredWork(actor, callback, props) {
let workId = '' + (++_deferredWorkSequence); let workId = '' + (++_deferredWorkSequence);
_deferredWorkData[workId] = { 'actor': actor, _deferredWorkData[workId] = { 'actor': actor,
'callback': callback }; 'callback': callback };
actor.connect('notify::mapped', function () { actor.connect('notify::mapped', () => {
if (!(actor.mapped && _deferredWorkQueue.indexOf(workId) >= 0)) if (!(actor.mapped && _deferredWorkQueue.indexOf(workId) >= 0))
return; return;
_queueBeforeRedraw(workId); _queueBeforeRedraw(workId);
}); });
actor.connect('destroy', function() { actor.connect('destroy', () => {
let index = _deferredWorkQueue.indexOf(workId); let index = _deferredWorkQueue.indexOf(workId);
if (index >= 0) if (index >= 0)
_deferredWorkQueue.splice(index, 1); _deferredWorkQueue.splice(index, 1);
@ -673,7 +675,7 @@ function queueDeferredWork(workId) {
_queueBeforeRedraw(workId); _queueBeforeRedraw(workId);
return; return;
} else if (_deferredTimeoutId == 0) { } else if (_deferredTimeoutId == 0) {
_deferredTimeoutId = Mainloop.timeout_add_seconds(DEFERRED_TIMEOUT_SECONDS, function () { _deferredTimeoutId = Mainloop.timeout_add_seconds(DEFERRED_TIMEOUT_SECONDS, () => {
_runAllDeferredWork(); _runAllDeferredWork();
_deferredTimeoutId = 0; _deferredTimeoutId = 0;
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;

View File

@ -48,7 +48,7 @@ var URLHighlighter = new Lang.Class({
this.actor = new St.Label({ reactive: true, style_class: 'url-highlighter', this.actor = new St.Label({ reactive: true, style_class: 'url-highlighter',
x_expand: true, x_align: Clutter.ActorAlign.START }); x_expand: true, x_align: Clutter.ActorAlign.START });
this._linkColor = '#ccccff'; this._linkColor = '#ccccff';
this.actor.connect('style-changed', Lang.bind(this, function() { this.actor.connect('style-changed', () => {
let [hasColor, color] = this.actor.get_theme_node().lookup_color('link-color', false); let [hasColor, color] = this.actor.get_theme_node().lookup_color('link-color', false);
if (hasColor) { if (hasColor) {
let linkColor = color.to_string().substr(0, 7); let linkColor = color.to_string().substr(0, 7);
@ -57,12 +57,12 @@ var URLHighlighter = new Lang.Class({
this._highlightUrls(); this._highlightUrls();
} }
} }
})); });
this.actor.clutter_text.line_wrap = lineWrap; this.actor.clutter_text.line_wrap = lineWrap;
this.actor.clutter_text.line_wrap_mode = Pango.WrapMode.WORD_CHAR; this.actor.clutter_text.line_wrap_mode = Pango.WrapMode.WORD_CHAR;
this.setMarkup(text, allowMarkup); this.setMarkup(text, allowMarkup);
this.actor.connect('button-press-event', Lang.bind(this, function(actor, event) { this.actor.connect('button-press-event', (actor, event) => {
// Don't try to URL highlight when invisible. // Don't try to URL highlight when invisible.
// The MessageTray doesn't actually hide us, so // The MessageTray doesn't actually hide us, so
// we need to check for paint opacities as well. // we need to check for paint opacities as well.
@ -73,8 +73,8 @@ var URLHighlighter = new Lang.Class({
// a pointer grab, which would block our button-release-event // a pointer grab, which would block our button-release-event
// handler, if an URL is clicked // handler, if an URL is clicked
return this._findUrlAtPos(event) != -1; return this._findUrlAtPos(event) != -1;
})); });
this.actor.connect('button-release-event', Lang.bind(this, function (actor, event) { this.actor.connect('button-release-event', (actor, event) => {
if (!actor.visible || actor.get_paint_opacity() == 0) if (!actor.visible || actor.get_paint_opacity() == 0)
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
@ -88,8 +88,8 @@ var URLHighlighter = new Lang.Class({
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} }
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
})); });
this.actor.connect('motion-event', Lang.bind(this, function(actor, event) { this.actor.connect('motion-event', (actor, event) => {
if (!actor.visible || actor.get_paint_opacity() == 0) if (!actor.visible || actor.get_paint_opacity() == 0)
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
@ -102,8 +102,8 @@ var URLHighlighter = new Lang.Class({
this._cursorChanged = false; this._cursorChanged = false;
} }
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
})); });
this.actor.connect('leave-event', Lang.bind(this, function() { this.actor.connect('leave-event', () => {
if (!this.actor.visible || this.actor.get_paint_opacity() == 0) if (!this.actor.visible || this.actor.get_paint_opacity() == 0)
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
@ -112,7 +112,7 @@ var URLHighlighter = new Lang.Class({
global.screen.set_cursor(Meta.Cursor.DEFAULT); global.screen.set_cursor(Meta.Cursor.DEFAULT);
} }
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
})); });
}, },
setMarkup(text, allowMarkup) { setMarkup(text, allowMarkup) {
@ -183,10 +183,9 @@ var ScaleLayout = new Lang.Class({
if (this._container) if (this._container)
for (let signal of ['notify::scale-x', 'notify::scale-y']) { for (let signal of ['notify::scale-x', 'notify::scale-y']) {
let id = this._container.connect(signal, Lang.bind(this, let id = this._container.connect(signal, () => {
function() { this.layout_changed();
this.layout_changed(); });
}));
this._signals.push(id); this._signals.push(id);
} }
}, },
@ -541,7 +540,7 @@ var MessageListSection = new Lang.Class({
let id = Main.sessionMode.connect('updated', let id = Main.sessionMode.connect('updated',
Lang.bind(this, this._sync)); Lang.bind(this, this._sync));
this.actor.connect('destroy', function() { this.actor.connect('destroy', () => {
Main.sessionMode.disconnect(id); Main.sessionMode.disconnect(id);
}); });
@ -585,14 +584,12 @@ var MessageListSection = new Lang.Class({
scale_x: scale, scale_y: scale }); scale_x: scale, scale_y: scale });
obj.keyFocusId = message.actor.connect('key-focus-in', obj.keyFocusId = message.actor.connect('key-focus-in',
Lang.bind(this, this._onKeyFocusIn)); Lang.bind(this, this._onKeyFocusIn));
obj.destroyId = message.actor.connect('destroy', obj.destroyId = message.actor.connect('destroy', () => {
Lang.bind(this, function() { this.removeMessage(message, false);
this.removeMessage(message, false); });
})); obj.closeId = message.connect('close', () => {
obj.closeId = message.connect('close', this.removeMessage(message, true);
Lang.bind(this, function() { });
this.removeMessage(message, true);
}));
this._messages.set(message, obj); this._messages.set(message, obj);
obj.container.add_actor(message.actor); obj.container.add_actor(message.actor);
@ -614,13 +611,13 @@ var MessageListSection = new Lang.Class({
return; return;
} }
let onComplete = Lang.bind(this, function() { let onComplete = () => {
this._list.set_child_at_index(obj.container, index); this._list.set_child_at_index(obj.container, index);
Tweener.addTween(obj.container, { scale_x: 1, Tweener.addTween(obj.container, { scale_x: 1,
scale_y: 1, scale_y: 1,
time: MESSAGE_ANIMATION_TIME, time: MESSAGE_ANIMATION_TIME,
transition: 'easeOutQuad' }); transition: 'easeOutQuad' });
}); };
Tweener.addTween(obj.container, { scale_x: 0, Tweener.addTween(obj.container, { scale_x: 0,
scale_y: 0, scale_y: 0,
time: MESSAGE_ANIMATION_TIME, time: MESSAGE_ANIMATION_TIME,
@ -652,13 +649,11 @@ var MessageListSection = new Lang.Class({
}, },
clear() { clear() {
let messages = [...this._messages.keys()].filter(function(message) { let messages = [...this._messages.keys()].filter(msg => msg.canClose());
return message.canClose();
});
// If there are few messages, letting them all zoom out looks OK // If there are few messages, letting them all zoom out looks OK
if (messages.length < 2) { if (messages.length < 2) {
messages.forEach(function(message) { messages.forEach(message => {
message.close(); message.close();
}); });
} else { } else {

View File

@ -504,14 +504,13 @@ var NotificationBanner = new Lang.Class({
this._addActions(); this._addActions();
this._addSecondaryIcon(); this._addSecondaryIcon();
this._activatedId = this.notification.connect('activated', this._activatedId = this.notification.connect('activated', () => {
Lang.bind(this, function() { // We hide all types of notifications once the user clicks on
// We hide all types of notifications once the user clicks on // them because the common outcome of clicking should be the
// them because the common outcome of clicking should be the // relevant window being brought forward and the user's
// relevant window being brought forward and the user's // attention switching to the window.
// attention switching to the window. this.emit('done-displaying');
this.emit('done-displaying'); });
}));
}, },
_onDestroy() { _onDestroy() {
@ -533,10 +532,9 @@ var NotificationBanner = new Lang.Class({
}, },
_addActions() { _addActions() {
this.notification.actions.forEach(Lang.bind(this, this.notification.actions.forEach(action => {
function(action) { this.addAction(action.label, action.callback);
this.addAction(action.label, action.callback); });
}));
}, },
_addSecondaryIcon() { _addSecondaryIcon() {
@ -559,7 +557,7 @@ var NotificationBanner = new Lang.Class({
return null; return null;
this._buttonBox.add(button); this._buttonBox.add(button);
button.connect('clicked', Lang.bind(this, function() { button.connect('clicked', () => {
callback(); callback();
if (!this.notification.resident) { if (!this.notification.resident) {
@ -570,7 +568,7 @@ var NotificationBanner = new Lang.Class({
this.emit('done-displaying'); this.emit('done-displaying');
this.notification.destroy(); this.notification.destroy();
} }
})); });
return button; return button;
}, },
@ -596,10 +594,10 @@ var SourceActor = new Lang.Class({
this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth)); this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight)); this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
this.actor.connect('allocate', Lang.bind(this, this._allocate)); this.actor.connect('allocate', Lang.bind(this, this._allocate));
this.actor.connect('destroy', Lang.bind(this, function() { this.actor.connect('destroy', () => {
this._source.disconnect(this._iconUpdatedId); this._source.disconnect(this._iconUpdatedId);
this._actorDestroyed = true; this._actorDestroyed = true;
})); });
this._actorDestroyed = false; this._actorDestroyed = false;
let scale_factor = St.ThemeContext.get_for_stage(global.stage).scale_factor; let scale_factor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
@ -659,18 +657,18 @@ var SourceActorWithLabel = new Lang.Class({
layout_manager: new Clutter.BinLayout() }); layout_manager: new Clutter.BinLayout() });
this._counterBin.hide(); this._counterBin.hide();
this._counterBin.connect('style-changed', Lang.bind(this, function() { this._counterBin.connect('style-changed', () => {
let themeNode = this._counterBin.get_theme_node(); let themeNode = this._counterBin.get_theme_node();
this._counterBin.translation_x = themeNode.get_length('-shell-counter-overlap-x'); this._counterBin.translation_x = themeNode.get_length('-shell-counter-overlap-x');
this._counterBin.translation_y = themeNode.get_length('-shell-counter-overlap-y'); this._counterBin.translation_y = themeNode.get_length('-shell-counter-overlap-y');
})); });
this.actor.add_actor(this._counterBin); this.actor.add_actor(this._counterBin);
this._countUpdatedId = this._source.connect('count-updated', Lang.bind(this, this._updateCount)); this._countUpdatedId = this._source.connect('count-updated', Lang.bind(this, this._updateCount));
this._updateCount(); this._updateCount();
this.actor.connect('destroy', function() { this.actor.connect('destroy', () => {
this._source.disconnect(this._countUpdatedId); this._source.disconnect(this._countUpdatedId);
}); });
}, },
@ -736,7 +734,7 @@ var Source = new Lang.Class({
}, },
get unseenCount() { get unseenCount() {
return this.notifications.filter(function(n) { return !n.acknowledged; }).length; return this.notifications.filter(n => !n.acknowledged).length;
}, },
get countVisible() { get countVisible() {
@ -844,26 +842,25 @@ var MessageTray = new Lang.Class({
Name: 'MessageTray', Name: 'MessageTray',
_init() { _init() {
this._presence = new GnomeSession.Presence(Lang.bind(this, function(proxy, error) { this._presence = new GnomeSession.Presence((proxy, error) => {
this._onStatusChanged(proxy.status); this._onStatusChanged(proxy.status);
})); });
this._busy = false; this._busy = false;
this._bannerBlocked = false; this._bannerBlocked = false;
this._presence.connectSignal('StatusChanged', Lang.bind(this, function(proxy, senderName, [status]) { this._presence.connectSignal('StatusChanged', (proxy, senderName, [status]) => {
this._onStatusChanged(status); this._onStatusChanged(status);
})); });
global.stage.connect('enter-event', Lang.bind(this, global.stage.connect('enter-event', (a, ev) => {
function(a, ev) { // HACK: St uses ClutterInputDevice for hover tracking, which
// HACK: St uses ClutterInputDevice for hover tracking, which // misses relevant X11 events when untracked actors are
// misses relevant X11 events when untracked actors are // involved (read: the notification banner in normal mode),
// involved (read: the notification banner in normal mode), // so fix up Clutter's view of the pointer position in
// so fix up Clutter's view of the pointer position in // that case.
// that case. let related = ev.get_related();
let related = ev.get_related(); if (!related || this.actor.contains(related))
if (!related || this.actor.contains(related)) global.sync_pointer();
global.sync_pointer(); });
}));
this.actor = new St.Widget({ visible: false, this.actor = new St.Widget({ visible: false,
clip_to_allocation: true, clip_to_allocation: true,
@ -1093,9 +1090,9 @@ var MessageTray = new Lang.Class({
notification.connect('destroy', notification.connect('destroy',
Lang.bind(this, this._onNotificationDestroy)); Lang.bind(this, this._onNotificationDestroy));
this._notificationQueue.push(notification); this._notificationQueue.push(notification);
this._notificationQueue.sort(function(notification1, notification2) { this._notificationQueue.sort(
return (notification2.urgency - notification1.urgency); (n1, n2) => n2.urgency - n1.urgency
}); );
this.emit('queue-changed'); this.emit('queue-changed');
} }
} }
@ -1219,7 +1216,7 @@ var MessageTray = new Lang.Class({
// Filter out acknowledged notifications. // Filter out acknowledged notifications.
let changed = false; let changed = false;
this._notificationQueue = this._notificationQueue.filter(function(n) { this._notificationQueue = this._notificationQueue.filter(n => {
changed = changed || n.acknowledged; changed = changed || n.acknowledged;
return !n.acknowledged; return !n.acknowledged;
}); });
@ -1310,9 +1307,9 @@ var MessageTray = new Lang.Class({
this._banner = this._notification.createBanner(); this._banner = this._notification.createBanner();
this._bannerClickedId = this._banner.connect('done-displaying', this._bannerClickedId = this._banner.connect('done-displaying',
Lang.bind(this, this._escapeTray)); Lang.bind(this, this._escapeTray));
this._bannerUnfocusedId = this._banner.connect('unfocused', Lang.bind(this, function() { this._bannerUnfocusedId = this._banner.connect('unfocused', () => {
this._updateState(); this._updateState();
})); });
this._bannerBin.add_actor(this._banner.actor); this._bannerBin.add_actor(this._banner.actor);

View File

@ -142,11 +142,10 @@ var ModalDialog = new Lang.Class({
{ opacity: 255, { opacity: 255,
time: this._shouldFadeIn ? OPEN_AND_CLOSE_TIME : 0, time: this._shouldFadeIn ? OPEN_AND_CLOSE_TIME : 0,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete: Lang.bind(this, onComplete: () => {
function() { this.state = State.OPENED;
this.state = State.OPENED; this.emit('opened');
this.emit('opened'); }
})
}); });
}, },
@ -156,10 +155,10 @@ var ModalDialog = new Lang.Class({
this._initialKeyFocus = actor; this._initialKeyFocus = actor;
this._initialKeyFocusDestroyId = actor.connect('destroy', Lang.bind(this, function() { this._initialKeyFocusDestroyId = actor.connect('destroy', () => {
this._initialKeyFocus = null; this._initialKeyFocus = null;
this._initialKeyFocusDestroyId = 0; this._initialKeyFocusDestroyId = 0;
})); });
}, },
open(timestamp, onPrimary) { open(timestamp, onPrimary) {
@ -269,10 +268,9 @@ var ModalDialog = new Lang.Class({
{ opacity: 0, { opacity: 0,
time: FADE_OUT_DIALOG_TIME, time: FADE_OUT_DIALOG_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete: Lang.bind(this, onComplete: () => {
function() { this.state = State.FADED_OUT;
this.state = State.FADED_OUT; }
})
}); });
} }
}); });

View File

@ -60,19 +60,19 @@ var MediaMessage = new Lang.Class({
this.setIcon(this._icon); this.setIcon(this._icon);
this._prevButton = this.addMediaControl('media-skip-backward-symbolic', this._prevButton = this.addMediaControl('media-skip-backward-symbolic',
Lang.bind(this, function() { () => {
this._player.previous(); this._player.previous();
})); });
this._playPauseButton = this.addMediaControl(null, this._playPauseButton = this.addMediaControl(null,
Lang.bind(this, function() { () => {
this._player.playPause(); this._player.playPause();
})); });
this._nextButton = this.addMediaControl('media-skip-forward-symbolic', this._nextButton = this.addMediaControl('media-skip-forward-symbolic',
Lang.bind(this, function() { () => {
this._player.next(); this._player.next();
})); });
this._player.connect('changed', Lang.bind(this, this._update)); this._player.connect('changed', Lang.bind(this, this._update));
this._player.connect('closed', Lang.bind(this, this.close)); this._player.connect('closed', Lang.bind(this, this.close));
@ -191,10 +191,10 @@ var MprisPlayer = new Lang.Class({
_onMprisProxyReady() { _onMprisProxyReady() {
this._ownerNotifyId = this._mprisProxy.connect('notify::g-name-owner', this._ownerNotifyId = this._mprisProxy.connect('notify::g-name-owner',
Lang.bind(this, function() { () => {
if (!this._mprisProxy.g_name_owner) if (!this._mprisProxy.g_name_owner)
this._close(); this._close();
})); });
}, },
_onPlayerProxyReady() { _onPlayerProxyReady() {
@ -250,29 +250,27 @@ var MediaSection = new Lang.Class({
return; return;
let player = new MprisPlayer(busName); let player = new MprisPlayer(busName);
player.connect('closed', Lang.bind(this, player.connect('closed',
function() { () => {
this._players.delete(busName); this._players.delete(busName);
})); });
player.connect('show', Lang.bind(this, player.connect('show',
function() { () => {
let message = new MediaMessage(player); let message = new MediaMessage(player);
this.addMessage(message, true); this.addMessage(message, true);
})); });
this._players.set(busName, player); this._players.set(busName, player);
}, },
_onProxyReady() { _onProxyReady() {
this._proxy.ListNamesRemote(Lang.bind(this, this._proxy.ListNamesRemote(([names]) => {
function([names]) { names.forEach(name => {
names.forEach(Lang.bind(this, if (!name.startsWith(MPRIS_PLAYER_PREFIX))
function(name) { return;
if (!name.startsWith(MPRIS_PLAYER_PREFIX))
return;
this._addPlayer(name); this._addPlayer(name);
})); });
})); });
this._proxy.connectSignal('NameOwnerChanged', this._proxy.connectSignal('NameOwnerChanged',
Lang.bind(this, this._onNameOwnerChanged)); Lang.bind(this, this._onNameOwnerChanged));
}, },

View File

@ -190,11 +190,11 @@ var FdoNotificationDaemon = new Lang.Class({
source = new FdoNotificationDaemonSource(title, pid, sender, appId); source = new FdoNotificationDaemonSource(title, pid, sender, appId);
this._sources.push(source); this._sources.push(source);
source.connect('destroy', Lang.bind(this, function() { source.connect('destroy', () => {
let index = this._sources.indexOf(source); let index = this._sources.indexOf(source);
if (index >= 0) if (index >= 0)
this._sources.splice(index, 1); this._sources.splice(index, 1);
})); });
Main.messageTray.add(source); Main.messageTray.add(source);
return source; return source;
@ -220,11 +220,10 @@ var FdoNotificationDaemon = new Lang.Class({
// Ignore replacesId since we already sent back a // Ignore replacesId since we already sent back a
// NotificationClosed for that id. // NotificationClosed for that id.
id = this._nextNotificationId++; id = this._nextNotificationId++;
let idle_id = Mainloop.idle_add(Lang.bind(this, let idle_id = Mainloop.idle_add(() => {
function () { this._emitNotificationClosed(id, NotificationClosedReason.DISMISSED);
this._emitNotificationClosed(id, NotificationClosedReason.DISMISSED); return GLib.SOURCE_REMOVE;
return GLib.SOURCE_REMOVE; });
}));
GLib.Source.set_name_by_id(idle_id, '[gnome-shell] this._emitNotificationClosed'); GLib.Source.set_name_by_id(idle_id, '[gnome-shell] this._emitNotificationClosed');
return invocation.return_value(GLib.Variant.new('(u)', [id])); return invocation.return_value(GLib.Variant.new('(u)', [id]));
} }
@ -285,7 +284,7 @@ var FdoNotificationDaemon = new Lang.Class({
return invocation.return_value(GLib.Variant.new('(u)', [id]));; return invocation.return_value(GLib.Variant.new('(u)', [id]));;
} }
this._busProxy.GetConnectionUnixProcessIDRemote(sender, Lang.bind(this, function (result, excp) { this._busProxy.GetConnectionUnixProcessIDRemote(sender, (result, excp) => {
// The app may have updated or removed the notification // The app may have updated or removed the notification
ndata = this._notifications[id]; ndata = this._notifications[id];
if (!ndata) if (!ndata)
@ -300,11 +299,11 @@ var FdoNotificationDaemon = new Lang.Class({
source = this._getSource(appName, pid, ndata, sender, null); source = this._getSource(appName, pid, ndata, sender, null);
this._senderToPid[sender] = pid; this._senderToPid[sender] = pid;
source.connect('destroy', Lang.bind(this, function() { source.connect('destroy', () => {
delete this._senderToPid[sender]; delete this._senderToPid[sender];
})); });
this._notifyForSource(source, ndata); this._notifyForSource(source, ndata);
})); });
return invocation.return_value(GLib.Variant.new('(u)', [id])); return invocation.return_value(GLib.Variant.new('(u)', [id]));
}, },
@ -317,23 +316,22 @@ var FdoNotificationDaemon = new Lang.Class({
if (notification == null) { if (notification == null) {
notification = new MessageTray.Notification(source); notification = new MessageTray.Notification(source);
ndata.notification = notification; ndata.notification = notification;
notification.connect('destroy', Lang.bind(this, notification.connect('destroy', (n, reason) => {
function(n, reason) { delete this._notifications[ndata.id];
delete this._notifications[ndata.id]; let notificationClosedReason;
let notificationClosedReason; switch (reason) {
switch (reason) { case MessageTray.NotificationDestroyedReason.EXPIRED:
case MessageTray.NotificationDestroyedReason.EXPIRED: notificationClosedReason = NotificationClosedReason.EXPIRED;
notificationClosedReason = NotificationClosedReason.EXPIRED; break;
break; case MessageTray.NotificationDestroyedReason.DISMISSED:
case MessageTray.NotificationDestroyedReason.DISMISSED: notificationClosedReason = NotificationClosedReason.DISMISSED;
notificationClosedReason = NotificationClosedReason.DISMISSED; break;
break; case MessageTray.NotificationDestroyedReason.SOURCE_CLOSED:
case MessageTray.NotificationDestroyedReason.SOURCE_CLOSED: notificationClosedReason = NotificationClosedReason.APP_CLOSED;
notificationClosedReason = NotificationClosedReason.APP_CLOSED; break;
break; }
} this._emitNotificationClosed(ndata.id, notificationClosedReason);
this._emitNotificationClosed(ndata.id, notificationClosedReason); });
}));
} }
let gicon = this._iconForNotificationData(icon, hints); let gicon = this._iconForNotificationData(icon, hints);
@ -365,20 +363,20 @@ var FdoNotificationDaemon = new Lang.Class({
if (actionId == 'default') if (actionId == 'default')
hasDefaultAction = true; hasDefaultAction = true;
else else
notification.addAction(label, Lang.bind(this, function() { notification.addAction(label, () => {
this._emitActionInvoked(ndata.id, actionId); this._emitActionInvoked(ndata.id, actionId);
})); });
} }
} }
if (hasDefaultAction) { if (hasDefaultAction) {
notification.connect('activated', Lang.bind(this, function() { notification.connect('activated', () => {
this._emitActionInvoked(ndata.id, 'default'); this._emitActionInvoked(ndata.id, 'default');
})); });
} else { } else {
notification.connect('activated', Lang.bind(this, function() { notification.connect('activated', () => {
source.open(); source.open();
})); });
} }
switch (hints.urgency) { switch (hints.urgency) {
@ -615,10 +613,10 @@ var GtkNotificationDaemonNotification = new Lang.Class({
} }
if (buttons) { if (buttons) {
buttons.deep_unpack().forEach(Lang.bind(this, function(button) { buttons.deep_unpack().forEach(button => {
this.addAction(button.label.unpack(), this.addAction(button.label.unpack(),
Lang.bind(this, this._onButtonClicked, button)); Lang.bind(this, this._onButtonClicked, button));
})); });
} }
this._defaultAction = defaultAction ? defaultAction.unpack() : null; this._defaultAction = defaultAction ? defaultAction.unpack() : null;
@ -713,7 +711,7 @@ var GtkNotificationDaemonAppSource = new Lang.Class({
}, },
activateAction(actionId, target) { activateAction(actionId, target) {
this._createApp(function (app, error) { this._createApp((app, error) => {
if (error == null) if (error == null)
app.ActivateActionRemote(actionId, target ? [target] : [], getPlatformData()); app.ActivateActionRemote(actionId, target ? [target] : [], getPlatformData());
else else
@ -724,7 +722,7 @@ var GtkNotificationDaemonAppSource = new Lang.Class({
}, },
open() { open() {
this._createApp(function (app, error) { this._createApp((app, error) => {
if (error == null) if (error == null)
app.ActivateRemote(getPlatformData()); app.ActivateRemote(getPlatformData());
else else
@ -741,9 +739,9 @@ var GtkNotificationDaemonAppSource = new Lang.Class({
this._notifications[notificationId].destroy(); this._notifications[notificationId].destroy();
let notification = new GtkNotificationDaemonNotification(this, notificationParams); let notification = new GtkNotificationDaemonNotification(this, notificationParams);
notification.connect('destroy', Lang.bind(this, function() { notification.connect('destroy', () => {
delete this._notifications[notificationId]; delete this._notifications[notificationId];
})); });
this._notifications[notificationId] = notification; this._notifications[notificationId] = notification;
if (showBanner) if (showBanner)
@ -809,10 +807,10 @@ var GtkNotificationDaemon = new Lang.Class({
let source = new GtkNotificationDaemonAppSource(appId); let source = new GtkNotificationDaemonAppSource(appId);
source.connect('destroy', Lang.bind(this, function() { source.connect('destroy', () => {
delete this._sources[appId]; delete this._sources[appId];
this._saveNotifications(); this._saveNotifications();
})); });
source.connect('count-updated', Lang.bind(this, this._saveNotifications)); source.connect('count-updated', Lang.bind(this, this._saveNotifications));
Main.messageTray.add(source); Main.messageTray.add(source);
this._sources[appId] = source; this._sources[appId] = source;
@ -825,7 +823,7 @@ var GtkNotificationDaemon = new Lang.Class({
let value = global.get_persistent_state('a(sa(sv))', 'notifications'); let value = global.get_persistent_state('a(sa(sv))', 'notifications');
if (value) { if (value) {
let sources = value.deep_unpack(); let sources = value.deep_unpack();
sources.forEach(Lang.bind(this, function([appId, notifications]) { sources.forEach(([appId, notifications]) => {
if (notifications.length == 0) if (notifications.length == 0)
return; return;
@ -836,10 +834,10 @@ var GtkNotificationDaemon = new Lang.Class({
return; return;
} }
notifications.forEach(function([notificationId, notification]) { notifications.forEach(([notificationId, notification]) => {
source.addNotification(notificationId, notification.deep_unpack(), false); source.addNotification(notificationId, notification.deep_unpack(), false);
}); });
})); });
} }
this._isLoading = false; this._isLoading = false;

View File

@ -82,9 +82,9 @@ var OsdMonitorLabeler = new Lang.Class({
this._client = client; this._client = client;
this._clientWatchId = Gio.bus_watch_name(Gio.BusType.SESSION, client, 0, null, this._clientWatchId = Gio.bus_watch_name(Gio.BusType.SESSION, client, 0, null,
Lang.bind(this, function(c, name) { (c, name) => {
this.hide(name); this.hide(name);
})); });
return true; return true;
}, },

View File

@ -177,10 +177,10 @@ var OsdWindow = new Lang.Class({
{ opacity: 0, { opacity: 0,
time: FADE_TIME, time: FADE_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete: Lang.bind(this, function() { onComplete: () => {
this._reset(); this._reset();
Meta.enable_unredirect_for_screen(global.screen); Meta.enable_unredirect_for_screen(global.screen);
}) }
}); });
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
}, },

View File

@ -62,10 +62,9 @@ var ShellInfo = new Lang.Class({
if (this._source == null) { if (this._source == null) {
this._source = new MessageTray.SystemNotificationSource(); this._source = new MessageTray.SystemNotificationSource();
this._source.connect('destroy', Lang.bind(this, this._source.connect('destroy', () => {
function() { this._source = null;
this._source = null; });
}));
Main.messageTray.add(this._source); Main.messageTray.add(this._source);
} }
@ -141,7 +140,7 @@ var Overview = new Lang.Class({
this._coverPane = new Clutter.Actor({ opacity: 0, this._coverPane = new Clutter.Actor({ opacity: 0,
reactive: true }); reactive: true });
Main.layoutManager.overviewGroup.add_child(this._coverPane); Main.layoutManager.overviewGroup.add_child(this._coverPane);
this._coverPane.connect('event', Lang.bind(this, function (actor, event) { return Clutter.EVENT_STOP; })); this._coverPane.connect('event', () => Clutter.EVENT_STOP);
Main.layoutManager.overviewGroup.add_child(this._overview); Main.layoutManager.overviewGroup.add_child(this._overview);
@ -254,10 +253,9 @@ var Overview = new Lang.Class({
// TODO - recalculate everything when desktop size changes // TODO - recalculate everything when desktop size changes
this.dashIconSize = this._dash.iconSize; this.dashIconSize = this._dash.iconSize;
this._dash.connect('icon-size-changed', this._dash.connect('icon-size-changed', () => {
Lang.bind(this, function() { this.dashIconSize = this._dash.iconSize;
this.dashIconSize = this._dash.iconSize; });
}));
Main.layoutManager.connect('monitors-changed', Lang.bind(this, this._relayout)); Main.layoutManager.connect('monitors-changed', Lang.bind(this, this._relayout));
this._relayout(); this._relayout();
@ -343,15 +341,15 @@ var Overview = new Lang.Class({
if (targetIsWindow) { if (targetIsWindow) {
this._lastHoveredWindow = dragEvent.targetActor._delegate.metaWindow; this._lastHoveredWindow = dragEvent.targetActor._delegate.metaWindow;
this._windowSwitchTimeoutId = Mainloop.timeout_add(DND_WINDOW_SWITCH_TIMEOUT, this._windowSwitchTimeoutId = Mainloop.timeout_add(DND_WINDOW_SWITCH_TIMEOUT,
Lang.bind(this, function() { () => {
this._windowSwitchTimeoutId = 0; this._windowSwitchTimeoutId = 0;
this._needsFakePointerEvent = true; this._needsFakePointerEvent = true;
Main.activateWindow(dragEvent.targetActor._delegate.metaWindow, Main.activateWindow(dragEvent.targetActor._delegate.metaWindow,
this._windowSwitchTimestamp); this._windowSwitchTimestamp);
this.hide(); this.hide();
this._lastHoveredWindow = null; this._lastHoveredWindow = null;
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); });
GLib.Source.set_name_by_id(this._windowSwitchTimeoutId, '[gnome-shell] Main.activateWindow'); GLib.Source.set_name_by_id(this._windowSwitchTimeoutId, '[gnome-shell] Main.activateWindow');
} }
@ -371,18 +369,18 @@ var Overview = new Lang.Class({
}, },
_getDesktopClone() { _getDesktopClone() {
let windows = global.get_window_actors().filter(function(w) { let windows = global.get_window_actors().filter(
return w.meta_window.get_window_type() == Meta.WindowType.DESKTOP; w => w.meta_window.get_window_type() == Meta.WindowType.DESKTOP
}); );
if (windows.length == 0) if (windows.length == 0)
return null; return null;
let window = windows[0]; let window = windows[0];
let clone = new Clutter.Clone({ source: window, let clone = new Clutter.Clone({ source: window,
x: window.x, y: window.y }); x: window.x, y: window.y });
clone.source.connect('destroy', Lang.bind(this, function() { clone.source.connect('destroy', () => {
clone.destroy(); clone.destroy();
})); });
return clone; return clone;
}, },

View File

@ -431,20 +431,17 @@ var ControlsManager = new Lang.Class({
layout.connect('allocation-changed', Lang.bind(this, this._updateWorkspacesGeometry)); layout.connect('allocation-changed', Lang.bind(this, this._updateWorkspacesGeometry));
Main.overview.connect('showing', Lang.bind(this, this._updateSpacerVisibility)); Main.overview.connect('showing', Lang.bind(this, this._updateSpacerVisibility));
Main.overview.connect('item-drag-begin', Lang.bind(this, Main.overview.connect('item-drag-begin', () => {
function() { let activePage = this.viewSelector.getActivePage();
let activePage = this.viewSelector.getActivePage(); if (activePage != ViewSelector.ViewPage.WINDOWS)
if (activePage != ViewSelector.ViewPage.WINDOWS) this.viewSelector.fadeHalf();
this.viewSelector.fadeHalf(); });
})); Main.overview.connect('item-drag-end', () => {
Main.overview.connect('item-drag-end', Lang.bind(this, this.viewSelector.fadeIn();
function() { });
this.viewSelector.fadeIn(); Main.overview.connect('item-drag-cancelled', () => {
})); this.viewSelector.fadeIn();
Main.overview.connect('item-drag-cancelled', Lang.bind(this, });
function() {
this.viewSelector.fadeIn();
}));
}, },
_updateWorkspacesGeometry() { _updateWorkspacesGeometry() {

View File

@ -50,7 +50,7 @@ var PadChooser = new Lang.Class({
this._ensureMenu(groupDevices); this._ensureMenu(groupDevices);
this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
this.actor.connect('clicked', Lang.bind(this, function (actor) { this.actor.connect('clicked', actor => {
if (actor.get_checked()) { if (actor.get_checked()) {
if (this._padChooserMenu != null) if (this._padChooserMenu != null)
this._padChooserMenu.open(true); this._padChooserMenu.open(true);
@ -59,12 +59,14 @@ var PadChooser = new Lang.Class({
} else { } else {
this._padChooserMenu.close(true); this._padChooserMenu.close(true);
} }
})); });
}, },
_ensureMenu(devices) { _ensureMenu(devices) {
this._padChooserMenu = new PopupMenu.PopupMenu(this.actor, 0.5, St.Side.TOP); this._padChooserMenu = new PopupMenu.PopupMenu(this.actor, 0.5, St.Side.TOP);
this._padChooserMenu.connect('menu-closed', Lang.bind(this, function() { this.actor.set_checked(false); })); this._padChooserMenu.connect('menu-closed', () => {
this.actor.set_checked(false);
});
this._padChooserMenu.actor.hide(); this._padChooserMenu.actor.hide();
Main.uiGroup.add_actor(this._padChooserMenu.actor); Main.uiGroup.add_actor(this._padChooserMenu.actor);
@ -144,7 +146,9 @@ var ActionComboBox = new Lang.Class({
box.add_child(arrow); box.add_child(arrow);
this._editMenu = new PopupMenu.PopupMenu(this.actor, 0, St.Side.TOP); this._editMenu = new PopupMenu.PopupMenu(this.actor, 0, St.Side.TOP);
this._editMenu.connect('menu-closed', Lang.bind(this, function() { this.actor.set_checked(false); })); this._editMenu.connect('menu-closed', () => {
this.actor.set_checked(false);
});
this._editMenu.actor.hide(); this._editMenu.actor.hide();
Main.uiGroup.add_actor(this._editMenu.actor); Main.uiGroup.add_actor(this._editMenu.actor);
@ -158,7 +162,9 @@ var ActionComboBox = new Lang.Class({
for (let [action, label] of this._actionLabels.entries()) { for (let [action, label] of this._actionLabels.entries()) {
let selectedAction = action; let selectedAction = action;
let item = this._editMenu.addAction(label, Lang.bind(this, function() { this._onActionSelected(selectedAction) })); let item = this._editMenu.addAction(label, () => {
this._onActionSelected(selectedAction);
});
/* These actions only apply to pad buttons */ /* These actions only apply to pad buttons */
if (selectedAction == GDesktopEnums.PadButtonAction.HELP || if (selectedAction == GDesktopEnums.PadButtonAction.HELP ||
@ -632,14 +638,14 @@ var PadOsd = new Lang.Class({
this._padChooser = null; this._padChooser = null;
let deviceManager = Clutter.DeviceManager.get_default(); let deviceManager = Clutter.DeviceManager.get_default();
this._deviceAddedId = deviceManager.connect('device-added', Lang.bind(this, function (manager, device) { this._deviceAddedId = deviceManager.connect('device-added', (manager, device) => {
if (device.get_device_type() == Clutter.InputDeviceType.PAD_DEVICE && if (device.get_device_type() == Clutter.InputDeviceType.PAD_DEVICE &&
this.padDevice.is_grouped(device)) { this.padDevice.is_grouped(device)) {
this._groupPads.push(device); this._groupPads.push(device);
this._updatePadChooser(); this._updatePadChooser();
} }
})); });
this._deviceRemovedId = deviceManager.connect('device-removed', Lang.bind(this, function (manager, device) { this._deviceRemovedId = deviceManager.connect('device-removed', (manager, device) => {
// If the device is being removed, destroy the padOsd. // If the device is being removed, destroy the padOsd.
if (device == this.padDevice) { if (device == this.padDevice) {
this.destroy(); this.destroy();
@ -650,14 +656,14 @@ var PadOsd = new Lang.Class({
this._updatePadChooser(); this._updatePadChooser();
} }
})); });
deviceManager.list_devices().forEach(Lang.bind(this, function(device) { deviceManager.list_devices().forEach(device => {
if (device != this.padDevice && if (device != this.padDevice &&
device.get_device_type() == Clutter.InputDeviceType.PAD_DEVICE && device.get_device_type() == Clutter.InputDeviceType.PAD_DEVICE &&
this.padDevice.is_grouped(device)) this.padDevice.is_grouped(device))
this._groupPads.push(device); this._groupPads.push(device);
})); });
this.actor = new St.BoxLayout({ style_class: 'pad-osd-window', this.actor = new St.BoxLayout({ style_class: 'pad-osd-window',
x_expand: true, x_expand: true,
@ -735,7 +741,9 @@ var PadOsd = new Lang.Class({
style_class: 'button', style_class: 'button',
x_align: Clutter.ActorAlign.CENTER, x_align: Clutter.ActorAlign.CENTER,
can_focus: true }); can_focus: true });
this._editButton.connect('clicked', Lang.bind(this, function () { this.setEditionMode(true) })); this._editButton.connect('clicked', () => {
this.setEditionMode(true);
});
buttonBox.add_actor(this._editButton); buttonBox.add_actor(this._editButton);
this._syncEditionMode(); this._syncEditionMode();
@ -746,9 +754,9 @@ var PadOsd = new Lang.Class({
if (this._groupPads.length > 1) { if (this._groupPads.length > 1) {
if (this._padChooser == null) { if (this._padChooser == null) {
this._padChooser = new PadChooser(this.padDevice, this._groupPads) this._padChooser = new PadChooser(this.padDevice, this._groupPads)
this._padChooser.connect('pad-selected', Lang.bind(this, function (chooser, pad) { this._padChooser.connect('pad-selected', (chooser, pad) => {
this._requestForOtherPad(pad); this._requestForOtherPad(pad);
})); });
this._titleBox.add_child(this._padChooser.actor); this._titleBox.add_child(this._padChooser.actor);
} else { } else {
this._padChooser.update(this._groupPads); this._padChooser.update(this._groupPads);
@ -976,11 +984,11 @@ var PadOsdService = new Lang.Class({
let devices = deviceManager.list_devices(); let devices = deviceManager.list_devices();
let padDevice = null; let padDevice = null;
devices.forEach(Lang.bind(this, function(device) { devices.forEach(device => {
if (deviceNode == device.get_device_node() && if (deviceNode == device.get_device_node() &&
device.get_device_type() == Clutter.InputDeviceType.PAD_DEVICE) device.get_device_type() == Clutter.InputDeviceType.PAD_DEVICE)
padDevice = device; padDevice = device;
})); });
if (padDevice == null) { if (padDevice == null) {
invocation.return_error_literal(Gio.IOErrorEnum, invocation.return_error_literal(Gio.IOErrorEnum,

View File

@ -240,13 +240,10 @@ var AppMenuButton = new Lang.Class({
_onAppStateChanged(appSys, app) { _onAppStateChanged(appSys, app) {
let state = app.state; let state = app.state;
if (state != Shell.AppState.STARTING) { if (state != Shell.AppState.STARTING)
this._startingApps = this._startingApps.filter(function(a) { this._startingApps = this._startingApps.filter(a => a != app);
return a != app; else if (state == Shell.AppState.STARTING)
});
} else if (state == Shell.AppState.STARTING) {
this._startingApps.push(app); this._startingApps.push(app);
}
// For now just resync on all running state changes; this is mainly to handle // For now just resync on all running state changes; this is mainly to handle
// cases where the focused window's application changes without the focus // cases where the focused window's application changes without the focus
// changing. An example case is how we map OpenOffice.org based on the window // changing. An example case is how we map OpenOffice.org based on the window
@ -343,10 +340,10 @@ var AppMenuButton = new Lang.Class({
return; return;
menu = new RemoteMenu.RemoteMenu(this.actor, this._targetApp.menu, this._targetApp.action_group); menu = new RemoteMenu.RemoteMenu(this.actor, this._targetApp.menu, this._targetApp.action_group);
menu.connect('activate', Lang.bind(this, function() { menu.connect('activate', () => {
let win = this._targetApp.get_windows()[0]; let win = this._targetApp.get_windows()[0];
win.check_alive(global.get_current_time()); win.check_alive(global.get_current_time());
})); });
} else { } else {
if (this.menu && this.menu.isDummyQuitMenu) if (this.menu && this.menu.isDummyQuitMenu)
@ -355,9 +352,9 @@ var AppMenuButton = new Lang.Class({
// fallback to older menu // fallback to older menu
menu = new PopupMenu.PopupMenu(this.actor, 0.0, St.Side.TOP, 0); menu = new PopupMenu.PopupMenu(this.actor, 0.0, St.Side.TOP, 0);
menu.isDummyQuitMenu = true; menu.isDummyQuitMenu = true;
menu.addAction(_("Quit"), Lang.bind(this, function() { menu.addAction(_("Quit"), () => {
this._targetApp.request_quit(); this._targetApp.request_quit();
})); });
} }
this.setMenu(menu); this.setMenu(menu);
@ -420,14 +417,14 @@ var ActivitiesButton = new Lang.Class({
this.actor.connect('captured-event', Lang.bind(this, this._onCapturedEvent)); this.actor.connect('captured-event', Lang.bind(this, this._onCapturedEvent));
this.actor.connect_after('key-release-event', Lang.bind(this, this._onKeyRelease)); this.actor.connect_after('key-release-event', Lang.bind(this, this._onKeyRelease));
Main.overview.connect('showing', Lang.bind(this, function() { Main.overview.connect('showing', () => {
this.actor.add_style_pseudo_class('overview'); this.actor.add_style_pseudo_class('overview');
this.actor.add_accessible_state (Atk.StateType.CHECKED); this.actor.add_accessible_state (Atk.StateType.CHECKED);
})); });
Main.overview.connect('hiding', Lang.bind(this, function() { Main.overview.connect('hiding', () => {
this.actor.remove_style_pseudo_class('overview'); this.actor.remove_style_pseudo_class('overview');
this.actor.remove_accessible_state (Atk.StateType.CHECKED); this.actor.remove_accessible_state (Atk.StateType.CHECKED);
})); });
this._xdndTimeOut = 0; this._xdndTimeOut = 0;
}, },
@ -574,20 +571,19 @@ var PanelCorner = new Lang.Class({
this._button = button; this._button = button;
button.connect('destroy', Lang.bind(this, button.connect('destroy', () => {
function() { if (this._button == button) {
if (this._button == button) { this._button = null;
this._button = null; this._buttonStyleChangedSignalId = 0;
this._buttonStyleChangedSignalId = 0; }
} });
}));
// Synchronize the locate button's pseudo classes with this corner // Synchronize the locate button's pseudo classes with this corner
this._buttonStyleChangedSignalId = button.connect('style-changed', Lang.bind(this, this._buttonStyleChangedSignalId = button.connect('style-changed',
function(actor) { actor => {
let pseudoClass = button.get_style_pseudo_class(); let pseudoClass = button.get_style_pseudo_class();
this.actor.set_style_pseudo_class(pseudoClass); this.actor.set_style_pseudo_class(pseudoClass);
})); });
// The corner doesn't support theme transitions, so override // The corner doesn't support theme transitions, so override
// the .panel-button default // the .panel-button default
@ -801,14 +797,14 @@ var Panel = new Lang.Class({
this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress)); this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress));
this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPress)); this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPress));
Main.overview.connect('showing', Lang.bind(this, function () { Main.overview.connect('showing', () => {
this.actor.add_style_pseudo_class('overview'); this.actor.add_style_pseudo_class('overview');
this._updateSolidStyle(); this._updateSolidStyle();
})); });
Main.overview.connect('hiding', Lang.bind(this, function () { Main.overview.connect('hiding', () => {
this.actor.remove_style_pseudo_class('overview'); this.actor.remove_style_pseudo_class('overview');
this._updateSolidStyle(); this._updateSolidStyle();
})); });
Main.layoutManager.panelBox.add(this.actor); Main.layoutManager.panelBox.add(this.actor);
Main.ctrlAltTabManager.addGroup(this.actor, _("Top Bar"), 'focus-top-bar-symbolic', Main.ctrlAltTabManager.addGroup(this.actor, _("Top Bar"), 'focus-top-bar-symbolic',
@ -1079,7 +1075,7 @@ var Panel = new Lang.Class({
/* Get all the windows in the active workspace that are in the primary monitor and visible */ /* Get all the windows in the active workspace that are in the primary monitor and visible */
let activeWorkspace = global.screen.get_active_workspace(); let activeWorkspace = global.screen.get_active_workspace();
let windows = activeWorkspace.list_windows().filter(function(metaWindow) { let windows = activeWorkspace.list_windows().filter(metaWindow => {
return metaWindow.is_on_primary_monitor() && return metaWindow.is_on_primary_monitor() &&
metaWindow.showing_on_its_workspace() && metaWindow.showing_on_its_workspace() &&
metaWindow.get_window_type() != Meta.WindowType.DESKTOP; metaWindow.get_window_type() != Meta.WindowType.DESKTOP;
@ -1089,10 +1085,10 @@ var Panel = new Lang.Class({
let [, panelTop] = this.actor.get_transformed_position(); let [, panelTop] = this.actor.get_transformed_position();
let panelBottom = panelTop + this.actor.get_height(); let panelBottom = panelTop + this.actor.get_height();
let scale = St.ThemeContext.get_for_stage(global.stage).scale_factor; let scale = St.ThemeContext.get_for_stage(global.stage).scale_factor;
let isNearEnough = windows.some(Lang.bind(this, function(metaWindow) { let isNearEnough = windows.some(metaWindow => {
let verticalPosition = metaWindow.get_frame_rect().y; let verticalPosition = metaWindow.get_frame_rect().y;
return verticalPosition < panelBottom + 5 * scale; return verticalPosition < panelBottom + 5 * scale;
})); });
if (isNearEnough) if (isNearEnough)
this._addStyleClassName('solid'); this._addStyleClassName('solid');
@ -1150,11 +1146,11 @@ var Panel = new Lang.Class({
if (indicator.menu) if (indicator.menu)
this.menuManager.addMenu(indicator.menu); this.menuManager.addMenu(indicator.menu);
this.statusArea[role] = indicator; this.statusArea[role] = indicator;
let destroyId = indicator.connect('destroy', Lang.bind(this, function(emitter) { let destroyId = indicator.connect('destroy', emitter => {
delete this.statusArea[role]; delete this.statusArea[role];
emitter.disconnect(destroyId); emitter.disconnect(destroyId);
container.destroy(); container.destroy();
})); });
indicator.connect('menu-set', Lang.bind(this, this._onMenuSet)); indicator.connect('menu-set', Lang.bind(this, this._onMenuSet));
this._onMenuSet(indicator); this._onMenuSet(indicator);
}, },
@ -1195,7 +1191,7 @@ var Panel = new Lang.Class({
return; return;
indicator.menu._openChangedId = indicator.menu.connect('open-state-changed', indicator.menu._openChangedId = indicator.menu.connect('open-state-changed',
Lang.bind(this, function(menu, isOpen) { (menu, isOpen) => {
let boxAlignment; let boxAlignment;
if (this._leftBox.contains(indicator.container)) if (this._leftBox.contains(indicator.container))
boxAlignment = Clutter.ActorAlign.START; boxAlignment = Clutter.ActorAlign.START;
@ -1206,6 +1202,6 @@ var Panel = new Lang.Class({
if (boxAlignment == Main.messageTray.bannerAlignment) if (boxAlignment == Main.messageTray.bannerAlignment)
Main.messageTray.bannerBlocked = isOpen; Main.messageTray.bannerBlocked = isOpen;
})); });
} }
}); });

View File

@ -214,9 +214,7 @@ var SystemIndicator = new Lang.Class({
}, },
_syncIndicatorsVisible() { _syncIndicatorsVisible() {
this.indicators.visible = this.indicators.get_children().some(function(actor) { this.indicators.visible = this.indicators.get_children().some(a => a.visible);
return actor.visible;
});
}, },
_addIndicator() { _addIndicator() {

View File

@ -476,25 +476,25 @@ var PopupMenuBase = new Lang.Class({
menuItem = new PopupMenuItem(title); menuItem = new PopupMenuItem(title);
this.addMenuItem(menuItem); this.addMenuItem(menuItem);
menuItem.connect('activate', Lang.bind(this, function (menuItem, event) { menuItem.connect('activate', (menuItem, event) => {
callback(event); callback(event);
})); });
return menuItem; return menuItem;
}, },
addSettingsAction(title, desktopFile) { addSettingsAction(title, desktopFile) {
let menuItem = this.addAction(title, function() { let menuItem = this.addAction(title, () => {
let app = Shell.AppSystem.get_default().lookup_app(desktopFile); let app = Shell.AppSystem.get_default().lookup_app(desktopFile);
if (!app) { if (!app) {
log('Settings panel for desktop file ' + desktopFile + ' could not be loaded!'); log('Settings panel for desktop file ' + desktopFile + ' could not be loaded!');
return; return;
} }
Main.overview.hide(); Main.overview.hide();
app.activate(); app.activate();
}); });
menuItem.actor.visible = Main.sessionMode.allowSettings; menuItem.actor.visible = Main.sessionMode.allowSettings;
this._settingsActions[desktopFile] = menuItem; this._settingsActions[desktopFile] = menuItem;
@ -510,7 +510,7 @@ var PopupMenuBase = new Lang.Class({
}, },
isEmpty() { isEmpty() {
let hasVisibleChildren = this.box.get_children().some(function(child) { let hasVisibleChildren = this.box.get_children().some(child => {
if (child._delegate instanceof PopupSeparatorMenuItem) if (child._delegate instanceof PopupSeparatorMenuItem)
return false; return false;
return isPopupMenuItemVisible(child); return isPopupMenuItemVisible(child);
@ -534,7 +534,7 @@ var PopupMenuBase = new Lang.Class({
}, },
_connectItemSignals(menuItem) { _connectItemSignals(menuItem) {
menuItem._activeChangeId = menuItem.connect('active-changed', Lang.bind(this, function (menuItem, active) { menuItem._activeChangeId = menuItem.connect('active-changed', (menuItem, active) => {
if (active && this._activeMenuItem != menuItem) { if (active && this._activeMenuItem != menuItem) {
if (this._activeMenuItem) if (this._activeMenuItem)
this._activeMenuItem.setActive(false); this._activeMenuItem.setActive(false);
@ -544,8 +544,8 @@ var PopupMenuBase = new Lang.Class({
this._activeMenuItem = null; this._activeMenuItem = null;
this.emit('active-changed', null); this.emit('active-changed', null);
} }
})); });
menuItem._sensitiveChangeId = menuItem.connect('sensitive-changed', Lang.bind(this, function() { menuItem._sensitiveChangeId = menuItem.connect('sensitive-changed', () => {
let sensitive = menuItem.getSensitive(); let sensitive = menuItem.getSensitive();
if (!sensitive && this._activeMenuItem == menuItem) { if (!sensitive && this._activeMenuItem == menuItem) {
if (!this.actor.navigate_focus(menuItem.actor, if (!this.actor.navigate_focus(menuItem.actor,
@ -556,21 +556,21 @@ var PopupMenuBase = new Lang.Class({
if (global.stage.get_key_focus() == this.actor) if (global.stage.get_key_focus() == this.actor)
menuItem.actor.grab_key_focus(); menuItem.actor.grab_key_focus();
} }
})); });
menuItem._activateId = menuItem.connect('activate', Lang.bind(this, function (menuItem, event) { menuItem._activateId = menuItem.connect('activate', (menuItem, event) => {
this.emit('activate', menuItem); this.emit('activate', menuItem);
this.itemActivated(BoxPointer.PopupAnimation.FULL); this.itemActivated(BoxPointer.PopupAnimation.FULL);
})); });
menuItem._parentSensitiveChangeId = this.connect('sensitive-changed', Lang.bind(this, function() { menuItem._parentSensitiveChangeId = this.connect('sensitive-changed', () => {
menuItem.syncSensitive(); menuItem.syncSensitive();
})); });
// the weird name is to avoid a conflict with some random property // the weird name is to avoid a conflict with some random property
// the menuItem may have, called destroyId // the menuItem may have, called destroyId
// (FIXME: in the future it may make sense to have container objects // (FIXME: in the future it may make sense to have container objects
// like PopupMenuManager does) // like PopupMenuManager does)
menuItem._popupMenuDestroyId = menuItem.connect('destroy', Lang.bind(this, function(menuItem) { menuItem._popupMenuDestroyId = menuItem.connect('destroy', menuItem => {
menuItem.disconnect(menuItem._popupMenuDestroyId); menuItem.disconnect(menuItem._popupMenuDestroyId);
menuItem.disconnect(menuItem._activateId); menuItem.disconnect(menuItem._activateId);
menuItem.disconnect(menuItem._activeChangeId); menuItem.disconnect(menuItem._activeChangeId);
@ -578,7 +578,7 @@ var PopupMenuBase = new Lang.Class({
this.disconnect(menuItem._parentSensitiveChangeId); this.disconnect(menuItem._parentSensitiveChangeId);
if (menuItem == this._activeMenuItem) if (menuItem == this._activeMenuItem)
this._activeMenuItem = null; this._activeMenuItem = null;
})); });
}, },
_updateSeparatorVisibility(menuItem) { _updateSeparatorVisibility(menuItem) {
@ -652,26 +652,26 @@ var PopupMenuBase = new Lang.Class({
if (menuItem instanceof PopupMenuSection) { if (menuItem instanceof PopupMenuSection) {
let activeChangeId = menuItem.connect('active-changed', Lang.bind(this, this._subMenuActiveChanged)); let activeChangeId = menuItem.connect('active-changed', Lang.bind(this, this._subMenuActiveChanged));
let parentOpenStateChangedId = this.connect('open-state-changed', function(self, open) { let parentOpenStateChangedId = this.connect('open-state-changed', (self, open) => {
if (open) if (open)
menuItem.open(); menuItem.open();
else else
menuItem.close(); menuItem.close();
}); });
let parentClosingId = this.connect('menu-closed', function() { let parentClosingId = this.connect('menu-closed', () => {
menuItem.emit('menu-closed'); menuItem.emit('menu-closed');
}); });
let subMenuSensitiveChangedId = this.connect('sensitive-changed', Lang.bind(this, function() { let subMenuSensitiveChangedId = this.connect('sensitive-changed', () => {
menuItem.emit('sensitive-changed'); menuItem.emit('sensitive-changed');
})); });
menuItem.connect('destroy', Lang.bind(this, function() { menuItem.connect('destroy', () => {
menuItem.disconnect(activeChangeId); menuItem.disconnect(activeChangeId);
this.disconnect(subMenuSensitiveChangedId); this.disconnect(subMenuSensitiveChangedId);
this.disconnect(parentOpenStateChangedId); this.disconnect(parentOpenStateChangedId);
this.disconnect(parentClosingId); this.disconnect(parentClosingId);
this.length--; this.length--;
})); });
} else if (menuItem instanceof PopupSubMenuMenuItem) { } else if (menuItem instanceof PopupSubMenuMenuItem) {
if (before_item == null) if (before_item == null)
this.box.add(menuItem.menu.actor); this.box.add(menuItem.menu.actor);
@ -680,14 +680,14 @@ var PopupMenuBase = new Lang.Class({
this._connectItemSignals(menuItem); this._connectItemSignals(menuItem);
let subMenuActiveChangeId = menuItem.menu.connect('active-changed', Lang.bind(this, this._subMenuActiveChanged)); let subMenuActiveChangeId = menuItem.menu.connect('active-changed', Lang.bind(this, this._subMenuActiveChanged));
let closingId = this.connect('menu-closed', function() { let closingId = this.connect('menu-closed', () => {
menuItem.menu.close(BoxPointer.PopupAnimation.NONE); menuItem.menu.close(BoxPointer.PopupAnimation.NONE);
}); });
menuItem.connect('destroy', Lang.bind(this, function() { menuItem.connect('destroy', () => {
menuItem.menu.disconnect(subMenuActiveChangeId); menuItem.menu.disconnect(subMenuActiveChangeId);
this.disconnect(closingId); this.disconnect(closingId);
})); });
} else if (menuItem instanceof PopupSeparatorMenuItem) { } else if (menuItem instanceof PopupSeparatorMenuItem) {
this._connectItemSignals(menuItem); this._connectItemSignals(menuItem);
@ -695,11 +695,13 @@ var PopupMenuBase = new Lang.Class({
// separator's adjacent siblings change visibility or position. // separator's adjacent siblings change visibility or position.
// open-state-changed isn't exactly that, but doing it in more // open-state-changed isn't exactly that, but doing it in more
// precise ways would require a lot more bookkeeping. // precise ways would require a lot more bookkeeping.
let openStateChangeId = this.connect('open-state-changed', Lang.bind(this, function() { this._updateSeparatorVisibility(menuItem); })); let openStateChangeId = this.connect('open-state-changed', () => {
let destroyId = menuItem.connect('destroy', Lang.bind(this, function() { this._updateSeparatorVisibility(menuItem);
});
let destroyId = menuItem.connect('destroy', () => {
this.disconnect(openStateChangeId); this.disconnect(openStateChangeId);
menuItem.disconnect(destroyId); menuItem.disconnect(destroyId);
})); });
} else if (menuItem instanceof PopupBaseMenuItem) } else if (menuItem instanceof PopupBaseMenuItem)
this._connectItemSignals(menuItem); this._connectItemSignals(menuItem);
else else
@ -711,9 +713,7 @@ var PopupMenuBase = new Lang.Class({
}, },
_getMenuItems() { _getMenuItems() {
return this.box.get_children().map(function (actor) { return this.box.get_children().map(a => a._delegate).filter(item => {
return actor._delegate;
}).filter(function(item) {
return item instanceof PopupBaseMenuItem || item instanceof PopupMenuSection; return item instanceof PopupBaseMenuItem || item instanceof PopupMenuSection;
}); });
}, },
@ -875,9 +875,9 @@ var PopupMenu = new Lang.Class({
this._activeMenuItem.setActive(false); this._activeMenuItem.setActive(false);
if (this._boxPointer.actor.visible) { if (this._boxPointer.actor.visible) {
this._boxPointer.hide(animate, Lang.bind(this, function() { this._boxPointer.hide(animate, () => {
this.emit('menu-closed'); this.emit('menu-closed');
})); });
} }
if (!this.isOpen) if (!this.isOpen)
@ -1234,8 +1234,11 @@ var PopupMenuManager = new Lang.Class({
if (source) { if (source) {
if (!menu.blockSourceEvents) if (!menu.blockSourceEvents)
this._grabHelper.addActor(source); this._grabHelper.addActor(source);
menudata.enterId = source.connect('enter-event', Lang.bind(this, function() { return this._onMenuSourceEnter(menu); })); menudata.enterId = source.connect('enter-event',
menudata.focusInId = source.connect('key-focus-in', Lang.bind(this, function() { this._onMenuSourceEnter(menu); })); () => this._onMenuSourceEnter(menu));
menudata.focusInId = source.connect('key-focus-in', () => {
this._onMenuSourceEnter(menu);
});
} }
if (position == undefined) if (position == undefined)

View File

@ -47,7 +47,7 @@ var RemoteMenuSeparatorItemMapper = new Lang.Class({
this._trackerItem.connect('notify::label', Lang.bind(this, this._updateLabel)); this._trackerItem.connect('notify::label', Lang.bind(this, this._updateLabel));
this._updateLabel(); this._updateLabel();
this.menuItem.connect('destroy', function() { this.menuItem.connect('destroy', () => {
trackerItem.run_dispose(); trackerItem.run_dispose();
}); });
}, },
@ -89,15 +89,15 @@ var RemoteMenuSubmenuItemMapper = new Lang.Class({
_insertItem.bind(null, this.menuItem.menu), _insertItem.bind(null, this.menuItem.menu),
_removeItem.bind(null, this.menuItem.menu)); _removeItem.bind(null, this.menuItem.menu));
this.menuItem.connect('request-open', Lang.bind(this, function(menu, open) { this.menuItem.connect('request-open', (menu, open) => {
this._trackerItem.request_submenu_shown(open); this._trackerItem.request_submenu_shown(open);
})); });
this._trackerItem.connect('notify::submenu-shown', Lang.bind(this, function() { this._trackerItem.connect('notify::submenu-shown', () => {
this.menuItem.setSubmenuShown(this._trackerItem.get_submenu_shown()); this.menuItem.setSubmenuShown(this._trackerItem.get_submenu_shown());
})); });
this.menuItem.connect('destroy', function() { this.menuItem.connect('destroy', () => {
trackerItem.run_dispose(); trackerItem.run_dispose();
}); });
}, },
@ -123,9 +123,9 @@ var RemoteMenuItemMapper = new Lang.Class({
this.menuItem.actor.add_child(this._label); this.menuItem.actor.add_child(this._label);
this.menuItem.actor.label_actor = this._label; this.menuItem.actor.label_actor = this._label;
this.menuItem.connect('activate', Lang.bind(this, function() { this.menuItem.connect('activate', () => {
this._trackerItem.activated(); this._trackerItem.activated();
})); });
this._trackerItem.bind_property('visible', this.menuItem.actor, 'visible', GObject.BindingFlags.SYNC_CREATE); this._trackerItem.bind_property('visible', this.menuItem.actor, 'visible', GObject.BindingFlags.SYNC_CREATE);
@ -138,7 +138,7 @@ var RemoteMenuItemMapper = new Lang.Class({
this._updateSensitivity(); this._updateSensitivity();
this._updateRole(); this._updateRole();
this.menuItem.connect('destroy', function() { this.menuItem.connect('destroy', () => {
trackerItem.run_dispose(); trackerItem.run_dispose();
}); });
}, },

View File

@ -143,7 +143,7 @@ function loadRemoteSearchProviders(searchSettings, callback) {
// Special case gnome-control-center to be always active and always first // Special case gnome-control-center to be always active and always first
sortOrder.unshift('gnome-control-center.desktop'); sortOrder.unshift('gnome-control-center.desktop');
loadedProviders = loadedProviders.filter(function(provider) { loadedProviders = loadedProviders.filter(provider => {
let appId = provider.appInfo.get_id(); let appId = provider.appInfo.get_id();
if (provider.defaultEnabled) { if (provider.defaultEnabled) {
@ -155,7 +155,7 @@ function loadRemoteSearchProviders(searchSettings, callback) {
} }
}); });
loadedProviders.sort(function(providerA, providerB) { loadedProviders.sort((providerA, providerB) => {
let idxA, idxB; let idxA, idxB;
let appIdA, appIdB; let appIdA, appIdB;
@ -240,8 +240,8 @@ var RemoteSearchProvider = new Lang.Class({
if (results.length <= maxNumber) if (results.length <= maxNumber)
return results; return results;
let regularResults = results.filter(function(r) { return !r.startsWith('special:'); }); let regularResults = results.filter(r => !r.startsWith('special:'));
let specialResults = results.filter(function(r) { return r.startsWith('special:'); }); let specialResults = results.filter(r => r.startsWith('special:'));
return regularResults.slice(0, maxNumber).concat(specialResults.slice(0, maxNumber)); return regularResults.slice(0, maxNumber).concat(specialResults.slice(0, maxNumber));
}, },

View File

@ -40,30 +40,29 @@ var RunDialog = new Lang.Class({
this._lockdownSettings = new Gio.Settings({ schema_id: LOCKDOWN_SCHEMA }); this._lockdownSettings = new Gio.Settings({ schema_id: LOCKDOWN_SCHEMA });
this._terminalSettings = new Gio.Settings({ schema_id: TERMINAL_SCHEMA }); this._terminalSettings = new Gio.Settings({ schema_id: TERMINAL_SCHEMA });
global.settings.connect('changed::development-tools', Lang.bind(this, function () { global.settings.connect('changed::development-tools', () => {
this._enableInternalCommands = global.settings.get_boolean('development-tools'); this._enableInternalCommands = global.settings.get_boolean('development-tools');
})); });
this._enableInternalCommands = global.settings.get_boolean('development-tools'); this._enableInternalCommands = global.settings.get_boolean('development-tools');
this._internalCommands = { 'lg': this._internalCommands = { 'lg': () => {
Lang.bind(this, function() {
Main.createLookingGlass().open(); Main.createLookingGlass().open();
}), },
'r': Lang.bind(this, this._restart), 'r': Lang.bind(this, this._restart),
// Developer brain backwards compatibility // Developer brain backwards compatibility
'restart': Lang.bind(this, this._restart), 'restart': Lang.bind(this, this._restart),
'debugexit': Lang.bind(this, function() { 'debugexit': () => {
Meta.quit(Meta.ExitCode.ERROR); Meta.quit(Meta.ExitCode.ERROR);
}), },
// rt is short for "reload theme" // rt is short for "reload theme"
'rt': Lang.bind(this, function() { 'rt': () => {
Main.reloadThemeResource(); Main.reloadThemeResource();
Main.loadTheme(); Main.loadTheme();
}) }
}; };
@ -115,7 +114,7 @@ var RunDialog = new Lang.Class({
this._history = new History.HistoryManager({ gsettingsKey: HISTORY_KEY, this._history = new History.HistoryManager({ gsettingsKey: HISTORY_KEY,
entry: this._entryText }); entry: this._entryText });
this._entryText.connect('key-press-event', Lang.bind(this, function(o, e) { this._entryText.connect('key-press-event', (o, e) => {
let symbol = e.get_key_symbol(); let symbol = e.get_key_symbol();
if (symbol == Clutter.Return || symbol == Clutter.KP_Enter) { if (symbol == Clutter.Return || symbol == Clutter.KP_Enter) {
this.popModal(); this.popModal();
@ -142,7 +141,7 @@ var RunDialog = new Lang.Class({
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} }
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
})); });
}, },
_getCommandCompletion(text) { _getCommandCompletion(text) {
@ -162,7 +161,7 @@ var RunDialog = new Lang.Class({
let paths = GLib.getenv('PATH').split(':'); let paths = GLib.getenv('PATH').split(':');
paths.push(GLib.get_home_dir()); paths.push(GLib.get_home_dir());
let someResults = paths.map(function(path) { let someResults = paths.map(path => {
let results = []; let results = [];
try { try {
let file = Gio.File.new_for_path(path); let file = Gio.File.new_for_path(path);
@ -180,9 +179,7 @@ var RunDialog = new Lang.Class({
return results; return results;
} }
}); });
let results = someResults.reduce(function(a, b) { let results = someResults.reduce((a, b) => a.concat(b), []);
return a.concat(b);
}, []);
if (!results.length) if (!results.length)
return null; return null;
@ -263,11 +260,10 @@ var RunDialog = new Lang.Class({
{ height: parentActor.height + errorBoxNaturalHeight, { height: parentActor.height + errorBoxNaturalHeight,
time: DIALOG_GROW_TIME, time: DIALOG_GROW_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete: Lang.bind(this, onComplete: () => {
function() { parentActor.set_height(-1);
parentActor.set_height(-1); this._errorBox.show();
this._errorBox.show(); }
})
}); });
} }
}, },

View File

@ -112,9 +112,9 @@ var NotificationsBox = new Lang.Class({
this.actor.add(this._scrollView, { x_fill: true, x_align: St.Align.START }); this.actor.add(this._scrollView, { x_fill: true, x_align: St.Align.START });
this._sources = new Map(); this._sources = new Map();
Main.messageTray.getSources().forEach(Lang.bind(this, function(source) { Main.messageTray.getSources().forEach(source => {
this._sourceAdded(Main.messageTray, source, true); this._sourceAdded(Main.messageTray, source, true);
})); });
this._updateVisibility(); this._updateVisibility();
this._sourceAddedId = Main.messageTray.connect('source-added', Lang.bind(this, this._sourceAdded)); this._sourceAddedId = Main.messageTray.connect('source-added', Lang.bind(this, this._sourceAdded));
@ -135,9 +135,8 @@ var NotificationsBox = new Lang.Class({
}, },
_updateVisibility() { _updateVisibility() {
this._notificationBox.visible = this._notificationBox.get_children().some(function(a) { this._notificationBox.visible =
return a.visible; this._notificationBox.get_children().some(a => a.visible);
});
this.actor.visible = this._notificationBox.visible; this.actor.visible = this._notificationBox.visible;
}, },
@ -235,21 +234,21 @@ var NotificationsBox = new Lang.Class({
this._showSource(source, obj, obj.sourceBox); this._showSource(source, obj, obj.sourceBox);
this._notificationBox.add(obj.sourceBox, { x_fill: false, x_align: St.Align.START }); this._notificationBox.add(obj.sourceBox, { x_fill: false, x_align: St.Align.START });
obj.sourceCountChangedId = source.connect('count-updated', Lang.bind(this, function(source) { obj.sourceCountChangedId = source.connect('count-updated', source => {
this._countChanged(source, obj); this._countChanged(source, obj);
})); });
obj.sourceTitleChangedId = source.connect('title-changed', Lang.bind(this, function(source) { obj.sourceTitleChangedId = source.connect('title-changed', source => {
this._titleChanged(source, obj); this._titleChanged(source, obj);
})); });
obj.policyChangedId = source.policy.connect('policy-changed', Lang.bind(this, function(policy, key) { obj.policyChangedId = source.policy.connect('policy-changed', (policy, key) => {
if (key == 'show-in-lock-screen') if (key == 'show-in-lock-screen')
this._visibleChanged(source, obj); this._visibleChanged(source, obj);
else else
this._detailedChanged(source, obj); this._detailedChanged(source, obj);
})); });
obj.sourceDestroyId = source.connect('destroy', Lang.bind(this, function(source) { obj.sourceDestroyId = source.connect('destroy', source => {
this._onSourceDestroy(source, obj); this._onSourceDestroy(source, obj);
})); });
this._sources.set(source, obj); this._sources.set(source, obj);
@ -499,47 +498,48 @@ var ScreenShield = new Lang.Class({
this.actor.add_actor(this._lockDialogGroup); this.actor.add_actor(this._lockDialogGroup);
this.actor.add_actor(this._lockScreenGroup); this.actor.add_actor(this._lockScreenGroup);
this._presence = new GnomeSession.Presence(Lang.bind(this, function(proxy, error) { this._presence = new GnomeSession.Presence((proxy, error) => {
if (error) { if (error) {
logError(error, 'Error while reading gnome-session presence'); logError(error, 'Error while reading gnome-session presence');
return; return;
} }
this._onStatusChanged(proxy.status); this._onStatusChanged(proxy.status);
})); });
this._presence.connectSignal('StatusChanged', Lang.bind(this, function(proxy, senderName, [status]) { this._presence.connectSignal('StatusChanged', (proxy, senderName, [status]) => {
this._onStatusChanged(status); this._onStatusChanged(status);
})); });
this._screenSaverDBus = new ShellDBus.ScreenSaverDBus(this); this._screenSaverDBus = new ShellDBus.ScreenSaverDBus(this);
this._smartcardManager = SmartcardManager.getSmartcardManager(); this._smartcardManager = SmartcardManager.getSmartcardManager();
this._smartcardManager.connect('smartcard-inserted', this._smartcardManager.connect('smartcard-inserted',
Lang.bind(this, function(manager, token) { (manager, token) => {
if (this._isLocked && token.UsedToLogin) if (this._isLocked && token.UsedToLogin)
this._liftShield(true, 0); this._liftShield(true, 0);
})); });
this._oVirtCredentialsManager = OVirt.getOVirtCredentialsManager(); this._oVirtCredentialsManager = OVirt.getOVirtCredentialsManager();
this._oVirtCredentialsManager.connect('user-authenticated', this._oVirtCredentialsManager.connect('user-authenticated',
Lang.bind(this, function() { () => {
if (this._isLocked) if (this._isLocked)
this._liftShield(true, 0); this._liftShield(true, 0);
})); });
this._loginManager = LoginManager.getLoginManager(); this._loginManager = LoginManager.getLoginManager();
this._loginManager.connect('prepare-for-sleep', this._loginManager.connect('prepare-for-sleep',
Lang.bind(this, this._prepareForSleep)); Lang.bind(this, this._prepareForSleep));
this._loginSession = null; this._loginSession = null;
this._loginManager.getCurrentSessionProxy(Lang.bind(this, this._loginManager.getCurrentSessionProxy(sessionProxy => {
function(sessionProxy) { this._loginSession = sessionProxy;
this._loginSession = sessionProxy; this._loginSession.connectSignal('Lock',
this._loginSession.connectSignal('Lock', Lang.bind(this, function() { this.lock(false); })); () => { this.lock(false); });
this._loginSession.connectSignal('Unlock', Lang.bind(this, function() { this.deactivate(false); })); this._loginSession.connectSignal('Unlock',
this._loginSession.connect('g-properties-changed', Lang.bind(this, this._syncInhibitor)); () => { this.deactivate(false); });
this._syncInhibitor(); this._loginSession.connect('g-properties-changed', Lang.bind(this, this._syncInhibitor));
})); this._syncInhibitor();
});
this._settings = new Gio.Settings({ schema_id: SCREENSAVER_SCHEMA }); this._settings = new Gio.Settings({ schema_id: SCREENSAVER_SCHEMA });
this._settings.connect('changed::' + LOCK_ENABLED_KEY, Lang.bind(this, this._syncInhibitor)); this._settings.connect('changed::' + LOCK_ENABLED_KEY, Lang.bind(this, this._syncInhibitor));
@ -713,11 +713,11 @@ var ScreenShield = new Lang.Class({
!this._isActive && lockEnabled && !lockLocked); !this._isActive && lockEnabled && !lockLocked);
if (inhibit) { if (inhibit) {
this._loginManager.inhibit(_("GNOME needs to lock the screen"), this._loginManager.inhibit(_("GNOME needs to lock the screen"),
Lang.bind(this, function(inhibitor) { inhibitor => {
if (this._inhibitor) if (this._inhibitor)
this._inhibitor.close(null); this._inhibitor.close(null);
this._inhibitor = inhibitor; this._inhibitor = inhibitor;
})); });
} else { } else {
if (this._inhibitor) if (this._inhibitor)
this._inhibitor.close(null); this._inhibitor.close(null);
@ -846,11 +846,11 @@ var ScreenShield = new Lang.Class({
if (shouldLock) { if (shouldLock) {
let lockTimeout = Math.max(STANDARD_FADE_TIME, this._settings.get_uint(LOCK_DELAY_KEY)); let lockTimeout = Math.max(STANDARD_FADE_TIME, this._settings.get_uint(LOCK_DELAY_KEY));
this._lockTimeoutId = Mainloop.timeout_add(lockTimeout * 1000, this._lockTimeoutId = Mainloop.timeout_add(lockTimeout * 1000,
Lang.bind(this, function() { () => {
this._lockTimeoutId = 0; this._lockTimeoutId = 0;
this.lock(false); this.lock(false);
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); });
GLib.Source.set_name_by_id(this._lockTimeoutId, '[gnome-shell] this.lock'); GLib.Source.set_name_by_id(this._lockTimeoutId, '[gnome-shell] this.lock');
} }
@ -1094,14 +1094,14 @@ var ScreenShield = new Lang.Class({
this._checkArrowAnimation(); this._checkArrowAnimation();
let motionId = global.stage.connect('captured-event', Lang.bind(this, function(stage, event) { let motionId = global.stage.connect('captured-event', (stage, event) => {
if (event.type() == Clutter.EventType.MOTION) { if (event.type() == Clutter.EventType.MOTION) {
this._cursorTracker.set_pointer_visible(true); this._cursorTracker.set_pointer_visible(true);
global.stage.disconnect(motionId); global.stage.disconnect(motionId);
} }
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
})); });
this._cursorTracker.set_pointer_visible(false); this._cursorTracker.set_pointer_visible(false);
this._lockScreenState = MessageTray.State.SHOWN; this._lockScreenState = MessageTray.State.SHOWN;
@ -1111,10 +1111,10 @@ var ScreenShield = new Lang.Class({
if (params.fadeToBlack && params.animateFade) { if (params.fadeToBlack && params.animateFade) {
// Take a beat // Take a beat
let id = Mainloop.timeout_add(1000 * MANUAL_FADE_TIME, Lang.bind(this, function() { let id = Mainloop.timeout_add(1000 * MANUAL_FADE_TIME, () => {
this._activateFade(this._shortLightbox, MANUAL_FADE_TIME); this._activateFade(this._shortLightbox, MANUAL_FADE_TIME);
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); });
GLib.Source.set_name_by_id(id, '[gnome-shell] this._activateFade'); GLib.Source.set_name_by_id(id, '[gnome-shell] this._activateFade');
} else { } else {
if (params.fadeToBlack) if (params.fadeToBlack)
@ -1192,9 +1192,7 @@ var ScreenShield = new Lang.Class({
deactivate(animate) { deactivate(animate) {
if (this._dialog) if (this._dialog)
this._dialog.finish(Lang.bind(this, function() { this._dialog.finish(() => { this._continueDeactivate(animate); });
this._continueDeactivate(animate);
}));
else else
this._continueDeactivate(animate); this._continueDeactivate(animate);
}, },
@ -1339,9 +1337,9 @@ var ScreenShield = new Lang.Class({
let wasLocked = global.get_runtime_state('b', LOCKED_STATE_STR); let wasLocked = global.get_runtime_state('b', LOCKED_STATE_STR);
if (wasLocked === null) if (wasLocked === null)
return; return;
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() { Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
this.lock(false); this.lock(false);
})); });
} }
}); });
Signals.addSignalMethods(ScreenShield.prototype); Signals.addSignalMethods(ScreenShield.prototype);

View File

@ -114,9 +114,9 @@ var ScreenshotService = new Lang.Class({
if (result) { if (result) {
if (flash) { if (flash) {
let flashspot = new Flashspot(area); let flashspot = new Flashspot(area);
flashspot.fire(Lang.bind(this, function() { flashspot.fire(() => {
this._removeShooterForSender(invocation.get_sender()); this._removeShooterForSender(invocation.get_sender());
})); });
} }
else else
this._removeShooterForSender(invocation.get_sender()); this._removeShooterForSender(invocation.get_sender());
@ -184,18 +184,17 @@ var ScreenshotService = new Lang.Class({
SelectAreaAsync(params, invocation) { SelectAreaAsync(params, invocation) {
let selectArea = new SelectArea(); let selectArea = new SelectArea();
selectArea.show(); selectArea.show();
selectArea.connect('finished', Lang.bind(this, selectArea.connect('finished', (selectArea, areaRectangle) => {
function(selectArea, areaRectangle) { if (areaRectangle) {
if (areaRectangle) { let retRectangle = this._unscaleArea(areaRectangle.x, areaRectangle.y,
let retRectangle = this._unscaleArea(areaRectangle.x, areaRectangle.y, areaRectangle.width, areaRectangle.height);
areaRectangle.width, areaRectangle.height); let retval = GLib.Variant.new('(iiii)', retRectangle);
let retval = GLib.Variant.new('(iiii)', retRectangle); invocation.return_value(retval);
invocation.return_value(retval); } else {
} else { invocation.return_error_literal(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED,
invocation.return_error_literal(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED, "Operation was cancelled");
"Operation was cancelled"); }
} });
}));
}, },
FlashAreaAsync(params, invocation) { FlashAreaAsync(params, invocation) {
@ -317,10 +316,9 @@ var SelectArea = new Lang.Class({
{ opacity: 0, { opacity: 0,
time: 0.2, time: 0.2,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete: Lang.bind(this, onComplete: () => {
function() { this._grabHelper.ungrab();
this._grabHelper.ungrab(); }
})
}); });
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
}, },
@ -329,11 +327,10 @@ var SelectArea = new Lang.Class({
global.screen.set_cursor(Meta.Cursor.DEFAULT); global.screen.set_cursor(Meta.Cursor.DEFAULT);
this.emit('finished', this._result); this.emit('finished', this._result);
GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
function() { this._group.destroy();
this._group.destroy(); return GLib.SOURCE_REMOVE;
return GLib.SOURCE_REMOVE; });
}));
} }
}); });
Signals.addSignalMethods(SelectArea.prototype); Signals.addSignalMethods(SelectArea.prototype);
@ -360,11 +357,11 @@ var Flashspot = new Lang.Class({
{ opacity: 0, { opacity: 0,
time: FLASHSPOT_ANIMATION_OUT_TIME, time: FLASHSPOT_ANIMATION_OUT_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete: Lang.bind(this, function() { onComplete: () => {
if (doneCallback) if (doneCallback)
doneCallback(); doneCallback();
this.destroy(); this.destroy();
}) }
}); });
} }
}); });

View File

@ -40,16 +40,14 @@ const Params = imports.misc.params;
function sleep(milliseconds) { function sleep(milliseconds) {
let cb; let cb;
let id = Mainloop.timeout_add(milliseconds, function() { let id = Mainloop.timeout_add(milliseconds, () => {
if (cb) if (cb)
cb(); cb();
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
}); });
GLib.Source.set_name_by_id(id, '[gnome-shell] sleep'); GLib.Source.set_name_by_id(id, '[gnome-shell] sleep');
return function(callback) { return callback => { cb = callback; };
cb = callback;
};
} }
/** /**
@ -62,14 +60,12 @@ function sleep(milliseconds) {
function waitLeisure() { function waitLeisure() {
let cb; let cb;
global.run_at_leisure(function() { global.run_at_leisure(() => {
if (cb) if (cb)
cb(); cb();
}); });
return function(callback) { return callback => { cb = callback; };
cb = callback;
};
} }
const PerfHelperIface = '<node> \ const PerfHelperIface = '<node> \
@ -103,19 +99,19 @@ function _callRemote(obj, method, ...args) {
let cb; let cb;
let errcb; let errcb;
args.push(function(result, excp) { args.push((result, excp) => {
if (excp) { if (excp) {
if (errcb) if (errcb)
errcb(excp); errcb(excp);
} else { } else {
if (cb) if (cb)
cb(); cb();
} }
}); });
method.apply(obj, args); method.apply(obj, args);
return function(callback, error_callback) { return (callback, error_callback) => {
cb = callback; cb = callback;
errcb = error_callback; errcb = error_callback;
}; };
@ -213,10 +209,10 @@ function collectStatistics() {
function _step(g, finish, onError) { function _step(g, finish, onError) {
try { try {
let waitFunction = g.next(); let waitFunction = g.next();
waitFunction(function() { waitFunction(() => {
_step(g, finish, onError); _step(g, finish, onError);
}, },
function(err) { err => {
if (onError) if (onError)
onError(err); onError(err);
}); });
@ -239,7 +235,7 @@ function _collect(scriptModule, outputFile) {
} }
Shell.PerfLog.get_default().replay( Shell.PerfLog.get_default().replay(
function(time, eventName, signature, arg) { (time, eventName, signature, arg) => {
if (eventName in eventHandlers) if (eventName in eventHandlers)
eventHandlers[eventName](time, arg); eventHandlers[eventName](time, arg);
}); });
@ -370,7 +366,7 @@ function runPerfScript(scriptModule, outputFile) {
let g = scriptModule.run(); let g = scriptModule.run();
_step(g, _step(g,
function() { () => {
try { try {
_collect(scriptModule, outputFile); _collect(scriptModule, outputFile);
} catch (err) { } catch (err) {
@ -379,7 +375,7 @@ function runPerfScript(scriptModule, outputFile) {
} }
Meta.exit(Meta.ExitCode.SUCCESS); Meta.exit(Meta.ExitCode.SUCCESS);
}, },
function(err) { err => {
log("Script failed: " + err + "\n" + err.stack); log("Script failed: " + err + "\n" + err.stack);
Meta.exit(Meta.ExitCode.ERROR); Meta.exit(Meta.ExitCode.ERROR);
}); });

View File

@ -214,9 +214,9 @@ var SearchResultsBase = new Lang.Class({
}, },
_ensureResultActors(results, callback) { _ensureResultActors(results, callback) {
let metasNeeded = results.filter(Lang.bind(this, function(resultId) { let metasNeeded = results.filter(
return this._resultDisplays[resultId] === undefined; resultId => this._resultDisplays[resultId] === undefined
})); );
if (metasNeeded.length === 0) { if (metasNeeded.length === 0) {
callback(true); callback(true);
@ -224,30 +224,28 @@ var SearchResultsBase = new Lang.Class({
this._cancellable.cancel(); this._cancellable.cancel();
this._cancellable.reset(); this._cancellable.reset();
this.provider.getResultMetas(metasNeeded, Lang.bind(this, function(metas) { this.provider.getResultMetas(metasNeeded, metas => {
if (metas.length != metasNeeded.length) { if (metas.length != metasNeeded.length) {
log('Wrong number of result metas returned by search provider ' + this.provider.id + log('Wrong number of result metas returned by search provider ' + this.provider.id +
': expected ' + metasNeeded.length + ' but got ' + metas.length); ': expected ' + metasNeeded.length + ' but got ' + metas.length);
callback(false); callback(false);
return; return;
} }
if (metas.some(function(meta) { if (metas.some(meta => !meta.name || !meta.id)) {
return !meta.name || !meta.id;
})) {
log('Invalid result meta returned from search provider ' + this.provider.id); log('Invalid result meta returned from search provider ' + this.provider.id);
callback(false); callback(false);
return; return;
} }
metasNeeded.forEach(Lang.bind(this, function(resultId, i) { metasNeeded.forEach((resultId, i) => {
let meta = metas[i]; let meta = metas[i];
let display = this._createResultDisplay(meta); let display = this._createResultDisplay(meta);
display.connect('activate', Lang.bind(this, this._activateResult)); display.connect('activate', Lang.bind(this, this._activateResult));
display.actor.connect('key-focus-in', Lang.bind(this, this._keyFocusIn)); display.actor.connect('key-focus-in', Lang.bind(this, this._keyFocusIn));
this._resultDisplays[resultId] = display; this._resultDisplays[resultId] = display;
})); });
callback(true); callback(true);
}), this._cancellable); }, this._cancellable);
} }
}, },
@ -262,7 +260,7 @@ var SearchResultsBase = new Lang.Class({
let results = this.provider.filterResults(providerResults, maxResults); let results = this.provider.filterResults(providerResults, maxResults);
let moreCount = Math.max(providerResults.length - results.length, 0); let moreCount = Math.max(providerResults.length - results.length, 0);
this._ensureResultActors(results, Lang.bind(this, function(successful) { this._ensureResultActors(results, successful => {
if (!successful) { if (!successful) {
this._clearResultDisplay(); this._clearResultDisplay();
callback(); callback();
@ -274,13 +272,13 @@ var SearchResultsBase = new Lang.Class({
// content while filling in the results. // content while filling in the results.
this.actor.hide(); this.actor.hide();
this._clearResultDisplay(); this._clearResultDisplay();
results.forEach(Lang.bind(this, function(resultId) { results.forEach(resultId => {
this._addItem(this._resultDisplays[resultId]); this._addItem(this._resultDisplays[resultId]);
})); });
this._setMoreCount(this.provider.canLaunchSearch ? moreCount : 0); this._setMoreCount(this.provider.canLaunchSearch ? moreCount : 0);
this.actor.show(); this.actor.show();
callback(); callback();
})); });
} }
} }
}); });
@ -295,12 +293,11 @@ var ListSearchResults = new Lang.Class({
this._container = new St.BoxLayout({ style_class: 'search-section-content' }); this._container = new St.BoxLayout({ style_class: 'search-section-content' });
this.providerInfo = new ProviderInfo(provider); this.providerInfo = new ProviderInfo(provider);
this.providerInfo.connect('key-focus-in', Lang.bind(this, this._keyFocusIn)); this.providerInfo.connect('key-focus-in', Lang.bind(this, this._keyFocusIn));
this.providerInfo.connect('clicked', Lang.bind(this, this.providerInfo.connect('clicked', () => {
function() { this.providerInfo.animateLaunch();
this.providerInfo.animateLaunch(); provider.launchSearch(this._terms);
provider.launchSearch(this._terms); Main.overview.toggle();
Main.overview.toggle(); });
}));
this._container.add(this.providerInfo, { x_fill: false, this._container.add(this.providerInfo, { x_fill: false,
y_fill: false, y_fill: false,
@ -457,16 +454,14 @@ var SearchResults = new Lang.Class({
}, },
_reloadRemoteProviders() { _reloadRemoteProviders() {
let remoteProviders = this._providers.filter(function(provider) { let remoteProviders = this._providers.filter(p => p.isRemoteProvider);
return provider.isRemoteProvider; remoteProviders.forEach(provider => {
});
remoteProviders.forEach(Lang.bind(this, function(provider) {
this._unregisterProvider(provider); this._unregisterProvider(provider);
})); });
RemoteSearch.loadRemoteSearchProviders(this._searchSettings, Lang.bind(this, function(providers) { RemoteSearch.loadRemoteSearchProviders(this._searchSettings, providers => {
providers.forEach(Lang.bind(this, this._registerProvider)); providers.forEach(Lang.bind(this, this._registerProvider));
})); });
}, },
_registerProvider(provider) { _registerProvider(provider) {
@ -511,7 +506,7 @@ var SearchResults = new Lang.Class({
let previousResults = this._results; let previousResults = this._results;
this._results = {}; this._results = {};
this._providers.forEach(Lang.bind(this, function(provider) { this._providers.forEach(provider => {
provider.searchInProgress = true; provider.searchInProgress = true;
let previousProviderResults = previousResults[provider.id]; let previousProviderResults = previousResults[provider.id];
@ -519,7 +514,7 @@ var SearchResults = new Lang.Class({
provider.getSubsearchResultSet(previousProviderResults, this._terms, Lang.bind(this, this._gotResults, provider), this._cancellable); provider.getSubsearchResultSet(previousProviderResults, this._terms, Lang.bind(this, this._gotResults, provider), this._cancellable);
else else
provider.getInitialResultSet(this._terms, Lang.bind(this, this._gotResults, provider), this._cancellable); provider.getInitialResultSet(this._terms, Lang.bind(this, this._gotResults, provider), this._cancellable);
})); });
this._updateSearchProgress(); this._updateSearchProgress();
@ -597,7 +592,7 @@ var SearchResults = new Lang.Class({
}, },
_clearDisplay() { _clearDisplay() {
this._providers.forEach(function(provider) { this._providers.forEach(provider => {
provider.display.clear(); provider.display.clear();
}); });
}, },
@ -632,13 +627,11 @@ var SearchResults = new Lang.Class({
if (this._startingSearch) if (this._startingSearch)
return true; return true;
return this._providers.some(function(provider) { return this._providers.some(p => p.searchInProgress);
return provider.searchInProgress;
});
}, },
_updateSearchProgress() { _updateSearchProgress() {
let haveResults = this._providers.some(function(provider) { let haveResults = this._providers.some(provider => {
let display = provider.display; let display = provider.display;
return (display.getFirstResult() != null); return (display.getFirstResult() != null);
}); });
@ -659,12 +652,12 @@ var SearchResults = new Lang.Class({
let terms = this._terms; let terms = this._terms;
let display = provider.display; let display = provider.display;
display.updateSearch(results, terms, Lang.bind(this, function() { display.updateSearch(results, terms, () => {
provider.searchInProgress = false; provider.searchInProgress = false;
this._maybeSetInitialSelection(); this._maybeSetInitialSelection();
this._updateSearchProgress(); this._updateSearchProgress();
})); });
}, },
activateDefault() { activateDefault() {

View File

@ -138,7 +138,7 @@ function _loadModes() {
function listModes() { function listModes() {
_loadModes(); _loadModes();
let id = Mainloop.idle_add(function() { let id = Mainloop.idle_add(() => {
let names = Object.getOwnPropertyNames(_modes); let names = Object.getOwnPropertyNames(_modes);
for (let i = 0; i < names.length; i++) for (let i = 0; i < names.length; i++)
if (_modes[names[i]].isPrimary) if (_modes[names[i]].isPrimary)

View File

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

View File

@ -85,10 +85,10 @@ var EntryMenu = new Lang.Class({
}, },
_updatePasteItem() { _updatePasteItem() {
this._clipboard.get_text(St.ClipboardType.CLIPBOARD, Lang.bind(this, this._clipboard.get_text(St.ClipboardType.CLIPBOARD,
function(clipboard, text) { (clipboard, text) => {
this._pasteItem.setSensitive(text && text != ''); this._pasteItem.setSensitive(text && text != '');
})); });
}, },
_updatePasswordItem() { _updatePasswordItem() {
@ -105,14 +105,14 @@ var EntryMenu = new Lang.Class({
}, },
_onPasteActivated() { _onPasteActivated() {
this._clipboard.get_text(St.ClipboardType.CLIPBOARD, Lang.bind(this, this._clipboard.get_text(St.ClipboardType.CLIPBOARD,
function(clipboard, text) { (clipboard, text) => {
if (!text) if (!text)
return; return;
this._entry.clutter_text.delete_selection(); this._entry.clutter_text.delete_selection();
let pos = this._entry.clutter_text.get_cursor_position(); let pos = this._entry.clutter_text.get_cursor_position();
this._entry.clutter_text.insert_text(text, pos); this._entry.clutter_text.insert_text(text, pos);
})); });
}, },
_onPasswordActivated() { _onPasswordActivated() {
@ -166,7 +166,7 @@ function addContextMenu(entry, params) {
entry.connect('popup-menu', Lang.bind(null, _onPopup, entry)); entry.connect('popup-menu', Lang.bind(null, _onPopup, entry));
entry.connect('destroy', function() { entry.connect('destroy', () => {
entry.menu.destroy(); entry.menu.destroy();
entry.menu = null; entry.menu = null;
entry._menuManager = null; entry._menuManager = null;

View File

@ -137,13 +137,13 @@ var ShellMountOperation = new Lang.Class({
this._closeExistingDialog(); this._closeExistingDialog();
this._dialog = new ShellMountQuestionDialog(this._gicon); this._dialog = new ShellMountQuestionDialog(this._gicon);
this._dialogId = this._dialog.connect('response', Lang.bind(this, this._dialogId = this._dialog.connect('response',
function(object, choice) { (object, choice) => {
this.mountOp.set_choice(choice); this.mountOp.set_choice(choice);
this.mountOp.reply(Gio.MountOperationResult.HANDLED); this.mountOp.reply(Gio.MountOperationResult.HANDLED);
this.close(); this.close();
})); });
this._dialog.update(message, choices); this._dialog.update(message, choices);
this._dialog.open(); this._dialog.open();
@ -157,8 +157,8 @@ var ShellMountOperation = new Lang.Class({
this._dialog = new ShellMountPasswordDialog(message, this._gicon, flags); this._dialog = new ShellMountPasswordDialog(message, this._gicon, flags);
} }
this._dialogId = this._dialog.connect('response', Lang.bind(this, this._dialogId = this._dialog.connect('response',
function(object, choice, password, remember) { (object, choice, password, remember) => {
if (choice == -1) { if (choice == -1) {
this.mountOp.reply(Gio.MountOperationResult.ABORTED); this.mountOp.reply(Gio.MountOperationResult.ABORTED);
} else { } else {
@ -170,7 +170,7 @@ var ShellMountOperation = new Lang.Class({
this.mountOp.set_password(password); this.mountOp.set_password(password);
this.mountOp.reply(Gio.MountOperationResult.HANDLED); this.mountOp.reply(Gio.MountOperationResult.HANDLED);
} }
})); });
this._dialog.open(); this._dialog.open();
}, },
@ -200,8 +200,8 @@ var ShellMountOperation = new Lang.Class({
this._processesDialog = new ShellProcessesDialog(this._gicon); this._processesDialog = new ShellProcessesDialog(this._gicon);
this._dialog = this._processesDialog; this._dialog = this._processesDialog;
this._dialogId = this._processesDialog.connect('response', Lang.bind(this, this._dialogId = this._processesDialog.connect('response',
function(object, choice) { (object, choice) => {
if (choice == -1) { if (choice == -1) {
this.mountOp.reply(Gio.MountOperationResult.ABORTED); this.mountOp.reply(Gio.MountOperationResult.ABORTED);
} else { } else {
@ -210,7 +210,7 @@ var ShellMountOperation = new Lang.Class({
} }
this.close(); this.close();
})); });
this._processesDialog.open(); this._processesDialog.open();
} }
@ -397,24 +397,22 @@ var ShellProcessesDialog = new Lang.Class({
this._applicationList = new St.BoxLayout({ vertical: true }); this._applicationList = new St.BoxLayout({ vertical: true });
scrollView.add_actor(this._applicationList); scrollView.add_actor(this._applicationList);
this._applicationList.connect('actor-added', this._applicationList.connect('actor-added', () => {
Lang.bind(this, function() { if (this._applicationList.get_n_children() == 1)
if (this._applicationList.get_n_children() == 1) scrollView.show();
scrollView.show(); });
}));
this._applicationList.connect('actor-removed', this._applicationList.connect('actor-removed', () => {
Lang.bind(this, function() { if (this._applicationList.get_n_children() == 0)
if (this._applicationList.get_n_children() == 0) scrollView.hide();
scrollView.hide(); });
}));
}, },
_setAppsForPids(pids) { _setAppsForPids(pids) {
// remove all the items // remove all the items
this._applicationList.destroy_all_children(); this._applicationList.destroy_all_children();
pids.forEach(Lang.bind(this, function(pid) { pids.forEach(pid => {
let tracker = Shell.WindowTracker.get_default(); let tracker = Shell.WindowTracker.get_default();
let app = tracker.get_app_from_pid(pid); let app = tracker.get_app_from_pid(pid);
@ -424,12 +422,11 @@ var ShellProcessesDialog = new Lang.Class({
let item = new ListItem(app); let item = new ListItem(app);
this._applicationList.add(item.actor, { x_fill: true }); this._applicationList.add(item.actor, { x_fill: true });
item.connect('activate', item.connect('activate', () => {
Lang.bind(this, function() { // use -1 to indicate Cancel
// use -1 to indicate Cancel this.emit('response', -1);
this.emit('response', -1); });
})); });
}));
}, },
update(message, processes, choices) { update(message, processes, choices) {
@ -572,8 +569,8 @@ var GnomeShellMountOpHandler = new Lang.Class({
this._closeDialog(); this._closeDialog();
this._dialog = new ShellMountPasswordDialog(message, this._createGIcon(iconName), flags); this._dialog = new ShellMountPasswordDialog(message, this._createGIcon(iconName), flags);
this._dialog.connect('response', Lang.bind(this, this._dialog.connect('response',
function(object, choice, password, remember) { (object, choice, password, remember) => {
let details = {}; let details = {};
let response; let response;
@ -588,7 +585,7 @@ var GnomeShellMountOpHandler = new Lang.Class({
} }
this._clearCurrentRequest(response, details); this._clearCurrentRequest(response, details);
})); });
this._dialog.open(); this._dialog.open();
}, },
@ -621,11 +618,10 @@ var GnomeShellMountOpHandler = new Lang.Class({
this._closeDialog(); this._closeDialog();
this._dialog = new ShellMountQuestionDialog(this._createGIcon(iconName), message); this._dialog = new ShellMountQuestionDialog(this._createGIcon(iconName), message);
this._dialog.connect('response', Lang.bind(this, this._dialog.connect('response', (object, choice) => {
function(object, choice) { this._clearCurrentRequest(Gio.MountOperationResult.HANDLED,
this._clearCurrentRequest(Gio.MountOperationResult.HANDLED, { choice: GLib.Variant.new('i', choice) });
{ choice: GLib.Variant.new('i', choice) }); });
}));
this._dialog.update(message, choices); this._dialog.update(message, choices);
this._dialog.open(); this._dialog.open();
@ -661,20 +657,19 @@ var GnomeShellMountOpHandler = new Lang.Class({
this._closeDialog(); this._closeDialog();
this._dialog = new ShellProcessesDialog(this._createGIcon(iconName)); this._dialog = new ShellProcessesDialog(this._createGIcon(iconName));
this._dialog.connect('response', Lang.bind(this, this._dialog.connect('response', (object, choice) => {
function(object, choice) { let response;
let response; let details = {};
let details = {};
if (choice == -1) { if (choice == -1) {
response = Gio.MountOperationResult.ABORTED; response = Gio.MountOperationResult.ABORTED;
} else { } else {
response = Gio.MountOperationResult.HANDLED; response = Gio.MountOperationResult.HANDLED;
details['choice'] = GLib.Variant.new('i', choice); details['choice'] = GLib.Variant.new('i', choice);
} }
this._clearCurrentRequest(response, details); this._clearCurrentRequest(response, details);
})); });
this._dialog.update(message, applicationPids, choices); this._dialog.update(message, applicationPids, choices);
this._dialog.open(); this._dialog.open();

View File

@ -93,7 +93,7 @@ var ATIndicator = new Lang.Class({
let alwaysShow = this._a11ySettings.get_boolean(KEY_ALWAYS_SHOW); let alwaysShow = this._a11ySettings.get_boolean(KEY_ALWAYS_SHOW);
let items = this.menu._getMenuItems(); let items = this.menu._getMenuItems();
this.actor.visible = alwaysShow || items.some(function(f) { return !!f.state; }); this.actor.visible = alwaysShow || items.some(f => !!f.state);
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
}, },
@ -111,7 +111,7 @@ var ATIndicator = new Lang.Class({
if (!writable) if (!writable)
widget.actor.reactive = false; widget.actor.reactive = false;
else else
widget.connect('toggled', function(item) { widget.connect('toggled', item => {
on_set(item.state); on_set(item.state);
}); });
return widget; return widget;
@ -119,25 +119,23 @@ var ATIndicator = new Lang.Class({
_buildItem(string, schema, key) { _buildItem(string, schema, key) {
let settings = new Gio.Settings({ schema_id: schema }); let settings = new Gio.Settings({ schema_id: schema });
settings.connect('changed::'+key, Lang.bind(this, function() { settings.connect('changed::'+key, () => {
widget.setToggleState(settings.get_boolean(key)); widget.setToggleState(settings.get_boolean(key));
this._queueSyncMenuVisibility(); this._queueSyncMenuVisibility();
})); });
let widget = this._buildItemExtended(string, let widget = this._buildItemExtended(string,
settings.get_boolean(key), settings.get_boolean(key),
settings.is_writable(key), settings.is_writable(key),
function(enabled) { enabled => settings.set_boolean(key, enabled));
return settings.set_boolean(key, enabled);
});
return widget; return widget;
}, },
_buildHCItem() { _buildHCItem() {
let interfaceSettings = new Gio.Settings({ schema_id: DESKTOP_INTERFACE_SCHEMA }); let interfaceSettings = new Gio.Settings({ schema_id: DESKTOP_INTERFACE_SCHEMA });
let wmSettings = new Gio.Settings({ schema_id: WM_SCHEMA }); let wmSettings = new Gio.Settings({ schema_id: WM_SCHEMA });
interfaceSettings.connect('changed::' + KEY_GTK_THEME, Lang.bind(this, function() { interfaceSettings.connect('changed::' + KEY_GTK_THEME, () => {
let value = interfaceSettings.get_string(KEY_GTK_THEME); let value = interfaceSettings.get_string(KEY_GTK_THEME);
if (value == HIGH_CONTRAST_THEME) { if (value == HIGH_CONTRAST_THEME) {
highContrast.setToggleState(true); highContrast.setToggleState(true);
@ -147,13 +145,13 @@ var ATIndicator = new Lang.Class({
} }
this._queueSyncMenuVisibility(); this._queueSyncMenuVisibility();
})); });
interfaceSettings.connect('changed::' + KEY_ICON_THEME, function() { interfaceSettings.connect('changed::' + KEY_ICON_THEME, () => {
let value = interfaceSettings.get_string(KEY_ICON_THEME); let value = interfaceSettings.get_string(KEY_ICON_THEME);
if (value != HIGH_CONTRAST_THEME) if (value != HIGH_CONTRAST_THEME)
iconTheme = value; iconTheme = value;
}); });
wmSettings.connect('changed::' + KEY_WM_THEME, function() { wmSettings.connect('changed::' + KEY_WM_THEME, () => {
let value = wmSettings.get_string(KEY_WM_THEME); let value = wmSettings.get_string(KEY_WM_THEME);
if (value != HIGH_CONTRAST_THEME) if (value != HIGH_CONTRAST_THEME)
wmTheme = value; wmTheme = value;
@ -169,7 +167,7 @@ var ATIndicator = new Lang.Class({
interfaceSettings.is_writable(KEY_GTK_THEME) && interfaceSettings.is_writable(KEY_GTK_THEME) &&
interfaceSettings.is_writable(KEY_ICON_THEME) && interfaceSettings.is_writable(KEY_ICON_THEME) &&
wmSettings.is_writable(KEY_WM_THEME), wmSettings.is_writable(KEY_WM_THEME),
function (enabled) { enabled => {
if (enabled) { if (enabled) {
interfaceSettings.set_string(KEY_GTK_THEME, HIGH_CONTRAST_THEME); interfaceSettings.set_string(KEY_GTK_THEME, HIGH_CONTRAST_THEME);
interfaceSettings.set_string(KEY_ICON_THEME, HIGH_CONTRAST_THEME); interfaceSettings.set_string(KEY_ICON_THEME, HIGH_CONTRAST_THEME);
@ -189,20 +187,20 @@ var ATIndicator = new Lang.Class({
_buildFontItem() { _buildFontItem() {
let settings = new Gio.Settings({ schema_id: DESKTOP_INTERFACE_SCHEMA }); let settings = new Gio.Settings({ schema_id: DESKTOP_INTERFACE_SCHEMA });
settings.connect('changed::' + KEY_TEXT_SCALING_FACTOR, Lang.bind(this, function() { settings.connect('changed::' + KEY_TEXT_SCALING_FACTOR, () => {
let factor = settings.get_double(KEY_TEXT_SCALING_FACTOR); let factor = settings.get_double(KEY_TEXT_SCALING_FACTOR);
let active = (factor > 1.0); let active = (factor > 1.0);
widget.setToggleState(active); widget.setToggleState(active);
this._queueSyncMenuVisibility(); this._queueSyncMenuVisibility();
})); });
let factor = settings.get_double(KEY_TEXT_SCALING_FACTOR); let factor = settings.get_double(KEY_TEXT_SCALING_FACTOR);
let initial_setting = (factor > 1.0); let initial_setting = (factor > 1.0);
let widget = this._buildItemExtended(_("Large Text"), let widget = this._buildItemExtended(_("Large Text"),
initial_setting, initial_setting,
settings.is_writable(KEY_TEXT_SCALING_FACTOR), settings.is_writable(KEY_TEXT_SCALING_FACTOR),
function (enabled) { enabled => {
if (enabled) if (enabled)
settings.set_double(KEY_TEXT_SCALING_FACTOR, settings.set_double(KEY_TEXT_SCALING_FACTOR,
DPI_FACTOR_LARGE); DPI_FACTOR_LARGE);

View File

@ -35,23 +35,23 @@ var Indicator = new Lang.Class({
this._hadSetupDevices = global.settings.get_boolean(HAD_BLUETOOTH_DEVICES_SETUP); this._hadSetupDevices = global.settings.get_boolean(HAD_BLUETOOTH_DEVICES_SETUP);
this._proxy = new RfkillManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH, this._proxy = new RfkillManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
Lang.bind(this, function(proxy, error) { (proxy, error) => {
if (error) { if (error) {
log(error.message); log(error.message);
return; return;
} }
this._sync(); this._sync();
})); });
this._proxy.connect('g-properties-changed', Lang.bind(this, this._sync)); this._proxy.connect('g-properties-changed', Lang.bind(this, this._sync));
this._item = new PopupMenu.PopupSubMenuMenuItem(_("Bluetooth"), true); this._item = new PopupMenu.PopupSubMenuMenuItem(_("Bluetooth"), true);
this._item.icon.icon_name = 'bluetooth-active-symbolic'; this._item.icon.icon_name = 'bluetooth-active-symbolic';
this._toggleItem = new PopupMenu.PopupMenuItem(''); this._toggleItem = new PopupMenu.PopupMenuItem('');
this._toggleItem.connect('activate', Lang.bind(this, function() { this._toggleItem.connect('activate', () => {
this._proxy.BluetoothAirplaneMode = !this._proxy.BluetoothAirplaneMode; this._proxy.BluetoothAirplaneMode = !this._proxy.BluetoothAirplaneMode;
})); });
this._item.menu.addMenuItem(this._toggleItem); this._item.menu.addMenuItem(this._toggleItem);
this._item.menu.addSettingsAction(_("Bluetooth Settings"), 'gnome-bluetooth-panel.desktop'); this._item.menu.addSettingsAction(_("Bluetooth Settings"), 'gnome-bluetooth-panel.desktop');

View File

@ -26,7 +26,7 @@ var Indicator = new Lang.Class({
_init() { _init() {
this.parent('display-brightness-symbolic'); this.parent('display-brightness-symbolic');
this._proxy = new BrightnessProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH, this._proxy = new BrightnessProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
Lang.bind(this, function(proxy, error) { (proxy, error) => {
if (error) { if (error) {
log(error.message); log(error.message);
return; return;
@ -34,7 +34,7 @@ var Indicator = new Lang.Class({
this._proxy.connect('g-properties-changed', Lang.bind(this, this._sync)); this._proxy.connect('g-properties-changed', Lang.bind(this, this._sync));
this._sync(); this._sync();
})); });
this._item = new PopupMenu.PopupBaseMenuItem({ activate: false }); this._item = new PopupMenu.PopupBaseMenuItem({ activate: false });
this.menu.addMenuItem(this._item); this.menu.addMenuItem(this._item);
@ -47,12 +47,12 @@ var Indicator = new Lang.Class({
style_class: 'popup-menu-icon' }); style_class: 'popup-menu-icon' });
this._item.actor.add(icon); this._item.actor.add(icon);
this._item.actor.add(this._slider.actor, { expand: true }); this._item.actor.add(this._slider.actor, { expand: true });
this._item.actor.connect('button-press-event', Lang.bind(this, function(actor, event) { this._item.actor.connect('button-press-event', (actor, event) => {
return this._slider.startDragging(event); return this._slider.startDragging(event);
})); });
this._item.actor.connect('key-press-event', Lang.bind(this, function(actor, event) { this._item.actor.connect('key-press-event', (actor, event) => {
return this._slider.onKeyPressEvent(actor, event); return this._slider.onKeyPressEvent(actor, event);
})); });
}, },

View File

@ -209,7 +209,7 @@ var InputSourceSystemSettings = new Lang.Class({
'GetAll', 'GetAll',
new GLib.Variant('(s)', [this._BUS_IFACE]), new GLib.Variant('(s)', [this._BUS_IFACE]),
null, Gio.DBusCallFlags.NONE, -1, null, null, Gio.DBusCallFlags.NONE, -1, null,
Lang.bind(this, function(conn, result) { (conn, result) => {
let props; let props;
try { try {
props = conn.call_finish(result).deep_unpack()[0]; props = conn.call_finish(result).deep_unpack()[0];
@ -231,7 +231,7 @@ var InputSourceSystemSettings = new Lang.Class({
this._options = options; this._options = options;
this._emitKeyboardOptionsChanged(); this._emitKeyboardOptionsChanged();
} }
})); });
}, },
get inputSources() { get inputSources() {
@ -485,7 +485,7 @@ var InputSourceManager = new Lang.Class({
for (let i in this._inputSources) for (let i in this._inputSources)
sourcesList.push(this._inputSources[i]); sourcesList.push(this._inputSources[i]);
this._keyboardManager.setUserLayouts(sourcesList.map(function(x) { return x.xkbId; })); this._keyboardManager.setUserLayouts(sourcesList.map(x => x.xkbId));
if (!this._disableIBus && this._mruSourcesBackup) { if (!this._disableIBus && this._mruSourcesBackup) {
this._mruSources = this._mruSourcesBackup; this._mruSources = this._mruSourcesBackup;
@ -733,9 +733,7 @@ var InputSourceManager = new Lang.Class({
Main.overview.disconnect(this._overviewHiddenId); Main.overview.disconnect(this._overviewHiddenId);
this._overviewHiddenId = 0; this._overviewHiddenId = 0;
let windows = global.get_window_actors().map(function(w) { let windows = global.get_window_actors().map(w => w.meta_window);
return w.meta_window;
});
for (let i = 0; i < windows.length; ++i) { for (let i = 0; i < windows.length; ++i) {
delete windows[i]._inputSources; delete windows[i]._inputSources;
delete windows[i]._currentSource; delete windows[i]._currentSource;
@ -836,16 +834,14 @@ var InputSourceIndicator = new Lang.Class({
let is = this._inputSourceManager.inputSources[i]; let is = this._inputSourceManager.inputSources[i];
let menuItem = new LayoutMenuItem(is.displayName, is.shortName); let menuItem = new LayoutMenuItem(is.displayName, is.shortName);
menuItem.connect('activate', function() { menuItem.connect('activate', () => { is.activate(true); });
is.activate(true);
});
let indicatorLabel = new St.Label({ text: is.shortName, let indicatorLabel = new St.Label({ text: is.shortName,
visible: false }); visible: false });
this._menuItems[i] = menuItem; this._menuItems[i] = menuItem;
this._indicatorLabels[i] = indicatorLabel; this._indicatorLabels[i] = indicatorLabel;
is.connect('changed', function() { is.connect('changed', () => {
menuItem.indicator.set_text(is.shortName); menuItem.indicator.set_text(is.shortName);
indicatorLabel.set_text(is.shortName); indicatorLabel.set_text(is.shortName);
}); });
@ -939,7 +935,7 @@ var InputSourceIndicator = new Lang.Class({
item.radioGroup = radioGroup; item.radioGroup = radioGroup;
item.setOrnament(prop.get_state() == IBus.PropState.CHECKED ? item.setOrnament(prop.get_state() == IBus.PropState.CHECKED ?
PopupMenu.Ornament.DOT : PopupMenu.Ornament.NONE); PopupMenu.Ornament.DOT : PopupMenu.Ornament.NONE);
item.connect('activate', Lang.bind(this, function() { item.connect('activate', () => {
if (item.prop.get_state() == IBus.PropState.CHECKED) if (item.prop.get_state() == IBus.PropState.CHECKED)
return; return;
@ -957,13 +953,13 @@ var InputSourceIndicator = new Lang.Class({
IBus.PropState.UNCHECKED); IBus.PropState.UNCHECKED);
} }
} }
})); });
break; break;
case IBus.PropType.TOGGLE: case IBus.PropType.TOGGLE:
item = new PopupMenu.PopupSwitchMenuItem(prop.get_label().get_text(), prop.get_state() == IBus.PropState.CHECKED); item = new PopupMenu.PopupSwitchMenuItem(prop.get_label().get_text(), prop.get_state() == IBus.PropState.CHECKED);
item.prop = prop; item.prop = prop;
item.connect('toggled', Lang.bind(this, function() { item.connect('toggled', () => {
if (item.state) { if (item.state) {
item.prop.set_state(IBus.PropState.CHECKED); item.prop.set_state(IBus.PropState.CHECKED);
ibusManager.activateProperty(item.prop.get_key(), ibusManager.activateProperty(item.prop.get_key(),
@ -973,16 +969,16 @@ var InputSourceIndicator = new Lang.Class({
ibusManager.activateProperty(item.prop.get_key(), ibusManager.activateProperty(item.prop.get_key(),
IBus.PropState.UNCHECKED); IBus.PropState.UNCHECKED);
} }
})); });
break; break;
case IBus.PropType.NORMAL: case IBus.PropType.NORMAL:
item = new PopupMenu.PopupMenuItem(prop.get_label().get_text()); item = new PopupMenu.PopupMenuItem(prop.get_label().get_text());
item.prop = prop; item.prop = prop;
item.connect('activate', Lang.bind(this, function() { item.connect('activate', () => {
ibusManager.activateProperty(item.prop.get_key(), ibusManager.activateProperty(item.prop.get_key(),
item.prop.get_state()); item.prop.get_state());
})); });
break; break;
case IBus.PropType.SEPARATOR: case IBus.PropType.SEPARATOR:

View File

@ -116,11 +116,11 @@ var Indicator = new Lang.Class({
this._permStoreProxy, this._permStoreProxy,
this._getMaxAccuracyLevel()); this._getMaxAccuracyLevel());
authorizer.authorize(Lang.bind(this, function(accuracyLevel) { authorizer.authorize(accuracyLevel => {
let ret = (accuracyLevel != GeoclueAccuracyLevel.NONE); let ret = (accuracyLevel != GeoclueAccuracyLevel.NONE);
invocation.return_value(GLib.Variant.new('(bu)', invocation.return_value(GLib.Variant.new('(bu)',
[ret, accuracyLevel])); [ret, accuracyLevel]));
})); });
}, },
_syncIndicator() { _syncIndicator() {
@ -331,12 +331,11 @@ var AppAuthorizer = new Lang.Class({
reason, reason,
this.reqAccuracyLevel); this.reqAccuracyLevel);
let responseId = this._dialog.connect('response', Lang.bind(this, let responseId = this._dialog.connect('response', (dialog, level) => {
function(dialog, level) { this._dialog.disconnect(responseId);
this._dialog.disconnect(responseId); this._accuracyLevel = level;
this._accuracyLevel = level; this._completeAuth();
this._completeAuth(); });
}));
this._dialog.open(); this._dialog.open();
}, },
@ -367,7 +366,7 @@ var AppAuthorizer = new Lang.Class({
APP_PERMISSIONS_ID, APP_PERMISSIONS_ID,
this._permissions, this._permissions,
data, data,
function (result, error) { (result, error) => {
if (error != null) if (error != null)
log(error.message); log(error.message);
}); });

View File

@ -293,12 +293,10 @@ var NMConnectionSection = new Lang.Class({
if (!item) if (!item)
return; return;
item.connect('icon-changed', Lang.bind(this, function() { item.connect('icon-changed', () => { this._iconChanged(); });
this._iconChanged(); item.connect('activation-failed', (item, reason) => {
}));
item.connect('activation-failed', Lang.bind(this, function(item, reason) {
this.emit('activation-failed', reason); this.emit('activation-failed', reason);
})); });
item.connect('name-changed', Lang.bind(this, this._sync)); item.connect('name-changed', Lang.bind(this, this._sync));
let pos = Util.insertSorted(this._connections, connection, Lang.bind(this, this._connectionSortFunction)); let pos = Util.insertSorted(this._connections, connection, Lang.bind(this, this._connectionSortFunction));
@ -550,9 +548,9 @@ var NMDeviceModem = new Lang.Class({
if (this._mobileDevice) { if (this._mobileDevice) {
this._operatorNameId = this._mobileDevice.connect('notify::operator-name', Lang.bind(this, this._sync)); this._operatorNameId = this._mobileDevice.connect('notify::operator-name', Lang.bind(this, this._sync));
this._signalQualityId = this._mobileDevice.connect('notify::signal-quality', Lang.bind(this, function() { this._signalQualityId = this._mobileDevice.connect('notify::signal-quality', () => {
this._iconChanged(); this._iconChanged();
})); });
} }
}, },
@ -649,13 +647,9 @@ var NMWirelessDialogItem = new Lang.Class({
this.actor = new St.BoxLayout({ style_class: 'nm-dialog-item', this.actor = new St.BoxLayout({ style_class: 'nm-dialog-item',
can_focus: true, can_focus: true,
reactive: true }); reactive: true });
this.actor.connect('key-focus-in', Lang.bind(this, function() { this.actor.connect('key-focus-in', () => { this.emit('selected'); });
this.emit('selected');
}));
let action = new Clutter.ClickAction(); let action = new Clutter.ClickAction();
action.connect('clicked', Lang.bind(this, function() { action.connect('clicked', () => { this.actor.grab_key_focus(); });
this.actor.grab_key_focus();
}));
this.actor.add_action(action); this.actor.add_action(action);
let title = ssidToLabel(this._ap.get_ssid()); let title = ssidToLabel(this._ap.get_ssid());
@ -725,9 +719,9 @@ var NMWirelessDialog = new Lang.Class({
this._buildLayout(); this._buildLayout();
let connections = client.get_connections(); let connections = client.get_connections();
this._connections = connections.filter(Lang.bind(this, function(connection) { this._connections = connections.filter(
return device.connection_valid(connection); connection => device.connection_valid(connection)
})); );
this._apAddedId = device.connect('access-point-added', Lang.bind(this, this._accessPointAdded)); this._apAddedId = device.connect('access-point-added', Lang.bind(this, this._accessPointAdded));
this._apRemovedId = device.connect('access-point-removed', Lang.bind(this, this._accessPointRemoved)); this._apRemovedId = device.connect('access-point-removed', Lang.bind(this, this._accessPointRemoved));
@ -735,9 +729,9 @@ var NMWirelessDialog = new Lang.Class({
// accessPointAdded will also create dialog items // accessPointAdded will also create dialog items
let accessPoints = device.get_access_points() || [ ]; let accessPoints = device.get_access_points() || [ ];
accessPoints.forEach(Lang.bind(this, function(ap) { accessPoints.forEach(ap => {
this._accessPointAdded(this._device, ap); this._accessPointAdded(this._device, ap);
})); });
this._selectedNetwork = null; this._selectedNetwork = null;
this._activeApChanged(); this._activeApChanged();
@ -902,12 +896,12 @@ var NMWirelessDialog = new Lang.Class({
let airplaneSubStack = new St.Widget({ layout_manager: new Clutter.BinLayout }); let airplaneSubStack = new St.Widget({ layout_manager: new Clutter.BinLayout });
this._airplaneButton = new St.Button({ style_class: 'modal-dialog-button button' }); this._airplaneButton = new St.Button({ style_class: 'modal-dialog-button button' });
this._airplaneButton.connect('clicked', Lang.bind(this, function() { this._airplaneButton.connect('clicked', () => {
if (this._rfkill.airplaneMode) if (this._rfkill.airplaneMode)
this._rfkill.airplaneMode = false; this._rfkill.airplaneMode = false;
else else
this._client.wireless_enabled = true; this._client.wireless_enabled = true;
})); });
airplaneSubStack.add_actor(this._airplaneButton); airplaneSubStack.add_actor(this._airplaneButton);
this._airplaneInactive = new St.Label({ style_class: 'nm-dialog-airplane-text', this._airplaneInactive = new St.Label({ style_class: 'nm-dialog-airplane-text',
text: _("Use hardware switch to turn off") }); text: _("Use hardware switch to turn off") });
@ -1058,7 +1052,7 @@ var NMWirelessDialog = new Lang.Class({
}, },
_checkConnections(network, accessPoint) { _checkConnections(network, accessPoint) {
this._connections.forEach(function(connection) { this._connections.forEach(connection => {
if (accessPoint.connection_valid(connection) && if (accessPoint.connection_valid(connection) &&
network.connections.indexOf(connection) == -1) { network.connections.indexOf(connection) == -1) {
network.connections.push(connection); network.connections.push(connection);
@ -1084,7 +1078,7 @@ var NMWirelessDialog = new Lang.Class({
return; return;
} }
Util.insertSorted(network.accessPoints, accessPoint, function(one, two) { Util.insertSorted(network.accessPoints, accessPoint, (one, two) => {
return two.strength - one.strength; return two.strength - one.strength;
}); });
network.item.updateBestAP(network.accessPoints[0]); network.item.updateBestAP(network.accessPoints[0]);
@ -1137,9 +1131,9 @@ var NMWirelessDialog = new Lang.Class({
let scrollValue = adjustment.value; let scrollValue = adjustment.value;
this._itemBox.remove_all_children(); this._itemBox.remove_all_children();
this._networks.forEach(Lang.bind(this, function(network) { this._networks.forEach(network => {
this._itemBox.add_child(network.item.actor); this._itemBox.add_child(network.item.actor);
})); });
adjustment.value = scrollValue; adjustment.value = scrollValue;
}, },
@ -1158,10 +1152,10 @@ var NMWirelessDialog = new Lang.Class({
_createNetworkItem(network) { _createNetworkItem(network) {
network.item = new NMWirelessDialogItem(network); network.item = new NMWirelessDialogItem(network);
network.item.setActive(network == this._selectedNetwork); network.item.setActive(network == this._selectedNetwork);
network.item.connect('selected', Lang.bind(this, function() { network.item.connect('selected', () => {
Util.ensureActorVisibleInScrollView(this._scrollView, network.item.actor); Util.ensureActorVisibleInScrollView(this._scrollView, network.item.actor);
this._selectNetwork(network); this._selectNetwork(network);
})); });
}, },
}); });
@ -1518,12 +1512,12 @@ var NMVpnSection = new Lang.Class({
for (let item of connections) { for (let item of connections) {
item.setActiveConnection(null); item.setActiveConnection(null);
} }
vpnConnections.forEach(Lang.bind(this, function(a) { vpnConnections.forEach(a => {
if (a.connection) { if (a.connection) {
let item = this._connectionItems.get(a.connection.get_uuid()); let item = this._connectionItems.get(a.connection.get_uuid());
item.setActiveConnection(a); item.setActiveConnection(a);
} }
})); });
}, },
_makeConnectionItem(connection) { _makeConnectionItem(connection) {
@ -1570,9 +1564,7 @@ var DeviceCategory = new Lang.Class({
_sync() { _sync() {
let nDevices = this.section.box.get_children().reduce( let nDevices = this.section.box.get_children().reduce(
function(prev, child) { (prev, child) => prev + (child.visible ? 1 : 0), 0);
return prev + (child.visible ? 1 : 0);
}, 0);
this._summaryItem.label.text = this._getSummaryLabel(nDevices); this._summaryItem.label.text = this._getSummaryLabel(nDevices);
let shouldSummarize = nDevices > MAX_DEVICE_ITEMS; let shouldSummarize = nDevices > MAX_DEVICE_ITEMS;
this._summaryItem.actor.visible = shouldSummarize; this._summaryItem.actor.visible = shouldSummarize;
@ -1700,9 +1692,7 @@ var NMApplet = new Lang.Class({
'network-transmit-receive'); 'network-transmit-receive');
this._source.policy = new MessageTray.NotificationApplicationPolicy('gnome-network-panel'); this._source.policy = new MessageTray.NotificationApplicationPolicy('gnome-network-panel');
this._source.connect('destroy', Lang.bind(this, function() { this._source.connect('destroy', () => { this._source = null; });
this._source = null;
}));
Main.messageTray.add(this._source); Main.messageTray.add(this._source);
} }
}, },
@ -1725,7 +1715,7 @@ var NMApplet = new Lang.Class({
this._notification = new MessageTray.Notification(this._source, title, text, { gicon: gicon }); this._notification = new MessageTray.Notification(this._source, title, text, { gicon: gicon });
this._notification.setUrgency(urgency); this._notification.setUrgency(urgency);
this._notification.setTransient(true); this._notification.setTransient(true);
this._notification.connect('destroy', function() { this._notification.connect('destroy', () => {
this._notification = null; this._notification = null;
}); });
this._source.notify(this._notification); this._source.notify(this._notification);
@ -1767,7 +1757,7 @@ var NMApplet = new Lang.Class({
this._syncDeviceNames(); this._syncDeviceNames();
if (wrapper instanceof NMConnectionSection) { if (wrapper instanceof NMConnectionSection) {
this._connections.forEach(function(connection) { this._connections.forEach(connection => {
wrapper.checkConnection(connection); wrapper.checkConnection(connection);
}); });
} }
@ -1854,12 +1844,12 @@ var NMApplet = new Lang.Class({
_syncVpnConnections() { _syncVpnConnections() {
let activeConnections = this._client.get_active_connections() || []; let activeConnections = this._client.get_active_connections() || [];
let vpnConnections = activeConnections.filter(function(a) { let vpnConnections = activeConnections.filter(
return (a instanceof NM.VpnConnection); a => (a instanceof NM.VpnConnection)
}); );
vpnConnections.forEach(Lang.bind(this, function(a) { vpnConnections.forEach(a => {
ensureActiveConnectionProps(a, this._client); ensureActiveConnectionProps(a, this._client);
})); });
this._vpnSection.setActiveConnections(vpnConnections); this._vpnSection.setActiveConnections(vpnConnections);
this._updateIcon(); this._updateIcon();
@ -1943,7 +1933,7 @@ var NMApplet = new Lang.Class({
this._vpnSection.checkConnection(connection); this._vpnSection.checkConnection(connection);
} else { } else {
let devices = this._devices[section].devices; let devices = this._devices[section].devices;
devices.forEach(function(wrapper) { devices.forEach(wrapper => {
if (wrapper instanceof NMConnectionSection) if (wrapper instanceof NMConnectionSection)
wrapper.checkConnection(connection); wrapper.checkConnection(connection);
}); });
@ -1989,13 +1979,13 @@ var NMApplet = new Lang.Class({
this._closeConnectivityCheck(path); this._closeConnectivityCheck(path);
return; return;
} else if (result == PortalHelperResult.RECHECK) { } else if (result == PortalHelperResult.RECHECK) {
this._client.check_connectivity_async(null, Lang.bind(this, function(client, result) { this._client.check_connectivity_async(null, (client, result) => {
try { try {
let state = client.check_connectivity_finish(result); let state = client.check_connectivity_finish(result);
if (state >= NM.ConnectivityState.FULL) if (state >= NM.ConnectivityState.FULL)
this._closeConnectivityCheck(path); this._closeConnectivityCheck(path);
} catch(e) { } } catch(e) { }
})); });
} else { } else {
log('Invalid result from portal helper: ' + result); log('Invalid result from portal helper: ' + result);
} }
@ -2030,7 +2020,7 @@ var NMApplet = new Lang.Class({
this._portalHelperProxy.AuthenticateRemote(path, '', timestamp); this._portalHelperProxy.AuthenticateRemote(path, '', timestamp);
} else { } else {
new PortalHelperProxy(Gio.DBus.session, 'org.gnome.Shell.PortalHelper', new PortalHelperProxy(Gio.DBus.session, 'org.gnome.Shell.PortalHelper',
'/org/gnome/Shell/PortalHelper', Lang.bind(this, function (proxy, error) { '/org/gnome/Shell/PortalHelper', (proxy, error) => {
if (error) { if (error) {
log('Error launching the portal helper: ' + error); log('Error launching the portal helper: ' + error);
return; return;
@ -2040,7 +2030,7 @@ var NMApplet = new Lang.Class({
proxy.connectSignal('Done', Lang.bind(this, this._portalHelperDone)); proxy.connectSignal('Done', Lang.bind(this, this._portalHelperDone));
proxy.AuthenticateRemote(path, '', timestamp); proxy.AuthenticateRemote(path, '', timestamp);
})); });
} }
this._connectivityQueue.push(path); this._connectivityQueue.push(path);

View File

@ -47,7 +47,7 @@ var Indicator = new Lang.Class({
this.indicators.add_style_class_name('power-status'); this.indicators.add_style_class_name('power-status');
this._proxy = new PowerManagerProxy(Gio.DBus.system, BUS_NAME, OBJECT_PATH, this._proxy = new PowerManagerProxy(Gio.DBus.system, BUS_NAME, OBJECT_PATH,
Lang.bind(this, function(proxy, error) { (proxy, error) => {
if (error) { if (error) {
log(error.message); log(error.message);
return; return;
@ -55,7 +55,7 @@ var Indicator = new Lang.Class({
this._proxy.connect('g-properties-changed', this._proxy.connect('g-properties-changed',
Lang.bind(this, this._sync)); Lang.bind(this, this._sync));
this._sync(); this._sync();
})); });
this._item = new PopupMenu.PopupSubMenuMenuItem("", true); this._item = new PopupMenu.PopupSubMenuMenuItem("", true);
this._item.menu.addSettingsAction(_("Power Settings"), 'gnome-power-panel.desktop'); this._item.menu.addSettingsAction(_("Power Settings"), 'gnome-power-panel.desktop');

View File

@ -26,7 +26,7 @@ var RfkillManager = new Lang.Class({
_init() { _init() {
this._proxy = new RfkillManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH, this._proxy = new RfkillManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
Lang.bind(this, function(proxy, error) { (proxy, error) => {
if (error) { if (error) {
log(error.message); log(error.message);
return; return;
@ -34,7 +34,7 @@ var RfkillManager = new Lang.Class({
this._proxy.connect('g-properties-changed', this._proxy.connect('g-properties-changed',
Lang.bind(this, this._changed)); Lang.bind(this, this._changed));
this._changed(); this._changed();
})); });
}, },
get airplaneMode() { get airplaneMode() {
@ -87,9 +87,9 @@ var Indicator = new Lang.Class({
// changing the menu contents. // changing the menu contents.
this._item = new PopupMenu.PopupSubMenuMenuItem(_("Airplane Mode On"), true); this._item = new PopupMenu.PopupSubMenuMenuItem(_("Airplane Mode On"), true);
this._item.icon.icon_name = 'airplane-mode-symbolic'; this._item.icon.icon_name = 'airplane-mode-symbolic';
this._offItem = this._item.menu.addAction(_("Turn Off"), Lang.bind(this, function() { this._offItem = this._item.menu.addAction(_("Turn Off"), () => {
this._manager.airplaneMode = false; this._manager.airplaneMode = false;
})); });
this._item.menu.addSettingsAction(_("Network Settings"), 'gnome-network-panel.desktop'); this._item.menu.addSettingsAction(_("Network Settings"), 'gnome-network-panel.desktop');
this.menu.addMenuItem(this._item); this.menu.addMenuItem(this._item);

View File

@ -133,13 +133,12 @@ var Indicator = new Lang.Class({
// settings (disable-log-out) and Polkit policy - the latter doesn't // settings (disable-log-out) and Polkit policy - the latter doesn't
// notify, so we update the menu item each time the menu opens or // notify, so we update the menu item each time the menu opens or
// the lockdown setting changes, which should be close enough. // the lockdown setting changes, which should be close enough.
this.menu.connect('open-state-changed', Lang.bind(this, this.menu.connect('open-state-changed', (menu, open) => {
function(menu, open) { if (!open)
if (!open) return;
return;
this._systemActions.forceUpdate(); this._systemActions.forceUpdate();
})); });
this._updateMultiUser(); this._updateMultiUser();
Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated)); Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
@ -220,10 +219,10 @@ var Indicator = new Lang.Class({
// the popup menu, and we can't easily connect on allocation-changed // the popup menu, and we can't easily connect on allocation-changed
// or notify::width without creating layout cycles, simply update the // or notify::width without creating layout cycles, simply update the
// label whenever the menu is opened. // label whenever the menu is opened.
this.menu.connect('open-state-changed', Lang.bind(this, function(menu, isOpen) { this.menu.connect('open-state-changed', (menu, isOpen) => {
if (isOpen) if (isOpen)
this._updateSwitchUserSubMenu(); this._updateSwitchUserSubMenu();
})); });
item = new PopupMenu.PopupMenuItem(_("Switch User")); item = new PopupMenu.PopupMenuItem(_("Switch User"));
item.connect('activate', () => { item.connect('activate', () => {

View File

@ -132,7 +132,7 @@ var Client = new Lang.Class({
enrollDevice(id, policy, callback) { enrollDevice(id, policy, callback) {
this._proxy.EnrollDeviceRemote(id, policy, AuthFlags.NONE, this._proxy.EnrollDeviceRemote(id, policy, AuthFlags.NONE,
Lang.bind(this, function (res, error) { (res, error) => {
if (error) { if (error) {
callback(null, error); callback(null, error);
return; return;
@ -143,7 +143,7 @@ var Client = new Lang.Class({
BOLT_DBUS_NAME, BOLT_DBUS_NAME,
path); path);
callback(device, null); callback(device, null);
})); });
} }
}); });
@ -271,9 +271,7 @@ var Indicator = new Lang.Class({
if (!this._source) { if (!this._source) {
this._source = new MessageTray.Source(_("Thunderbolt"), this._source = new MessageTray.Source(_("Thunderbolt"),
'thunderbolt-symbolic'); 'thunderbolt-symbolic');
this._source.connect('destroy', Lang.bind(this, function() { this._source.connect('destroy', () => { this._source = null; });
this._source = null;
}));
Main.messageTray.add(this._source); Main.messageTray.add(this._source);
} }
@ -289,7 +287,7 @@ var Indicator = new Lang.Class({
this._notification = new MessageTray.Notification(source, title, body); this._notification = new MessageTray.Notification(source, title, body);
this._notification.setUrgency(MessageTray.Urgency.HIGH); this._notification.setUrgency(MessageTray.Urgency.HIGH);
this._notification.connect('destroy', function() { this._notification.connect('destroy', () => {
this._notification = null; this._notification = null;
}); });
this._notification.connect('activated', () => { this._notification.connect('activated', () => {

View File

@ -42,12 +42,12 @@ var StreamSlider = new Lang.Class({
this._icon = new St.Icon({ style_class: 'popup-menu-icon' }); this._icon = new St.Icon({ style_class: 'popup-menu-icon' });
this.item.actor.add(this._icon); this.item.actor.add(this._icon);
this.item.actor.add(this._slider.actor, { expand: true }); this.item.actor.add(this._slider.actor, { expand: true });
this.item.actor.connect('button-press-event', Lang.bind(this, function(actor, event) { this.item.actor.connect('button-press-event', (actor, event) => {
return this._slider.startDragging(event); return this._slider.startDragging(event);
})); });
this.item.actor.connect('key-press-event', Lang.bind(this, function(actor, event) { this.item.actor.connect('key-press-event', (actor, event) => {
return this._slider.onKeyPressEvent(actor, event); return this._slider.onKeyPressEvent(actor, event);
})); });
this._stream = null; this._stream = null;
}, },
@ -270,9 +270,9 @@ var VolumeMenu = new Lang.Class({
this._control.connect('default-source-changed', Lang.bind(this, this._readInput)); this._control.connect('default-source-changed', Lang.bind(this, this._readInput));
this._output = new OutputStreamSlider(this._control); this._output = new OutputStreamSlider(this._control);
this._output.connect('stream-updated', Lang.bind(this, function() { this._output.connect('stream-updated', () => {
this.emit('icon-changed'); this.emit('icon-changed');
})); });
this.addMenuItem(this._output.item); this.addMenuItem(this._output.item);
this._input = new InputStreamSlider(this._control); this._input = new InputStreamSlider(this._control);
@ -324,7 +324,7 @@ var Indicator = new Lang.Class({
this._control = getMixerControl(); this._control = getMixerControl();
this._volumeMenu = new VolumeMenu(this._control); this._volumeMenu = new VolumeMenu(this._control);
this._volumeMenu.connect('icon-changed', Lang.bind(this, function(menu) { this._volumeMenu.connect('icon-changed', menu => {
let icon = this._volumeMenu.getIcon(); let icon = this._volumeMenu.getIcon();
if (icon != null) { if (icon != null) {
@ -333,7 +333,7 @@ var Indicator = new Lang.Class({
} else { } else {
this.indicators.hide(); this.indicators.hide();
} }
})); });
this.menu.addMenuItem(this._volumeMenu); this.menu.addMenuItem(this._volumeMenu);

View File

@ -161,12 +161,12 @@ var SwitcherPopup = new Lang.Class({
// We delay showing the popup so that fast Alt+Tab users aren't // We delay showing the popup so that fast Alt+Tab users aren't
// disturbed by the popup briefly flashing. // disturbed by the popup briefly flashing.
this._initialDelayTimeoutId = Mainloop.timeout_add(POPUP_DELAY_TIMEOUT, this._initialDelayTimeoutId = Mainloop.timeout_add(POPUP_DELAY_TIMEOUT,
Lang.bind(this, function () { () => {
Main.osdWindowManager.hideAll(); Main.osdWindowManager.hideAll();
this.actor.opacity = 255; this.actor.opacity = 255;
this._initialDelayTimeoutId = 0; this._initialDelayTimeoutId = 0;
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); });
GLib.Source.set_name_by_id(this._initialDelayTimeoutId, '[gnome-shell] Main.osdWindow.cancel'); GLib.Source.set_name_by_id(this._initialDelayTimeoutId, '[gnome-shell] Main.osdWindow.cancel');
return true; return true;
}, },
@ -282,11 +282,11 @@ var SwitcherPopup = new Lang.Class({
Mainloop.source_remove(this._noModsTimeoutId); Mainloop.source_remove(this._noModsTimeoutId);
this._noModsTimeoutId = Mainloop.timeout_add(NO_MODS_TIMEOUT, this._noModsTimeoutId = Mainloop.timeout_add(NO_MODS_TIMEOUT,
Lang.bind(this, function () { () => {
this._finish(global.get_current_time()); this._finish(global.get_current_time());
this._noModsTimeoutId = 0; this._noModsTimeoutId = 0;
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); });
}, },
_popModal() { _popModal() {
@ -303,10 +303,9 @@ var SwitcherPopup = new Lang.Class({
{ opacity: 0, { opacity: 0,
time: POPUP_FADE_OUT_TIME, time: POPUP_FADE_OUT_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete: Lang.bind(this, onComplete: () => {
function() { this.actor.destroy();
this.actor.destroy(); }
})
}); });
} else } else
this.actor.destroy(); this.actor.destroy();
@ -346,9 +345,9 @@ var SwitcherList = new Lang.Class({
// children to have the same width. // children to have the same width.
this._list = new Shell.GenericContainer({ style_class: 'switcher-list-item-container' }); this._list = new Shell.GenericContainer({ style_class: 'switcher-list-item-container' });
this._list.spacing = 0; this._list.spacing = 0;
this._list.connect('style-changed', Lang.bind(this, function() { this._list.connect('style-changed', () => {
this._list.spacing = this._list.get_theme_node().get_length('spacing'); this._list.spacing = this._list.get_theme_node().get_length('spacing');
})); });
this._list.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth)); this._list.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
this._list.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight)); this._list.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
@ -366,12 +365,14 @@ var SwitcherList = new Lang.Class({
// Those arrows indicate whether scrolling in one direction is possible // Those arrows indicate whether scrolling in one direction is possible
this._leftArrow = new St.DrawingArea({ style_class: 'switcher-arrow', this._leftArrow = new St.DrawingArea({ style_class: 'switcher-arrow',
pseudo_class: 'highlighted' }); pseudo_class: 'highlighted' });
this._leftArrow.connect('repaint', Lang.bind(this, this._leftArrow.connect('repaint', () => {
function() { drawArrow(this._leftArrow, St.Side.LEFT); })); drawArrow(this._leftArrow, St.Side.LEFT);
});
this._rightArrow = new St.DrawingArea({ style_class: 'switcher-arrow', this._rightArrow = new St.DrawingArea({ style_class: 'switcher-arrow',
pseudo_class: 'highlighted' }); pseudo_class: 'highlighted' });
this._rightArrow.connect('repaint', Lang.bind(this, this._rightArrow.connect('repaint', () => {
function() { drawArrow(this._rightArrow, St.Side.RIGHT); })); drawArrow(this._rightArrow, St.Side.RIGHT);
});
this.actor.add_actor(this._leftArrow); this.actor.add_actor(this._leftArrow);
this.actor.add_actor(this._rightArrow); this.actor.add_actor(this._rightArrow);
@ -422,8 +423,8 @@ var SwitcherList = new Lang.Class({
this._list.add_actor(bbox); this._list.add_actor(bbox);
let n = this._items.length; let n = this._items.length;
bbox.connect('clicked', Lang.bind(this, function() { this._onItemClicked(n); })); bbox.connect('clicked', () => { this._onItemClicked(n); });
bbox.connect('motion-event', Lang.bind(this, function() { return this._onItemEnter(n); })); bbox.connect('motion-event', () => this._onItemEnter(n));
bbox.label_actor = label; bbox.label_actor = label;
@ -494,11 +495,11 @@ var SwitcherList = new Lang.Class({
{ value: value, { value: value,
time: POPUP_SCROLL_TIME, time: POPUP_SCROLL_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete: Lang.bind(this, function () { onComplete: () => {
if (this._highlighted == 0) if (this._highlighted == 0)
this._scrollableLeft = false; this._scrollableLeft = false;
this.actor.queue_relayout(); this.actor.queue_relayout();
}) }
}); });
}, },
@ -518,11 +519,11 @@ var SwitcherList = new Lang.Class({
{ value: value, { value: value,
time: POPUP_SCROLL_TIME, time: POPUP_SCROLL_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete: Lang.bind(this, function () { onComplete: () => {
if (this._highlighted == this._items.length - 1) if (this._highlighted == this._items.length - 1)
this._scrollableRight = false; this._scrollableRight = false;
this.actor.queue_relayout(); this.actor.queue_relayout();
}) }
}); });
}, },

View File

@ -49,7 +49,7 @@ function _wrapTweening(target, tweeningParameters) {
state.destroyedId = target.connect('destroy', _actorDestroyed); state.destroyedId = target.connect('destroy', _actorDestroyed);
} else if (target.actor && target.actor instanceof Clutter.Actor) { } else if (target.actor && target.actor instanceof Clutter.Actor) {
state.actor = target.actor; state.actor = target.actor;
state.destroyedId = target.actor.connect('destroy', function() { _actorDestroyed(target); }); state.destroyedId = target.actor.connect('destroy', () => { _actorDestroyed(target); });
} }
} }
@ -87,12 +87,12 @@ function _addHandler(target, params, name, handler) {
let oldParams = params[name + 'Params']; let oldParams = params[name + 'Params'];
let eventScope = oldScope ? oldScope : target; let eventScope = oldScope ? oldScope : target;
params[name] = function () { params[name] = () => {
oldHandler.apply(eventScope, oldParams); oldHandler.apply(eventScope, oldParams);
handler(target); handler(target);
}; };
} else } else
params[name] = function () { handler(target); }; params[name] = () => { handler(target); };
} }
function _actorDestroyed(target) { function _actorDestroyed(target) {
@ -178,10 +178,9 @@ var ClutterFrameTicker = new Lang.Class({
this._startTime = -1; this._startTime = -1;
this._currentTime = -1; this._currentTime = -1;
this._timeline.connect('new-frame', Lang.bind(this, this._timeline.connect('new-frame', (timeline, frame) => {
function(timeline, frame) { this._onNewFrame(frame);
this._onNewFrame(frame); });
}));
let perf_log = Shell.PerfLog.get_default(); let perf_log = Shell.PerfLog.get_default();
perf_log.define_event("tweener.framePrepareStart", perf_log.define_event("tweener.framePrepareStart",

View File

@ -84,9 +84,9 @@ var ShowOverviewAction = new Lang.Class({
this.parent(); this.parent();
this.set_n_touch_points(3); this.set_n_touch_points(3);
global.display.connect('grab-op-begin', Lang.bind(this, function() { global.display.connect('grab-op-begin', () => {
this.cancel(); this.cancel();
})); });
}, },
vfunc_gesture_prepare(action, actor) { vfunc_gesture_prepare(action, actor) {
@ -157,12 +157,12 @@ var ViewSelector = new Lang.Class({
this._text = this._entry.clutter_text; this._text = this._entry.clutter_text;
this._text.connect('text-changed', Lang.bind(this, this._onTextChanged)); this._text.connect('text-changed', Lang.bind(this, this._onTextChanged));
this._text.connect('key-press-event', Lang.bind(this, this._onKeyPress)); this._text.connect('key-press-event', Lang.bind(this, this._onKeyPress));
this._text.connect('key-focus-in', Lang.bind(this, function() { this._text.connect('key-focus-in', () => {
this._searchResults.highlightDefault(true); this._searchResults.highlightDefault(true);
})); });
this._text.connect('key-focus-out', Lang.bind(this, function() { this._text.connect('key-focus-out', () => {
this._searchResults.highlightDefault(false); this._searchResults.highlightDefault(false);
})); });
this._entry.connect('popup-menu', () => { this._entry.connect('popup-menu', () => {
if (!this._searchActive) if (!this._searchActive)
return; return;
@ -198,38 +198,35 @@ var ViewSelector = new Lang.Class({
// dummy widget as the last results container child so that we can // dummy widget as the last results container child so that we can
// include the entry in the keynav tab path // include the entry in the keynav tab path
this._focusTrap = new FocusTrap({ can_focus: true }); this._focusTrap = new FocusTrap({ can_focus: true });
this._focusTrap.connect('key-focus-in', Lang.bind(this, function() { this._focusTrap.connect('key-focus-in', () => {
this._entry.grab_key_focus(); this._entry.grab_key_focus();
})); });
this._searchResults.actor.add_actor(this._focusTrap); this._searchResults.actor.add_actor(this._focusTrap);
global.focus_manager.add_group(this._searchResults.actor); global.focus_manager.add_group(this._searchResults.actor);
this._stageKeyPressId = 0; this._stageKeyPressId = 0;
Main.overview.connect('showing', Lang.bind(this, Main.overview.connect('showing', () => {
function () { this._stageKeyPressId = global.stage.connect('key-press-event',
this._stageKeyPressId = global.stage.connect('key-press-event', Lang.bind(this, this._onStageKeyPress));
Lang.bind(this, this._onStageKeyPress)); });
})); Main.overview.connect('hiding', () => {
Main.overview.connect('hiding', Lang.bind(this, if (this._stageKeyPressId != 0) {
function () { global.stage.disconnect(this._stageKeyPressId);
if (this._stageKeyPressId != 0) { this._stageKeyPressId = 0;
global.stage.disconnect(this._stageKeyPressId); }
this._stageKeyPressId = 0; });
} Main.overview.connect('shown', () => {
})); // If we were animating from the desktop view to the
Main.overview.connect('shown', Lang.bind(this, // apps page the workspace page was visible, allowing
function() { // the windows to animate, but now we no longer want to
// If we were animating from the desktop view to the // show it given that we are now on the apps page or
// apps page the workspace page was visible, allowing // search page.
// the windows to animate, but now we no longer want to if (this._activePage != this._workspacesPage) {
// show it given that we are now on the apps page or this._workspacesPage.opacity = 0;
// search page. this._workspacesPage.hide();
if (this._activePage != this._workspacesPage) { }
this._workspacesPage.opacity = 0; });
this._workspacesPage.hide();
}
}));
Main.wm.addKeybinding('toggle-application-view', Main.wm.addKeybinding('toggle-application-view',
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }), new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
@ -252,12 +249,12 @@ var ViewSelector = new Lang.Class({
side = St.Side.LEFT; side = St.Side.LEFT;
let gesture = new EdgeDragAction.EdgeDragAction(side, let gesture = new EdgeDragAction.EdgeDragAction(side,
Shell.ActionMode.NORMAL); Shell.ActionMode.NORMAL);
gesture.connect('activated', Lang.bind(this, function() { gesture.connect('activated', () => {
if (Main.overview.visible) if (Main.overview.visible)
Main.overview.hide(); Main.overview.hide();
else else
this.showApps(); this.showApps();
})); });
global.stage.add_action(gesture); global.stage.add_action(gesture);
gesture = new ShowOverviewAction(); gesture = new ShowOverviewAction();
@ -330,10 +327,9 @@ var ViewSelector = new Lang.Class({
else else
Main.ctrlAltTabManager.addGroup(actor, name, a11yIcon, Main.ctrlAltTabManager.addGroup(actor, name, a11yIcon,
{ proxy: this.actor, { proxy: this.actor,
focusCallback: Lang.bind(this, focusCallback: () => {
function() { this._a11yFocusPage(page);
this._a11yFocusPage(page); }
})
});; });;
page.hide(); page.hide();
this.actor.add_actor(page); this.actor.add_actor(page);
@ -354,9 +350,9 @@ var ViewSelector = new Lang.Class({
{ opacity: 0, { opacity: 0,
time: OverviewControls.SIDE_CONTROLS_ANIMATION_TIME, time: OverviewControls.SIDE_CONTROLS_ANIMATION_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete: Lang.bind(this, function() { onComplete: () => {
this._animateIn(oldPage); this._animateIn(oldPage);
}) }
}); });
}, },
@ -382,10 +378,9 @@ var ViewSelector = new Lang.Class({
if (page == this._appsPage && if (page == this._appsPage &&
this._activePage == this._workspacesPage && this._activePage == this._workspacesPage &&
!Main.overview.animationInProgress) { !Main.overview.animationInProgress) {
this.appDisplay.animate(IconGrid.AnimationDirection.OUT, Lang.bind(this, this.appDisplay.animate(IconGrid.AnimationDirection.OUT, () => {
function() { this._animateIn(oldPage)
this._animateIn(oldPage) });
}));
} else { } else {
this._fadePageOut(page); this._fadePageOut(page);
} }

View File

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

View File

@ -296,24 +296,24 @@ var WorkspaceTracker = new Lang.Class({
if (workspace._keepAliveId) if (workspace._keepAliveId)
Mainloop.source_remove(workspace._keepAliveId); Mainloop.source_remove(workspace._keepAliveId);
workspace._keepAliveId = Mainloop.timeout_add(duration, Lang.bind(this, function() { workspace._keepAliveId = Mainloop.timeout_add(duration, () => {
workspace._keepAliveId = 0; workspace._keepAliveId = 0;
this._queueCheckWorkspaces(); this._queueCheckWorkspaces();
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); });
GLib.Source.set_name_by_id(workspace._keepAliveId, '[gnome-shell] this._queueCheckWorkspaces'); GLib.Source.set_name_by_id(workspace._keepAliveId, '[gnome-shell] this._queueCheckWorkspaces');
}, },
_windowRemoved(workspace, window) { _windowRemoved(workspace, window) {
workspace._lastRemovedWindow = window; workspace._lastRemovedWindow = window;
this._queueCheckWorkspaces(); this._queueCheckWorkspaces();
let id = Mainloop.timeout_add(LAST_WINDOW_GRACE_TIME, Lang.bind(this, function() { let id = Mainloop.timeout_add(LAST_WINDOW_GRACE_TIME, () => {
if (workspace._lastRemovedWindow == window) { if (workspace._lastRemovedWindow == window) {
workspace._lastRemovedWindow = null; workspace._lastRemovedWindow = null;
this._queueCheckWorkspaces(); this._queueCheckWorkspaces();
} }
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
})); });
GLib.Source.set_name_by_id(id, '[gnome-shell] this._queueCheckWorkspaces'); GLib.Source.set_name_by_id(id, '[gnome-shell] this._queueCheckWorkspaces');
}, },
@ -378,7 +378,7 @@ var WorkspaceTracker = new Lang.Class({
} }
let lostWorkspaces = this._workspaces.splice(removedIndex, removedNum); let lostWorkspaces = this._workspaces.splice(removedIndex, removedNum);
lostWorkspaces.forEach(function(workspace) { lostWorkspaces.forEach(workspace => {
workspace.disconnect(workspace._windowAddedId); workspace.disconnect(workspace._windowAddedId);
workspace.disconnect(workspace._windowRemovedId); workspace.disconnect(workspace._windowRemovedId);
}); });
@ -545,9 +545,9 @@ var WorkspaceSwitchAction = new Lang.Class({
this.set_n_touch_points(4); this.set_n_touch_points(4);
this.set_threshold_trigger_distance(MOTION_THRESHOLD, MOTION_THRESHOLD); this.set_threshold_trigger_distance(MOTION_THRESHOLD, MOTION_THRESHOLD);
global.display.connect('grab-op-begin', Lang.bind(this, function() { global.display.connect('grab-op-begin', () => {
this.cancel(); this.cancel();
})); });
}, },
vfunc_gesture_prepare(actor) { vfunc_gesture_prepare(actor) {
@ -584,9 +584,9 @@ var AppSwitchAction = new Lang.Class({
this.parent(); this.parent();
this.set_n_touch_points(3); this.set_n_touch_points(3);
global.display.connect('grab-op-begin', Lang.bind(this, function() { global.display.connect('grab-op-begin', () => {
this.cancel(); this.cancel();
})); });
}, },
vfunc_gesture_prepare(action, actor) { vfunc_gesture_prepare(action, actor) {
@ -693,12 +693,12 @@ var WindowManager = new Lang.Class({
this._switchData = null; this._switchData = null;
this._shellwm.connect('kill-switch-workspace', Lang.bind(this, this._switchWorkspaceDone)); this._shellwm.connect('kill-switch-workspace', Lang.bind(this, this._switchWorkspaceDone));
this._shellwm.connect('kill-window-effects', Lang.bind(this, function (shellwm, actor) { this._shellwm.connect('kill-window-effects', (shellwm, actor) => {
this._minimizeWindowDone(shellwm, actor); this._minimizeWindowDone(shellwm, actor);
this._mapWindowDone(shellwm, actor); this._mapWindowDone(shellwm, actor);
this._destroyWindowDone(shellwm, actor); this._destroyWindowDone(shellwm, actor);
this._sizeChangeWindowDone(shellwm, actor); this._sizeChangeWindowDone(shellwm, actor);
})); });
this._shellwm.connect('switch-workspace', Lang.bind(this, this._switchWorkspace)); this._shellwm.connect('switch-workspace', Lang.bind(this, this._switchWorkspace));
this._shellwm.connect('show-tile-preview', Lang.bind(this, this._showTilePreview)); this._shellwm.connect('show-tile-preview', Lang.bind(this, this._showTilePreview));
@ -927,21 +927,21 @@ var WindowManager = new Lang.Class({
global.display.connect('show-resize-popup', Lang.bind(this, this._showResizePopup)); global.display.connect('show-resize-popup', Lang.bind(this, this._showResizePopup));
global.display.connect('show-pad-osd', Lang.bind(this, this._showPadOsd)); global.display.connect('show-pad-osd', Lang.bind(this, this._showPadOsd));
global.display.connect('show-osd', Lang.bind(this, function (display, monitorIndex, iconName, label) { global.display.connect('show-osd', (display, monitorIndex, iconName, label) => {
let icon = Gio.Icon.new_for_string(iconName); let icon = Gio.Icon.new_for_string(iconName);
Main.osdWindowManager.show(monitorIndex, icon, label, null); Main.osdWindowManager.show(monitorIndex, icon, label, null);
})); });
this._gsdWacomProxy = new GsdWacomProxy(Gio.DBus.session, GSD_WACOM_BUS_NAME, this._gsdWacomProxy = new GsdWacomProxy(Gio.DBus.session, GSD_WACOM_BUS_NAME,
GSD_WACOM_OBJECT_PATH, GSD_WACOM_OBJECT_PATH,
Lang.bind(this, function(proxy, error) { (proxy, error) => {
if (error) { if (error) {
log(error.message); log(error.message);
return; return;
} }
})); });
global.display.connect('pad-mode-switch', Lang.bind(this, function (display, pad, group, mode) { global.display.connect('pad-mode-switch', (display, pad, group, mode) => {
let labels = []; let labels = [];
//FIXME: Fix num buttons //FIXME: Fix num buttons
@ -954,16 +954,16 @@ var WindowManager = new Lang.Class({
this._gsdWacomProxy.SetOLEDLabelsRemote(pad.get_device_node(), labels); this._gsdWacomProxy.SetOLEDLabelsRemote(pad.get_device_node(), labels);
this._gsdWacomProxy.SetGroupModeLEDRemote(pad.get_device_node(), group, mode); this._gsdWacomProxy.SetGroupModeLEDRemote(pad.get_device_node(), group, mode);
} }
})); });
Main.overview.connect('showing', Lang.bind(this, function() { Main.overview.connect('showing', () => {
for (let i = 0; i < this._dimmedWindows.length; i++) for (let i = 0; i < this._dimmedWindows.length; i++)
this._undimWindow(this._dimmedWindows[i]); this._undimWindow(this._dimmedWindows[i]);
})); });
Main.overview.connect('hiding', Lang.bind(this, function() { Main.overview.connect('hiding', () => {
for (let i = 0; i < this._dimmedWindows.length; i++) for (let i = 0; i < this._dimmedWindows.length; i++)
this._dimWindow(this._dimmedWindows[i]); this._dimWindow(this._dimmedWindows[i]);
})); });
this._windowMenuManager = new WindowMenu.WindowMenuManager(); this._windowMenuManager = new WindowMenu.WindowMenuManager();
@ -987,15 +987,15 @@ var WindowManager = new Lang.Class({
let mode = Shell.ActionMode.ALL & ~Shell.ActionMode.LOCK_SCREEN; let mode = Shell.ActionMode.ALL & ~Shell.ActionMode.LOCK_SCREEN;
gesture = new EdgeDragAction.EdgeDragAction(St.Side.BOTTOM, mode); gesture = new EdgeDragAction.EdgeDragAction(St.Side.BOTTOM, mode);
gesture.connect('activated', Lang.bind(this, function() { gesture.connect('activated', () => {
Main.keyboard.show(Main.layoutManager.bottomIndex); Main.keyboard.show(Main.layoutManager.bottomIndex);
})); });
global.stage.add_action(gesture); global.stage.add_action(gesture);
}, },
_showPadOsd(display, device, settings, imagePath, editionMode, monitorIndex) { _showPadOsd(display, device, settings, imagePath, editionMode, monitorIndex) {
this._currentPadOsd = new PadOsd.PadOsd(device, settings, imagePath, editionMode, monitorIndex); this._currentPadOsd = new PadOsd.PadOsd(device, settings, imagePath, editionMode, monitorIndex);
this._currentPadOsd.connect('closed', Lang.bind(this, function() { this._currentPadOsd = null })); this._currentPadOsd.connect('closed', () => { this._currentPadOsd = null });
return this._currentPadOsd.actor; return this._currentPadOsd.actor;
}, },
@ -1015,11 +1015,11 @@ var WindowManager = new Lang.Class({
}, },
_switchApp() { _switchApp() {
let windows = global.get_window_actors().filter(Lang.bind(this, function(actor) { let windows = global.get_window_actors().filter(actor => {
let win = actor.metaWindow; let win = actor.metaWindow;
return (!win.is_override_redirect() && return (!win.is_override_redirect() &&
win.located_on_workspace(global.screen.get_active_workspace())); win.located_on_workspace(global.screen.get_active_workspace()));
})); });
if (windows.length == 0) if (windows.length == 0)
return; return;
@ -1047,14 +1047,12 @@ var WindowManager = new Lang.Class({
global.screen.append_new_workspace(false, global.get_current_time()); global.screen.append_new_workspace(false, global.get_current_time());
let windows = global.get_window_actors().map(function(winActor) { let windows = global.get_window_actors().map(a => a.meta_window);
return winActor.meta_window;
});
// To create a new workspace, we slide all the windows on workspaces // To create a new workspace, we slide all the windows on workspaces
// below us to the next workspace, leaving a blank workspace for us // below us to the next workspace, leaving a blank workspace for us
// to recycle. // to recycle.
windows.forEach(function(window) { windows.forEach(window => {
// If the window is attached to an ancestor, we don't need/want // If the window is attached to an ancestor, we don't need/want
// to move it // to move it
if (window.get_transient_for() != null) if (window.get_transient_for() != null)
@ -1406,7 +1404,7 @@ var WindowManager = new Lang.Class({
_hasAttachedDialogs(window, ignoreWindow) { _hasAttachedDialogs(window, ignoreWindow) {
var count = 0; var count = 0;
window.foreach_transient(function(win) { window.foreach_transient(win => {
if (win != ignoreWindow && if (win != ignoreWindow &&
win.is_attached_dialog() && win.is_attached_dialog() &&
win.get_transient_for() == window) { win.get_transient_for() == window) {
@ -1427,9 +1425,8 @@ var WindowManager = new Lang.Class({
this._dimWindow(window); this._dimWindow(window);
} else if (!shouldDim && window._dimmed) { } else if (!shouldDim && window._dimmed) {
window._dimmed = false; window._dimmed = false;
this._dimmedWindows = this._dimmedWindows.filter(function(win) { this._dimmedWindows =
return win != window; this._dimmedWindows.filter(win => win != window);
});
this._undimWindow(window); this._undimWindow(window);
} }
}, },
@ -1469,24 +1466,25 @@ var WindowManager = new Lang.Class({
_mapWindow(shellwm, actor) { _mapWindow(shellwm, actor) {
actor._windowType = actor.meta_window.get_window_type(); actor._windowType = actor.meta_window.get_window_type();
actor._notifyWindowTypeSignalId = actor.meta_window.connect('notify::window-type', Lang.bind(this, function () { actor._notifyWindowTypeSignalId =
let type = actor.meta_window.get_window_type(); actor.meta_window.connect('notify::window-type', () => {
if (type == actor._windowType) let type = actor.meta_window.get_window_type();
return; if (type == actor._windowType)
if (type == Meta.WindowType.MODAL_DIALOG || return;
actor._windowType == Meta.WindowType.MODAL_DIALOG) { if (type == Meta.WindowType.MODAL_DIALOG ||
let parent = actor.get_meta_window().get_transient_for(); actor._windowType == Meta.WindowType.MODAL_DIALOG) {
if (parent) let parent = actor.get_meta_window().get_transient_for();
this._checkDimming(parent); if (parent)
} this._checkDimming(parent);
}
actor._windowType = type; actor._windowType = type;
})); });
actor.meta_window.connect('unmanaged', Lang.bind(this, function(window) { actor.meta_window.connect('unmanaged', window => {
let parent = window.get_transient_for(); let parent = window.get_transient_for();
if (parent) if (parent)
this._checkDimming(parent); this._checkDimming(parent);
})); });
if (actor.meta_window.is_attached_dialog()) if (actor.meta_window.is_attached_dialog())
this._checkDimming(actor.get_meta_window().get_transient_for()); this._checkDimming(actor.get_meta_window().get_transient_for());
@ -1576,9 +1574,8 @@ var WindowManager = new Lang.Class({
actor._notifyWindowTypeSignalId = 0; actor._notifyWindowTypeSignalId = 0;
} }
if (window._dimmed) { if (window._dimmed) {
this._dimmedWindows = this._dimmedWindows.filter(function(win) { this._dimmedWindows =
return win != window; this._dimmedWindows.filter(win => win != window);
});
} }
if (window.is_attached_dialog()) if (window.is_attached_dialog())
@ -1618,10 +1615,10 @@ var WindowManager = new Lang.Class({
if (window.is_attached_dialog()) { if (window.is_attached_dialog()) {
let parent = window.get_transient_for(); let parent = window.get_transient_for();
actor._parentDestroyId = parent.connect('unmanaged', Lang.bind(this, function () { actor._parentDestroyId = parent.connect('unmanaged', () => {
Tweener.removeTweens(actor); Tweener.removeTweens(actor);
this._destroyWindowDone(shellwm, actor); this._destroyWindowDone(shellwm, actor);
})); });
} }
Tweener.addTween(actor, Tweener.addTween(actor,
@ -1940,11 +1937,11 @@ var WindowManager = new Lang.Class({
if (this._workspaceSwitcherPopup == null) { if (this._workspaceSwitcherPopup == null) {
this._workspaceTracker.blockUpdates(); this._workspaceTracker.blockUpdates();
this._workspaceSwitcherPopup = new WorkspaceSwitcherPopup.WorkspaceSwitcherPopup(); this._workspaceSwitcherPopup = new WorkspaceSwitcherPopup.WorkspaceSwitcherPopup();
this._workspaceSwitcherPopup.connect('destroy', Lang.bind(this, function() { this._workspaceSwitcherPopup.connect('destroy', () => {
this._workspaceTracker.unblockUpdates(); this._workspaceTracker.unblockUpdates();
this._workspaceSwitcherPopup = null; this._workspaceSwitcherPopup = null;
this._isWorkspacePrepended = false; this._isWorkspacePrepended = false;
})); });
} }
this._workspaceSwitcherPopup.display(direction, newWs.index()); this._workspaceSwitcherPopup.display(direction, newWs.index());
} }

View File

@ -31,48 +31,48 @@ var WindowMenu = new Lang.Class({
let item; let item;
item = this.addAction(_("Minimize"), Lang.bind(this, function(event) { item = this.addAction(_("Minimize"), () => {
window.minimize(); window.minimize();
})); });
if (!window.can_minimize()) if (!window.can_minimize())
item.setSensitive(false); item.setSensitive(false);
if (window.get_maximized()) { if (window.get_maximized()) {
item = this.addAction(_("Unmaximize"), Lang.bind(this, function() { item = this.addAction(_("Unmaximize"), () => {
window.unmaximize(Meta.MaximizeFlags.BOTH); window.unmaximize(Meta.MaximizeFlags.BOTH);
})); });
} else { } else {
item = this.addAction(_("Maximize"), Lang.bind(this, function() { item = this.addAction(_("Maximize"), () => {
window.maximize(Meta.MaximizeFlags.BOTH); window.maximize(Meta.MaximizeFlags.BOTH);
})); });
} }
if (!window.can_maximize()) if (!window.can_maximize())
item.setSensitive(false); item.setSensitive(false);
item = this.addAction(_("Move"), Lang.bind(this, function(event) { item = this.addAction(_("Move"), event => {
window.begin_grab_op(Meta.GrabOp.KEYBOARD_MOVING, true, event.get_time()); window.begin_grab_op(Meta.GrabOp.KEYBOARD_MOVING, true, event.get_time());
})); });
if (!window.allows_move()) if (!window.allows_move())
item.setSensitive(false); item.setSensitive(false);
item = this.addAction(_("Resize"), Lang.bind(this, function(event) { item = this.addAction(_("Resize"), event => {
window.begin_grab_op(Meta.GrabOp.KEYBOARD_RESIZING_UNKNOWN, true, event.get_time()); window.begin_grab_op(Meta.GrabOp.KEYBOARD_RESIZING_UNKNOWN, true, event.get_time());
})); });
if (!window.allows_resize()) if (!window.allows_resize())
item.setSensitive(false); item.setSensitive(false);
if (!window.titlebar_is_onscreen() && type != Meta.WindowType.DOCK && type != Meta.WindowType.DESKTOP) { if (!window.titlebar_is_onscreen() && type != Meta.WindowType.DOCK && type != Meta.WindowType.DESKTOP) {
this.addAction(_("Move Titlebar Onscreen"), Lang.bind(this, function(event) { this.addAction(_("Move Titlebar Onscreen"), () => {
window.shove_titlebar_onscreen(); window.shove_titlebar_onscreen();
})); });
} }
item = this.addAction(_("Always on Top"), Lang.bind(this, function() { item = this.addAction(_("Always on Top"), () => {
if (window.is_above()) if (window.is_above())
window.unmake_above(); window.unmake_above();
else else
window.make_above(); window.make_above();
})); });
if (window.is_above()) if (window.is_above())
item.setOrnament(PopupMenu.Ornament.CHECK); item.setOrnament(PopupMenu.Ornament.CHECK);
if (window.get_maximized() == Meta.MaximizeFlags.BOTH || if (window.get_maximized() == Meta.MaximizeFlags.BOTH ||
@ -86,12 +86,12 @@ var WindowMenu = new Lang.Class({
window.is_on_primary_monitor())) { window.is_on_primary_monitor())) {
let isSticky = window.is_on_all_workspaces(); let isSticky = window.is_on_all_workspaces();
item = this.addAction(_("Always on Visible Workspace"), Lang.bind(this, function() { item = this.addAction(_("Always on Visible Workspace"), () => {
if (isSticky) if (isSticky)
window.unstick(); window.unstick();
else else
window.stick(); window.stick();
})); });
if (isSticky) if (isSticky)
item.setOrnament(PopupMenu.Ornament.CHECK); item.setOrnament(PopupMenu.Ornament.CHECK);
if (window.is_always_on_all_workspaces()) if (window.is_always_on_all_workspaces())
@ -100,24 +100,28 @@ var WindowMenu = new Lang.Class({
if (!isSticky) { if (!isSticky) {
let workspace = window.get_workspace(); let workspace = window.get_workspace();
if (workspace != workspace.get_neighbor(Meta.MotionDirection.LEFT)) { if (workspace != workspace.get_neighbor(Meta.MotionDirection.LEFT)) {
this.addAction(_("Move to Workspace Left"), Lang.bind(this, function(event) { this.addAction(_("Move to Workspace Left"), () => {
window.change_workspace(workspace.get_neighbor(Meta.MotionDirection.LEFT)); let dir = Meta.MotionDirection.LEFT;
})); window.change_workspace(workspace.get_neighbor(dir));
});
} }
if (workspace != workspace.get_neighbor(Meta.MotionDirection.RIGHT)) { if (workspace != workspace.get_neighbor(Meta.MotionDirection.RIGHT)) {
this.addAction(_("Move to Workspace Right"), Lang.bind(this, function(event) { this.addAction(_("Move to Workspace Right"), () => {
window.change_workspace(workspace.get_neighbor(Meta.MotionDirection.RIGHT)); let dir = Meta.MotionDirection.RIGHT;
})); window.change_workspace(workspace.get_neighbor(dir));
});
} }
if (workspace != workspace.get_neighbor(Meta.MotionDirection.UP)) { if (workspace != workspace.get_neighbor(Meta.MotionDirection.UP)) {
this.addAction(_("Move to Workspace Up"), Lang.bind(this, function(event) { this.addAction(_("Move to Workspace Up"), () => {
window.change_workspace(workspace.get_neighbor(Meta.MotionDirection.UP)); let dir = Meta.MotionDirection.UP;
})); window.change_workspace(workspace.get_neighbor(dir));
});
} }
if (workspace != workspace.get_neighbor(Meta.MotionDirection.DOWN)) { if (workspace != workspace.get_neighbor(Meta.MotionDirection.DOWN)) {
this.addAction(_("Move to Workspace Down"), Lang.bind(this, function(event) { this.addAction(_("Move to Workspace Down"), () => {
window.change_workspace(workspace.get_neighbor(Meta.MotionDirection.DOWN)); let dir = Meta.MotionDirection.DOWN;
})); window.change_workspace(workspace.get_neighbor(dir));
});
} }
} }
} }
@ -125,41 +129,52 @@ var WindowMenu = new Lang.Class({
let screen = global.screen; let screen = global.screen;
let nMonitors = screen.get_n_monitors(); let nMonitors = screen.get_n_monitors();
if (nMonitors > 1) { if (nMonitors > 1) {
this.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); this.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
let monitorIndex = window.get_monitor(); let monitorIndex = window.get_monitor();
let upMonitorIndex = screen.get_monitor_neighbor_index(monitorIndex, Meta.ScreenDirection.UP); let dir = Meta.ScreenDirection.UP;
if (upMonitorIndex != -1) { let upMonitorIndex =
this.addAction(_("Move to Monitor Up"), Lang.bind(this, function(event) { screen.get_monitor_neighbor_index(monitorIndex, dir);
window.move_to_monitor(upMonitorIndex); if (upMonitorIndex != -1) {
})); this.addAction(_("Move to Monitor Up"), () => {
} window.move_to_monitor(upMonitorIndex);
let downMonitorIndex = screen.get_monitor_neighbor_index(monitorIndex, Meta.ScreenDirection.DOWN); });
if (downMonitorIndex != -1) { }
this.addAction(_("Move to Monitor Down"), Lang.bind(this, function(event) {
window.move_to_monitor(downMonitorIndex); dir = Meta.ScreenDirection.DOWN;
})); let downMonitorIndex =
} screen.get_monitor_neighbor_index(monitorIndex, dir);
let leftMonitorIndex = screen.get_monitor_neighbor_index(monitorIndex, Meta.ScreenDirection.LEFT); if (downMonitorIndex != -1) {
if (leftMonitorIndex != -1) { this.addAction(_("Move to Monitor Down"), () => {
this.addAction(_("Move to Monitor Left"), Lang.bind(this, function(event) { window.move_to_monitor(downMonitorIndex);
window.move_to_monitor(leftMonitorIndex); });
})); }
}
let rightMonitorIndex = screen.get_monitor_neighbor_index(monitorIndex, Meta.ScreenDirection.RIGHT); dir = Meta.ScreenDirection.LEFT;
if (rightMonitorIndex != -1) { let leftMonitorIndex =
this.addAction(_("Move to Monitor Right"), Lang.bind(this, function(event) { screen.get_monitor_neighbor_index(monitorIndex, dir);
window.move_to_monitor(rightMonitorIndex); if (leftMonitorIndex != -1) {
})); this.addAction(_("Move to Monitor Left"), () => {
} window.move_to_monitor(leftMonitorIndex);
});
}
dir = Meta.ScreenDirection.RIGHT;
let rightMonitorIndex =
screen.get_monitor_neighbor_index(monitorIndex, dir);
if (rightMonitorIndex != -1) {
this.addAction(_("Move to Monitor Right"), () => {
window.move_to_monitor(rightMonitorIndex);
});
}
} }
this.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); this.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
item = this.addAction(_("Close"), Lang.bind(this, function(event) { item = this.addAction(_("Close"), event => {
window.delete(event.get_time()); window.delete(event.get_time());
})); });
if (!window.can_close()) if (!window.can_close())
item.setSensitive(false); item.setSensitive(false);
} }
@ -191,10 +206,9 @@ var WindowMenuManager = new Lang.Class({
this._manager = new PopupMenu.PopupMenuManager({ actor: Main.layoutManager.dummyCursor }); this._manager = new PopupMenu.PopupMenuManager({ actor: Main.layoutManager.dummyCursor });
this._sourceActor = new St.Widget({ reactive: true, visible: false }); this._sourceActor = new St.Widget({ reactive: true, visible: false });
this._sourceActor.connect('button-press-event', Lang.bind(this, this._sourceActor.connect('button-press-event', () => {
function() { this._manager.activeMenu.toggle();
this._manager.activeMenu.toggle(); });
}));
Main.uiGroup.add_actor(this._sourceActor); Main.uiGroup.add_actor(this._sourceActor);
}, },
@ -204,13 +218,12 @@ var WindowMenuManager = new Lang.Class({
this._manager.addMenu(menu); this._manager.addMenu(menu);
menu.connect('activate', function() { menu.connect('activate', () => {
window.check_alive(global.get_current_time()); window.check_alive(global.get_current_time());
}); });
let destroyId = window.connect('unmanaged', let destroyId = window.connect('unmanaged', () => {
function() { menu.close();
menu.close(); });
});
this._sourceActor.set_size(Math.max(1, rect.width), Math.max(1, rect.height)); this._sourceActor.set_size(Math.max(1, rect.width), Math.max(1, rect.height));
this._sourceActor.set_position(rect.x, rect.y); this._sourceActor.set_position(rect.x, rect.y);
@ -218,13 +231,13 @@ var WindowMenuManager = new Lang.Class({
menu.open(BoxPointer.PopupAnimation.NONE); menu.open(BoxPointer.PopupAnimation.NONE);
menu.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false); menu.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
menu.connect('open-state-changed', Lang.bind(this, function(menu_, isOpen) { menu.connect('open-state-changed', (menu_, isOpen) => {
if (isOpen) if (isOpen)
return; return;
this._sourceActor.hide(); this._sourceActor.hide();
menu.destroy(); menu.destroy();
window.disconnect(destroyId); window.disconnect(destroyId);
})); });
} }
}); });

View File

@ -89,7 +89,7 @@ var WindowCloneLayout = new Lang.Class({
}, },
vfunc_allocate(container, box, flags) { vfunc_allocate(container, box, flags) {
container.get_children().forEach(Lang.bind(this, function (child) { container.get_children().forEach(child => {
let realWindow; let realWindow;
if (child == container._delegate._windowClone) if (child == container._delegate._windowClone)
realWindow = container._delegate.realWindow; realWindow = container._delegate.realWindow;
@ -98,7 +98,7 @@ var WindowCloneLayout = new Lang.Class({
child.allocate(this._makeBoxForWindow(realWindow.meta_window), child.allocate(this._makeBoxForWindow(realWindow.meta_window),
flags); flags);
})); });
} }
}); });
@ -139,12 +139,14 @@ var WindowClone = new Lang.Class({
this._windowClone._updateId = this.metaWindow.connect('size-changed', this._windowClone._updateId = this.metaWindow.connect('size-changed',
Lang.bind(this, this._onRealWindowSizeChanged)); Lang.bind(this, this._onRealWindowSizeChanged));
this._windowClone._destroyId = this.realWindow.connect('destroy', Lang.bind(this, function() { this._windowClone._destroyId =
// First destroy the clone and then destroy everything this.realWindow.connect('destroy', () => {
// This will ensure that we never see it in the _disconnectSignals loop // First destroy the clone and then destroy everything
this._windowClone.destroy(); // This will ensure that we never see it in the
this.destroy(); // _disconnectSignals loop
})); this._windowClone.destroy();
this.destroy();
});
this._updateAttachedDialogs(); this._updateAttachedDialogs();
this._computeBoundingBox(); this._computeBoundingBox();
@ -214,21 +216,21 @@ var WindowClone = new Lang.Class({
_doAddAttachedDialog(metaWin, realWin) { _doAddAttachedDialog(metaWin, realWin) {
let clone = new Clutter.Clone({ source: realWin }); let clone = new Clutter.Clone({ source: realWin });
clone._updateId = metaWin.connect('size-changed', Lang.bind(this, function() { clone._updateId = metaWin.connect('size-changed', () => {
this._computeBoundingBox(); this._computeBoundingBox();
this.emit('size-changed'); this.emit('size-changed');
})); });
clone._destroyId = realWin.connect('destroy', Lang.bind(this, function() { clone._destroyId = realWin.connect('destroy', () => {
clone.destroy(); clone.destroy();
this._computeBoundingBox(); this._computeBoundingBox();
this.emit('size-changed'); this.emit('size-changed');
})); });
this.actor.add_child(clone); this.actor.add_child(clone);
}, },
_updateAttachedDialogs() { _updateAttachedDialogs() {
let iter = Lang.bind(this, function(win) { let iter = win => {
let actor = win.get_compositor_private(); let actor = win.get_compositor_private();
if (!actor) if (!actor)
@ -239,7 +241,7 @@ var WindowClone = new Lang.Class({
this._doAddAttachedDialog(win, actor); this._doAddAttachedDialog(win, actor);
win.foreach_transient(iter); win.foreach_transient(iter);
return true; return true;
}); };
this.metaWindow.foreach_transient(iter); this.metaWindow.foreach_transient(iter);
}, },
@ -262,7 +264,7 @@ var WindowClone = new Lang.Class({
_computeBoundingBox() { _computeBoundingBox() {
let rect = this.metaWindow.get_frame_rect(); let rect = this.metaWindow.get_frame_rect();
this.actor.get_children().forEach(function (child) { this.actor.get_children().forEach(child => {
let realWindow; let realWindow;
if (child == this._windowClone) if (child == this._windowClone)
realWindow = this.realWindow; realWindow = this.realWindow;
@ -271,7 +273,7 @@ var WindowClone = new Lang.Class({
let metaWindow = realWindow.meta_window; let metaWindow = realWindow.meta_window;
rect = rect.union(metaWindow.get_frame_rect()); rect = rect.union(metaWindow.get_frame_rect());
}, this); });
// Convert from a MetaRectangle to a native JS object // Convert from a MetaRectangle to a native JS object
this._boundingBox = { x: rect.x, y: rect.y, width: rect.width, height: rect.height }; this._boundingBox = { x: rect.x, y: rect.y, width: rect.width, height: rect.height };
@ -312,7 +314,7 @@ var WindowClone = new Lang.Class({
}, },
_disconnectSignals() { _disconnectSignals() {
this.actor.get_children().forEach(Lang.bind(this, function (child) { this.actor.get_children().forEach(child => {
let realWindow; let realWindow;
if (child == this._windowClone) if (child == this._windowClone)
realWindow = this.realWindow; realWindow = this.realWindow;
@ -321,7 +323,7 @@ var WindowClone = new Lang.Class({
realWindow.meta_window.disconnect(child._updateId); realWindow.meta_window.disconnect(child._updateId);
realWindow.disconnect(child._destroyId); realWindow.disconnect(child._destroyId);
})); });
}, },
_onRealWindowSizeChanged() { _onRealWindowSizeChanged() {
@ -373,14 +375,13 @@ var WindowClone = new Lang.Class({
// A click cancels a long-press before any click handler is // A click cancels a long-press before any click handler is
// run - make sure to not start a drag in that case // run - make sure to not start a drag in that case
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
function() { if (this._selected)
if (this._selected) return;
return; let [x, y] = action.get_coords();
let [x, y] = action.get_coords(); action.release();
action.release(); this._draggable.startDrag(x, y, global.get_current_time(), this._dragTouchSequence);
this._draggable.startDrag(x, y, global.get_current_time(), this._dragTouchSequence); });
}));
} else { } else {
this.emit('show-chrome'); this.emit('show-chrome');
} }
@ -450,11 +451,10 @@ var WindowOverlay = new Lang.Class({
title.clutter_text.ellipsize = Pango.EllipsizeMode.END; title.clutter_text.ellipsize = Pango.EllipsizeMode.END;
windowClone.actor.label_actor = title; windowClone.actor.label_actor = title;
this._updateCaptionId = metaWindow.connect('notify::title', this._updateCaptionId = metaWindow.connect('notify::title', w => {
Lang.bind(this, function(w) { this.title.text = w.title;
this.title.text = w.title; this.relayout(false);
this.relayout(false); });
}));
let button = new St.Button({ style_class: 'window-close' }); let button = new St.Button({ style_class: 'window-close' });
button._overlap = 0; button._overlap = 0;
@ -603,11 +603,10 @@ var WindowOverlay = new Lang.Class({
// use an idle handler to avoid mapping problems - // use an idle handler to avoid mapping problems -
// see comment in Workspace._windowAdded // see comment in Workspace._windowAdded
let id = Mainloop.idle_add(Lang.bind(this, let id = Mainloop.idle_add(() => {
function() { this._windowClone.emit('selected');
this._windowClone.emit('selected'); return GLib.SOURCE_REMOVE;
return GLib.SOURCE_REMOVE; });
}));
GLib.Source.set_name_by_id(id, '[gnome-shell] this._windowClone.emit'); GLib.Source.set_name_by_id(id, '[gnome-shell] this._windowClone.emit');
} }
}, },
@ -990,9 +989,7 @@ var UnalignedLayoutStrategy = new Lang.Class({
_sortRow(row) { _sortRow(row) {
// Sort windows horizontally to minimize travel distance // Sort windows horizontally to minimize travel distance
row.windows.sort(function(a, b) { row.windows.sort((a, b) => a.realWindow.x - b.realWindow.x);
return a.realWindow.x - b.realWindow.x;
});
}, },
computeLayout(windows, layout) { computeLayout(windows, layout) {
@ -1161,10 +1158,10 @@ var Workspace = new Lang.Class({
this._positionWindowsFlags = 0; this._positionWindowsFlags = 0;
this._positionWindowsId = 0; this._positionWindowsId = 0;
this.actor.connect('notify::mapped', Lang.bind(this, function() { this.actor.connect('notify::mapped', () => {
if (this.actor.mapped) if (this.actor.mapped)
this._syncActualGeometry(); this._syncActualGeometry();
})); });
}, },
setFullGeometry(geom) { setFullGeometry(geom) {
@ -1194,7 +1191,7 @@ var Workspace = new Lang.Class({
if (!this._actualGeometry) if (!this._actualGeometry)
return; return;
this._actualGeometryLater = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() { this._actualGeometryLater = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
this._actualGeometryLater = 0; this._actualGeometryLater = 0;
if (!this.actor.mapped) if (!this.actor.mapped)
return false; return false;
@ -1206,7 +1203,7 @@ var Workspace = new Lang.Class({
this._updateWindowPositions(Main.overview.animationInProgress ? WindowPositionFlags.ANIMATE : WindowPositionFlags.NONE); this._updateWindowPositions(Main.overview.animationInProgress ? WindowPositionFlags.ANIMATE : WindowPositionFlags.NONE);
return false; return false;
})); });
}, },
_lookupIndex(metaWindow) { _lookupIndex(metaWindow) {
@ -1247,12 +1244,12 @@ var Workspace = new Lang.Class({
if (this._positionWindowsId > 0) if (this._positionWindowsId > 0)
return; return;
this._positionWindowsId = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() { this._positionWindowsId = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
this._realRecalculateWindowPositions(this._positionWindowsFlags); this._realRecalculateWindowPositions(this._positionWindowsFlags);
this._positionWindowsFlags = 0; this._positionWindowsFlags = 0;
this._positionWindowsId = 0; this._positionWindowsId = 0;
return false; return false;
})); });
}, },
_realRecalculateWindowPositions(flags) { _realRecalculateWindowPositions(flags) {
@ -1265,7 +1262,7 @@ var Workspace = new Lang.Class({
if (clones.length == 0) if (clones.length == 0)
return; return;
clones.sort(function(a, b) { clones.sort((a, b) => {
return a.metaWindow.get_stable_sequence() - b.metaWindow.get_stable_sequence(); return a.metaWindow.get_stable_sequence() - b.metaWindow.get_stable_sequence();
}); });
@ -1366,7 +1363,11 @@ var Workspace = new Lang.Class({
syncStacking(stackIndices) { syncStacking(stackIndices) {
let clones = this._windows.slice(); let clones = this._windows.slice();
clones.sort(function (a, b) { return stackIndices[a.metaWindow.get_stable_sequence()] - stackIndices[b.metaWindow.get_stable_sequence()]; }); clones.sort((a, b) => {
let indexA = stackIndices[a.metaWindow.get_stable_sequence()];
let indexB = stackIndices[b.metaWindow.get_stable_sequence()];
return indexA - indexB;
});
for (let i = 0; i < clones.length; i++) { for (let i = 0; i < clones.length; i++) {
let clone = clones[i]; let clone = clones[i];
@ -1388,9 +1389,9 @@ var Workspace = new Lang.Class({
scale_y: scale, scale_y: scale,
time: Overview.ANIMATION_TIME, time: Overview.ANIMATION_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete: Lang.bind(this, function() { onComplete: () => {
this._showWindowOverlay(clone, overlay); this._showWindowOverlay(clone, overlay);
}) }
}); });
clone.overlay.relayout(true); clone.overlay.relayout(true);
@ -1492,14 +1493,13 @@ var Workspace = new Lang.Class({
if (!win) { if (!win) {
// Newly-created windows are added to a workspace before // Newly-created windows are added to a workspace before
// the compositor finds out about them... // the compositor finds out about them...
let id = Mainloop.idle_add(Lang.bind(this, let id = Mainloop.idle_add(() => {
function () { if (this.actor &&
if (this.actor && metaWin.get_compositor_private() &&
metaWin.get_compositor_private() && metaWin.get_workspace() == this.metaWorkspace)
metaWin.get_workspace() == this.metaWorkspace) this._doAddWindow(metaWin);
this._doAddWindow(metaWin); return GLib.SOURCE_REMOVE;
return GLib.SOURCE_REMOVE; });
}));
GLib.Source.set_name_by_id(id, '[gnome-shell] this._doAddWindow'); GLib.Source.set_name_by_id(id, '[gnome-shell] this._doAddWindow');
return; return;
} }
@ -1839,24 +1839,20 @@ var Workspace = new Lang.Class({
clone.connect('selected', clone.connect('selected',
Lang.bind(this, this._onCloneSelected)); Lang.bind(this, this._onCloneSelected));
clone.connect('drag-begin', clone.connect('drag-begin', () => {
Lang.bind(this, function() { Main.overview.beginWindowDrag(clone.metaWindow);
Main.overview.beginWindowDrag(clone.metaWindow); overlay.hide();
overlay.hide(); });
})); clone.connect('drag-cancelled', () => {
clone.connect('drag-cancelled', Main.overview.cancelledWindowDrag(clone.metaWindow);
Lang.bind(this, function() { });
Main.overview.cancelledWindowDrag(clone.metaWindow); clone.connect('drag-end', () => {
})); Main.overview.endWindowDrag(clone.metaWindow);
clone.connect('drag-end', overlay.show();
Lang.bind(this, function() { });
Main.overview.endWindowDrag(clone.metaWindow); clone.connect('size-changed', () => {
overlay.show(); this._recalculateWindowPositions(WindowPositionFlags.NONE);
})); });
clone.connect('size-changed',
Lang.bind(this, function() {
this._recalculateWindowPositions(WindowPositionFlags.NONE);
}));
this.actor.add_actor(clone.actor); this.actor.add_actor(clone.actor);

View File

@ -32,9 +32,9 @@ var WorkspaceSwitcherPopup = new Lang.Class({
this._childHeight = 0; this._childHeight = 0;
this._childWidth = 0; this._childWidth = 0;
this._timeoutId = 0; this._timeoutId = 0;
this._list.connect('style-changed', Lang.bind(this, function() { this._list.connect('style-changed', () => {
this._itemSpacing = this._list.get_theme_node().get_length('spacing'); this._itemSpacing = this._list.get_theme_node().get_length('spacing');
})); });
this._list.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth)); this._list.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
this._list.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight)); this._list.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));

View File

@ -70,12 +70,12 @@ var WindowClone = new Lang.Class({
this.clone._updateId = this.metaWindow.connect('position-changed', this.clone._updateId = this.metaWindow.connect('position-changed',
Lang.bind(this, this._onPositionChanged)); Lang.bind(this, this._onPositionChanged));
this.clone._destroyId = this.realWindow.connect('destroy', Lang.bind(this, function() { this.clone._destroyId = this.realWindow.connect('destroy', () => {
// First destroy the clone and then destroy everything // First destroy the clone and then destroy everything
// This will ensure that we never see it in the _disconnectSignals loop // This will ensure that we never see it in the _disconnectSignals loop
this.clone.destroy(); this.clone.destroy();
this.destroy(); this.destroy();
})); });
this._onPositionChanged(); this._onPositionChanged();
this.actor.connect('button-release-event', this.actor.connect('button-release-event',
@ -94,7 +94,7 @@ var WindowClone = new Lang.Class({
this._draggable.connect('drag-end', Lang.bind(this, this._onDragEnd)); this._draggable.connect('drag-end', Lang.bind(this, this._onDragEnd));
this.inDrag = false; this.inDrag = false;
let iter = Lang.bind(this, function(win) { let iter = win => {
let actor = win.get_compositor_private(); let actor = win.get_compositor_private();
if (!actor) if (!actor)
@ -106,7 +106,7 @@ var WindowClone = new Lang.Class({
win.foreach_transient(iter); win.foreach_transient(iter);
return true; return true;
}); };
this.metaWindow.foreach_transient(iter); this.metaWindow.foreach_transient(iter);
}, },
@ -155,9 +155,9 @@ var WindowClone = new Lang.Class({
clone._updateId = metaDialog.connect('position-changed', clone._updateId = metaDialog.connect('position-changed',
Lang.bind(this, this._updateDialogPosition, clone)); Lang.bind(this, this._updateDialogPosition, clone));
clone._destroyId = realDialog.connect('destroy', Lang.bind(this, function() { clone._destroyId = realDialog.connect('destroy', () => {
clone.destroy(); clone.destroy();
})); });
this.actor.add_child(clone); this.actor.add_child(clone);
}, },
@ -175,7 +175,7 @@ var WindowClone = new Lang.Class({
}, },
_disconnectSignals() { _disconnectSignals() {
this.actor.get_children().forEach(function(child) { this.actor.get_children().forEach(child => {
let realWindow = child.source; let realWindow = child.source;
realWindow.meta_window.disconnect(child._updateId); realWindow.meta_window.disconnect(child._updateId);
@ -277,10 +277,10 @@ var WorkspaceThumbnail = new Lang.Class({
let monitor = Main.layoutManager.primaryMonitor; let monitor = Main.layoutManager.primaryMonitor;
this.setPorthole(monitor.x, monitor.y, monitor.width, monitor.height); this.setPorthole(monitor.x, monitor.y, monitor.width, monitor.height);
let windows = global.get_window_actors().filter(Lang.bind(this, function(actor) { let windows = global.get_window_actors().filter(actor => {
let win = actor.meta_window; let win = actor.meta_window;
return win.located_on_workspace(metaWorkspace); return win.located_on_workspace(metaWorkspace);
})); });
// Create clones for windows that should be visible in the Overview // Create clones for windows that should be visible in the Overview
this._windows = []; this._windows = [];
@ -337,7 +337,11 @@ var WorkspaceThumbnail = new Lang.Class({
}, },
syncStacking(stackIndices) { syncStacking(stackIndices) {
this._windows.sort(function (a, b) { return stackIndices[a.metaWindow.get_stable_sequence()] - stackIndices[b.metaWindow.get_stable_sequence()]; }); this._windows.sort((a, b) => {
let indexA = stackIndices[a.metaWindow.get_stable_sequence()];
let indexB = stackIndices[b.metaWindow.get_stable_sequence()];
return indexA - indexB;
});
for (let i = 0; i < this._windows.length; i++) { for (let i = 0; i < this._windows.length; i++) {
let clone = this._windows[i]; let clone = this._windows[i];
@ -393,14 +397,13 @@ var WorkspaceThumbnail = new Lang.Class({
if (!win) { if (!win) {
// Newly-created windows are added to a workspace before // Newly-created windows are added to a workspace before
// the compositor finds out about them... // the compositor finds out about them...
let id = Mainloop.idle_add(Lang.bind(this, let id = Mainloop.idle_add(() => {
function () { if (!this._removed &&
if (!this._removed && metaWin.get_compositor_private() &&
metaWin.get_compositor_private() && metaWin.get_workspace() == this.metaWorkspace)
metaWin.get_workspace() == this.metaWorkspace) this._doAddWindow(metaWin);
this._doAddWindow(metaWin); return GLib.SOURCE_REMOVE;
return GLib.SOURCE_REMOVE; });
}));
GLib.Source.set_name_by_id(id, '[gnome-shell] this._doAddWindow'); GLib.Source.set_name_by_id(id, '[gnome-shell] this._doAddWindow');
return; return;
} }
@ -523,22 +526,18 @@ var WorkspaceThumbnail = new Lang.Class({
_addWindowClone(win) { _addWindowClone(win) {
let clone = new WindowClone(win); let clone = new WindowClone(win);
clone.connect('selected', clone.connect('selected', (clone, time) => {
Lang.bind(this, function(clone, time) { this.activate(time);
this.activate(time); });
})); clone.connect('drag-begin', () => {
clone.connect('drag-begin', Main.overview.beginWindowDrag(clone.metaWindow);
Lang.bind(this, function() { });
Main.overview.beginWindowDrag(clone.metaWindow); clone.connect('drag-cancelled', () => {
})); Main.overview.cancelledWindowDrag(clone.metaWindow);
clone.connect('drag-cancelled', });
Lang.bind(this, function() { clone.connect('drag-end', () => {
Main.overview.cancelledWindowDrag(clone.metaWindow); Main.overview.endWindowDrag(clone.metaWindow);
})); });
clone.connect('drag-end',
Lang.bind(this, function() {
Main.overview.endWindowDrag(clone.metaWindow);
}));
this._contents.add_actor(clone.actor); this._contents.add_actor(clone.actor);
if (this._windows.length == 0) if (this._windows.length == 0)
@ -651,7 +650,7 @@ var ThumbnailsBox = new Lang.Class({
this._thumbnails = []; this._thumbnails = [];
this.actor.connect('button-press-event', function() { return Clutter.EVENT_STOP; }); this.actor.connect('button-press-event', () => Clutter.EVENT_STOP);
this.actor.connect('button-release-event', Lang.bind(this, this._onButtonRelease)); this.actor.connect('button-release-event', Lang.bind(this, this._onButtonRelease));
this.actor.connect('touch-event', Lang.bind(this, this._onTouchEvent)); this.actor.connect('touch-event', Lang.bind(this, this._onTouchEvent));
@ -677,11 +676,11 @@ var ThumbnailsBox = new Lang.Class({
this._settings.connect('changed::dynamic-workspaces', this._settings.connect('changed::dynamic-workspaces',
Lang.bind(this, this._updateSwitcherVisibility)); Lang.bind(this, this._updateSwitcherVisibility));
Main.layoutManager.connect('monitors-changed', Lang.bind(this, function() { Main.layoutManager.connect('monitors-changed', () => {
this._destroyThumbnails(); this._destroyThumbnails();
if (Main.overview.visible) if (Main.overview.visible)
this._createThumbnails(); this._createThumbnails();
})); });
}, },
_updateSwitcherVisibility() { _updateSwitcherVisibility() {
@ -910,9 +909,8 @@ var ThumbnailsBox = new Lang.Class({
}, },
_workspacesChanged() { _workspacesChanged() {
let validThumbnails = this._thumbnails.filter(function(t) { let validThumbnails =
return t.state <= ThumbnailState.NORMAL; this._thumbnails.filter(t => t.state <= ThumbnailState.NORMAL);
});
let oldNumWorkspaces = validThumbnails.length; let oldNumWorkspaces = validThumbnails.length;
let newNumWorkspaces = global.screen.n_workspaces; let newNumWorkspaces = global.screen.n_workspaces;
let active = global.screen.get_active_workspace_index(); let active = global.screen.get_active_workspace_index();
@ -1043,48 +1041,44 @@ var ThumbnailsBox = new Lang.Class({
return; return;
// Then slide out any thumbnails that have been destroyed // Then slide out any thumbnails that have been destroyed
this._iterateStateThumbnails(ThumbnailState.REMOVING, this._iterateStateThumbnails(ThumbnailState.REMOVING, thumbnail => {
function(thumbnail) { this._setThumbnailState(thumbnail, ThumbnailState.ANIMATING_OUT);
this._setThumbnailState(thumbnail, ThumbnailState.ANIMATING_OUT);
Tweener.addTween(thumbnail, Tweener.addTween(thumbnail,
{ slidePosition: 1, { slidePosition: 1,
time: SLIDE_ANIMATION_TIME, time: SLIDE_ANIMATION_TIME,
transition: 'linear', transition: 'linear',
onComplete() { onComplete: () => {
this._setThumbnailState(thumbnail, ThumbnailState.ANIMATED_OUT); this._setThumbnailState(thumbnail, ThumbnailState.ANIMATED_OUT);
this._queueUpdateStates(); this._queueUpdateStates();
}, }
onCompleteScope: this });
}); });
});
// As long as things are sliding out, don't proceed // As long as things are sliding out, don't proceed
if (this._stateCounts[ThumbnailState.ANIMATING_OUT] > 0) if (this._stateCounts[ThumbnailState.ANIMATING_OUT] > 0)
return; return;
// Once that's complete, we can start scaling to the new size and collapse any removed thumbnails // Once that's complete, we can start scaling to the new size and collapse any removed thumbnails
this._iterateStateThumbnails(ThumbnailState.ANIMATED_OUT, this._iterateStateThumbnails(ThumbnailState.ANIMATED_OUT, thumbnail => {
function(thumbnail) { this.actor.set_skip_paint(thumbnail.actor, true);
this.actor.set_skip_paint(thumbnail.actor, true); this._setThumbnailState(thumbnail, ThumbnailState.COLLAPSING);
this._setThumbnailState(thumbnail, ThumbnailState.COLLAPSING); Tweener.addTween(thumbnail,
Tweener.addTween(thumbnail, { collapseFraction: 1,
{ collapseFraction: 1, time: RESCALE_ANIMATION_TIME,
time: RESCALE_ANIMATION_TIME, transition: 'easeOutQuad',
transition: 'easeOutQuad', onComplete: () => {
onComplete() { this._stateCounts[thumbnail.state]--;
this._stateCounts[thumbnail.state]--; thumbnail.state = ThumbnailState.DESTROYED;
thumbnail.state = ThumbnailState.DESTROYED;
let index = this._thumbnails.indexOf(thumbnail); let index = this._thumbnails.indexOf(thumbnail);
this._thumbnails.splice(index, 1); this._thumbnails.splice(index, 1);
thumbnail.destroy(); thumbnail.destroy();
this._queueUpdateStates(); this._queueUpdateStates();
}, }
onCompleteScope: this });
}); });
});
if (this._pendingScaleUpdate) { if (this._pendingScaleUpdate) {
this._tweenScale(); this._tweenScale();
@ -1096,19 +1090,17 @@ var ThumbnailsBox = new Lang.Class({
return; return;
// And then slide in any new thumbnails // And then slide in any new thumbnails
this._iterateStateThumbnails(ThumbnailState.NEW, this._iterateStateThumbnails(ThumbnailState.NEW, thumbnail => {
function(thumbnail) { this._setThumbnailState(thumbnail, ThumbnailState.ANIMATING_IN);
this._setThumbnailState(thumbnail, ThumbnailState.ANIMATING_IN); Tweener.addTween(thumbnail,
Tweener.addTween(thumbnail, { slidePosition: 0,
{ slidePosition: 0, time: SLIDE_ANIMATION_TIME,
time: SLIDE_ANIMATION_TIME, transition: 'easeOutQuad',
transition: 'easeOutQuad', onComplete: () => {
onComplete() { this._setThumbnailState(thumbnail, ThumbnailState.NORMAL);
this._setThumbnailState(thumbnail, ThumbnailState.NORMAL); }
}, });
onCompleteScope: this });
});
});
}, },
_queueUpdateStates() { _queueUpdateStates() {
@ -1235,9 +1227,9 @@ var ThumbnailsBox = new Lang.Class({
let y = box.y1; let y = box.y1;
if (this._dropPlaceholderPos == -1) { if (this._dropPlaceholderPos == -1) {
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() { Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
this._dropPlaceholder.hide(); this._dropPlaceholder.hide();
})); });
} }
let childBox = new Clutter.ActorBox(); let childBox = new Clutter.ActorBox();
@ -1264,9 +1256,9 @@ var ThumbnailsBox = new Lang.Class({
childBox.y1 = Math.round(y); childBox.y1 = Math.round(y);
childBox.y2 = Math.round(y + placeholderHeight); childBox.y2 = Math.round(y + placeholderHeight);
this._dropPlaceholder.allocate(childBox, flags); this._dropPlaceholder.allocate(childBox, flags);
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() { Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
this._dropPlaceholder.show(); this._dropPlaceholder.show();
})); });
y += placeholderHeight + spacing; y += placeholderHeight + spacing;
} }

View File

@ -112,11 +112,10 @@ var WorkspacesView = new Lang.Class({
this._updateWorkspacesId = global.screen.connect('notify::n-workspaces', Lang.bind(this, this._updateWorkspaces)); this._updateWorkspacesId = global.screen.connect('notify::n-workspaces', Lang.bind(this, this._updateWorkspaces));
this._overviewShownId = this._overviewShownId =
Main.overview.connect('shown', Main.overview.connect('shown', () => {
Lang.bind(this, function() {
this.actor.set_clip(this._fullGeometry.x, this._fullGeometry.y, this.actor.set_clip(this._fullGeometry.x, this._fullGeometry.y,
this._fullGeometry.width, this._fullGeometry.height); this._fullGeometry.width, this._fullGeometry.height);
})); });
this._switchWorkspaceNotifyId = this._switchWorkspaceNotifyId =
global.window_manager.connect('switch-workspace', global.window_manager.connect('switch-workspace',
@ -200,11 +199,10 @@ var WorkspacesView = new Lang.Class({
// matter which tween we use, so we pick the first one ... // matter which tween we use, so we pick the first one ...
if (w == 0) { if (w == 0) {
this._updateVisibility(); this._updateVisibility();
params.onComplete = Lang.bind(this, params.onComplete = () => {
function() { this._animating = false;
this._animating = false; this._updateVisibility();
this._updateVisibility(); };
});
} }
Tweener.addTween(workspace.actor, params); Tweener.addTween(workspace.actor, params);
} else { } else {
@ -241,10 +239,9 @@ var WorkspacesView = new Lang.Class({
value: index, value: index,
time: WORKSPACE_SWITCH_TIME, time: WORKSPACE_SWITCH_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete: Lang.bind(this, onComplete: () => {
function() { this._animatingScroll = false;
this._animatingScroll = false; }
})
}); });
}, },
@ -421,7 +418,7 @@ var WorkspacesDisplay = new Lang.Class({
this.actor.connect('parent-set', Lang.bind(this, this._parentSet)); this.actor.connect('parent-set', Lang.bind(this, this._parentSet));
let clickAction = new Clutter.ClickAction(); let clickAction = new Clutter.ClickAction();
clickAction.connect('clicked', Lang.bind(this, function(action) { clickAction.connect('clicked', action => {
// Only switch to the workspace when there's no application // Only switch to the workspace when there's no application
// windows open. The problem is that it's too easy to miss // windows open. The problem is that it's too easy to miss
// an app window and get the wrong one focused. // an app window and get the wrong one focused.
@ -430,13 +427,13 @@ var WorkspacesDisplay = new Lang.Class({
if ((action.get_button() == 1 || action.get_button() == 0) && if ((action.get_button() == 1 || action.get_button() == 0) &&
this._workspacesViews[index].getActiveWorkspace().isEmpty()) this._workspacesViews[index].getActiveWorkspace().isEmpty())
Main.overview.hide(); Main.overview.hide();
})); });
Main.overview.addAction(clickAction); Main.overview.addAction(clickAction);
this.actor.bind_property('mapped', clickAction, 'enabled', GObject.BindingFlags.SYNC_CREATE); this.actor.bind_property('mapped', clickAction, 'enabled', GObject.BindingFlags.SYNC_CREATE);
let panAction = new Clutter.PanAction({ threshold_trigger_edge: Clutter.GestureTriggerEdge.AFTER }); let panAction = new Clutter.PanAction({ threshold_trigger_edge: Clutter.GestureTriggerEdge.AFTER });
panAction.connect('pan', Lang.bind(this, this._onPan)); panAction.connect('pan', Lang.bind(this, this._onPan));
panAction.connect('gesture-begin', Lang.bind(this, function() { panAction.connect('gesture-begin', () => {
if (this._workspacesOnlyOnPrimary) { if (this._workspacesOnlyOnPrimary) {
let event = Clutter.get_current_event(); let event = Clutter.get_current_event();
if (this._getMonitorIndexForEvent(event) != this._primaryIndex) if (this._getMonitorIndexForEvent(event) != this._primaryIndex)
@ -446,17 +443,17 @@ var WorkspacesDisplay = new Lang.Class({
for (let i = 0; i < this._workspacesViews.length; i++) for (let i = 0; i < this._workspacesViews.length; i++)
this._workspacesViews[i].startSwipeScroll(); this._workspacesViews[i].startSwipeScroll();
return true; return true;
})); });
panAction.connect('gesture-cancel', Lang.bind(this, function() { panAction.connect('gesture-cancel', () => {
clickAction.release(); clickAction.release();
for (let i = 0; i < this._workspacesViews.length; i++) for (let i = 0; i < this._workspacesViews.length; i++)
this._workspacesViews[i].endSwipeScroll(); this._workspacesViews[i].endSwipeScroll();
})); });
panAction.connect('gesture-end', Lang.bind(this, function() { panAction.connect('gesture-end', () => {
clickAction.release(); clickAction.release();
for (let i = 0; i < this._workspacesViews.length; i++) for (let i = 0; i < this._workspacesViews.length; i++)
this._workspacesViews[i].endSwipeScroll(); this._workspacesViews[i].endSwipeScroll();
})); });
Main.overview.addAction(panAction); Main.overview.addAction(panAction);
this.actor.bind_property('mapped', panAction, 'enabled', GObject.BindingFlags.SYNC_CREATE); this.actor.bind_property('mapped', panAction, 'enabled', GObject.BindingFlags.SYNC_CREATE);
@ -615,25 +612,23 @@ var WorkspacesDisplay = new Lang.Class({
oldParent.disconnect(this._notifyOpacityId); oldParent.disconnect(this._notifyOpacityId);
this._notifyOpacityId = 0; this._notifyOpacityId = 0;
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
function() { let newParent = this.actor.get_parent();
let newParent = this.actor.get_parent(); if (!newParent)
if (!newParent) return;
return;
// This is kinda hackish - we want the primary view to // This is kinda hackish - we want the primary view to
// appear as parent of this.actor, though in reality it // appear as parent of this.actor, though in reality it
// is added directly to Main.layoutManager.overviewGroup // is added directly to Main.layoutManager.overviewGroup
this._notifyOpacityId = newParent.connect('notify::opacity', this._notifyOpacityId = newParent.connect('notify::opacity', () => {
Lang.bind(this, function() { let opacity = this.actor.get_parent().opacity;
let opacity = this.actor.get_parent().opacity; let primaryView = this._getPrimaryView();
let primaryView = this._getPrimaryView(); if (!primaryView)
if (!primaryView) return;
return; primaryView.actor.opacity = opacity;
primaryView.actor.opacity = opacity; primaryView.actor.visible = opacity != 0;
primaryView.actor.visible = opacity != 0; });
})); });
}));
}, },
// This geometry should always be the fullest geometry // This geometry should always be the fullest geometry

View File

@ -35,7 +35,7 @@ function test() {
if (useCairo) if (useCairo)
obin.style = 'border: 3px solid green;'; obin.style = 'border: 3px solid green;';
else else
obin.connect_after('paint', function(actor) { obin.connect_after('paint', actor => {
Cogl.set_source_color4f(0, 1, 0, 1); Cogl.set_source_color4f(0, 1, 0, 1);
let geom = actor.get_allocation_geometry(); let geom = actor.get_allocation_geometry();

View File

@ -62,14 +62,14 @@ function test() {
resize_animated(label1); resize_animated(label1);
resize_animated(label2); resize_animated(label2);
Mainloop.timeout_add(DELAY, Lang.bind(this, function() { Mainloop.timeout_add(DELAY, () => {
log(label1 + label1.get_size()); log(label1 + label1.get_size());
resize_animated(label1); resize_animated(label1);
resize_animated(label2); resize_animated(label2);
return true; return true;
})); });
Mainloop.timeout_add(2 * DELAY, Lang.bind(this, function() { Mainloop.timeout_add(2 * DELAY, () => {
iter += 1; iter += 1;
iter %= shadowStyles.length; iter %= shadowStyles.length;
label1.set_style(get_css_style(shadowStyles[iter])); label1.set_style(get_css_style(shadowStyles[iter]));
@ -77,7 +77,7 @@ function test() {
label2.set_style(get_css_style(shadowStyles[iter])); label2.set_style(get_css_style(shadowStyles[iter]));
label2.set_text(shadowStyles[iter]); label2.set_text(shadowStyles[iter]);
return true; return true;
})); });
UI.main(stage); UI.main(stage);
} }

Some files were not shown because too many files have changed in this diff Show More