From c860409da5c00da0378e5af7366fb4618a342250 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Mon, 19 Aug 2019 21:06:04 +0200 Subject: [PATCH] cleanup: Use object shorthand where possible ES6 allows to omit property names where they match the name of the assigned variable, which makes code less redunant and thus cleaner. We will soon enforce that in our eslint rules, so make sure we use the shorthand wherever possible. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805 --- js/extensionPrefs/main.js | 2 +- js/gdm/authPrompt.js | 2 +- js/gdm/loginDialog.js | 3 +-- js/gdm/util.js | 2 +- js/misc/loginManager.js | 2 +- js/misc/util.js | 3 +-- js/portalHelper/main.js | 4 ++-- js/ui/altTab.js | 2 +- js/ui/animation.js | 2 +- js/ui/appDisplay.js | 8 ++++---- js/ui/background.js | 8 ++++---- js/ui/components/automountManager.js | 2 +- js/ui/components/networkAgent.js | 4 ++-- js/ui/components/telepathyClient.js | 16 ++++++++-------- js/ui/ctrlAltTab.js | 2 +- js/ui/dialog.js | 2 +- js/ui/endSessionDialog.js | 2 +- js/ui/extensionDownloader.js | 2 +- js/ui/iconGrid.js | 2 +- js/ui/keyboard.js | 2 +- js/ui/layout.js | 8 ++++---- js/ui/lookingGlass.js | 14 +++++++------- js/ui/magnifier.js | 4 ++-- js/ui/main.js | 12 ++++++------ js/ui/messageTray.js | 6 +++--- js/ui/mpris.js | 2 +- js/ui/notificationDaemon.js | 16 ++++++++-------- js/ui/overviewControls.js | 2 +- js/ui/panel.js | 3 +-- js/ui/popupMenu.js | 10 +++++----- js/ui/remoteSearch.js | 3 +-- js/ui/screenShield.js | 5 ++--- js/ui/screenshot.js | 2 +- js/ui/status/keyboard.js | 8 ++++---- js/ui/status/network.js | 2 +- js/ui/unlockDialog.js | 2 +- js/ui/windowManager.js | 2 +- js/ui/workspace.js | 2 +- js/ui/workspacesView.js | 4 ++-- js/ui/xdndHandler.js | 4 ++-- 40 files changed, 89 insertions(+), 94 deletions(-) diff --git a/js/extensionPrefs/main.js b/js/extensionPrefs/main.js index 71ad86235..25f3976f0 100644 --- a/js/extensionPrefs/main.js +++ b/js/extensionPrefs/main.js @@ -126,7 +126,7 @@ class Application extends Gtk.Application { let buffer = new Gtk.TextBuffer({ text: errortext }); let textview = new Gtk.TextView({ - buffer: buffer, + buffer, wrap_mode: Gtk.WrapMode.WORD, monospace: true, editable: false, diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js index de4bed78a..0d12e9d1a 100644 --- a/js/gdm/authPrompt.js +++ b/js/gdm/authPrompt.js @@ -64,7 +64,7 @@ var AuthPrompt = GObject.registerClass({ else if (this._mode == AuthPromptMode.UNLOCK_OR_LOG_IN) reauthenticationOnly = false; - this._userVerifier = new GdmUtil.ShellUserVerifier(this._gdmClient, { reauthenticationOnly: reauthenticationOnly }); + this._userVerifier = new GdmUtil.ShellUserVerifier(this._gdmClient, { reauthenticationOnly }); this._userVerifier.connect('ask-question', this._onAskQuestion.bind(this)); this._userVerifier.connect('show-message', this._onShowMessage.bind(this)); diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js index 3cc4e8a64..5c0030f78 100644 --- a/js/gdm/loginDialog.js +++ b/js/gdm/loginDialog.js @@ -1134,8 +1134,7 @@ var LoginDialog = GObject.registerClass({ let userName = item.user.get_user_name(); let hold = new Batch.Hold(); - this._authPrompt.begin({ userName: userName, - hold: hold }); + this._authPrompt.begin({ userName, hold }); return hold; } diff --git a/js/gdm/util.js b/js/gdm/util.js index f9f25b4be..72ec12b27 100644 --- a/js/gdm/util.js +++ b/js/gdm/util.js @@ -272,7 +272,7 @@ var ShellUserVerifier = class { let interval = this._getIntervalForMessage(message); this.hasPendingMessages = true; - this._messageQueue.push({ text: message, type: messageType, interval: interval }); + this._messageQueue.push({ text: message, type: messageType, interval }); this._queueMessageTimeout(); } diff --git a/js/misc/loginManager.js b/js/misc/loginManager.js index 7c383a519..9ddc42856 100644 --- a/js/misc/loginManager.js +++ b/js/misc/loginManager.js @@ -185,7 +185,7 @@ var LoginManagerSystemd = class { try { let [outVariant_, fdList] = proxy.call_with_unix_fd_list_finish(result); fd = fdList.steal_fds()[0]; - callback(new Gio.UnixInputStream({ fd: fd })); + callback(new Gio.UnixInputStream({ fd })); } catch (e) { logError(e, "Error getting systemd inhibitor"); callback(null); diff --git a/js/misc/util.js b/js/misc/util.js index 7d5874bef..a9194e3a0 100644 --- a/js/misc/util.js +++ b/js/misc/util.js @@ -121,8 +121,7 @@ function trySpawn(argv) { // We are only interested in the part in the parentheses. (And // we can't pattern match the text, since it gets localized.) let message = err.message.replace(/.*\((.+)\)/, '$1'); - throw new (err.constructor)({ code: err.code, - message: message }); + throw new (err.constructor)({ code: err.code, message }); } else { throw err; } diff --git a/js/portalHelper/main.js b/js/portalHelper/main.js index f6124e5ef..2c3b1726e 100644 --- a/js/portalHelper/main.js +++ b/js/portalHelper/main.js @@ -92,7 +92,7 @@ class PortalHeaderBar extends Gtk.HeaderBar { var PortalWindow = GObject.registerClass( class PortalWindow extends Gtk.ApplicationWindow { _init(application, url, timestamp, doneCallback) { - super._init({ application: application }); + super._init({ application }); this.connect('delete-event', this.destroyWindow.bind(this)); this._headerBar = new PortalHeaderBar(); @@ -287,7 +287,7 @@ class WebPortalHelper extends Gtk.Application { } Authenticate(connection, url, timestamp) { - this._queue.push({ connection: connection, url: url, timestamp: timestamp }); + this._queue.push({ connection, url, timestamp }); this._processQueue(); } diff --git a/js/ui/altTab.js b/js/ui/altTab.js index 449e37143..cedd19855 100644 --- a/js/ui/altTab.js +++ b/js/ui/altTab.js @@ -415,7 +415,7 @@ class CyclerHighlight extends St.Widget { this.add_actor(this._highlight); let coordinate = Clutter.BindCoordinate.ALL; - let constraint = new Clutter.BindConstraint({ coordinate: coordinate }); + let constraint = new Clutter.BindConstraint({ coordinate }); this._clone.bind_property('source', constraint, 'source', 0); this.add_constraint(constraint); diff --git a/js/ui/animation.js b/js/ui/animation.js index d047b75ed..e2fdf489b 100644 --- a/js/ui/animation.js +++ b/js/ui/animation.js @@ -10,7 +10,7 @@ var SPINNER_ANIMATION_DELAY = 1000; var Animation = GObject.registerClass( class Animation extends St.Bin { _init(file, width, height, speed) { - super._init({ width: width, height: height }); + super._init({ width, height }); this.connect('destroy', this._onDestroy.bind(this)); this.connect('resource-scale-changed', this._loadFile.bind(this, file, width, height)); diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index 9193c121b..c0cb047f0 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -710,7 +710,7 @@ var AllView = GObject.registerClass({ else opacity = 255; this._items[id].ease({ - opacity: opacity, + opacity, duration: INACTIVE_GRID_OPACITY_ANIMATION_TIME, mode: Clutter.AnimationMode.EASE_OUT_QUAD }); @@ -1029,14 +1029,14 @@ class AppDisplay extends St.BoxLayout { style_class: 'app-view-control button', can_focus: true, x_expand: true }); - this._views[Views.FREQUENT] = { 'view': view, 'control': button }; + this._views[Views.FREQUENT] = { view, 'control': button }; view = new AllView(); button = new St.Button({ label: _("All"), style_class: 'app-view-control button', can_focus: true, x_expand: true }); - this._views[Views.ALL] = { 'view': view, 'control': button }; + this._views[Views.ALL] = { view, 'control': button }; this._viewStackLayout = new ViewStackLayout(); this._viewStack = new St.Widget({ x_expand: true, y_expand: true, @@ -1472,7 +1472,7 @@ var FolderIcon = GObject.registerClass({ this._parentView = parentView; this._folder = new Gio.Settings({ schema_id: 'org.gnome.desktop.app-folders.folder', - path: path }); + path }); this._delegate = this; // whether we need to update arrow side, position etc. this._popupInvalidated = false; diff --git a/js/ui/background.js b/js/ui/background.js index 9302cedea..1953ba034 100644 --- a/js/ui/background.js +++ b/js/ui/background.js @@ -444,7 +444,7 @@ var Background = GObject.registerClass({ _loadAnimation(file) { this._cache.getAnimation({ - file: file, + file, settingsSchema: this._settings.schema_id, onLoaded: animation => { this._animation = animation; @@ -592,11 +592,11 @@ var BackgroundSource = class BackgroundSource { if (!(monitorIndex in this._backgrounds)) { let background = new Background({ - monitorIndex: monitorIndex, + monitorIndex, layoutManager: this._layoutManager, settings: this._settings, - file: file, - style: style + file, + style }); background._changedId = background.connect('bg-changed', () => { diff --git a/js/ui/components/automountManager.js b/js/ui/components/automountManager.js index 467829f73..2df866197 100644 --- a/js/ui/components/automountManager.js +++ b/js/ui/components/automountManager.js @@ -230,7 +230,7 @@ var AutomountManager = class { let existingDialog = prevOperation ? prevOperation.borrowDialog() : null; let operation = new ShellMountOperation.ShellMountOperation(volume, - { existingDialog: existingDialog }); + { existingDialog }); this._mountVolume(volume, operation); } diff --git a/js/ui/components/networkAgent.js b/js/ui/components/networkAgent.js index 983595ca6..57a8b41fa 100644 --- a/js/ui/components/networkAgent.js +++ b/js/ui/components/networkAgent.js @@ -56,7 +56,7 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog { secret.entry = new St.Entry({ style_class: 'prompt-dialog-password-entry', text: secret.value, can_focus: reactive, - reactive: reactive, + reactive, x_expand: true }); ShellEntry.addContextMenu(secret.entry, { isPassword: secret.password }); @@ -553,7 +553,7 @@ var VPNRequestHandler = class { contentOverride.secrets.push({ label: keyfile.get_string(groups[i], 'Label'), key: groups[i], - value: value, + value, password: keyfile.get_boolean(groups[i], 'IsSecret'), }); } else { diff --git a/js/ui/components/telepathyClient.js b/js/ui/components/telepathyClient.js index 4260bec21..90fc03ca8 100644 --- a/js/ui/components/telepathyClient.js +++ b/js/ui/components/telepathyClient.js @@ -49,10 +49,10 @@ function makeMessageFromTpMessage(tpMessage, direction) { return { messageType: tpMessage.get_message_type(), - text: text, + text, sender: tpMessage.sender.alias, - timestamp: timestamp, - direction: direction + timestamp, + direction }; } @@ -66,7 +66,7 @@ function makeMessageFromTplEvent(event) { text: event.get_message(), sender: event.get_sender().get_alias(), timestamp: event.get_timestamp(), - direction: direction + direction }; } @@ -350,7 +350,7 @@ class ChatSource extends MessageTray.Source { getIcon() { let file = this._contact.get_avatar_file(); if (file) - return new Gio.FileIcon({ file: file }); + return new Gio.FileIcon({ file }); else return new Gio.ThemedIcon({ name: 'avatar-default' }); } @@ -683,10 +683,10 @@ var ChatNotification = HAVE_TP ? GObject.registerClass({ ? 'received' : 'sent'); this._append({ body: messageBody, - group: group, - styles: styles, + group, + styles, timestamp: message.timestamp, - noTimestamp: noTimestamp }); + noTimestamp }); } _filterMessages() { diff --git a/js/ui/ctrlAltTab.js b/js/ui/ctrlAltTab.js index 4b54d9410..b7b3939af 100644 --- a/js/ui/ctrlAltTab.js +++ b/js/ui/ctrlAltTab.js @@ -104,7 +104,7 @@ var CtrlAltTabManager = class CtrlAltTabManager { Main.activateWindow(windows[i], timestamp); }, iconActor: icon, - iconName: iconName, + iconName, sortGroup: SortGroup.MIDDLE }); } } diff --git a/js/ui/dialog.js b/js/ui/dialog.js index d3b7178e0..ff986055f 100644 --- a/js/ui/dialog.js +++ b/js/ui/dialog.js @@ -117,7 +117,7 @@ class Dialog extends St.Widget { can_focus: true, x_expand: true, y_expand: true, - label: label }); + label }); button.connect('clicked', action); buttonInfo['button'] = button; diff --git a/js/ui/endSessionDialog.js b/js/ui/endSessionDialog.js index 319e8c764..c87cf59dd 100644 --- a/js/ui/endSessionDialog.js +++ b/js/ui/endSessionDialog.js @@ -456,7 +456,7 @@ class EndSessionDialog extends ModalDialog.ModalDialog { this._confirm(signal); }); }, - label: label, + label, }); } diff --git a/js/ui/extensionDownloader.js b/js/ui/extensionDownloader.js index 4cf0414dd..d4199ed2f 100644 --- a/js/ui/extensionDownloader.js +++ b/js/ui/extensionDownloader.js @@ -19,7 +19,7 @@ var REPOSITORY_URL_UPDATE = `${REPOSITORY_URL_BASE}/update-info/`; let _httpSession; function installExtension(uuid, invocation) { - let params = { uuid: uuid, + let params = { uuid, shell_version: Config.PACKAGE_VERSION }; let message = Soup.form_request_new_from_hash('GET', REPOSITORY_URL_INFO, params); diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js index ba769de24..dbde03763 100644 --- a/js/ui/iconGrid.js +++ b/js/ui/iconGrid.js @@ -487,7 +487,7 @@ var IconGrid = GObject.registerClass({ scale_y: ANIMATION_BOUNCE_ICON_SCALE, duration: bounceUpTime, mode: Clutter.AnimationMode.EASE_IN_OUT_QUAD, - delay: delay, + delay, onComplete: () => { let duration = ANIMATION_TIME_IN - bounceUpTime; actor.ease({ diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js index 48c3afa1c..f51ac7776 100644 --- a/js/ui/keyboard.js +++ b/js/ui/keyboard.js @@ -404,7 +404,7 @@ var Key = GObject.registerClass({ _makeKey(key) { let label = GLib.markup_escape_text(key, -1); let button = new St.Button({ - label: label, + label, style_class: 'keyboard-key', x_expand: true, }); diff --git a/js/ui/layout.js b/js/ui/layout.js index c26dd54de..b1c3d9264 100644 --- a/js/ui/layout.js +++ b/js/ui/layout.js @@ -445,7 +445,7 @@ var LayoutManager = GObject.registerClass({ _createBackgroundManager(monitorIndex) { let bgManager = new Background.BackgroundManager({ container: this._backgroundGroup, layoutManager: this, - monitorIndex: monitorIndex }); + monitorIndex }); bgManager.connect('changed', this._addBackgroundMenu.bind(this)); this._addBackgroundMenu(bgManager); @@ -955,7 +955,7 @@ var LayoutManager = GObject.registerClass({ findIndexForActor(actor) { let [x, y] = actor.get_transformed_position(); let [w, h] = actor.get_transformed_size(); - let rect = new Meta.Rectangle({ x: x, y: y, width: w, height: h }); + let rect = new Meta.Rectangle({ x, y, width: w, height: h }); return global.display.get_monitor_index_for_rect(rect); } @@ -1026,7 +1026,7 @@ var LayoutManager = GObject.registerClass({ h = Math.round(h); if (actorData.affectsInputRegion && wantsInputRegion && actorData.actor.get_paint_visibility()) - rects.push(new Meta.Rectangle({ x: x, y: y, width: w, height: h })); + rects.push(new Meta.Rectangle({ x, y, width: w, height: h })); let monitor = null; if (actorData.affectsStruts) @@ -1077,7 +1077,7 @@ var LayoutManager = GObject.registerClass({ } let strutRect = new Meta.Rectangle({ x: x1, y: y1, width: x2 - x1, height: y2 - y1 }); - let strut = new Meta.Strut({ rect: strutRect, side: side }); + let strut = new Meta.Strut({ rect: strutRect, side }); struts.push(strut); } } diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js index 7f83c4a8b..6f9a5235d 100644 --- a/js/ui/lookingGlass.js +++ b/js/ui/lookingGlass.js @@ -86,12 +86,12 @@ var AutoComplete = class AutoComplete { let currTime = global.get_current_time(); if ((currTime - this._lastTabTime) < AUTO_COMPLETE_DOUBLE_TAB_DELAY) { this._processCompletionRequest({ tabType: 'double', - completions: completions, - attrHead: attrHead }); + completions, + attrHead }); } else { this._processCompletionRequest({ tabType: 'single', - completions: completions, - attrHead: attrHead }); + completions, + attrHead }); } this._lastTabTime = currTime; } @@ -141,9 +141,9 @@ var Notebook = GObject.registerClass({ scrollview.get_hscroll_bar().hide(); scrollview.add_actor(child); - let tabData = { child: child, - labelBox: labelBox, - label: label, + let tabData = { child, + labelBox, + label, scrollView: scrollview, _scrollToBottom: false }; this._tabs.push(tabData); diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js index f45d2e124..e38c3a417 100644 --- a/js/ui/magnifier.js +++ b/js/ui/magnifier.js @@ -858,8 +858,8 @@ var ZoomRegion = class ZoomRegion { * of the magnified view. */ setMagFactor(xMagFactor, yMagFactor) { - this._changeROI({ xMagFactor: xMagFactor, - yMagFactor: yMagFactor, + this._changeROI({ xMagFactor, + yMagFactor, redoCursorTracking: this._followingCursor }); } diff --git a/js/ui/main.js b/js/ui/main.js index 5018258b0..d580d56fe 100644 --- a/js/ui/main.js +++ b/js/ui/main.js @@ -490,11 +490,11 @@ function pushModal(actor, params) { modalActorFocusStack[index].prevFocus = null; }); } - modalActorFocusStack.push({ actor: actor, + modalActorFocusStack.push({ actor, destroyId: actorDestroyId, - prevFocus: prevFocus, - prevFocusDestroyId: prevFocusDestroyId, - actionMode: actionMode }); + prevFocus, + prevFocusDestroyId, + actionMode }); actionMode = params.actionMode; global.stage.set_key_focus(actor); @@ -687,8 +687,8 @@ function _queueBeforeRedraw(workId) { function initializeDeferredWork(actor, callback) { // Turn into a string so we can use as an object property let workId = `${(++_deferredWorkSequence)}`; - _deferredWorkData[workId] = { 'actor': actor, - 'callback': callback }; + _deferredWorkData[workId] = { actor, + callback }; actor.connect('notify::mapped', () => { if (!(actor.mapped && _deferredWorkQueue.includes(workId))) return; diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index e8d4e5570..4a62cdb6a 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -435,7 +435,7 @@ var Notification = GObject.registerClass({ // @label: the label for the action's button // @callback: the callback for the action addAction(label, callback) { - this.actions.push({ label: label, callback: callback }); + this.actions.push({ label, callback }); } get acknowledged() { @@ -609,7 +609,7 @@ var NotificationBanner = GObject.registerClass({ addAction(label, callback) { let button = new St.Button({ style_class: 'notification-button', - label: label, + label, x_expand: true, can_focus: true }); @@ -750,7 +750,7 @@ var Source = GObject.registerClass({ } }, class Source extends GObject.Object { _init(title, iconName) { - super._init({ title: title }); + super._init({ title }); this.SOURCE_ICON_SIZE = 48; diff --git a/js/ui/mpris.js b/js/ui/mpris.js index 1519e4752..2b251546d 100644 --- a/js/ui/mpris.js +++ b/js/ui/mpris.js @@ -72,7 +72,7 @@ class MediaMessage extends MessageList.Message { if (this._player.trackCoverUrl) { let file = Gio.File.new_for_uri(this._player.trackCoverUrl); - this._icon.gicon = new Gio.FileIcon({ file: file }); + this._icon.gicon = new Gio.FileIcon({ file }); this._icon.remove_style_class_name('fallback'); } else { this._icon.icon_name = 'audio-x-generic-symbolic'; diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js index d9be574a5..e9109dd51 100644 --- a/js/ui/notificationDaemon.js +++ b/js/ui/notificationDaemon.js @@ -201,13 +201,13 @@ var FdoNotificationDaemon = class FdoNotificationDaemon { hints['image-data'] = hints['icon_data']; } - let ndata = { appName: appName, - icon: icon, - summary: summary, - body: body, - actions: actions, - hints: hints, - timeout: timeout }; + let ndata = { appName, + icon, + summary, + body, + actions, + hints, + timeout }; if (replacesId != 0 && this._notifications[replacesId]) { ndata.id = id = replacesId; ndata.notification = this._notifications[replacesId].notification; @@ -299,7 +299,7 @@ var FdoNotificationDaemon = class FdoNotificationDaemon { else if (!gicon) gicon = this._fallbackIconForNotificationData(hints); - notification.update(summary, body, { gicon: gicon, + notification.update(summary, body, { gicon, bannerMarkup: true, clear: true, soundFile: hints['sound-file'], diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js index 812abb001..a529b8325 100644 --- a/js/ui/overviewControls.js +++ b/js/ui/overviewControls.js @@ -462,7 +462,7 @@ class ControlsManager extends St.Widget { _updateWorkspacesGeometry() { let [x, y] = this.get_transformed_position(); let [width, height] = this.get_transformed_size(); - let geometry = { x: x, y: y, width: width, height: height }; + let geometry = { x, y, width, height }; let spacing = this.get_theme_node().get_length('spacing'); let dashWidth = this._dashSlider.getVisibleWidth() + spacing; diff --git a/js/ui/panel.js b/js/ui/panel.js index 4823d75b7..46080987c 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -57,8 +57,7 @@ function _unpremultiply(color) { let red = Math.min((color.red * 255 + 127) / color.alpha, 255); let green = Math.min((color.green * 255 + 127) / color.alpha, 255); let blue = Math.min((color.blue * 255 + 127) / color.alpha, 255); - return new Clutter.Color({ red: red, green: green, - blue: blue, alpha: color.alpha }); + return new Clutter.Color({ red, green, blue, alpha: color.alpha }); } class AppMenu extends PopupMenu.PopupMenu { diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index 978b3b22e..34e0413dd 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -269,7 +269,7 @@ class PopupMenuItem extends PopupBaseMenuItem { _init(text, params) { super._init(params); - this.label = new St.Label({ text: text }); + this.label = new St.Label({ text }); this.add_child(this.label); this.label_actor = this.label; } @@ -330,7 +330,7 @@ var PopupSwitchMenuItem = GObject.registerClass({ _init(text, active, params) { super._init(params); - this.label = new St.Label({ text: text }); + this.label = new St.Label({ text }); this._switch = new Switch(active); this.accessible_role = Atk.Role.CHECK_MENU_ITEM; @@ -416,7 +416,7 @@ class PopupImageMenuItem extends PopupBaseMenuItem { this._icon = new St.Icon({ style_class: 'popup-menu-icon', x_align: Clutter.ActorAlign.END }); this.add_child(this._icon); - this.label = new St.Label({ text: text }); + this.label = new St.Label({ text }); this.add_child(this.label); this.label_actor = this.label; @@ -1129,7 +1129,7 @@ class PopupSubMenuMenuItem extends PopupBaseMenuItem { this.add_child(this.icon); } - this.label = new St.Label({ text: text, + this.label = new St.Label({ text, y_expand: true, y_align: Clutter.ActorAlign.CENTER }); this.add_child(this.label); @@ -1251,7 +1251,7 @@ var PopupMenuManager = class { return; let menudata = { - menu: menu, + menu, openStateChangeId: menu.connect('open-state-changed', this._onMenuOpenState.bind(this)), destroyId: menu.connect('destroy', this._onMenuDestroy.bind(this)), enterId: 0, diff --git a/js/ui/remoteSearch.js b/js/ui/remoteSearch.js index b357aca74..98aa437dd 100644 --- a/js/ui/remoteSearch.js +++ b/js/ui/remoteSearch.js @@ -228,8 +228,7 @@ var RemoteSearchProvider = class { } if (gicon) - icon = new St.Icon({ gicon: gicon, - icon_size: size }); + icon = new St.Icon({ gicon, icon_size: size }); return icon; } diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js index 732bb69a4..3e5ee17e4 100644 --- a/js/ui/screenShield.js +++ b/js/ui/screenShield.js @@ -600,7 +600,7 @@ var ScreenShield = class { height: monitor.height }); let bgManager = new Background.BackgroundManager({ container: widget, - monitorIndex: monitorIndex, + monitorIndex, controlPosition: false, settingsSchema: SCREENSAVER_SCHEMA }); @@ -1026,8 +1026,7 @@ var ScreenShield = class { }); } else { this._lockScreenGroup.fixed_position_set = false; - this._lockScreenShown({ fadeToBlack: fadeToBlack, - animateFade: false }); + this._lockScreenShown({ fadeToBlack, animateFade: false }); } this._lockScreenGroup.grab_key_focus(); diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js index f57e10224..93825f122 100644 --- a/js/ui/screenshot.js +++ b/js/ui/screenshot.js @@ -252,7 +252,7 @@ var ScreenshotService = class { "Invalid params"); return; } - let flashspot = new Flashspot({ x: x, y: y, width: width, height: height }); + let flashspot = new Flashspot({ x, y, width, height }); flashspot.fire(); invocation.return_value(null); } diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js index e9a4eb48e..1180e258c 100644 --- a/js/ui/status/keyboard.js +++ b/js/ui/status/keyboard.js @@ -233,7 +233,7 @@ var InputSourceSystemSettings = class extends InputSourceSettings { let id = layouts[i]; if (variants[i]) id += `+${variants[i]}`; - sourcesList.push({ type: INPUT_SOURCE_TYPE_XKB, id: id }); + sourcesList.push({ type: INPUT_SOURCE_TYPE_XKB, id }); } return sourcesList; } @@ -266,7 +266,7 @@ var InputSourceSessionSettings = class extends InputSourceSettings { for (let i = 0; i < nSources; i++) { let [type, id] = sources.get_child_value(i).deep_unpack(); - sourcesList.push({ type: type, id: id }); + sourcesList.push({ type, id }); } return sourcesList; } @@ -562,14 +562,14 @@ var InputSourceManager = class { } if (exists) - infosList.push({ type: type, id: id, displayName: displayName, shortName: shortName }); + infosList.push({ type, id, displayName, shortName }); } if (infosList.length == 0) { let type = INPUT_SOURCE_TYPE_XKB; let id = KeyboardManager.DEFAULT_LAYOUT; let [, displayName, shortName] = this._xkbInfo.get_layout_info(id); - infosList.push({ type: type, id: id, displayName: displayName, shortName: shortName }); + infosList.push({ type, id, displayName, shortName }); } let inputSourcesByShortName = {}; diff --git a/js/ui/status/network.js b/js/ui/status/network.js index 638090320..3835ffbc3 100644 --- a/js/ui/status/network.js +++ b/js/ui/status/network.js @@ -1710,7 +1710,7 @@ class Indicator extends PanelMenu.SystemIndicator { this._ensureSource(); let gicon = new Gio.ThemedIcon({ name: iconName }); - this._notification = new MessageTray.Notification(this._source, title, text, { gicon: gicon }); + this._notification = new MessageTray.Notification(this._source, title, text, { gicon }); this._notification.setUrgency(urgency); this._notification.setTransient(true); this._notification.connect('destroy', () => { diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js index 077ab1fbe..6584bea45 100644 --- a/js/ui/unlockDialog.js +++ b/js/ui/unlockDialog.js @@ -95,7 +95,7 @@ var UnlockDialog = GObject.registerClass({ userName = null; } - this._authPrompt.begin({ userName: userName }); + this._authPrompt.begin({ userName }); } _escape() { diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js index 8b976bdfb..c902f5b27 100644 --- a/js/ui/windowManager.js +++ b/js/ui/windowManager.js @@ -1466,7 +1466,7 @@ var WindowManager = class { this._resizePending.add(actor); actor.__animationInfo = { clone: actorClone, oldRect: oldFrameRect, - destroyId: destroyId }; + destroyId }; } _sizeChangedWindow(shellwm, actor) { diff --git a/js/ui/workspace.js b/js/ui/workspace.js index 1713e7436..403aa5385 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -1950,7 +1950,7 @@ class Workspace extends St.Widget { if (numColumns == lastLayout.numColumns) break; - let layout = { area: area, strategy: strategy, numRows: numRows, numColumns: numColumns }; + let layout = { area, strategy, numRows, numColumns }; strategy.computeLayout(windows, layout); strategy.computeScaleAndSpace(layout); diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js index 59f283038..199891e47 100644 --- a/js/ui/workspacesView.js +++ b/js/ui/workspacesView.js @@ -697,7 +697,7 @@ class WorkspacesDisplay extends St.Widget { _getMonitorIndexForEvent(event) { let [x, y] = event.get_coords(); - let rect = new Meta.Rectangle({ x: x, y: y, width: 1, height: 1 }); + let rect = new Meta.Rectangle({ x, y, width: 1, height: 1 }); return global.display.get_monitor_index_for_rect(rect); } @@ -766,7 +766,7 @@ class WorkspacesDisplay extends St.Widget { let allocation = this.allocation; let width = allocation.x2 - allocation.x1; let height = allocation.y2 - allocation.y1; - let primaryGeometry = { x: x, y: y, width: width, height: height }; + let primaryGeometry = { x, y, width, height }; let monitors = Main.layoutManager.monitors; for (let i = 0; i < monitors.length; i++) { diff --git a/js/ui/xdndHandler.js b/js/ui/xdndHandler.js index 8b5297c09..fc4283c11 100644 --- a/js/ui/xdndHandler.js +++ b/js/ui/xdndHandler.js @@ -84,8 +84,8 @@ var XdndHandler = class { Main.uiGroup.set_child_above_sibling(this._cursorWindowClone, null); let dragEvent = { - x: x, - y: y, + x, + y, dragActor: this._cursorWindowClone ? this._cursorWindowClone : this._dummy, source: this, targetActor: pickedActor