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:
parent
76f09b1e49
commit
213e38c2ef
@ -127,9 +127,7 @@ var Application = new Lang.Class({
|
||||
errortext += 'Stack trace:\n';
|
||||
|
||||
// Indent stack trace.
|
||||
errortext += exc.stack.split('\n').map(function(line) {
|
||||
return ' ' + line;
|
||||
}).join('\n');
|
||||
errortext += exc.stack.split('\n').map(line => ' ' + line).join('\n');
|
||||
|
||||
let scroll = new Gtk.ScrolledWindow({ vexpand: true });
|
||||
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.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)
|
||||
this._scanExtensions();
|
||||
}));
|
||||
});
|
||||
|
||||
this._window.show_all();
|
||||
},
|
||||
@ -204,10 +202,9 @@ var Application = new Lang.Class({
|
||||
let row = new ExtensionRow(extension.uuid);
|
||||
|
||||
row.prefsButton.visible = this._extensionAvailable(row.uuid);
|
||||
row.prefsButton.connect('clicked', Lang.bind(this,
|
||||
function() {
|
||||
this._selectExtension(row.uuid);
|
||||
}));
|
||||
row.prefsButton.connect('clicked', () => {
|
||||
this._selectExtension(row.uuid);
|
||||
});
|
||||
|
||||
row.show_all();
|
||||
this._extensionSelector.add(row);
|
||||
@ -275,18 +272,17 @@ var ExtensionRow = new Lang.Class({
|
||||
this.uuid = uuid;
|
||||
|
||||
this._settings = new Gio.Settings({ schema_id: 'org.gnome.shell' });
|
||||
this._settings.connect('changed::enabled-extensions', Lang.bind(this,
|
||||
function() {
|
||||
this._switch.state = this._isEnabled();
|
||||
}));
|
||||
this._settings.connect('changed::enabled-extensions', () => {
|
||||
this._switch.state = this._isEnabled();
|
||||
});
|
||||
this._settings.connect('changed::disable-extension-version-validation',
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
this._switch.sensitive = this._canEnable();
|
||||
}));
|
||||
});
|
||||
this._settings.connect('changed::disable-user-extensions',
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
this._switch.sensitive = this._canEnable();
|
||||
}));
|
||||
});
|
||||
|
||||
this._buildUI();
|
||||
},
|
||||
@ -328,14 +324,13 @@ var ExtensionRow = new Lang.Class({
|
||||
this._switch = new Gtk.Switch({ valign: Gtk.Align.CENTER,
|
||||
sensitive: this._canEnable(),
|
||||
state: this._isEnabled() });
|
||||
this._switch.connect('notify::active', Lang.bind(this,
|
||||
function() {
|
||||
if (this._switch.active)
|
||||
this._enable();
|
||||
else
|
||||
this._disable();
|
||||
}));
|
||||
this._switch.connect('state-set', function() { return true; });
|
||||
this._switch.connect('notify::active', () => {
|
||||
if (this._switch.active)
|
||||
this._enable();
|
||||
else
|
||||
this._disable();
|
||||
});
|
||||
this._switch.connect('state-set', () => true);
|
||||
hbox.add(this._switch);
|
||||
},
|
||||
|
||||
|
@ -64,26 +64,24 @@ var AuthPrompt = new Lang.Class({
|
||||
this._userVerifier.connect('ovirt-user-authenticated', Lang.bind(this, this._onOVirtUserAuthenticated));
|
||||
this.smartcardDetected = this._userVerifier.smartcardDetected;
|
||||
|
||||
this.connect('next', Lang.bind(this, function() {
|
||||
this.updateSensitivity(false);
|
||||
this.startSpinning();
|
||||
if (this._queryingService) {
|
||||
this._userVerifier.answerQuery(this._queryingService, this._entry.text);
|
||||
} else {
|
||||
this._preemptiveAnswer = this._entry.text;
|
||||
}
|
||||
}));
|
||||
this.connect('next', () => {
|
||||
this.updateSensitivity(false);
|
||||
this.startSpinning();
|
||||
if (this._queryingService) {
|
||||
this._userVerifier.answerQuery(this._queryingService, this._entry.text);
|
||||
} else {
|
||||
this._preemptiveAnswer = this._entry.text;
|
||||
}
|
||||
});
|
||||
|
||||
this.actor = new St.BoxLayout({ style_class: 'login-dialog-prompt-layout',
|
||||
vertical: true });
|
||||
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||
this.actor.connect('key-press-event',
|
||||
Lang.bind(this, function(actor, event) {
|
||||
if (event.get_key_symbol() == Clutter.KEY_Escape) {
|
||||
this.cancel();
|
||||
}
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}));
|
||||
this.actor.connect('key-press-event', (actor, event) => {
|
||||
if (event.get_key_symbol() == Clutter.KEY_Escape)
|
||||
this.cancel();
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
});
|
||||
|
||||
this._userWell = new St.Bin({ x_fill: true,
|
||||
x_align: St.Align.START });
|
||||
@ -147,10 +145,7 @@ var AuthPrompt = new Lang.Class({
|
||||
reactive: true,
|
||||
can_focus: true,
|
||||
label: _("Cancel") });
|
||||
this.cancelButton.connect('clicked',
|
||||
Lang.bind(this, function() {
|
||||
this.cancel();
|
||||
}));
|
||||
this.cancelButton.connect('clicked', () => { this.cancel(); });
|
||||
this._buttonBox.add(this.cancelButton,
|
||||
{ expand: false,
|
||||
x_fill: false,
|
||||
@ -169,10 +164,7 @@ var AuthPrompt = new Lang.Class({
|
||||
reactive: true,
|
||||
can_focus: true,
|
||||
label: _("Next") });
|
||||
this.nextButton.connect('clicked',
|
||||
Lang.bind(this, function() {
|
||||
this.emit('next');
|
||||
}));
|
||||
this.nextButton.connect('clicked', () => { this.emit('next'); });
|
||||
this.nextButton.add_style_pseudo_class('default');
|
||||
this._buttonBox.add(this.nextButton,
|
||||
{ expand: false,
|
||||
@ -183,17 +175,16 @@ var AuthPrompt = new Lang.Class({
|
||||
|
||||
this._updateNextButtonSensitivity(this._entry.text.length > 0);
|
||||
|
||||
this._entry.clutter_text.connect('text-changed',
|
||||
Lang.bind(this, function() {
|
||||
if (!this._userVerifier.hasPendingMessages)
|
||||
this._fadeOutMessage();
|
||||
this._entry.clutter_text.connect('text-changed', () => {
|
||||
if (!this._userVerifier.hasPendingMessages)
|
||||
this._fadeOutMessage();
|
||||
|
||||
this._updateNextButtonSensitivity(this._entry.text.length > 0 || this.verificationStatus == AuthPromptStatus.VERIFYING);
|
||||
}));
|
||||
this._entry.clutter_text.connect('activate', Lang.bind(this, function() {
|
||||
this._updateNextButtonSensitivity(this._entry.text.length > 0 || this.verificationStatus == AuthPromptStatus.VERIFYING);
|
||||
});
|
||||
this._entry.clutter_text.connect('activate', () => {
|
||||
if (this.nextButton.reactive)
|
||||
this.emit('next');
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_onAskQuestion(verifier, serviceName, question, passwordChar) {
|
||||
@ -509,12 +500,11 @@ var AuthPrompt = new Lang.Class({
|
||||
return;
|
||||
}
|
||||
|
||||
let signalId = this._userVerifier.connect('no-more-messages',
|
||||
Lang.bind(this, function() {
|
||||
this._userVerifier.disconnect(signalId);
|
||||
this._userVerifier.clear();
|
||||
onComplete();
|
||||
}));
|
||||
let signalId = this._userVerifier.connect('no-more-messages', () => {
|
||||
this._userVerifier.disconnect(signalId);
|
||||
this._userVerifier.clear();
|
||||
onComplete();
|
||||
});
|
||||
},
|
||||
|
||||
cancel() {
|
||||
|
@ -73,9 +73,7 @@ var Hold = new Lang.Class({
|
||||
Extends: Task,
|
||||
|
||||
_init() {
|
||||
this.parent(this, function () {
|
||||
return this;
|
||||
});
|
||||
this.parent(this, () => this);
|
||||
|
||||
this._acquisitions = 1;
|
||||
},
|
||||
@ -91,10 +89,10 @@ var Hold = new Lang.Class({
|
||||
return;
|
||||
|
||||
this.acquire();
|
||||
let signalId = hold.connect('release', Lang.bind(this, function() {
|
||||
hold.disconnect(signalId);
|
||||
this.release();
|
||||
}));
|
||||
let signalId = hold.connect('release', () => {
|
||||
hold.disconnect(signalId);
|
||||
this.release();
|
||||
});
|
||||
},
|
||||
|
||||
release() {
|
||||
@ -214,11 +212,10 @@ var ConsecutiveBatch = new Lang.Class({
|
||||
if (hold && hold.isAcquired()) {
|
||||
// This task is inhibiting the batch. Wait on it
|
||||
// before processing the next one.
|
||||
let signalId = hold.connect('release',
|
||||
Lang.bind(this, function() {
|
||||
hold.disconnect(signalId);
|
||||
this.nextTask();
|
||||
}));
|
||||
let signalId = hold.connect('release', () => {
|
||||
hold.disconnect(signalId);
|
||||
this.nextTask();
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
// This task finished, process the next one
|
||||
|
@ -129,20 +129,19 @@ var UserListItem = new Lang.Class({
|
||||
|
||||
let startTime = GLib.get_monotonic_time();
|
||||
|
||||
this._timedLoginTimeoutId = GLib.timeout_add (GLib.PRIORITY_DEFAULT,
|
||||
33,
|
||||
Lang.bind(this, function() {
|
||||
let currentTime = GLib.get_monotonic_time();
|
||||
let elapsedTime = (currentTime - startTime) / GLib.USEC_PER_SEC;
|
||||
this._timedLoginIndicator.scale_x = elapsedTime / time;
|
||||
if (elapsedTime >= time) {
|
||||
this._timedLoginTimeoutId = 0;
|
||||
hold.release();
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}
|
||||
this._timedLoginTimeoutId = GLib.timeout_add (GLib.PRIORITY_DEFAULT, 33,
|
||||
() => {
|
||||
let currentTime = GLib.get_monotonic_time();
|
||||
let elapsedTime = (currentTime - startTime) / GLib.USEC_PER_SEC;
|
||||
this._timedLoginIndicator.scale_x = elapsedTime / time;
|
||||
if (elapsedTime >= time) {
|
||||
this._timedLoginTimeoutId = 0;
|
||||
hold.release();
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
return GLib.SOURCE_CONTINUE;
|
||||
}));
|
||||
return GLib.SOURCE_CONTINUE;
|
||||
});
|
||||
|
||||
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);
|
||||
if (!focusSet) {
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() {
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||
this._moveFocusToItems();
|
||||
return false;
|
||||
}));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@ -275,11 +274,7 @@ var UserList = new Lang.Class({
|
||||
Lang.bind(this, this._onItemActivated));
|
||||
|
||||
// Try to keep the focused item front-and-center
|
||||
item.actor.connect('key-focus-in',
|
||||
Lang.bind(this,
|
||||
function() {
|
||||
this.scrollToItem(item);
|
||||
}));
|
||||
item.actor.connect('key-focus-in', () => { this.scrollToItem(item); });
|
||||
|
||||
this._moveFocusToItems();
|
||||
|
||||
@ -338,20 +333,17 @@ var SessionMenuButton = new Lang.Class({
|
||||
Main.uiGroup.add_actor(this._menu.actor);
|
||||
this._menu.actor.hide();
|
||||
|
||||
this._menu.connect('open-state-changed',
|
||||
Lang.bind(this, function(menu, isOpen) {
|
||||
if (isOpen)
|
||||
this._button.add_style_pseudo_class('active');
|
||||
else
|
||||
this._button.remove_style_pseudo_class('active');
|
||||
}));
|
||||
this._menu.connect('open-state-changed', (menu, isOpen) => {
|
||||
if (isOpen)
|
||||
this._button.add_style_pseudo_class('active');
|
||||
else
|
||||
this._button.remove_style_pseudo_class('active');
|
||||
});
|
||||
|
||||
this._manager = new PopupMenu.PopupMenuManager({ actor: this._button });
|
||||
this._manager.addMenu(this._menu);
|
||||
|
||||
this._button.connect('clicked', Lang.bind(this, function() {
|
||||
this._menu.toggle();
|
||||
}));
|
||||
this._button.connect('clicked', () => { this._menu.toggle(); });
|
||||
|
||||
this._items = {};
|
||||
this._activeSessionId = null;
|
||||
@ -403,10 +395,10 @@ var SessionMenuButton = new Lang.Class({
|
||||
this._menu.addMenuItem(item);
|
||||
this._items[id] = item;
|
||||
|
||||
item.connect('activate', Lang.bind(this, function() {
|
||||
item.connect('activate', () => {
|
||||
this.setActiveSession(id);
|
||||
this.emit('session-activated', this._activeSessionId);
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -506,17 +498,16 @@ var LoginDialog = new Lang.Class({
|
||||
this.actor.add_child(this._logoBin);
|
||||
this._updateLogo();
|
||||
|
||||
this._userList.connect('activate',
|
||||
Lang.bind(this, function(userList, item) {
|
||||
this._onUserListActivated(item);
|
||||
}));
|
||||
this._userList.connect('activate', (userList, item) => {
|
||||
this._onUserListActivated(item);
|
||||
});
|
||||
|
||||
|
||||
this._sessionMenuButton = new SessionMenuButton();
|
||||
this._sessionMenuButton.connect('session-activated',
|
||||
Lang.bind(this, function(list, sessionId) {
|
||||
this._greeter.call_select_session_sync (sessionId, null);
|
||||
}));
|
||||
(list, sessionId) => {
|
||||
this._greeter.call_select_session_sync (sessionId, null);
|
||||
});
|
||||
this._sessionMenuButton.actor.opacity = 0;
|
||||
this._sessionMenuButton.actor.show();
|
||||
this._authPrompt.addActorToDefaultButtonWell(this._sessionMenuButton.actor);
|
||||
@ -724,13 +715,13 @@ var LoginDialog = new Lang.Class({
|
||||
_ensureUserListLoaded() {
|
||||
if (!this._userManager.is_loaded) {
|
||||
this._userManagerLoadedId = this._userManager.connect('notify::is-loaded',
|
||||
Lang.bind(this, function() {
|
||||
if (this._userManager.is_loaded) {
|
||||
this._loadUserList();
|
||||
this._userManager.disconnect(this._userManagerLoadedId);
|
||||
this._userManagerLoadedId = 0;
|
||||
}
|
||||
}));
|
||||
() => {
|
||||
if (this._userManager.is_loaded) {
|
||||
this._loadUserList();
|
||||
this._userManager.disconnect(this._userManagerLoadedId);
|
||||
this._userManagerLoadedId = 0;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, this._loadUserList));
|
||||
GLib.Source.set_name_by_id(id, '[gnome-shell] _loadUserList');
|
||||
@ -907,17 +898,17 @@ var LoginDialog = new Lang.Class({
|
||||
if (this._nextSignalId)
|
||||
this._authPrompt.disconnect(this._nextSignalId);
|
||||
this._nextSignalId = this._authPrompt.connect('next',
|
||||
Lang.bind(this, function() {
|
||||
this._authPrompt.disconnect(this._nextSignalId);
|
||||
this._nextSignalId = 0;
|
||||
this._authPrompt.updateSensitivity(false);
|
||||
let answer = this._authPrompt.getAnswer();
|
||||
this._user = this._userManager.get_user(answer);
|
||||
this._authPrompt.clear();
|
||||
this._authPrompt.startSpinning();
|
||||
this._authPrompt.begin({ userName: answer });
|
||||
this._updateCancelButton();
|
||||
}));
|
||||
() => {
|
||||
this._authPrompt.disconnect(this._nextSignalId);
|
||||
this._nextSignalId = 0;
|
||||
this._authPrompt.updateSensitivity(false);
|
||||
let answer = this._authPrompt.getAnswer();
|
||||
this._user = this._userManager.get_user(answer);
|
||||
this._authPrompt.clear();
|
||||
this._authPrompt.startSpinning();
|
||||
this._authPrompt.begin({ userName: answer });
|
||||
this._updateCancelButton();
|
||||
});
|
||||
this._updateCancelButton();
|
||||
|
||||
this._sessionMenuButton.updateSensitivity(false);
|
||||
@ -952,10 +943,10 @@ var LoginDialog = new Lang.Class({
|
||||
_gotGreeterSessionProxy(proxy) {
|
||||
this._greeterSessionProxy = proxy;
|
||||
this._greeterSessionProxyChangedId =
|
||||
proxy.connect('g-properties-changed', Lang.bind(this, function() {
|
||||
proxy.connect('g-properties-changed', () => {
|
||||
if (proxy.Active)
|
||||
this._loginScreenSessionActivated();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_startSession(serviceName) {
|
||||
@ -979,9 +970,7 @@ var LoginDialog = new Lang.Class({
|
||||
},
|
||||
|
||||
_onSessionOpened(client, serviceName) {
|
||||
this._authPrompt.finish(Lang.bind(this, function() {
|
||||
this._startSession(serviceName);
|
||||
}));
|
||||
this._authPrompt.finish(() => { this._startSession(serviceName); });
|
||||
},
|
||||
|
||||
_waitForItemForUser(userName) {
|
||||
@ -992,16 +981,14 @@ var LoginDialog = new Lang.Class({
|
||||
|
||||
let hold = new Batch.Hold();
|
||||
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)
|
||||
hold.release();
|
||||
}));
|
||||
if (item)
|
||||
hold.release();
|
||||
});
|
||||
|
||||
hold.connect('release', Lang.bind(this, function() {
|
||||
this._userList.disconnect(signalId);
|
||||
}));
|
||||
hold.connect('release', () => { this._userList.disconnect(signalId); });
|
||||
|
||||
return hold;
|
||||
},
|
||||
@ -1024,11 +1011,11 @@ var LoginDialog = new Lang.Class({
|
||||
let hold = new Batch.Hold();
|
||||
|
||||
this._timedLoginIdleTimeOutId = Mainloop.timeout_add_seconds(_TIMED_LOGIN_IDLE_THRESHOLD,
|
||||
function() {
|
||||
this._timedLoginAnimationTime -= _TIMED_LOGIN_IDLE_THRESHOLD;
|
||||
hold.release();
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
() => {
|
||||
this._timedLoginAnimationTime -= _TIMED_LOGIN_IDLE_THRESHOLD;
|
||||
hold.release();
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
GLib.Source.set_name_by_id(this._timedLoginIdleTimeOutId, '[gnome-shell] this._timedLoginAnimationTime');
|
||||
return hold;
|
||||
},
|
||||
@ -1038,15 +1025,13 @@ var LoginDialog = new Lang.Class({
|
||||
this._timedLoginDelay = delay;
|
||||
this._timedLoginAnimationTime = delay;
|
||||
|
||||
let tasks = [function() {
|
||||
return this._waitForItemForUser(userName);
|
||||
},
|
||||
let tasks = [() => this._waitForItemForUser(userName),
|
||||
|
||||
function() {
|
||||
() => {
|
||||
this._timedLoginItem = this._userList.getItemFromUserName(userName);
|
||||
},
|
||||
|
||||
function() {
|
||||
() => {
|
||||
// If we're just starting out, start on the right
|
||||
// item.
|
||||
if (!this._userManager.is_loaded) {
|
||||
@ -1056,13 +1041,13 @@ var LoginDialog = new Lang.Class({
|
||||
|
||||
this._blockTimedLoginUntilIdle,
|
||||
|
||||
function() {
|
||||
() => {
|
||||
this._userList.scrollToItem(this._timedLoginItem);
|
||||
},
|
||||
|
||||
this._showTimedLoginAnimation,
|
||||
|
||||
function() {
|
||||
() => {
|
||||
this._timedLoginBatch = null;
|
||||
this._greeter.call_begin_auto_login_sync(userName, null);
|
||||
}];
|
||||
@ -1090,24 +1075,23 @@ var LoginDialog = new Lang.Class({
|
||||
_onTimedLoginRequested(client, userName, seconds) {
|
||||
this._startTimedLogin(userName, seconds);
|
||||
|
||||
global.stage.connect('captured-event',
|
||||
Lang.bind(this, function(actor, event) {
|
||||
if (this._timedLoginDelay == undefined)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
global.stage.connect('captured-event', (actor, event) => {
|
||||
if (this._timedLoginDelay == undefined)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
if (event.type() == Clutter.EventType.KEY_PRESS ||
|
||||
event.type() == Clutter.EventType.BUTTON_PRESS) {
|
||||
if (this._timedLoginBatch) {
|
||||
this._timedLoginBatch.cancel();
|
||||
this._timedLoginBatch = null;
|
||||
}
|
||||
} else if (event.type() == Clutter.EventType.KEY_RELEASE ||
|
||||
event.type() == Clutter.EventType.BUTTON_RELEASE) {
|
||||
this._resetTimedLogin();
|
||||
}
|
||||
if (event.type() == Clutter.EventType.KEY_PRESS ||
|
||||
event.type() == Clutter.EventType.BUTTON_PRESS) {
|
||||
if (this._timedLoginBatch) {
|
||||
this._timedLoginBatch.cancel();
|
||||
this._timedLoginBatch = null;
|
||||
}
|
||||
} else if (event.type() == Clutter.EventType.KEY_RELEASE ||
|
||||
event.type() == Clutter.EventType.BUTTON_RELEASE) {
|
||||
this._resetTimedLogin();
|
||||
}
|
||||
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}));
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
});
|
||||
},
|
||||
|
||||
_setUserListExpanded(expanded) {
|
||||
@ -1218,25 +1202,25 @@ var LoginDialog = new Lang.Class({
|
||||
this._updateDisableUserList();
|
||||
|
||||
this._userAddedId = this._userManager.connect('user-added',
|
||||
Lang.bind(this, function(userManager, user) {
|
||||
this._userList.addUser(user);
|
||||
this._updateDisableUserList();
|
||||
}));
|
||||
(userManager, user) => {
|
||||
this._userList.addUser(user);
|
||||
this._updateDisableUserList();
|
||||
});
|
||||
|
||||
this._userRemovedId = this._userManager.connect('user-removed',
|
||||
Lang.bind(this, function(userManager, user) {
|
||||
this._userList.removeUser(user);
|
||||
this._updateDisableUserList();
|
||||
}));
|
||||
(userManager, user) => {
|
||||
this._userList.removeUser(user);
|
||||
this._updateDisableUserList();
|
||||
});
|
||||
|
||||
this._userChangedId = this._userManager.connect('user-changed',
|
||||
Lang.bind(this, function(userManager, user) {
|
||||
if (this._userList.containsUser(user) && user.locked)
|
||||
this._userList.removeUser(user);
|
||||
else if (!this._userList.containsUser(user) && !user.locked)
|
||||
this._userList.addUser(user);
|
||||
this._updateDisableUserList();
|
||||
}));
|
||||
(userManager, user) => {
|
||||
if (this._userList.containsUser(user) && user.locked)
|
||||
this._userList.removeUser(user);
|
||||
else if (!this._userList.containsUser(user) && !user.locked)
|
||||
this._userList.addUser(user);
|
||||
this._updateDisableUserList();
|
||||
});
|
||||
|
||||
return GLib.SOURCE_REMOVE;
|
||||
},
|
||||
|
@ -70,10 +70,10 @@ var Manager = new Lang.Class({
|
||||
this._realms = {};
|
||||
|
||||
this._signalId = this._aggregateProvider.connect('g-properties-changed',
|
||||
Lang.bind(this, function(proxy, properties) {
|
||||
if ('Realms' in properties.deep_unpack())
|
||||
this._reloadRealms();
|
||||
}));
|
||||
(proxy, properties) => {
|
||||
if ('Realms' in properties.deep_unpack())
|
||||
this._reloadRealms();
|
||||
});
|
||||
},
|
||||
|
||||
_reloadRealms() {
|
||||
@ -109,11 +109,10 @@ var Manager = new Lang.Class({
|
||||
|
||||
this._reloadRealm(realm);
|
||||
|
||||
realm.connect('g-properties-changed',
|
||||
Lang.bind(this, function(proxy, properties) {
|
||||
if ('Configured' in properties.deep_unpack())
|
||||
this._reloadRealm(realm);
|
||||
}));
|
||||
realm.connect('g-properties-changed', (proxy, properties) => {
|
||||
if ('Configured' in properties.deep_unpack())
|
||||
this._reloadRealm(realm);
|
||||
});
|
||||
},
|
||||
|
||||
_updateLoginFormat() {
|
||||
@ -146,9 +145,7 @@ var Manager = new Lang.Class({
|
||||
Service(Gio.DBus.system,
|
||||
'org.freedesktop.realmd',
|
||||
'/org/freedesktop/realmd',
|
||||
function(service) {
|
||||
service.ReleaseRemote();
|
||||
});
|
||||
service => { service.ReleaseRemote(); });
|
||||
this._aggregateProvider.disconnect(this._signalId);
|
||||
this._realms = { };
|
||||
this._updateLoginFormat();
|
||||
|
@ -230,11 +230,10 @@ var ShellUserVerifier = new Lang.Class({
|
||||
if (!this.hasPendingMessages) {
|
||||
this._userVerifier.call_answer_query(serviceName, answer, this._cancellable, null);
|
||||
} else {
|
||||
let signalId = this.connect('no-more-messages',
|
||||
Lang.bind(this, function() {
|
||||
this.disconnect(signalId);
|
||||
this._userVerifier.call_answer_query(serviceName, answer, this._cancellable, null);
|
||||
}));
|
||||
let signalId = this.connect('no-more-messages', () => {
|
||||
this.disconnect(signalId);
|
||||
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,
|
||||
message.interval,
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
this._messageQueueTimeoutId = 0;
|
||||
this._queueMessageTimeout();
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
GLib.Source.set_name_by_id(this._messageQueueTimeoutId, '[gnome-shell] this._queueMessageTimeout');
|
||||
},
|
||||
|
||||
@ -303,13 +302,13 @@ var ShellUserVerifier = new Lang.Class({
|
||||
return;
|
||||
}
|
||||
|
||||
this._fprintManager.GetDefaultDeviceRemote(Gio.DBusCallFlags.NONE, this._cancellable, Lang.bind(this,
|
||||
function(device, error) {
|
||||
this._fprintManager.GetDefaultDeviceRemote(Gio.DBusCallFlags.NONE, this._cancellable,
|
||||
(device, error) => {
|
||||
if (!error && device) {
|
||||
this._haveFingerprintReader = true;
|
||||
this._updateDefaultService();
|
||||
}
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_oVirtUserAuthenticated(token) {
|
||||
@ -432,7 +431,7 @@ var ShellUserVerifier = new Lang.Class({
|
||||
this._userVerifier.call_begin_verification_for_user(serviceName,
|
||||
this._userName,
|
||||
this._cancellable,
|
||||
Lang.bind(this, function(obj, result) {
|
||||
(obj, result) => {
|
||||
try {
|
||||
obj.call_begin_verification_for_user_finish(result);
|
||||
} catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
|
||||
@ -443,11 +442,11 @@ var ShellUserVerifier = new Lang.Class({
|
||||
}
|
||||
|
||||
this._hold.release();
|
||||
}));
|
||||
});
|
||||
} else {
|
||||
this._userVerifier.call_begin_verification(serviceName,
|
||||
this._cancellable,
|
||||
Lang.bind(this, function(obj, result) {
|
||||
(obj, result) => {
|
||||
try {
|
||||
obj.call_begin_verification_finish(result);
|
||||
} catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
|
||||
@ -458,7 +457,7 @@ var ShellUserVerifier = new Lang.Class({
|
||||
}
|
||||
|
||||
this._hold.release();
|
||||
}));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@ -546,22 +545,20 @@ var ShellUserVerifier = new Lang.Class({
|
||||
if (!this.hasPendingMessages) {
|
||||
this._retry();
|
||||
} else {
|
||||
let signalId = this.connect('no-more-messages',
|
||||
Lang.bind(this, function() {
|
||||
this.disconnect(signalId);
|
||||
if (this._cancellable && !this._cancellable.is_cancelled())
|
||||
this._retry();
|
||||
}));
|
||||
let signalId = this.connect('no-more-messages', () => {
|
||||
this.disconnect(signalId);
|
||||
if (this._cancellable && !this._cancellable.is_cancelled())
|
||||
this._retry();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (!this.hasPendingMessages) {
|
||||
this._cancelAndReset();
|
||||
} else {
|
||||
let signalId = this.connect('no-more-messages',
|
||||
Lang.bind(this, function() {
|
||||
this.disconnect(signalId);
|
||||
this._cancelAndReset();
|
||||
}));
|
||||
let signalId = this.connect('no-more-messages', () => {
|
||||
this.disconnect(signalId);
|
||||
this._cancelAndReset();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ var IBusManager = new Lang.Class({
|
||||
} catch (e) {
|
||||
}
|
||||
// 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;
|
||||
try {
|
||||
engine = this._ibus.get_global_engine_async_finish(result);
|
||||
@ -136,7 +136,7 @@ var IBusManager = new Lang.Class({
|
||||
return;
|
||||
}
|
||||
this._engineChanged(this._ibus, engine.get_name());
|
||||
}));
|
||||
});
|
||||
this._updateReadiness();
|
||||
} else {
|
||||
this._clear();
|
||||
@ -159,7 +159,7 @@ var IBusManager = new Lang.Class({
|
||||
return;
|
||||
|
||||
this._registerPropertiesId =
|
||||
this._panelService.connect('register-properties', Lang.bind(this, function(p, props) {
|
||||
this._panelService.connect('register-properties', (p, props) => {
|
||||
if (!props.get(0))
|
||||
return;
|
||||
|
||||
@ -167,7 +167,7 @@ var IBusManager = new Lang.Class({
|
||||
this._registerPropertiesId = 0;
|
||||
|
||||
this.emit('properties-registered', this._currentEngineName, props);
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_updateProperty(panel, prop) {
|
||||
@ -214,7 +214,7 @@ var IBusManager = new Lang.Class({
|
||||
|
||||
this._preloadEnginesId =
|
||||
Mainloop.timeout_add_seconds(this._PRELOAD_ENGINES_DELAY_TIME,
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
this._ibus.preload_engines_async(
|
||||
ids,
|
||||
-1,
|
||||
@ -222,7 +222,7 @@ var IBusManager = new Lang.Class({
|
||||
null);
|
||||
this._preloadEnginesId = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
},
|
||||
});
|
||||
Signals.addSignalMethods(IBusManager.prototype);
|
||||
|
@ -59,8 +59,8 @@ var InputMethod = new Lang.Class({
|
||||
|
||||
_setContext(bus, 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('disabled', Lang.bind(this, function () { this._enabled = false }));
|
||||
this._context.connect('enabled', () => { this._enabled = true });
|
||||
this._context.connect('disabled', () => { this._enabled = false });
|
||||
this._context.connect('commit-text', Lang.bind(this, this._onCommitText));
|
||||
this._context.connect('delete-surrounding-text', Lang.bind(this, this._onDeleteSurroundingText));
|
||||
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(),
|
||||
event.get_key_code() - 8, // Convert XKB keycodes to evcodes
|
||||
state, -1, null,
|
||||
Lang.bind(this, (context, res) => {
|
||||
(context, res) => {
|
||||
try {
|
||||
let retval = context.process_key_event_async_finish(res);
|
||||
this.notify_key_event(event, retval);
|
||||
} catch (e) {
|
||||
log('Error processing key on IM: ' + e.message);
|
||||
}
|
||||
}));
|
||||
});
|
||||
return true;
|
||||
},
|
||||
});
|
||||
|
@ -23,9 +23,9 @@ function getCompletions(text, commandHeader, globalCompletionList) {
|
||||
if (matches) {
|
||||
[expr, base, attrHead] = matches;
|
||||
|
||||
methods = getPropertyNamesFromExpression(base, commandHeader).filter(function(attr) {
|
||||
return attr.slice(0, attrHead.length) == attrHead;
|
||||
});
|
||||
methods = getPropertyNamesFromExpression(base, commandHeader).filter(
|
||||
attr => attr.slice(0, attrHead.length) == attrHead
|
||||
);
|
||||
}
|
||||
|
||||
// Look for the empty expression or partially entered words
|
||||
@ -33,9 +33,9 @@ function getCompletions(text, commandHeader, globalCompletionList) {
|
||||
matches = text.match(/^(\w*)$/);
|
||||
if (text == '' || matches) {
|
||||
[expr, attrHead] = matches;
|
||||
methods = globalCompletionList.filter(function(attr) {
|
||||
return attr.slice(0, attrHead.length) == attrHead;
|
||||
});
|
||||
methods = globalCompletionList.filter(
|
||||
attr => attr.slice(0, attrHead.length) == attrHead
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ function getPropertyNamesFromExpression(expr, commandHeader) {
|
||||
|
||||
// Make sure propsUnique contains one key for every
|
||||
// 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();
|
||||
}
|
||||
@ -233,7 +233,7 @@ function isUnsafeExpression(str) {
|
||||
// Returns a list of global keywords derived from str
|
||||
function getDeclaredConstants(str) {
|
||||
let ret = [];
|
||||
str.split(';').forEach(function(s) {
|
||||
str.split(';').forEach(s => {
|
||||
let base, keyword;
|
||||
let match = s.match(/const\s+(\w+)\s*=/);
|
||||
if (match) {
|
||||
|
@ -138,8 +138,8 @@ var KeyboardManager = new Lang.Class({
|
||||
|
||||
_buildGroupStrings(_group) {
|
||||
let group = _group.concat(this._localeLayoutInfo);
|
||||
let layouts = group.map(function(g) { return g.layout; }).join(',');
|
||||
let variants = group.map(function(g) { return g.variant; }).join(',');
|
||||
let layouts = group.map(g => g.layout).join(',');
|
||||
let variants = group.map(g => g.variant).join(',');
|
||||
return [layouts, variants];
|
||||
},
|
||||
|
||||
|
@ -125,21 +125,20 @@ var LoginManagerSystemd = new Lang.Class({
|
||||
return;
|
||||
}
|
||||
|
||||
this._proxy.GetSessionRemote(sessionId, Lang.bind(this,
|
||||
function(result, error) {
|
||||
if (error) {
|
||||
logError(error, 'Could not get a proxy for the current session');
|
||||
} else {
|
||||
this._currentSession = new SystemdLoginSession(Gio.DBus.system,
|
||||
'org.freedesktop.login1',
|
||||
result[0]);
|
||||
callback(this._currentSession);
|
||||
}
|
||||
}));
|
||||
this._proxy.GetSessionRemote(sessionId, (result, error) => {
|
||||
if (error) {
|
||||
logError(error, 'Could not get a proxy for the current session');
|
||||
} else {
|
||||
this._currentSession = new SystemdLoginSession(Gio.DBus.system,
|
||||
'org.freedesktop.login1',
|
||||
result[0]);
|
||||
callback(this._currentSession);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
canSuspend(asyncCallback) {
|
||||
this._proxy.CanSuspendRemote(function(result, error) {
|
||||
this._proxy.CanSuspendRemote((result, error) => {
|
||||
if (error) {
|
||||
asyncCallback(false, false);
|
||||
} else {
|
||||
@ -151,7 +150,7 @@ var LoginManagerSystemd = new Lang.Class({
|
||||
},
|
||||
|
||||
listSessions(asyncCallback) {
|
||||
this._proxy.ListSessionsRemote(function(result, error) {
|
||||
this._proxy.ListSessionsRemote((result, error) => {
|
||||
if (error)
|
||||
asyncCallback([]);
|
||||
else
|
||||
@ -170,7 +169,7 @@ var LoginManagerSystemd = new Lang.Class({
|
||||
reason,
|
||||
'delay']);
|
||||
this._proxy.call_with_unix_fd_list('Inhibit', inVariant, 0, -1, null, null,
|
||||
Lang.bind(this, function(proxy, result) {
|
||||
(proxy, result) => {
|
||||
let fd = -1;
|
||||
try {
|
||||
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");
|
||||
callback(null);
|
||||
}
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_prepareForSleep(proxy, sender, [aboutToSuspend]) {
|
||||
|
@ -140,15 +140,15 @@ var ModemGsm = new Lang.Class({
|
||||
this.operator_name = null;
|
||||
|
||||
// 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.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.emit('notify::operator-name');
|
||||
}));
|
||||
this._proxy.GetRegistrationInfoRemote(Lang.bind(this, function([result], err) {
|
||||
});
|
||||
this._proxy.GetRegistrationInfoRemote(([result], err) => {
|
||||
if (err) {
|
||||
log(err);
|
||||
return;
|
||||
@ -157,8 +157,8 @@ var ModemGsm = new Lang.Class({
|
||||
let [status, code, name] = result;
|
||||
this.operator_name = _findProviderForMccMnc(name, code);
|
||||
this.emit('notify::operator-name');
|
||||
}));
|
||||
this._proxy.GetSignalQualityRemote(Lang.bind(this, function(result, err) {
|
||||
});
|
||||
this._proxy.GetSignalQualityRemote((result, err) => {
|
||||
if (err) {
|
||||
// it will return an error if the device is not connected
|
||||
this.signal_quality = 0;
|
||||
@ -167,7 +167,7 @@ var ModemGsm = new Lang.Class({
|
||||
this.signal_quality = quality;
|
||||
}
|
||||
this.emit('notify::signal-quality');
|
||||
}));
|
||||
});
|
||||
}
|
||||
});
|
||||
Signals.addSignalMethods(ModemGsm.prototype);
|
||||
@ -180,7 +180,7 @@ var ModemCdma = new Lang.Class({
|
||||
|
||||
this.signal_quality = 0;
|
||||
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.emit('notify::signal-quality');
|
||||
|
||||
@ -188,8 +188,8 @@ var ModemCdma = new Lang.Class({
|
||||
// and we can finally call GetServingSystem
|
||||
if (this.operator_name == null)
|
||||
this._refreshServingSystem();
|
||||
}));
|
||||
this._proxy.GetSignalQualityRemote(Lang.bind(this, function(result, err) {
|
||||
});
|
||||
this._proxy.GetSignalQualityRemote((result, err) => {
|
||||
if (err) {
|
||||
// it will return an error if the device is not connected
|
||||
this.signal_quality = 0;
|
||||
@ -198,11 +198,11 @@ var ModemCdma = new Lang.Class({
|
||||
this.signal_quality = quality;
|
||||
}
|
||||
this.emit('notify::signal-quality');
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_refreshServingSystem() {
|
||||
this._proxy.GetServingSystemRemote(Lang.bind(this, function([result], err) {
|
||||
this._proxy.GetServingSystemRemote(([result], err) => {
|
||||
if (err) {
|
||||
// it will return an error if the device is not connected
|
||||
this.operator_name = null;
|
||||
@ -212,7 +212,7 @@ var ModemCdma = new Lang.Class({
|
||||
this.operator_name = _findProviderForSid(sid)
|
||||
}
|
||||
this.emit('notify::operator-name');
|
||||
}));
|
||||
});
|
||||
}
|
||||
});
|
||||
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._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())
|
||||
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();
|
||||
if ('OperatorName' in unpacked || 'OperatorCode' in unpacked)
|
||||
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();
|
||||
if ('Nid' in unpacked || 'Sid' in unpacked)
|
||||
this._reloadCdmaOperatorName();
|
||||
}));
|
||||
});
|
||||
this._reloadCdmaOperatorName();
|
||||
},
|
||||
|
||||
|
@ -93,7 +93,7 @@ var ObjectManager = new Lang.Class({
|
||||
|
||||
proxy.init_async(GLib.PRIORITY_DEFAULT,
|
||||
this._cancellable,
|
||||
Lang.bind(this, function(initable, result) {
|
||||
(initable, result) => {
|
||||
let error = null;
|
||||
try {
|
||||
initable.init_finish(result);
|
||||
@ -127,7 +127,7 @@ var ObjectManager = new Lang.Class({
|
||||
|
||||
if (onFinished)
|
||||
onFinished();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_removeInterface(objectPath, interfaceName) {
|
||||
@ -168,35 +168,35 @@ var ObjectManager = new Lang.Class({
|
||||
}
|
||||
|
||||
this._managerProxy.connectSignal('InterfacesAdded',
|
||||
Lang.bind(this, function(objectManager, sender, [objectPath, interfaces]) {
|
||||
(objectManager, sender, [objectPath, interfaces]) => {
|
||||
let interfaceNames = Object.keys(interfaces);
|
||||
for (let i = 0; i < interfaceNames.length; i++)
|
||||
this._addInterface(objectPath, interfaceNames[i]);
|
||||
}));
|
||||
});
|
||||
this._managerProxy.connectSignal('InterfacesRemoved',
|
||||
Lang.bind(this, function(objectManager, sender, [objectPath, interfaceNames]) {
|
||||
(objectManager, sender, [objectPath, interfaceNames]) => {
|
||||
for (let i = 0; i < interfaceNames.length; i++)
|
||||
this._removeInterface(objectPath, interfaceNames[i]);
|
||||
}));
|
||||
});
|
||||
|
||||
if (Object.keys(this._interfaceInfos).length == 0) {
|
||||
this._tryToCompleteLoad();
|
||||
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)
|
||||
this._onNameAppeared();
|
||||
else
|
||||
this._onNameVanished();
|
||||
}));
|
||||
});
|
||||
|
||||
if (this._managerProxy.g_name_owner)
|
||||
this._onNameAppeared();
|
||||
},
|
||||
|
||||
_onNameAppeared() {
|
||||
this._managerProxy.GetManagedObjectsRemote(Lang.bind(this, function(result, error) {
|
||||
this._managerProxy.GetManagedObjectsRemote((result, error) => {
|
||||
if (!result) {
|
||||
if (error) {
|
||||
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();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_onNameVanished() {
|
||||
|
@ -43,15 +43,15 @@ var SmartcardManager = new Lang.Class({
|
||||
for (let i = 0; i < tokens.length; 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')
|
||||
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')
|
||||
this._removeToken(proxy);
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_updateToken(token) {
|
||||
@ -69,18 +69,17 @@ var SmartcardManager = new Lang.Class({
|
||||
_addToken(token) {
|
||||
this._updateToken(token);
|
||||
|
||||
token.connect('g-properties-changed',
|
||||
Lang.bind(this, function(proxy, properties) {
|
||||
if ('IsInserted' in properties.deep_unpack()) {
|
||||
this._updateToken(token);
|
||||
token.connect('g-properties-changed', (proxy, properties) => {
|
||||
if ('IsInserted' in properties.deep_unpack()) {
|
||||
this._updateToken(token);
|
||||
|
||||
if (token.IsInserted) {
|
||||
this.emit('smartcard-inserted', token);
|
||||
} else {
|
||||
this.emit('smartcard-removed', token);
|
||||
}
|
||||
}
|
||||
}));
|
||||
if (token.IsInserted) {
|
||||
this.emit('smartcard-inserted', token);
|
||||
} else {
|
||||
this.emit('smartcard-removed', token);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Emit a smartcard-inserted at startup if it's already plugged in
|
||||
if (token.IsInserted)
|
||||
|
@ -410,7 +410,7 @@ const SystemActions = new Lang.Class({
|
||||
if (Main.screenShield)
|
||||
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);
|
||||
return false;
|
||||
});
|
||||
|
@ -136,7 +136,7 @@ function trySpawn(argv)
|
||||
// Dummy child watch; we don't want to double-fork internally
|
||||
// because then we lose the parent-child relationship, which
|
||||
// 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:
|
||||
@ -291,12 +291,10 @@ function createTimeLabel(date, params) {
|
||||
_desktopSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' });
|
||||
|
||||
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.connect('destroy', function() {
|
||||
_desktopSettings.disconnect(id);
|
||||
});
|
||||
label.connect('destroy', () => { _desktopSettings.disconnect(id); });
|
||||
return label;
|
||||
}
|
||||
|
||||
@ -316,7 +314,7 @@ function createTimeLabel(date, params) {
|
||||
|
||||
function lowerBound(array, val, cmp) {
|
||||
let min, max, mid, v;
|
||||
cmp = cmp || function(a, b) { return a - b; };
|
||||
cmp = cmp || ((a, b) => a - b);
|
||||
|
||||
if (array.length == 0)
|
||||
return 0;
|
||||
|
@ -75,9 +75,9 @@ function run() {
|
||||
// Enable recording of timestamps for different points in the frame cycle
|
||||
global.frame_timestamps = true;
|
||||
|
||||
Main.overview.connect('shown', function() {
|
||||
Scripting.scriptEvent('overviewShowDone');
|
||||
});
|
||||
Main.overview.connect('shown', () => {
|
||||
Scripting.scriptEvent('overviewShowDone');
|
||||
});
|
||||
|
||||
yield Scripting.sleep(1000);
|
||||
|
||||
|
@ -42,35 +42,29 @@ function waitAndDraw(milliseconds) {
|
||||
let timeline = new Clutter.Timeline({ duration: milliseconds });
|
||||
timeline.start();
|
||||
|
||||
timeline.connect('new-frame',
|
||||
function(timeline, frame) {
|
||||
global.stage.queue_redraw();
|
||||
});
|
||||
timeline.connect('new-frame', (timeline, frame) => {
|
||||
global.stage.queue_redraw();
|
||||
});
|
||||
|
||||
timeline.connect('completed',
|
||||
function() {
|
||||
timeline.stop();
|
||||
if (cb)
|
||||
cb();
|
||||
});
|
||||
timeline.connect('completed', () => {
|
||||
timeline.stop();
|
||||
if (cb)
|
||||
cb();
|
||||
});
|
||||
|
||||
return function(callback) {
|
||||
cb = callback;
|
||||
};
|
||||
return callback => { cb = callback; };
|
||||
}
|
||||
|
||||
function waitSignal(object, signal) {
|
||||
let cb;
|
||||
|
||||
let id = object.connect(signal, function() {
|
||||
let id = object.connect(signal, () => {
|
||||
object.disconnect(id);
|
||||
if (cb)
|
||||
cb();
|
||||
});
|
||||
|
||||
return function(callback) {
|
||||
cb = callback;
|
||||
};
|
||||
return callback => { cb = callback; };
|
||||
}
|
||||
|
||||
function extractBootTimestamp() {
|
||||
@ -270,7 +264,7 @@ function script_redrawTestDone(time) {
|
||||
function script_collectTimings(time) {
|
||||
for (let timing in redrawTimes) {
|
||||
let times = redrawTimes[timing];
|
||||
times.sort(function(a, b) { return a - b });
|
||||
times.sort((a, b) => a - b);
|
||||
|
||||
let len = times.length;
|
||||
let median;
|
||||
|
@ -357,9 +357,9 @@ var WebPortalHelper = new Lang.Class({
|
||||
if (top.window != null)
|
||||
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]));
|
||||
}));
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -372,10 +372,10 @@ var AppSwitcherPopup = new Lang.Class({
|
||||
{ opacity: 0,
|
||||
time: THUMBNAIL_FADE_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this, function() {
|
||||
thumbnailsActor.destroy();
|
||||
this.thumbnailsVisible = false;
|
||||
})
|
||||
onComplete: () => {
|
||||
thumbnailsActor.destroy();
|
||||
this.thumbnailsVisible = false;
|
||||
}
|
||||
});
|
||||
this._thumbnails = null;
|
||||
if (this._switcherList._items[this._selectedIndex])
|
||||
@ -403,7 +403,7 @@ var AppSwitcherPopup = new Lang.Class({
|
||||
{ opacity: 255,
|
||||
time: THUMBNAIL_FADE_TIME,
|
||||
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);
|
||||
@ -678,9 +678,9 @@ var AppSwitcher = new Lang.Class({
|
||||
let appIcon = new AppIcon(apps[i]);
|
||||
// Cache the window list now; we don't handle dynamic changes here,
|
||||
// and we don't want to be continually retrieving it
|
||||
appIcon.cachedWindows = allWindows.filter(function(w) {
|
||||
return windowTracker.get_window_app (w) == appIcon.app;
|
||||
});
|
||||
appIcon.cachedWindows = allWindows.filter(
|
||||
w => windowTracker.get_window_app (w) == appIcon.app
|
||||
);
|
||||
if (appIcon.cachedWindows.length > 0)
|
||||
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 scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||
let iconSizes = baseIconSizes.map(function(s) {
|
||||
return s * scaleFactor;
|
||||
});
|
||||
let iconSizes = baseIconSizes.map(s => s * scaleFactor);
|
||||
|
||||
if (this._items.length == 1) {
|
||||
this._iconSize = baseIconSizes[0];
|
||||
@ -775,11 +773,11 @@ var AppSwitcher = new Lang.Class({
|
||||
Mainloop.source_remove(this._mouseTimeOutId);
|
||||
if (this._altTabPopup.thumbnailsVisible) {
|
||||
this._mouseTimeOutId = Mainloop.timeout_add(APP_ICON_HOVER_TIMEOUT,
|
||||
Lang.bind(this, function () {
|
||||
this._enterItem(index);
|
||||
this._mouseTimeOutId = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
() => {
|
||||
this._enterItem(index);
|
||||
this._mouseTimeOutId = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
GLib.Source.set_name_by_id(this._mouseTimeOutId, '[gnome-shell] this._enterItem');
|
||||
} else
|
||||
this._itemEntered(index);
|
||||
@ -829,7 +827,7 @@ var AppSwitcher = new Lang.Class({
|
||||
|
||||
let n = this._arrows.length;
|
||||
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._arrows.push(arrow);
|
||||
|
||||
|
@ -129,9 +129,9 @@ var BaseAppView = new Lang.Class({
|
||||
else
|
||||
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);
|
||||
}));
|
||||
});
|
||||
// Standard hack for ClutterBinLayout
|
||||
this._grid.actor.x_expand = true;
|
||||
|
||||
@ -173,9 +173,7 @@ var BaseAppView = new Lang.Class({
|
||||
|
||||
loadGrid() {
|
||||
this._allItems.sort(this._compareItems);
|
||||
this._allItems.forEach(Lang.bind(this, function(item) {
|
||||
this._grid.addItem(item);
|
||||
}));
|
||||
this._allItems.forEach(item => { this._grid.addItem(item); });
|
||||
this.emit('view-loaded');
|
||||
},
|
||||
|
||||
@ -191,18 +189,19 @@ var BaseAppView = new Lang.Class({
|
||||
this._selectAppInternal(id);
|
||||
} else if (this._items[id]) {
|
||||
// Need to wait until the view is mapped
|
||||
let signalId = this._items[id].actor.connect('notify::mapped', Lang.bind(this, function(actor) {
|
||||
if (actor.mapped) {
|
||||
actor.disconnect(signalId);
|
||||
this._selectAppInternal(id);
|
||||
}
|
||||
}));
|
||||
let signalId = this._items[id].actor.connect('notify::mapped',
|
||||
actor => {
|
||||
if (actor.mapped) {
|
||||
actor.disconnect(signalId);
|
||||
this._selectAppInternal(id);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 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.selectApp(id);
|
||||
}));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@ -214,11 +213,10 @@ var BaseAppView = new Lang.Class({
|
||||
|
||||
animate(animationDirection, onComplete) {
|
||||
if (onComplete) {
|
||||
let animationDoneId = this._grid.connect('animation-done', Lang.bind(this,
|
||||
function () {
|
||||
this._grid.disconnect(animationDoneId);
|
||||
onComplete();
|
||||
}));
|
||||
let animationDoneId = this._grid.connect('animation-done', () => {
|
||||
this._grid.disconnect(animationDoneId);
|
||||
onComplete();
|
||||
});
|
||||
}
|
||||
|
||||
if (animationDirection == IconGrid.AnimationDirection.IN) {
|
||||
@ -244,7 +242,7 @@ var BaseAppView = new Lang.Class({
|
||||
} else {
|
||||
params.opacity = 0;
|
||||
params.delay = 0;
|
||||
params.onComplete = Lang.bind(this, function() { this.actor.hide() });
|
||||
params.onComplete = () => { this.actor.hide(); };
|
||||
}
|
||||
|
||||
Tweener.addTween(this._grid.actor, params);
|
||||
@ -284,11 +282,9 @@ var PageIndicators = new Lang.Class({
|
||||
this._nPages = 0;
|
||||
this._currentPage = undefined;
|
||||
|
||||
this.actor.connect('notify::mapped',
|
||||
Lang.bind(this, function() {
|
||||
this.animateIndicators(IconGrid.AnimationDirection.IN);
|
||||
})
|
||||
);
|
||||
this.actor.connect('notify::mapped', () => {
|
||||
this.animateIndicators(IconGrid.AnimationDirection.IN);
|
||||
});
|
||||
},
|
||||
|
||||
setNPages(nPages) {
|
||||
@ -306,10 +302,9 @@ var PageIndicators = new Lang.Class({
|
||||
toggle_mode: true,
|
||||
checked: pageIndex == this._currentPage });
|
||||
indicator.child = new St.Widget({ style_class: 'page-indicator-icon' });
|
||||
indicator.connect('clicked', Lang.bind(this,
|
||||
function() {
|
||||
this.emit('page-activated', pageIndex);
|
||||
}));
|
||||
indicator.connect('clicked', () => {
|
||||
this.emit('page-activated', pageIndex);
|
||||
});
|
||||
this.actor.add_actor(indicator);
|
||||
}
|
||||
} else {
|
||||
@ -391,10 +386,10 @@ var AllView = new Lang.Class({
|
||||
this._adjustment = this._scrollView.vscroll.adjustment;
|
||||
|
||||
this._pageIndicators = new PageIndicators();
|
||||
this._pageIndicators.connect('page-activated', Lang.bind(this,
|
||||
function(indicators, pageIndex) {
|
||||
this._pageIndicators.connect('page-activated',
|
||||
(indicators, pageIndex) => {
|
||||
this.goToPage(pageIndex);
|
||||
}));
|
||||
});
|
||||
this._pageIndicators.actor.connect('scroll-event', Lang.bind(this, this._onScroll));
|
||||
this.actor.add_actor(this._pageIndicators.actor);
|
||||
|
||||
@ -421,7 +416,7 @@ var AllView = new Lang.Class({
|
||||
this._scrollView.add_action(panAction);
|
||||
this._panning = false;
|
||||
this._clickAction = new Clutter.ClickAction();
|
||||
this._clickAction.connect('clicked', Lang.bind(this, function() {
|
||||
this._clickAction.connect('clicked', () => {
|
||||
if (!this._currentPopup)
|
||||
return;
|
||||
|
||||
@ -429,7 +424,7 @@ var AllView = new Lang.Class({
|
||||
let actor = global.stage.get_actor_at_pos(Clutter.PickMode.ALL, x, y);
|
||||
if (!this._currentPopup.actor.contains(actor))
|
||||
this._currentPopup.popdown();
|
||||
}));
|
||||
});
|
||||
this._eventBlocker.add_action(this._clickAction);
|
||||
|
||||
this._displayingPopup = false;
|
||||
@ -437,45 +432,39 @@ var AllView = new Lang.Class({
|
||||
this._availWidth = 0;
|
||||
this._availHeight = 0;
|
||||
|
||||
Main.overview.connect('hidden', Lang.bind(this,
|
||||
function() {
|
||||
this.goToPage(0);
|
||||
}));
|
||||
this._grid.connect('space-opened', Lang.bind(this,
|
||||
function() {
|
||||
let fadeEffect = this._scrollView.get_effect('fade');
|
||||
if (fadeEffect)
|
||||
fadeEffect.enabled = false;
|
||||
Main.overview.connect('hidden', () => { this.goToPage(0); });
|
||||
this._grid.connect('space-opened', () => {
|
||||
let fadeEffect = this._scrollView.get_effect('fade');
|
||||
if (fadeEffect)
|
||||
fadeEffect.enabled = false;
|
||||
|
||||
this.emit('space-ready');
|
||||
}));
|
||||
this._grid.connect('space-closed', Lang.bind(this,
|
||||
function() {
|
||||
this._displayingPopup = false;
|
||||
}));
|
||||
this.emit('space-ready');
|
||||
});
|
||||
this._grid.connect('space-closed', () => {
|
||||
this._displayingPopup = false;
|
||||
});
|
||||
|
||||
this.actor.connect('notify::mapped', Lang.bind(this,
|
||||
function() {
|
||||
if (this.actor.mapped) {
|
||||
this._keyPressEventId =
|
||||
global.stage.connect('key-press-event',
|
||||
Lang.bind(this, this._onKeyPressEvent));
|
||||
} else {
|
||||
if (this._keyPressEventId)
|
||||
global.stage.disconnect(this._keyPressEventId);
|
||||
this._keyPressEventId = 0;
|
||||
}
|
||||
}));
|
||||
this.actor.connect('notify::mapped', () => {
|
||||
if (this.actor.mapped) {
|
||||
this._keyPressEventId =
|
||||
global.stage.connect('key-press-event',
|
||||
Lang.bind(this, this._onKeyPressEvent));
|
||||
} else {
|
||||
if (this._keyPressEventId)
|
||||
global.stage.disconnect(this._keyPressEventId);
|
||||
this._keyPressEventId = 0;
|
||||
}
|
||||
});
|
||||
|
||||
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);
|
||||
}));
|
||||
});
|
||||
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);
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
removeAll() {
|
||||
@ -495,43 +484,41 @@ var AllView = new Lang.Class({
|
||||
},
|
||||
|
||||
_refilterApps() {
|
||||
this._allItems.forEach(function(icon) {
|
||||
this._allItems.forEach(icon => {
|
||||
if (icon instanceof AppIcon)
|
||||
icon.actor.visible = true;
|
||||
});
|
||||
|
||||
this.folderIcons.forEach(Lang.bind(this, function(folder) {
|
||||
this.folderIcons.forEach(folder => {
|
||||
let folderApps = folder.getAppIds();
|
||||
folderApps.forEach(Lang.bind(this, function(appId) {
|
||||
folderApps.forEach(appId => {
|
||||
let appIcon = this._items[appId];
|
||||
appIcon.actor.visible = false;
|
||||
}));
|
||||
}));
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
_loadApps() {
|
||||
let apps = Gio.AppInfo.get_all().filter(function(appInfo) {
|
||||
let apps = Gio.AppInfo.get_all().filter(appInfo => {
|
||||
try {
|
||||
let id = appInfo.get_id(); // catch invalid file encodings
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
return appInfo.should_show();
|
||||
}).map(function(app) {
|
||||
return app.get_id();
|
||||
});
|
||||
}).map(app => app.get_id());
|
||||
|
||||
let appSys = Shell.AppSystem.get_default();
|
||||
|
||||
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 icon = new FolderIcon(id, path, this);
|
||||
icon.connect('name-changed', Lang.bind(this, this._itemNameChanged));
|
||||
icon.connect('apps-changed', Lang.bind(this, this._refilterApps));
|
||||
this.addItem(icon);
|
||||
this.folderIcons.push(icon);
|
||||
}));
|
||||
});
|
||||
|
||||
// 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
|
||||
@ -541,13 +528,13 @@ var AllView = new Lang.Class({
|
||||
// but we hope that is not used much.
|
||||
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 icon = new AppIcon(app,
|
||||
{ isDraggable: favoritesWritable });
|
||||
this.addItem(icon);
|
||||
}));
|
||||
});
|
||||
|
||||
this.loadGrid();
|
||||
this._refilterApps();
|
||||
@ -556,24 +543,23 @@ var AllView = new Lang.Class({
|
||||
// Overriden from BaseAppView
|
||||
animate(animationDirection, onComplete) {
|
||||
this._scrollView.reactive = false;
|
||||
let completionFunc = Lang.bind(this, function() {
|
||||
let completionFunc = () => {
|
||||
this._scrollView.reactive = true;
|
||||
if (onComplete)
|
||||
onComplete();
|
||||
});
|
||||
};
|
||||
|
||||
if (animationDirection == IconGrid.AnimationDirection.OUT &&
|
||||
this._displayingPopup && this._currentPopup) {
|
||||
this._currentPopup.popdown();
|
||||
let spaceClosedId = this._grid.connect('space-closed', Lang.bind(this,
|
||||
function() {
|
||||
this._grid.disconnect(spaceClosedId);
|
||||
// Given that we can't call this.parent() inside the
|
||||
// signal handler, call again animate which will
|
||||
// call the parent given that popup is already
|
||||
// closed.
|
||||
this.animate(animationDirection, completionFunc);
|
||||
}));
|
||||
let spaceClosedId = this._grid.connect('space-closed', () => {
|
||||
this._grid.disconnect(spaceClosedId);
|
||||
// Given that we can't call this.parent() inside the
|
||||
// signal handler, call again animate which will
|
||||
// call the parent given that popup is already
|
||||
// closed.
|
||||
this.animate(animationDirection, completionFunc);
|
||||
});
|
||||
} else {
|
||||
this.parent(animationDirection, completionFunc);
|
||||
if (animationDirection == IconGrid.AnimationDirection.OUT)
|
||||
@ -725,14 +711,13 @@ var AllView = new Lang.Class({
|
||||
|
||||
addFolderPopup(popup) {
|
||||
this._stack.add_actor(popup.actor);
|
||||
popup.connect('open-state-changed', Lang.bind(this,
|
||||
function(popup, isOpen) {
|
||||
this._eventBlocker.reactive = isOpen;
|
||||
this._currentPopup = isOpen ? popup : null;
|
||||
this._updateIconOpacities(isOpen);
|
||||
if(!isOpen)
|
||||
this._closeSpaceForPopup();
|
||||
}));
|
||||
popup.connect('open-state-changed', (popup, isOpen) => {
|
||||
this._eventBlocker.reactive = isOpen;
|
||||
this._currentPopup = isOpen ? popup : null;
|
||||
this._updateIconOpacities(isOpen);
|
||||
if(!isOpen)
|
||||
this._closeSpaceForPopup();
|
||||
});
|
||||
},
|
||||
|
||||
_keyFocusIn(icon) {
|
||||
@ -779,11 +764,10 @@ var AllView = new Lang.Class({
|
||||
if (this._availWidth != availWidth || this._availHeight != availHeight || oldNPages != this._grid.nPages()) {
|
||||
this._adjustment.value = 0;
|
||||
this._grid.currentPage = 0;
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this,
|
||||
function() {
|
||||
this._pageIndicators.setNPages(this._grid.nPages());
|
||||
this._pageIndicators.setCurrentPage(0);
|
||||
}));
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||
this._pageIndicators.setNPages(this._grid.nPages());
|
||||
this._pageIndicators.setCurrentPage(0);
|
||||
});
|
||||
}
|
||||
|
||||
this._availWidth = availWidth;
|
||||
@ -821,10 +805,10 @@ var FrequentView = new Lang.Class({
|
||||
|
||||
this._usage = Shell.AppUsage.get_default();
|
||||
|
||||
this.actor.connect('notify::mapped', Lang.bind(this, function() {
|
||||
this.actor.connect('notify::mapped', () => {
|
||||
if (this.actor.mapped)
|
||||
this._redisplay();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
hasUsefulData() {
|
||||
@ -951,18 +935,17 @@ var AppDisplay = new Lang.Class({
|
||||
let layout = new ControlsBoxLayout({ homogeneous: true });
|
||||
this._controls = new St.Widget({ style_class: 'app-view-controls',
|
||||
layout_manager: layout });
|
||||
this._controls.connect('notify::mapped', Lang.bind(this,
|
||||
function() {
|
||||
// controls are faded either with their parent or
|
||||
// explicitly in animate(); we can't know how they'll be
|
||||
// shown next, so make sure to restore their opacity
|
||||
// when they are hidden
|
||||
if (this._controls.mapped)
|
||||
return;
|
||||
this._controls.connect('notify::mapped', () => {
|
||||
// controls are faded either with their parent or
|
||||
// explicitly in animate(); we can't know how they'll be
|
||||
// shown next, so make sure to restore their opacity
|
||||
// when they are hidden
|
||||
if (this._controls.mapped)
|
||||
return;
|
||||
|
||||
Tweener.removeTweens(this._controls);
|
||||
this._controls.opacity = 255;
|
||||
}));
|
||||
Tweener.removeTweens(this._controls);
|
||||
this._controls.opacity = 255;
|
||||
});
|
||||
|
||||
layout.hookup_style(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);
|
||||
|
||||
let viewIndex = i;
|
||||
this._views[i].control.connect('clicked', Lang.bind(this,
|
||||
function(actor) {
|
||||
this._showView(viewIndex);
|
||||
global.settings.set_uint('app-picker-view', viewIndex);
|
||||
}));
|
||||
this._views[i].control.connect('clicked', actor => {
|
||||
this._showView(viewIndex);
|
||||
global.settings.set_uint('app-picker-view', viewIndex);
|
||||
});
|
||||
}
|
||||
let initialView = Math.min(global.settings.get_uint('app-picker-view'),
|
||||
this._views.length - 1);
|
||||
@ -989,10 +971,10 @@ var AppDisplay = new Lang.Class({
|
||||
Gio.DBus.system.watch_name(SWITCHEROO_BUS_NAME,
|
||||
Gio.BusNameWatcherFlags.NONE,
|
||||
Lang.bind(this, this._switcherooProxyAppeared),
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
this._switcherooProxy = null;
|
||||
this._updateDiscreteGpuAvailable();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_updateDiscreteGpuAvailable() {
|
||||
@ -1004,13 +986,13 @@ var AppDisplay = new Lang.Class({
|
||||
|
||||
_switcherooProxyAppeared() {
|
||||
this._switcherooProxy = new SwitcherooProxy(Gio.DBus.system, SWITCHEROO_BUS_NAME, SWITCHEROO_OBJECT_PATH,
|
||||
Lang.bind(this, function(proxy, error) {
|
||||
(proxy, error) => {
|
||||
if (error) {
|
||||
log(error.message);
|
||||
return;
|
||||
}
|
||||
this._updateDiscreteGpuAvailable();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
animate(animationDirection, onComplete) {
|
||||
@ -1053,9 +1035,7 @@ var AppDisplay = new Lang.Class({
|
||||
let enabled = this._privacySettings.get_boolean('remember-app-usage');
|
||||
this._views[Views.FREQUENT].control.visible = enabled;
|
||||
|
||||
let visibleViews = this._views.filter(function(v) {
|
||||
return v.control.visible;
|
||||
});
|
||||
let visibleViews = this._views.filter(v => v.control.visible);
|
||||
this._controls.visible = visibleViews.length > 1;
|
||||
|
||||
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 usage = Shell.AppUsage.get_default();
|
||||
let results = [];
|
||||
groups.forEach(function(group) {
|
||||
group = group.filter(function(appID) {
|
||||
groups.forEach(group => {
|
||||
group = group.filter(appID => {
|
||||
let app = Gio.DesktopAppInfo.new(appID);
|
||||
return app && app.should_show();
|
||||
});
|
||||
results = results.concat(group.sort(function(a, b) {
|
||||
return usage.compare('', a, b);
|
||||
}));
|
||||
results = results.concat(group.sort(
|
||||
(a, b) => usage.compare('', a, b)
|
||||
));
|
||||
});
|
||||
|
||||
results = results.concat(this._systemActions.getMatchingActions(terms));
|
||||
@ -1295,26 +1275,22 @@ var FolderIcon = new Lang.Class({
|
||||
|
||||
this.view = new FolderView();
|
||||
|
||||
this.actor.connect('clicked', Lang.bind(this,
|
||||
function() {
|
||||
this._ensurePopup();
|
||||
this.view.actor.vscroll.adjustment.value = 0;
|
||||
this._openSpaceForPopup();
|
||||
}));
|
||||
this.actor.connect('notify::mapped', Lang.bind(this,
|
||||
function() {
|
||||
if (!this.actor.mapped && this._popup)
|
||||
this._popup.popdown();
|
||||
}));
|
||||
this.actor.connect('clicked', () => {
|
||||
this._ensurePopup();
|
||||
this.view.actor.vscroll.adjustment.value = 0;
|
||||
this._openSpaceForPopup();
|
||||
});
|
||||
this.actor.connect('notify::mapped', () => {
|
||||
if (!this.actor.mapped && this._popup)
|
||||
this._popup.popdown();
|
||||
});
|
||||
|
||||
this._folder.connect('changed', Lang.bind(this, this._redisplay));
|
||||
this._redisplay();
|
||||
},
|
||||
|
||||
getAppIds() {
|
||||
return this.view.getAllItems().map(function(item) {
|
||||
return item.id;
|
||||
});
|
||||
return this.view.getAllItems().map(item => item.id);
|
||||
},
|
||||
|
||||
_updateName() {
|
||||
@ -1334,7 +1310,7 @@ var FolderIcon = new Lang.Class({
|
||||
|
||||
let excludedApps = this._folder.get_strv('excluded-apps');
|
||||
let appSys = Shell.AppSystem.get_default();
|
||||
let addAppId = (function addAppId(appId) {
|
||||
let addAppId = appId => {
|
||||
if (excludedApps.indexOf(appId) >= 0)
|
||||
return;
|
||||
|
||||
@ -1347,13 +1323,13 @@ var FolderIcon = new Lang.Class({
|
||||
|
||||
let icon = new AppIcon(app);
|
||||
this.view.addItem(icon);
|
||||
}).bind(this);
|
||||
};
|
||||
|
||||
let folderApps = this._folder.get_strv('apps');
|
||||
folderApps.forEach(addAppId);
|
||||
|
||||
let folderCategories = this._folder.get_strv('categories');
|
||||
Gio.AppInfo.get_all().forEach(function(appInfo) {
|
||||
Gio.AppInfo.get_all().forEach(appInfo => {
|
||||
let appCategories = _getCategories(appInfo);
|
||||
if (!_listsIntersect(folderCategories, appCategories))
|
||||
return;
|
||||
@ -1379,12 +1355,11 @@ var FolderIcon = new Lang.Class({
|
||||
},
|
||||
|
||||
_openSpaceForPopup() {
|
||||
let id = this._parentView.connect('space-ready', Lang.bind(this,
|
||||
function() {
|
||||
this._parentView.disconnect(id);
|
||||
this._popup.popup();
|
||||
this._updatePopupPosition();
|
||||
}));
|
||||
let id = this._parentView.connect('space-ready', () => {
|
||||
this._parentView.disconnect(id);
|
||||
this._popup.popup();
|
||||
this._updatePopupPosition();
|
||||
});
|
||||
this._parentView.openSpaceForPopup(this, this._boxPointerArrowside, this.view.nRowsDisplayedAtOnce());
|
||||
},
|
||||
|
||||
@ -1424,11 +1399,10 @@ var FolderIcon = new Lang.Class({
|
||||
if (!this._popup) {
|
||||
this._popup = new AppFolderPopup(this, this._boxPointerArrowside);
|
||||
this._parentView.addFolderPopup(this._popup);
|
||||
this._popup.connect('open-state-changed', Lang.bind(this,
|
||||
function(popup, isOpen) {
|
||||
if (!isOpen)
|
||||
this.actor.checked = false;
|
||||
}));
|
||||
this._popup.connect('open-state-changed', (popup, isOpen) => {
|
||||
if (!isOpen)
|
||||
this.actor.checked = false;
|
||||
});
|
||||
} else {
|
||||
this._popup.updateArrowSide(this._boxPointerArrowside);
|
||||
}
|
||||
@ -1490,10 +1464,7 @@ var AppFolderPopup = new Lang.Class({
|
||||
|
||||
global.focus_manager.add_group(this.actor);
|
||||
|
||||
source.actor.connect('destroy', Lang.bind(this,
|
||||
function() {
|
||||
this.actor.destroy();
|
||||
}));
|
||||
source.actor.connect('destroy', () => { this.actor.destroy(); });
|
||||
this._grabHelper = new GrabHelper.GrabHelper(this.actor);
|
||||
this._grabHelper.addActor(Main.layoutManager.overviewGroup);
|
||||
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._boxPointer.show(BoxPointer.PopupAnimation.FADE |
|
||||
BoxPointer.PopupAnimation.SLIDE,
|
||||
Lang.bind(this,
|
||||
function() {
|
||||
() => {
|
||||
this._view.actor.opacity = 255;
|
||||
this._view.animate(IconGrid.AnimationDirection.IN);
|
||||
}));
|
||||
});
|
||||
|
||||
this.emit('open-state-changed', true);
|
||||
},
|
||||
@ -1663,28 +1633,24 @@ var AppIcon = new Lang.Class({
|
||||
|
||||
if (isDraggable) {
|
||||
this._draggable = DND.makeDraggable(this.actor);
|
||||
this._draggable.connect('drag-begin', Lang.bind(this,
|
||||
function () {
|
||||
this._removeMenuTimeout();
|
||||
Main.overview.beginItemDrag(this);
|
||||
}));
|
||||
this._draggable.connect('drag-cancelled', Lang.bind(this,
|
||||
function () {
|
||||
Main.overview.cancelledItemDrag(this);
|
||||
}));
|
||||
this._draggable.connect('drag-end', Lang.bind(this,
|
||||
function () {
|
||||
Main.overview.endItemDrag(this);
|
||||
}));
|
||||
this._draggable.connect('drag-begin', () => {
|
||||
this._removeMenuTimeout();
|
||||
Main.overview.beginItemDrag(this);
|
||||
});
|
||||
this._draggable.connect('drag-cancelled', () => {
|
||||
Main.overview.cancelledItemDrag(this);
|
||||
});
|
||||
this._draggable.connect('drag-end', () => {
|
||||
Main.overview.endItemDrag(this);
|
||||
});
|
||||
}
|
||||
|
||||
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||
|
||||
this._menuTimeoutId = 0;
|
||||
this._stateChangedId = this.app.connect('notify::state', Lang.bind(this,
|
||||
function () {
|
||||
this._updateRunningStyle();
|
||||
}));
|
||||
this._stateChangedId = this.app.connect('notify::state', () => {
|
||||
this._updateRunningStyle();
|
||||
});
|
||||
this._updateRunningStyle();
|
||||
},
|
||||
|
||||
@ -1715,12 +1681,11 @@ var AppIcon = new Lang.Class({
|
||||
|
||||
_setPopupTimeout() {
|
||||
this._removeMenuTimeout();
|
||||
this._menuTimeoutId = Mainloop.timeout_add(MENU_POPUP_TIMEOUT,
|
||||
Lang.bind(this, function() {
|
||||
this._menuTimeoutId = 0;
|
||||
this.popupMenu();
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
this._menuTimeoutId = Mainloop.timeout_add(MENU_POPUP_TIMEOUT, () => {
|
||||
this._menuTimeoutId = 0;
|
||||
this.popupMenu();
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
GLib.Source.set_name_by_id(this._menuTimeoutId, '[gnome-shell] this.popupMenu');
|
||||
},
|
||||
|
||||
@ -1770,15 +1735,17 @@ var AppIcon = new Lang.Class({
|
||||
|
||||
if (!this._menu) {
|
||||
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._menu.connect('open-state-changed', Lang.bind(this, function (menu, isPoppedUp) {
|
||||
});
|
||||
this._menu.connect('open-state-changed', (menu, isPoppedUp) => {
|
||||
if (!isPoppedUp)
|
||||
this._onMenuPoppedDown();
|
||||
}));
|
||||
let id = Main.overview.connect('hiding', Lang.bind(this, function () { this._menu.close(); }));
|
||||
this.actor.connect('destroy', function() {
|
||||
});
|
||||
let id = Main.overview.connect('hiding', () => {
|
||||
this._menu.close();
|
||||
});
|
||||
this.actor.connect('destroy', () => {
|
||||
Main.overview.disconnect(id);
|
||||
});
|
||||
|
||||
@ -1888,9 +1855,9 @@ var AppIconMenu = new Lang.Class({
|
||||
_redisplay() {
|
||||
this.removeAll();
|
||||
|
||||
let windows = this._source.app.get_windows().filter(function(w) {
|
||||
return !w.skip_taskbar;
|
||||
});
|
||||
let windows = this._source.app.get_windows().filter(
|
||||
w => !w.skip_taskbar
|
||||
);
|
||||
|
||||
// Display the app windows menu items and the separator between windows
|
||||
// of the current desktop and other windows.
|
||||
@ -1904,9 +1871,9 @@ var AppIconMenu = new Lang.Class({
|
||||
separatorShown = true;
|
||||
}
|
||||
let item = this._appendMenuItem(window.title);
|
||||
item.connect('activate', Lang.bind(this, function() {
|
||||
item.connect('activate', () => {
|
||||
this.emit('activate-window', window);
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
if (!this._source.app.is_window_backed()) {
|
||||
@ -1917,13 +1884,13 @@ var AppIconMenu = new Lang.Class({
|
||||
if (this._source.app.can_open_new_window() &&
|
||||
actions.indexOf('new-window') == -1) {
|
||||
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)
|
||||
this._source.animateLaunch();
|
||||
|
||||
this._source.app.open_new_window(-1);
|
||||
this.emit('activate-window', null);
|
||||
}));
|
||||
});
|
||||
this._appendSeparator();
|
||||
}
|
||||
|
||||
@ -1931,22 +1898,22 @@ var AppIconMenu = new Lang.Class({
|
||||
this._source.app.state == Shell.AppState.STOPPED &&
|
||||
actions.indexOf('activate-discrete-gpu') == -1) {
|
||||
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)
|
||||
this._source.animateLaunch();
|
||||
|
||||
this._source.app.launch(0, -1, true);
|
||||
this.emit('activate-window', null);
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
for (let i = 0; i < actions.length; i++) {
|
||||
let action = actions[i];
|
||||
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.emit('activate-window', null);
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
let canFavorite = global.settings.is_writable('favorite-apps');
|
||||
@ -1958,37 +1925,36 @@ var AppIconMenu = new Lang.Class({
|
||||
|
||||
if (isFavorite) {
|
||||
let item = this._appendMenuItem(_("Remove from Favorites"));
|
||||
item.connect('activate', Lang.bind(this, function() {
|
||||
item.connect('activate', () => {
|
||||
let favs = AppFavorites.getAppFavorites();
|
||||
favs.removeFavorite(this._source.app.get_id());
|
||||
}));
|
||||
});
|
||||
} else {
|
||||
let item = this._appendMenuItem(_("Add to Favorites"));
|
||||
item.connect('activate', Lang.bind(this, function() {
|
||||
item.connect('activate', () => {
|
||||
let favs = AppFavorites.getAppFavorites();
|
||||
favs.addFavorite(this._source.app.get_id());
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (Shell.AppSystem.get_default().lookup_app('org.gnome.Software.desktop')) {
|
||||
this._appendSeparator();
|
||||
let item = this._appendMenuItem(_("Show Details"));
|
||||
item.connect('activate', Lang.bind(this, function() {
|
||||
item.connect('activate', () => {
|
||||
let id = this._source.app.get_id();
|
||||
let args = GLib.Variant.new('(ss)', [id, '']);
|
||||
Gio.DBus.get(Gio.BusType.SESSION, null,
|
||||
function(o, res) {
|
||||
let bus = Gio.DBus.get_finish(res);
|
||||
bus.call('org.gnome.Software',
|
||||
'/org/gnome/Software',
|
||||
'org.gtk.Actions', 'Activate',
|
||||
GLib.Variant.new('(sava{sv})',
|
||||
['details', [args], null]),
|
||||
null, 0, -1, null, null);
|
||||
Main.overview.hide();
|
||||
});
|
||||
}));
|
||||
Gio.DBus.get(Gio.BusType.SESSION, null, (o, res) => {
|
||||
let bus = Gio.DBus.get_finish(res);
|
||||
bus.call('org.gnome.Software',
|
||||
'/org/gnome/Software',
|
||||
'org.gtk.Actions', 'Activate',
|
||||
GLib.Variant.new('(sava{sv})',
|
||||
['details', [args], null]),
|
||||
null, 0, -1, null, null);
|
||||
Main.overview.hide();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -66,7 +66,7 @@ var AppFavorites = new Lang.Class({
|
||||
|
||||
// Map old desktop file names to the current ones
|
||||
let updated = false;
|
||||
ids = ids.map(function (id) {
|
||||
ids = ids.map(id => {
|
||||
let newId = RENAMED_DESKTOP_IDS[id];
|
||||
if (newId !== undefined &&
|
||||
appSys.lookup_app(newId) != null) {
|
||||
@ -79,11 +79,8 @@ var AppFavorites = new Lang.Class({
|
||||
if (updated)
|
||||
global.settings.set_strv(this.FAVORITE_APPS_KEY, ids);
|
||||
|
||||
let apps = ids.map(function (id) {
|
||||
return appSys.lookup_app(id);
|
||||
}).filter(function (app) {
|
||||
return app != null;
|
||||
});
|
||||
let apps = ids.map(id => appSys.lookup_app(id))
|
||||
.filter(app => app != null);
|
||||
this._favorites = {};
|
||||
for (let i = 0; i < apps.length; 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()),
|
||||
{ forFeedback: true,
|
||||
undoCallback: Lang.bind(this, function () {
|
||||
this._removeFavorite(appId);
|
||||
})
|
||||
undoCallback: () => {
|
||||
this._removeFavorite(appId);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@ -159,7 +156,7 @@ var AppFavorites = new Lang.Class({
|
||||
if (!appId in this._favorites)
|
||||
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);
|
||||
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()),
|
||||
{ forFeedback: true,
|
||||
undoCallback: Lang.bind(this, function () {
|
||||
this._addFavorite(appId, pos);
|
||||
})
|
||||
undoCallback: () => {
|
||||
this._addFavorite(appId, pos);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -101,13 +101,11 @@ var AudioDeviceSelectionDialog = new Lang.Class({
|
||||
_addDevice(device) {
|
||||
let box = new St.BoxLayout({ style_class: 'audio-selection-device-box',
|
||||
vertical: true });
|
||||
box.connect('notify::height',
|
||||
function() {
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
|
||||
function() {
|
||||
box.width = box.height;
|
||||
});
|
||||
box.connect('notify::height', () => {
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||
box.width = box.height;
|
||||
});
|
||||
});
|
||||
|
||||
let icon = new St.Icon({ style_class: 'audio-selection-device-icon',
|
||||
icon_name: this._getDeviceIcon(device) });
|
||||
@ -123,12 +121,11 @@ var AudioDeviceSelectionDialog = new Lang.Class({
|
||||
child: box });
|
||||
this._selectionBox.add(button);
|
||||
|
||||
button.connect('clicked', Lang.bind(this,
|
||||
function() {
|
||||
this.emit('device-selected', device);
|
||||
this.close();
|
||||
Main.overview.hide();
|
||||
}));
|
||||
button.connect('clicked', () => {
|
||||
this.emit('device-selected', device);
|
||||
this.close();
|
||||
Main.overview.hide();
|
||||
});
|
||||
},
|
||||
|
||||
_openSettings() {
|
||||
@ -166,9 +163,8 @@ var AudioDeviceSelectionDBus = new Lang.Class({
|
||||
let connection = this._dbusImpl.get_connection();
|
||||
let info = this._dbusImpl.get_info();
|
||||
let deviceName = Object.keys(AudioDevice).filter(
|
||||
function(dev) {
|
||||
return AudioDevice[dev] == device;
|
||||
})[0].toLowerCase();
|
||||
dev => AudioDevice[dev] == device
|
||||
)[0].toLowerCase();
|
||||
connection.emit_signal(this._audioSelectionDialog._sender,
|
||||
this._dbusImpl.get_object_path(),
|
||||
info ? info.name : null,
|
||||
@ -184,9 +180,7 @@ var AudioDeviceSelectionDBus = new Lang.Class({
|
||||
|
||||
let [deviceNames] = params;
|
||||
let devices = 0;
|
||||
deviceNames.forEach(function(n) {
|
||||
devices |= AudioDevice[n.toUpperCase()];
|
||||
});
|
||||
deviceNames.forEach(n => { devices |= AudioDevice[n.toUpperCase()]; });
|
||||
|
||||
let dialog;
|
||||
try {
|
||||
|
@ -154,13 +154,13 @@ var BackgroundCache = new Lang.Class({
|
||||
|
||||
let monitor = file.monitor(Gio.FileMonitorFlags.NONE, null);
|
||||
monitor.connect('changed',
|
||||
Lang.bind(this, function(obj, file, otherFile, eventType) {
|
||||
(obj, file, otherFile, eventType) => {
|
||||
// Ignore CHANGED and CREATED events, since in both cases
|
||||
// we'll get a CHANGES_DONE_HINT event when done.
|
||||
if (eventType != Gio.FileMonitorEvent.CHANGED &&
|
||||
eventType != Gio.FileMonitorEvent.CREATED)
|
||||
this.emit('file-changed', file);
|
||||
}));
|
||||
});
|
||||
|
||||
this._fileMonitors[key] = monitor;
|
||||
},
|
||||
@ -173,10 +173,10 @@ var BackgroundCache = new Lang.Class({
|
||||
let animation = this._animations[params.settingsSchema];
|
||||
if (animation && _fileEqual0(animation.file, params.file)) {
|
||||
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]);
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
GLib.Source.set_name_by_id(id, '[gnome-shell] params.onLoaded');
|
||||
}
|
||||
return;
|
||||
@ -184,17 +184,17 @@ var BackgroundCache = new Lang.Class({
|
||||
|
||||
animation = new Animation({ file: params.file });
|
||||
|
||||
animation.load(Lang.bind(this, function() {
|
||||
this._animations[params.settingsSchema] = animation;
|
||||
animation.load(() => {
|
||||
this._animations[params.settingsSchema] = animation;
|
||||
|
||||
if (params.onLoaded) {
|
||||
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, function() {
|
||||
params.onLoaded(this._animations[params.settingsSchema]);
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
GLib.Source.set_name_by_id(id, '[gnome-shell] params.onLoaded');
|
||||
}
|
||||
}));
|
||||
if (params.onLoaded) {
|
||||
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
|
||||
params.onLoaded(this._animations[params.settingsSchema]);
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
GLib.Source.set_name_by_id(id, '[gnome-shell] params.onLoaded');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getBackgroundSource(layoutManager, settingsSchema) {
|
||||
@ -254,10 +254,10 @@ var Background = new Lang.Class({
|
||||
|
||||
this._clock = new GnomeDesktop.WallClock();
|
||||
this._timezoneChangedId = this._clock.connect('notify::timezone',
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
if (this._animation)
|
||||
this._loadAnimation(this._animation.file);
|
||||
}));
|
||||
});
|
||||
|
||||
let loginManager = LoginManager.getLoginManager();
|
||||
this._prepareForSleepId = loginManager.connect('prepare-for-sleep',
|
||||
@ -267,9 +267,9 @@ var Background = new Lang.Class({
|
||||
this._refreshAnimation();
|
||||
});
|
||||
|
||||
this._settingsChangedSignalId = this._settings.connect('changed', Lang.bind(this, function() {
|
||||
this.emit('changed');
|
||||
}));
|
||||
this._settingsChangedSignalId = this._settings.connect('changed', () => {
|
||||
this.emit('changed');
|
||||
});
|
||||
|
||||
this._load();
|
||||
},
|
||||
@ -319,10 +319,10 @@ var Background = new Lang.Class({
|
||||
|
||||
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');
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
GLib.Source.set_name_by_id(id, '[gnome-shell] this.emit');
|
||||
},
|
||||
|
||||
@ -349,13 +349,13 @@ var Background = new Lang.Class({
|
||||
|
||||
this._cache.monitorFile(file);
|
||||
let signalId = this._cache.connect('file-changed',
|
||||
Lang.bind(this, function(cache, changedFile) {
|
||||
(cache, changedFile) => {
|
||||
if (changedFile.equal(file)) {
|
||||
let imageCache = Meta.BackgroundImageCache.get_default();
|
||||
imageCache.purge(changedFile);
|
||||
this.emit('changed');
|
||||
}
|
||||
}));
|
||||
});
|
||||
this._fileWatches[key] = signalId;
|
||||
},
|
||||
|
||||
@ -372,7 +372,7 @@ var Background = new Lang.Class({
|
||||
this._animation.update(this._layoutManager.monitors[this._monitorIndex]);
|
||||
let files = this._animation.keyFrameFiles;
|
||||
|
||||
let finish = Lang.bind(this, function() {
|
||||
let finish = () => {
|
||||
this._setLoaded();
|
||||
if (files.length > 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._queueUpdateAnimation();
|
||||
});
|
||||
};
|
||||
|
||||
let cache = Meta.BackgroundImageCache.get_default();
|
||||
let numPendingImages = files.length;
|
||||
@ -396,13 +396,12 @@ var Background = new Lang.Class({
|
||||
if (numPendingImages == 0)
|
||||
finish();
|
||||
} else {
|
||||
let id = image.connect('loaded',
|
||||
Lang.bind(this, function() {
|
||||
image.disconnect(id);
|
||||
numPendingImages--;
|
||||
if (numPendingImages == 0)
|
||||
finish();
|
||||
}));
|
||||
let id = image.connect('loaded', () => {
|
||||
image.disconnect(id);
|
||||
numPendingImages--;
|
||||
if (numPendingImages == 0)
|
||||
finish();
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -428,18 +427,18 @@ var Background = new Lang.Class({
|
||||
|
||||
this._updateAnimationTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
|
||||
interval,
|
||||
Lang.bind(this, function() {
|
||||
this._updateAnimationTimeoutId = 0;
|
||||
this._updateAnimation();
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
() => {
|
||||
this._updateAnimationTimeoutId = 0;
|
||||
this._updateAnimation();
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
GLib.Source.set_name_by_id(this._updateAnimationTimeoutId, '[gnome-shell] this._updateAnimation');
|
||||
},
|
||||
|
||||
_loadAnimation(file) {
|
||||
this._cache.getAnimation({ file: file,
|
||||
settingsSchema: this._settings.schema_id,
|
||||
onLoaded: Lang.bind(this, function(animation) {
|
||||
onLoaded: animation => {
|
||||
this._animation = animation;
|
||||
|
||||
if (!this._animation || this._cancellable.is_cancelled()) {
|
||||
@ -449,7 +448,7 @@ var Background = new Lang.Class({
|
||||
|
||||
this._updateAnimation();
|
||||
this._watchFile(file);
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@ -462,11 +461,10 @@ var Background = new Lang.Class({
|
||||
if (image.is_loaded())
|
||||
this._setLoaded();
|
||||
else {
|
||||
let id = image.connect('loaded',
|
||||
Lang.bind(this, function() {
|
||||
this._setLoaded();
|
||||
image.disconnect(id);
|
||||
}));
|
||||
let id = image.connect('loaded', () => {
|
||||
this._setLoaded();
|
||||
image.disconnect(id);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@ -514,18 +512,17 @@ var SystemBackground = new Lang.Class({
|
||||
let image = cache.load(file);
|
||||
if (image.is_loaded()) {
|
||||
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');
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
GLib.Source.set_name_by_id(id, '[gnome-shell] SystemBackground.loaded');
|
||||
} else {
|
||||
let id = image.connect('loaded',
|
||||
Lang.bind(this, function() {
|
||||
this.emit('loaded');
|
||||
image.disconnect(id);
|
||||
image = null;
|
||||
}));
|
||||
let id = image.connect('loaded', () => {
|
||||
this.emit('loaded');
|
||||
image.disconnect(id);
|
||||
image = null;
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
@ -594,11 +591,11 @@ var BackgroundSource = new Lang.Class({
|
||||
style: style
|
||||
});
|
||||
|
||||
background._changedId = background.connect('changed', Lang.bind(this, function() {
|
||||
background._changedId = background.connect('changed', () => {
|
||||
background.disconnect(background._changedId);
|
||||
background.destroy();
|
||||
delete this._backgrounds[monitorIndex];
|
||||
}));
|
||||
});
|
||||
|
||||
this._backgrounds[monitorIndex] = background;
|
||||
}
|
||||
@ -635,13 +632,11 @@ var Animation = new Lang.Class({
|
||||
load(callback) {
|
||||
this._show = new GnomeDesktop.BGSlideShow({ filename: this.file.get_path() });
|
||||
|
||||
this._show.load_async(null,
|
||||
Lang.bind(this,
|
||||
function(object, result) {
|
||||
this.loaded = true;
|
||||
if (callback)
|
||||
callback();
|
||||
}));
|
||||
this._show.load_async(null, (object, result) => {
|
||||
this.loaded = true;
|
||||
if (callback)
|
||||
callback();
|
||||
});
|
||||
},
|
||||
|
||||
update(monitor) {
|
||||
@ -745,13 +740,12 @@ var BackgroundManager = new Lang.Class({
|
||||
this._swapBackgroundActor();
|
||||
} else {
|
||||
newBackgroundActor.loadedSignalId = background.connect('loaded',
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
background.disconnect(newBackgroundActor.loadedSignalId);
|
||||
newBackgroundActor.loadedSignalId = 0;
|
||||
|
||||
this._swapBackgroundActor();
|
||||
|
||||
}));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@ -775,19 +769,19 @@ var BackgroundManager = new Lang.Class({
|
||||
backgroundActor.lower_bottom();
|
||||
}
|
||||
|
||||
let changeSignalId = background.connect('changed', Lang.bind(this, function() {
|
||||
let changeSignalId = background.connect('changed', () => {
|
||||
background.disconnect(changeSignalId);
|
||||
changeSignalId = null;
|
||||
this._updateBackgroundActor();
|
||||
}));
|
||||
});
|
||||
|
||||
backgroundActor.connect('destroy', Lang.bind(this, function() {
|
||||
backgroundActor.connect('destroy', () => {
|
||||
if (changeSignalId)
|
||||
background.disconnect(changeSignalId);
|
||||
|
||||
if (backgroundActor.loadedSignalId)
|
||||
background.disconnect(backgroundActor.loadedSignalId);
|
||||
}));
|
||||
});
|
||||
|
||||
return backgroundActor;
|
||||
},
|
||||
|
@ -40,7 +40,7 @@ function addBackgroundMenu(actor, layoutManager) {
|
||||
}
|
||||
|
||||
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)
|
||||
return ((action.get_button() == 0 ||
|
||||
action.get_button() == 1) &&
|
||||
@ -52,7 +52,7 @@ function addBackgroundMenu(actor, layoutManager) {
|
||||
}
|
||||
return true;
|
||||
});
|
||||
clickAction.connect('clicked', function(action) {
|
||||
clickAction.connect('clicked', action => {
|
||||
if (action.get_button() == 3) {
|
||||
let [x, y] = action.get_coords();
|
||||
openMenu(x, y);
|
||||
@ -60,11 +60,11 @@ function addBackgroundMenu(actor, layoutManager) {
|
||||
});
|
||||
actor.add_action(clickAction);
|
||||
|
||||
let grabOpBeginId = global.display.connect('grab-op-begin', function () {
|
||||
let grabOpBeginId = global.display.connect('grab-op-begin', () => {
|
||||
clickAction.release();
|
||||
});
|
||||
|
||||
actor.connect('destroy', function() {
|
||||
actor.connect('destroy', () => {
|
||||
actor._backgroundMenu.destroy();
|
||||
actor._backgroundMenu = null;
|
||||
actor._backgroundManager = null;
|
||||
|
@ -69,7 +69,7 @@ var BoxPointer = new Lang.Class({
|
||||
_muteInput() {
|
||||
if (this._capturedEventId == 0)
|
||||
this._capturedEventId = this.actor.connect('captured-event',
|
||||
function() { return Clutter.EVENT_STOP; });
|
||||
() => Clutter.EVENT_STOP);
|
||||
},
|
||||
|
||||
_unmuteInput() {
|
||||
@ -112,11 +112,11 @@ var BoxPointer = new Lang.Class({
|
||||
xOffset: 0,
|
||||
yOffset: 0,
|
||||
transition: 'linear',
|
||||
onComplete: Lang.bind(this, function() {
|
||||
onComplete: () => {
|
||||
this._unmuteInput();
|
||||
if (onComplete)
|
||||
onComplete();
|
||||
}),
|
||||
},
|
||||
time: animationTime });
|
||||
},
|
||||
|
||||
@ -156,14 +156,14 @@ var BoxPointer = new Lang.Class({
|
||||
yOffset: yOffset,
|
||||
transition: 'linear',
|
||||
time: animationTime,
|
||||
onComplete: Lang.bind(this, function () {
|
||||
onComplete: () => {
|
||||
this.actor.hide();
|
||||
this.opacity = 0;
|
||||
this.xOffset = 0;
|
||||
this.yOffset = 0;
|
||||
if (onComplete)
|
||||
onComplete();
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@ -623,10 +623,10 @@ var BoxPointer = new Lang.Class({
|
||||
if (this._arrowSide != arrowSide) {
|
||||
this._arrowSide = arrowSide;
|
||||
this._reposition();
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() {
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||
this._container.queue_relayout();
|
||||
return false;
|
||||
}));
|
||||
});
|
||||
|
||||
this.emit('arrow-side-changed');
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ var ELLIPSIS_CHAR = '\u2026';
|
||||
|
||||
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) {
|
||||
return (dateA.getYear() == dateB.getYear());
|
||||
@ -188,14 +188,13 @@ var DBusEventSource = new Lang.Class({
|
||||
|
||||
let savedState = global.get_persistent_state('as', 'ignored_events');
|
||||
if (savedState)
|
||||
savedState.deep_unpack().forEach(Lang.bind(this,
|
||||
function(eventId) {
|
||||
this._ignoredEvents.set(eventId, true);
|
||||
}));
|
||||
savedState.deep_unpack().forEach(eventId => {
|
||||
this._ignoredEvents.set(eventId, true);
|
||||
});
|
||||
|
||||
this._initialized = false;
|
||||
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;
|
||||
|
||||
try {
|
||||
@ -218,23 +217,23 @@ var DBusEventSource = new Lang.Class({
|
||||
|
||||
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)
|
||||
this._onNameAppeared();
|
||||
else
|
||||
this._onNameVanished();
|
||||
}));
|
||||
});
|
||||
|
||||
this._dbusProxy.connect('g-properties-changed', Lang.bind(this, function() {
|
||||
this._dbusProxy.connect('g-properties-changed', () => {
|
||||
this.emit('notify::has-calendars');
|
||||
}));
|
||||
});
|
||||
|
||||
this._initialized = loaded;
|
||||
if (loaded) {
|
||||
this.emit('notify::has-calendars');
|
||||
this._onNameAppeared();
|
||||
}
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
destroy() {
|
||||
@ -283,9 +282,7 @@ var DBusEventSource = new Lang.Class({
|
||||
let event = new CalendarEvent(id, date, end, summary, allDay);
|
||||
newEvents.push(event);
|
||||
}
|
||||
newEvents.sort(function(event1, event2) {
|
||||
return event1.date.getTime() - event2.date.getTime();
|
||||
});
|
||||
newEvents.sort((ev1, ev2) => ev1.date.getTime() - ev2.date.getTime());
|
||||
}
|
||||
|
||||
this._events = newEvents;
|
||||
@ -340,7 +337,7 @@ var DBusEventSource = new Lang.Class({
|
||||
result.push(event);
|
||||
}
|
||||
}
|
||||
result.sort(function(event1, event2) {
|
||||
result.sort((event1, event2) => {
|
||||
// sort events by end time on ending day
|
||||
let d1 = event1.date < begin && event1.end <= end ? event1.end : event1.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.
|
||||
setEventSource(eventSource) {
|
||||
this._eventSource = eventSource;
|
||||
this._eventSource.connect('changed', Lang.bind(this, function() {
|
||||
this._eventSource.connect('changed', () => {
|
||||
this._rebuildCalendar();
|
||||
this._update();
|
||||
}));
|
||||
});
|
||||
this._rebuildCalendar();
|
||||
this._update();
|
||||
},
|
||||
@ -617,11 +614,11 @@ var Calendar = new Lang.Class({
|
||||
button.reactive = false;
|
||||
|
||||
button._date = new Date(iter);
|
||||
button.connect('clicked', Lang.bind(this, function() {
|
||||
button.connect('clicked', () => {
|
||||
this._shouldDateGrabFocus = true;
|
||||
this.setDate(button._date);
|
||||
this._shouldDateGrabFocus = false;
|
||||
}));
|
||||
});
|
||||
|
||||
let hasEvents = this._eventSource.hasEvents(iter);
|
||||
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))
|
||||
this._rebuildCalendar();
|
||||
|
||||
this._buttons.forEach(Lang.bind(this, function(button) {
|
||||
this._buttons.forEach(button => {
|
||||
if (sameDay(button._date, this._selectedDate)) {
|
||||
button.add_style_pseudo_class('selected');
|
||||
if (this._shouldDateGrabFocus)
|
||||
@ -699,7 +696,7 @@ var Calendar = new Lang.Class({
|
||||
}
|
||||
else
|
||||
button.remove_style_pseudo_class('selected');
|
||||
}));
|
||||
});
|
||||
}
|
||||
});
|
||||
Signals.addSignalMethods(Calendar.prototype);
|
||||
@ -773,16 +770,14 @@ var NotificationMessage = new Lang.Class({
|
||||
|
||||
this.setIcon(this._getIcon());
|
||||
|
||||
this.connect('close', Lang.bind(this,
|
||||
function() {
|
||||
this._closed = true;
|
||||
this.notification.destroy(MessageTray.NotificationDestroyedReason.DISMISSED);
|
||||
}));
|
||||
this._destroyId = notification.connect('destroy', Lang.bind(this,
|
||||
function() {
|
||||
if (!this._closed)
|
||||
this.close();
|
||||
}));
|
||||
this.connect('close', () => {
|
||||
this._closed = true;
|
||||
this.notification.destroy(MessageTray.NotificationDestroyedReason.DISMISSED);
|
||||
});
|
||||
this._destroyId = notification.connect('destroy', () => {
|
||||
if (!this._closed)
|
||||
this.close();
|
||||
});
|
||||
this._updatedId = notification.connect('updated',
|
||||
Lang.bind(this, this._onUpdated));
|
||||
},
|
||||
@ -890,9 +885,9 @@ var EventsSection = new Lang.Class({
|
||||
let event = events[i];
|
||||
|
||||
let message = new EventMessage(event, this._date);
|
||||
message.connect('close', Lang.bind(this, function() {
|
||||
message.connect('close', () => {
|
||||
this._ignoreEvent(event);
|
||||
}));
|
||||
});
|
||||
this.addMessage(message, false);
|
||||
}
|
||||
|
||||
@ -912,7 +907,7 @@ var EventsSection = new Lang.Class({
|
||||
let apps = Gio.AppInfo.get_recommended_for_type('text/calendar');
|
||||
if (apps && (apps.length > 0)) {
|
||||
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];
|
||||
} else {
|
||||
this._calendarApp = null;
|
||||
@ -959,9 +954,9 @@ var NotificationSection = new Lang.Class({
|
||||
this._nUrgent = 0;
|
||||
|
||||
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.actor.connect('notify::mapped', Lang.bind(this, this._onMapped));
|
||||
},
|
||||
@ -988,9 +983,9 @@ var NotificationSection = new Lang.Class({
|
||||
notificationAddedId: 0,
|
||||
};
|
||||
|
||||
obj.destroyId = source.connect('destroy', Lang.bind(this, function(source) {
|
||||
obj.destroyId = source.connect('destroy', source => {
|
||||
this._onSourceDestroy(source, obj);
|
||||
}));
|
||||
});
|
||||
obj.notificationAddedId = source.connect('notification-added',
|
||||
Lang.bind(this, this._onNotificationAdded));
|
||||
|
||||
@ -1003,18 +998,16 @@ var NotificationSection = new Lang.Class({
|
||||
|
||||
let isUrgent = notification.urgency == MessageTray.Urgency.CRITICAL;
|
||||
|
||||
let updatedId = notification.connect('updated', Lang.bind(this,
|
||||
function() {
|
||||
message.setSecondaryActor(this._createTimeLabel(notification.datetime));
|
||||
this.moveMessage(message, isUrgent ? 0 : this._nUrgent, this.actor.mapped);
|
||||
}));
|
||||
let destroyId = notification.connect('destroy', Lang.bind(this,
|
||||
function() {
|
||||
notification.disconnect(destroyId);
|
||||
notification.disconnect(updatedId);
|
||||
if (isUrgent)
|
||||
this._nUrgent--;
|
||||
}));
|
||||
let updatedId = notification.connect('updated', () => {
|
||||
message.setSecondaryActor(this._createTimeLabel(notification.datetime));
|
||||
this.moveMessage(message, isUrgent ? 0 : this._nUrgent, this.actor.mapped);
|
||||
});
|
||||
let destroyId = notification.connect('destroy', () => {
|
||||
notification.disconnect(destroyId);
|
||||
notification.disconnect(updatedId);
|
||||
if (isUrgent)
|
||||
this._nUrgent--;
|
||||
});
|
||||
|
||||
if (isUrgent) {
|
||||
// Keep track of urgent notifications to keep them on top
|
||||
@ -1157,10 +1150,9 @@ var CalendarMessageList = new Lang.Class({
|
||||
canClearChangedId: 0,
|
||||
keyFocusId: 0
|
||||
};
|
||||
obj.destroyId = section.actor.connect('destroy', Lang.bind(this,
|
||||
function() {
|
||||
this._removeSection(section);
|
||||
}));
|
||||
obj.destroyId = section.actor.connect('destroy', () => {
|
||||
this._removeSection(section);
|
||||
});
|
||||
obj.visibleId = section.actor.connect('notify::visible',
|
||||
Lang.bind(this, this._sync));
|
||||
obj.emptyChangedId = section.connect('empty-changed',
|
||||
@ -1194,22 +1186,16 @@ var CalendarMessageList = new Lang.Class({
|
||||
|
||||
_sync() {
|
||||
let sections = [...this._sections.keys()];
|
||||
let visible = sections.some(function(s) {
|
||||
return s.allowed;
|
||||
});
|
||||
let visible = sections.some(s => s.allowed);
|
||||
this.actor.visible = visible;
|
||||
if (!visible)
|
||||
return;
|
||||
|
||||
let empty = sections.every(function(s) {
|
||||
return s.empty || !s.actor.visible;
|
||||
});
|
||||
let empty = sections.every(s => s.empty || !s.actor.visible);
|
||||
this._placeholder.actor.visible = empty;
|
||||
this._clearButton.visible = !empty;
|
||||
|
||||
let canClear = sections.some(function(s) {
|
||||
return s.canClear && s.actor.visible;
|
||||
});
|
||||
let canClear = sections.some(s => s.canClear && s.actor.visible);
|
||||
this._clearButton.reactive = canClear;
|
||||
},
|
||||
|
||||
|
@ -107,9 +107,9 @@ var CloseDialog = new Lang.Class({
|
||||
{ scale_y: 1,
|
||||
transition: 'linear',
|
||||
time: DIALOG_TRANSITION_TIME,
|
||||
onComplete: Lang.bind(this, function () {
|
||||
onComplete: () => {
|
||||
Main.layoutManager.trackChrome(this._dialog, { affectsInputRegion: true });
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@ -125,9 +125,9 @@ var CloseDialog = new Lang.Class({
|
||||
{ scale_y: 0,
|
||||
transition: 'linear',
|
||||
time: DIALOG_TRANSITION_TIME,
|
||||
onComplete: Lang.bind(this, function () {
|
||||
onComplete: () => {
|
||||
dialog.destroy();
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -16,17 +16,17 @@ var ComponentManager = new Lang.Class({
|
||||
_sessionUpdated() {
|
||||
let newEnabledComponents = Main.sessionMode.components;
|
||||
|
||||
newEnabledComponents.filter(Lang.bind(this, function(name) {
|
||||
return this._enabledComponents.indexOf(name) == -1;
|
||||
})).forEach(Lang.bind(this, function(name) {
|
||||
newEnabledComponents.filter(
|
||||
name => this._enabledComponents.indexOf(name) == -1
|
||||
).forEach(name => {
|
||||
this._enableComponent(name);
|
||||
}));
|
||||
});
|
||||
|
||||
this._enabledComponents.filter(Lang.bind(this, function(name) {
|
||||
return newEnabledComponents.indexOf(name) == -1;
|
||||
})).forEach(Lang.bind(this, function(name) {
|
||||
this._enabledComponents.filter(
|
||||
name => newEnabledComponents.indexOf(name) == -1
|
||||
).forEach(name => {
|
||||
this._disableComponent(name);
|
||||
}));
|
||||
});
|
||||
|
||||
this._enabledComponents = newEnabledComponents;
|
||||
},
|
||||
|
@ -61,21 +61,20 @@ var AutomountManager = new Lang.Class({
|
||||
|
||||
_InhibitorsChanged(object, senderName, [inhibtor]) {
|
||||
this._session.IsInhibitedRemote(GNOME_SESSION_AUTOMOUNT_INHIBIT,
|
||||
Lang.bind(this,
|
||||
function(result, error) {
|
||||
if (!error) {
|
||||
this._inhibited = result[0];
|
||||
}
|
||||
}));
|
||||
(result, error) => {
|
||||
if (!error) {
|
||||
this._inhibited = result[0];
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_startupMountAll() {
|
||||
let volumes = this._volumeMonitor.get_volumes();
|
||||
volumes.forEach(Lang.bind(this, function(volume) {
|
||||
volumes.forEach(volume => {
|
||||
this._checkAndMountVolume(volume, { checkSession: false,
|
||||
useMountOp: false,
|
||||
allowAutorun: false });
|
||||
}));
|
||||
});
|
||||
|
||||
this._mountAllId = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
@ -114,23 +113,23 @@ var AutomountManager = new Lang.Class({
|
||||
if (drive.can_stop()) {
|
||||
drive.stop
|
||||
(Gio.MountUnmountFlags.FORCE, null, null,
|
||||
Lang.bind(this, function(drive, res) {
|
||||
(drive, res) => {
|
||||
try {
|
||||
drive.stop_finish(res);
|
||||
} catch (e) {
|
||||
log("Unable to stop the drive after drive-eject-button " + e.toString());
|
||||
}
|
||||
}));
|
||||
});
|
||||
} else if (drive.can_eject()) {
|
||||
drive.eject_with_operation
|
||||
(Gio.MountUnmountFlags.FORCE, null, null,
|
||||
Lang.bind(this, function(drive, res) {
|
||||
(drive, res) => {
|
||||
try {
|
||||
drive.eject_with_operation_finish(res);
|
||||
} catch (e) {
|
||||
log("Unable to eject the drive after drive-eject-button " + e.toString());
|
||||
}
|
||||
}));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@ -212,9 +211,7 @@ var AutomountManager = new Lang.Class({
|
||||
|
||||
_onVolumeRemoved(monitor, volume) {
|
||||
this._volumeQueue =
|
||||
this._volumeQueue.filter(function(element) {
|
||||
return (element != volume);
|
||||
});
|
||||
this._volumeQueue.filter(element => (element != volume));
|
||||
},
|
||||
|
||||
_reaskPassword(volume) {
|
||||
@ -235,7 +232,7 @@ var AutomountManager = new Lang.Class({
|
||||
},
|
||||
|
||||
_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;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
|
@ -129,9 +129,9 @@ var ContentTypeDiscoverer = new Lang.Class({
|
||||
|
||||
let hotplugSniffer = new HotplugSniffer();
|
||||
hotplugSniffer.SniffURIRemote(root.get_uri(),
|
||||
Lang.bind(this, function([contentTypes]) {
|
||||
([contentTypes]) => {
|
||||
this._emitCallback(mount, contentTypes);
|
||||
}));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@ -140,12 +140,12 @@ var ContentTypeDiscoverer = new Lang.Class({
|
||||
contentTypes = [];
|
||||
|
||||
// we're not interested in win32 software content types here
|
||||
contentTypes = contentTypes.filter(function(type) {
|
||||
return (type != 'x-content/win32-software');
|
||||
});
|
||||
contentTypes = contentTypes.filter(
|
||||
type => (type != 'x-content/win32-software')
|
||||
);
|
||||
|
||||
let apps = [];
|
||||
contentTypes.forEach(function(type) {
|
||||
contentTypes.forEach(type => {
|
||||
let app = Gio.app_info_get_default_for_type(type, false);
|
||||
|
||||
if (app)
|
||||
@ -185,9 +185,9 @@ var AutorunManager = new Lang.Class({
|
||||
if (!this._session.SessionIsActive)
|
||||
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);
|
||||
}));
|
||||
});
|
||||
discoverer.guessContentTypes(mount);
|
||||
},
|
||||
|
||||
@ -222,10 +222,7 @@ var AutorunDispatcher = new Lang.Class({
|
||||
},
|
||||
|
||||
_getSourceForMount(mount) {
|
||||
let filtered =
|
||||
this._sources.filter(function (source) {
|
||||
return (source.mount == mount);
|
||||
});
|
||||
let filtered = this._sources.filter(source => (source.mount == mount));
|
||||
|
||||
// we always make sure not to add two sources for the same
|
||||
// mount in addMount(), so it's safe to assume filtered.length
|
||||
@ -337,12 +334,12 @@ var AutorunNotification = new Lang.Class({
|
||||
createBanner() {
|
||||
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);
|
||||
|
||||
if (actor)
|
||||
banner.addButton(actor);
|
||||
}));
|
||||
});
|
||||
|
||||
return banner;
|
||||
},
|
||||
@ -366,10 +363,10 @@ var AutorunNotification = new Lang.Class({
|
||||
button_mask: St.ButtonMask.ONE,
|
||||
style_class: 'hotplug-notification-item button' });
|
||||
|
||||
button.connect('clicked', Lang.bind(this, function() {
|
||||
button.connect('clicked', () => {
|
||||
startAppForMount(app, this._mount);
|
||||
this.destroy();
|
||||
}));
|
||||
});
|
||||
|
||||
return button;
|
||||
},
|
||||
|
@ -279,13 +279,12 @@ var KeyringPrompter = new Lang.Class({
|
||||
|
||||
_init() {
|
||||
this._prompter = new Gcr.SystemPrompter();
|
||||
this._prompter.connect('new-prompt', Lang.bind(this,
|
||||
function() {
|
||||
let dialog = this._enabled ? new KeyringDialog()
|
||||
: new KeyringDummyDialog();
|
||||
this._currentPrompt = dialog.prompt;
|
||||
return this._currentPrompt;
|
||||
}));
|
||||
this._prompter.connect('new-prompt', () => {
|
||||
let dialog = this._enabled ? new KeyringDialog()
|
||||
: new KeyringDummyDialog();
|
||||
this._currentPrompt = dialog.prompt;
|
||||
return this._currentPrompt;
|
||||
});
|
||||
this._dbusId = null;
|
||||
this._registered = false;
|
||||
this._enabled = false;
|
||||
|
@ -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('text-changed', Lang.bind(this, function() {
|
||||
secret.entry.clutter_text.connect('text-changed', () => {
|
||||
secret.value = secret.entry.get_text();
|
||||
if (secret.validate)
|
||||
secret.valid = secret.validate(secret);
|
||||
else
|
||||
secret.valid = secret.value.length > 0;
|
||||
this._updateOkButton();
|
||||
}));
|
||||
});
|
||||
} else
|
||||
secret.valid = true;
|
||||
|
||||
@ -464,7 +464,7 @@ var VPNRequestHandler = new Lang.Class({
|
||||
},
|
||||
|
||||
_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);
|
||||
|
||||
if (line == null) {
|
||||
@ -477,11 +477,11 @@ var VPNRequestHandler = new Lang.Class({
|
||||
|
||||
// try to read more!
|
||||
this._readStdoutOldStyle();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_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);
|
||||
|
||||
if (cnt == 0) {
|
||||
@ -495,7 +495,7 @@ var VPNRequestHandler = new Lang.Class({
|
||||
// Try to read more
|
||||
this._dataStdout.set_buffer_size(2 * this._dataStdout.get_buffer_size());
|
||||
this._readStdoutNewStyle();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_showNewStyleDialog() {
|
||||
@ -562,14 +562,14 @@ var VPNRequestHandler = new Lang.Class({
|
||||
let vpnSetting = this._connection.get_setting_vpn();
|
||||
|
||||
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_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_VAL=' + (value || '') + '\n\n', null);
|
||||
}));
|
||||
});
|
||||
this._stdin.write('DONE\n\n', null);
|
||||
} catch(e) {
|
||||
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);
|
||||
|
||||
notification.connect('activated', Lang.bind(this, function() {
|
||||
notification.connect('activated', () => {
|
||||
notification.answered = true;
|
||||
this._handleRequest(requestId, connection, settingName, hints, flags);
|
||||
}));
|
||||
});
|
||||
|
||||
this._notifications[requestId] = notification;
|
||||
notification.connect('destroy', Lang.bind(this, function() {
|
||||
notification.connect('destroy', () => {
|
||||
if (!notification.answered)
|
||||
this._native.respond(requestId, Shell.NetworkAgentResponse.USER_CANCELED);
|
||||
delete this._notifications[requestId];
|
||||
}));
|
||||
});
|
||||
|
||||
Main.messageTray.add(source);
|
||||
source.notify(notification);
|
||||
@ -718,9 +718,9 @@ var NetworkAgent = new Lang.Class({
|
||||
}
|
||||
|
||||
let dialog = new NetworkSecretDialog(this._native, requestId, connection, settingName, hints);
|
||||
dialog.connect('destroy', Lang.bind(this, function() {
|
||||
dialog.connect('destroy', () => {
|
||||
delete this._dialogs[requestId];
|
||||
}));
|
||||
});
|
||||
this._dialogs[requestId] = dialog;
|
||||
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);
|
||||
vpnRequest.connect('destroy', Lang.bind(this, function() {
|
||||
vpnRequest.connect('destroy', () => {
|
||||
delete this._vpnRequests[requestId];
|
||||
}));
|
||||
});
|
||||
this._vpnRequests[requestId] = vpnRequest;
|
||||
},
|
||||
|
||||
|
@ -47,7 +47,7 @@ var NotificationDirection = {
|
||||
RECEIVED: 'chat-received'
|
||||
};
|
||||
|
||||
var N_ = function(s) { return s; };
|
||||
var N_ = s => s;
|
||||
|
||||
function makeMessageFromTpMessage(tpMessage, direction) {
|
||||
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);
|
||||
|
||||
this._chatSources[channel.get_object_path()] = source;
|
||||
source.connect('destroy', Lang.bind(this,
|
||||
function() {
|
||||
delete this._chatSources[channel.get_object_path()];
|
||||
}));
|
||||
source.connect('destroy', () => {
|
||||
delete this._chatSources[channel.get_object_path()];
|
||||
});
|
||||
},
|
||||
|
||||
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
|
||||
dispatchOp.claim_with_async(this, Lang.bind(this, function(dispatchOp, result) {
|
||||
dispatchOp.claim_with_async(this, (dispatchOp, result) => {
|
||||
try {
|
||||
dispatchOp.claim_with_finish(result);
|
||||
this._handlingChannels(account, conn, [channel], false);
|
||||
} catch (err) {
|
||||
log('Failed to Claim channel: ' + err);
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
||||
context.accept();
|
||||
},
|
||||
@ -322,15 +321,13 @@ var ChatSource = new Lang.Class({
|
||||
|
||||
this._notification = new ChatNotification(this);
|
||||
this._notification.connect('activated', Lang.bind(this, this.open));
|
||||
this._notification.connect('updated', Lang.bind(this,
|
||||
function() {
|
||||
if (this._banner && this._banner.expanded)
|
||||
this._ackMessages();
|
||||
}));
|
||||
this._notification.connect('destroy', Lang.bind(this,
|
||||
function() {
|
||||
this._notification = null;
|
||||
}));
|
||||
this._notification.connect('updated', () => {
|
||||
if (this._banner && this._banner.expanded)
|
||||
this._ackMessages();
|
||||
});
|
||||
this._notification.connect('destroy', () => {
|
||||
this._notification = null;
|
||||
});
|
||||
this.pushNotification(this._notification);
|
||||
},
|
||||
|
||||
@ -345,11 +342,10 @@ var ChatSource = new Lang.Class({
|
||||
|
||||
// We ack messages when the user expands the new notification
|
||||
let id = this._banner.connect('expanded', Lang.bind(this, this._ackMessages));
|
||||
this._banner.actor.connect('destroy', Lang.bind(this,
|
||||
function() {
|
||||
this._banner.disconnect(id);
|
||||
this._banner = null;
|
||||
}));
|
||||
this._banner.actor.connect('destroy', () => {
|
||||
this._banner.disconnect(id);
|
||||
this._banner = null;
|
||||
});
|
||||
|
||||
return this._banner;
|
||||
},
|
||||
@ -504,7 +500,7 @@ var ChatSource = new Lang.Class({
|
||||
this._ackMessages();
|
||||
// The chat box has been destroyed so it can't
|
||||
// handle the channel any more.
|
||||
this._channel.close_async(function(channel, result) {
|
||||
this._channel.close_async((channel, result) => {
|
||||
channel.close_finish(result);
|
||||
});
|
||||
} else {
|
||||
@ -602,9 +598,9 @@ var ChatSource = new Lang.Class({
|
||||
}
|
||||
|
||||
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);
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
setChatState(state) {
|
||||
@ -722,7 +718,7 @@ var ChatNotification = new Lang.Class({
|
||||
let maxLength = (lastMessageTime < currentTime - SCROLLBACK_RECENT_TIME) ?
|
||||
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) {
|
||||
let lastMessageToKeep = filteredHistory[maxLength];
|
||||
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.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._responseEntry.clutter_text.connect('key-focus-out', Lang.bind(this, function() {
|
||||
});
|
||||
this._responseEntry.clutter_text.connect('key-focus-out', () => {
|
||||
this.focused = false;
|
||||
this.emit('unfocused');
|
||||
}));
|
||||
});
|
||||
|
||||
this._scrollArea = new St.ScrollView({ style_class: 'chat-scrollview vfade',
|
||||
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
|
||||
// bottom
|
||||
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)
|
||||
this.scrollTo(St.Side.BOTTOM);
|
||||
this._oldMaxScrollValue = Math.max(adjustment.lower, adjustment.upper - adjustment.page_size);
|
||||
}));
|
||||
});
|
||||
|
||||
this._inputHistory = new History.HistoryManager({ entry: this._responseEntry.clutter_text });
|
||||
|
||||
@ -868,19 +864,19 @@ var ChatNotificationBanner = new Lang.Class({
|
||||
this._messageActors = new Map();
|
||||
|
||||
this._messageAddedId = this.notification.connect('message-added',
|
||||
Lang.bind(this, function(n, message) {
|
||||
(n, message) => {
|
||||
this._addMessage(message);
|
||||
}));
|
||||
});
|
||||
this._messageRemovedId = this.notification.connect('message-removed',
|
||||
Lang.bind(this, function(n, message) {
|
||||
(n, message) => {
|
||||
let actor = this._messageActors.get(message);
|
||||
if (this._messageActors.delete(message))
|
||||
actor.destroy();
|
||||
}));
|
||||
});
|
||||
this._timestampChangedId = this.notification.connect('timestamp-changed',
|
||||
Lang.bind(this, function(n, message) {
|
||||
(n, message) => {
|
||||
this._updateTimestamp(message);
|
||||
}));
|
||||
});
|
||||
|
||||
for (let i = this.notification.messages.length - 1; i >= 0; i--)
|
||||
this._addMessage(this.notification.messages[i]);
|
||||
|
@ -41,7 +41,7 @@ var CtrlAltTabManager = new Lang.Class({
|
||||
item.iconName = icon;
|
||||
|
||||
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)
|
||||
global.focus_manager.add_group(root);
|
||||
},
|
||||
@ -81,7 +81,7 @@ var CtrlAltTabManager = new Lang.Class({
|
||||
|
||||
popup(backward, binding, mask) {
|
||||
// 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
|
||||
if (Main.sessionMode.hasWindows && !Main.overview.visible) {
|
||||
@ -125,9 +125,9 @@ var CtrlAltTabManager = new Lang.Class({
|
||||
this._popup.show(backward, binding, mask);
|
||||
|
||||
this._popup.actor.connect('destroy',
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
this._popup = null;
|
||||
}));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
104
js/ui/dash.js
104
js/ui/dash.js
@ -148,9 +148,9 @@ var DashItemContainer = new Lang.Class({
|
||||
{ opacity: 0,
|
||||
time: DASH_ITEM_LABEL_HIDE_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this, function() {
|
||||
onComplete: () => {
|
||||
this.label.hide();
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@ -195,9 +195,9 @@ var DashItemContainer = new Lang.Class({
|
||||
childOpacity: 0,
|
||||
time: DASH_ANIMATION_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this, function() {
|
||||
onComplete: () => {
|
||||
this.destroy();
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@ -301,11 +301,10 @@ var ShowAppsIcon = new Lang.Class({
|
||||
|
||||
let id = app.get_id();
|
||||
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this,
|
||||
function () {
|
||||
AppFavorites.getAppFavorites().removeFavorite(id);
|
||||
return false;
|
||||
}));
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||
AppFavorites.getAppFavorites().removeFavorite(id);
|
||||
return false;
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -415,21 +414,20 @@ var Dash = new Lang.Class({
|
||||
this._container.add_actor(this._showAppsIcon);
|
||||
|
||||
this.actor = new St.Bin({ child: this._container });
|
||||
this.actor.connect('notify::height', Lang.bind(this,
|
||||
function() {
|
||||
if (this._maxHeight != this.actor.height)
|
||||
this._queueRedisplay();
|
||||
this._maxHeight = this.actor.height;
|
||||
}));
|
||||
this.actor.connect('notify::height', () => {
|
||||
if (this._maxHeight != this.actor.height)
|
||||
this._queueRedisplay();
|
||||
this._maxHeight = this.actor.height;
|
||||
});
|
||||
|
||||
this._workId = Main.initializeDeferredWork(this._box, Lang.bind(this, this._redisplay));
|
||||
|
||||
this._appSystem = Shell.AppSystem.get_default();
|
||||
|
||||
this._appSystem.connect('installed-changed', Lang.bind(this, function() {
|
||||
this._appSystem.connect('installed-changed', () => {
|
||||
AppFavorites.getAppFavorites().reload();
|
||||
this._queueRedisplay();
|
||||
}));
|
||||
});
|
||||
AppFavorites.getAppFavorites().connect('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) {
|
||||
item.child.connect('notify::hover', Lang.bind(this, function() {
|
||||
item.child.connect('notify::hover', () => {
|
||||
this._syncLabel(item, appIcon);
|
||||
}));
|
||||
});
|
||||
|
||||
let id = Main.overview.connect('hiding', Lang.bind(this, function() {
|
||||
let id = Main.overview.connect('hiding', () => {
|
||||
this._labelShowing = false;
|
||||
item.hideLabel();
|
||||
}));
|
||||
item.child.connect('destroy', function() {
|
||||
});
|
||||
item.child.connect('destroy', () => {
|
||||
Main.overview.disconnect(id);
|
||||
});
|
||||
|
||||
if (appIcon) {
|
||||
appIcon.connect('sync-tooltip', Lang.bind(this, function() {
|
||||
appIcon.connect('sync-tooltip', () => {
|
||||
this._syncLabel(item, appIcon);
|
||||
}));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@ -534,19 +532,19 @@ var Dash = new Lang.Class({
|
||||
showLabel: false });
|
||||
if (appIcon._draggable) {
|
||||
appIcon._draggable.connect('drag-begin',
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
appIcon.actor.opacity = 50;
|
||||
}));
|
||||
});
|
||||
appIcon._draggable.connect('drag-end',
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
appIcon.actor.opacity = 255;
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
appIcon.connect('menu-state-changed',
|
||||
Lang.bind(this, function(appIcon, opened) {
|
||||
(appIcon, opened) => {
|
||||
this._itemMenuStateChanged(item, opened);
|
||||
}));
|
||||
});
|
||||
|
||||
let item = new DashItemContainer();
|
||||
item.setChild(appIcon.actor);
|
||||
@ -582,12 +580,12 @@ var Dash = new Lang.Class({
|
||||
if (this._showLabelTimeoutId == 0) {
|
||||
let timeout = this._labelShowing ? 0 : DASH_ITEM_HOVER_TIMEOUT;
|
||||
this._showLabelTimeoutId = Mainloop.timeout_add(timeout,
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
this._labelShowing = true;
|
||||
item.showLabel();
|
||||
this._showLabelTimeoutId = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
GLib.Source.set_name_by_id(this._showLabelTimeoutId, '[gnome-shell] item.showLabel');
|
||||
if (this._resetHoverTimeoutId > 0) {
|
||||
Mainloop.source_remove(this._resetHoverTimeoutId);
|
||||
@ -601,11 +599,11 @@ var Dash = new Lang.Class({
|
||||
item.hideLabel();
|
||||
if (this._labelShowing) {
|
||||
this._resetHoverTimeoutId = Mainloop.timeout_add(DASH_ITEM_HOVER_TIMEOUT,
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
this._labelShowing = false;
|
||||
this._resetHoverTimeoutId = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
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
|
||||
// animating out (which means they will be destroyed at the end of
|
||||
// the animation)
|
||||
let iconChildren = this._box.get_children().filter(function(actor) {
|
||||
let iconChildren = this._box.get_children().filter(actor => {
|
||||
return actor.child &&
|
||||
actor.child._delegate &&
|
||||
actor.child._delegate.icon &&
|
||||
@ -655,9 +653,7 @@ var Dash = new Lang.Class({
|
||||
|
||||
let availSize = availHeight / iconChildren.length;
|
||||
|
||||
let iconSizes = baseIconSizes.map(function(s) {
|
||||
return s * scaleFactor;
|
||||
});
|
||||
let iconSizes = baseIconSizes.map(s => s * scaleFactor);
|
||||
|
||||
let newIconSize = baseIconSizes[0];
|
||||
for (let i = 0; i < iconSizes.length; i++) {
|
||||
@ -708,15 +704,13 @@ var Dash = new Lang.Class({
|
||||
|
||||
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 &&
|
||||
actor.child._delegate &&
|
||||
actor.child._delegate.app;
|
||||
});
|
||||
// Apps currently in the dash
|
||||
let oldApps = children.map(function(actor) {
|
||||
return actor.child._delegate.app;
|
||||
});
|
||||
let oldApps = children.map(actor => actor.child._delegate.app);
|
||||
// Apps supposed to be in the dash
|
||||
let newApps = [];
|
||||
|
||||
@ -782,7 +776,7 @@ var Dash = new Lang.Class({
|
||||
let nextApp = newApps.length > newIndex + 1 ? newApps[newIndex + 1]
|
||||
: null;
|
||||
let insertHere = nextApp && nextApp == oldApp;
|
||||
let alreadyRemoved = removedActors.reduce(function(result, actor) {
|
||||
let alreadyRemoved = removedActors.reduce((result, actor) => {
|
||||
let removedApp = actor.child._delegate.app;
|
||||
return result || removedApp == newApp;
|
||||
}, false);
|
||||
@ -838,10 +832,9 @@ var Dash = new Lang.Class({
|
||||
if (this._dragPlaceholder) {
|
||||
this._animatingPlaceholdersCount++;
|
||||
this._dragPlaceholder.animateOutAndDestroy();
|
||||
this._dragPlaceholder.connect('destroy',
|
||||
Lang.bind(this, function() {
|
||||
this._animatingPlaceholdersCount--;
|
||||
}));
|
||||
this._dragPlaceholder.connect('destroy', () => {
|
||||
this._animatingPlaceholdersCount--;
|
||||
});
|
||||
this._dragPlaceholder = null;
|
||||
}
|
||||
this._dragPlaceholderPos = -1;
|
||||
@ -968,15 +961,14 @@ var Dash = new Lang.Class({
|
||||
if (!this._dragPlaceholder)
|
||||
return true;
|
||||
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this,
|
||||
function () {
|
||||
let appFavorites = AppFavorites.getAppFavorites();
|
||||
if (srcIsFavorite)
|
||||
appFavorites.moveFavoriteToPos(id, favPos);
|
||||
else
|
||||
appFavorites.addFavoriteAtPos(id, favPos);
|
||||
return false;
|
||||
}));
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||
let appFavorites = AppFavorites.getAppFavorites();
|
||||
if (srcIsFavorite)
|
||||
appFavorites.moveFavoriteToPos(id, favPos);
|
||||
else
|
||||
appFavorites.addFavoriteAtPos(id, favPos);
|
||||
return false;
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -43,10 +43,9 @@ var TodayButton = new Lang.Class({
|
||||
can_focus: true,
|
||||
reactive: false
|
||||
});
|
||||
this.actor.connect('clicked', Lang.bind(this,
|
||||
function() {
|
||||
this._calendar.setDate(new Date(), false);
|
||||
}));
|
||||
this.actor.connect('clicked', () => {
|
||||
this._calendar.setDate(new Date(), false);
|
||||
});
|
||||
|
||||
let hbox = new St.BoxLayout({ vertical: true });
|
||||
this.actor.add_actor(hbox);
|
||||
@ -59,12 +58,11 @@ var TodayButton = new Lang.Class({
|
||||
hbox.add_actor(this._dateLabel);
|
||||
|
||||
this._calendar = calendar;
|
||||
this._calendar.connect('selected-date-changed', Lang.bind(this,
|
||||
function(calendar, date) {
|
||||
// Make the button reactive only if the selected date is not the
|
||||
// current date.
|
||||
this.actor.reactive = !_isToday(date)
|
||||
}));
|
||||
this._calendar.connect('selected-date-changed', (calendar, date) => {
|
||||
// Make the button reactive only if the selected date is not the
|
||||
// current date.
|
||||
this.actor.reactive = !_isToday(date)
|
||||
});
|
||||
},
|
||||
|
||||
setDate(date) {
|
||||
@ -97,13 +95,12 @@ var WorldClocksSection = new Lang.Class({
|
||||
this.actor = new St.Button({ style_class: 'world-clocks-button',
|
||||
x_fill: true,
|
||||
can_focus: true });
|
||||
this.actor.connect('clicked', Lang.bind(this,
|
||||
function() {
|
||||
this._clockAppMon.activateApp();
|
||||
this.actor.connect('clicked', () => {
|
||||
this._clockAppMon.activateApp();
|
||||
|
||||
Main.overview.hide();
|
||||
Main.panel.closeCalendar();
|
||||
}));
|
||||
Main.overview.hide();
|
||||
Main.panel.closeCalendar();
|
||||
});
|
||||
|
||||
let layout = new Clutter.GridLayout({ orientation: Clutter.Orientation.VERTICAL });
|
||||
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.sort(function(a, b) {
|
||||
this._locations.sort((a, b) => {
|
||||
return a.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));
|
||||
|
||||
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) {
|
||||
@ -371,10 +368,7 @@ var MessagesIndicator = new Lang.Class({
|
||||
|
||||
_updateCount() {
|
||||
let count = 0;
|
||||
this._sources.forEach(Lang.bind(this,
|
||||
function(source) {
|
||||
count += source.unseenCount;
|
||||
}));
|
||||
this._sources.forEach(source => { count += source.unseenCount; });
|
||||
count -= Main.messageTray.queueCount;
|
||||
|
||||
this.actor.visible = (count > 0);
|
||||
@ -500,12 +494,12 @@ var DateMenuButton = new Lang.Class({
|
||||
|
||||
this._calendar = new Calendar.Calendar();
|
||||
this._calendar.connect('selected-date-changed',
|
||||
Lang.bind(this, function(calendar, date) {
|
||||
(calendar, date) => {
|
||||
layout.frozen = !_isToday(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
|
||||
if (isOpen) {
|
||||
let now = new Date();
|
||||
@ -513,7 +507,7 @@ var DateMenuButton = new Lang.Class({
|
||||
this._date.setDate(now);
|
||||
this._messageList.setDate(now);
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
||||
// Fill up the first column
|
||||
this._messageList = new Calendar.CalendarMessageList();
|
||||
|
11
js/ui/dnd.js
11
js/ui/dnd.js
@ -49,10 +49,9 @@ function _getEventHandlerActor() {
|
||||
Main.uiGroup.add_actor(eventHandlerActor);
|
||||
// We connect to 'event' rather than 'captured-event' because the capturing phase doesn't happen
|
||||
// when you've grabbed the pointer.
|
||||
eventHandlerActor.connect('event',
|
||||
function(actor, event) {
|
||||
return currentDraggable._onEvent(actor, event);
|
||||
});
|
||||
eventHandlerActor.connect('event', (actor, event) => {
|
||||
return currentDraggable._onEvent(actor, event);
|
||||
});
|
||||
}
|
||||
return eventHandlerActor;
|
||||
}
|
||||
@ -86,13 +85,13 @@ var _Draggable = new Lang.Class({
|
||||
Lang.bind(this, this._onTouchEvent));
|
||||
}
|
||||
|
||||
this.actor.connect('destroy', Lang.bind(this, function() {
|
||||
this.actor.connect('destroy', () => {
|
||||
this._actorDestroyed = true;
|
||||
|
||||
if (this._dragInProgress && this._dragCancellable)
|
||||
this._cancelDrag(global.get_current_time());
|
||||
this.disconnectAll();
|
||||
}));
|
||||
});
|
||||
this._onEventId = null;
|
||||
this._touchSequence = null;
|
||||
|
||||
|
@ -22,9 +22,7 @@ var EdgeDragAction = new Lang.Class({
|
||||
this._allowedModes = allowedModes;
|
||||
this.set_n_touch_points(1);
|
||||
|
||||
global.display.connect('grab-op-begin', Lang.bind(this, function() {
|
||||
this.cancel();
|
||||
}));
|
||||
global.display.connect('grab-op-begin', () => { this.cancel(); });
|
||||
},
|
||||
|
||||
_getMonitorRect(x, y) {
|
||||
|
@ -290,14 +290,14 @@ var EndSessionDialog = new Lang.Class({
|
||||
this._pkOfflineProxy = new PkOfflineProxy(Gio.DBus.system,
|
||||
'org.freedesktop.PackageKit',
|
||||
'/org/freedesktop/PackageKit',
|
||||
Lang.bind(this, function(proxy, error) {
|
||||
(proxy, error) => {
|
||||
if (error)
|
||||
log(error.message);
|
||||
}));
|
||||
});
|
||||
this._powerProxy = new UPowerProxy(Gio.DBus.system,
|
||||
'org.freedesktop.UPower',
|
||||
'/org/freedesktop/UPower',
|
||||
Lang.bind(this, function(proxy, error) {
|
||||
(proxy, error) => {
|
||||
if (error) {
|
||||
log(error.message);
|
||||
return;
|
||||
@ -305,7 +305,7 @@ var EndSessionDialog = new Lang.Class({
|
||||
this._powerProxy.connect('g-properties-changed',
|
||||
Lang.bind(this, this._sync));
|
||||
this._sync();
|
||||
}));
|
||||
});
|
||||
|
||||
this._secondsLeft = 0;
|
||||
this._totalSecondsToStayOpen = 0;
|
||||
@ -485,14 +485,13 @@ var EndSessionDialog = new Lang.Class({
|
||||
for (let i = 0; i < dialogContent.confirmButtons.length; i++) {
|
||||
let signal = dialogContent.confirmButtons[i].signal;
|
||||
let label = dialogContent.confirmButtons[i].label;
|
||||
buttons.push({ action: Lang.bind(this, function() {
|
||||
this.close(true);
|
||||
let signalId = this.connect('closed',
|
||||
Lang.bind(this, function() {
|
||||
this.disconnect(signalId);
|
||||
this._confirm(signal);
|
||||
}));
|
||||
}),
|
||||
buttons.push({ action: () => {
|
||||
this.close(true);
|
||||
let signalId = this.connect('closed', () => {
|
||||
this.disconnect(signalId);
|
||||
this._confirm(signal);
|
||||
});
|
||||
},
|
||||
label: label });
|
||||
}
|
||||
|
||||
@ -513,11 +512,11 @@ var EndSessionDialog = new Lang.Class({
|
||||
},
|
||||
|
||||
_confirm(signal) {
|
||||
let callback = Lang.bind(this, function() {
|
||||
let callback = () => {
|
||||
this._fadeOutDialog();
|
||||
this._stopTimer();
|
||||
this._dbusImpl.emit_signal(signal, null);
|
||||
});
|
||||
};
|
||||
|
||||
// Offline update not available; just emit the signal
|
||||
if (!this._checkBox.actor.visible) {
|
||||
@ -552,8 +551,7 @@ var EndSessionDialog = new Lang.Class({
|
||||
},
|
||||
|
||||
_triggerOfflineUpdateReboot(callback) {
|
||||
this._pkOfflineProxy.TriggerRemote('reboot',
|
||||
function (result, error) {
|
||||
this._pkOfflineProxy.TriggerRemote('reboot', (result, error) => {
|
||||
if (error)
|
||||
log(error.message);
|
||||
|
||||
@ -562,8 +560,7 @@ var EndSessionDialog = new Lang.Class({
|
||||
},
|
||||
|
||||
_triggerOfflineUpdateShutdown(callback) {
|
||||
this._pkOfflineProxy.TriggerRemote('power-off',
|
||||
function (result, error) {
|
||||
this._pkOfflineProxy.TriggerRemote('power-off', (result, error) => {
|
||||
if (error)
|
||||
log(error.message);
|
||||
|
||||
@ -572,7 +569,7 @@ var EndSessionDialog = new Lang.Class({
|
||||
},
|
||||
|
||||
_triggerOfflineUpdateCancel(callback) {
|
||||
this._pkOfflineProxy.CancelRemote(function (result, error) {
|
||||
this._pkOfflineProxy.CancelRemote((result, error) => {
|
||||
if (error)
|
||||
log(error.message);
|
||||
|
||||
@ -584,24 +581,23 @@ var EndSessionDialog = new Lang.Class({
|
||||
let startTime = GLib.get_monotonic_time();
|
||||
this._secondsLeft = this._totalSecondsToStayOpen;
|
||||
|
||||
this._timerId = Mainloop.timeout_add_seconds(1, Lang.bind(this,
|
||||
function() {
|
||||
let currentTime = GLib.get_monotonic_time();
|
||||
let secondsElapsed = ((currentTime - startTime) / 1000000);
|
||||
this._timerId = Mainloop.timeout_add_seconds(1, () => {
|
||||
let currentTime = GLib.get_monotonic_time();
|
||||
let secondsElapsed = ((currentTime - startTime) / 1000000);
|
||||
|
||||
this._secondsLeft = this._totalSecondsToStayOpen - secondsElapsed;
|
||||
if (this._secondsLeft > 0) {
|
||||
this._sync();
|
||||
return GLib.SOURCE_CONTINUE;
|
||||
}
|
||||
this._secondsLeft = this._totalSecondsToStayOpen - secondsElapsed;
|
||||
if (this._secondsLeft > 0) {
|
||||
this._sync();
|
||||
return GLib.SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
let dialogContent = DialogContent[this._type];
|
||||
let button = dialogContent.confirmButtons[dialogContent.confirmButtons.length - 1];
|
||||
this._confirm(button.signal);
|
||||
this._timerId = 0;
|
||||
let dialogContent = DialogContent[this._type];
|
||||
let button = dialogContent.confirmButtons[dialogContent.confirmButtons.length - 1];
|
||||
this._confirm(button.signal);
|
||||
this._timerId = 0;
|
||||
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
GLib.Source.set_name_by_id(this._timerId, '[gnome-shell] this._confirm');
|
||||
},
|
||||
|
||||
@ -689,7 +685,7 @@ var EndSessionDialog = new Lang.Class({
|
||||
},
|
||||
|
||||
_loadSessions() {
|
||||
this._loginManager.listSessions(Lang.bind(this, function(result) {
|
||||
this._loginManager.listSessions(result => {
|
||||
let n = 0;
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
let[id, uid, userName, seat, sessionPath] = result[i];
|
||||
@ -720,7 +716,7 @@ var EndSessionDialog = new Lang.Class({
|
||||
}
|
||||
|
||||
this._sync();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
OpenAsync(parameters, invocation) {
|
||||
@ -750,9 +746,9 @@ var EndSessionDialog = new Lang.Class({
|
||||
let dialogContent = DialogContent[this._type];
|
||||
|
||||
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._applications.push(inhibitor);
|
||||
}
|
||||
@ -787,11 +783,10 @@ var EndSessionDialog = new Lang.Class({
|
||||
|
||||
this._sync();
|
||||
|
||||
let signalId = this.connect('opened',
|
||||
Lang.bind(this, function() {
|
||||
invocation.return_value(null);
|
||||
this.disconnect(signalId);
|
||||
}));
|
||||
let signalId = this.connect('opened', () => {
|
||||
invocation.return_value(null);
|
||||
this.disconnect(signalId);
|
||||
});
|
||||
},
|
||||
|
||||
Close(parameters, invocation) {
|
||||
|
@ -47,14 +47,14 @@ function _patchContainerClass(containerClass) {
|
||||
function _patchLayoutClass(layoutClass, styleProps) {
|
||||
if (styleProps)
|
||||
layoutClass.prototype.hookup_style = function(container) {
|
||||
container.connect('style-changed', Lang.bind(this, function() {
|
||||
container.connect('style-changed', () => {
|
||||
let node = container.get_theme_node();
|
||||
for (let prop in styleProps) {
|
||||
let [found, length] = node.lookup_length(styleProps[prop], false);
|
||||
if (found)
|
||||
this[prop] = length;
|
||||
}
|
||||
}));
|
||||
});
|
||||
};
|
||||
layoutClass.prototype.child_set = function(actor, props) {
|
||||
let meta = this.get_child_meta(actor.get_parent(), actor);
|
||||
@ -88,7 +88,7 @@ function init() {
|
||||
window._ = Gettext.gettext;
|
||||
window.C_ = Gettext.pgettext;
|
||||
window.ngettext = Gettext.ngettext;
|
||||
window.N_ = function(s) { return s; };
|
||||
window.N_ = s => s;
|
||||
|
||||
// Miscellaneous monkeypatching
|
||||
_patchContainerClass(St.BoxLayout);
|
||||
|
@ -30,7 +30,7 @@ function installExtension(uuid, invocation) {
|
||||
|
||||
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) {
|
||||
ExtensionSystem.logExtensionError(uuid, 'downloading info: ' + message.status_code);
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if (status != 0)
|
||||
@ -119,8 +119,8 @@ function updateExtension(uuid) {
|
||||
let url = REPOSITORY_URL_DOWNLOAD.format(uuid);
|
||||
let message = Soup.form_request_new_from_hash('GET', url, params);
|
||||
|
||||
_httpSession.queue_message(message, Lang.bind(this, function(session, message) {
|
||||
gotExtensionZipFile(session, message, uuid, newExtensionTmpDir, function() {
|
||||
_httpSession.queue_message(message, (session, message) => {
|
||||
gotExtensionZipFile(session, message, uuid, newExtensionTmpDir, () => {
|
||||
let oldExtension = ExtensionUtils.extensions[uuid];
|
||||
let extensionDir = oldExtension.dir;
|
||||
|
||||
@ -151,10 +151,10 @@ function updateExtension(uuid) {
|
||||
}
|
||||
|
||||
FileUtils.recursivelyDeleteDir(oldExtensionTmpDir, true);
|
||||
}, function(code, message) {
|
||||
}, (code, message) => {
|
||||
log('Error while updating extension %s: %s (%s)'.format(uuid, code, message ? message : ''));
|
||||
});
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
function checkForUpdates() {
|
||||
@ -168,7 +168,7 @@ function checkForUpdates() {
|
||||
|
||||
let url = REPOSITORY_URL_UPDATE;
|
||||
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)
|
||||
return;
|
||||
|
||||
@ -258,9 +258,9 @@ var InstallExtensionDialog = new Lang.Class({
|
||||
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);
|
||||
}));
|
||||
});
|
||||
|
||||
this.close();
|
||||
}
|
||||
|
@ -273,17 +273,17 @@ function onEnabledExtensionsChanged() {
|
||||
|
||||
// Find and enable all the newly enabled extensions: UUIDs found in the
|
||||
// new setting, but not in the old one.
|
||||
newEnabledExtensions.filter(function(uuid) {
|
||||
return enabledExtensions.indexOf(uuid) == -1;
|
||||
}).forEach(function(uuid) {
|
||||
newEnabledExtensions.filter(
|
||||
uuid => !enabledExtensions.includes(uuid)
|
||||
).forEach(uuid => {
|
||||
enableExtension(uuid);
|
||||
});
|
||||
|
||||
// Find and disable all the newly disabled extensions: UUIDs found in the
|
||||
// old setting, but not in the new one.
|
||||
enabledExtensions.filter(function(item) {
|
||||
return newEnabledExtensions.indexOf(item) == -1;
|
||||
}).forEach(function(uuid) {
|
||||
enabledExtensions.filter(
|
||||
item => !newEnabledExtensions.includes(item)
|
||||
).forEach(uuid => {
|
||||
disableExtension(uuid);
|
||||
});
|
||||
|
||||
@ -300,7 +300,7 @@ function _onVersionValidationChanged() {
|
||||
enabledExtensions = getEnabledExtensions();
|
||||
|
||||
if (Main.sessionMode.allowExtensions) {
|
||||
enabledExtensions.forEach(function(uuid) {
|
||||
enabledExtensions.forEach(uuid => {
|
||||
enableExtension(uuid);
|
||||
});
|
||||
}
|
||||
@ -314,7 +314,7 @@ function _loadExtensions() {
|
||||
enabledExtensions = getEnabledExtensions();
|
||||
|
||||
let finder = new ExtensionUtils.ExtensionFinder();
|
||||
finder.connect('extension-found', function(finder, extension) {
|
||||
finder.connect('extension-found', (finder, extension) => {
|
||||
loadExtension(extension);
|
||||
});
|
||||
finder.scanExtensions();
|
||||
@ -328,7 +328,7 @@ function enableAllExtensions() {
|
||||
_loadExtensions();
|
||||
initted = true;
|
||||
} else {
|
||||
enabledExtensions.forEach(function(uuid) {
|
||||
enabledExtensions.forEach(uuid => {
|
||||
enableExtension(uuid);
|
||||
});
|
||||
}
|
||||
@ -340,7 +340,7 @@ function disableAllExtensions() {
|
||||
return;
|
||||
|
||||
if (initted) {
|
||||
extensionOrder.slice().reverse().forEach(function(uuid) {
|
||||
extensionOrder.slice().reverse().forEach(uuid => {
|
||||
disableExtension(uuid);
|
||||
});
|
||||
}
|
||||
|
@ -67,7 +67,9 @@ var GrabHelper = new Lang.Class({
|
||||
// Adds @actor to the set of actors that are allowed to process events
|
||||
// during a grab.
|
||||
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);
|
||||
},
|
||||
|
||||
|
@ -34,13 +34,13 @@ var CandidateArea = new Lang.Class({
|
||||
this.actor.add(box);
|
||||
|
||||
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());
|
||||
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();
|
||||
switch(direction) {
|
||||
case Clutter.ScrollDirection.UP:
|
||||
@ -51,7 +51,7 @@ var CandidateArea = new Lang.Class({
|
||||
break;
|
||||
};
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}));
|
||||
});
|
||||
|
||||
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._previousButton.connect('clicked', Lang.bind(this, function() {
|
||||
this._previousButton.connect('clicked', () => {
|
||||
this.emit('previous-page');
|
||||
}));
|
||||
this._nextButton.connect('clicked', Lang.bind(this, function() {
|
||||
});
|
||||
this._nextButton.connect('clicked', () => {
|
||||
this.emit('next-page');
|
||||
}));
|
||||
});
|
||||
|
||||
this._orientation = -1;
|
||||
this._cursorPosition = 0;
|
||||
@ -152,23 +152,23 @@ var CandidatePopup = new Lang.Class({
|
||||
this._candidateArea = new CandidateArea();
|
||||
box.add(this._candidateArea.actor);
|
||||
|
||||
this._candidateArea.connect('previous-page', Lang.bind(this, function() {
|
||||
this._candidateArea.connect('previous-page', () => {
|
||||
this._panelService.page_up();
|
||||
}));
|
||||
this._candidateArea.connect('next-page', Lang.bind(this, function() {
|
||||
});
|
||||
this._candidateArea.connect('next-page', () => {
|
||||
this._panelService.page_down();
|
||||
}));
|
||||
});
|
||||
|
||||
this._candidateArea.connect('cursor-up', Lang.bind(this, function() {
|
||||
this._candidateArea.connect('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._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 = null;
|
||||
},
|
||||
@ -178,115 +178,103 @@ var CandidatePopup = new Lang.Class({
|
||||
if (!panelService)
|
||||
return;
|
||||
|
||||
panelService.connect('set-cursor-location',
|
||||
Lang.bind(this, function(ps, x, y, w, h) {
|
||||
this._setDummyCursorGeometry(x, y, w, h);
|
||||
}));
|
||||
panelService.connect('set-cursor-location', (ps, x, y, w, h) => {
|
||||
this._setDummyCursorGeometry(x, y, w, h);
|
||||
});
|
||||
try {
|
||||
panelService.connect('set-cursor-location-relative',
|
||||
Lang.bind(this, function(ps, x, y, w, h) {
|
||||
if (!global.display.focus_window)
|
||||
return;
|
||||
let window = global.display.focus_window.get_compositor_private();
|
||||
this._setDummyCursorGeometry(window.x + x, window.y + y, w, h);
|
||||
}));
|
||||
panelService.connect('set-cursor-location-relative', (ps, x, y, w, h) => {
|
||||
if (!global.display.focus_window)
|
||||
return;
|
||||
let window = global.display.focus_window.get_compositor_private();
|
||||
this._setDummyCursorGeometry(window.x + x, window.y + y, w, h);
|
||||
});
|
||||
} catch(e) {
|
||||
// Only recent IBus versions have support for this signal
|
||||
// which is used for wayland clients. In order to work
|
||||
// with older IBus versions we can silently ignore the
|
||||
// signal's absence.
|
||||
}
|
||||
panelService.connect('update-preedit-text',
|
||||
Lang.bind(this, function(ps, text, cursorPosition, visible) {
|
||||
this._preeditText.visible = visible;
|
||||
this._updateVisibility();
|
||||
panelService.connect('update-preedit-text', (ps, text, cursorPosition, visible) => {
|
||||
this._preeditText.visible = visible;
|
||||
this._updateVisibility();
|
||||
|
||||
this._preeditText.text = text.get_text();
|
||||
this._preeditText.text = text.get_text();
|
||||
|
||||
let attrs = text.get_attributes();
|
||||
if (attrs)
|
||||
this._setTextAttributes(this._preeditText.clutter_text,
|
||||
attrs);
|
||||
}));
|
||||
panelService.connect('show-preedit-text',
|
||||
Lang.bind(this, function(ps) {
|
||||
this._preeditText.show();
|
||||
this._updateVisibility();
|
||||
}));
|
||||
panelService.connect('hide-preedit-text',
|
||||
Lang.bind(this, function(ps) {
|
||||
this._preeditText.hide();
|
||||
this._updateVisibility();
|
||||
}));
|
||||
panelService.connect('update-auxiliary-text',
|
||||
Lang.bind(this, function(ps, text, visible) {
|
||||
this._auxText.visible = visible;
|
||||
this._updateVisibility();
|
||||
let attrs = text.get_attributes();
|
||||
if (attrs)
|
||||
this._setTextAttributes(this._preeditText.clutter_text,
|
||||
attrs);
|
||||
});
|
||||
panelService.connect('show-preedit-text', ps => {
|
||||
this._preeditText.show();
|
||||
this._updateVisibility();
|
||||
});
|
||||
panelService.connect('hide-preedit-text', ps => {
|
||||
this._preeditText.hide();
|
||||
this._updateVisibility();
|
||||
});
|
||||
panelService.connect('update-auxiliary-text', (ps, text, visible) => {
|
||||
this._auxText.visible = visible;
|
||||
this._updateVisibility();
|
||||
|
||||
this._auxText.text = text.get_text();
|
||||
}));
|
||||
panelService.connect('show-auxiliary-text',
|
||||
Lang.bind(this, function(ps) {
|
||||
this._auxText.show();
|
||||
this._updateVisibility();
|
||||
}));
|
||||
panelService.connect('hide-auxiliary-text',
|
||||
Lang.bind(this, function(ps) {
|
||||
this._auxText.hide();
|
||||
this._updateVisibility();
|
||||
}));
|
||||
panelService.connect('update-lookup-table',
|
||||
Lang.bind(this, function(ps, lookupTable, visible) {
|
||||
this._candidateArea.actor.visible = visible;
|
||||
this._updateVisibility();
|
||||
this._auxText.text = text.get_text();
|
||||
});
|
||||
panelService.connect('show-auxiliary-text', ps => {
|
||||
this._auxText.show();
|
||||
this._updateVisibility();
|
||||
});
|
||||
panelService.connect('hide-auxiliary-text', ps => {
|
||||
this._auxText.hide();
|
||||
this._updateVisibility();
|
||||
});
|
||||
panelService.connect('update-lookup-table', (ps, lookupTable, visible) => {
|
||||
this._candidateArea.actor.visible = visible;
|
||||
this._updateVisibility();
|
||||
|
||||
let nCandidates = lookupTable.get_number_of_candidates();
|
||||
let cursorPos = lookupTable.get_cursor_pos();
|
||||
let pageSize = lookupTable.get_page_size();
|
||||
let nPages = Math.ceil(nCandidates / pageSize);
|
||||
let page = ((cursorPos == 0) ? 0 : Math.floor(cursorPos / pageSize));
|
||||
let startIndex = page * pageSize;
|
||||
let endIndex = Math.min((page + 1) * pageSize, nCandidates);
|
||||
let nCandidates = lookupTable.get_number_of_candidates();
|
||||
let cursorPos = lookupTable.get_cursor_pos();
|
||||
let pageSize = lookupTable.get_page_size();
|
||||
let nPages = Math.ceil(nCandidates / pageSize);
|
||||
let page = ((cursorPos == 0) ? 0 : Math.floor(cursorPos / pageSize));
|
||||
let startIndex = page * pageSize;
|
||||
let endIndex = Math.min((page + 1) * pageSize, nCandidates);
|
||||
|
||||
let indexes = [];
|
||||
let indexLabel;
|
||||
for (let i = 0; indexLabel = lookupTable.get_label(i); ++i)
|
||||
indexes.push(indexLabel.get_text());
|
||||
let indexes = [];
|
||||
let indexLabel;
|
||||
for (let i = 0; indexLabel = lookupTable.get_label(i); ++i)
|
||||
indexes.push(indexLabel.get_text());
|
||||
|
||||
Main.keyboard.resetSuggestions();
|
||||
Main.keyboard.resetSuggestions();
|
||||
|
||||
let candidates = [];
|
||||
for (let i = startIndex; i < endIndex; ++i) {
|
||||
candidates.push(lookupTable.get_candidate(i).get_text());
|
||||
let candidates = [];
|
||||
for (let i = startIndex; i < endIndex; ++i) {
|
||||
candidates.push(lookupTable.get_candidate(i).get_text());
|
||||
|
||||
Main.keyboard.addSuggestion(lookupTable.get_candidate(i).get_text(), Lang.bind(this, function() {
|
||||
let index = i;
|
||||
this._panelService.candidate_clicked(index, 1, 0);
|
||||
}));
|
||||
}
|
||||
Main.keyboard.addSuggestion(lookupTable.get_candidate(i).get_text(), () => {
|
||||
let index = i;
|
||||
this._panelService.candidate_clicked(index, 1, 0);
|
||||
});
|
||||
}
|
||||
|
||||
this._candidateArea.setCandidates(indexes,
|
||||
candidates,
|
||||
cursorPos % pageSize,
|
||||
lookupTable.is_cursor_visible());
|
||||
this._candidateArea.setOrientation(lookupTable.get_orientation());
|
||||
this._candidateArea.updateButtons(lookupTable.is_round(), page, nPages);
|
||||
}));
|
||||
panelService.connect('show-lookup-table',
|
||||
Lang.bind(this, function(ps) {
|
||||
this._candidateArea.actor.show();
|
||||
this._updateVisibility();
|
||||
}));
|
||||
panelService.connect('hide-lookup-table',
|
||||
Lang.bind(this, function(ps) {
|
||||
this._candidateArea.actor.hide();
|
||||
this._updateVisibility();
|
||||
}));
|
||||
panelService.connect('focus-out',
|
||||
Lang.bind(this, function(ps) {
|
||||
this._boxPointer.hide(BoxPointer.PopupAnimation.NONE);
|
||||
Main.keyboard.resetSuggestions();
|
||||
}));
|
||||
this._candidateArea.setCandidates(indexes,
|
||||
candidates,
|
||||
cursorPos % pageSize,
|
||||
lookupTable.is_cursor_visible());
|
||||
this._candidateArea.setOrientation(lookupTable.get_orientation());
|
||||
this._candidateArea.updateButtons(lookupTable.is_round(), page, nPages);
|
||||
});
|
||||
panelService.connect('show-lookup-table', ps => {
|
||||
this._candidateArea.actor.show();
|
||||
this._updateVisibility();
|
||||
});
|
||||
panelService.connect('hide-lookup-table', ps => {
|
||||
this._candidateArea.actor.hide();
|
||||
this._updateVisibility();
|
||||
});
|
||||
panelService.connect('focus-out', ps => {
|
||||
this._boxPointer.hide(BoxPointer.PopupAnimation.NONE);
|
||||
Main.keyboard.resetSuggestions();
|
||||
});
|
||||
},
|
||||
|
||||
_setDummyCursorGeometry(x, y, w, h) {
|
||||
|
@ -321,11 +321,7 @@ var IconGrid = new Lang.Class({
|
||||
},
|
||||
|
||||
_getVisibleChildren() {
|
||||
let children = this._grid.get_children();
|
||||
children = children.filter(function(actor) {
|
||||
return actor.visible;
|
||||
});
|
||||
return children;
|
||||
return this._grid.get_children().filter(actor => actor.visible);
|
||||
},
|
||||
|
||||
_getPreferredHeight(grid, forWidth, alloc) {
|
||||
@ -462,19 +458,19 @@ var IconGrid = new Lang.Class({
|
||||
delay: delay,
|
||||
scale_x: ANIMATION_BOUNCE_ICON_SCALE,
|
||||
scale_y: ANIMATION_BOUNCE_ICON_SCALE,
|
||||
onComplete: Lang.bind(this, function() {
|
||||
onComplete: () => {
|
||||
Tweener.addTween(actor,
|
||||
{ time: ANIMATION_TIME_IN - bounceUpTime,
|
||||
transition: 'easeInOutQuad',
|
||||
scale_x: 1,
|
||||
scale_y: 1,
|
||||
onComplete: Lang.bind(this, function() {
|
||||
onComplete: () => {
|
||||
if (isLastItem)
|
||||
this._animationDone();
|
||||
actor.reactive = true;
|
||||
})
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
@ -495,15 +491,15 @@ var IconGrid = new Lang.Class({
|
||||
// Design decision, 1/2 of the source actor size.
|
||||
let [sourceScaledWidth, sourceScaledHeight] = [sourceWidth / 2, sourceHeight / 2];
|
||||
|
||||
actors.forEach(function(actor) {
|
||||
actors.forEach(actor => {
|
||||
let [actorX, actorY] = actor._transformedPosition = actor.get_transformed_position();
|
||||
let [x, y] = [actorX - sourceX, actorY - sourceY];
|
||||
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);
|
||||
}, 0);
|
||||
let minDist = actors.reduce(function(prev, cur) {
|
||||
let minDist = actors.reduce((prev, cur) => {
|
||||
return Math.min(prev, cur._distance);
|
||||
}, Infinity);
|
||||
let normalization = maxDist - minDist;
|
||||
@ -541,14 +537,14 @@ var IconGrid = new Lang.Class({
|
||||
y: finalY,
|
||||
scale_x: 1,
|
||||
scale_y: 1,
|
||||
onComplete: Lang.bind(this, function() {
|
||||
onComplete: () => {
|
||||
if (isLastItem)
|
||||
this._animationDone();
|
||||
|
||||
actor.opacity = 255;
|
||||
actor.reactive = true;
|
||||
actorClone.destroy();
|
||||
})};
|
||||
}};
|
||||
fadeParams = { time: ANIMATION_FADE_IN_TIME_FOR_ITEM,
|
||||
transition: 'easeInOutQuad',
|
||||
delay: delay,
|
||||
@ -567,14 +563,14 @@ var IconGrid = new Lang.Class({
|
||||
y: adjustedSourcePositionY,
|
||||
scale_x: scaleX,
|
||||
scale_y: scaleY,
|
||||
onComplete: Lang.bind(this, function() {
|
||||
onComplete: () => {
|
||||
if (isLastItem) {
|
||||
this._animationDone();
|
||||
this._restoreItemsOpacity();
|
||||
}
|
||||
actor.reactive = true;
|
||||
actorClone.destroy();
|
||||
})};
|
||||
}};
|
||||
fadeParams = { time: ANIMATION_FADE_IN_TIME_FOR_ITEM,
|
||||
transition: 'easeInOutQuad',
|
||||
delay: ANIMATION_TIME_OUT + delay - ANIMATION_FADE_IN_TIME_FOR_ITEM,
|
||||
@ -1000,10 +996,7 @@ var PaginatedIconGrid = new Lang.Class({
|
||||
transition: 'easeInOutQuad'
|
||||
};
|
||||
if (i == (children.length - 1))
|
||||
params.onComplete = Lang.bind(this,
|
||||
function() {
|
||||
this.emit('space-opened');
|
||||
});
|
||||
params.onComplete = () => { this.emit('space-opened'); };
|
||||
Tweener.addTween(children[i], params);
|
||||
}
|
||||
},
|
||||
@ -1021,10 +1014,7 @@ var PaginatedIconGrid = new Lang.Class({
|
||||
{ translation_y: 0,
|
||||
time: EXTRA_SPACE_ANIMATION_TIME,
|
||||
transition: 'easeInOutQuad',
|
||||
onComplete: Lang.bind(this,
|
||||
function() {
|
||||
this.emit('space-closed');
|
||||
})
|
||||
onComplete: () => { this.emit('space-closed'); }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -189,19 +189,19 @@ var LanguageSelectionPopup = new Lang.Class({
|
||||
for (let i in inputSources) {
|
||||
let is = inputSources[i];
|
||||
|
||||
this.addAction(is.displayName, Lang.bind(this, () => {
|
||||
this.addAction(is.displayName, () => {
|
||||
inputSourceManager.activateInputSource(is, true);
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
this.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
|
||||
this.addAction(_("Region & Language Settings"), Lang.bind(this, this._launchSettings));
|
||||
this._capturedEventId = 0;
|
||||
|
||||
this._unmapId = actor.connect('notify::mapped', Lang.bind(this, function() {
|
||||
this._unmapId = actor.connect('notify::mapped', () => {
|
||||
if (!actor.is_mapped())
|
||||
this.close(true);
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_launchSettings() {
|
||||
@ -304,7 +304,7 @@ var Key = new Lang.Class({
|
||||
if (key == this.key) {
|
||||
this._pressTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
|
||||
KEY_LONG_PRESS_TIME,
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
this._longPress = true;
|
||||
this._pressTimeoutId = 0;
|
||||
|
||||
@ -319,7 +319,7 @@ var Key = new Lang.Class({
|
||||
}
|
||||
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@ -358,10 +358,10 @@ var Key = new Lang.Class({
|
||||
this._boxPointer.show(BoxPointer.PopupAnimation.FULL);
|
||||
this._capturedEventId = global.stage.connect('captured-event',
|
||||
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())
|
||||
this._hideSubkeys();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_hideSubkeys() {
|
||||
@ -384,45 +384,42 @@ var Key = new Lang.Class({
|
||||
style_class: 'keyboard-key' });
|
||||
|
||||
button.keyWidth = 1;
|
||||
button.connect('button-press-event', Lang.bind(this,
|
||||
function () {
|
||||
button.connect('button-press-event', () => {
|
||||
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);
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}));
|
||||
button.connect('button-release-event', Lang.bind(this,
|
||||
function () {
|
||||
} 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;
|
||||
}));
|
||||
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 Clutter.EVENT_PROPAGATE;
|
||||
});
|
||||
|
||||
return button;
|
||||
},
|
||||
@ -513,8 +510,8 @@ var Keyboard = new Lang.Class({
|
||||
this._lastDeviceId = null;
|
||||
this._suggestions = null;
|
||||
|
||||
Meta.get_backend().connect('last-device-changed', Lang.bind(this,
|
||||
function (backend, deviceId) {
|
||||
Meta.get_backend().connect('last-device-changed',
|
||||
(backend, deviceId) => {
|
||||
let manager = Clutter.DeviceManager.get_default();
|
||||
let device = manager.get_device(deviceId);
|
||||
|
||||
@ -522,26 +519,26 @@ var Keyboard = new Lang.Class({
|
||||
this._lastDeviceId = deviceId;
|
||||
this._syncEnabled();
|
||||
}
|
||||
}));
|
||||
});
|
||||
this._syncEnabled();
|
||||
|
||||
this._showIdleId = 0;
|
||||
|
||||
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._keyboardRequested = false;
|
||||
this._keyboardRestingId = 0;
|
||||
|
||||
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) {
|
||||
// let currentWindow = global.screen.get_display().focus_window;
|
||||
// this.setCursorLocation(currentWindow, rect.get_x(), rect.get_y(),
|
||||
// rect.get_width(), rect.get_height());
|
||||
// }
|
||||
//}));
|
||||
//});
|
||||
},
|
||||
|
||||
get visible() {
|
||||
@ -568,7 +565,7 @@ var Keyboard = new Lang.Class({
|
||||
GLib.source_remove(this._updateCaretPositionId);
|
||||
if (!this._keyboardRequested)
|
||||
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;
|
||||
|
||||
let currentWindow = global.screen.get_display().focus_window;
|
||||
@ -595,7 +592,7 @@ var Keyboard = new Lang.Class({
|
||||
}
|
||||
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
|
||||
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._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.actor.add(this._suggestions.actor,
|
||||
{ x_align: St.Align.MIDDLE,
|
||||
x_fill: false });
|
||||
@ -734,11 +731,10 @@ var Keyboard = new Lang.Class({
|
||||
}
|
||||
|
||||
if (!this._showIdleId) {
|
||||
this._showIdleId = GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE,
|
||||
Lang.bind(this, function() {
|
||||
this.show(Main.layoutManager.focusIndex);
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
this._showIdleId = GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
|
||||
this.show(Main.layoutManager.focusIndex);
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
GLib.Source.set_name_by_id(this._showIdleId, '[gnome-shell] this.show');
|
||||
}
|
||||
},
|
||||
@ -782,7 +778,7 @@ var Keyboard = new Lang.Class({
|
||||
if (button.key == ' ')
|
||||
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 ||
|
||||
!this._keyboardController.commitString(str, true)) {
|
||||
if (keyval != 0) {
|
||||
@ -790,8 +786,8 @@ var Keyboard = new Lang.Class({
|
||||
button._keyvalPress = true;
|
||||
}
|
||||
}
|
||||
}));
|
||||
button.connect('released', Lang.bind(this, function(actor, keyval, str) {
|
||||
});
|
||||
button.connect('released', (actor, keyval, str) => {
|
||||
if (keyval != 0) {
|
||||
if (button._keyvalPress)
|
||||
this._keyboardController.keyvalRelease(keyval);
|
||||
@ -800,7 +796,7 @@ var Keyboard = new Lang.Class({
|
||||
|
||||
if (!this._latched)
|
||||
this._setActiveLayer(0);
|
||||
}));
|
||||
});
|
||||
|
||||
layout.appendKey(button.actor, button.keyButton.keyWidth);
|
||||
}
|
||||
@ -833,7 +829,7 @@ var Keyboard = new Lang.Class({
|
||||
|
||||
let actor = extraButton.keyButton;
|
||||
|
||||
extraButton.connect('pressed', Lang.bind(this, function() {
|
||||
extraButton.connect('pressed', () => {
|
||||
if (switchToLevel != null) {
|
||||
this._setActiveLayer(switchToLevel);
|
||||
// Shift only gets latched on long press
|
||||
@ -841,23 +837,23 @@ var Keyboard = new Lang.Class({
|
||||
} else if (keyval != null) {
|
||||
this._keyboardController.keyvalPress(keyval);
|
||||
}
|
||||
}));
|
||||
extraButton.connect('released', Lang.bind(this, function() {
|
||||
});
|
||||
extraButton.connect('released', () => {
|
||||
if (keyval != null)
|
||||
this._keyboardController.keyvalRelease(keyval);
|
||||
else if (action == 'hide')
|
||||
this.hide();
|
||||
else if (action == 'languageMenu')
|
||||
this._popupLanguageMenu(actor);
|
||||
}));
|
||||
});
|
||||
|
||||
if (switchToLevel == 0) {
|
||||
layout.shiftKeys.push(extraButton);
|
||||
} else if (switchToLevel == 1) {
|
||||
extraButton.connect('long-press', Lang.bind(this, function() {
|
||||
extraButton.connect('long-press', () => {
|
||||
this._latched = true;
|
||||
this._setCurrentLevelLatched(this._current_page, this._latched);
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
/* Fixup default keys based on the number of levels/keys */
|
||||
@ -1019,11 +1015,11 @@ var Keyboard = new Lang.Class({
|
||||
this._clearKeyboardRestTimer();
|
||||
this._keyboardRestingId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
|
||||
KEYBOARD_REST_TIME,
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
this._clearKeyboardRestTimer();
|
||||
this._show(monitor);
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
GLib.Source.set_name_by_id(this._keyboardRestingId, '[gnome-shell] this._clearKeyboardRestTimer');
|
||||
},
|
||||
|
||||
@ -1051,11 +1047,11 @@ var Keyboard = new Lang.Class({
|
||||
this._clearKeyboardRestTimer();
|
||||
this._keyboardRestingId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
|
||||
KEYBOARD_REST_TIME,
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
this._clearKeyboardRestTimer();
|
||||
this._hide();
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
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-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() {
|
||||
|
@ -101,16 +101,18 @@ var MonitorConstraint = new Lang.Class({
|
||||
vfunc_set_actor(actor) {
|
||||
if (actor) {
|
||||
if (!this._monitorsChangedId) {
|
||||
this._monitorsChangedId = Main.layoutManager.connect('monitors-changed', Lang.bind(this, function() {
|
||||
this.actor.queue_relayout();
|
||||
}));
|
||||
this._monitorsChangedId =
|
||||
Main.layoutManager.connect('monitors-changed', () => {
|
||||
this.actor.queue_relayout();
|
||||
});
|
||||
}
|
||||
|
||||
if (!this._workareasChangedId) {
|
||||
this._workareasChangedId = global.screen.connect('workareas-changed', Lang.bind(this, function() {
|
||||
if (this._workArea)
|
||||
this.actor.queue_relayout();
|
||||
}));
|
||||
this._workareasChangedId =
|
||||
global.screen.connect('workareas-changed', () => {
|
||||
if (this._workArea)
|
||||
this.actor.queue_relayout();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (this._monitorsChangedId)
|
||||
@ -201,22 +203,19 @@ var LayoutManager = new Lang.Class({
|
||||
|
||||
// Set up stage hierarchy to group all UI actors under one container.
|
||||
this.uiGroup = new Shell.GenericContainer({ name: 'uiGroup' });
|
||||
this.uiGroup.connect('allocate',
|
||||
function (actor, box, flags) {
|
||||
let children = actor.get_children();
|
||||
for (let i = 0; i < children.length; i++)
|
||||
children[i].allocate_preferred_size(flags);
|
||||
});
|
||||
this.uiGroup.connect('get-preferred-width',
|
||||
function(actor, forHeight, alloc) {
|
||||
let width = global.stage.width;
|
||||
[alloc.min_size, alloc.natural_size] = [width, width];
|
||||
});
|
||||
this.uiGroup.connect('get-preferred-height',
|
||||
function(actor, forWidth, alloc) {
|
||||
let height = global.stage.height;
|
||||
[alloc.min_size, alloc.natural_size] = [height, height];
|
||||
});
|
||||
this.uiGroup.connect('allocate', (actor, box, flags) => {
|
||||
let children = actor.get_children();
|
||||
for (let i = 0; i < children.length; i++)
|
||||
children[i].allocate_preferred_size(flags);
|
||||
});
|
||||
this.uiGroup.connect('get-preferred-width', (actor, forHeight, alloc) => {
|
||||
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;
|
||||
[alloc.min_size, alloc.natural_size] = [height, height];
|
||||
});
|
||||
|
||||
global.stage.remove_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
|
||||
if (Shell.util_need_background_refresh()) {
|
||||
LoginManager.getLoginManager().connect('prepare-for-sleep',
|
||||
function(lm, suspending) {
|
||||
if (suspending)
|
||||
return;
|
||||
Meta.Background.refresh_all();
|
||||
});
|
||||
(lm, suspending) => {
|
||||
if (suspending)
|
||||
return;
|
||||
Meta.Background.refresh_all();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@ -359,7 +358,7 @@ var LayoutManager = new Lang.Class({
|
||||
|
||||
_updateHotCorners() {
|
||||
// destroy old hot corners
|
||||
this.hotCorners.forEach(function(corner) {
|
||||
this.hotCorners.forEach(corner => {
|
||||
if (corner)
|
||||
corner.destroy();
|
||||
});
|
||||
@ -487,7 +486,7 @@ var LayoutManager = new Lang.Class({
|
||||
this._updatePanelBarrier();
|
||||
|
||||
let size = this.panelBox.height;
|
||||
this.hotCorners.forEach(function(corner) {
|
||||
this.hotCorners.forEach(corner => {
|
||||
if (corner)
|
||||
corner.setBarrierSize(size);
|
||||
});
|
||||
@ -584,13 +583,13 @@ var LayoutManager = new Lang.Class({
|
||||
coordinate: Clutter.BindCoordinate.ALL });
|
||||
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.actor.show();
|
||||
global.stage.show();
|
||||
|
||||
this._prepareStartupAnimation();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
// Startup Animations
|
||||
@ -652,10 +651,10 @@ var LayoutManager = new Lang.Class({
|
||||
// until the event loop is uncontended and idle.
|
||||
// This helps to prevent us from running the animation
|
||||
// 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();
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
GLib.Source.set_name_by_id(id, '[gnome-shell] this._startupAnimation');
|
||||
},
|
||||
|
||||
@ -727,9 +726,9 @@ var LayoutManager = new Lang.Class({
|
||||
// anchor point changes
|
||||
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;
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
hideKeyboard(immediate) {
|
||||
@ -940,7 +939,7 @@ var LayoutManager = new Lang.Class({
|
||||
},
|
||||
|
||||
_getWindowActorsForWorkspace(workspace) {
|
||||
return global.get_window_actors().filter(function (actor) {
|
||||
return global.get_window_actors().filter(actor => {
|
||||
let win = actor.meta_window;
|
||||
return win.located_on_workspace(workspace);
|
||||
});
|
||||
@ -1359,7 +1358,7 @@ var PressureBarrier = new Lang.Class({
|
||||
|
||||
_onBarrierLeft(barrier, event) {
|
||||
barrier._isHit = false;
|
||||
if (this._barriers.every(function(b) { return !b._isHit; })) {
|
||||
if (this._barriers.every(b => !b._isHit)) {
|
||||
this._reset();
|
||||
this._isTriggered = false;
|
||||
}
|
||||
|
@ -171,20 +171,20 @@ var Lightbox = new Lang.Class({
|
||||
vignetteSharpness: VIGNETTE_SHARPNESS,
|
||||
time: fadeInTime,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this, function() {
|
||||
onComplete: () => {
|
||||
this.shown = true;
|
||||
this.emit('shown');
|
||||
})
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Tweener.addTween(this.actor,
|
||||
{ opacity: 255 * this._fadeFactor,
|
||||
time: fadeInTime,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this, function() {
|
||||
onComplete: () => {
|
||||
this.shown = true;
|
||||
this.emit('shown');
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -203,18 +203,18 @@ var Lightbox = new Lang.Class({
|
||||
opacity: 0,
|
||||
time: fadeOutTime,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this, function() {
|
||||
onComplete: () => {
|
||||
this.actor.hide();
|
||||
})
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Tweener.addTween(this.actor,
|
||||
{ opacity: 0,
|
||||
time: fadeOutTime,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this, function() {
|
||||
onComplete: () => {
|
||||
this.actor.hide();
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -53,7 +53,9 @@ var AUTO_COMPLETE_GLOBAL_KEYWORDS = _getAutoCompleteGlobalKeywords();
|
||||
function _getAutoCompleteGlobalKeywords() {
|
||||
const keywords = ['true', 'false', 'null', 'new'];
|
||||
// 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);
|
||||
|
||||
return keywords.concat(windowProperties).concat(headerProperties);
|
||||
@ -142,10 +144,10 @@ var Notebook = new Lang.Class({
|
||||
reactive: true,
|
||||
track_hover: true });
|
||||
let label = new St.Button({ label: name });
|
||||
label.connect('clicked', Lang.bind(this, function () {
|
||||
label.connect('clicked', () => {
|
||||
this.selectChild(child);
|
||||
return true;
|
||||
}));
|
||||
});
|
||||
labelBox.add(label, { expand: true });
|
||||
this.tabControls.add(labelBox);
|
||||
|
||||
@ -163,8 +165,8 @@ var Notebook = new Lang.Class({
|
||||
this.actor.add(scrollview, { expand: true });
|
||||
|
||||
let vAdjust = scrollview.vscroll.adjustment;
|
||||
vAdjust.connect('changed', Lang.bind(this, function () { this._onAdjustScopeChanged(tabData); }));
|
||||
vAdjust.connect('notify::value', Lang.bind(this, function() { this._onAdjustValueChanged(tabData); }));
|
||||
vAdjust.connect('changed', () => { this._onAdjustScopeChanged(tabData); });
|
||||
vAdjust.connect('notify::value', () => { this._onAdjustValueChanged(tabData); });
|
||||
|
||||
if (this._selectedIndex == -1)
|
||||
this.selectIndex(0);
|
||||
@ -821,34 +823,34 @@ var LookingGlass = new Lang.Class({
|
||||
icon_size: 24 });
|
||||
toolbar.add_actor(inspectIcon);
|
||||
inspectIcon.reactive = true;
|
||||
inspectIcon.connect('button-press-event', Lang.bind(this, function () {
|
||||
inspectIcon.connect('button-press-event', () => {
|
||||
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);
|
||||
}));
|
||||
inspector.connect('closed', Lang.bind(this, function() {
|
||||
});
|
||||
inspector.connect('closed', () => {
|
||||
this.actor.show();
|
||||
global.stage.set_key_focus(this._entry);
|
||||
}));
|
||||
});
|
||||
this.actor.hide();
|
||||
return Clutter.EVENT_STOP;
|
||||
}));
|
||||
});
|
||||
|
||||
let gcIcon = new St.Icon({ icon_name: 'user-trash-full',
|
||||
icon_size: 24 });
|
||||
toolbar.add_actor(gcIcon);
|
||||
gcIcon.reactive = true;
|
||||
gcIcon.connect('button-press-event', Lang.bind(this, function () {
|
||||
gcIcon.connect('button-press-event', () => {
|
||||
gcIcon.icon_name = 'user-trash';
|
||||
System.gc();
|
||||
this._timeoutId = Mainloop.timeout_add(500, Lang.bind(this, function () {
|
||||
this._timeoutId = Mainloop.timeout_add(500, () => {
|
||||
gcIcon.icon_name = 'user-trash-full';
|
||||
this._timeoutId = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] gcIcon.icon_name = \'user-trash-full\'');
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}));
|
||||
});
|
||||
|
||||
let notebook = new Notebook();
|
||||
this._notebook = notebook;
|
||||
@ -880,7 +882,7 @@ var LookingGlass = new Lang.Class({
|
||||
this._extensions = new Extensions(this);
|
||||
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
|
||||
this._hideCompletions();
|
||||
|
||||
@ -894,21 +896,21 @@ var LookingGlass = new Lang.Class({
|
||||
return true;
|
||||
this._evaluate(text);
|
||||
return true;
|
||||
}));
|
||||
});
|
||||
|
||||
this._history = new History.HistoryManager({ gsettingsKey: HISTORY_KEY,
|
||||
entry: this._entry.clutter_text });
|
||||
|
||||
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);
|
||||
}));
|
||||
});
|
||||
// If a completion is completed unambiguously, the currently-displayed completion
|
||||
// suggestions become irrelevant.
|
||||
this._autoComplete.connect('completion', Lang.bind(this, function(a,e) {
|
||||
this._autoComplete.connect('completion', (a, e) => {
|
||||
if (e.type == 'whole-word')
|
||||
this._hideCompletions();
|
||||
}));
|
||||
});
|
||||
|
||||
this._resize();
|
||||
},
|
||||
@ -987,9 +989,9 @@ var LookingGlass = new Lang.Class({
|
||||
transition: 'easeOutQuad',
|
||||
height: 0,
|
||||
opacity: 0,
|
||||
onComplete: Lang.bind(this, function () {
|
||||
onComplete: () => {
|
||||
this._completionActor.hide();
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
@ -1030,8 +1032,7 @@ var LookingGlass = new Lang.Class({
|
||||
},
|
||||
|
||||
_queueResize() {
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
|
||||
Lang.bind(this, function () { this._resize(); }));
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => { this._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),
|
||||
transition: 'easeOutQuad',
|
||||
y: this._hiddenY,
|
||||
onComplete: Lang.bind(this, function () {
|
||||
onComplete: () => {
|
||||
this.actor.hide();
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -111,7 +111,7 @@ var Magnifier = new Lang.Class({
|
||||
setActive(activate) {
|
||||
let isActive = this.isActive();
|
||||
|
||||
this._zoomRegions.forEach (function(zoomRegion, index, array) {
|
||||
this._zoomRegions.forEach ((zoomRegion, index, array) => {
|
||||
zoomRegion.setActive(activate);
|
||||
});
|
||||
|
||||
@ -189,7 +189,7 @@ var Magnifier = new Lang.Class({
|
||||
this.yMouse = yMouse;
|
||||
|
||||
let sysMouseOverAny = false;
|
||||
this._zoomRegions.forEach(function(zoomRegion, index, array) {
|
||||
this._zoomRegions.forEach((zoomRegion, index, array) => {
|
||||
if (zoomRegion.scrollToMousePos())
|
||||
sysMouseOverAny = true;
|
||||
});
|
||||
@ -287,7 +287,7 @@ var Magnifier = new Lang.Class({
|
||||
this.setCrosshairsClip(clip);
|
||||
|
||||
let theCrossHairs = this._crossHairs;
|
||||
this._zoomRegions.forEach (function(zoomRegion, index, array) {
|
||||
this._zoomRegions.forEach ((zoomRegion, index, array) => {
|
||||
zoomRegion.addCrosshairs(theCrossHairs);
|
||||
});
|
||||
},
|
||||
@ -447,10 +447,9 @@ var Magnifier = new Lang.Class({
|
||||
this._appSettings = new Gio.Settings({ schema_id: APPLICATIONS_SCHEMA });
|
||||
this._settings = new Gio.Settings({ schema_id: MAGNIFIER_SCHEMA });
|
||||
|
||||
this._appSettings.connect('changed::' + SHOW_KEY,
|
||||
Lang.bind(this, function() {
|
||||
this._appSettings.connect('changed::' + SHOW_KEY, () => {
|
||||
this.setActive(this._appSettings.get_boolean(SHOW_KEY));
|
||||
}));
|
||||
});
|
||||
|
||||
this._settings.connect('changed::' + SCREEN_POSITION_KEY,
|
||||
Lang.bind(this, this._updateScreenPosition));
|
||||
@ -486,35 +485,29 @@ var Magnifier = new Lang.Class({
|
||||
this._settings.connect('changed::' + CONTRAST_BLUE_KEY,
|
||||
Lang.bind(this, this._updateContrast));
|
||||
|
||||
this._settings.connect('changed::' + SHOW_CROSS_HAIRS_KEY,
|
||||
Lang.bind(this, function() {
|
||||
this._settings.connect('changed::' + SHOW_CROSS_HAIRS_KEY, () => {
|
||||
this.setCrosshairsVisible(this._settings.get_boolean(SHOW_CROSS_HAIRS_KEY));
|
||||
}));
|
||||
});
|
||||
|
||||
this._settings.connect('changed::' + CROSS_HAIRS_THICKNESS_KEY,
|
||||
Lang.bind(this, function() {
|
||||
this._settings.connect('changed::' + CROSS_HAIRS_THICKNESS_KEY, () => {
|
||||
this.setCrosshairsThickness(this._settings.get_int(CROSS_HAIRS_THICKNESS_KEY));
|
||||
}));
|
||||
});
|
||||
|
||||
this._settings.connect('changed::' + CROSS_HAIRS_COLOR_KEY,
|
||||
Lang.bind(this, function() {
|
||||
this._settings.connect('changed::' + CROSS_HAIRS_COLOR_KEY, () => {
|
||||
this.setCrosshairsColor(this._settings.get_string(CROSS_HAIRS_COLOR_KEY));
|
||||
}));
|
||||
});
|
||||
|
||||
this._settings.connect('changed::' + CROSS_HAIRS_OPACITY_KEY,
|
||||
Lang.bind(this, function() {
|
||||
this._settings.connect('changed::' + CROSS_HAIRS_OPACITY_KEY, () => {
|
||||
this.setCrosshairsOpacity(this._settings.get_double(CROSS_HAIRS_OPACITY_KEY));
|
||||
}));
|
||||
});
|
||||
|
||||
this._settings.connect('changed::' + CROSS_HAIRS_LENGTH_KEY,
|
||||
Lang.bind(this, function() {
|
||||
this._settings.connect('changed::' + CROSS_HAIRS_LENGTH_KEY, () => {
|
||||
this.setCrosshairsLength(this._settings.get_int(CROSS_HAIRS_LENGTH_KEY));
|
||||
}));
|
||||
});
|
||||
|
||||
this._settings.connect('changed::' + CROSS_HAIRS_CLIP_KEY,
|
||||
Lang.bind(this, function() {
|
||||
this._settings.connect('changed::' + CROSS_HAIRS_CLIP_KEY, () => {
|
||||
this.setCrosshairsClip(this._settings.get_boolean(CROSS_HAIRS_CLIP_KEY));
|
||||
}));
|
||||
});
|
||||
|
||||
if (zoomRegion) {
|
||||
// Mag factor is accurate to two decimal places.
|
||||
@ -1088,10 +1081,10 @@ var ZoomRegion = new Lang.Class({
|
||||
}
|
||||
|
||||
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);
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -203,7 +203,7 @@ var ShellMagnifier = new Lang.Class({
|
||||
let zoomRegions = Main.magnifier.getZoomRegions();
|
||||
let objectPaths = [];
|
||||
let thoseZoomers = this._zoomers;
|
||||
zoomRegions.forEach (function(aZoomRegion, index, array) {
|
||||
zoomRegions.forEach ((aZoomRegion, index, array) => {
|
||||
let found = false;
|
||||
for (let objectPath in thoseZoomers) {
|
||||
let proxyAndZoomRegion = thoseZoomers[objectPath];
|
||||
|
@ -119,7 +119,9 @@ function start() {
|
||||
global.log = window.log;
|
||||
|
||||
// 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');
|
||||
|
||||
@ -190,17 +192,17 @@ function _initializeUI() {
|
||||
|
||||
_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))
|
||||
overview.toggle();
|
||||
}));
|
||||
});
|
||||
|
||||
global.display.connect('show-restart-message', function(display, message) {
|
||||
global.display.connect('show-restart-message', (display, message) => {
|
||||
showRestartMessage(message);
|
||||
return true;
|
||||
});
|
||||
|
||||
global.display.connect('restart', function() {
|
||||
global.display.connect('restart', () => {
|
||||
global.reexec_self();
|
||||
return true;
|
||||
});
|
||||
@ -227,12 +229,12 @@ function _initializeUI() {
|
||||
ExtensionSystem.init();
|
||||
|
||||
if (sessionMode.isGreeter && screenShield) {
|
||||
layoutManager.connect('startup-prepared', function() {
|
||||
layoutManager.connect('startup-prepared', () => {
|
||||
screenShield.showDialog();
|
||||
});
|
||||
}
|
||||
|
||||
layoutManager.connect('startup-complete', function() {
|
||||
layoutManager.connect('startup-complete', () => {
|
||||
if (actionMode == Shell.ActionMode.NONE) {
|
||||
actionMode = Shell.ActionMode.NORMAL;
|
||||
}
|
||||
@ -423,7 +425,7 @@ function pushModal(actor, params) {
|
||||
}
|
||||
|
||||
modalCount += 1;
|
||||
let actorDestroyId = actor.connect('destroy', function() {
|
||||
let actorDestroyId = actor.connect('destroy', () => {
|
||||
let index = _findModal(actor);
|
||||
if (index >= 0)
|
||||
popModal(actor);
|
||||
@ -432,7 +434,7 @@ function pushModal(actor, params) {
|
||||
let prevFocus = global.stage.get_key_focus();
|
||||
let prevFocusDestroyId;
|
||||
if (prevFocus != null) {
|
||||
prevFocusDestroyId = prevFocus.connect('destroy', function() {
|
||||
prevFocusDestroyId = prevFocus.connect('destroy', () => {
|
||||
let index = _findModal(actor);
|
||||
if (index >= 0)
|
||||
modalActorFocusStack[index].prevFocus = null;
|
||||
@ -606,7 +608,7 @@ function _runBeforeRedrawQueue() {
|
||||
function _queueBeforeRedraw(workId) {
|
||||
_beforeRedrawQueue.push(workId);
|
||||
if (_beforeRedrawQueue.length == 1) {
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, function () {
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||
_runBeforeRedrawQueue();
|
||||
return false;
|
||||
});
|
||||
@ -636,12 +638,12 @@ function initializeDeferredWork(actor, callback, props) {
|
||||
let workId = '' + (++_deferredWorkSequence);
|
||||
_deferredWorkData[workId] = { 'actor': actor,
|
||||
'callback': callback };
|
||||
actor.connect('notify::mapped', function () {
|
||||
actor.connect('notify::mapped', () => {
|
||||
if (!(actor.mapped && _deferredWorkQueue.indexOf(workId) >= 0))
|
||||
return;
|
||||
_queueBeforeRedraw(workId);
|
||||
});
|
||||
actor.connect('destroy', function() {
|
||||
actor.connect('destroy', () => {
|
||||
let index = _deferredWorkQueue.indexOf(workId);
|
||||
if (index >= 0)
|
||||
_deferredWorkQueue.splice(index, 1);
|
||||
@ -673,7 +675,7 @@ function queueDeferredWork(workId) {
|
||||
_queueBeforeRedraw(workId);
|
||||
return;
|
||||
} else if (_deferredTimeoutId == 0) {
|
||||
_deferredTimeoutId = Mainloop.timeout_add_seconds(DEFERRED_TIMEOUT_SECONDS, function () {
|
||||
_deferredTimeoutId = Mainloop.timeout_add_seconds(DEFERRED_TIMEOUT_SECONDS, () => {
|
||||
_runAllDeferredWork();
|
||||
_deferredTimeoutId = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
|
@ -48,7 +48,7 @@ var URLHighlighter = new Lang.Class({
|
||||
this.actor = new St.Label({ reactive: true, style_class: 'url-highlighter',
|
||||
x_expand: true, x_align: Clutter.ActorAlign.START });
|
||||
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);
|
||||
if (hasColor) {
|
||||
let linkColor = color.to_string().substr(0, 7);
|
||||
@ -57,12 +57,12 @@ var URLHighlighter = new Lang.Class({
|
||||
this._highlightUrls();
|
||||
}
|
||||
}
|
||||
}));
|
||||
});
|
||||
this.actor.clutter_text.line_wrap = lineWrap;
|
||||
this.actor.clutter_text.line_wrap_mode = Pango.WrapMode.WORD_CHAR;
|
||||
|
||||
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.
|
||||
// The MessageTray doesn't actually hide us, so
|
||||
// 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
|
||||
// handler, if an URL is clicked
|
||||
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)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
@ -88,8 +88,8 @@ var URLHighlighter = new Lang.Class({
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
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)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
@ -102,8 +102,8 @@ var URLHighlighter = new Lang.Class({
|
||||
this._cursorChanged = false;
|
||||
}
|
||||
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)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
@ -112,7 +112,7 @@ var URLHighlighter = new Lang.Class({
|
||||
global.screen.set_cursor(Meta.Cursor.DEFAULT);
|
||||
}
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
setMarkup(text, allowMarkup) {
|
||||
@ -183,10 +183,9 @@ var ScaleLayout = new Lang.Class({
|
||||
|
||||
if (this._container)
|
||||
for (let signal of ['notify::scale-x', 'notify::scale-y']) {
|
||||
let id = this._container.connect(signal, Lang.bind(this,
|
||||
function() {
|
||||
this.layout_changed();
|
||||
}));
|
||||
let id = this._container.connect(signal, () => {
|
||||
this.layout_changed();
|
||||
});
|
||||
this._signals.push(id);
|
||||
}
|
||||
},
|
||||
@ -541,7 +540,7 @@ var MessageListSection = new Lang.Class({
|
||||
|
||||
let id = Main.sessionMode.connect('updated',
|
||||
Lang.bind(this, this._sync));
|
||||
this.actor.connect('destroy', function() {
|
||||
this.actor.connect('destroy', () => {
|
||||
Main.sessionMode.disconnect(id);
|
||||
});
|
||||
|
||||
@ -585,14 +584,12 @@ var MessageListSection = new Lang.Class({
|
||||
scale_x: scale, scale_y: scale });
|
||||
obj.keyFocusId = message.actor.connect('key-focus-in',
|
||||
Lang.bind(this, this._onKeyFocusIn));
|
||||
obj.destroyId = message.actor.connect('destroy',
|
||||
Lang.bind(this, function() {
|
||||
this.removeMessage(message, false);
|
||||
}));
|
||||
obj.closeId = message.connect('close',
|
||||
Lang.bind(this, function() {
|
||||
this.removeMessage(message, true);
|
||||
}));
|
||||
obj.destroyId = message.actor.connect('destroy', () => {
|
||||
this.removeMessage(message, false);
|
||||
});
|
||||
obj.closeId = message.connect('close', () => {
|
||||
this.removeMessage(message, true);
|
||||
});
|
||||
|
||||
this._messages.set(message, obj);
|
||||
obj.container.add_actor(message.actor);
|
||||
@ -614,13 +611,13 @@ var MessageListSection = new Lang.Class({
|
||||
return;
|
||||
}
|
||||
|
||||
let onComplete = Lang.bind(this, function() {
|
||||
let onComplete = () => {
|
||||
this._list.set_child_at_index(obj.container, index);
|
||||
Tweener.addTween(obj.container, { scale_x: 1,
|
||||
scale_y: 1,
|
||||
time: MESSAGE_ANIMATION_TIME,
|
||||
transition: 'easeOutQuad' });
|
||||
});
|
||||
};
|
||||
Tweener.addTween(obj.container, { scale_x: 0,
|
||||
scale_y: 0,
|
||||
time: MESSAGE_ANIMATION_TIME,
|
||||
@ -652,13 +649,11 @@ var MessageListSection = new Lang.Class({
|
||||
},
|
||||
|
||||
clear() {
|
||||
let messages = [...this._messages.keys()].filter(function(message) {
|
||||
return message.canClose();
|
||||
});
|
||||
let messages = [...this._messages.keys()].filter(msg => msg.canClose());
|
||||
|
||||
// If there are few messages, letting them all zoom out looks OK
|
||||
if (messages.length < 2) {
|
||||
messages.forEach(function(message) {
|
||||
messages.forEach(message => {
|
||||
message.close();
|
||||
});
|
||||
} else {
|
||||
|
@ -504,14 +504,13 @@ var NotificationBanner = new Lang.Class({
|
||||
this._addActions();
|
||||
this._addSecondaryIcon();
|
||||
|
||||
this._activatedId = this.notification.connect('activated',
|
||||
Lang.bind(this, function() {
|
||||
// We hide all types of notifications once the user clicks on
|
||||
// them because the common outcome of clicking should be the
|
||||
// relevant window being brought forward and the user's
|
||||
// attention switching to the window.
|
||||
this.emit('done-displaying');
|
||||
}));
|
||||
this._activatedId = this.notification.connect('activated', () => {
|
||||
// We hide all types of notifications once the user clicks on
|
||||
// them because the common outcome of clicking should be the
|
||||
// relevant window being brought forward and the user's
|
||||
// attention switching to the window.
|
||||
this.emit('done-displaying');
|
||||
});
|
||||
},
|
||||
|
||||
_onDestroy() {
|
||||
@ -533,10 +532,9 @@ var NotificationBanner = new Lang.Class({
|
||||
},
|
||||
|
||||
_addActions() {
|
||||
this.notification.actions.forEach(Lang.bind(this,
|
||||
function(action) {
|
||||
this.addAction(action.label, action.callback);
|
||||
}));
|
||||
this.notification.actions.forEach(action => {
|
||||
this.addAction(action.label, action.callback);
|
||||
});
|
||||
},
|
||||
|
||||
_addSecondaryIcon() {
|
||||
@ -559,7 +557,7 @@ var NotificationBanner = new Lang.Class({
|
||||
return null;
|
||||
|
||||
this._buttonBox.add(button);
|
||||
button.connect('clicked', Lang.bind(this, function() {
|
||||
button.connect('clicked', () => {
|
||||
callback();
|
||||
|
||||
if (!this.notification.resident) {
|
||||
@ -570,7 +568,7 @@ var NotificationBanner = new Lang.Class({
|
||||
this.emit('done-displaying');
|
||||
this.notification.destroy();
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
||||
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-height', Lang.bind(this, this._getPreferredHeight));
|
||||
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._actorDestroyed = true;
|
||||
}));
|
||||
});
|
||||
this._actorDestroyed = false;
|
||||
|
||||
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() });
|
||||
this._counterBin.hide();
|
||||
|
||||
this._counterBin.connect('style-changed', Lang.bind(this, function() {
|
||||
this._counterBin.connect('style-changed', () => {
|
||||
let themeNode = this._counterBin.get_theme_node();
|
||||
this._counterBin.translation_x = themeNode.get_length('-shell-counter-overlap-x');
|
||||
this._counterBin.translation_y = themeNode.get_length('-shell-counter-overlap-y');
|
||||
}));
|
||||
});
|
||||
|
||||
this.actor.add_actor(this._counterBin);
|
||||
|
||||
this._countUpdatedId = this._source.connect('count-updated', Lang.bind(this, this._updateCount));
|
||||
this._updateCount();
|
||||
|
||||
this.actor.connect('destroy', function() {
|
||||
this.actor.connect('destroy', () => {
|
||||
this._source.disconnect(this._countUpdatedId);
|
||||
});
|
||||
},
|
||||
@ -736,7 +734,7 @@ var Source = new Lang.Class({
|
||||
},
|
||||
|
||||
get unseenCount() {
|
||||
return this.notifications.filter(function(n) { return !n.acknowledged; }).length;
|
||||
return this.notifications.filter(n => !n.acknowledged).length;
|
||||
},
|
||||
|
||||
get countVisible() {
|
||||
@ -844,26 +842,25 @@ var MessageTray = new Lang.Class({
|
||||
Name: 'MessageTray',
|
||||
|
||||
_init() {
|
||||
this._presence = new GnomeSession.Presence(Lang.bind(this, function(proxy, error) {
|
||||
this._presence = new GnomeSession.Presence((proxy, error) => {
|
||||
this._onStatusChanged(proxy.status);
|
||||
}));
|
||||
});
|
||||
this._busy = 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);
|
||||
}));
|
||||
});
|
||||
|
||||
global.stage.connect('enter-event', Lang.bind(this,
|
||||
function(a, ev) {
|
||||
// HACK: St uses ClutterInputDevice for hover tracking, which
|
||||
// misses relevant X11 events when untracked actors are
|
||||
// involved (read: the notification banner in normal mode),
|
||||
// so fix up Clutter's view of the pointer position in
|
||||
// that case.
|
||||
let related = ev.get_related();
|
||||
if (!related || this.actor.contains(related))
|
||||
global.sync_pointer();
|
||||
}));
|
||||
global.stage.connect('enter-event', (a, ev) => {
|
||||
// HACK: St uses ClutterInputDevice for hover tracking, which
|
||||
// misses relevant X11 events when untracked actors are
|
||||
// involved (read: the notification banner in normal mode),
|
||||
// so fix up Clutter's view of the pointer position in
|
||||
// that case.
|
||||
let related = ev.get_related();
|
||||
if (!related || this.actor.contains(related))
|
||||
global.sync_pointer();
|
||||
});
|
||||
|
||||
this.actor = new St.Widget({ visible: false,
|
||||
clip_to_allocation: true,
|
||||
@ -1093,9 +1090,9 @@ var MessageTray = new Lang.Class({
|
||||
notification.connect('destroy',
|
||||
Lang.bind(this, this._onNotificationDestroy));
|
||||
this._notificationQueue.push(notification);
|
||||
this._notificationQueue.sort(function(notification1, notification2) {
|
||||
return (notification2.urgency - notification1.urgency);
|
||||
});
|
||||
this._notificationQueue.sort(
|
||||
(n1, n2) => n2.urgency - n1.urgency
|
||||
);
|
||||
this.emit('queue-changed');
|
||||
}
|
||||
}
|
||||
@ -1219,7 +1216,7 @@ var MessageTray = new Lang.Class({
|
||||
|
||||
// Filter out acknowledged notifications.
|
||||
let changed = false;
|
||||
this._notificationQueue = this._notificationQueue.filter(function(n) {
|
||||
this._notificationQueue = this._notificationQueue.filter(n => {
|
||||
changed = changed || n.acknowledged;
|
||||
return !n.acknowledged;
|
||||
});
|
||||
@ -1310,9 +1307,9 @@ var MessageTray = new Lang.Class({
|
||||
this._banner = this._notification.createBanner();
|
||||
this._bannerClickedId = this._banner.connect('done-displaying',
|
||||
Lang.bind(this, this._escapeTray));
|
||||
this._bannerUnfocusedId = this._banner.connect('unfocused', Lang.bind(this, function() {
|
||||
this._bannerUnfocusedId = this._banner.connect('unfocused', () => {
|
||||
this._updateState();
|
||||
}));
|
||||
});
|
||||
|
||||
this._bannerBin.add_actor(this._banner.actor);
|
||||
|
||||
|
@ -142,11 +142,10 @@ var ModalDialog = new Lang.Class({
|
||||
{ opacity: 255,
|
||||
time: this._shouldFadeIn ? OPEN_AND_CLOSE_TIME : 0,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this,
|
||||
function() {
|
||||
this.state = State.OPENED;
|
||||
this.emit('opened');
|
||||
})
|
||||
onComplete: () => {
|
||||
this.state = State.OPENED;
|
||||
this.emit('opened');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@ -156,10 +155,10 @@ var ModalDialog = new Lang.Class({
|
||||
|
||||
this._initialKeyFocus = actor;
|
||||
|
||||
this._initialKeyFocusDestroyId = actor.connect('destroy', Lang.bind(this, function() {
|
||||
this._initialKeyFocusDestroyId = actor.connect('destroy', () => {
|
||||
this._initialKeyFocus = null;
|
||||
this._initialKeyFocusDestroyId = 0;
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
open(timestamp, onPrimary) {
|
||||
@ -269,10 +268,9 @@ var ModalDialog = new Lang.Class({
|
||||
{ opacity: 0,
|
||||
time: FADE_OUT_DIALOG_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this,
|
||||
function() {
|
||||
this.state = State.FADED_OUT;
|
||||
})
|
||||
onComplete: () => {
|
||||
this.state = State.FADED_OUT;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -60,19 +60,19 @@ var MediaMessage = new Lang.Class({
|
||||
this.setIcon(this._icon);
|
||||
|
||||
this._prevButton = this.addMediaControl('media-skip-backward-symbolic',
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
this._player.previous();
|
||||
}));
|
||||
});
|
||||
|
||||
this._playPauseButton = this.addMediaControl(null,
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
this._player.playPause();
|
||||
}));
|
||||
});
|
||||
|
||||
this._nextButton = this.addMediaControl('media-skip-forward-symbolic',
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
this._player.next();
|
||||
}));
|
||||
});
|
||||
|
||||
this._player.connect('changed', Lang.bind(this, this._update));
|
||||
this._player.connect('closed', Lang.bind(this, this.close));
|
||||
@ -191,10 +191,10 @@ var MprisPlayer = new Lang.Class({
|
||||
|
||||
_onMprisProxyReady() {
|
||||
this._ownerNotifyId = this._mprisProxy.connect('notify::g-name-owner',
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
if (!this._mprisProxy.g_name_owner)
|
||||
this._close();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_onPlayerProxyReady() {
|
||||
@ -250,29 +250,27 @@ var MediaSection = new Lang.Class({
|
||||
return;
|
||||
|
||||
let player = new MprisPlayer(busName);
|
||||
player.connect('closed', Lang.bind(this,
|
||||
function() {
|
||||
player.connect('closed',
|
||||
() => {
|
||||
this._players.delete(busName);
|
||||
}));
|
||||
player.connect('show', Lang.bind(this,
|
||||
function() {
|
||||
});
|
||||
player.connect('show',
|
||||
() => {
|
||||
let message = new MediaMessage(player);
|
||||
this.addMessage(message, true);
|
||||
}));
|
||||
});
|
||||
this._players.set(busName, player);
|
||||
},
|
||||
|
||||
_onProxyReady() {
|
||||
this._proxy.ListNamesRemote(Lang.bind(this,
|
||||
function([names]) {
|
||||
names.forEach(Lang.bind(this,
|
||||
function(name) {
|
||||
if (!name.startsWith(MPRIS_PLAYER_PREFIX))
|
||||
return;
|
||||
this._proxy.ListNamesRemote(([names]) => {
|
||||
names.forEach(name => {
|
||||
if (!name.startsWith(MPRIS_PLAYER_PREFIX))
|
||||
return;
|
||||
|
||||
this._addPlayer(name);
|
||||
}));
|
||||
}));
|
||||
this._addPlayer(name);
|
||||
});
|
||||
});
|
||||
this._proxy.connectSignal('NameOwnerChanged',
|
||||
Lang.bind(this, this._onNameOwnerChanged));
|
||||
},
|
||||
|
@ -190,11 +190,11 @@ var FdoNotificationDaemon = new Lang.Class({
|
||||
source = new FdoNotificationDaemonSource(title, pid, sender, appId);
|
||||
|
||||
this._sources.push(source);
|
||||
source.connect('destroy', Lang.bind(this, function() {
|
||||
source.connect('destroy', () => {
|
||||
let index = this._sources.indexOf(source);
|
||||
if (index >= 0)
|
||||
this._sources.splice(index, 1);
|
||||
}));
|
||||
});
|
||||
|
||||
Main.messageTray.add(source);
|
||||
return source;
|
||||
@ -220,11 +220,10 @@ var FdoNotificationDaemon = new Lang.Class({
|
||||
// Ignore replacesId since we already sent back a
|
||||
// NotificationClosed for that id.
|
||||
id = this._nextNotificationId++;
|
||||
let idle_id = Mainloop.idle_add(Lang.bind(this,
|
||||
function () {
|
||||
this._emitNotificationClosed(id, NotificationClosedReason.DISMISSED);
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
let idle_id = Mainloop.idle_add(() => {
|
||||
this._emitNotificationClosed(id, NotificationClosedReason.DISMISSED);
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
GLib.Source.set_name_by_id(idle_id, '[gnome-shell] this._emitNotificationClosed');
|
||||
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]));;
|
||||
}
|
||||
|
||||
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
|
||||
ndata = this._notifications[id];
|
||||
if (!ndata)
|
||||
@ -300,11 +299,11 @@ var FdoNotificationDaemon = new Lang.Class({
|
||||
source = this._getSource(appName, pid, ndata, sender, null);
|
||||
|
||||
this._senderToPid[sender] = pid;
|
||||
source.connect('destroy', Lang.bind(this, function() {
|
||||
source.connect('destroy', () => {
|
||||
delete this._senderToPid[sender];
|
||||
}));
|
||||
});
|
||||
this._notifyForSource(source, ndata);
|
||||
}));
|
||||
});
|
||||
|
||||
return invocation.return_value(GLib.Variant.new('(u)', [id]));
|
||||
},
|
||||
@ -317,23 +316,22 @@ var FdoNotificationDaemon = new Lang.Class({
|
||||
if (notification == null) {
|
||||
notification = new MessageTray.Notification(source);
|
||||
ndata.notification = notification;
|
||||
notification.connect('destroy', Lang.bind(this,
|
||||
function(n, reason) {
|
||||
delete this._notifications[ndata.id];
|
||||
let notificationClosedReason;
|
||||
switch (reason) {
|
||||
case MessageTray.NotificationDestroyedReason.EXPIRED:
|
||||
notificationClosedReason = NotificationClosedReason.EXPIRED;
|
||||
break;
|
||||
case MessageTray.NotificationDestroyedReason.DISMISSED:
|
||||
notificationClosedReason = NotificationClosedReason.DISMISSED;
|
||||
break;
|
||||
case MessageTray.NotificationDestroyedReason.SOURCE_CLOSED:
|
||||
notificationClosedReason = NotificationClosedReason.APP_CLOSED;
|
||||
break;
|
||||
}
|
||||
this._emitNotificationClosed(ndata.id, notificationClosedReason);
|
||||
}));
|
||||
notification.connect('destroy', (n, reason) => {
|
||||
delete this._notifications[ndata.id];
|
||||
let notificationClosedReason;
|
||||
switch (reason) {
|
||||
case MessageTray.NotificationDestroyedReason.EXPIRED:
|
||||
notificationClosedReason = NotificationClosedReason.EXPIRED;
|
||||
break;
|
||||
case MessageTray.NotificationDestroyedReason.DISMISSED:
|
||||
notificationClosedReason = NotificationClosedReason.DISMISSED;
|
||||
break;
|
||||
case MessageTray.NotificationDestroyedReason.SOURCE_CLOSED:
|
||||
notificationClosedReason = NotificationClosedReason.APP_CLOSED;
|
||||
break;
|
||||
}
|
||||
this._emitNotificationClosed(ndata.id, notificationClosedReason);
|
||||
});
|
||||
}
|
||||
|
||||
let gicon = this._iconForNotificationData(icon, hints);
|
||||
@ -365,20 +363,20 @@ var FdoNotificationDaemon = new Lang.Class({
|
||||
if (actionId == 'default')
|
||||
hasDefaultAction = true;
|
||||
else
|
||||
notification.addAction(label, Lang.bind(this, function() {
|
||||
notification.addAction(label, () => {
|
||||
this._emitActionInvoked(ndata.id, actionId);
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (hasDefaultAction) {
|
||||
notification.connect('activated', Lang.bind(this, function() {
|
||||
notification.connect('activated', () => {
|
||||
this._emitActionInvoked(ndata.id, 'default');
|
||||
}));
|
||||
});
|
||||
} else {
|
||||
notification.connect('activated', Lang.bind(this, function() {
|
||||
notification.connect('activated', () => {
|
||||
source.open();
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
switch (hints.urgency) {
|
||||
@ -615,10 +613,10 @@ var GtkNotificationDaemonNotification = new Lang.Class({
|
||||
}
|
||||
|
||||
if (buttons) {
|
||||
buttons.deep_unpack().forEach(Lang.bind(this, function(button) {
|
||||
buttons.deep_unpack().forEach(button => {
|
||||
this.addAction(button.label.unpack(),
|
||||
Lang.bind(this, this._onButtonClicked, button));
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
this._defaultAction = defaultAction ? defaultAction.unpack() : null;
|
||||
@ -713,7 +711,7 @@ var GtkNotificationDaemonAppSource = new Lang.Class({
|
||||
},
|
||||
|
||||
activateAction(actionId, target) {
|
||||
this._createApp(function (app, error) {
|
||||
this._createApp((app, error) => {
|
||||
if (error == null)
|
||||
app.ActivateActionRemote(actionId, target ? [target] : [], getPlatformData());
|
||||
else
|
||||
@ -724,7 +722,7 @@ var GtkNotificationDaemonAppSource = new Lang.Class({
|
||||
},
|
||||
|
||||
open() {
|
||||
this._createApp(function (app, error) {
|
||||
this._createApp((app, error) => {
|
||||
if (error == null)
|
||||
app.ActivateRemote(getPlatformData());
|
||||
else
|
||||
@ -741,9 +739,9 @@ var GtkNotificationDaemonAppSource = new Lang.Class({
|
||||
this._notifications[notificationId].destroy();
|
||||
|
||||
let notification = new GtkNotificationDaemonNotification(this, notificationParams);
|
||||
notification.connect('destroy', Lang.bind(this, function() {
|
||||
notification.connect('destroy', () => {
|
||||
delete this._notifications[notificationId];
|
||||
}));
|
||||
});
|
||||
this._notifications[notificationId] = notification;
|
||||
|
||||
if (showBanner)
|
||||
@ -809,10 +807,10 @@ var GtkNotificationDaemon = new Lang.Class({
|
||||
|
||||
let source = new GtkNotificationDaemonAppSource(appId);
|
||||
|
||||
source.connect('destroy', Lang.bind(this, function() {
|
||||
source.connect('destroy', () => {
|
||||
delete this._sources[appId];
|
||||
this._saveNotifications();
|
||||
}));
|
||||
});
|
||||
source.connect('count-updated', Lang.bind(this, this._saveNotifications));
|
||||
Main.messageTray.add(source);
|
||||
this._sources[appId] = source;
|
||||
@ -825,7 +823,7 @@ var GtkNotificationDaemon = new Lang.Class({
|
||||
let value = global.get_persistent_state('a(sa(sv))', 'notifications');
|
||||
if (value) {
|
||||
let sources = value.deep_unpack();
|
||||
sources.forEach(Lang.bind(this, function([appId, notifications]) {
|
||||
sources.forEach(([appId, notifications]) => {
|
||||
if (notifications.length == 0)
|
||||
return;
|
||||
|
||||
@ -836,10 +834,10 @@ var GtkNotificationDaemon = new Lang.Class({
|
||||
return;
|
||||
}
|
||||
|
||||
notifications.forEach(function([notificationId, notification]) {
|
||||
notifications.forEach(([notificationId, notification]) => {
|
||||
source.addNotification(notificationId, notification.deep_unpack(), false);
|
||||
});
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
this._isLoading = false;
|
||||
|
@ -82,9 +82,9 @@ var OsdMonitorLabeler = new Lang.Class({
|
||||
|
||||
this._client = client;
|
||||
this._clientWatchId = Gio.bus_watch_name(Gio.BusType.SESSION, client, 0, null,
|
||||
Lang.bind(this, function(c, name) {
|
||||
(c, name) => {
|
||||
this.hide(name);
|
||||
}));
|
||||
});
|
||||
return true;
|
||||
},
|
||||
|
||||
|
@ -177,10 +177,10 @@ var OsdWindow = new Lang.Class({
|
||||
{ opacity: 0,
|
||||
time: FADE_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this, function() {
|
||||
onComplete: () => {
|
||||
this._reset();
|
||||
Meta.enable_unredirect_for_screen(global.screen);
|
||||
})
|
||||
}
|
||||
});
|
||||
return GLib.SOURCE_REMOVE;
|
||||
},
|
||||
|
@ -62,10 +62,9 @@ var ShellInfo = new Lang.Class({
|
||||
|
||||
if (this._source == null) {
|
||||
this._source = new MessageTray.SystemNotificationSource();
|
||||
this._source.connect('destroy', Lang.bind(this,
|
||||
function() {
|
||||
this._source = null;
|
||||
}));
|
||||
this._source.connect('destroy', () => {
|
||||
this._source = null;
|
||||
});
|
||||
Main.messageTray.add(this._source);
|
||||
}
|
||||
|
||||
@ -141,7 +140,7 @@ var Overview = new Lang.Class({
|
||||
this._coverPane = new Clutter.Actor({ opacity: 0,
|
||||
reactive: true });
|
||||
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);
|
||||
|
||||
@ -254,10 +253,9 @@ var Overview = new Lang.Class({
|
||||
|
||||
// TODO - recalculate everything when desktop size changes
|
||||
this.dashIconSize = this._dash.iconSize;
|
||||
this._dash.connect('icon-size-changed',
|
||||
Lang.bind(this, function() {
|
||||
this.dashIconSize = this._dash.iconSize;
|
||||
}));
|
||||
this._dash.connect('icon-size-changed', () => {
|
||||
this.dashIconSize = this._dash.iconSize;
|
||||
});
|
||||
|
||||
Main.layoutManager.connect('monitors-changed', Lang.bind(this, this._relayout));
|
||||
this._relayout();
|
||||
@ -343,15 +341,15 @@ var Overview = new Lang.Class({
|
||||
if (targetIsWindow) {
|
||||
this._lastHoveredWindow = dragEvent.targetActor._delegate.metaWindow;
|
||||
this._windowSwitchTimeoutId = Mainloop.timeout_add(DND_WINDOW_SWITCH_TIMEOUT,
|
||||
Lang.bind(this, function() {
|
||||
this._windowSwitchTimeoutId = 0;
|
||||
this._needsFakePointerEvent = true;
|
||||
Main.activateWindow(dragEvent.targetActor._delegate.metaWindow,
|
||||
this._windowSwitchTimestamp);
|
||||
this.hide();
|
||||
this._lastHoveredWindow = null;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
() => {
|
||||
this._windowSwitchTimeoutId = 0;
|
||||
this._needsFakePointerEvent = true;
|
||||
Main.activateWindow(dragEvent.targetActor._delegate.metaWindow,
|
||||
this._windowSwitchTimestamp);
|
||||
this.hide();
|
||||
this._lastHoveredWindow = null;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
GLib.Source.set_name_by_id(this._windowSwitchTimeoutId, '[gnome-shell] Main.activateWindow');
|
||||
}
|
||||
|
||||
@ -371,18 +369,18 @@ var Overview = new Lang.Class({
|
||||
},
|
||||
|
||||
_getDesktopClone() {
|
||||
let windows = global.get_window_actors().filter(function(w) {
|
||||
return w.meta_window.get_window_type() == Meta.WindowType.DESKTOP;
|
||||
});
|
||||
let windows = global.get_window_actors().filter(
|
||||
w => w.meta_window.get_window_type() == Meta.WindowType.DESKTOP
|
||||
);
|
||||
if (windows.length == 0)
|
||||
return null;
|
||||
|
||||
let window = windows[0];
|
||||
let clone = new Clutter.Clone({ source: window,
|
||||
x: window.x, y: window.y });
|
||||
clone.source.connect('destroy', Lang.bind(this, function() {
|
||||
clone.source.connect('destroy', () => {
|
||||
clone.destroy();
|
||||
}));
|
||||
});
|
||||
return clone;
|
||||
},
|
||||
|
||||
|
@ -431,20 +431,17 @@ var ControlsManager = new Lang.Class({
|
||||
layout.connect('allocation-changed', Lang.bind(this, this._updateWorkspacesGeometry));
|
||||
|
||||
Main.overview.connect('showing', Lang.bind(this, this._updateSpacerVisibility));
|
||||
Main.overview.connect('item-drag-begin', Lang.bind(this,
|
||||
function() {
|
||||
let activePage = this.viewSelector.getActivePage();
|
||||
if (activePage != ViewSelector.ViewPage.WINDOWS)
|
||||
this.viewSelector.fadeHalf();
|
||||
}));
|
||||
Main.overview.connect('item-drag-end', Lang.bind(this,
|
||||
function() {
|
||||
this.viewSelector.fadeIn();
|
||||
}));
|
||||
Main.overview.connect('item-drag-cancelled', Lang.bind(this,
|
||||
function() {
|
||||
this.viewSelector.fadeIn();
|
||||
}));
|
||||
Main.overview.connect('item-drag-begin', () => {
|
||||
let activePage = this.viewSelector.getActivePage();
|
||||
if (activePage != ViewSelector.ViewPage.WINDOWS)
|
||||
this.viewSelector.fadeHalf();
|
||||
});
|
||||
Main.overview.connect('item-drag-end', () => {
|
||||
this.viewSelector.fadeIn();
|
||||
});
|
||||
Main.overview.connect('item-drag-cancelled', () => {
|
||||
this.viewSelector.fadeIn();
|
||||
});
|
||||
},
|
||||
|
||||
_updateWorkspacesGeometry() {
|
||||
|
@ -50,7 +50,7 @@ var PadChooser = new Lang.Class({
|
||||
this._ensureMenu(groupDevices);
|
||||
|
||||
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 (this._padChooserMenu != null)
|
||||
this._padChooserMenu.open(true);
|
||||
@ -59,12 +59,14 @@ var PadChooser = new Lang.Class({
|
||||
} else {
|
||||
this._padChooserMenu.close(true);
|
||||
}
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_ensureMenu(devices) {
|
||||
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();
|
||||
Main.uiGroup.add_actor(this._padChooserMenu.actor);
|
||||
|
||||
@ -144,7 +146,9 @@ var ActionComboBox = new Lang.Class({
|
||||
box.add_child(arrow);
|
||||
|
||||
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();
|
||||
Main.uiGroup.add_actor(this._editMenu.actor);
|
||||
|
||||
@ -158,7 +162,9 @@ var ActionComboBox = new Lang.Class({
|
||||
|
||||
for (let [action, label] of this._actionLabels.entries()) {
|
||||
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 */
|
||||
if (selectedAction == GDesktopEnums.PadButtonAction.HELP ||
|
||||
@ -632,14 +638,14 @@ var PadOsd = new Lang.Class({
|
||||
this._padChooser = null;
|
||||
|
||||
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 &&
|
||||
this.padDevice.is_grouped(device)) {
|
||||
this._groupPads.push(device);
|
||||
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 (device == this.padDevice) {
|
||||
this.destroy();
|
||||
@ -650,14 +656,14 @@ var PadOsd = new Lang.Class({
|
||||
this._updatePadChooser();
|
||||
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
||||
deviceManager.list_devices().forEach(Lang.bind(this, function(device) {
|
||||
deviceManager.list_devices().forEach(device => {
|
||||
if (device != this.padDevice &&
|
||||
device.get_device_type() == Clutter.InputDeviceType.PAD_DEVICE &&
|
||||
this.padDevice.is_grouped(device))
|
||||
this._groupPads.push(device);
|
||||
}));
|
||||
});
|
||||
|
||||
this.actor = new St.BoxLayout({ style_class: 'pad-osd-window',
|
||||
x_expand: true,
|
||||
@ -735,7 +741,9 @@ var PadOsd = new Lang.Class({
|
||||
style_class: 'button',
|
||||
x_align: Clutter.ActorAlign.CENTER,
|
||||
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);
|
||||
|
||||
this._syncEditionMode();
|
||||
@ -746,9 +754,9 @@ var PadOsd = new Lang.Class({
|
||||
if (this._groupPads.length > 1) {
|
||||
if (this._padChooser == null) {
|
||||
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._titleBox.add_child(this._padChooser.actor);
|
||||
} else {
|
||||
this._padChooser.update(this._groupPads);
|
||||
@ -976,11 +984,11 @@ var PadOsdService = new Lang.Class({
|
||||
let devices = deviceManager.list_devices();
|
||||
let padDevice = null;
|
||||
|
||||
devices.forEach(Lang.bind(this, function(device) {
|
||||
devices.forEach(device => {
|
||||
if (deviceNode == device.get_device_node() &&
|
||||
device.get_device_type() == Clutter.InputDeviceType.PAD_DEVICE)
|
||||
padDevice = device;
|
||||
}));
|
||||
});
|
||||
|
||||
if (padDevice == null) {
|
||||
invocation.return_error_literal(Gio.IOErrorEnum,
|
||||
|
@ -240,13 +240,10 @@ var AppMenuButton = new Lang.Class({
|
||||
|
||||
_onAppStateChanged(appSys, app) {
|
||||
let state = app.state;
|
||||
if (state != Shell.AppState.STARTING) {
|
||||
this._startingApps = this._startingApps.filter(function(a) {
|
||||
return a != app;
|
||||
});
|
||||
} else if (state == Shell.AppState.STARTING) {
|
||||
if (state != Shell.AppState.STARTING)
|
||||
this._startingApps = this._startingApps.filter(a => a != app);
|
||||
else if (state == Shell.AppState.STARTING)
|
||||
this._startingApps.push(app);
|
||||
}
|
||||
// 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
|
||||
// changing. An example case is how we map OpenOffice.org based on the window
|
||||
@ -343,10 +340,10 @@ var AppMenuButton = new Lang.Class({
|
||||
return;
|
||||
|
||||
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];
|
||||
win.check_alive(global.get_current_time());
|
||||
}));
|
||||
});
|
||||
|
||||
} else {
|
||||
if (this.menu && this.menu.isDummyQuitMenu)
|
||||
@ -355,9 +352,9 @@ var AppMenuButton = new Lang.Class({
|
||||
// fallback to older menu
|
||||
menu = new PopupMenu.PopupMenu(this.actor, 0.0, St.Side.TOP, 0);
|
||||
menu.isDummyQuitMenu = true;
|
||||
menu.addAction(_("Quit"), Lang.bind(this, function() {
|
||||
menu.addAction(_("Quit"), () => {
|
||||
this._targetApp.request_quit();
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
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_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_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_accessible_state (Atk.StateType.CHECKED);
|
||||
}));
|
||||
});
|
||||
|
||||
this._xdndTimeOut = 0;
|
||||
},
|
||||
@ -574,20 +571,19 @@ var PanelCorner = new Lang.Class({
|
||||
|
||||
this._button = button;
|
||||
|
||||
button.connect('destroy', Lang.bind(this,
|
||||
function() {
|
||||
if (this._button == button) {
|
||||
this._button = null;
|
||||
this._buttonStyleChangedSignalId = 0;
|
||||
}
|
||||
}));
|
||||
button.connect('destroy', () => {
|
||||
if (this._button == button) {
|
||||
this._button = null;
|
||||
this._buttonStyleChangedSignalId = 0;
|
||||
}
|
||||
});
|
||||
|
||||
// Synchronize the locate button's pseudo classes with this corner
|
||||
this._buttonStyleChangedSignalId = button.connect('style-changed', Lang.bind(this,
|
||||
function(actor) {
|
||||
this._buttonStyleChangedSignalId = button.connect('style-changed',
|
||||
actor => {
|
||||
let pseudoClass = button.get_style_pseudo_class();
|
||||
this.actor.set_style_pseudo_class(pseudoClass);
|
||||
}));
|
||||
});
|
||||
|
||||
// The corner doesn't support theme transitions, so override
|
||||
// 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('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._updateSolidStyle();
|
||||
}));
|
||||
Main.overview.connect('hiding', Lang.bind(this, function () {
|
||||
});
|
||||
Main.overview.connect('hiding', () => {
|
||||
this.actor.remove_style_pseudo_class('overview');
|
||||
this._updateSolidStyle();
|
||||
}));
|
||||
});
|
||||
|
||||
Main.layoutManager.panelBox.add(this.actor);
|
||||
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 */
|
||||
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() &&
|
||||
metaWindow.showing_on_its_workspace() &&
|
||||
metaWindow.get_window_type() != Meta.WindowType.DESKTOP;
|
||||
@ -1089,10 +1085,10 @@ var Panel = new Lang.Class({
|
||||
let [, panelTop] = this.actor.get_transformed_position();
|
||||
let panelBottom = panelTop + this.actor.get_height();
|
||||
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;
|
||||
return verticalPosition < panelBottom + 5 * scale;
|
||||
}));
|
||||
});
|
||||
|
||||
if (isNearEnough)
|
||||
this._addStyleClassName('solid');
|
||||
@ -1150,11 +1146,11 @@ var Panel = new Lang.Class({
|
||||
if (indicator.menu)
|
||||
this.menuManager.addMenu(indicator.menu);
|
||||
this.statusArea[role] = indicator;
|
||||
let destroyId = indicator.connect('destroy', Lang.bind(this, function(emitter) {
|
||||
let destroyId = indicator.connect('destroy', emitter => {
|
||||
delete this.statusArea[role];
|
||||
emitter.disconnect(destroyId);
|
||||
container.destroy();
|
||||
}));
|
||||
});
|
||||
indicator.connect('menu-set', Lang.bind(this, this._onMenuSet));
|
||||
this._onMenuSet(indicator);
|
||||
},
|
||||
@ -1195,7 +1191,7 @@ var Panel = new Lang.Class({
|
||||
return;
|
||||
|
||||
indicator.menu._openChangedId = indicator.menu.connect('open-state-changed',
|
||||
Lang.bind(this, function(menu, isOpen) {
|
||||
(menu, isOpen) => {
|
||||
let boxAlignment;
|
||||
if (this._leftBox.contains(indicator.container))
|
||||
boxAlignment = Clutter.ActorAlign.START;
|
||||
@ -1206,6 +1202,6 @@ var Panel = new Lang.Class({
|
||||
|
||||
if (boxAlignment == Main.messageTray.bannerAlignment)
|
||||
Main.messageTray.bannerBlocked = isOpen;
|
||||
}));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -214,9 +214,7 @@ var SystemIndicator = new Lang.Class({
|
||||
},
|
||||
|
||||
_syncIndicatorsVisible() {
|
||||
this.indicators.visible = this.indicators.get_children().some(function(actor) {
|
||||
return actor.visible;
|
||||
});
|
||||
this.indicators.visible = this.indicators.get_children().some(a => a.visible);
|
||||
},
|
||||
|
||||
_addIndicator() {
|
||||
|
@ -476,25 +476,25 @@ var PopupMenuBase = new Lang.Class({
|
||||
menuItem = new PopupMenuItem(title);
|
||||
|
||||
this.addMenuItem(menuItem);
|
||||
menuItem.connect('activate', Lang.bind(this, function (menuItem, event) {
|
||||
menuItem.connect('activate', (menuItem, event) => {
|
||||
callback(event);
|
||||
}));
|
||||
});
|
||||
|
||||
return menuItem;
|
||||
},
|
||||
|
||||
addSettingsAction(title, desktopFile) {
|
||||
let menuItem = this.addAction(title, function() {
|
||||
let app = Shell.AppSystem.get_default().lookup_app(desktopFile);
|
||||
let menuItem = this.addAction(title, () => {
|
||||
let app = Shell.AppSystem.get_default().lookup_app(desktopFile);
|
||||
|
||||
if (!app) {
|
||||
log('Settings panel for desktop file ' + desktopFile + ' could not be loaded!');
|
||||
return;
|
||||
}
|
||||
if (!app) {
|
||||
log('Settings panel for desktop file ' + desktopFile + ' could not be loaded!');
|
||||
return;
|
||||
}
|
||||
|
||||
Main.overview.hide();
|
||||
app.activate();
|
||||
});
|
||||
Main.overview.hide();
|
||||
app.activate();
|
||||
});
|
||||
|
||||
menuItem.actor.visible = Main.sessionMode.allowSettings;
|
||||
this._settingsActions[desktopFile] = menuItem;
|
||||
@ -510,7 +510,7 @@ var PopupMenuBase = new Lang.Class({
|
||||
},
|
||||
|
||||
isEmpty() {
|
||||
let hasVisibleChildren = this.box.get_children().some(function(child) {
|
||||
let hasVisibleChildren = this.box.get_children().some(child => {
|
||||
if (child._delegate instanceof PopupSeparatorMenuItem)
|
||||
return false;
|
||||
return isPopupMenuItemVisible(child);
|
||||
@ -534,7 +534,7 @@ var PopupMenuBase = new Lang.Class({
|
||||
},
|
||||
|
||||
_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 (this._activeMenuItem)
|
||||
this._activeMenuItem.setActive(false);
|
||||
@ -544,8 +544,8 @@ var PopupMenuBase = new Lang.Class({
|
||||
this._activeMenuItem = 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();
|
||||
if (!sensitive && this._activeMenuItem == menuItem) {
|
||||
if (!this.actor.navigate_focus(menuItem.actor,
|
||||
@ -556,21 +556,21 @@ var PopupMenuBase = new Lang.Class({
|
||||
if (global.stage.get_key_focus() == this.actor)
|
||||
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.itemActivated(BoxPointer.PopupAnimation.FULL);
|
||||
}));
|
||||
});
|
||||
|
||||
menuItem._parentSensitiveChangeId = this.connect('sensitive-changed', Lang.bind(this, function() {
|
||||
menuItem._parentSensitiveChangeId = this.connect('sensitive-changed', () => {
|
||||
menuItem.syncSensitive();
|
||||
}));
|
||||
});
|
||||
|
||||
// the weird name is to avoid a conflict with some random property
|
||||
// the menuItem may have, called destroyId
|
||||
// (FIXME: in the future it may make sense to have container objects
|
||||
// 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._activateId);
|
||||
menuItem.disconnect(menuItem._activeChangeId);
|
||||
@ -578,7 +578,7 @@ var PopupMenuBase = new Lang.Class({
|
||||
this.disconnect(menuItem._parentSensitiveChangeId);
|
||||
if (menuItem == this._activeMenuItem)
|
||||
this._activeMenuItem = null;
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_updateSeparatorVisibility(menuItem) {
|
||||
@ -652,26 +652,26 @@ var PopupMenuBase = new Lang.Class({
|
||||
if (menuItem instanceof PopupMenuSection) {
|
||||
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)
|
||||
menuItem.open();
|
||||
else
|
||||
menuItem.close();
|
||||
});
|
||||
let parentClosingId = this.connect('menu-closed', function() {
|
||||
let parentClosingId = this.connect('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.connect('destroy', Lang.bind(this, function() {
|
||||
menuItem.connect('destroy', () => {
|
||||
menuItem.disconnect(activeChangeId);
|
||||
this.disconnect(subMenuSensitiveChangedId);
|
||||
this.disconnect(parentOpenStateChangedId);
|
||||
this.disconnect(parentClosingId);
|
||||
this.length--;
|
||||
}));
|
||||
});
|
||||
} else if (menuItem instanceof PopupSubMenuMenuItem) {
|
||||
if (before_item == null)
|
||||
this.box.add(menuItem.menu.actor);
|
||||
@ -680,14 +680,14 @@ var PopupMenuBase = new Lang.Class({
|
||||
|
||||
this._connectItemSignals(menuItem);
|
||||
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.connect('destroy', Lang.bind(this, function() {
|
||||
menuItem.connect('destroy', () => {
|
||||
menuItem.menu.disconnect(subMenuActiveChangeId);
|
||||
this.disconnect(closingId);
|
||||
}));
|
||||
});
|
||||
} else if (menuItem instanceof PopupSeparatorMenuItem) {
|
||||
this._connectItemSignals(menuItem);
|
||||
|
||||
@ -695,11 +695,13 @@ var PopupMenuBase = new Lang.Class({
|
||||
// separator's adjacent siblings change visibility or position.
|
||||
// open-state-changed isn't exactly that, but doing it in more
|
||||
// precise ways would require a lot more bookkeeping.
|
||||
let openStateChangeId = this.connect('open-state-changed', Lang.bind(this, function() { this._updateSeparatorVisibility(menuItem); }));
|
||||
let destroyId = menuItem.connect('destroy', Lang.bind(this, function() {
|
||||
let openStateChangeId = this.connect('open-state-changed', () => {
|
||||
this._updateSeparatorVisibility(menuItem);
|
||||
});
|
||||
let destroyId = menuItem.connect('destroy', () => {
|
||||
this.disconnect(openStateChangeId);
|
||||
menuItem.disconnect(destroyId);
|
||||
}));
|
||||
});
|
||||
} else if (menuItem instanceof PopupBaseMenuItem)
|
||||
this._connectItemSignals(menuItem);
|
||||
else
|
||||
@ -711,9 +713,7 @@ var PopupMenuBase = new Lang.Class({
|
||||
},
|
||||
|
||||
_getMenuItems() {
|
||||
return this.box.get_children().map(function (actor) {
|
||||
return actor._delegate;
|
||||
}).filter(function(item) {
|
||||
return this.box.get_children().map(a => a._delegate).filter(item => {
|
||||
return item instanceof PopupBaseMenuItem || item instanceof PopupMenuSection;
|
||||
});
|
||||
},
|
||||
@ -875,9 +875,9 @@ var PopupMenu = new Lang.Class({
|
||||
this._activeMenuItem.setActive(false);
|
||||
|
||||
if (this._boxPointer.actor.visible) {
|
||||
this._boxPointer.hide(animate, Lang.bind(this, function() {
|
||||
this._boxPointer.hide(animate, () => {
|
||||
this.emit('menu-closed');
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
if (!this.isOpen)
|
||||
@ -1234,8 +1234,11 @@ var PopupMenuManager = new Lang.Class({
|
||||
if (source) {
|
||||
if (!menu.blockSourceEvents)
|
||||
this._grabHelper.addActor(source);
|
||||
menudata.enterId = source.connect('enter-event', Lang.bind(this, function() { return this._onMenuSourceEnter(menu); }));
|
||||
menudata.focusInId = source.connect('key-focus-in', Lang.bind(this, function() { this._onMenuSourceEnter(menu); }));
|
||||
menudata.enterId = source.connect('enter-event',
|
||||
() => this._onMenuSourceEnter(menu));
|
||||
menudata.focusInId = source.connect('key-focus-in', () => {
|
||||
this._onMenuSourceEnter(menu);
|
||||
});
|
||||
}
|
||||
|
||||
if (position == undefined)
|
||||
|
@ -47,7 +47,7 @@ var RemoteMenuSeparatorItemMapper = new Lang.Class({
|
||||
this._trackerItem.connect('notify::label', Lang.bind(this, this._updateLabel));
|
||||
this._updateLabel();
|
||||
|
||||
this.menuItem.connect('destroy', function() {
|
||||
this.menuItem.connect('destroy', () => {
|
||||
trackerItem.run_dispose();
|
||||
});
|
||||
},
|
||||
@ -89,15 +89,15 @@ var RemoteMenuSubmenuItemMapper = new Lang.Class({
|
||||
_insertItem.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.connect('notify::submenu-shown', Lang.bind(this, function() {
|
||||
this._trackerItem.connect('notify::submenu-shown', () => {
|
||||
this.menuItem.setSubmenuShown(this._trackerItem.get_submenu_shown());
|
||||
}));
|
||||
});
|
||||
|
||||
this.menuItem.connect('destroy', function() {
|
||||
this.menuItem.connect('destroy', () => {
|
||||
trackerItem.run_dispose();
|
||||
});
|
||||
},
|
||||
@ -123,9 +123,9 @@ var RemoteMenuItemMapper = new Lang.Class({
|
||||
this.menuItem.actor.add_child(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.bind_property('visible', this.menuItem.actor, 'visible', GObject.BindingFlags.SYNC_CREATE);
|
||||
|
||||
@ -138,7 +138,7 @@ var RemoteMenuItemMapper = new Lang.Class({
|
||||
this._updateSensitivity();
|
||||
this._updateRole();
|
||||
|
||||
this.menuItem.connect('destroy', function() {
|
||||
this.menuItem.connect('destroy', () => {
|
||||
trackerItem.run_dispose();
|
||||
});
|
||||
},
|
||||
|
@ -143,7 +143,7 @@ function loadRemoteSearchProviders(searchSettings, callback) {
|
||||
// Special case gnome-control-center to be always active and always first
|
||||
sortOrder.unshift('gnome-control-center.desktop');
|
||||
|
||||
loadedProviders = loadedProviders.filter(function(provider) {
|
||||
loadedProviders = loadedProviders.filter(provider => {
|
||||
let appId = provider.appInfo.get_id();
|
||||
|
||||
if (provider.defaultEnabled) {
|
||||
@ -155,7 +155,7 @@ function loadRemoteSearchProviders(searchSettings, callback) {
|
||||
}
|
||||
});
|
||||
|
||||
loadedProviders.sort(function(providerA, providerB) {
|
||||
loadedProviders.sort((providerA, providerB) => {
|
||||
let idxA, idxB;
|
||||
let appIdA, appIdB;
|
||||
|
||||
@ -240,8 +240,8 @@ var RemoteSearchProvider = new Lang.Class({
|
||||
if (results.length <= maxNumber)
|
||||
return results;
|
||||
|
||||
let regularResults = results.filter(function(r) { return !r.startsWith('special:'); });
|
||||
let specialResults = results.filter(function(r) { return r.startsWith('special:'); });
|
||||
let regularResults = results.filter(r => !r.startsWith('special:'));
|
||||
let specialResults = results.filter(r => r.startsWith('special:'));
|
||||
|
||||
return regularResults.slice(0, maxNumber).concat(specialResults.slice(0, maxNumber));
|
||||
},
|
||||
|
@ -40,30 +40,29 @@ var RunDialog = new Lang.Class({
|
||||
|
||||
this._lockdownSettings = new Gio.Settings({ schema_id: LOCKDOWN_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._internalCommands = { 'lg':
|
||||
Lang.bind(this, function() {
|
||||
this._internalCommands = { 'lg': () => {
|
||||
Main.createLookingGlass().open();
|
||||
}),
|
||||
},
|
||||
|
||||
'r': Lang.bind(this, this._restart),
|
||||
|
||||
// Developer brain backwards compatibility
|
||||
'restart': Lang.bind(this, this._restart),
|
||||
|
||||
'debugexit': Lang.bind(this, function() {
|
||||
'debugexit': () => {
|
||||
Meta.quit(Meta.ExitCode.ERROR);
|
||||
}),
|
||||
},
|
||||
|
||||
// rt is short for "reload theme"
|
||||
'rt': Lang.bind(this, function() {
|
||||
'rt': () => {
|
||||
Main.reloadThemeResource();
|
||||
Main.loadTheme();
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -115,7 +114,7 @@ var RunDialog = new Lang.Class({
|
||||
|
||||
this._history = new History.HistoryManager({ gsettingsKey: HISTORY_KEY,
|
||||
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();
|
||||
if (symbol == Clutter.Return || symbol == Clutter.KP_Enter) {
|
||||
this.popModal();
|
||||
@ -142,7 +141,7 @@ var RunDialog = new Lang.Class({
|
||||
return Clutter.EVENT_STOP;
|
||||
}
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_getCommandCompletion(text) {
|
||||
@ -162,7 +161,7 @@ var RunDialog = new Lang.Class({
|
||||
|
||||
let paths = GLib.getenv('PATH').split(':');
|
||||
paths.push(GLib.get_home_dir());
|
||||
let someResults = paths.map(function(path) {
|
||||
let someResults = paths.map(path => {
|
||||
let results = [];
|
||||
try {
|
||||
let file = Gio.File.new_for_path(path);
|
||||
@ -180,9 +179,7 @@ var RunDialog = new Lang.Class({
|
||||
return results;
|
||||
}
|
||||
});
|
||||
let results = someResults.reduce(function(a, b) {
|
||||
return a.concat(b);
|
||||
}, []);
|
||||
let results = someResults.reduce((a, b) => a.concat(b), []);
|
||||
|
||||
if (!results.length)
|
||||
return null;
|
||||
@ -263,11 +260,10 @@ var RunDialog = new Lang.Class({
|
||||
{ height: parentActor.height + errorBoxNaturalHeight,
|
||||
time: DIALOG_GROW_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this,
|
||||
function() {
|
||||
parentActor.set_height(-1);
|
||||
this._errorBox.show();
|
||||
})
|
||||
onComplete: () => {
|
||||
parentActor.set_height(-1);
|
||||
this._errorBox.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -112,9 +112,9 @@ var NotificationsBox = new Lang.Class({
|
||||
this.actor.add(this._scrollView, { x_fill: true, x_align: St.Align.START });
|
||||
|
||||
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._updateVisibility();
|
||||
|
||||
this._sourceAddedId = Main.messageTray.connect('source-added', Lang.bind(this, this._sourceAdded));
|
||||
@ -135,9 +135,8 @@ var NotificationsBox = new Lang.Class({
|
||||
},
|
||||
|
||||
_updateVisibility() {
|
||||
this._notificationBox.visible = this._notificationBox.get_children().some(function(a) {
|
||||
return a.visible;
|
||||
});
|
||||
this._notificationBox.visible =
|
||||
this._notificationBox.get_children().some(a => a.visible);
|
||||
|
||||
this.actor.visible = this._notificationBox.visible;
|
||||
},
|
||||
@ -235,21 +234,21 @@ var NotificationsBox = new Lang.Class({
|
||||
this._showSource(source, obj, obj.sourceBox);
|
||||
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);
|
||||
}));
|
||||
obj.sourceTitleChangedId = source.connect('title-changed', Lang.bind(this, function(source) {
|
||||
});
|
||||
obj.sourceTitleChangedId = source.connect('title-changed', source => {
|
||||
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')
|
||||
this._visibleChanged(source, obj);
|
||||
else
|
||||
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._sources.set(source, obj);
|
||||
|
||||
@ -499,47 +498,48 @@ var ScreenShield = new Lang.Class({
|
||||
this.actor.add_actor(this._lockDialogGroup);
|
||||
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) {
|
||||
logError(error, 'Error while reading gnome-session presence');
|
||||
return;
|
||||
}
|
||||
|
||||
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._screenSaverDBus = new ShellDBus.ScreenSaverDBus(this);
|
||||
|
||||
this._smartcardManager = SmartcardManager.getSmartcardManager();
|
||||
this._smartcardManager.connect('smartcard-inserted',
|
||||
Lang.bind(this, function(manager, token) {
|
||||
(manager, token) => {
|
||||
if (this._isLocked && token.UsedToLogin)
|
||||
this._liftShield(true, 0);
|
||||
}));
|
||||
});
|
||||
|
||||
this._oVirtCredentialsManager = OVirt.getOVirtCredentialsManager();
|
||||
this._oVirtCredentialsManager.connect('user-authenticated',
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
if (this._isLocked)
|
||||
this._liftShield(true, 0);
|
||||
}));
|
||||
});
|
||||
|
||||
this._loginManager = LoginManager.getLoginManager();
|
||||
this._loginManager.connect('prepare-for-sleep',
|
||||
Lang.bind(this, this._prepareForSleep));
|
||||
|
||||
this._loginSession = null;
|
||||
this._loginManager.getCurrentSessionProxy(Lang.bind(this,
|
||||
function(sessionProxy) {
|
||||
this._loginSession = sessionProxy;
|
||||
this._loginSession.connectSignal('Lock', Lang.bind(this, function() { this.lock(false); }));
|
||||
this._loginSession.connectSignal('Unlock', Lang.bind(this, function() { this.deactivate(false); }));
|
||||
this._loginSession.connect('g-properties-changed', Lang.bind(this, this._syncInhibitor));
|
||||
this._syncInhibitor();
|
||||
}));
|
||||
this._loginManager.getCurrentSessionProxy(sessionProxy => {
|
||||
this._loginSession = sessionProxy;
|
||||
this._loginSession.connectSignal('Lock',
|
||||
() => { this.lock(false); });
|
||||
this._loginSession.connectSignal('Unlock',
|
||||
() => { this.deactivate(false); });
|
||||
this._loginSession.connect('g-properties-changed', Lang.bind(this, this._syncInhibitor));
|
||||
this._syncInhibitor();
|
||||
});
|
||||
|
||||
this._settings = new Gio.Settings({ schema_id: SCREENSAVER_SCHEMA });
|
||||
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);
|
||||
if (inhibit) {
|
||||
this._loginManager.inhibit(_("GNOME needs to lock the screen"),
|
||||
Lang.bind(this, function(inhibitor) {
|
||||
if (this._inhibitor)
|
||||
this._inhibitor.close(null);
|
||||
this._inhibitor = inhibitor;
|
||||
}));
|
||||
inhibitor => {
|
||||
if (this._inhibitor)
|
||||
this._inhibitor.close(null);
|
||||
this._inhibitor = inhibitor;
|
||||
});
|
||||
} else {
|
||||
if (this._inhibitor)
|
||||
this._inhibitor.close(null);
|
||||
@ -846,11 +846,11 @@ var ScreenShield = new Lang.Class({
|
||||
if (shouldLock) {
|
||||
let lockTimeout = Math.max(STANDARD_FADE_TIME, this._settings.get_uint(LOCK_DELAY_KEY));
|
||||
this._lockTimeoutId = Mainloop.timeout_add(lockTimeout * 1000,
|
||||
Lang.bind(this, function() {
|
||||
() => {
|
||||
this._lockTimeoutId = 0;
|
||||
this.lock(false);
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
GLib.Source.set_name_by_id(this._lockTimeoutId, '[gnome-shell] this.lock');
|
||||
}
|
||||
|
||||
@ -1094,14 +1094,14 @@ var ScreenShield = new Lang.Class({
|
||||
|
||||
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) {
|
||||
this._cursorTracker.set_pointer_visible(true);
|
||||
global.stage.disconnect(motionId);
|
||||
}
|
||||
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}));
|
||||
});
|
||||
this._cursorTracker.set_pointer_visible(false);
|
||||
|
||||
this._lockScreenState = MessageTray.State.SHOWN;
|
||||
@ -1111,10 +1111,10 @@ var ScreenShield = new Lang.Class({
|
||||
if (params.fadeToBlack && params.animateFade) {
|
||||
// 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);
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
GLib.Source.set_name_by_id(id, '[gnome-shell] this._activateFade');
|
||||
} else {
|
||||
if (params.fadeToBlack)
|
||||
@ -1192,9 +1192,7 @@ var ScreenShield = new Lang.Class({
|
||||
|
||||
deactivate(animate) {
|
||||
if (this._dialog)
|
||||
this._dialog.finish(Lang.bind(this, function() {
|
||||
this._continueDeactivate(animate);
|
||||
}));
|
||||
this._dialog.finish(() => { this._continueDeactivate(animate); });
|
||||
else
|
||||
this._continueDeactivate(animate);
|
||||
},
|
||||
@ -1339,9 +1337,9 @@ var ScreenShield = new Lang.Class({
|
||||
let wasLocked = global.get_runtime_state('b', LOCKED_STATE_STR);
|
||||
if (wasLocked === null)
|
||||
return;
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() {
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||
this.lock(false);
|
||||
}));
|
||||
});
|
||||
}
|
||||
});
|
||||
Signals.addSignalMethods(ScreenShield.prototype);
|
||||
|
@ -114,9 +114,9 @@ var ScreenshotService = new Lang.Class({
|
||||
if (result) {
|
||||
if (flash) {
|
||||
let flashspot = new Flashspot(area);
|
||||
flashspot.fire(Lang.bind(this, function() {
|
||||
flashspot.fire(() => {
|
||||
this._removeShooterForSender(invocation.get_sender());
|
||||
}));
|
||||
});
|
||||
}
|
||||
else
|
||||
this._removeShooterForSender(invocation.get_sender());
|
||||
@ -184,18 +184,17 @@ var ScreenshotService = new Lang.Class({
|
||||
SelectAreaAsync(params, invocation) {
|
||||
let selectArea = new SelectArea();
|
||||
selectArea.show();
|
||||
selectArea.connect('finished', Lang.bind(this,
|
||||
function(selectArea, areaRectangle) {
|
||||
if (areaRectangle) {
|
||||
let retRectangle = this._unscaleArea(areaRectangle.x, areaRectangle.y,
|
||||
areaRectangle.width, areaRectangle.height);
|
||||
let retval = GLib.Variant.new('(iiii)', retRectangle);
|
||||
invocation.return_value(retval);
|
||||
} else {
|
||||
invocation.return_error_literal(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED,
|
||||
"Operation was cancelled");
|
||||
}
|
||||
}));
|
||||
selectArea.connect('finished', (selectArea, areaRectangle) => {
|
||||
if (areaRectangle) {
|
||||
let retRectangle = this._unscaleArea(areaRectangle.x, areaRectangle.y,
|
||||
areaRectangle.width, areaRectangle.height);
|
||||
let retval = GLib.Variant.new('(iiii)', retRectangle);
|
||||
invocation.return_value(retval);
|
||||
} else {
|
||||
invocation.return_error_literal(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED,
|
||||
"Operation was cancelled");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
FlashAreaAsync(params, invocation) {
|
||||
@ -317,10 +316,9 @@ var SelectArea = new Lang.Class({
|
||||
{ opacity: 0,
|
||||
time: 0.2,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this,
|
||||
function() {
|
||||
this._grabHelper.ungrab();
|
||||
})
|
||||
onComplete: () => {
|
||||
this._grabHelper.ungrab();
|
||||
}
|
||||
});
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
},
|
||||
@ -329,11 +327,10 @@ var SelectArea = new Lang.Class({
|
||||
global.screen.set_cursor(Meta.Cursor.DEFAULT);
|
||||
this.emit('finished', this._result);
|
||||
|
||||
GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this,
|
||||
function() {
|
||||
this._group.destroy();
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
|
||||
this._group.destroy();
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
}
|
||||
});
|
||||
Signals.addSignalMethods(SelectArea.prototype);
|
||||
@ -360,11 +357,11 @@ var Flashspot = new Lang.Class({
|
||||
{ opacity: 0,
|
||||
time: FLASHSPOT_ANIMATION_OUT_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this, function() {
|
||||
onComplete: () => {
|
||||
if (doneCallback)
|
||||
doneCallback();
|
||||
this.destroy();
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -40,16 +40,14 @@ const Params = imports.misc.params;
|
||||
function sleep(milliseconds) {
|
||||
let cb;
|
||||
|
||||
let id = Mainloop.timeout_add(milliseconds, function() {
|
||||
if (cb)
|
||||
cb();
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
let id = Mainloop.timeout_add(milliseconds, () => {
|
||||
if (cb)
|
||||
cb();
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
GLib.Source.set_name_by_id(id, '[gnome-shell] sleep');
|
||||
|
||||
return function(callback) {
|
||||
cb = callback;
|
||||
};
|
||||
return callback => { cb = callback; };
|
||||
}
|
||||
|
||||
/**
|
||||
@ -62,14 +60,12 @@ function sleep(milliseconds) {
|
||||
function waitLeisure() {
|
||||
let cb;
|
||||
|
||||
global.run_at_leisure(function() {
|
||||
if (cb)
|
||||
cb();
|
||||
});
|
||||
global.run_at_leisure(() => {
|
||||
if (cb)
|
||||
cb();
|
||||
});
|
||||
|
||||
return function(callback) {
|
||||
cb = callback;
|
||||
};
|
||||
return callback => { cb = callback; };
|
||||
}
|
||||
|
||||
const PerfHelperIface = '<node> \
|
||||
@ -103,19 +99,19 @@ function _callRemote(obj, method, ...args) {
|
||||
let cb;
|
||||
let errcb;
|
||||
|
||||
args.push(function(result, excp) {
|
||||
if (excp) {
|
||||
if (errcb)
|
||||
errcb(excp);
|
||||
} else {
|
||||
if (cb)
|
||||
cb();
|
||||
}
|
||||
});
|
||||
args.push((result, excp) => {
|
||||
if (excp) {
|
||||
if (errcb)
|
||||
errcb(excp);
|
||||
} else {
|
||||
if (cb)
|
||||
cb();
|
||||
}
|
||||
});
|
||||
|
||||
method.apply(obj, args);
|
||||
|
||||
return function(callback, error_callback) {
|
||||
return (callback, error_callback) => {
|
||||
cb = callback;
|
||||
errcb = error_callback;
|
||||
};
|
||||
@ -213,10 +209,10 @@ function collectStatistics() {
|
||||
function _step(g, finish, onError) {
|
||||
try {
|
||||
let waitFunction = g.next();
|
||||
waitFunction(function() {
|
||||
waitFunction(() => {
|
||||
_step(g, finish, onError);
|
||||
},
|
||||
function(err) {
|
||||
err => {
|
||||
if (onError)
|
||||
onError(err);
|
||||
});
|
||||
@ -239,7 +235,7 @@ function _collect(scriptModule, outputFile) {
|
||||
}
|
||||
|
||||
Shell.PerfLog.get_default().replay(
|
||||
function(time, eventName, signature, arg) {
|
||||
(time, eventName, signature, arg) => {
|
||||
if (eventName in eventHandlers)
|
||||
eventHandlers[eventName](time, arg);
|
||||
});
|
||||
@ -370,7 +366,7 @@ function runPerfScript(scriptModule, outputFile) {
|
||||
let g = scriptModule.run();
|
||||
|
||||
_step(g,
|
||||
function() {
|
||||
() => {
|
||||
try {
|
||||
_collect(scriptModule, outputFile);
|
||||
} catch (err) {
|
||||
@ -379,7 +375,7 @@ function runPerfScript(scriptModule, outputFile) {
|
||||
}
|
||||
Meta.exit(Meta.ExitCode.SUCCESS);
|
||||
},
|
||||
function(err) {
|
||||
err => {
|
||||
log("Script failed: " + err + "\n" + err.stack);
|
||||
Meta.exit(Meta.ExitCode.ERROR);
|
||||
});
|
||||
|
@ -214,9 +214,9 @@ var SearchResultsBase = new Lang.Class({
|
||||
},
|
||||
|
||||
_ensureResultActors(results, callback) {
|
||||
let metasNeeded = results.filter(Lang.bind(this, function(resultId) {
|
||||
return this._resultDisplays[resultId] === undefined;
|
||||
}));
|
||||
let metasNeeded = results.filter(
|
||||
resultId => this._resultDisplays[resultId] === undefined
|
||||
);
|
||||
|
||||
if (metasNeeded.length === 0) {
|
||||
callback(true);
|
||||
@ -224,30 +224,28 @@ var SearchResultsBase = new Lang.Class({
|
||||
this._cancellable.cancel();
|
||||
this._cancellable.reset();
|
||||
|
||||
this.provider.getResultMetas(metasNeeded, Lang.bind(this, function(metas) {
|
||||
this.provider.getResultMetas(metasNeeded, metas => {
|
||||
if (metas.length != metasNeeded.length) {
|
||||
log('Wrong number of result metas returned by search provider ' + this.provider.id +
|
||||
': expected ' + metasNeeded.length + ' but got ' + metas.length);
|
||||
callback(false);
|
||||
return;
|
||||
}
|
||||
if (metas.some(function(meta) {
|
||||
return !meta.name || !meta.id;
|
||||
})) {
|
||||
if (metas.some(meta => !meta.name || !meta.id)) {
|
||||
log('Invalid result meta returned from search provider ' + this.provider.id);
|
||||
callback(false);
|
||||
return;
|
||||
}
|
||||
|
||||
metasNeeded.forEach(Lang.bind(this, function(resultId, i) {
|
||||
metasNeeded.forEach((resultId, i) => {
|
||||
let meta = metas[i];
|
||||
let display = this._createResultDisplay(meta);
|
||||
display.connect('activate', Lang.bind(this, this._activateResult));
|
||||
display.actor.connect('key-focus-in', Lang.bind(this, this._keyFocusIn));
|
||||
this._resultDisplays[resultId] = display;
|
||||
}));
|
||||
});
|
||||
callback(true);
|
||||
}), this._cancellable);
|
||||
}, this._cancellable);
|
||||
}
|
||||
},
|
||||
|
||||
@ -262,7 +260,7 @@ var SearchResultsBase = new Lang.Class({
|
||||
let results = this.provider.filterResults(providerResults, maxResults);
|
||||
let moreCount = Math.max(providerResults.length - results.length, 0);
|
||||
|
||||
this._ensureResultActors(results, Lang.bind(this, function(successful) {
|
||||
this._ensureResultActors(results, successful => {
|
||||
if (!successful) {
|
||||
this._clearResultDisplay();
|
||||
callback();
|
||||
@ -274,13 +272,13 @@ var SearchResultsBase = new Lang.Class({
|
||||
// content while filling in the results.
|
||||
this.actor.hide();
|
||||
this._clearResultDisplay();
|
||||
results.forEach(Lang.bind(this, function(resultId) {
|
||||
results.forEach(resultId => {
|
||||
this._addItem(this._resultDisplays[resultId]);
|
||||
}));
|
||||
});
|
||||
this._setMoreCount(this.provider.canLaunchSearch ? moreCount : 0);
|
||||
this.actor.show();
|
||||
callback();
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -295,12 +293,11 @@ var ListSearchResults = new Lang.Class({
|
||||
this._container = new St.BoxLayout({ style_class: 'search-section-content' });
|
||||
this.providerInfo = new ProviderInfo(provider);
|
||||
this.providerInfo.connect('key-focus-in', Lang.bind(this, this._keyFocusIn));
|
||||
this.providerInfo.connect('clicked', Lang.bind(this,
|
||||
function() {
|
||||
this.providerInfo.animateLaunch();
|
||||
provider.launchSearch(this._terms);
|
||||
Main.overview.toggle();
|
||||
}));
|
||||
this.providerInfo.connect('clicked', () => {
|
||||
this.providerInfo.animateLaunch();
|
||||
provider.launchSearch(this._terms);
|
||||
Main.overview.toggle();
|
||||
});
|
||||
|
||||
this._container.add(this.providerInfo, { x_fill: false,
|
||||
y_fill: false,
|
||||
@ -457,16 +454,14 @@ var SearchResults = new Lang.Class({
|
||||
},
|
||||
|
||||
_reloadRemoteProviders() {
|
||||
let remoteProviders = this._providers.filter(function(provider) {
|
||||
return provider.isRemoteProvider;
|
||||
});
|
||||
remoteProviders.forEach(Lang.bind(this, function(provider) {
|
||||
let remoteProviders = this._providers.filter(p => p.isRemoteProvider);
|
||||
remoteProviders.forEach(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));
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_registerProvider(provider) {
|
||||
@ -511,7 +506,7 @@ var SearchResults = new Lang.Class({
|
||||
let previousResults = this._results;
|
||||
this._results = {};
|
||||
|
||||
this._providers.forEach(Lang.bind(this, function(provider) {
|
||||
this._providers.forEach(provider => {
|
||||
provider.searchInProgress = true;
|
||||
|
||||
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);
|
||||
else
|
||||
provider.getInitialResultSet(this._terms, Lang.bind(this, this._gotResults, provider), this._cancellable);
|
||||
}));
|
||||
});
|
||||
|
||||
this._updateSearchProgress();
|
||||
|
||||
@ -597,7 +592,7 @@ var SearchResults = new Lang.Class({
|
||||
},
|
||||
|
||||
_clearDisplay() {
|
||||
this._providers.forEach(function(provider) {
|
||||
this._providers.forEach(provider => {
|
||||
provider.display.clear();
|
||||
});
|
||||
},
|
||||
@ -632,13 +627,11 @@ var SearchResults = new Lang.Class({
|
||||
if (this._startingSearch)
|
||||
return true;
|
||||
|
||||
return this._providers.some(function(provider) {
|
||||
return provider.searchInProgress;
|
||||
});
|
||||
return this._providers.some(p => p.searchInProgress);
|
||||
},
|
||||
|
||||
_updateSearchProgress() {
|
||||
let haveResults = this._providers.some(function(provider) {
|
||||
let haveResults = this._providers.some(provider => {
|
||||
let display = provider.display;
|
||||
return (display.getFirstResult() != null);
|
||||
});
|
||||
@ -659,12 +652,12 @@ var SearchResults = new Lang.Class({
|
||||
let terms = this._terms;
|
||||
let display = provider.display;
|
||||
|
||||
display.updateSearch(results, terms, Lang.bind(this, function() {
|
||||
display.updateSearch(results, terms, () => {
|
||||
provider.searchInProgress = false;
|
||||
|
||||
this._maybeSetInitialSelection();
|
||||
this._updateSearchProgress();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
activateDefault() {
|
||||
|
@ -138,7 +138,7 @@ function _loadModes() {
|
||||
|
||||
function listModes() {
|
||||
_loadModes();
|
||||
let id = Mainloop.idle_add(function() {
|
||||
let id = Mainloop.idle_add(() => {
|
||||
let names = Object.getOwnPropertyNames(_modes);
|
||||
for (let i = 0; i < names.length; i++)
|
||||
if (_modes[names[i]].isPrimary)
|
||||
|
@ -92,10 +92,10 @@ var GnomeShell = new Lang.Class({
|
||||
this._grabbedAccelerators = new Map();
|
||||
this._grabbers = new Map();
|
||||
|
||||
global.display.connect('accelerator-activated', Lang.bind(this,
|
||||
function(display, action, deviceid, timestamp) {
|
||||
global.display.connect('accelerator-activated',
|
||||
(display, action, deviceid, timestamp) => {
|
||||
this._emitAcceleratorActivated(action, deviceid, timestamp);
|
||||
}));
|
||||
});
|
||||
|
||||
this._cachedOverviewVisible = false;
|
||||
Main.overview.connect('showing',
|
||||
@ -357,7 +357,7 @@ var GnomeShellExtensions = new Lang.Class({
|
||||
// Only serialize the properties that we actually need.
|
||||
const serializedProperties = ["type", "state", "path", "error", "hasPrefs"];
|
||||
|
||||
serializedProperties.forEach(function(prop) {
|
||||
serializedProperties.forEach(prop => {
|
||||
obj[prop] = extension[prop];
|
||||
});
|
||||
|
||||
@ -439,12 +439,12 @@ var ScreenSaverDBus = new Lang.Class({
|
||||
this.parent();
|
||||
|
||||
this._screenShield = screenShield;
|
||||
screenShield.connect('active-changed', Lang.bind(this, function(shield) {
|
||||
screenShield.connect('active-changed', shield => {
|
||||
this._dbusImpl.emit_signal('ActiveChanged', GLib.Variant.new('(b)', [shield.active]));
|
||||
}));
|
||||
screenShield.connect('wake-up-screen', Lang.bind(this, function(shield) {
|
||||
});
|
||||
screenShield.connect('wake-up-screen', shield => {
|
||||
this._dbusImpl.emit_signal('WakeUpScreen', null);
|
||||
}));
|
||||
});
|
||||
|
||||
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(ScreenSaverIface, this);
|
||||
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/ScreenSaver');
|
||||
@ -453,11 +453,11 @@ var ScreenSaverDBus = new Lang.Class({
|
||||
},
|
||||
|
||||
LockAsync(parameters, invocation) {
|
||||
let tmpId = this._screenShield.connect('lock-screen-shown', Lang.bind(this, function() {
|
||||
let tmpId = this._screenShield.connect('lock-screen-shown', () => {
|
||||
this._screenShield.disconnect(tmpId);
|
||||
|
||||
invocation.return_value(null);
|
||||
}));
|
||||
});
|
||||
|
||||
this._screenShield.lock(true);
|
||||
},
|
||||
|
@ -85,10 +85,10 @@ var EntryMenu = new Lang.Class({
|
||||
},
|
||||
|
||||
_updatePasteItem() {
|
||||
this._clipboard.get_text(St.ClipboardType.CLIPBOARD, Lang.bind(this,
|
||||
function(clipboard, text) {
|
||||
this._clipboard.get_text(St.ClipboardType.CLIPBOARD,
|
||||
(clipboard, text) => {
|
||||
this._pasteItem.setSensitive(text && text != '');
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_updatePasswordItem() {
|
||||
@ -105,14 +105,14 @@ var EntryMenu = new Lang.Class({
|
||||
},
|
||||
|
||||
_onPasteActivated() {
|
||||
this._clipboard.get_text(St.ClipboardType.CLIPBOARD, Lang.bind(this,
|
||||
function(clipboard, text) {
|
||||
this._clipboard.get_text(St.ClipboardType.CLIPBOARD,
|
||||
(clipboard, text) => {
|
||||
if (!text)
|
||||
return;
|
||||
this._entry.clutter_text.delete_selection();
|
||||
let pos = this._entry.clutter_text.get_cursor_position();
|
||||
this._entry.clutter_text.insert_text(text, pos);
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_onPasswordActivated() {
|
||||
@ -166,7 +166,7 @@ function addContextMenu(entry, params) {
|
||||
|
||||
entry.connect('popup-menu', Lang.bind(null, _onPopup, entry));
|
||||
|
||||
entry.connect('destroy', function() {
|
||||
entry.connect('destroy', () => {
|
||||
entry.menu.destroy();
|
||||
entry.menu = null;
|
||||
entry._menuManager = null;
|
||||
|
@ -137,13 +137,13 @@ var ShellMountOperation = new Lang.Class({
|
||||
this._closeExistingDialog();
|
||||
this._dialog = new ShellMountQuestionDialog(this._gicon);
|
||||
|
||||
this._dialogId = this._dialog.connect('response', Lang.bind(this,
|
||||
function(object, choice) {
|
||||
this._dialogId = this._dialog.connect('response',
|
||||
(object, choice) => {
|
||||
this.mountOp.set_choice(choice);
|
||||
this.mountOp.reply(Gio.MountOperationResult.HANDLED);
|
||||
|
||||
this.close();
|
||||
}));
|
||||
});
|
||||
|
||||
this._dialog.update(message, choices);
|
||||
this._dialog.open();
|
||||
@ -157,8 +157,8 @@ var ShellMountOperation = new Lang.Class({
|
||||
this._dialog = new ShellMountPasswordDialog(message, this._gicon, flags);
|
||||
}
|
||||
|
||||
this._dialogId = this._dialog.connect('response', Lang.bind(this,
|
||||
function(object, choice, password, remember) {
|
||||
this._dialogId = this._dialog.connect('response',
|
||||
(object, choice, password, remember) => {
|
||||
if (choice == -1) {
|
||||
this.mountOp.reply(Gio.MountOperationResult.ABORTED);
|
||||
} else {
|
||||
@ -170,7 +170,7 @@ var ShellMountOperation = new Lang.Class({
|
||||
this.mountOp.set_password(password);
|
||||
this.mountOp.reply(Gio.MountOperationResult.HANDLED);
|
||||
}
|
||||
}));
|
||||
});
|
||||
this._dialog.open();
|
||||
},
|
||||
|
||||
@ -200,8 +200,8 @@ var ShellMountOperation = new Lang.Class({
|
||||
this._processesDialog = new ShellProcessesDialog(this._gicon);
|
||||
this._dialog = this._processesDialog;
|
||||
|
||||
this._dialogId = this._processesDialog.connect('response', Lang.bind(this,
|
||||
function(object, choice) {
|
||||
this._dialogId = this._processesDialog.connect('response',
|
||||
(object, choice) => {
|
||||
if (choice == -1) {
|
||||
this.mountOp.reply(Gio.MountOperationResult.ABORTED);
|
||||
} else {
|
||||
@ -210,7 +210,7 @@ var ShellMountOperation = new Lang.Class({
|
||||
}
|
||||
|
||||
this.close();
|
||||
}));
|
||||
});
|
||||
this._processesDialog.open();
|
||||
}
|
||||
|
||||
@ -397,24 +397,22 @@ var ShellProcessesDialog = new Lang.Class({
|
||||
this._applicationList = new St.BoxLayout({ vertical: true });
|
||||
scrollView.add_actor(this._applicationList);
|
||||
|
||||
this._applicationList.connect('actor-added',
|
||||
Lang.bind(this, function() {
|
||||
if (this._applicationList.get_n_children() == 1)
|
||||
scrollView.show();
|
||||
}));
|
||||
this._applicationList.connect('actor-added', () => {
|
||||
if (this._applicationList.get_n_children() == 1)
|
||||
scrollView.show();
|
||||
});
|
||||
|
||||
this._applicationList.connect('actor-removed',
|
||||
Lang.bind(this, function() {
|
||||
if (this._applicationList.get_n_children() == 0)
|
||||
scrollView.hide();
|
||||
}));
|
||||
this._applicationList.connect('actor-removed', () => {
|
||||
if (this._applicationList.get_n_children() == 0)
|
||||
scrollView.hide();
|
||||
});
|
||||
},
|
||||
|
||||
_setAppsForPids(pids) {
|
||||
// remove all the items
|
||||
this._applicationList.destroy_all_children();
|
||||
|
||||
pids.forEach(Lang.bind(this, function(pid) {
|
||||
pids.forEach(pid => {
|
||||
let tracker = Shell.WindowTracker.get_default();
|
||||
let app = tracker.get_app_from_pid(pid);
|
||||
|
||||
@ -424,12 +422,11 @@ var ShellProcessesDialog = new Lang.Class({
|
||||
let item = new ListItem(app);
|
||||
this._applicationList.add(item.actor, { x_fill: true });
|
||||
|
||||
item.connect('activate',
|
||||
Lang.bind(this, function() {
|
||||
// use -1 to indicate Cancel
|
||||
this.emit('response', -1);
|
||||
}));
|
||||
}));
|
||||
item.connect('activate', () => {
|
||||
// use -1 to indicate Cancel
|
||||
this.emit('response', -1);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
update(message, processes, choices) {
|
||||
@ -572,8 +569,8 @@ var GnomeShellMountOpHandler = new Lang.Class({
|
||||
this._closeDialog();
|
||||
|
||||
this._dialog = new ShellMountPasswordDialog(message, this._createGIcon(iconName), flags);
|
||||
this._dialog.connect('response', Lang.bind(this,
|
||||
function(object, choice, password, remember) {
|
||||
this._dialog.connect('response',
|
||||
(object, choice, password, remember) => {
|
||||
let details = {};
|
||||
let response;
|
||||
|
||||
@ -588,7 +585,7 @@ var GnomeShellMountOpHandler = new Lang.Class({
|
||||
}
|
||||
|
||||
this._clearCurrentRequest(response, details);
|
||||
}));
|
||||
});
|
||||
this._dialog.open();
|
||||
},
|
||||
|
||||
@ -621,11 +618,10 @@ var GnomeShellMountOpHandler = new Lang.Class({
|
||||
this._closeDialog();
|
||||
|
||||
this._dialog = new ShellMountQuestionDialog(this._createGIcon(iconName), message);
|
||||
this._dialog.connect('response', Lang.bind(this,
|
||||
function(object, choice) {
|
||||
this._clearCurrentRequest(Gio.MountOperationResult.HANDLED,
|
||||
{ choice: GLib.Variant.new('i', choice) });
|
||||
}));
|
||||
this._dialog.connect('response', (object, choice) => {
|
||||
this._clearCurrentRequest(Gio.MountOperationResult.HANDLED,
|
||||
{ choice: GLib.Variant.new('i', choice) });
|
||||
});
|
||||
|
||||
this._dialog.update(message, choices);
|
||||
this._dialog.open();
|
||||
@ -661,20 +657,19 @@ var GnomeShellMountOpHandler = new Lang.Class({
|
||||
this._closeDialog();
|
||||
|
||||
this._dialog = new ShellProcessesDialog(this._createGIcon(iconName));
|
||||
this._dialog.connect('response', Lang.bind(this,
|
||||
function(object, choice) {
|
||||
let response;
|
||||
let details = {};
|
||||
this._dialog.connect('response', (object, choice) => {
|
||||
let response;
|
||||
let details = {};
|
||||
|
||||
if (choice == -1) {
|
||||
response = Gio.MountOperationResult.ABORTED;
|
||||
} else {
|
||||
response = Gio.MountOperationResult.HANDLED;
|
||||
details['choice'] = GLib.Variant.new('i', choice);
|
||||
}
|
||||
if (choice == -1) {
|
||||
response = Gio.MountOperationResult.ABORTED;
|
||||
} else {
|
||||
response = Gio.MountOperationResult.HANDLED;
|
||||
details['choice'] = GLib.Variant.new('i', choice);
|
||||
}
|
||||
|
||||
this._clearCurrentRequest(response, details);
|
||||
}));
|
||||
this._clearCurrentRequest(response, details);
|
||||
});
|
||||
|
||||
this._dialog.update(message, applicationPids, choices);
|
||||
this._dialog.open();
|
||||
|
@ -93,7 +93,7 @@ var ATIndicator = new Lang.Class({
|
||||
let alwaysShow = this._a11ySettings.get_boolean(KEY_ALWAYS_SHOW);
|
||||
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;
|
||||
},
|
||||
@ -111,7 +111,7 @@ var ATIndicator = new Lang.Class({
|
||||
if (!writable)
|
||||
widget.actor.reactive = false;
|
||||
else
|
||||
widget.connect('toggled', function(item) {
|
||||
widget.connect('toggled', item => {
|
||||
on_set(item.state);
|
||||
});
|
||||
return widget;
|
||||
@ -119,25 +119,23 @@ var ATIndicator = new Lang.Class({
|
||||
|
||||
_buildItem(string, schema, key) {
|
||||
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));
|
||||
|
||||
this._queueSyncMenuVisibility();
|
||||
}));
|
||||
});
|
||||
|
||||
let widget = this._buildItemExtended(string,
|
||||
settings.get_boolean(key),
|
||||
settings.is_writable(key),
|
||||
function(enabled) {
|
||||
return settings.set_boolean(key, enabled);
|
||||
});
|
||||
enabled => settings.set_boolean(key, enabled));
|
||||
return widget;
|
||||
},
|
||||
|
||||
_buildHCItem() {
|
||||
let interfaceSettings = new Gio.Settings({ schema_id: DESKTOP_INTERFACE_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);
|
||||
if (value == HIGH_CONTRAST_THEME) {
|
||||
highContrast.setToggleState(true);
|
||||
@ -147,13 +145,13 @@ var ATIndicator = new Lang.Class({
|
||||
}
|
||||
|
||||
this._queueSyncMenuVisibility();
|
||||
}));
|
||||
interfaceSettings.connect('changed::' + KEY_ICON_THEME, function() {
|
||||
});
|
||||
interfaceSettings.connect('changed::' + KEY_ICON_THEME, () => {
|
||||
let value = interfaceSettings.get_string(KEY_ICON_THEME);
|
||||
if (value != HIGH_CONTRAST_THEME)
|
||||
iconTheme = value;
|
||||
});
|
||||
wmSettings.connect('changed::' + KEY_WM_THEME, function() {
|
||||
wmSettings.connect('changed::' + KEY_WM_THEME, () => {
|
||||
let value = wmSettings.get_string(KEY_WM_THEME);
|
||||
if (value != HIGH_CONTRAST_THEME)
|
||||
wmTheme = value;
|
||||
@ -169,7 +167,7 @@ var ATIndicator = new Lang.Class({
|
||||
interfaceSettings.is_writable(KEY_GTK_THEME) &&
|
||||
interfaceSettings.is_writable(KEY_ICON_THEME) &&
|
||||
wmSettings.is_writable(KEY_WM_THEME),
|
||||
function (enabled) {
|
||||
enabled => {
|
||||
if (enabled) {
|
||||
interfaceSettings.set_string(KEY_GTK_THEME, HIGH_CONTRAST_THEME);
|
||||
interfaceSettings.set_string(KEY_ICON_THEME, HIGH_CONTRAST_THEME);
|
||||
@ -189,20 +187,20 @@ var ATIndicator = new Lang.Class({
|
||||
|
||||
_buildFontItem() {
|
||||
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 active = (factor > 1.0);
|
||||
widget.setToggleState(active);
|
||||
|
||||
this._queueSyncMenuVisibility();
|
||||
}));
|
||||
});
|
||||
|
||||
let factor = settings.get_double(KEY_TEXT_SCALING_FACTOR);
|
||||
let initial_setting = (factor > 1.0);
|
||||
let widget = this._buildItemExtended(_("Large Text"),
|
||||
initial_setting,
|
||||
settings.is_writable(KEY_TEXT_SCALING_FACTOR),
|
||||
function (enabled) {
|
||||
enabled => {
|
||||
if (enabled)
|
||||
settings.set_double(KEY_TEXT_SCALING_FACTOR,
|
||||
DPI_FACTOR_LARGE);
|
||||
|
@ -35,23 +35,23 @@ var Indicator = new Lang.Class({
|
||||
this._hadSetupDevices = global.settings.get_boolean(HAD_BLUETOOTH_DEVICES_SETUP);
|
||||
|
||||
this._proxy = new RfkillManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
|
||||
Lang.bind(this, function(proxy, error) {
|
||||
(proxy, error) => {
|
||||
if (error) {
|
||||
log(error.message);
|
||||
return;
|
||||
}
|
||||
|
||||
this._sync();
|
||||
}));
|
||||
});
|
||||
this._proxy.connect('g-properties-changed', Lang.bind(this, this._sync));
|
||||
|
||||
this._item = new PopupMenu.PopupSubMenuMenuItem(_("Bluetooth"), true);
|
||||
this._item.icon.icon_name = 'bluetooth-active-symbolic';
|
||||
|
||||
this._toggleItem = new PopupMenu.PopupMenuItem('');
|
||||
this._toggleItem.connect('activate', Lang.bind(this, function() {
|
||||
this._toggleItem.connect('activate', () => {
|
||||
this._proxy.BluetoothAirplaneMode = !this._proxy.BluetoothAirplaneMode;
|
||||
}));
|
||||
});
|
||||
this._item.menu.addMenuItem(this._toggleItem);
|
||||
|
||||
this._item.menu.addSettingsAction(_("Bluetooth Settings"), 'gnome-bluetooth-panel.desktop');
|
||||
|
@ -26,7 +26,7 @@ var Indicator = new Lang.Class({
|
||||
_init() {
|
||||
this.parent('display-brightness-symbolic');
|
||||
this._proxy = new BrightnessProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
|
||||
Lang.bind(this, function(proxy, error) {
|
||||
(proxy, error) => {
|
||||
if (error) {
|
||||
log(error.message);
|
||||
return;
|
||||
@ -34,7 +34,7 @@ var Indicator = new Lang.Class({
|
||||
|
||||
this._proxy.connect('g-properties-changed', Lang.bind(this, this._sync));
|
||||
this._sync();
|
||||
}));
|
||||
});
|
||||
|
||||
this._item = new PopupMenu.PopupBaseMenuItem({ activate: false });
|
||||
this.menu.addMenuItem(this._item);
|
||||
@ -47,12 +47,12 @@ var Indicator = new Lang.Class({
|
||||
style_class: 'popup-menu-icon' });
|
||||
this._item.actor.add(icon);
|
||||
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);
|
||||
}));
|
||||
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);
|
||||
}));
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
|
@ -209,7 +209,7 @@ var InputSourceSystemSettings = new Lang.Class({
|
||||
'GetAll',
|
||||
new GLib.Variant('(s)', [this._BUS_IFACE]),
|
||||
null, Gio.DBusCallFlags.NONE, -1, null,
|
||||
Lang.bind(this, function(conn, result) {
|
||||
(conn, result) => {
|
||||
let props;
|
||||
try {
|
||||
props = conn.call_finish(result).deep_unpack()[0];
|
||||
@ -231,7 +231,7 @@ var InputSourceSystemSettings = new Lang.Class({
|
||||
this._options = options;
|
||||
this._emitKeyboardOptionsChanged();
|
||||
}
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
get inputSources() {
|
||||
@ -485,7 +485,7 @@ var InputSourceManager = new Lang.Class({
|
||||
for (let i in this._inputSources)
|
||||
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) {
|
||||
this._mruSources = this._mruSourcesBackup;
|
||||
@ -733,9 +733,7 @@ var InputSourceManager = new Lang.Class({
|
||||
Main.overview.disconnect(this._overviewHiddenId);
|
||||
this._overviewHiddenId = 0;
|
||||
|
||||
let windows = global.get_window_actors().map(function(w) {
|
||||
return w.meta_window;
|
||||
});
|
||||
let windows = global.get_window_actors().map(w => w.meta_window);
|
||||
for (let i = 0; i < windows.length; ++i) {
|
||||
delete windows[i]._inputSources;
|
||||
delete windows[i]._currentSource;
|
||||
@ -836,16 +834,14 @@ var InputSourceIndicator = new Lang.Class({
|
||||
let is = this._inputSourceManager.inputSources[i];
|
||||
|
||||
let menuItem = new LayoutMenuItem(is.displayName, is.shortName);
|
||||
menuItem.connect('activate', function() {
|
||||
is.activate(true);
|
||||
});
|
||||
menuItem.connect('activate', () => { is.activate(true); });
|
||||
|
||||
let indicatorLabel = new St.Label({ text: is.shortName,
|
||||
visible: false });
|
||||
|
||||
this._menuItems[i] = menuItem;
|
||||
this._indicatorLabels[i] = indicatorLabel;
|
||||
is.connect('changed', function() {
|
||||
is.connect('changed', () => {
|
||||
menuItem.indicator.set_text(is.shortName);
|
||||
indicatorLabel.set_text(is.shortName);
|
||||
});
|
||||
@ -939,7 +935,7 @@ var InputSourceIndicator = new Lang.Class({
|
||||
item.radioGroup = radioGroup;
|
||||
item.setOrnament(prop.get_state() == IBus.PropState.CHECKED ?
|
||||
PopupMenu.Ornament.DOT : PopupMenu.Ornament.NONE);
|
||||
item.connect('activate', Lang.bind(this, function() {
|
||||
item.connect('activate', () => {
|
||||
if (item.prop.get_state() == IBus.PropState.CHECKED)
|
||||
return;
|
||||
|
||||
@ -957,13 +953,13 @@ var InputSourceIndicator = new Lang.Class({
|
||||
IBus.PropState.UNCHECKED);
|
||||
}
|
||||
}
|
||||
}));
|
||||
});
|
||||
break;
|
||||
|
||||
case IBus.PropType.TOGGLE:
|
||||
item = new PopupMenu.PopupSwitchMenuItem(prop.get_label().get_text(), prop.get_state() == IBus.PropState.CHECKED);
|
||||
item.prop = prop;
|
||||
item.connect('toggled', Lang.bind(this, function() {
|
||||
item.connect('toggled', () => {
|
||||
if (item.state) {
|
||||
item.prop.set_state(IBus.PropState.CHECKED);
|
||||
ibusManager.activateProperty(item.prop.get_key(),
|
||||
@ -973,16 +969,16 @@ var InputSourceIndicator = new Lang.Class({
|
||||
ibusManager.activateProperty(item.prop.get_key(),
|
||||
IBus.PropState.UNCHECKED);
|
||||
}
|
||||
}));
|
||||
});
|
||||
break;
|
||||
|
||||
case IBus.PropType.NORMAL:
|
||||
item = new PopupMenu.PopupMenuItem(prop.get_label().get_text());
|
||||
item.prop = prop;
|
||||
item.connect('activate', Lang.bind(this, function() {
|
||||
item.connect('activate', () => {
|
||||
ibusManager.activateProperty(item.prop.get_key(),
|
||||
item.prop.get_state());
|
||||
}));
|
||||
});
|
||||
break;
|
||||
|
||||
case IBus.PropType.SEPARATOR:
|
||||
|
@ -116,11 +116,11 @@ var Indicator = new Lang.Class({
|
||||
this._permStoreProxy,
|
||||
this._getMaxAccuracyLevel());
|
||||
|
||||
authorizer.authorize(Lang.bind(this, function(accuracyLevel) {
|
||||
authorizer.authorize(accuracyLevel => {
|
||||
let ret = (accuracyLevel != GeoclueAccuracyLevel.NONE);
|
||||
invocation.return_value(GLib.Variant.new('(bu)',
|
||||
[ret, accuracyLevel]));
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_syncIndicator() {
|
||||
@ -331,12 +331,11 @@ var AppAuthorizer = new Lang.Class({
|
||||
reason,
|
||||
this.reqAccuracyLevel);
|
||||
|
||||
let responseId = this._dialog.connect('response', Lang.bind(this,
|
||||
function(dialog, level) {
|
||||
this._dialog.disconnect(responseId);
|
||||
this._accuracyLevel = level;
|
||||
this._completeAuth();
|
||||
}));
|
||||
let responseId = this._dialog.connect('response', (dialog, level) => {
|
||||
this._dialog.disconnect(responseId);
|
||||
this._accuracyLevel = level;
|
||||
this._completeAuth();
|
||||
});
|
||||
|
||||
this._dialog.open();
|
||||
},
|
||||
@ -367,7 +366,7 @@ var AppAuthorizer = new Lang.Class({
|
||||
APP_PERMISSIONS_ID,
|
||||
this._permissions,
|
||||
data,
|
||||
function (result, error) {
|
||||
(result, error) => {
|
||||
if (error != null)
|
||||
log(error.message);
|
||||
});
|
||||
|
@ -293,12 +293,10 @@ var NMConnectionSection = new Lang.Class({
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
item.connect('icon-changed', Lang.bind(this, function() {
|
||||
this._iconChanged();
|
||||
}));
|
||||
item.connect('activation-failed', Lang.bind(this, function(item, reason) {
|
||||
item.connect('icon-changed', () => { this._iconChanged(); });
|
||||
item.connect('activation-failed', (item, reason) => {
|
||||
this.emit('activation-failed', reason);
|
||||
}));
|
||||
});
|
||||
item.connect('name-changed', Lang.bind(this, this._sync));
|
||||
|
||||
let pos = Util.insertSorted(this._connections, connection, Lang.bind(this, this._connectionSortFunction));
|
||||
@ -550,9 +548,9 @@ var NMDeviceModem = new Lang.Class({
|
||||
|
||||
if (this._mobileDevice) {
|
||||
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();
|
||||
}));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@ -649,13 +647,9 @@ var NMWirelessDialogItem = new Lang.Class({
|
||||
this.actor = new St.BoxLayout({ style_class: 'nm-dialog-item',
|
||||
can_focus: true,
|
||||
reactive: true });
|
||||
this.actor.connect('key-focus-in', Lang.bind(this, function() {
|
||||
this.emit('selected');
|
||||
}));
|
||||
this.actor.connect('key-focus-in', () => { this.emit('selected'); });
|
||||
let action = new Clutter.ClickAction();
|
||||
action.connect('clicked', Lang.bind(this, function() {
|
||||
this.actor.grab_key_focus();
|
||||
}));
|
||||
action.connect('clicked', () => { this.actor.grab_key_focus(); });
|
||||
this.actor.add_action(action);
|
||||
|
||||
let title = ssidToLabel(this._ap.get_ssid());
|
||||
@ -725,9 +719,9 @@ var NMWirelessDialog = new Lang.Class({
|
||||
this._buildLayout();
|
||||
|
||||
let connections = client.get_connections();
|
||||
this._connections = connections.filter(Lang.bind(this, function(connection) {
|
||||
return device.connection_valid(connection);
|
||||
}));
|
||||
this._connections = connections.filter(
|
||||
connection => device.connection_valid(connection)
|
||||
);
|
||||
|
||||
this._apAddedId = device.connect('access-point-added', Lang.bind(this, this._accessPointAdded));
|
||||
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
|
||||
let accessPoints = device.get_access_points() || [ ];
|
||||
accessPoints.forEach(Lang.bind(this, function(ap) {
|
||||
accessPoints.forEach(ap => {
|
||||
this._accessPointAdded(this._device, ap);
|
||||
}));
|
||||
});
|
||||
|
||||
this._selectedNetwork = null;
|
||||
this._activeApChanged();
|
||||
@ -902,12 +896,12 @@ var NMWirelessDialog = new Lang.Class({
|
||||
|
||||
let airplaneSubStack = new St.Widget({ layout_manager: new Clutter.BinLayout });
|
||||
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)
|
||||
this._rfkill.airplaneMode = false;
|
||||
else
|
||||
this._client.wireless_enabled = true;
|
||||
}));
|
||||
});
|
||||
airplaneSubStack.add_actor(this._airplaneButton);
|
||||
this._airplaneInactive = new St.Label({ style_class: 'nm-dialog-airplane-text',
|
||||
text: _("Use hardware switch to turn off") });
|
||||
@ -1058,7 +1052,7 @@ var NMWirelessDialog = new Lang.Class({
|
||||
},
|
||||
|
||||
_checkConnections(network, accessPoint) {
|
||||
this._connections.forEach(function(connection) {
|
||||
this._connections.forEach(connection => {
|
||||
if (accessPoint.connection_valid(connection) &&
|
||||
network.connections.indexOf(connection) == -1) {
|
||||
network.connections.push(connection);
|
||||
@ -1084,7 +1078,7 @@ var NMWirelessDialog = new Lang.Class({
|
||||
return;
|
||||
}
|
||||
|
||||
Util.insertSorted(network.accessPoints, accessPoint, function(one, two) {
|
||||
Util.insertSorted(network.accessPoints, accessPoint, (one, two) => {
|
||||
return two.strength - one.strength;
|
||||
});
|
||||
network.item.updateBestAP(network.accessPoints[0]);
|
||||
@ -1137,9 +1131,9 @@ var NMWirelessDialog = new Lang.Class({
|
||||
let scrollValue = adjustment.value;
|
||||
|
||||
this._itemBox.remove_all_children();
|
||||
this._networks.forEach(Lang.bind(this, function(network) {
|
||||
this._networks.forEach(network => {
|
||||
this._itemBox.add_child(network.item.actor);
|
||||
}));
|
||||
});
|
||||
|
||||
adjustment.value = scrollValue;
|
||||
},
|
||||
@ -1158,10 +1152,10 @@ var NMWirelessDialog = new Lang.Class({
|
||||
_createNetworkItem(network) {
|
||||
network.item = new NMWirelessDialogItem(network);
|
||||
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);
|
||||
this._selectNetwork(network);
|
||||
}));
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@ -1518,12 +1512,12 @@ var NMVpnSection = new Lang.Class({
|
||||
for (let item of connections) {
|
||||
item.setActiveConnection(null);
|
||||
}
|
||||
vpnConnections.forEach(Lang.bind(this, function(a) {
|
||||
vpnConnections.forEach(a => {
|
||||
if (a.connection) {
|
||||
let item = this._connectionItems.get(a.connection.get_uuid());
|
||||
item.setActiveConnection(a);
|
||||
}
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_makeConnectionItem(connection) {
|
||||
@ -1570,9 +1564,7 @@ var DeviceCategory = new Lang.Class({
|
||||
|
||||
_sync() {
|
||||
let nDevices = this.section.box.get_children().reduce(
|
||||
function(prev, child) {
|
||||
return prev + (child.visible ? 1 : 0);
|
||||
}, 0);
|
||||
(prev, child) => prev + (child.visible ? 1 : 0), 0);
|
||||
this._summaryItem.label.text = this._getSummaryLabel(nDevices);
|
||||
let shouldSummarize = nDevices > MAX_DEVICE_ITEMS;
|
||||
this._summaryItem.actor.visible = shouldSummarize;
|
||||
@ -1700,9 +1692,7 @@ var NMApplet = new Lang.Class({
|
||||
'network-transmit-receive');
|
||||
this._source.policy = new MessageTray.NotificationApplicationPolicy('gnome-network-panel');
|
||||
|
||||
this._source.connect('destroy', Lang.bind(this, function() {
|
||||
this._source = null;
|
||||
}));
|
||||
this._source.connect('destroy', () => { this._source = null; });
|
||||
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.setUrgency(urgency);
|
||||
this._notification.setTransient(true);
|
||||
this._notification.connect('destroy', function() {
|
||||
this._notification.connect('destroy', () => {
|
||||
this._notification = null;
|
||||
});
|
||||
this._source.notify(this._notification);
|
||||
@ -1767,7 +1757,7 @@ var NMApplet = new Lang.Class({
|
||||
this._syncDeviceNames();
|
||||
|
||||
if (wrapper instanceof NMConnectionSection) {
|
||||
this._connections.forEach(function(connection) {
|
||||
this._connections.forEach(connection => {
|
||||
wrapper.checkConnection(connection);
|
||||
});
|
||||
}
|
||||
@ -1854,12 +1844,12 @@ var NMApplet = new Lang.Class({
|
||||
|
||||
_syncVpnConnections() {
|
||||
let activeConnections = this._client.get_active_connections() || [];
|
||||
let vpnConnections = activeConnections.filter(function(a) {
|
||||
return (a instanceof NM.VpnConnection);
|
||||
});
|
||||
vpnConnections.forEach(Lang.bind(this, function(a) {
|
||||
let vpnConnections = activeConnections.filter(
|
||||
a => (a instanceof NM.VpnConnection)
|
||||
);
|
||||
vpnConnections.forEach(a => {
|
||||
ensureActiveConnectionProps(a, this._client);
|
||||
}));
|
||||
});
|
||||
this._vpnSection.setActiveConnections(vpnConnections);
|
||||
|
||||
this._updateIcon();
|
||||
@ -1943,7 +1933,7 @@ var NMApplet = new Lang.Class({
|
||||
this._vpnSection.checkConnection(connection);
|
||||
} else {
|
||||
let devices = this._devices[section].devices;
|
||||
devices.forEach(function(wrapper) {
|
||||
devices.forEach(wrapper => {
|
||||
if (wrapper instanceof NMConnectionSection)
|
||||
wrapper.checkConnection(connection);
|
||||
});
|
||||
@ -1989,13 +1979,13 @@ var NMApplet = new Lang.Class({
|
||||
this._closeConnectivityCheck(path);
|
||||
return;
|
||||
} 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 {
|
||||
let state = client.check_connectivity_finish(result);
|
||||
if (state >= NM.ConnectivityState.FULL)
|
||||
this._closeConnectivityCheck(path);
|
||||
} catch(e) { }
|
||||
}));
|
||||
});
|
||||
} else {
|
||||
log('Invalid result from portal helper: ' + result);
|
||||
}
|
||||
@ -2030,7 +2020,7 @@ var NMApplet = new Lang.Class({
|
||||
this._portalHelperProxy.AuthenticateRemote(path, '', timestamp);
|
||||
} else {
|
||||
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) {
|
||||
log('Error launching the portal helper: ' + error);
|
||||
return;
|
||||
@ -2040,7 +2030,7 @@ var NMApplet = new Lang.Class({
|
||||
proxy.connectSignal('Done', Lang.bind(this, this._portalHelperDone));
|
||||
|
||||
proxy.AuthenticateRemote(path, '', timestamp);
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
this._connectivityQueue.push(path);
|
||||
|
@ -47,7 +47,7 @@ var Indicator = new Lang.Class({
|
||||
this.indicators.add_style_class_name('power-status');
|
||||
|
||||
this._proxy = new PowerManagerProxy(Gio.DBus.system, BUS_NAME, OBJECT_PATH,
|
||||
Lang.bind(this, function(proxy, error) {
|
||||
(proxy, error) => {
|
||||
if (error) {
|
||||
log(error.message);
|
||||
return;
|
||||
@ -55,7 +55,7 @@ var Indicator = new Lang.Class({
|
||||
this._proxy.connect('g-properties-changed',
|
||||
Lang.bind(this, this._sync));
|
||||
this._sync();
|
||||
}));
|
||||
});
|
||||
|
||||
this._item = new PopupMenu.PopupSubMenuMenuItem("", true);
|
||||
this._item.menu.addSettingsAction(_("Power Settings"), 'gnome-power-panel.desktop');
|
||||
|
@ -26,7 +26,7 @@ var RfkillManager = new Lang.Class({
|
||||
|
||||
_init() {
|
||||
this._proxy = new RfkillManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
|
||||
Lang.bind(this, function(proxy, error) {
|
||||
(proxy, error) => {
|
||||
if (error) {
|
||||
log(error.message);
|
||||
return;
|
||||
@ -34,7 +34,7 @@ var RfkillManager = new Lang.Class({
|
||||
this._proxy.connect('g-properties-changed',
|
||||
Lang.bind(this, this._changed));
|
||||
this._changed();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
get airplaneMode() {
|
||||
@ -87,9 +87,9 @@ var Indicator = new Lang.Class({
|
||||
// changing the menu contents.
|
||||
this._item = new PopupMenu.PopupSubMenuMenuItem(_("Airplane Mode On"), true);
|
||||
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._item.menu.addSettingsAction(_("Network Settings"), 'gnome-network-panel.desktop');
|
||||
this.menu.addMenuItem(this._item);
|
||||
|
||||
|
@ -133,13 +133,12 @@ var Indicator = new Lang.Class({
|
||||
// settings (disable-log-out) and Polkit policy - the latter doesn't
|
||||
// notify, so we update the menu item each time the menu opens or
|
||||
// the lockdown setting changes, which should be close enough.
|
||||
this.menu.connect('open-state-changed', Lang.bind(this,
|
||||
function(menu, open) {
|
||||
if (!open)
|
||||
return;
|
||||
this.menu.connect('open-state-changed', (menu, open) => {
|
||||
if (!open)
|
||||
return;
|
||||
|
||||
this._systemActions.forceUpdate();
|
||||
}));
|
||||
this._systemActions.forceUpdate();
|
||||
});
|
||||
this._updateMultiUser();
|
||||
|
||||
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
|
||||
// or notify::width without creating layout cycles, simply update the
|
||||
// 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)
|
||||
this._updateSwitchUserSubMenu();
|
||||
}));
|
||||
});
|
||||
|
||||
item = new PopupMenu.PopupMenuItem(_("Switch User"));
|
||||
item.connect('activate', () => {
|
||||
|
@ -132,7 +132,7 @@ var Client = new Lang.Class({
|
||||
|
||||
enrollDevice(id, policy, callback) {
|
||||
this._proxy.EnrollDeviceRemote(id, policy, AuthFlags.NONE,
|
||||
Lang.bind(this, function (res, error) {
|
||||
(res, error) => {
|
||||
if (error) {
|
||||
callback(null, error);
|
||||
return;
|
||||
@ -143,7 +143,7 @@ var Client = new Lang.Class({
|
||||
BOLT_DBUS_NAME,
|
||||
path);
|
||||
callback(device, null);
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
@ -271,9 +271,7 @@ var Indicator = new Lang.Class({
|
||||
if (!this._source) {
|
||||
this._source = new MessageTray.Source(_("Thunderbolt"),
|
||||
'thunderbolt-symbolic');
|
||||
this._source.connect('destroy', Lang.bind(this, function() {
|
||||
this._source = null;
|
||||
}));
|
||||
this._source.connect('destroy', () => { this._source = null; });
|
||||
|
||||
Main.messageTray.add(this._source);
|
||||
}
|
||||
@ -289,7 +287,7 @@ var Indicator = new Lang.Class({
|
||||
|
||||
this._notification = new MessageTray.Notification(source, title, body);
|
||||
this._notification.setUrgency(MessageTray.Urgency.HIGH);
|
||||
this._notification.connect('destroy', function() {
|
||||
this._notification.connect('destroy', () => {
|
||||
this._notification = null;
|
||||
});
|
||||
this._notification.connect('activated', () => {
|
||||
|
@ -42,12 +42,12 @@ var StreamSlider = new Lang.Class({
|
||||
this._icon = new St.Icon({ style_class: 'popup-menu-icon' });
|
||||
this.item.actor.add(this._icon);
|
||||
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);
|
||||
}));
|
||||
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);
|
||||
}));
|
||||
});
|
||||
|
||||
this._stream = null;
|
||||
},
|
||||
@ -270,9 +270,9 @@ var VolumeMenu = new Lang.Class({
|
||||
this._control.connect('default-source-changed', Lang.bind(this, this._readInput));
|
||||
|
||||
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.addMenuItem(this._output.item);
|
||||
|
||||
this._input = new InputStreamSlider(this._control);
|
||||
@ -324,7 +324,7 @@ var Indicator = new Lang.Class({
|
||||
|
||||
this._control = getMixerControl();
|
||||
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();
|
||||
|
||||
if (icon != null) {
|
||||
@ -333,7 +333,7 @@ var Indicator = new Lang.Class({
|
||||
} else {
|
||||
this.indicators.hide();
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
||||
this.menu.addMenuItem(this._volumeMenu);
|
||||
|
||||
|
@ -161,12 +161,12 @@ var SwitcherPopup = new Lang.Class({
|
||||
// We delay showing the popup so that fast Alt+Tab users aren't
|
||||
// disturbed by the popup briefly flashing.
|
||||
this._initialDelayTimeoutId = Mainloop.timeout_add(POPUP_DELAY_TIMEOUT,
|
||||
Lang.bind(this, function () {
|
||||
() => {
|
||||
Main.osdWindowManager.hideAll();
|
||||
this.actor.opacity = 255;
|
||||
this._initialDelayTimeoutId = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
GLib.Source.set_name_by_id(this._initialDelayTimeoutId, '[gnome-shell] Main.osdWindow.cancel');
|
||||
return true;
|
||||
},
|
||||
@ -282,11 +282,11 @@ var SwitcherPopup = new Lang.Class({
|
||||
Mainloop.source_remove(this._noModsTimeoutId);
|
||||
|
||||
this._noModsTimeoutId = Mainloop.timeout_add(NO_MODS_TIMEOUT,
|
||||
Lang.bind(this, function () {
|
||||
() => {
|
||||
this._finish(global.get_current_time());
|
||||
this._noModsTimeoutId = 0;
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_popModal() {
|
||||
@ -303,10 +303,9 @@ var SwitcherPopup = new Lang.Class({
|
||||
{ opacity: 0,
|
||||
time: POPUP_FADE_OUT_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this,
|
||||
function() {
|
||||
this.actor.destroy();
|
||||
})
|
||||
onComplete: () => {
|
||||
this.actor.destroy();
|
||||
}
|
||||
});
|
||||
} else
|
||||
this.actor.destroy();
|
||||
@ -346,9 +345,9 @@ var SwitcherList = new Lang.Class({
|
||||
// children to have the same width.
|
||||
this._list = new Shell.GenericContainer({ style_class: 'switcher-list-item-container' });
|
||||
this._list.spacing = 0;
|
||||
this._list.connect('style-changed', Lang.bind(this, function() {
|
||||
this._list.spacing = this._list.get_theme_node().get_length('spacing');
|
||||
}));
|
||||
this._list.connect('style-changed', () => {
|
||||
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-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
|
||||
this._leftArrow = new St.DrawingArea({ style_class: 'switcher-arrow',
|
||||
pseudo_class: 'highlighted' });
|
||||
this._leftArrow.connect('repaint', Lang.bind(this,
|
||||
function() { drawArrow(this._leftArrow, St.Side.LEFT); }));
|
||||
this._leftArrow.connect('repaint', () => {
|
||||
drawArrow(this._leftArrow, St.Side.LEFT);
|
||||
});
|
||||
this._rightArrow = new St.DrawingArea({ style_class: 'switcher-arrow',
|
||||
pseudo_class: 'highlighted' });
|
||||
this._rightArrow.connect('repaint', Lang.bind(this,
|
||||
function() { drawArrow(this._rightArrow, St.Side.RIGHT); }));
|
||||
this._rightArrow.connect('repaint', () => {
|
||||
drawArrow(this._rightArrow, St.Side.RIGHT);
|
||||
});
|
||||
|
||||
this.actor.add_actor(this._leftArrow);
|
||||
this.actor.add_actor(this._rightArrow);
|
||||
@ -422,8 +423,8 @@ var SwitcherList = new Lang.Class({
|
||||
this._list.add_actor(bbox);
|
||||
|
||||
let n = this._items.length;
|
||||
bbox.connect('clicked', Lang.bind(this, function() { this._onItemClicked(n); }));
|
||||
bbox.connect('motion-event', Lang.bind(this, function() { return this._onItemEnter(n); }));
|
||||
bbox.connect('clicked', () => { this._onItemClicked(n); });
|
||||
bbox.connect('motion-event', () => this._onItemEnter(n));
|
||||
|
||||
bbox.label_actor = label;
|
||||
|
||||
@ -494,11 +495,11 @@ var SwitcherList = new Lang.Class({
|
||||
{ value: value,
|
||||
time: POPUP_SCROLL_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this, function () {
|
||||
onComplete: () => {
|
||||
if (this._highlighted == 0)
|
||||
this._scrollableLeft = false;
|
||||
this.actor.queue_relayout();
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@ -518,11 +519,11 @@ var SwitcherList = new Lang.Class({
|
||||
{ value: value,
|
||||
time: POPUP_SCROLL_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this, function () {
|
||||
onComplete: () => {
|
||||
if (this._highlighted == this._items.length - 1)
|
||||
this._scrollableRight = false;
|
||||
this.actor.queue_relayout();
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -49,7 +49,7 @@ function _wrapTweening(target, tweeningParameters) {
|
||||
state.destroyedId = target.connect('destroy', _actorDestroyed);
|
||||
} else if (target.actor && target.actor instanceof Clutter.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 eventScope = oldScope ? oldScope : target;
|
||||
|
||||
params[name] = function () {
|
||||
params[name] = () => {
|
||||
oldHandler.apply(eventScope, oldParams);
|
||||
handler(target);
|
||||
};
|
||||
} else
|
||||
params[name] = function () { handler(target); };
|
||||
params[name] = () => { handler(target); };
|
||||
}
|
||||
|
||||
function _actorDestroyed(target) {
|
||||
@ -178,10 +178,9 @@ var ClutterFrameTicker = new Lang.Class({
|
||||
this._startTime = -1;
|
||||
this._currentTime = -1;
|
||||
|
||||
this._timeline.connect('new-frame', Lang.bind(this,
|
||||
function(timeline, frame) {
|
||||
this._onNewFrame(frame);
|
||||
}));
|
||||
this._timeline.connect('new-frame', (timeline, frame) => {
|
||||
this._onNewFrame(frame);
|
||||
});
|
||||
|
||||
let perf_log = Shell.PerfLog.get_default();
|
||||
perf_log.define_event("tweener.framePrepareStart",
|
||||
|
@ -84,9 +84,9 @@ var ShowOverviewAction = new Lang.Class({
|
||||
this.parent();
|
||||
this.set_n_touch_points(3);
|
||||
|
||||
global.display.connect('grab-op-begin', Lang.bind(this, function() {
|
||||
global.display.connect('grab-op-begin', () => {
|
||||
this.cancel();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
vfunc_gesture_prepare(action, actor) {
|
||||
@ -157,12 +157,12 @@ var ViewSelector = new Lang.Class({
|
||||
this._text = this._entry.clutter_text;
|
||||
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-focus-in', Lang.bind(this, function() {
|
||||
this._text.connect('key-focus-in', () => {
|
||||
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._entry.connect('popup-menu', () => {
|
||||
if (!this._searchActive)
|
||||
return;
|
||||
@ -198,38 +198,35 @@ var ViewSelector = new Lang.Class({
|
||||
// dummy widget as the last results container child so that we can
|
||||
// include the entry in the keynav tab path
|
||||
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._searchResults.actor.add_actor(this._focusTrap);
|
||||
|
||||
global.focus_manager.add_group(this._searchResults.actor);
|
||||
|
||||
this._stageKeyPressId = 0;
|
||||
Main.overview.connect('showing', Lang.bind(this,
|
||||
function () {
|
||||
this._stageKeyPressId = global.stage.connect('key-press-event',
|
||||
Lang.bind(this, this._onStageKeyPress));
|
||||
}));
|
||||
Main.overview.connect('hiding', Lang.bind(this,
|
||||
function () {
|
||||
if (this._stageKeyPressId != 0) {
|
||||
global.stage.disconnect(this._stageKeyPressId);
|
||||
this._stageKeyPressId = 0;
|
||||
}
|
||||
}));
|
||||
Main.overview.connect('shown', Lang.bind(this,
|
||||
function() {
|
||||
// If we were animating from the desktop view to the
|
||||
// apps page the workspace page was visible, allowing
|
||||
// the windows to animate, but now we no longer want to
|
||||
// show it given that we are now on the apps page or
|
||||
// search page.
|
||||
if (this._activePage != this._workspacesPage) {
|
||||
this._workspacesPage.opacity = 0;
|
||||
this._workspacesPage.hide();
|
||||
}
|
||||
}));
|
||||
Main.overview.connect('showing', () => {
|
||||
this._stageKeyPressId = global.stage.connect('key-press-event',
|
||||
Lang.bind(this, this._onStageKeyPress));
|
||||
});
|
||||
Main.overview.connect('hiding', () => {
|
||||
if (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
|
||||
// apps page the workspace page was visible, allowing
|
||||
// the windows to animate, but now we no longer want to
|
||||
// show it given that we are now on the apps page or
|
||||
// search page.
|
||||
if (this._activePage != this._workspacesPage) {
|
||||
this._workspacesPage.opacity = 0;
|
||||
this._workspacesPage.hide();
|
||||
}
|
||||
});
|
||||
|
||||
Main.wm.addKeybinding('toggle-application-view',
|
||||
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
||||
@ -252,12 +249,12 @@ var ViewSelector = new Lang.Class({
|
||||
side = St.Side.LEFT;
|
||||
let gesture = new EdgeDragAction.EdgeDragAction(side,
|
||||
Shell.ActionMode.NORMAL);
|
||||
gesture.connect('activated', Lang.bind(this, function() {
|
||||
gesture.connect('activated', () => {
|
||||
if (Main.overview.visible)
|
||||
Main.overview.hide();
|
||||
else
|
||||
this.showApps();
|
||||
}));
|
||||
});
|
||||
global.stage.add_action(gesture);
|
||||
|
||||
gesture = new ShowOverviewAction();
|
||||
@ -330,10 +327,9 @@ var ViewSelector = new Lang.Class({
|
||||
else
|
||||
Main.ctrlAltTabManager.addGroup(actor, name, a11yIcon,
|
||||
{ proxy: this.actor,
|
||||
focusCallback: Lang.bind(this,
|
||||
function() {
|
||||
this._a11yFocusPage(page);
|
||||
})
|
||||
focusCallback: () => {
|
||||
this._a11yFocusPage(page);
|
||||
}
|
||||
});;
|
||||
page.hide();
|
||||
this.actor.add_actor(page);
|
||||
@ -354,9 +350,9 @@ var ViewSelector = new Lang.Class({
|
||||
{ opacity: 0,
|
||||
time: OverviewControls.SIDE_CONTROLS_ANIMATION_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this, function() {
|
||||
onComplete: () => {
|
||||
this._animateIn(oldPage);
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@ -382,10 +378,9 @@ var ViewSelector = new Lang.Class({
|
||||
if (page == this._appsPage &&
|
||||
this._activePage == this._workspacesPage &&
|
||||
!Main.overview.animationInProgress) {
|
||||
this.appDisplay.animate(IconGrid.AnimationDirection.OUT, Lang.bind(this,
|
||||
function() {
|
||||
this._animateIn(oldPage)
|
||||
}));
|
||||
this.appDisplay.animate(IconGrid.AnimationDirection.OUT, () => {
|
||||
this._animateIn(oldPage)
|
||||
});
|
||||
} else {
|
||||
this._fadePageOut(page);
|
||||
}
|
||||
|
@ -40,17 +40,17 @@ var WindowAttentionHandler = new Lang.Class({
|
||||
let [title, banner] = this._getTitleAndBanner(app, window);
|
||||
|
||||
let notification = new MessageTray.Notification(source, title, banner);
|
||||
notification.connect('activated', function() {
|
||||
notification.connect('activated', () => {
|
||||
source.open();
|
||||
});
|
||||
notification.setForFeedback(true);
|
||||
|
||||
source.notify(notification);
|
||||
|
||||
source.signalIDs.push(window.connect('notify::title', Lang.bind(this, function() {
|
||||
source.signalIDs.push(window.connect('notify::title', () => {
|
||||
let [title, banner] = this._getTitleAndBanner(app, window);
|
||||
notification.update(title, banner);
|
||||
})));
|
||||
}));
|
||||
}
|
||||
});
|
||||
|
||||
@ -65,9 +65,12 @@ var Source = new Lang.Class({
|
||||
this.parent(app.get_name());
|
||||
|
||||
this.signalIDs = [];
|
||||
this.signalIDs.push(this._window.connect('notify::demands-attention', Lang.bind(this, function() { this.destroy(); })));
|
||||
this.signalIDs.push(this._window.connect('focus', Lang.bind(this, function() { this.destroy(); })));
|
||||
this.signalIDs.push(this._window.connect('unmanaged', Lang.bind(this, function() { this.destroy(); })));
|
||||
this.signalIDs.push(this._window.connect('notify::demands-attention',
|
||||
() => { this.destroy(); }));
|
||||
this.signalIDs.push(this._window.connect('focus',
|
||||
() => { this.destroy(); }));
|
||||
this.signalIDs.push(this._window.connect('unmanaged',
|
||||
() => { this.destroy(); }));
|
||||
|
||||
this.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||
},
|
||||
|
@ -296,24 +296,24 @@ var WorkspaceTracker = new Lang.Class({
|
||||
if (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;
|
||||
this._queueCheckWorkspaces();
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
GLib.Source.set_name_by_id(workspace._keepAliveId, '[gnome-shell] this._queueCheckWorkspaces');
|
||||
},
|
||||
|
||||
_windowRemoved(workspace, window) {
|
||||
workspace._lastRemovedWindow = window;
|
||||
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) {
|
||||
workspace._lastRemovedWindow = null;
|
||||
this._queueCheckWorkspaces();
|
||||
}
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
});
|
||||
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);
|
||||
lostWorkspaces.forEach(function(workspace) {
|
||||
lostWorkspaces.forEach(workspace => {
|
||||
workspace.disconnect(workspace._windowAddedId);
|
||||
workspace.disconnect(workspace._windowRemovedId);
|
||||
});
|
||||
@ -545,9 +545,9 @@ var WorkspaceSwitchAction = new Lang.Class({
|
||||
this.set_n_touch_points(4);
|
||||
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();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
vfunc_gesture_prepare(actor) {
|
||||
@ -584,9 +584,9 @@ var AppSwitchAction = new Lang.Class({
|
||||
this.parent();
|
||||
this.set_n_touch_points(3);
|
||||
|
||||
global.display.connect('grab-op-begin', Lang.bind(this, function() {
|
||||
global.display.connect('grab-op-begin', () => {
|
||||
this.cancel();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
vfunc_gesture_prepare(action, actor) {
|
||||
@ -693,12 +693,12 @@ var WindowManager = new Lang.Class({
|
||||
|
||||
this._switchData = null;
|
||||
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._mapWindowDone(shellwm, actor);
|
||||
this._destroyWindowDone(shellwm, actor);
|
||||
this._sizeChangeWindowDone(shellwm, actor);
|
||||
}));
|
||||
});
|
||||
|
||||
this._shellwm.connect('switch-workspace', Lang.bind(this, this._switchWorkspace));
|
||||
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-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);
|
||||
Main.osdWindowManager.show(monitorIndex, icon, label, null);
|
||||
}));
|
||||
});
|
||||
|
||||
this._gsdWacomProxy = new GsdWacomProxy(Gio.DBus.session, GSD_WACOM_BUS_NAME,
|
||||
GSD_WACOM_OBJECT_PATH,
|
||||
Lang.bind(this, function(proxy, error) {
|
||||
(proxy, error) => {
|
||||
if (error) {
|
||||
log(error.message);
|
||||
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 = [];
|
||||
|
||||
//FIXME: Fix num buttons
|
||||
@ -954,16 +954,16 @@ var WindowManager = new Lang.Class({
|
||||
this._gsdWacomProxy.SetOLEDLabelsRemote(pad.get_device_node(), labels);
|
||||
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++)
|
||||
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++)
|
||||
this._dimWindow(this._dimmedWindows[i]);
|
||||
}));
|
||||
});
|
||||
|
||||
this._windowMenuManager = new WindowMenu.WindowMenuManager();
|
||||
|
||||
@ -987,15 +987,15 @@ var WindowManager = new Lang.Class({
|
||||
|
||||
let mode = Shell.ActionMode.ALL & ~Shell.ActionMode.LOCK_SCREEN;
|
||||
gesture = new EdgeDragAction.EdgeDragAction(St.Side.BOTTOM, mode);
|
||||
gesture.connect('activated', Lang.bind(this, function() {
|
||||
gesture.connect('activated', () => {
|
||||
Main.keyboard.show(Main.layoutManager.bottomIndex);
|
||||
}));
|
||||
});
|
||||
global.stage.add_action(gesture);
|
||||
},
|
||||
|
||||
_showPadOsd(display, 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;
|
||||
},
|
||||
@ -1015,11 +1015,11 @@ var WindowManager = new Lang.Class({
|
||||
},
|
||||
|
||||
_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;
|
||||
return (!win.is_override_redirect() &&
|
||||
win.located_on_workspace(global.screen.get_active_workspace()));
|
||||
}));
|
||||
});
|
||||
|
||||
if (windows.length == 0)
|
||||
return;
|
||||
@ -1047,14 +1047,12 @@ var WindowManager = new Lang.Class({
|
||||
|
||||
global.screen.append_new_workspace(false, global.get_current_time());
|
||||
|
||||
let windows = global.get_window_actors().map(function(winActor) {
|
||||
return winActor.meta_window;
|
||||
});
|
||||
let windows = global.get_window_actors().map(a => a.meta_window);
|
||||
|
||||
// To create a new workspace, we slide all the windows on workspaces
|
||||
// below us to the next workspace, leaving a blank workspace for us
|
||||
// to recycle.
|
||||
windows.forEach(function(window) {
|
||||
windows.forEach(window => {
|
||||
// If the window is attached to an ancestor, we don't need/want
|
||||
// to move it
|
||||
if (window.get_transient_for() != null)
|
||||
@ -1406,7 +1404,7 @@ var WindowManager = new Lang.Class({
|
||||
|
||||
_hasAttachedDialogs(window, ignoreWindow) {
|
||||
var count = 0;
|
||||
window.foreach_transient(function(win) {
|
||||
window.foreach_transient(win => {
|
||||
if (win != ignoreWindow &&
|
||||
win.is_attached_dialog() &&
|
||||
win.get_transient_for() == window) {
|
||||
@ -1427,9 +1425,8 @@ var WindowManager = new Lang.Class({
|
||||
this._dimWindow(window);
|
||||
} else if (!shouldDim && window._dimmed) {
|
||||
window._dimmed = false;
|
||||
this._dimmedWindows = this._dimmedWindows.filter(function(win) {
|
||||
return win != window;
|
||||
});
|
||||
this._dimmedWindows =
|
||||
this._dimmedWindows.filter(win => win != window);
|
||||
this._undimWindow(window);
|
||||
}
|
||||
},
|
||||
@ -1469,24 +1466,25 @@ var WindowManager = new Lang.Class({
|
||||
|
||||
_mapWindow(shellwm, actor) {
|
||||
actor._windowType = actor.meta_window.get_window_type();
|
||||
actor._notifyWindowTypeSignalId = actor.meta_window.connect('notify::window-type', Lang.bind(this, function () {
|
||||
let type = actor.meta_window.get_window_type();
|
||||
if (type == actor._windowType)
|
||||
return;
|
||||
if (type == Meta.WindowType.MODAL_DIALOG ||
|
||||
actor._windowType == Meta.WindowType.MODAL_DIALOG) {
|
||||
let parent = actor.get_meta_window().get_transient_for();
|
||||
if (parent)
|
||||
this._checkDimming(parent);
|
||||
}
|
||||
actor._notifyWindowTypeSignalId =
|
||||
actor.meta_window.connect('notify::window-type', () => {
|
||||
let type = actor.meta_window.get_window_type();
|
||||
if (type == actor._windowType)
|
||||
return;
|
||||
if (type == Meta.WindowType.MODAL_DIALOG ||
|
||||
actor._windowType == Meta.WindowType.MODAL_DIALOG) {
|
||||
let parent = actor.get_meta_window().get_transient_for();
|
||||
if (parent)
|
||||
this._checkDimming(parent);
|
||||
}
|
||||
|
||||
actor._windowType = type;
|
||||
}));
|
||||
actor.meta_window.connect('unmanaged', Lang.bind(this, function(window) {
|
||||
let parent = window.get_transient_for();
|
||||
if (parent)
|
||||
this._checkDimming(parent);
|
||||
}));
|
||||
actor._windowType = type;
|
||||
});
|
||||
actor.meta_window.connect('unmanaged', window => {
|
||||
let parent = window.get_transient_for();
|
||||
if (parent)
|
||||
this._checkDimming(parent);
|
||||
});
|
||||
|
||||
if (actor.meta_window.is_attached_dialog())
|
||||
this._checkDimming(actor.get_meta_window().get_transient_for());
|
||||
@ -1576,9 +1574,8 @@ var WindowManager = new Lang.Class({
|
||||
actor._notifyWindowTypeSignalId = 0;
|
||||
}
|
||||
if (window._dimmed) {
|
||||
this._dimmedWindows = this._dimmedWindows.filter(function(win) {
|
||||
return win != window;
|
||||
});
|
||||
this._dimmedWindows =
|
||||
this._dimmedWindows.filter(win => win != window);
|
||||
}
|
||||
|
||||
if (window.is_attached_dialog())
|
||||
@ -1618,10 +1615,10 @@ var WindowManager = new Lang.Class({
|
||||
|
||||
if (window.is_attached_dialog()) {
|
||||
let parent = window.get_transient_for();
|
||||
actor._parentDestroyId = parent.connect('unmanaged', Lang.bind(this, function () {
|
||||
actor._parentDestroyId = parent.connect('unmanaged', () => {
|
||||
Tweener.removeTweens(actor);
|
||||
this._destroyWindowDone(shellwm, actor);
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
Tweener.addTween(actor,
|
||||
@ -1940,11 +1937,11 @@ var WindowManager = new Lang.Class({
|
||||
if (this._workspaceSwitcherPopup == null) {
|
||||
this._workspaceTracker.blockUpdates();
|
||||
this._workspaceSwitcherPopup = new WorkspaceSwitcherPopup.WorkspaceSwitcherPopup();
|
||||
this._workspaceSwitcherPopup.connect('destroy', Lang.bind(this, function() {
|
||||
this._workspaceSwitcherPopup.connect('destroy', () => {
|
||||
this._workspaceTracker.unblockUpdates();
|
||||
this._workspaceSwitcherPopup = null;
|
||||
this._isWorkspacePrepended = false;
|
||||
}));
|
||||
});
|
||||
}
|
||||
this._workspaceSwitcherPopup.display(direction, newWs.index());
|
||||
}
|
||||
|
@ -31,48 +31,48 @@ var WindowMenu = new Lang.Class({
|
||||
|
||||
let item;
|
||||
|
||||
item = this.addAction(_("Minimize"), Lang.bind(this, function(event) {
|
||||
item = this.addAction(_("Minimize"), () => {
|
||||
window.minimize();
|
||||
}));
|
||||
});
|
||||
if (!window.can_minimize())
|
||||
item.setSensitive(false);
|
||||
|
||||
if (window.get_maximized()) {
|
||||
item = this.addAction(_("Unmaximize"), Lang.bind(this, function() {
|
||||
item = this.addAction(_("Unmaximize"), () => {
|
||||
window.unmaximize(Meta.MaximizeFlags.BOTH);
|
||||
}));
|
||||
});
|
||||
} else {
|
||||
item = this.addAction(_("Maximize"), Lang.bind(this, function() {
|
||||
item = this.addAction(_("Maximize"), () => {
|
||||
window.maximize(Meta.MaximizeFlags.BOTH);
|
||||
}));
|
||||
});
|
||||
}
|
||||
if (!window.can_maximize())
|
||||
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());
|
||||
}));
|
||||
});
|
||||
if (!window.allows_move())
|
||||
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());
|
||||
}));
|
||||
});
|
||||
if (!window.allows_resize())
|
||||
item.setSensitive(false);
|
||||
|
||||
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();
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
item = this.addAction(_("Always on Top"), Lang.bind(this, function() {
|
||||
item = this.addAction(_("Always on Top"), () => {
|
||||
if (window.is_above())
|
||||
window.unmake_above();
|
||||
else
|
||||
window.make_above();
|
||||
}));
|
||||
});
|
||||
if (window.is_above())
|
||||
item.setOrnament(PopupMenu.Ornament.CHECK);
|
||||
if (window.get_maximized() == Meta.MaximizeFlags.BOTH ||
|
||||
@ -86,12 +86,12 @@ var WindowMenu = new Lang.Class({
|
||||
window.is_on_primary_monitor())) {
|
||||
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)
|
||||
window.unstick();
|
||||
else
|
||||
window.stick();
|
||||
}));
|
||||
});
|
||||
if (isSticky)
|
||||
item.setOrnament(PopupMenu.Ornament.CHECK);
|
||||
if (window.is_always_on_all_workspaces())
|
||||
@ -100,24 +100,28 @@ var WindowMenu = new Lang.Class({
|
||||
if (!isSticky) {
|
||||
let workspace = window.get_workspace();
|
||||
if (workspace != workspace.get_neighbor(Meta.MotionDirection.LEFT)) {
|
||||
this.addAction(_("Move to Workspace Left"), Lang.bind(this, function(event) {
|
||||
window.change_workspace(workspace.get_neighbor(Meta.MotionDirection.LEFT));
|
||||
}));
|
||||
this.addAction(_("Move to Workspace Left"), () => {
|
||||
let dir = Meta.MotionDirection.LEFT;
|
||||
window.change_workspace(workspace.get_neighbor(dir));
|
||||
});
|
||||
}
|
||||
if (workspace != workspace.get_neighbor(Meta.MotionDirection.RIGHT)) {
|
||||
this.addAction(_("Move to Workspace Right"), Lang.bind(this, function(event) {
|
||||
window.change_workspace(workspace.get_neighbor(Meta.MotionDirection.RIGHT));
|
||||
}));
|
||||
this.addAction(_("Move to Workspace Right"), () => {
|
||||
let dir = Meta.MotionDirection.RIGHT;
|
||||
window.change_workspace(workspace.get_neighbor(dir));
|
||||
});
|
||||
}
|
||||
if (workspace != workspace.get_neighbor(Meta.MotionDirection.UP)) {
|
||||
this.addAction(_("Move to Workspace Up"), Lang.bind(this, function(event) {
|
||||
window.change_workspace(workspace.get_neighbor(Meta.MotionDirection.UP));
|
||||
}));
|
||||
this.addAction(_("Move to Workspace Up"), () => {
|
||||
let dir = Meta.MotionDirection.UP;
|
||||
window.change_workspace(workspace.get_neighbor(dir));
|
||||
});
|
||||
}
|
||||
if (workspace != workspace.get_neighbor(Meta.MotionDirection.DOWN)) {
|
||||
this.addAction(_("Move to Workspace Down"), Lang.bind(this, function(event) {
|
||||
window.change_workspace(workspace.get_neighbor(Meta.MotionDirection.DOWN));
|
||||
}));
|
||||
this.addAction(_("Move to Workspace 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 nMonitors = screen.get_n_monitors();
|
||||
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);
|
||||
if (upMonitorIndex != -1) {
|
||||
this.addAction(_("Move to Monitor Up"), Lang.bind(this, function(event) {
|
||||
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);
|
||||
}));
|
||||
}
|
||||
let leftMonitorIndex = screen.get_monitor_neighbor_index(monitorIndex, Meta.ScreenDirection.LEFT);
|
||||
if (leftMonitorIndex != -1) {
|
||||
this.addAction(_("Move to Monitor Left"), Lang.bind(this, function(event) {
|
||||
window.move_to_monitor(leftMonitorIndex);
|
||||
}));
|
||||
}
|
||||
let rightMonitorIndex = screen.get_monitor_neighbor_index(monitorIndex, Meta.ScreenDirection.RIGHT);
|
||||
if (rightMonitorIndex != -1) {
|
||||
this.addAction(_("Move to Monitor Right"), Lang.bind(this, function(event) {
|
||||
window.move_to_monitor(rightMonitorIndex);
|
||||
}));
|
||||
}
|
||||
let dir = Meta.ScreenDirection.UP;
|
||||
let upMonitorIndex =
|
||||
screen.get_monitor_neighbor_index(monitorIndex, dir);
|
||||
if (upMonitorIndex != -1) {
|
||||
this.addAction(_("Move to Monitor Up"), () => {
|
||||
window.move_to_monitor(upMonitorIndex);
|
||||
});
|
||||
}
|
||||
|
||||
dir = Meta.ScreenDirection.DOWN;
|
||||
let downMonitorIndex =
|
||||
screen.get_monitor_neighbor_index(monitorIndex, dir);
|
||||
if (downMonitorIndex != -1) {
|
||||
this.addAction(_("Move to Monitor Down"), () => {
|
||||
window.move_to_monitor(downMonitorIndex);
|
||||
});
|
||||
}
|
||||
|
||||
dir = Meta.ScreenDirection.LEFT;
|
||||
let leftMonitorIndex =
|
||||
screen.get_monitor_neighbor_index(monitorIndex, dir);
|
||||
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());
|
||||
|
||||
item = this.addAction(_("Close"), Lang.bind(this, function(event) {
|
||||
item = this.addAction(_("Close"), event => {
|
||||
window.delete(event.get_time());
|
||||
}));
|
||||
});
|
||||
if (!window.can_close())
|
||||
item.setSensitive(false);
|
||||
}
|
||||
@ -191,10 +206,9 @@ var WindowMenuManager = new Lang.Class({
|
||||
this._manager = new PopupMenu.PopupMenuManager({ actor: Main.layoutManager.dummyCursor });
|
||||
|
||||
this._sourceActor = new St.Widget({ reactive: true, visible: false });
|
||||
this._sourceActor.connect('button-press-event', Lang.bind(this,
|
||||
function() {
|
||||
this._manager.activeMenu.toggle();
|
||||
}));
|
||||
this._sourceActor.connect('button-press-event', () => {
|
||||
this._manager.activeMenu.toggle();
|
||||
});
|
||||
Main.uiGroup.add_actor(this._sourceActor);
|
||||
},
|
||||
|
||||
@ -204,13 +218,12 @@ var WindowMenuManager = new Lang.Class({
|
||||
|
||||
this._manager.addMenu(menu);
|
||||
|
||||
menu.connect('activate', function() {
|
||||
menu.connect('activate', () => {
|
||||
window.check_alive(global.get_current_time());
|
||||
});
|
||||
let destroyId = window.connect('unmanaged',
|
||||
function() {
|
||||
menu.close();
|
||||
});
|
||||
let destroyId = window.connect('unmanaged', () => {
|
||||
menu.close();
|
||||
});
|
||||
|
||||
this._sourceActor.set_size(Math.max(1, rect.width), Math.max(1, rect.height));
|
||||
this._sourceActor.set_position(rect.x, rect.y);
|
||||
@ -218,13 +231,13 @@ var WindowMenuManager = new Lang.Class({
|
||||
|
||||
menu.open(BoxPointer.PopupAnimation.NONE);
|
||||
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)
|
||||
return;
|
||||
|
||||
this._sourceActor.hide();
|
||||
menu.destroy();
|
||||
window.disconnect(destroyId);
|
||||
}));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -89,7 +89,7 @@ var WindowCloneLayout = new Lang.Class({
|
||||
},
|
||||
|
||||
vfunc_allocate(container, box, flags) {
|
||||
container.get_children().forEach(Lang.bind(this, function (child) {
|
||||
container.get_children().forEach(child => {
|
||||
let realWindow;
|
||||
if (child == container._delegate._windowClone)
|
||||
realWindow = container._delegate.realWindow;
|
||||
@ -98,7 +98,7 @@ var WindowCloneLayout = new Lang.Class({
|
||||
|
||||
child.allocate(this._makeBoxForWindow(realWindow.meta_window),
|
||||
flags);
|
||||
}));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@ -139,12 +139,14 @@ var WindowClone = new Lang.Class({
|
||||
|
||||
this._windowClone._updateId = this.metaWindow.connect('size-changed',
|
||||
Lang.bind(this, this._onRealWindowSizeChanged));
|
||||
this._windowClone._destroyId = this.realWindow.connect('destroy', Lang.bind(this, function() {
|
||||
// First destroy the clone and then destroy everything
|
||||
// This will ensure that we never see it in the _disconnectSignals loop
|
||||
this._windowClone.destroy();
|
||||
this.destroy();
|
||||
}));
|
||||
this._windowClone._destroyId =
|
||||
this.realWindow.connect('destroy', () => {
|
||||
// First destroy the clone and then destroy everything
|
||||
// This will ensure that we never see it in the
|
||||
// _disconnectSignals loop
|
||||
this._windowClone.destroy();
|
||||
this.destroy();
|
||||
});
|
||||
|
||||
this._updateAttachedDialogs();
|
||||
this._computeBoundingBox();
|
||||
@ -214,21 +216,21 @@ var WindowClone = new Lang.Class({
|
||||
|
||||
_doAddAttachedDialog(metaWin, 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.emit('size-changed');
|
||||
}));
|
||||
clone._destroyId = realWin.connect('destroy', Lang.bind(this, function() {
|
||||
});
|
||||
clone._destroyId = realWin.connect('destroy', () => {
|
||||
clone.destroy();
|
||||
|
||||
this._computeBoundingBox();
|
||||
this.emit('size-changed');
|
||||
}));
|
||||
});
|
||||
this.actor.add_child(clone);
|
||||
},
|
||||
|
||||
_updateAttachedDialogs() {
|
||||
let iter = Lang.bind(this, function(win) {
|
||||
let iter = win => {
|
||||
let actor = win.get_compositor_private();
|
||||
|
||||
if (!actor)
|
||||
@ -239,7 +241,7 @@ var WindowClone = new Lang.Class({
|
||||
this._doAddAttachedDialog(win, actor);
|
||||
win.foreach_transient(iter);
|
||||
return true;
|
||||
});
|
||||
};
|
||||
this.metaWindow.foreach_transient(iter);
|
||||
},
|
||||
|
||||
@ -262,7 +264,7 @@ var WindowClone = new Lang.Class({
|
||||
_computeBoundingBox() {
|
||||
let rect = this.metaWindow.get_frame_rect();
|
||||
|
||||
this.actor.get_children().forEach(function (child) {
|
||||
this.actor.get_children().forEach(child => {
|
||||
let realWindow;
|
||||
if (child == this._windowClone)
|
||||
realWindow = this.realWindow;
|
||||
@ -271,7 +273,7 @@ var WindowClone = new Lang.Class({
|
||||
|
||||
let metaWindow = realWindow.meta_window;
|
||||
rect = rect.union(metaWindow.get_frame_rect());
|
||||
}, this);
|
||||
});
|
||||
|
||||
// Convert from a MetaRectangle to a native JS object
|
||||
this._boundingBox = { x: rect.x, y: rect.y, width: rect.width, height: rect.height };
|
||||
@ -312,7 +314,7 @@ var WindowClone = new Lang.Class({
|
||||
},
|
||||
|
||||
_disconnectSignals() {
|
||||
this.actor.get_children().forEach(Lang.bind(this, function (child) {
|
||||
this.actor.get_children().forEach(child => {
|
||||
let realWindow;
|
||||
if (child == this._windowClone)
|
||||
realWindow = this.realWindow;
|
||||
@ -321,7 +323,7 @@ var WindowClone = new Lang.Class({
|
||||
|
||||
realWindow.meta_window.disconnect(child._updateId);
|
||||
realWindow.disconnect(child._destroyId);
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_onRealWindowSizeChanged() {
|
||||
@ -373,14 +375,13 @@ var WindowClone = new Lang.Class({
|
||||
|
||||
// A click cancels a long-press before any click handler is
|
||||
// run - make sure to not start a drag in that case
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this,
|
||||
function() {
|
||||
if (this._selected)
|
||||
return;
|
||||
let [x, y] = action.get_coords();
|
||||
action.release();
|
||||
this._draggable.startDrag(x, y, global.get_current_time(), this._dragTouchSequence);
|
||||
}));
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||
if (this._selected)
|
||||
return;
|
||||
let [x, y] = action.get_coords();
|
||||
action.release();
|
||||
this._draggable.startDrag(x, y, global.get_current_time(), this._dragTouchSequence);
|
||||
});
|
||||
} else {
|
||||
this.emit('show-chrome');
|
||||
}
|
||||
@ -450,11 +451,10 @@ var WindowOverlay = new Lang.Class({
|
||||
title.clutter_text.ellipsize = Pango.EllipsizeMode.END;
|
||||
windowClone.actor.label_actor = title;
|
||||
|
||||
this._updateCaptionId = metaWindow.connect('notify::title',
|
||||
Lang.bind(this, function(w) {
|
||||
this.title.text = w.title;
|
||||
this.relayout(false);
|
||||
}));
|
||||
this._updateCaptionId = metaWindow.connect('notify::title', w => {
|
||||
this.title.text = w.title;
|
||||
this.relayout(false);
|
||||
});
|
||||
|
||||
let button = new St.Button({ style_class: 'window-close' });
|
||||
button._overlap = 0;
|
||||
@ -603,11 +603,10 @@ var WindowOverlay = new Lang.Class({
|
||||
|
||||
// use an idle handler to avoid mapping problems -
|
||||
// see comment in Workspace._windowAdded
|
||||
let id = Mainloop.idle_add(Lang.bind(this,
|
||||
function() {
|
||||
this._windowClone.emit('selected');
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
let id = Mainloop.idle_add(() => {
|
||||
this._windowClone.emit('selected');
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
GLib.Source.set_name_by_id(id, '[gnome-shell] this._windowClone.emit');
|
||||
}
|
||||
},
|
||||
@ -990,9 +989,7 @@ var UnalignedLayoutStrategy = new Lang.Class({
|
||||
|
||||
_sortRow(row) {
|
||||
// Sort windows horizontally to minimize travel distance
|
||||
row.windows.sort(function(a, b) {
|
||||
return a.realWindow.x - b.realWindow.x;
|
||||
});
|
||||
row.windows.sort((a, b) => a.realWindow.x - b.realWindow.x);
|
||||
},
|
||||
|
||||
computeLayout(windows, layout) {
|
||||
@ -1161,10 +1158,10 @@ var Workspace = new Lang.Class({
|
||||
this._positionWindowsFlags = 0;
|
||||
this._positionWindowsId = 0;
|
||||
|
||||
this.actor.connect('notify::mapped', Lang.bind(this, function() {
|
||||
this.actor.connect('notify::mapped', () => {
|
||||
if (this.actor.mapped)
|
||||
this._syncActualGeometry();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
setFullGeometry(geom) {
|
||||
@ -1194,7 +1191,7 @@ var Workspace = new Lang.Class({
|
||||
if (!this._actualGeometry)
|
||||
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;
|
||||
if (!this.actor.mapped)
|
||||
return false;
|
||||
@ -1206,7 +1203,7 @@ var Workspace = new Lang.Class({
|
||||
this._updateWindowPositions(Main.overview.animationInProgress ? WindowPositionFlags.ANIMATE : WindowPositionFlags.NONE);
|
||||
|
||||
return false;
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_lookupIndex(metaWindow) {
|
||||
@ -1247,12 +1244,12 @@ var Workspace = new Lang.Class({
|
||||
if (this._positionWindowsId > 0)
|
||||
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._positionWindowsFlags = 0;
|
||||
this._positionWindowsId = 0;
|
||||
return false;
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_realRecalculateWindowPositions(flags) {
|
||||
@ -1265,7 +1262,7 @@ var Workspace = new Lang.Class({
|
||||
if (clones.length == 0)
|
||||
return;
|
||||
|
||||
clones.sort(function(a, b) {
|
||||
clones.sort((a, b) => {
|
||||
return a.metaWindow.get_stable_sequence() - b.metaWindow.get_stable_sequence();
|
||||
});
|
||||
|
||||
@ -1366,7 +1363,11 @@ var Workspace = new Lang.Class({
|
||||
|
||||
syncStacking(stackIndices) {
|
||||
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++) {
|
||||
let clone = clones[i];
|
||||
@ -1388,9 +1389,9 @@ var Workspace = new Lang.Class({
|
||||
scale_y: scale,
|
||||
time: Overview.ANIMATION_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this, function() {
|
||||
onComplete: () => {
|
||||
this._showWindowOverlay(clone, overlay);
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
clone.overlay.relayout(true);
|
||||
@ -1492,14 +1493,13 @@ var Workspace = new Lang.Class({
|
||||
if (!win) {
|
||||
// Newly-created windows are added to a workspace before
|
||||
// the compositor finds out about them...
|
||||
let id = Mainloop.idle_add(Lang.bind(this,
|
||||
function () {
|
||||
if (this.actor &&
|
||||
metaWin.get_compositor_private() &&
|
||||
metaWin.get_workspace() == this.metaWorkspace)
|
||||
this._doAddWindow(metaWin);
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
let id = Mainloop.idle_add(() => {
|
||||
if (this.actor &&
|
||||
metaWin.get_compositor_private() &&
|
||||
metaWin.get_workspace() == this.metaWorkspace)
|
||||
this._doAddWindow(metaWin);
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
GLib.Source.set_name_by_id(id, '[gnome-shell] this._doAddWindow');
|
||||
return;
|
||||
}
|
||||
@ -1839,24 +1839,20 @@ var Workspace = new Lang.Class({
|
||||
|
||||
clone.connect('selected',
|
||||
Lang.bind(this, this._onCloneSelected));
|
||||
clone.connect('drag-begin',
|
||||
Lang.bind(this, function() {
|
||||
Main.overview.beginWindowDrag(clone.metaWindow);
|
||||
overlay.hide();
|
||||
}));
|
||||
clone.connect('drag-cancelled',
|
||||
Lang.bind(this, function() {
|
||||
Main.overview.cancelledWindowDrag(clone.metaWindow);
|
||||
}));
|
||||
clone.connect('drag-end',
|
||||
Lang.bind(this, function() {
|
||||
Main.overview.endWindowDrag(clone.metaWindow);
|
||||
overlay.show();
|
||||
}));
|
||||
clone.connect('size-changed',
|
||||
Lang.bind(this, function() {
|
||||
this._recalculateWindowPositions(WindowPositionFlags.NONE);
|
||||
}));
|
||||
clone.connect('drag-begin', () => {
|
||||
Main.overview.beginWindowDrag(clone.metaWindow);
|
||||
overlay.hide();
|
||||
});
|
||||
clone.connect('drag-cancelled', () => {
|
||||
Main.overview.cancelledWindowDrag(clone.metaWindow);
|
||||
});
|
||||
clone.connect('drag-end', () => {
|
||||
Main.overview.endWindowDrag(clone.metaWindow);
|
||||
overlay.show();
|
||||
});
|
||||
clone.connect('size-changed', () => {
|
||||
this._recalculateWindowPositions(WindowPositionFlags.NONE);
|
||||
});
|
||||
|
||||
this.actor.add_actor(clone.actor);
|
||||
|
||||
|
@ -32,9 +32,9 @@ var WorkspaceSwitcherPopup = new Lang.Class({
|
||||
this._childHeight = 0;
|
||||
this._childWidth = 0;
|
||||
this._timeoutId = 0;
|
||||
this._list.connect('style-changed', Lang.bind(this, function() {
|
||||
this._itemSpacing = this._list.get_theme_node().get_length('spacing');
|
||||
}));
|
||||
this._list.connect('style-changed', () => {
|
||||
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-height', Lang.bind(this, this._getPreferredHeight));
|
||||
|
@ -70,12 +70,12 @@ var WindowClone = new Lang.Class({
|
||||
|
||||
this.clone._updateId = this.metaWindow.connect('position-changed',
|
||||
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
|
||||
// This will ensure that we never see it in the _disconnectSignals loop
|
||||
this.clone.destroy();
|
||||
this.destroy();
|
||||
}));
|
||||
});
|
||||
this._onPositionChanged();
|
||||
|
||||
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.inDrag = false;
|
||||
|
||||
let iter = Lang.bind(this, function(win) {
|
||||
let iter = win => {
|
||||
let actor = win.get_compositor_private();
|
||||
|
||||
if (!actor)
|
||||
@ -106,7 +106,7 @@ var WindowClone = new Lang.Class({
|
||||
win.foreach_transient(iter);
|
||||
|
||||
return true;
|
||||
});
|
||||
};
|
||||
this.metaWindow.foreach_transient(iter);
|
||||
},
|
||||
|
||||
@ -155,9 +155,9 @@ var WindowClone = new Lang.Class({
|
||||
|
||||
clone._updateId = metaDialog.connect('position-changed',
|
||||
Lang.bind(this, this._updateDialogPosition, clone));
|
||||
clone._destroyId = realDialog.connect('destroy', Lang.bind(this, function() {
|
||||
clone._destroyId = realDialog.connect('destroy', () => {
|
||||
clone.destroy();
|
||||
}));
|
||||
});
|
||||
this.actor.add_child(clone);
|
||||
},
|
||||
|
||||
@ -175,7 +175,7 @@ var WindowClone = new Lang.Class({
|
||||
},
|
||||
|
||||
_disconnectSignals() {
|
||||
this.actor.get_children().forEach(function(child) {
|
||||
this.actor.get_children().forEach(child => {
|
||||
let realWindow = child.source;
|
||||
|
||||
realWindow.meta_window.disconnect(child._updateId);
|
||||
@ -277,10 +277,10 @@ var WorkspaceThumbnail = new Lang.Class({
|
||||
let monitor = Main.layoutManager.primaryMonitor;
|
||||
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;
|
||||
return win.located_on_workspace(metaWorkspace);
|
||||
}));
|
||||
});
|
||||
|
||||
// Create clones for windows that should be visible in the Overview
|
||||
this._windows = [];
|
||||
@ -337,7 +337,11 @@ var WorkspaceThumbnail = new Lang.Class({
|
||||
},
|
||||
|
||||
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++) {
|
||||
let clone = this._windows[i];
|
||||
@ -393,14 +397,13 @@ var WorkspaceThumbnail = new Lang.Class({
|
||||
if (!win) {
|
||||
// Newly-created windows are added to a workspace before
|
||||
// the compositor finds out about them...
|
||||
let id = Mainloop.idle_add(Lang.bind(this,
|
||||
function () {
|
||||
if (!this._removed &&
|
||||
metaWin.get_compositor_private() &&
|
||||
metaWin.get_workspace() == this.metaWorkspace)
|
||||
this._doAddWindow(metaWin);
|
||||
return GLib.SOURCE_REMOVE;
|
||||
}));
|
||||
let id = Mainloop.idle_add(() => {
|
||||
if (!this._removed &&
|
||||
metaWin.get_compositor_private() &&
|
||||
metaWin.get_workspace() == this.metaWorkspace)
|
||||
this._doAddWindow(metaWin);
|
||||
return GLib.SOURCE_REMOVE;
|
||||
});
|
||||
GLib.Source.set_name_by_id(id, '[gnome-shell] this._doAddWindow');
|
||||
return;
|
||||
}
|
||||
@ -523,22 +526,18 @@ var WorkspaceThumbnail = new Lang.Class({
|
||||
_addWindowClone(win) {
|
||||
let clone = new WindowClone(win);
|
||||
|
||||
clone.connect('selected',
|
||||
Lang.bind(this, function(clone, time) {
|
||||
this.activate(time);
|
||||
}));
|
||||
clone.connect('drag-begin',
|
||||
Lang.bind(this, function() {
|
||||
Main.overview.beginWindowDrag(clone.metaWindow);
|
||||
}));
|
||||
clone.connect('drag-cancelled',
|
||||
Lang.bind(this, function() {
|
||||
Main.overview.cancelledWindowDrag(clone.metaWindow);
|
||||
}));
|
||||
clone.connect('drag-end',
|
||||
Lang.bind(this, function() {
|
||||
Main.overview.endWindowDrag(clone.metaWindow);
|
||||
}));
|
||||
clone.connect('selected', (clone, time) => {
|
||||
this.activate(time);
|
||||
});
|
||||
clone.connect('drag-begin', () => {
|
||||
Main.overview.beginWindowDrag(clone.metaWindow);
|
||||
});
|
||||
clone.connect('drag-cancelled', () => {
|
||||
Main.overview.cancelledWindowDrag(clone.metaWindow);
|
||||
});
|
||||
clone.connect('drag-end', () => {
|
||||
Main.overview.endWindowDrag(clone.metaWindow);
|
||||
});
|
||||
this._contents.add_actor(clone.actor);
|
||||
|
||||
if (this._windows.length == 0)
|
||||
@ -651,7 +650,7 @@ var ThumbnailsBox = new Lang.Class({
|
||||
|
||||
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('touch-event', Lang.bind(this, this._onTouchEvent));
|
||||
|
||||
@ -677,11 +676,11 @@ var ThumbnailsBox = new Lang.Class({
|
||||
this._settings.connect('changed::dynamic-workspaces',
|
||||
Lang.bind(this, this._updateSwitcherVisibility));
|
||||
|
||||
Main.layoutManager.connect('monitors-changed', Lang.bind(this, function() {
|
||||
Main.layoutManager.connect('monitors-changed', () => {
|
||||
this._destroyThumbnails();
|
||||
if (Main.overview.visible)
|
||||
this._createThumbnails();
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
_updateSwitcherVisibility() {
|
||||
@ -910,9 +909,8 @@ var ThumbnailsBox = new Lang.Class({
|
||||
},
|
||||
|
||||
_workspacesChanged() {
|
||||
let validThumbnails = this._thumbnails.filter(function(t) {
|
||||
return t.state <= ThumbnailState.NORMAL;
|
||||
});
|
||||
let validThumbnails =
|
||||
this._thumbnails.filter(t => t.state <= ThumbnailState.NORMAL);
|
||||
let oldNumWorkspaces = validThumbnails.length;
|
||||
let newNumWorkspaces = global.screen.n_workspaces;
|
||||
let active = global.screen.get_active_workspace_index();
|
||||
@ -1043,48 +1041,44 @@ var ThumbnailsBox = new Lang.Class({
|
||||
return;
|
||||
|
||||
// Then slide out any thumbnails that have been destroyed
|
||||
this._iterateStateThumbnails(ThumbnailState.REMOVING,
|
||||
function(thumbnail) {
|
||||
this._setThumbnailState(thumbnail, ThumbnailState.ANIMATING_OUT);
|
||||
this._iterateStateThumbnails(ThumbnailState.REMOVING, thumbnail => {
|
||||
this._setThumbnailState(thumbnail, ThumbnailState.ANIMATING_OUT);
|
||||
|
||||
Tweener.addTween(thumbnail,
|
||||
{ slidePosition: 1,
|
||||
time: SLIDE_ANIMATION_TIME,
|
||||
transition: 'linear',
|
||||
onComplete() {
|
||||
this._setThumbnailState(thumbnail, ThumbnailState.ANIMATED_OUT);
|
||||
this._queueUpdateStates();
|
||||
},
|
||||
onCompleteScope: this
|
||||
});
|
||||
});
|
||||
Tweener.addTween(thumbnail,
|
||||
{ slidePosition: 1,
|
||||
time: SLIDE_ANIMATION_TIME,
|
||||
transition: 'linear',
|
||||
onComplete: () => {
|
||||
this._setThumbnailState(thumbnail, ThumbnailState.ANIMATED_OUT);
|
||||
this._queueUpdateStates();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// As long as things are sliding out, don't proceed
|
||||
if (this._stateCounts[ThumbnailState.ANIMATING_OUT] > 0)
|
||||
return;
|
||||
|
||||
// Once that's complete, we can start scaling to the new size and collapse any removed thumbnails
|
||||
this._iterateStateThumbnails(ThumbnailState.ANIMATED_OUT,
|
||||
function(thumbnail) {
|
||||
this.actor.set_skip_paint(thumbnail.actor, true);
|
||||
this._setThumbnailState(thumbnail, ThumbnailState.COLLAPSING);
|
||||
Tweener.addTween(thumbnail,
|
||||
{ collapseFraction: 1,
|
||||
time: RESCALE_ANIMATION_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete() {
|
||||
this._stateCounts[thumbnail.state]--;
|
||||
thumbnail.state = ThumbnailState.DESTROYED;
|
||||
this._iterateStateThumbnails(ThumbnailState.ANIMATED_OUT, thumbnail => {
|
||||
this.actor.set_skip_paint(thumbnail.actor, true);
|
||||
this._setThumbnailState(thumbnail, ThumbnailState.COLLAPSING);
|
||||
Tweener.addTween(thumbnail,
|
||||
{ collapseFraction: 1,
|
||||
time: RESCALE_ANIMATION_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: () => {
|
||||
this._stateCounts[thumbnail.state]--;
|
||||
thumbnail.state = ThumbnailState.DESTROYED;
|
||||
|
||||
let index = this._thumbnails.indexOf(thumbnail);
|
||||
this._thumbnails.splice(index, 1);
|
||||
thumbnail.destroy();
|
||||
let index = this._thumbnails.indexOf(thumbnail);
|
||||
this._thumbnails.splice(index, 1);
|
||||
thumbnail.destroy();
|
||||
|
||||
this._queueUpdateStates();
|
||||
},
|
||||
onCompleteScope: this
|
||||
});
|
||||
});
|
||||
this._queueUpdateStates();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if (this._pendingScaleUpdate) {
|
||||
this._tweenScale();
|
||||
@ -1096,19 +1090,17 @@ var ThumbnailsBox = new Lang.Class({
|
||||
return;
|
||||
|
||||
// And then slide in any new thumbnails
|
||||
this._iterateStateThumbnails(ThumbnailState.NEW,
|
||||
function(thumbnail) {
|
||||
this._setThumbnailState(thumbnail, ThumbnailState.ANIMATING_IN);
|
||||
Tweener.addTween(thumbnail,
|
||||
{ slidePosition: 0,
|
||||
time: SLIDE_ANIMATION_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete() {
|
||||
this._setThumbnailState(thumbnail, ThumbnailState.NORMAL);
|
||||
},
|
||||
onCompleteScope: this
|
||||
});
|
||||
});
|
||||
this._iterateStateThumbnails(ThumbnailState.NEW, thumbnail => {
|
||||
this._setThumbnailState(thumbnail, ThumbnailState.ANIMATING_IN);
|
||||
Tweener.addTween(thumbnail,
|
||||
{ slidePosition: 0,
|
||||
time: SLIDE_ANIMATION_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: () => {
|
||||
this._setThumbnailState(thumbnail, ThumbnailState.NORMAL);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
_queueUpdateStates() {
|
||||
@ -1235,9 +1227,9 @@ var ThumbnailsBox = new Lang.Class({
|
||||
let y = box.y1;
|
||||
|
||||
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();
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
let childBox = new Clutter.ActorBox();
|
||||
@ -1264,9 +1256,9 @@ var ThumbnailsBox = new Lang.Class({
|
||||
childBox.y1 = Math.round(y);
|
||||
childBox.y2 = Math.round(y + placeholderHeight);
|
||||
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();
|
||||
}));
|
||||
});
|
||||
y += placeholderHeight + spacing;
|
||||
}
|
||||
|
||||
|
@ -112,11 +112,10 @@ var WorkspacesView = new Lang.Class({
|
||||
this._updateWorkspacesId = global.screen.connect('notify::n-workspaces', Lang.bind(this, this._updateWorkspaces));
|
||||
|
||||
this._overviewShownId =
|
||||
Main.overview.connect('shown',
|
||||
Lang.bind(this, function() {
|
||||
Main.overview.connect('shown', () => {
|
||||
this.actor.set_clip(this._fullGeometry.x, this._fullGeometry.y,
|
||||
this._fullGeometry.width, this._fullGeometry.height);
|
||||
}));
|
||||
});
|
||||
|
||||
this._switchWorkspaceNotifyId =
|
||||
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 ...
|
||||
if (w == 0) {
|
||||
this._updateVisibility();
|
||||
params.onComplete = Lang.bind(this,
|
||||
function() {
|
||||
this._animating = false;
|
||||
this._updateVisibility();
|
||||
});
|
||||
params.onComplete = () => {
|
||||
this._animating = false;
|
||||
this._updateVisibility();
|
||||
};
|
||||
}
|
||||
Tweener.addTween(workspace.actor, params);
|
||||
} else {
|
||||
@ -241,10 +239,9 @@ var WorkspacesView = new Lang.Class({
|
||||
value: index,
|
||||
time: WORKSPACE_SWITCH_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: Lang.bind(this,
|
||||
function() {
|
||||
this._animatingScroll = false;
|
||||
})
|
||||
onComplete: () => {
|
||||
this._animatingScroll = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@ -421,7 +418,7 @@ var WorkspacesDisplay = new Lang.Class({
|
||||
this.actor.connect('parent-set', Lang.bind(this, this._parentSet));
|
||||
|
||||
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
|
||||
// windows open. The problem is that it's too easy to miss
|
||||
// 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) &&
|
||||
this._workspacesViews[index].getActiveWorkspace().isEmpty())
|
||||
Main.overview.hide();
|
||||
}));
|
||||
});
|
||||
Main.overview.addAction(clickAction);
|
||||
this.actor.bind_property('mapped', clickAction, 'enabled', GObject.BindingFlags.SYNC_CREATE);
|
||||
|
||||
let panAction = new Clutter.PanAction({ threshold_trigger_edge: Clutter.GestureTriggerEdge.AFTER });
|
||||
panAction.connect('pan', Lang.bind(this, this._onPan));
|
||||
panAction.connect('gesture-begin', Lang.bind(this, function() {
|
||||
panAction.connect('gesture-begin', () => {
|
||||
if (this._workspacesOnlyOnPrimary) {
|
||||
let event = Clutter.get_current_event();
|
||||
if (this._getMonitorIndexForEvent(event) != this._primaryIndex)
|
||||
@ -446,17 +443,17 @@ var WorkspacesDisplay = new Lang.Class({
|
||||
for (let i = 0; i < this._workspacesViews.length; i++)
|
||||
this._workspacesViews[i].startSwipeScroll();
|
||||
return true;
|
||||
}));
|
||||
panAction.connect('gesture-cancel', Lang.bind(this, function() {
|
||||
});
|
||||
panAction.connect('gesture-cancel', () => {
|
||||
clickAction.release();
|
||||
for (let i = 0; i < this._workspacesViews.length; i++)
|
||||
this._workspacesViews[i].endSwipeScroll();
|
||||
}));
|
||||
panAction.connect('gesture-end', Lang.bind(this, function() {
|
||||
});
|
||||
panAction.connect('gesture-end', () => {
|
||||
clickAction.release();
|
||||
for (let i = 0; i < this._workspacesViews.length; i++)
|
||||
this._workspacesViews[i].endSwipeScroll();
|
||||
}));
|
||||
});
|
||||
Main.overview.addAction(panAction);
|
||||
this.actor.bind_property('mapped', panAction, 'enabled', GObject.BindingFlags.SYNC_CREATE);
|
||||
|
||||
@ -615,25 +612,23 @@ var WorkspacesDisplay = new Lang.Class({
|
||||
oldParent.disconnect(this._notifyOpacityId);
|
||||
this._notifyOpacityId = 0;
|
||||
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this,
|
||||
function() {
|
||||
let newParent = this.actor.get_parent();
|
||||
if (!newParent)
|
||||
return;
|
||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
|
||||
let newParent = this.actor.get_parent();
|
||||
if (!newParent)
|
||||
return;
|
||||
|
||||
// This is kinda hackish - we want the primary view to
|
||||
// appear as parent of this.actor, though in reality it
|
||||
// is added directly to Main.layoutManager.overviewGroup
|
||||
this._notifyOpacityId = newParent.connect('notify::opacity',
|
||||
Lang.bind(this, function() {
|
||||
let opacity = this.actor.get_parent().opacity;
|
||||
let primaryView = this._getPrimaryView();
|
||||
if (!primaryView)
|
||||
return;
|
||||
primaryView.actor.opacity = opacity;
|
||||
primaryView.actor.visible = opacity != 0;
|
||||
}));
|
||||
}));
|
||||
// This is kinda hackish - we want the primary view to
|
||||
// appear as parent of this.actor, though in reality it
|
||||
// is added directly to Main.layoutManager.overviewGroup
|
||||
this._notifyOpacityId = newParent.connect('notify::opacity', () => {
|
||||
let opacity = this.actor.get_parent().opacity;
|
||||
let primaryView = this._getPrimaryView();
|
||||
if (!primaryView)
|
||||
return;
|
||||
primaryView.actor.opacity = opacity;
|
||||
primaryView.actor.visible = opacity != 0;
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
// This geometry should always be the fullest geometry
|
||||
|
@ -35,7 +35,7 @@ function test() {
|
||||
if (useCairo)
|
||||
obin.style = 'border: 3px solid green;';
|
||||
else
|
||||
obin.connect_after('paint', function(actor) {
|
||||
obin.connect_after('paint', actor => {
|
||||
Cogl.set_source_color4f(0, 1, 0, 1);
|
||||
|
||||
let geom = actor.get_allocation_geometry();
|
||||
|
@ -62,14 +62,14 @@ function test() {
|
||||
|
||||
resize_animated(label1);
|
||||
resize_animated(label2);
|
||||
Mainloop.timeout_add(DELAY, Lang.bind(this, function() {
|
||||
Mainloop.timeout_add(DELAY, () => {
|
||||
log(label1 + label1.get_size());
|
||||
resize_animated(label1);
|
||||
resize_animated(label2);
|
||||
return true;
|
||||
}));
|
||||
});
|
||||
|
||||
Mainloop.timeout_add(2 * DELAY, Lang.bind(this, function() {
|
||||
Mainloop.timeout_add(2 * DELAY, () => {
|
||||
iter += 1;
|
||||
iter %= shadowStyles.length;
|
||||
label1.set_style(get_css_style(shadowStyles[iter]));
|
||||
@ -77,7 +77,7 @@ function test() {
|
||||
label2.set_style(get_css_style(shadowStyles[iter]));
|
||||
label2.set_text(shadowStyles[iter]);
|
||||
return true;
|
||||
}));
|
||||
});
|
||||
|
||||
UI.main(stage);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user