From 14d7897a9335fe408e1b1728c789a8f34980a824 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Mon, 28 Jan 2019 01:42:00 +0100 Subject: [PATCH] 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 --- js/gdm/authPrompt.js | 4 ++-- js/gdm/loginDialog.js | 8 ++++---- js/gdm/realmd.js | 2 +- js/misc/ibusManager.js | 2 +- js/misc/systemActions.js | 28 ++++++++++++++-------------- js/misc/util.js | 6 +++--- js/misc/weather.js | 2 +- js/perf/hwtest.js | 4 ++-- js/portalHelper/main.js | 2 +- js/ui/accessDialog.js | 2 +- js/ui/altTab.js | 4 ++-- js/ui/appDisplay.js | 8 ++++---- js/ui/audioDeviceSelection.js | 2 +- js/ui/calendar.js | 2 +- js/ui/components/networkAgent.js | 2 +- js/ui/ctrlAltTab.js | 2 +- js/ui/dateMenu.js | 8 ++++---- js/ui/edgeDragAction.js | 2 +- js/ui/iconGrid.js | 6 +++--- js/ui/keyboard.js | 8 ++++---- js/ui/lookingGlass.js | 6 +++--- js/ui/osdWindow.js | 2 +- js/ui/padOsd.js | 2 +- js/ui/panel.js | 2 +- js/ui/panel.js. | 0 js/ui/popupMenu.js | 2 +- js/ui/runDialog.js | 4 ++-- js/ui/screenShield.js | 6 +++--- js/ui/shellEntry.js | 2 +- js/ui/shellMountOperation.js | 2 +- js/ui/status/keyboard.js | 2 +- js/ui/status/network.js | 8 ++++---- js/ui/status/system.js | 18 +++++++++--------- js/ui/status/thunderbolt.js | 2 +- js/ui/switcherPopup.js | 2 +- js/ui/tweener.js | 4 ++-- js/ui/windowAttentionHandler.js | 4 ++-- js/ui/windowManager.js | 2 +- js/ui/workspace.js | 8 ++++---- 39 files changed, 91 insertions(+), 91 deletions(-) create mode 100644 js/ui/panel.js. diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js index f6cd9aa79..c9ab36073 100644 --- a/js/gdm/authPrompt.js +++ b/js/gdm/authPrompt.js @@ -138,7 +138,7 @@ var AuthPrompt = class { reactive: true, can_focus: true, label: _("Cancel") }); - this.cancelButton.connect('clicked', () => { this.cancel(); }); + this.cancelButton.connect('clicked', () => this.cancel()); this._buttonBox.add(this.cancelButton, { expand: false, x_fill: false, @@ -157,7 +157,7 @@ var AuthPrompt = class { reactive: true, can_focus: true, label: _("Next") }); - this.nextButton.connect('clicked', () => { this.emit('next'); }); + this.nextButton.connect('clicked', () => this.emit('next')); this.nextButton.add_style_pseudo_class('default'); this._buttonBox.add(this.nextButton, { expand: false, diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js index 5c3cdd57d..9412bc2db 100644 --- a/js/gdm/loginDialog.js +++ b/js/gdm/loginDialog.js @@ -259,7 +259,7 @@ var UserList = class { item.connect('activate', this._onItemActivated.bind(this)); // 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(); @@ -327,7 +327,7 @@ var SessionMenuButton = class { { actionMode: Shell.ActionMode.NONE }); this._manager.addMenu(this._menu); - this._button.connect('clicked', () => { this._menu.toggle(); }); + this._button.connect('clicked', () => this._menu.toggle()); this._items = {}; this._activeSessionId = null; @@ -955,7 +955,7 @@ var LoginDialog = GObject.registerClass({ } _onSessionOpened(client, serviceName) { - this._authPrompt.finish(() => { this._startSession(serviceName); }); + this._authPrompt.finish(() => this._startSession(serviceName)); } _waitForItemForUser(userName) { @@ -973,7 +973,7 @@ var LoginDialog = GObject.registerClass({ hold.release(); }); - hold.connect('release', () => { this._userList.disconnect(signalId); }); + hold.connect('release', () => this._userList.disconnect(signalId)); return hold; } diff --git a/js/gdm/realmd.js b/js/gdm/realmd.js index f00d3023a..ed02d601a 100644 --- a/js/gdm/realmd.js +++ b/js/gdm/realmd.js @@ -98,7 +98,7 @@ var Manager = class { Service(Gio.DBus.system, 'org.freedesktop.realmd', '/org/freedesktop/realmd', - service => { service.ReleaseRemote(); }); + service => service.ReleaseRemote()); this._aggregateProvider.disconnect(this._signalId); this._realms = { }; this._updateLoginFormat(); diff --git a/js/misc/ibusManager.js b/js/misc/ibusManager.js index a01d31254..338542a13 100644 --- a/js/misc/ibusManager.js +++ b/js/misc/ibusManager.js @@ -119,7 +119,7 @@ var IBusManager = class { if (!GLib.str_has_suffix(path, '/InputContext_1')) this.emit ('focus-in'); }); - this._panelService.connect('focus-out', () => { this.emit('focus-out'); }); + this._panelService.connect('focus-out', () => this.emit('focus-out')); try { // IBus versions older than 1.5.10 have a bug which diff --git a/js/misc/systemActions.js b/js/misc/systemActions.js index 008cf2902..cbd9f2567 100644 --- a/js/misc/systemActions.js +++ b/js/misc/systemActions.js @@ -143,26 +143,26 @@ const SystemActions = GObject.registerClass({ this._userManager = AccountsService.UserManager.get_default(); this._userManager.connect('notify::is-loaded', - () => { this._updateMultiUser(); }); + () => this._updateMultiUser()); this._userManager.connect('notify::has-multiple-users', - () => { this._updateMultiUser(); }); + () => this._updateMultiUser()); this._userManager.connect('user-added', - () => { this._updateMultiUser(); }); + () => this._updateMultiUser()); this._userManager.connect('user-removed', - () => { this._updateMultiUser(); }); + () => this._updateMultiUser()); this._lockdownSettings.connect('changed::' + DISABLE_USER_SWITCH_KEY, - () => { this._updateSwitchUser(); }); + () => this._updateSwitchUser()); this._lockdownSettings.connect('changed::' + DISABLE_LOG_OUT_KEY, - () => { this._updateLogout(); }); + () => this._updateLogout()); global.settings.connect('changed::' + ALWAYS_SHOW_LOG_OUT_KEY, - () => { this._updateLogout(); }); + () => this._updateLogout()); this._lockdownSettings.connect('changed::' + DISABLE_LOCK_SCREEN_KEY, - () => { this._updateLockScreen(); }); + () => this._updateLockScreen()); this._lockdownSettings.connect('changed::' + DISABLE_LOG_OUT_KEY, - () => { this._updateHaveShutdown(); }); + () => this._updateHaveShutdown()); this.forceUpdate(); @@ -172,10 +172,10 @@ const SystemActions = GObject.registerClass({ this._updateOrientationLockIcon(); }); Main.layoutManager.connect('monitors-changed', - () => { this._updateOrientationLock(); }); + () => this._updateOrientationLock()); Gio.DBus.system.watch_name(SENSOR_BUS_NAME, Gio.BusNameWatcherFlags.NONE, - () => { this._sensorProxyAppeared(); }, + () => this._sensorProxyAppeared(), () => { this._sensorProxy = null; this._updateOrientationLock(); @@ -183,7 +183,7 @@ const SystemActions = GObject.registerClass({ this._updateOrientationLock(); this._updateOrientationLockIcon(); - Main.sessionMode.connect('updated', () => { this._sessionUpdated(); }); + Main.sessionMode.connect('updated', () => this._sessionUpdated()); this._sessionUpdated(); } @@ -223,7 +223,7 @@ const SystemActions = GObject.registerClass({ return; } this._sensorProxy.connect('g-properties-changed', - () => { this._updateOrientationLock(); }); + () => this._updateOrientationLock()); this._updateOrientationLock(); }); } @@ -265,7 +265,7 @@ const SystemActions = GObject.registerClass({ getMatchingActions(terms) { // terms is a list of strings - terms = terms.map((term) => { return term.toLowerCase(); }); + terms = terms.map((term) => term.toLowerCase()); let results = []; diff --git a/js/misc/util.js b/js/misc/util.js index f2795aa15..036207cc1 100644 --- a/js/misc/util.js +++ b/js/misc/util.js @@ -288,7 +288,7 @@ function createTimeLabel(date, params) { let id = _desktopSettings.connect('changed::clock-format', () => { label.text = formatTime(date, params); }); - label.connect('destroy', () => { _desktopSettings.disconnect(id); }); + label.connect('destroy', () => _desktopSettings.disconnect(id)); return label; } @@ -492,13 +492,13 @@ var AppSettingsMonitor = class { } _setSettings(settings) { - this._handlers.forEach((handler) => { this._disconnectHandler(handler); }); + this._handlers.forEach((handler) => this._disconnectHandler(handler)); let hadSettings = (this._settings != null); this._settings = settings; let haveSettings = (this._settings != null); - this._handlers.forEach((handler) => { this._connectHandler(handler); }); + this._handlers.forEach((handler) => this._connectHandler(handler)); if (hadSettings != haveSettings) this.emit('available-changed'); diff --git a/js/misc/weather.js b/js/misc/weather.js index 66d89fe94..b1eee3aff 100644 --- a/js/misc/weather.js +++ b/js/misc/weather.js @@ -68,7 +68,7 @@ var WeatherClient = class { this._weatherAppMon = new Util.AppSettingsMonitor('org.gnome.Weather.desktop', '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._onAutomaticLocationChanged.bind(this)); this._weatherAppMon.watchSetting('locations', diff --git a/js/perf/hwtest.js b/js/perf/hwtest.js index cf16b06bb..b0de64f11 100644 --- a/js/perf/hwtest.js +++ b/js/perf/hwtest.js @@ -48,7 +48,7 @@ function waitAndDraw(milliseconds) { cb(); }); - return callback => { cb = callback; }; + return callback => cb = callback; } function waitSignal(object, signal) { @@ -60,7 +60,7 @@ function waitSignal(object, signal) { cb(); }); - return callback => { cb = callback; }; + return callback => cb = callback; } function extractBootTimestamp() { diff --git a/js/portalHelper/main.js b/js/portalHelper/main.js index bd5fa9e30..ba4760a5c 100644 --- a/js/portalHelper/main.js +++ b/js/portalHelper/main.js @@ -264,7 +264,7 @@ class WebPortalHelper extends Gtk.Application { this._queue = []; 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); } diff --git a/js/ui/accessDialog.js b/js/ui/accessDialog.js index a13bfa831..46778739b 100644 --- a/js/ui/accessDialog.js +++ b/js/ui/accessDialog.js @@ -146,7 +146,7 @@ var AccessDialogDBus = class { subtitle, body, options); dialog.open(); - dialog.connect('closed', () => { this._accessDialog = null; }); + dialog.connect('closed', () => this._accessDialog = null); this._accessDialog = dialog; } diff --git a/js/ui/altTab.js b/js/ui/altTab.js index 2a32aca7b..76679dc7f 100644 --- a/js/ui/altTab.js +++ b/js/ui/altTab.js @@ -395,7 +395,7 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup { { opacity: 255, time: THUMBNAIL_FADE_TIME, transition: 'easeOutQuad', - onComplete: () => { this.thumbnailsVisible = true; } + onComplete: () => this.thumbnailsVisible = true }); 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' }); - arrow.connect('repaint', () => { SwitcherPopup.drawArrow(arrow, St.Side.BOTTOM); }); + arrow.connect('repaint', () => SwitcherPopup.drawArrow(arrow, St.Side.BOTTOM)); this.add_actor(arrow); this._arrows.push(arrow); diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index 9978e9f66..661b0f98c 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -143,7 +143,7 @@ class BaseAppView { loadGrid() { 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'); } @@ -212,7 +212,7 @@ class BaseAppView { } else { params.opacity = 0; params.delay = 0; - params.onComplete = () => { this.actor.hide(); }; + params.onComplete = () => this.actor.hide(); } Tweener.addTween(this._grid, params); @@ -285,7 +285,7 @@ var AllView = class AllView extends BaseAppView { this._availWidth = 0; this._availHeight = 0; - Main.overview.connect('hidden', () => { this.goToPage(0); }); + Main.overview.connect('hidden', () => this.goToPage(0)); this._grid.connect('space-opened', () => { let fadeEffect = this._scrollView.get_effect('fade'); if (fadeEffect) @@ -1299,7 +1299,7 @@ var AppFolderPopup = class AppFolderPopup { 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, { actionMode: Shell.ActionMode.POPUP }); diff --git a/js/ui/audioDeviceSelection.js b/js/ui/audioDeviceSelection.js index 8ee00025c..06459846a 100644 --- a/js/ui/audioDeviceSelection.js +++ b/js/ui/audioDeviceSelection.js @@ -159,7 +159,7 @@ var AudioDeviceSelectionDBus = class AudioDeviceSelectionDBus { let [deviceNames] = params; let devices = 0; - deviceNames.forEach(n => { devices |= AudioDevice[n.toUpperCase()]; }); + deviceNames.forEach(n => devices |= AudioDevice[n.toUpperCase()]); let dialog; try { diff --git a/js/ui/calendar.js b/js/ui/calendar.js index e253f8469..ff0816eed 100644 --- a/js/ui/calendar.js +++ b/js/ui/calendar.js @@ -1072,7 +1072,7 @@ var CalendarMessageList = class CalendarMessageList { this._clearButton.set_x_align(Clutter.ActorAlign.END); this._clearButton.connect('clicked', () => { let sections = [...this._sections.keys()]; - sections.forEach((s) => { s.clear(); }); + sections.forEach((s) => s.clear()); }); box.add_actor(this._clearButton); diff --git a/js/ui/components/networkAgent.js b/js/ui/components/networkAgent.js index bd8faea6d..37352aef8 100644 --- a/js/ui/components/networkAgent.js +++ b/js/ui/components/networkAgent.js @@ -620,7 +620,7 @@ var NetworkAgent = class { this._pluginDir = Gio.file_new_for_path(Config.VPNDIR); try { let monitor = this._pluginDir.monitor(Gio.FileMonitorFlags.NONE, null); - monitor.connect('changed', () => { this._vpnCacheBuilt = false; }); + monitor.connect('changed', () => this._vpnCacheBuilt = false); } catch (e) { log('Failed to create monitor for VPN plugin dir: ' + e.message); } diff --git a/js/ui/ctrlAltTab.js b/js/ui/ctrlAltTab.js index a075ca151..015badfbc 100644 --- a/js/ui/ctrlAltTab.js +++ b/js/ui/ctrlAltTab.js @@ -32,7 +32,7 @@ var CtrlAltTabManager = class CtrlAltTabManager { item.iconName = icon; this._items.push(item); - root.connect('destroy', () => { this.removeGroup(root); }); + root.connect('destroy', () => this.removeGroup(root)); if (root instanceof St.Widget) global.focus_manager.add_group(root); } diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js index a333bc938..87979bd61 100644 --- a/js/ui/dateMenu.js +++ b/js/ui/dateMenu.js @@ -357,7 +357,7 @@ var MessagesIndicator = class MessagesIndicator { Main.messageTray.connect('queue-changed', this._updateCount.bind(this)); let sources = Main.messageTray.getSources(); - sources.forEach(source => { this._onSourceAdded(null, source); }); + sources.forEach(source => this._onSourceAdded(null, source)); } _onSourceAdded(tray, source) { @@ -373,7 +373,7 @@ var MessagesIndicator = class MessagesIndicator { _updateCount() { let count = 0; - this._sources.forEach(source => { count += source.unseenCount; }); + this._sources.forEach(source => count += source.unseenCount); count -= Main.messageTray.queueCount; this.actor.visible = (count > 0); @@ -384,8 +384,8 @@ var IndicatorPad = GObject.registerClass( class IndicatorPad extends St.Widget { _init(actor) { this._source = actor; - this._source.connect('notify::visible', () => { this.queue_relayout(); }); - this._source.connect('notify::size', () => { this.queue_relayout(); }); + this._source.connect('notify::visible', () => this.queue_relayout()); + this._source.connect('notify::size', () => this.queue_relayout()); super._init(); } diff --git a/js/ui/edgeDragAction.js b/js/ui/edgeDragAction.js index e811dda21..7b048c691 100644 --- a/js/ui/edgeDragAction.js +++ b/js/ui/edgeDragAction.js @@ -16,7 +16,7 @@ var EdgeDragAction = GObject.registerClass({ this._allowedModes = allowedModes; 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) { diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js index c2c7c85a8..3c0bd3cd2 100644 --- a/js/ui/iconGrid.js +++ b/js/ui/iconGrid.js @@ -402,7 +402,7 @@ var IconGrid = GObject.registerClass({ } _cancelAnimation() { - this._clonesAnimating.forEach(clone => { clone.destroy(); }); + this._clonesAnimating.forEach(clone => clone.destroy()); this._clonesAnimating = []; } @@ -967,7 +967,7 @@ var PaginatedIconGrid = GObject.registerClass({ transition: 'easeInOutQuad' }; if (i == (children.length - 1)) - params.onComplete = () => { this.emit('space-opened'); }; + params.onComplete = () => this.emit('space-opened'); Tweener.addTween(children[i], params); } } @@ -985,7 +985,7 @@ var PaginatedIconGrid = GObject.registerClass({ { translation_y: 0, time: EXTRA_SPACE_ANIMATION_TIME, transition: 'easeInOutQuad', - onComplete: () => { this.emit('space-closed'); } + onComplete: () => this.emit('space-closed') }); } } diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js index 16e064a37..f84569c69 100644 --- a/js/ui/keyboard.js +++ b/js/ui/keyboard.js @@ -862,7 +862,7 @@ var EmojiSelection = class EmojiSelection { x_expand: true, y_expand: 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.connect('page-changed', (pager, section, page, nPages) => { @@ -944,14 +944,14 @@ var EmojiSelection = class EmojiSelection { key = new Key('ABC', []); 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); for (let i = 0; i < this._sections.length; i++) { let section = this._sections[i]; 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); section.button = key; @@ -1171,7 +1171,7 @@ var Keyboard = class Keyboard { this._emojiSelection = new EmojiSelection(); 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._keyboardController.commitString(emoji); }); diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js index 9df407c6c..6de84002b 100644 --- a/js/ui/lookingGlass.js +++ b/js/ui/lookingGlass.js @@ -146,8 +146,8 @@ var Notebook = class Notebook { this.actor.add(scrollview, { expand: true }); let vAdjust = scrollview.vscroll.adjustment; - vAdjust.connect('changed', () => { this._onAdjustScopeChanged(tabData); }); - vAdjust.connect('notify::value', () => { this._onAdjustValueChanged(tabData); }); + vAdjust.connect('changed', () => this._onAdjustScopeChanged(tabData)); + vAdjust.connect('notify::value', () => this._onAdjustValueChanged(tabData)); if (this._selectedIndex == -1) this.selectIndex(0); @@ -1007,7 +1007,7 @@ var LookingGlass = class LookingGlass { } _queueResize() { - Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => { this._resize(); }); + Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => this._resize()); } _resize() { diff --git a/js/ui/osdWindow.js b/js/ui/osdWindow.js index 58d8e6791..3730d6b20 100644 --- a/js/ui/osdWindow.js +++ b/js/ui/osdWindow.js @@ -21,7 +21,7 @@ var LevelBar = class extends BarLevel.BarLevel { 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() { diff --git a/js/ui/padOsd.js b/js/ui/padOsd.js index ed3607d8f..2fc81d336 100644 --- a/js/ui/padOsd.js +++ b/js/ui/padOsd.js @@ -186,7 +186,7 @@ var ActionComboBox = class { } setButtonActionsActive(active) { - this._buttonItems.forEach(item => { item.setSensitive(active); }); + this._buttonItems.forEach(item => item.setSensitive(active)); } }; Signals.addSignalMethods(ActionComboBox.prototype); diff --git a/js/ui/panel.js b/js/ui/panel.js index cf8b64fe4..1a5d9b95a 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -862,7 +862,7 @@ class Panel extends St.Widget { 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(); } diff --git a/js/ui/panel.js. b/js/ui/panel.js. new file mode 100644 index 000000000..e69de29bb diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index 6f58af634..846a67b84 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -1134,7 +1134,7 @@ class PopupSubMenuMenuItem extends PopupBaseMenuItem { this.menu = new PopupSubMenu(this, this._triangle); this.menu.connect('open-state-changed', this._subMenuOpenStateChanged.bind(this)); - this.connect('destroy', () => { this.menu.destroy(); }); + this.connect('destroy', () => this.menu.destroy()); } _setParent(parent) { diff --git a/js/ui/runDialog.js b/js/ui/runDialog.js index 76b950713..211fb225f 100644 --- a/js/ui/runDialog.js +++ b/js/ui/runDialog.js @@ -34,14 +34,14 @@ class RunDialog extends ModalDialog.ModalDialog { this._enableInternalCommands = global.settings.get_boolean('development-tools'); this._internalCommands = { - 'lg': () => { Main.createLookingGlass().open(); }, + 'lg': () => Main.createLookingGlass().open(), 'r': this._restart.bind(this), // Developer brain backwards compatibility 'restart': this._restart.bind(this), - 'debugexit': () => { Meta.quit(Meta.ExitCode.ERROR); }, + 'debugexit': () => Meta.quit(Meta.ExitCode.ERROR), // rt is short for "reload theme" 'rt': () => { diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js index 698b8be24..18f98461f 100644 --- a/js/ui/screenShield.js +++ b/js/ui/screenShield.js @@ -529,9 +529,9 @@ var ScreenShield = class { this._loginManager.getCurrentSessionProxy(sessionProxy => { this._loginSession = sessionProxy; this._loginSession.connectSignal('Lock', - () => { this.lock(false); }); + () => this.lock(false)); this._loginSession.connectSignal('Unlock', - () => { this.deactivate(false); }); + () => this.deactivate(false)); this._loginSession.connect('g-properties-changed', this._syncInhibitor.bind(this)); this._syncInhibitor(); }); @@ -1177,7 +1177,7 @@ var ScreenShield = class { deactivate(animate) { if (this._dialog) - this._dialog.finish(() => { this._continueDeactivate(animate); }); + this._dialog.finish(() => this._continueDeactivate(animate)); else this._continueDeactivate(animate); } diff --git a/js/ui/shellEntry.js b/js/ui/shellEntry.js index c3130c526..da4ba442b 100644 --- a/js/ui/shellEntry.js +++ b/js/ui/shellEntry.js @@ -162,7 +162,7 @@ function addContextMenu(entry, params) { _onButtonPressEvent(actor, event, entry); }); - entry.connect('popup-menu', actor => { _onPopup(actor, entry); }); + entry.connect('popup-menu', actor => _onPopup(actor, entry)); entry.connect('destroy', () => { entry.menu.destroy(); diff --git a/js/ui/shellMountOperation.js b/js/ui/shellMountOperation.js index feeda0667..db6b0be18 100644 --- a/js/ui/shellMountOperation.js +++ b/js/ui/shellMountOperation.js @@ -26,7 +26,7 @@ function _setButtonsForChoices(dialog, choices) { for (let idx = 0; idx < choices.length; idx++) { let button = idx; buttons.unshift({ label: choices[idx], - action: () => { dialog.emit('response', button); } + action: () => dialog.emit('response', button) }); } diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js index 1a1dceef7..3f7364081 100644 --- a/js/ui/status/keyboard.js +++ b/js/ui/status/keyboard.js @@ -875,7 +875,7 @@ class InputSourceIndicator extends PanelMenu.Button { let is = this._inputSourceManager.inputSources[i]; 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, visible: false }); diff --git a/js/ui/status/network.js b/js/ui/status/network.js index 05c830c09..3604b056f 100644 --- a/js/ui/status/network.js +++ b/js/ui/status/network.js @@ -270,7 +270,7 @@ var NMConnectionSection = class NMConnectionSection { if (!item) return; - item.connect('icon-changed', () => { this._iconChanged(); }); + item.connect('icon-changed', () => this._iconChanged()); item.connect('activation-failed', (item, reason) => { this.emit('activation-failed', reason); }); @@ -630,9 +630,9 @@ var NMWirelessDialogItem = GObject.registerClass({ can_focus: true, reactive: true }); - this.connect('key-focus-in', () => { this.emit('selected'); }); + this.connect('key-focus-in', () => this.emit('selected')); let action = new Clutter.ClickAction(); - action.connect('clicked', () => { this.grab_key_focus(); }); + action.connect('clicked', () => this.grab_key_focus()); this.add_action(action); let title = ssidToLabel(this._ap.get_ssid()); @@ -1675,7 +1675,7 @@ var NMApplet = class extends PanelMenu.SystemIndicator { 'network-transmit-receive'); 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); } } diff --git a/js/ui/status/system.js b/js/ui/status/system.js index 68c20e224..adb32116f 100644 --- a/js/ui/status/system.js +++ b/js/ui/status/system.js @@ -15,13 +15,13 @@ var AltSwitcher = class { this._standard.connect('notify::visible', this._sync.bind(this)); if (this._standard instanceof St.Button) this._standard.connect('clicked', - () => { this._clickAction.release(); }); + () => this._clickAction.release()); this._alternate = alternate; this._alternate.connect('notify::visible', this._sync.bind(this)); if (this._alternate instanceof St.Button) this._alternate.connect('clicked', - () => { this._clickAction.release(); }); + () => this._clickAction.release()); 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.connect('destroy', this._onDestroy.bind(this)); - this.actor.connect('notify::mapped', () => { this._flipped = false; }); + this.actor.connect('notify::mapped', () => this._flipped = false); } _sync() { @@ -117,9 +117,9 @@ var Indicator = class extends PanelMenu.SystemIndicator { this._createSubMenu(); this._loginScreenItem.connect('notify::visible', - () => { this._updateMultiUser(); }); + () => this._updateMultiUser()); this._logoutItem.connect('notify::visible', - () => { this._updateMultiUser(); }); + () => this._updateMultiUser()); // Whether shutdown is available or not depends on both lockdown // settings (disable-log-out) and Polkit policy - the latter doesn't // 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._updateActionsVisibility(); }); + () => this._updateActionsVisibility()); this._orientationLockAction.connect('notify::visible', - () => { this._updateActionsVisibility(); }); + () => this._updateActionsVisibility()); this._lockScreenAction.connect('notify::visible', - () => { this._updateActionsVisibility(); }); + () => this._updateActionsVisibility()); this._altSwitcher.actor.connect('notify::visible', - () => { this._updateActionsVisibility(); }); + () => this._updateActionsVisibility()); } _onSettingsClicked() { diff --git a/js/ui/status/thunderbolt.js b/js/ui/status/thunderbolt.js index 2becaf245..8ce1652e3 100644 --- a/js/ui/status/thunderbolt.js +++ b/js/ui/status/thunderbolt.js @@ -259,7 +259,7 @@ var Indicator = class extends PanelMenu.SystemIndicator { if (!this._source) { this._source = new MessageTray.Source(_("Thunderbolt"), 'thunderbolt-symbolic'); - this._source.connect('destroy', () => { this._source = null; }); + this._source.connect('destroy', () => this._source = null); Main.messageTray.add(this._source); } diff --git a/js/ui/switcherPopup.js b/js/ui/switcherPopup.js index d7b11f982..89fe08afc 100644 --- a/js/ui/switcherPopup.js +++ b/js/ui/switcherPopup.js @@ -392,7 +392,7 @@ var SwitcherList = GObject.registerClass({ this._list.add_actor(bbox); 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.label_actor = label; diff --git a/js/ui/tweener.js b/js/ui/tweener.js index 2edbdc8ef..ebd475170 100644 --- a/js/ui/tweener.js +++ b/js/ui/tweener.js @@ -43,7 +43,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', () => { _actorDestroyed(target); }); + state.destroyedId = target.actor.connect('destroy', () => _actorDestroyed(target)); } } @@ -86,7 +86,7 @@ function _addHandler(target, params, name, handler) { handler(target); }; } else { - params[name] = () => { handler(target); }; + params[name] = () => handler(target); } } diff --git a/js/ui/windowAttentionHandler.js b/js/ui/windowAttentionHandler.js index 671684a6b..701f97e88 100644 --- a/js/ui/windowAttentionHandler.js +++ b/js/ui/windowAttentionHandler.js @@ -66,9 +66,9 @@ var Source = class WindowAttentionSource extends MessageTray.Source { this.signalIDs.push(this._window.connect('notify::urgent', this._sync.bind(this))); this.signalIDs.push(this._window.connect('focus', - () => { this.destroy(); })); + () => this.destroy())); this.signalIDs.push(this._window.connect('unmanaged', - () => { this.destroy(); })); + () => this.destroy())); } _sync() { diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js index f3b99b51e..6ff952da7 100644 --- a/js/ui/windowManager.js +++ b/js/ui/windowManager.js @@ -1106,7 +1106,7 @@ var WindowManager = class { _showPadOsd(display, 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; } diff --git a/js/ui/workspace.js b/js/ui/workspace.js index 0b0593c18..34c0b1f0c 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -152,11 +152,11 @@ var WindowClone = class { this.actor.connect('destroy', this._onDestroy.bind(this)); this.actor.connect('key-press-event', this._onKeyPress.bind(this)); - this.actor.connect('enter-event', () => { this.emit('show-chrome'); }); - this.actor.connect('key-focus-in', () => { 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('leave-event', () => { this.emit('hide-chrome'); }); - this.actor.connect('key-focus-out', () => { this.emit('hide-chrome'); }); + this.actor.connect('leave-event', () => this.emit('hide-chrome')); + this.actor.connect('key-focus-out', () => this.emit('hide-chrome')); this._draggable = DND.makeDraggable(this.actor, { restoreOnSuccess: true,