style: Stop using braces for single-line arrow functions

Braces are optional for single-line arrow functions, but there's a
subtle difference:
Without braces, the expression is implicitly used as return value; with
braces, the function returns nothing unless there's an explicit return.

We currently reflect that in our style by only omitting braces when the
function is expected to have a return value, but that's not very obvious,
not an important differentiation to make, and not easy to express in an
automatic rule.

So just omit braces consistently as mandated by gjs' coding style.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/608
This commit is contained in:
Florian Müllner 2019-01-28 01:42:00 +01:00 committed by Georges Basile Stavracas Neto
parent 1398aa6562
commit 14d7897a93
39 changed files with 91 additions and 91 deletions

View File

@ -138,7 +138,7 @@ var AuthPrompt = class {
reactive: true, reactive: true,
can_focus: true, can_focus: true,
label: _("Cancel") }); label: _("Cancel") });
this.cancelButton.connect('clicked', () => { this.cancel(); }); this.cancelButton.connect('clicked', () => this.cancel());
this._buttonBox.add(this.cancelButton, this._buttonBox.add(this.cancelButton,
{ expand: false, { expand: false,
x_fill: false, x_fill: false,
@ -157,7 +157,7 @@ var AuthPrompt = class {
reactive: true, reactive: true,
can_focus: true, can_focus: true,
label: _("Next") }); label: _("Next") });
this.nextButton.connect('clicked', () => { this.emit('next'); }); this.nextButton.connect('clicked', () => this.emit('next'));
this.nextButton.add_style_pseudo_class('default'); this.nextButton.add_style_pseudo_class('default');
this._buttonBox.add(this.nextButton, this._buttonBox.add(this.nextButton,
{ expand: false, { expand: false,

View File

@ -259,7 +259,7 @@ var UserList = class {
item.connect('activate', this._onItemActivated.bind(this)); item.connect('activate', this._onItemActivated.bind(this));
// Try to keep the focused item front-and-center // Try to keep the focused item front-and-center
item.actor.connect('key-focus-in', () => { this.scrollToItem(item); }); item.actor.connect('key-focus-in', () => this.scrollToItem(item));
this._moveFocusToItems(); this._moveFocusToItems();
@ -327,7 +327,7 @@ var SessionMenuButton = class {
{ actionMode: Shell.ActionMode.NONE }); { actionMode: Shell.ActionMode.NONE });
this._manager.addMenu(this._menu); this._manager.addMenu(this._menu);
this._button.connect('clicked', () => { this._menu.toggle(); }); this._button.connect('clicked', () => this._menu.toggle());
this._items = {}; this._items = {};
this._activeSessionId = null; this._activeSessionId = null;
@ -955,7 +955,7 @@ var LoginDialog = GObject.registerClass({
} }
_onSessionOpened(client, serviceName) { _onSessionOpened(client, serviceName) {
this._authPrompt.finish(() => { this._startSession(serviceName); }); this._authPrompt.finish(() => this._startSession(serviceName));
} }
_waitForItemForUser(userName) { _waitForItemForUser(userName) {
@ -973,7 +973,7 @@ var LoginDialog = GObject.registerClass({
hold.release(); hold.release();
}); });
hold.connect('release', () => { this._userList.disconnect(signalId); }); hold.connect('release', () => this._userList.disconnect(signalId));
return hold; return hold;
} }

View File

@ -98,7 +98,7 @@ var Manager = class {
Service(Gio.DBus.system, Service(Gio.DBus.system,
'org.freedesktop.realmd', 'org.freedesktop.realmd',
'/org/freedesktop/realmd', '/org/freedesktop/realmd',
service => { service.ReleaseRemote(); }); service => service.ReleaseRemote());
this._aggregateProvider.disconnect(this._signalId); this._aggregateProvider.disconnect(this._signalId);
this._realms = { }; this._realms = { };
this._updateLoginFormat(); this._updateLoginFormat();

View File

@ -119,7 +119,7 @@ var IBusManager = class {
if (!GLib.str_has_suffix(path, '/InputContext_1')) if (!GLib.str_has_suffix(path, '/InputContext_1'))
this.emit ('focus-in'); this.emit ('focus-in');
}); });
this._panelService.connect('focus-out', () => { this.emit('focus-out'); }); this._panelService.connect('focus-out', () => this.emit('focus-out'));
try { try {
// IBus versions older than 1.5.10 have a bug which // IBus versions older than 1.5.10 have a bug which

View File

@ -143,26 +143,26 @@ const SystemActions = GObject.registerClass({
this._userManager = AccountsService.UserManager.get_default(); this._userManager = AccountsService.UserManager.get_default();
this._userManager.connect('notify::is-loaded', this._userManager.connect('notify::is-loaded',
() => { this._updateMultiUser(); }); () => this._updateMultiUser());
this._userManager.connect('notify::has-multiple-users', this._userManager.connect('notify::has-multiple-users',
() => { this._updateMultiUser(); }); () => this._updateMultiUser());
this._userManager.connect('user-added', this._userManager.connect('user-added',
() => { this._updateMultiUser(); }); () => this._updateMultiUser());
this._userManager.connect('user-removed', this._userManager.connect('user-removed',
() => { this._updateMultiUser(); }); () => this._updateMultiUser());
this._lockdownSettings.connect('changed::' + DISABLE_USER_SWITCH_KEY, this._lockdownSettings.connect('changed::' + DISABLE_USER_SWITCH_KEY,
() => { this._updateSwitchUser(); }); () => this._updateSwitchUser());
this._lockdownSettings.connect('changed::' + DISABLE_LOG_OUT_KEY, this._lockdownSettings.connect('changed::' + DISABLE_LOG_OUT_KEY,
() => { this._updateLogout(); }); () => this._updateLogout());
global.settings.connect('changed::' + ALWAYS_SHOW_LOG_OUT_KEY, global.settings.connect('changed::' + ALWAYS_SHOW_LOG_OUT_KEY,
() => { this._updateLogout(); }); () => this._updateLogout());
this._lockdownSettings.connect('changed::' + DISABLE_LOCK_SCREEN_KEY, this._lockdownSettings.connect('changed::' + DISABLE_LOCK_SCREEN_KEY,
() => { this._updateLockScreen(); }); () => this._updateLockScreen());
this._lockdownSettings.connect('changed::' + DISABLE_LOG_OUT_KEY, this._lockdownSettings.connect('changed::' + DISABLE_LOG_OUT_KEY,
() => { this._updateHaveShutdown(); }); () => this._updateHaveShutdown());
this.forceUpdate(); this.forceUpdate();
@ -172,10 +172,10 @@ const SystemActions = GObject.registerClass({
this._updateOrientationLockIcon(); this._updateOrientationLockIcon();
}); });
Main.layoutManager.connect('monitors-changed', Main.layoutManager.connect('monitors-changed',
() => { this._updateOrientationLock(); }); () => this._updateOrientationLock());
Gio.DBus.system.watch_name(SENSOR_BUS_NAME, Gio.DBus.system.watch_name(SENSOR_BUS_NAME,
Gio.BusNameWatcherFlags.NONE, Gio.BusNameWatcherFlags.NONE,
() => { this._sensorProxyAppeared(); }, () => this._sensorProxyAppeared(),
() => { () => {
this._sensorProxy = null; this._sensorProxy = null;
this._updateOrientationLock(); this._updateOrientationLock();
@ -183,7 +183,7 @@ const SystemActions = GObject.registerClass({
this._updateOrientationLock(); this._updateOrientationLock();
this._updateOrientationLockIcon(); this._updateOrientationLockIcon();
Main.sessionMode.connect('updated', () => { this._sessionUpdated(); }); Main.sessionMode.connect('updated', () => this._sessionUpdated());
this._sessionUpdated(); this._sessionUpdated();
} }
@ -223,7 +223,7 @@ const SystemActions = GObject.registerClass({
return; return;
} }
this._sensorProxy.connect('g-properties-changed', this._sensorProxy.connect('g-properties-changed',
() => { this._updateOrientationLock(); }); () => this._updateOrientationLock());
this._updateOrientationLock(); this._updateOrientationLock();
}); });
} }
@ -265,7 +265,7 @@ const SystemActions = GObject.registerClass({
getMatchingActions(terms) { getMatchingActions(terms) {
// terms is a list of strings // terms is a list of strings
terms = terms.map((term) => { return term.toLowerCase(); }); terms = terms.map((term) => term.toLowerCase());
let results = []; let results = [];

View File

@ -288,7 +288,7 @@ function createTimeLabel(date, params) {
let id = _desktopSettings.connect('changed::clock-format', () => { let id = _desktopSettings.connect('changed::clock-format', () => {
label.text = formatTime(date, params); label.text = formatTime(date, params);
}); });
label.connect('destroy', () => { _desktopSettings.disconnect(id); }); label.connect('destroy', () => _desktopSettings.disconnect(id));
return label; return label;
} }
@ -492,13 +492,13 @@ var AppSettingsMonitor = class {
} }
_setSettings(settings) { _setSettings(settings) {
this._handlers.forEach((handler) => { this._disconnectHandler(handler); }); this._handlers.forEach((handler) => this._disconnectHandler(handler));
let hadSettings = (this._settings != null); let hadSettings = (this._settings != null);
this._settings = settings; this._settings = settings;
let haveSettings = (this._settings != null); let haveSettings = (this._settings != null);
this._handlers.forEach((handler) => { this._connectHandler(handler); }); this._handlers.forEach((handler) => this._connectHandler(handler));
if (hadSettings != haveSettings) if (hadSettings != haveSettings)
this.emit('available-changed'); this.emit('available-changed');

View File

@ -68,7 +68,7 @@ var WeatherClient = class {
this._weatherAppMon = new Util.AppSettingsMonitor('org.gnome.Weather.desktop', this._weatherAppMon = new Util.AppSettingsMonitor('org.gnome.Weather.desktop',
'org.gnome.Weather'); 'org.gnome.Weather');
this._weatherAppMon.connect('available-changed', () => { this.emit('changed'); }); this._weatherAppMon.connect('available-changed', () => this.emit('changed'));
this._weatherAppMon.watchSetting('automatic-location', this._weatherAppMon.watchSetting('automatic-location',
this._onAutomaticLocationChanged.bind(this)); this._onAutomaticLocationChanged.bind(this));
this._weatherAppMon.watchSetting('locations', this._weatherAppMon.watchSetting('locations',

View File

@ -48,7 +48,7 @@ function waitAndDraw(milliseconds) {
cb(); cb();
}); });
return callback => { cb = callback; }; return callback => cb = callback;
} }
function waitSignal(object, signal) { function waitSignal(object, signal) {
@ -60,7 +60,7 @@ function waitSignal(object, signal) {
cb(); cb();
}); });
return callback => { cb = callback; }; return callback => cb = callback;
} }
function extractBootTimestamp() { function extractBootTimestamp() {

View File

@ -264,7 +264,7 @@ class WebPortalHelper extends Gtk.Application {
this._queue = []; this._queue = [];
let action = new Gio.SimpleAction({ name: 'quit' }); let action = new Gio.SimpleAction({ name: 'quit' });
action.connect('activate', () => { this.active_window.destroyWindow(); }); action.connect('activate', () => this.active_window.destroyWindow());
this.add_action(action); this.add_action(action);
} }

View File

@ -146,7 +146,7 @@ var AccessDialogDBus = class {
subtitle, body, options); subtitle, body, options);
dialog.open(); dialog.open();
dialog.connect('closed', () => { this._accessDialog = null; }); dialog.connect('closed', () => this._accessDialog = null);
this._accessDialog = dialog; this._accessDialog = dialog;
} }

View File

@ -395,7 +395,7 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup {
{ opacity: 255, { opacity: 255,
time: THUMBNAIL_FADE_TIME, time: THUMBNAIL_FADE_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete: () => { this.thumbnailsVisible = true; } onComplete: () => this.thumbnailsVisible = true
}); });
this._switcherList._items[this._selectedIndex].add_accessible_state (Atk.StateType.EXPANDED); this._switcherList._items[this._selectedIndex].add_accessible_state (Atk.StateType.EXPANDED);
@ -843,7 +843,7 @@ class AppSwitcher extends SwitcherPopup.SwitcherList {
}); });
let arrow = new St.DrawingArea({ style_class: 'switcher-arrow' }); let arrow = new St.DrawingArea({ style_class: 'switcher-arrow' });
arrow.connect('repaint', () => { SwitcherPopup.drawArrow(arrow, St.Side.BOTTOM); }); arrow.connect('repaint', () => SwitcherPopup.drawArrow(arrow, St.Side.BOTTOM));
this.add_actor(arrow); this.add_actor(arrow);
this._arrows.push(arrow); this._arrows.push(arrow);

View File

@ -143,7 +143,7 @@ class BaseAppView {
loadGrid() { loadGrid() {
this._allItems.sort(this._compareItems); this._allItems.sort(this._compareItems);
this._allItems.forEach(item => { this._grid.addItem(item); }); this._allItems.forEach(item => this._grid.addItem(item));
this.emit('view-loaded'); this.emit('view-loaded');
} }
@ -212,7 +212,7 @@ class BaseAppView {
} else { } else {
params.opacity = 0; params.opacity = 0;
params.delay = 0; params.delay = 0;
params.onComplete = () => { this.actor.hide(); }; params.onComplete = () => this.actor.hide();
} }
Tweener.addTween(this._grid, params); Tweener.addTween(this._grid, params);
@ -285,7 +285,7 @@ var AllView = class AllView extends BaseAppView {
this._availWidth = 0; this._availWidth = 0;
this._availHeight = 0; this._availHeight = 0;
Main.overview.connect('hidden', () => { this.goToPage(0); }); Main.overview.connect('hidden', () => this.goToPage(0));
this._grid.connect('space-opened', () => { this._grid.connect('space-opened', () => {
let fadeEffect = this._scrollView.get_effect('fade'); let fadeEffect = this._scrollView.get_effect('fade');
if (fadeEffect) if (fadeEffect)
@ -1299,7 +1299,7 @@ var AppFolderPopup = class AppFolderPopup {
global.focus_manager.add_group(this.actor); global.focus_manager.add_group(this.actor);
source.actor.connect('destroy', () => { this.actor.destroy(); }); source.actor.connect('destroy', () => this.actor.destroy());
this._grabHelper = new GrabHelper.GrabHelper(this.actor, { this._grabHelper = new GrabHelper.GrabHelper(this.actor, {
actionMode: Shell.ActionMode.POPUP actionMode: Shell.ActionMode.POPUP
}); });

View File

@ -159,7 +159,7 @@ var AudioDeviceSelectionDBus = class AudioDeviceSelectionDBus {
let [deviceNames] = params; let [deviceNames] = params;
let devices = 0; let devices = 0;
deviceNames.forEach(n => { devices |= AudioDevice[n.toUpperCase()]; }); deviceNames.forEach(n => devices |= AudioDevice[n.toUpperCase()]);
let dialog; let dialog;
try { try {

View File

@ -1072,7 +1072,7 @@ var CalendarMessageList = class CalendarMessageList {
this._clearButton.set_x_align(Clutter.ActorAlign.END); this._clearButton.set_x_align(Clutter.ActorAlign.END);
this._clearButton.connect('clicked', () => { this._clearButton.connect('clicked', () => {
let sections = [...this._sections.keys()]; let sections = [...this._sections.keys()];
sections.forEach((s) => { s.clear(); }); sections.forEach((s) => s.clear());
}); });
box.add_actor(this._clearButton); box.add_actor(this._clearButton);

View File

@ -620,7 +620,7 @@ var NetworkAgent = class {
this._pluginDir = Gio.file_new_for_path(Config.VPNDIR); this._pluginDir = Gio.file_new_for_path(Config.VPNDIR);
try { try {
let monitor = this._pluginDir.monitor(Gio.FileMonitorFlags.NONE, null); let monitor = this._pluginDir.monitor(Gio.FileMonitorFlags.NONE, null);
monitor.connect('changed', () => { this._vpnCacheBuilt = false; }); monitor.connect('changed', () => this._vpnCacheBuilt = false);
} catch (e) { } catch (e) {
log('Failed to create monitor for VPN plugin dir: ' + e.message); log('Failed to create monitor for VPN plugin dir: ' + e.message);
} }

View File

@ -32,7 +32,7 @@ var CtrlAltTabManager = class CtrlAltTabManager {
item.iconName = icon; item.iconName = icon;
this._items.push(item); this._items.push(item);
root.connect('destroy', () => { this.removeGroup(root); }); root.connect('destroy', () => this.removeGroup(root));
if (root instanceof St.Widget) if (root instanceof St.Widget)
global.focus_manager.add_group(root); global.focus_manager.add_group(root);
} }

View File

@ -357,7 +357,7 @@ var MessagesIndicator = class MessagesIndicator {
Main.messageTray.connect('queue-changed', this._updateCount.bind(this)); Main.messageTray.connect('queue-changed', this._updateCount.bind(this));
let sources = Main.messageTray.getSources(); let sources = Main.messageTray.getSources();
sources.forEach(source => { this._onSourceAdded(null, source); }); sources.forEach(source => this._onSourceAdded(null, source));
} }
_onSourceAdded(tray, source) { _onSourceAdded(tray, source) {
@ -373,7 +373,7 @@ var MessagesIndicator = class MessagesIndicator {
_updateCount() { _updateCount() {
let count = 0; let count = 0;
this._sources.forEach(source => { count += source.unseenCount; }); this._sources.forEach(source => count += source.unseenCount);
count -= Main.messageTray.queueCount; count -= Main.messageTray.queueCount;
this.actor.visible = (count > 0); this.actor.visible = (count > 0);
@ -384,8 +384,8 @@ var IndicatorPad = GObject.registerClass(
class IndicatorPad extends St.Widget { class IndicatorPad extends St.Widget {
_init(actor) { _init(actor) {
this._source = actor; this._source = actor;
this._source.connect('notify::visible', () => { this.queue_relayout(); }); this._source.connect('notify::visible', () => this.queue_relayout());
this._source.connect('notify::size', () => { this.queue_relayout(); }); this._source.connect('notify::size', () => this.queue_relayout());
super._init(); super._init();
} }

View File

@ -16,7 +16,7 @@ var EdgeDragAction = GObject.registerClass({
this._allowedModes = allowedModes; this._allowedModes = allowedModes;
this.set_n_touch_points(1); this.set_n_touch_points(1);
global.display.connect('grab-op-begin', () => { this.cancel(); }); global.display.connect('grab-op-begin', () => this.cancel());
} }
_getMonitorRect(x, y) { _getMonitorRect(x, y) {

View File

@ -402,7 +402,7 @@ var IconGrid = GObject.registerClass({
} }
_cancelAnimation() { _cancelAnimation() {
this._clonesAnimating.forEach(clone => { clone.destroy(); }); this._clonesAnimating.forEach(clone => clone.destroy());
this._clonesAnimating = []; this._clonesAnimating = [];
} }
@ -967,7 +967,7 @@ var PaginatedIconGrid = GObject.registerClass({
transition: 'easeInOutQuad' transition: 'easeInOutQuad'
}; };
if (i == (children.length - 1)) if (i == (children.length - 1))
params.onComplete = () => { this.emit('space-opened'); }; params.onComplete = () => this.emit('space-opened');
Tweener.addTween(children[i], params); Tweener.addTween(children[i], params);
} }
} }
@ -985,7 +985,7 @@ var PaginatedIconGrid = GObject.registerClass({
{ translation_y: 0, { translation_y: 0,
time: EXTRA_SPACE_ANIMATION_TIME, time: EXTRA_SPACE_ANIMATION_TIME,
transition: 'easeInOutQuad', transition: 'easeInOutQuad',
onComplete: () => { this.emit('space-closed'); } onComplete: () => this.emit('space-closed')
}); });
} }
} }

View File

@ -862,7 +862,7 @@ var EmojiSelection = class EmojiSelection {
x_expand: true, x_expand: true,
y_expand: true, y_expand: true,
vertical: true }); vertical: true });
this.actor.connect('notify::mapped', () => { this._emojiPager.setCurrentPage(0); }); this.actor.connect('notify::mapped', () => this._emojiPager.setCurrentPage(0));
this._emojiPager = new EmojiPager(this._sections, 11, 3); this._emojiPager = new EmojiPager(this._sections, 11, 3);
this._emojiPager.connect('page-changed', (pager, section, page, nPages) => { this._emojiPager.connect('page-changed', (pager, section, page, nPages) => {
@ -944,14 +944,14 @@ var EmojiSelection = class EmojiSelection {
key = new Key('ABC', []); key = new Key('ABC', []);
key.keyButton.add_style_class_name('default-key'); key.keyButton.add_style_class_name('default-key');
key.connect('released', () => { this.emit('toggle'); }); key.connect('released', () => this.emit('toggle'));
row.appendKey(key.actor, 1.5); row.appendKey(key.actor, 1.5);
for (let i = 0; i < this._sections.length; i++) { for (let i = 0; i < this._sections.length; i++) {
let section = this._sections[i]; let section = this._sections[i];
key = new Key(section.label, []); key = new Key(section.label, []);
key.connect('released', () => { this._emojiPager.setCurrentSection(section, 0); }); key.connect('released', () => this._emojiPager.setCurrentSection(section, 0));
row.appendKey(key.actor); row.appendKey(key.actor);
section.button = key; section.button = key;
@ -1171,7 +1171,7 @@ var Keyboard = class Keyboard {
this._emojiSelection = new EmojiSelection(); this._emojiSelection = new EmojiSelection();
this._emojiSelection.connect('toggle', this._toggleEmoji.bind(this)); this._emojiSelection.connect('toggle', this._toggleEmoji.bind(this));
this._emojiSelection.connect('hide', (selection) => { this.hide(); }); this._emojiSelection.connect('hide', (selection) => this.hide());
this._emojiSelection.connect('emoji-selected', (selection, emoji) => { this._emojiSelection.connect('emoji-selected', (selection, emoji) => {
this._keyboardController.commitString(emoji); this._keyboardController.commitString(emoji);
}); });

View File

@ -146,8 +146,8 @@ var Notebook = class Notebook {
this.actor.add(scrollview, { expand: true }); this.actor.add(scrollview, { expand: true });
let vAdjust = scrollview.vscroll.adjustment; let vAdjust = scrollview.vscroll.adjustment;
vAdjust.connect('changed', () => { this._onAdjustScopeChanged(tabData); }); vAdjust.connect('changed', () => this._onAdjustScopeChanged(tabData));
vAdjust.connect('notify::value', () => { this._onAdjustValueChanged(tabData); }); vAdjust.connect('notify::value', () => this._onAdjustValueChanged(tabData));
if (this._selectedIndex == -1) if (this._selectedIndex == -1)
this.selectIndex(0); this.selectIndex(0);
@ -1007,7 +1007,7 @@ var LookingGlass = class LookingGlass {
} }
_queueResize() { _queueResize() {
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => { this._resize(); }); Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => this._resize());
} }
_resize() { _resize() {

View File

@ -21,7 +21,7 @@ var LevelBar = class extends BarLevel.BarLevel {
this.actor.accessible_name = _("Volume"); this.actor.accessible_name = _("Volume");
this.actor.connect('notify::width', () => { this.level = this.level; }); this.actor.connect('notify::width', () => this.level = this.level);
} }
get level() { get level() {

View File

@ -186,7 +186,7 @@ var ActionComboBox = class {
} }
setButtonActionsActive(active) { setButtonActionsActive(active) {
this._buttonItems.forEach(item => { item.setSensitive(active); }); this._buttonItems.forEach(item => item.setSensitive(active));
} }
}; };
Signals.addSignalMethods(ActionComboBox.prototype); Signals.addSignalMethods(ActionComboBox.prototype);

View File

@ -862,7 +862,7 @@ class Panel extends St.Widget {
Main.sessionMode.connect('updated', this._updatePanel.bind(this)); Main.sessionMode.connect('updated', this._updatePanel.bind(this));
global.display.connect('workareas-changed', () => { this.queue_relayout(); }); global.display.connect('workareas-changed', () => this.queue_relayout());
this._updatePanel(); this._updatePanel();
} }

0
js/ui/panel.js. Normal file
View File

View File

@ -1134,7 +1134,7 @@ class PopupSubMenuMenuItem extends PopupBaseMenuItem {
this.menu = new PopupSubMenu(this, this._triangle); this.menu = new PopupSubMenu(this, this._triangle);
this.menu.connect('open-state-changed', this._subMenuOpenStateChanged.bind(this)); this.menu.connect('open-state-changed', this._subMenuOpenStateChanged.bind(this));
this.connect('destroy', () => { this.menu.destroy(); }); this.connect('destroy', () => this.menu.destroy());
} }
_setParent(parent) { _setParent(parent) {

View File

@ -34,14 +34,14 @@ class RunDialog extends ModalDialog.ModalDialog {
this._enableInternalCommands = global.settings.get_boolean('development-tools'); this._enableInternalCommands = global.settings.get_boolean('development-tools');
this._internalCommands = { this._internalCommands = {
'lg': () => { Main.createLookingGlass().open(); }, 'lg': () => Main.createLookingGlass().open(),
'r': this._restart.bind(this), 'r': this._restart.bind(this),
// Developer brain backwards compatibility // Developer brain backwards compatibility
'restart': this._restart.bind(this), 'restart': this._restart.bind(this),
'debugexit': () => { Meta.quit(Meta.ExitCode.ERROR); }, 'debugexit': () => Meta.quit(Meta.ExitCode.ERROR),
// rt is short for "reload theme" // rt is short for "reload theme"
'rt': () => { 'rt': () => {

View File

@ -529,9 +529,9 @@ var ScreenShield = class {
this._loginManager.getCurrentSessionProxy(sessionProxy => { this._loginManager.getCurrentSessionProxy(sessionProxy => {
this._loginSession = sessionProxy; this._loginSession = sessionProxy;
this._loginSession.connectSignal('Lock', this._loginSession.connectSignal('Lock',
() => { this.lock(false); }); () => this.lock(false));
this._loginSession.connectSignal('Unlock', this._loginSession.connectSignal('Unlock',
() => { this.deactivate(false); }); () => this.deactivate(false));
this._loginSession.connect('g-properties-changed', this._syncInhibitor.bind(this)); this._loginSession.connect('g-properties-changed', this._syncInhibitor.bind(this));
this._syncInhibitor(); this._syncInhibitor();
}); });
@ -1177,7 +1177,7 @@ var ScreenShield = class {
deactivate(animate) { deactivate(animate) {
if (this._dialog) if (this._dialog)
this._dialog.finish(() => { this._continueDeactivate(animate); }); this._dialog.finish(() => this._continueDeactivate(animate));
else else
this._continueDeactivate(animate); this._continueDeactivate(animate);
} }

View File

@ -162,7 +162,7 @@ function addContextMenu(entry, params) {
_onButtonPressEvent(actor, event, entry); _onButtonPressEvent(actor, event, entry);
}); });
entry.connect('popup-menu', actor => { _onPopup(actor, entry); }); entry.connect('popup-menu', actor => _onPopup(actor, entry));
entry.connect('destroy', () => { entry.connect('destroy', () => {
entry.menu.destroy(); entry.menu.destroy();

View File

@ -26,7 +26,7 @@ function _setButtonsForChoices(dialog, choices) {
for (let idx = 0; idx < choices.length; idx++) { for (let idx = 0; idx < choices.length; idx++) {
let button = idx; let button = idx;
buttons.unshift({ label: choices[idx], buttons.unshift({ label: choices[idx],
action: () => { dialog.emit('response', button); } action: () => dialog.emit('response', button)
}); });
} }

View File

@ -875,7 +875,7 @@ class InputSourceIndicator extends PanelMenu.Button {
let is = this._inputSourceManager.inputSources[i]; let is = this._inputSourceManager.inputSources[i];
let menuItem = new LayoutMenuItem(is.displayName, is.shortName); let menuItem = new LayoutMenuItem(is.displayName, is.shortName);
menuItem.connect('activate', () => { is.activate(true); }); menuItem.connect('activate', () => is.activate(true));
let indicatorLabel = new St.Label({ text: is.shortName, let indicatorLabel = new St.Label({ text: is.shortName,
visible: false }); visible: false });

View File

@ -270,7 +270,7 @@ var NMConnectionSection = class NMConnectionSection {
if (!item) if (!item)
return; return;
item.connect('icon-changed', () => { this._iconChanged(); }); item.connect('icon-changed', () => this._iconChanged());
item.connect('activation-failed', (item, reason) => { item.connect('activation-failed', (item, reason) => {
this.emit('activation-failed', reason); this.emit('activation-failed', reason);
}); });
@ -630,9 +630,9 @@ var NMWirelessDialogItem = GObject.registerClass({
can_focus: true, can_focus: true,
reactive: true }); reactive: true });
this.connect('key-focus-in', () => { this.emit('selected'); }); this.connect('key-focus-in', () => this.emit('selected'));
let action = new Clutter.ClickAction(); let action = new Clutter.ClickAction();
action.connect('clicked', () => { this.grab_key_focus(); }); action.connect('clicked', () => this.grab_key_focus());
this.add_action(action); this.add_action(action);
let title = ssidToLabel(this._ap.get_ssid()); let title = ssidToLabel(this._ap.get_ssid());
@ -1675,7 +1675,7 @@ var NMApplet = class extends PanelMenu.SystemIndicator {
'network-transmit-receive'); 'network-transmit-receive');
this._source.policy = new MessageTray.NotificationApplicationPolicy('gnome-network-panel'); this._source.policy = new MessageTray.NotificationApplicationPolicy('gnome-network-panel');
this._source.connect('destroy', () => { this._source = null; }); this._source.connect('destroy', () => this._source = null);
Main.messageTray.add(this._source); Main.messageTray.add(this._source);
} }
} }

View File

@ -15,13 +15,13 @@ var AltSwitcher = class {
this._standard.connect('notify::visible', this._sync.bind(this)); this._standard.connect('notify::visible', this._sync.bind(this));
if (this._standard instanceof St.Button) if (this._standard instanceof St.Button)
this._standard.connect('clicked', this._standard.connect('clicked',
() => { this._clickAction.release(); }); () => this._clickAction.release());
this._alternate = alternate; this._alternate = alternate;
this._alternate.connect('notify::visible', this._sync.bind(this)); this._alternate.connect('notify::visible', this._sync.bind(this));
if (this._alternate instanceof St.Button) if (this._alternate instanceof St.Button)
this._alternate.connect('clicked', this._alternate.connect('clicked',
() => { this._clickAction.release(); }); () => this._clickAction.release());
this._capturedEventId = global.stage.connect('captured-event', this._onCapturedEvent.bind(this)); this._capturedEventId = global.stage.connect('captured-event', this._onCapturedEvent.bind(this));
@ -32,7 +32,7 @@ var AltSwitcher = class {
this.actor = new St.Bin(); this.actor = new St.Bin();
this.actor.connect('destroy', this._onDestroy.bind(this)); this.actor.connect('destroy', this._onDestroy.bind(this));
this.actor.connect('notify::mapped', () => { this._flipped = false; }); this.actor.connect('notify::mapped', () => this._flipped = false);
} }
_sync() { _sync() {
@ -117,9 +117,9 @@ var Indicator = class extends PanelMenu.SystemIndicator {
this._createSubMenu(); this._createSubMenu();
this._loginScreenItem.connect('notify::visible', this._loginScreenItem.connect('notify::visible',
() => { this._updateMultiUser(); }); () => this._updateMultiUser());
this._logoutItem.connect('notify::visible', this._logoutItem.connect('notify::visible',
() => { this._updateMultiUser(); }); () => this._updateMultiUser());
// Whether shutdown is available or not depends on both lockdown // Whether shutdown is available or not depends on both lockdown
// settings (disable-log-out) and Polkit policy - the latter doesn't // settings (disable-log-out) and Polkit policy - the latter doesn't
// notify, so we update the menu item each time the menu opens or // notify, so we update the menu item each time the menu opens or
@ -303,13 +303,13 @@ var Indicator = class extends PanelMenu.SystemIndicator {
this._settingsAction.connect('notify::visible', this._settingsAction.connect('notify::visible',
() => { this._updateActionsVisibility(); }); () => this._updateActionsVisibility());
this._orientationLockAction.connect('notify::visible', this._orientationLockAction.connect('notify::visible',
() => { this._updateActionsVisibility(); }); () => this._updateActionsVisibility());
this._lockScreenAction.connect('notify::visible', this._lockScreenAction.connect('notify::visible',
() => { this._updateActionsVisibility(); }); () => this._updateActionsVisibility());
this._altSwitcher.actor.connect('notify::visible', this._altSwitcher.actor.connect('notify::visible',
() => { this._updateActionsVisibility(); }); () => this._updateActionsVisibility());
} }
_onSettingsClicked() { _onSettingsClicked() {

View File

@ -259,7 +259,7 @@ var Indicator = class extends PanelMenu.SystemIndicator {
if (!this._source) { if (!this._source) {
this._source = new MessageTray.Source(_("Thunderbolt"), this._source = new MessageTray.Source(_("Thunderbolt"),
'thunderbolt-symbolic'); 'thunderbolt-symbolic');
this._source.connect('destroy', () => { this._source = null; }); this._source.connect('destroy', () => this._source = null);
Main.messageTray.add(this._source); Main.messageTray.add(this._source);
} }

View File

@ -392,7 +392,7 @@ var SwitcherList = GObject.registerClass({
this._list.add_actor(bbox); this._list.add_actor(bbox);
let n = this._items.length; let n = this._items.length;
bbox.connect('clicked', () => { this._onItemClicked(n); }); bbox.connect('clicked', () => this._onItemClicked(n));
bbox.connect('motion-event', () => this._onItemEnter(n)); bbox.connect('motion-event', () => this._onItemEnter(n));
bbox.label_actor = label; bbox.label_actor = label;

View File

@ -43,7 +43,7 @@ function _wrapTweening(target, tweeningParameters) {
state.destroyedId = target.connect('destroy', _actorDestroyed); state.destroyedId = target.connect('destroy', _actorDestroyed);
} else if (target.actor && target.actor instanceof Clutter.Actor) { } else if (target.actor && target.actor instanceof Clutter.Actor) {
state.actor = target.actor; state.actor = target.actor;
state.destroyedId = target.actor.connect('destroy', () => { _actorDestroyed(target); }); state.destroyedId = target.actor.connect('destroy', () => _actorDestroyed(target));
} }
} }
@ -86,7 +86,7 @@ function _addHandler(target, params, name, handler) {
handler(target); handler(target);
}; };
} else { } else {
params[name] = () => { handler(target); }; params[name] = () => handler(target);
} }
} }

View File

@ -66,9 +66,9 @@ var Source = class WindowAttentionSource extends MessageTray.Source {
this.signalIDs.push(this._window.connect('notify::urgent', this.signalIDs.push(this._window.connect('notify::urgent',
this._sync.bind(this))); this._sync.bind(this)));
this.signalIDs.push(this._window.connect('focus', this.signalIDs.push(this._window.connect('focus',
() => { this.destroy(); })); () => this.destroy()));
this.signalIDs.push(this._window.connect('unmanaged', this.signalIDs.push(this._window.connect('unmanaged',
() => { this.destroy(); })); () => this.destroy()));
} }
_sync() { _sync() {

View File

@ -1106,7 +1106,7 @@ var WindowManager = class {
_showPadOsd(display, device, settings, imagePath, editionMode, monitorIndex) { _showPadOsd(display, device, settings, imagePath, editionMode, monitorIndex) {
this._currentPadOsd = new PadOsd.PadOsd(device, settings, imagePath, editionMode, monitorIndex); this._currentPadOsd = new PadOsd.PadOsd(device, settings, imagePath, editionMode, monitorIndex);
this._currentPadOsd.connect('closed', () => { this._currentPadOsd = null; }); this._currentPadOsd.connect('closed', () => this._currentPadOsd = null);
return this._currentPadOsd.actor; return this._currentPadOsd.actor;
} }

View File

@ -152,11 +152,11 @@ var WindowClone = class {
this.actor.connect('destroy', this._onDestroy.bind(this)); this.actor.connect('destroy', this._onDestroy.bind(this));
this.actor.connect('key-press-event', this._onKeyPress.bind(this)); this.actor.connect('key-press-event', this._onKeyPress.bind(this));
this.actor.connect('enter-event', () => { this.emit('show-chrome'); }); this.actor.connect('enter-event', () => this.emit('show-chrome'));
this.actor.connect('key-focus-in', () => { this.emit('show-chrome'); }); this.actor.connect('key-focus-in', () => this.emit('show-chrome'));
this.actor.connect('leave-event', () => { this.emit('hide-chrome'); }); this.actor.connect('leave-event', () => this.emit('hide-chrome'));
this.actor.connect('key-focus-out', () => { this.emit('hide-chrome'); }); this.actor.connect('key-focus-out', () => this.emit('hide-chrome'));
this._draggable = DND.makeDraggable(this.actor, this._draggable = DND.makeDraggable(this.actor,
{ restoreOnSuccess: true, { restoreOnSuccess: true,