From 4c5206954a2f6c98c7ecd55e7c813abb7ce19793 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 31 Jan 2019 14:43:52 +0100 Subject: [PATCH] style: Use camelCase for variable names Spotted by eslint. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/607 --- js/misc/modemManager.js | 38 ++++++++++++++--------------- js/misc/util.js | 18 +++++++------- js/ui/animation.js | 8 +++--- js/ui/components/polkitAgent.js | 4 +-- js/ui/components/telepathyClient.js | 2 +- js/ui/keyboard.js | 4 +-- js/ui/layout.js | 4 +-- js/ui/messageList.js | 14 +++++------ js/ui/messageTray.js | 6 ++--- js/ui/notificationDaemon.js | 4 +-- js/ui/popupMenu.js | 10 ++++---- js/ui/remoteSearch.js | 8 +++--- js/ui/runDialog.js | 4 +-- js/ui/screenShield.js | 12 ++++----- js/ui/screenshot.js | 8 +++--- js/ui/status/accessibility.js | 10 ++++---- js/ui/status/dwellClick.js | 4 +-- js/ui/status/network.js | 16 ++++++------ js/ui/tweener.js | 20 +++++++-------- js/ui/xdndHandler.js | 6 ++--- 20 files changed, 100 insertions(+), 100 deletions(-) diff --git a/js/misc/modemManager.js b/js/misc/modemManager.js index f54b5ed48..a3bd4f94c 100644 --- a/js/misc/modemManager.js +++ b/js/misc/modemManager.js @@ -26,33 +26,33 @@ function _getMobileProvidersDatabase() { } // _findProviderForMccMnc: -// @operator_name: operator name -// @operator_code: operator code +// @operatorName: operator name +// @operatorCode: operator code // // Given an operator name string (which may not be a real operator name) and an // operator code string, tries to find a proper operator name to display. // -function _findProviderForMccMnc(operator_name, operator_code) { - if (operator_name) { - if (operator_name.length != 0 && - (operator_name.length > 6 || operator_name.length < 5)) { +function _findProviderForMccMnc(operatorName, operatorCode) { + if (operatorName) { + if (operatorName.length != 0 && + (operatorName.length > 6 || operatorName.length < 5)) { // this looks like a valid name, i.e. not an MCCMNC (that some // devices return when not yet connected - return operator_name; + return operatorName; } - if (isNaN(parseInt(operator_name))) { + if (isNaN(parseInt(operatorName))) { // name is definitely not a MCCMNC, so it may be a name // after all; return that - return operator_name; + return operatorName; } } let needle; - if ((!operator_name || operator_name.length == 0) && operator_code) - needle = operator_code; - else if (operator_name && (operator_name.length == 6 || operator_name.length == 5)) - needle = operator_name; + if ((!operatorName || operatorName.length == 0) && operatorCode) + needle = operatorCode; + else if (operatorName && (operatorName.length == 6 || operatorName.length == 5)) + needle = operatorName; else // nothing to search return null; @@ -230,17 +230,17 @@ var BroadbandModem = class { } _reloadOperatorName() { - let new_name = ""; + let newName = ""; if (this.operator_name_3gpp && this.operator_name_3gpp.length > 0) - new_name += this.operator_name_3gpp; + newName += this.operator_name_3gpp; if (this.operator_name_cdma && this.operator_name_cdma.length > 0) { - if (new_name != "") - new_name += ", "; - new_name += this.operator_name_cdma; + if (newName != "") + newName += ", "; + newName += this.operator_name_cdma; } - this.operator_name = new_name; + this.operator_name = newName; this.emit('notify::operator-name'); } diff --git a/js/misc/util.js b/js/misc/util.js index 9fd31256e..f2795aa15 100644 --- a/js/misc/util.js +++ b/js/misc/util.js @@ -69,16 +69,16 @@ function spawn(argv) { } // spawnCommandLine: -// @command_line: a command line +// @commandLine: a command line // -// Runs @command_line in the background, handling any errors that +// Runs @commandLine in the background, handling any errors that // occur when trying to parse or start the program. -function spawnCommandLine(command_line) { +function spawnCommandLine(commandLine) { try { - let [success, argv] = GLib.shell_parse_argv(command_line); + let [success, argv] = GLib.shell_parse_argv(commandLine); trySpawn(argv); } catch (err) { - _handleSpawnError(command_line, err); + _handleSpawnError(commandLine, err); } } @@ -134,15 +134,15 @@ function trySpawn(argv) { } // trySpawnCommandLine: -// @command_line: a command line +// @commandLine: a command line // -// Runs @command_line in the background. If launching @command_line +// Runs @commandLine in the background. If launching @commandLine // fails, this will throw an error. -function trySpawnCommandLine(command_line) { +function trySpawnCommandLine(commandLine) { let success, argv; try { - [success, argv] = GLib.shell_parse_argv(command_line); + [success, argv] = GLib.shell_parse_argv(commandLine); } catch (err) { // Replace "Error invoking GLib.shell_parse_argv: " with // something nicer diff --git a/js/ui/animation.js b/js/ui/animation.js index 960b8dabf..00bbab498 100644 --- a/js/ui/animation.js +++ b/js/ui/animation.js @@ -62,11 +62,11 @@ var Animation = class { if (!validResourceScale) return; - let texture_cache = St.TextureCache.get_default(); + let textureCache = St.TextureCache.get_default(); let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor; - this._animations = texture_cache.load_sliced_image(file, width, height, - scaleFactor, resourceScale, - this._animationsLoaded.bind(this)); + this._animations = textureCache.load_sliced_image(file, width, height, + scaleFactor, resourceScale, + this._animationsLoaded.bind(this)); this.actor.set_child(this._animations); } diff --git a/js/ui/components/polkitAgent.js b/js/ui/components/polkitAgent.js index a25532494..f228eb90a 100644 --- a/js/ui/components/polkitAgent.js +++ b/js/ui/components/polkitAgent.js @@ -250,14 +250,14 @@ var AuthenticationDialog = GObject.registerClass({ } } - _onSessionRequest(session, request, echo_on) { + _onSessionRequest(session, request, echoOn) { // Cheap localization trick if (request == 'Password:' || request == 'Password: ') this._passwordLabel.set_text(_("Password:")); else this._passwordLabel.set_text(request); - if (echo_on) + if (echoOn) this._passwordEntry.clutter_text.set_password_char(''); else this._passwordEntry.clutter_text.set_password_char('\u25cf'); // ● U+25CF BLACK CIRCLE diff --git a/js/ui/components/telepathyClient.js b/js/ui/components/telepathyClient.js index 6e81bab59..08fff1925 100644 --- a/js/ui/components/telepathyClient.js +++ b/js/ui/components/telepathyClient.js @@ -181,7 +181,7 @@ class TelepathyClient extends Tp.BaseClient { } vfunc_handle_channels(...args) { - let [account, conn, channels, requests, user_action_time, context] = args; + let [account, conn, channels, requests, userActionTime, context] = args; this._handlingChannels(account, conn, channels, true); context.accept(); } diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js index e9e760308..a803c53e1 100644 --- a/js/ui/keyboard.js +++ b/js/ui/keyboard.js @@ -1442,8 +1442,8 @@ var Keyboard = class Keyboard { numOfVertSlots = rows.length; for (let i = 0; i < rows.length; ++i) { - let keyboard_row = rows[i]; - let keys = keyboard_row.get_children(); + let keyboardRow = rows[i]; + let keys = keyboardRow.get_children(); numOfHorizSlots = Math.max(numOfHorizSlots, keys.length); } diff --git a/js/ui/layout.js b/js/ui/layout.js index ef1708968..5ad126aed 100644 --- a/js/ui/layout.js +++ b/js/ui/layout.js @@ -147,13 +147,13 @@ var MonitorConstraint = GObject.registerClass({ }); var Monitor = class Monitor { - constructor(index, geometry, geometry_scale) { + constructor(index, geometry, geometryScale) { this.index = index; this.x = geometry.x; this.y = geometry.y; this.width = geometry.width; this.height = geometry.height; - this.geometry_scale = geometry_scale; + this.geometry_scale = geometryScale; } get inFullscreen() { diff --git a/js/ui/messageList.js b/js/ui/messageList.js index d3db1c1f5..b912a782f 100644 --- a/js/ui/messageList.js +++ b/js/ui/messageList.js @@ -135,17 +135,17 @@ var URLHighlighter = class URLHighlighter { let success; let [x, y] = event.get_coords(); [success, x, y] = this.actor.transform_stage_point(x, y); - let find_pos = -1; + let findPos = -1; for (let i = 0; i < this.actor.clutter_text.text.length; i++) { - let [success, px, py, line_height] = this.actor.clutter_text.position_to_coords(i); - if (py > y || py + line_height < y || x < px) + let [success, px, py, lineHeight] = this.actor.clutter_text.position_to_coords(i); + if (py > y || py + lineHeight < y || x < px) continue; - find_pos = i; + findPos = i; } - if (find_pos != -1) { + if (findPos != -1) { for (let i = 0; i < this._urls.length; i++) - if (find_pos >= this._urls[i].pos && - this._urls[i].pos + this._urls[i].url.length > find_pos) + if (findPos >= this._urls[i].pos && + this._urls[i].pos + this._urls[i].url.length > findPos) return i; } return -1; diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index fc54f0d10..68a484c47 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -590,11 +590,11 @@ class SourceActor extends St.Widget { }); this._actorDestroyed = false; - let scale_factor = St.ThemeContext.get_for_stage(global.stage).scale_factor; + let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor; this._iconBin = new St.Bin({ x_fill: true, x_expand: true, - height: size * scale_factor, - width: size * scale_factor }); + height: size * scaleFactor, + width: size * scaleFactor }); this.add_actor(this._iconBin); diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js index cdb33f872..05ebb0068 100644 --- a/js/ui/notificationDaemon.js +++ b/js/ui/notificationDaemon.js @@ -170,11 +170,11 @@ var FdoNotificationDaemon = class FdoNotificationDaemon { // Ignore replacesId since we already sent back a // NotificationClosed for that id. id = this._nextNotificationId++; - let idle_id = Mainloop.idle_add(() => { + let idleId = Mainloop.idle_add(() => { this._emitNotificationClosed(id, NotificationClosedReason.DISMISSED); return GLib.SOURCE_REMOVE; }); - GLib.Source.set_name_by_id(idle_id, '[gnome-shell] this._emitNotificationClosed'); + GLib.Source.set_name_by_id(idleId, '[gnome-shell] this._emitNotificationClosed'); return invocation.return_value(GLib.Variant.new('(u)', [id])); } diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index 0cd0a0a84..cede9633c 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -650,14 +650,14 @@ var PopupMenuBase = class { } addMenuItem(menuItem, position) { - let before_item = null; + let beforeItem = null; if (position == undefined) { this.box.add(menuItem.actor); } else { let items = this._getMenuItems(); if (position < items.length) { - before_item = items[position].actor; - this.box.insert_child_below(menuItem.actor, before_item); + beforeItem = items[position].actor; + this.box.insert_child_below(menuItem.actor, beforeItem); } else { this.box.add(menuItem.actor); } @@ -687,10 +687,10 @@ var PopupMenuBase = class { this.length--; }); } else if (menuItem instanceof PopupSubMenuMenuItem) { - if (before_item == null) + if (beforeItem == null) this.box.add(menuItem.menu.actor); else - this.box.insert_child_below(menuItem.menu.actor, before_item); + this.box.insert_child_below(menuItem.menu.actor, beforeItem); this._connectItemSignals(menuItem); let subMenuActiveChangeId = menuItem.menu.connect('active-changed', this._subMenuActiveChanged.bind(this)); diff --git a/js/ui/remoteSearch.js b/js/ui/remoteSearch.js index d17dad269..6db79e2a7 100644 --- a/js/ui/remoteSearch.js +++ b/js/ui/remoteSearch.js @@ -191,18 +191,18 @@ var RemoteSearchProvider = class { if (!proxyInfo) proxyInfo = SearchProviderProxyInfo; - let g_flags = Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES; + let gFlags = Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES; if (autoStart) - g_flags |= Gio.DBusProxyFlags.DO_NOT_AUTO_START_AT_CONSTRUCTION; + gFlags |= Gio.DBusProxyFlags.DO_NOT_AUTO_START_AT_CONSTRUCTION; else - g_flags |= Gio.DBusProxyFlags.DO_NOT_AUTO_START; + gFlags |= Gio.DBusProxyFlags.DO_NOT_AUTO_START; this.proxy = new Gio.DBusProxy({ g_bus_type: Gio.BusType.SESSION, g_name: dbusName, g_object_path: dbusPath, g_interface_info: proxyInfo, g_interface_name: proxyInfo.name, - g_flags }); + gFlags }); this.proxy.init_async(GLib.PRIORITY_DEFAULT, null, null); this.appInfo = appInfo; diff --git a/js/ui/runDialog.js b/js/ui/runDialog.js index 109bbd91d..56eac4487 100644 --- a/js/ui/runDialog.js +++ b/js/ui/runDialog.js @@ -202,8 +202,8 @@ class RunDialog extends ModalDialog.ModalDialog { try { if (inTerminal) { let exec = this._terminalSettings.get_string(EXEC_KEY); - let exec_arg = this._terminalSettings.get_string(EXEC_ARG_KEY); - command = exec + ' ' + exec_arg + ' ' + input; + let execArg = this._terminalSettings.get_string(EXEC_ARG_KEY); + command = exec + ' ' + execArg + ' ' + input; } Util.trySpawnCommandLine(command); } catch (e) { diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js index 3a44686b6..c0560a67c 100644 --- a/js/ui/screenShield.js +++ b/js/ui/screenShield.js @@ -381,11 +381,11 @@ class ScreenShieldArrow extends St.Bin { if (!this._shadow) return true; - let shadow_box = new Clutter.ActorBox(); - this._shadow.get_box(this._drawingArea.get_allocation_box(), shadow_box); + let shadowBox = new Clutter.ActorBox(); + this._shadow.get_box(this._drawingArea.get_allocation_box(), shadowBox); - volume.set_width(Math.max(shadow_box.x2 - shadow_box.x1, volume.get_width())); - volume.set_height(Math.max(shadow_box.y2 - shadow_box.y1, volume.get_height())); + volume.set_width(Math.max(shadowBox.x2 - shadowBox.x1, volume.get_width())); + volume.set_height(Math.max(shadowBox.y2 - shadowBox.y1, volume.get_height())); return true; } @@ -933,9 +933,9 @@ var ScreenShield = class { // if velocity is specified, it's in pixels per milliseconds let h = global.stage.height; let delta = (h + this._lockScreenGroup.y); - let min_velocity = global.stage.height / (CURTAIN_SLIDE_TIME * 1000); + let minVelocity = global.stage.height / (CURTAIN_SLIDE_TIME * 1000); - velocity = Math.max(min_velocity, velocity); + velocity = Math.max(minVelocity, velocity); let time = (delta / velocity) / 1000; Tweener.addTween(this._lockScreenGroup, diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js index d7433ba90..97c762673 100644 --- a/js/ui/screenshot.js +++ b/js/ui/screenshot.js @@ -125,11 +125,11 @@ var ScreenshotService = class { } ScreenshotWindowAsync(params, invocation) { - let [include_frame, include_cursor, flash, filename] = params; + let [includeFrame, includeCursor, flash, filename] = params; let screenshot = this._createScreenshot(invocation); if (!screenshot) return; - screenshot.screenshot_window (include_frame, include_cursor, filename, + screenshot.screenshot_window (includeFrame, includeCursor, filename, (o, res) => { try { let [result, area, filenameUsed] = @@ -143,11 +143,11 @@ var ScreenshotService = class { } ScreenshotAsync(params, invocation) { - let [include_cursor, flash, filename] = params; + let [includeCursor, flash, filename] = params; let screenshot = this._createScreenshot(invocation); if (!screenshot) return; - screenshot.screenshot(include_cursor, filename, + screenshot.screenshot(includeCursor, filename, (o, res) => { try { let [result, area, filenameUsed] = diff --git a/js/ui/status/accessibility.js b/js/ui/status/accessibility.js index 6064a4f6b..db9b5b327 100644 --- a/js/ui/status/accessibility.js +++ b/js/ui/status/accessibility.js @@ -99,13 +99,13 @@ class ATIndicator extends PanelMenu.Button { GLib.Source.set_name_by_id(this._syncMenuVisibilityIdle, '[gnome-shell] this._syncMenuVisibility'); } - _buildItemExtended(string, initial_value, writable, on_set) { - let widget = new PopupMenu.PopupSwitchMenuItem(string, initial_value); + _buildItemExtended(string, initialValue, writable, onSet) { + let widget = new PopupMenu.PopupSwitchMenuItem(string, initialValue); if (!writable) widget.actor.reactive = false; else widget.connect('toggled', item => { - on_set(item.state); + onSet(item.state); }); return widget; } @@ -173,9 +173,9 @@ class ATIndicator extends PanelMenu.Button { _buildFontItem() { let settings = new Gio.Settings({ schema_id: DESKTOP_INTERFACE_SCHEMA }); let factor = settings.get_double(KEY_TEXT_SCALING_FACTOR); - let initial_setting = (factor > 1.0); + let initialSetting = (factor > 1.0); let widget = this._buildItemExtended(_("Large Text"), - initial_setting, + initialSetting, settings.is_writable(KEY_TEXT_SCALING_FACTOR), enabled => { if (enabled) diff --git a/js/ui/status/dwellClick.js b/js/ui/status/dwellClick.js index 0373bda28..6b5b623a0 100644 --- a/js/ui/status/dwellClick.js +++ b/js/ui/status/dwellClick.js @@ -71,9 +71,9 @@ class DwellClickIndicator extends PanelMenu.Button { this.menu.addAction(mode.name, this._setClickType.bind(this, mode), mode.icon); } - _updateClickType(manager, click_type) { + _updateClickType(manager, clickType) { for (let mode in DWELL_CLICK_MODES) { - if (DWELL_CLICK_MODES[mode].type == click_type) + if (DWELL_CLICK_MODES[mode].type == clickType) this._icon.icon_name = DWELL_CLICK_MODES[mode].icon; } } diff --git a/js/ui/status/network.js b/js/ui/status/network.js index 67cacba54..47a7c598a 100644 --- a/js/ui/status/network.js +++ b/js/ui/status/network.js @@ -937,19 +937,19 @@ class NMWirelessDialog extends ModalDialog.ModalDialog { return accessPoint._secType; let flags = accessPoint.flags; - let wpa_flags = accessPoint.wpa_flags; - let rsn_flags = accessPoint.rsn_flags; + let wpaFlags = accessPoint.wpa_flags; + let rsnFlags = accessPoint.rsn_flags; let type; - if (rsn_flags != NM80211ApSecurityFlags.NONE) { + if (rsnFlags != NM80211ApSecurityFlags.NONE) { /* RSN check first so that WPA+WPA2 APs are treated as RSN/WPA2 */ - if (rsn_flags & NM80211ApSecurityFlags.KEY_MGMT_802_1X) + if (rsnFlags & NM80211ApSecurityFlags.KEY_MGMT_802_1X) type = NMAccessPointSecurity.WPA2_ENT; - else if (rsn_flags & NM80211ApSecurityFlags.KEY_MGMT_PSK) + else if (rsnFlags & NM80211ApSecurityFlags.KEY_MGMT_PSK) type = NMAccessPointSecurity.WPA2_PSK; - } else if (wpa_flags != NM80211ApSecurityFlags.NONE) { - if (wpa_flags & NM80211ApSecurityFlags.KEY_MGMT_802_1X) + } else if (wpaFlags != NM80211ApSecurityFlags.NONE) { + if (wpaFlags & NM80211ApSecurityFlags.KEY_MGMT_802_1X) type = NMAccessPointSecurity.WPA_ENT; - else if (wpa_flags & NM80211ApSecurityFlags.KEY_MGMT_PSK) + else if (wpaFlags & NM80211ApSecurityFlags.KEY_MGMT_PSK) type = NMAccessPointSecurity.WPA_PSK; } else { if (flags & NM80211ApFlags.PRIVACY) diff --git a/js/ui/tweener.js b/js/ui/tweener.js index b4f7a8bcd..2edbdc8ef 100644 --- a/js/ui/tweener.js +++ b/js/ui/tweener.js @@ -173,13 +173,13 @@ var ClutterFrameTicker = class { this._onNewFrame(frame); }); - let perf_log = Shell.PerfLog.get_default(); - perf_log.define_event("tweener.framePrepareStart", - "Start of a new animation frame", - ""); - perf_log.define_event("tweener.framePrepareDone", - "Finished preparing frame", - ""); + let perfLog = Shell.PerfLog.get_default(); + perfLog.define_event("tweener.framePrepareStart", + "Start of a new animation frame", + ""); + perfLog.define_event("tweener.framePrepareDone", + "Finished preparing frame", + ""); } get FRAME_RATE() { @@ -196,11 +196,11 @@ var ClutterFrameTicker = class { this._startTime = GLib.get_monotonic_time() / 1000.0; // currentTime is in milliseconds - let perf_log = Shell.PerfLog.get_default(); + let perfLog = Shell.PerfLog.get_default(); this._currentTime = GLib.get_monotonic_time() / 1000.0 - this._startTime; - perf_log.event("tweener.framePrepareStart"); + perfLog.event("tweener.framePrepareStart"); this.emit('prepare-frame'); - perf_log.event("tweener.framePrepareDone"); + perfLog.event("tweener.framePrepareDone"); } getTime() { diff --git a/js/ui/xdndHandler.js b/js/ui/xdndHandler.js index 16741e3aa..fc84b7b98 100644 --- a/js/ui/xdndHandler.js +++ b/js/ui/xdndHandler.js @@ -62,14 +62,14 @@ var XdndHandler = class { if (!cursorWindow.get_meta_window().is_override_redirect()) return; - let constraint_position = new Clutter.BindConstraint({ coordinate: Clutter.BindCoordinate.POSITION, - source: cursorWindow }); + let constraintPosition = new Clutter.BindConstraint({ coordinate: Clutter.BindCoordinate.POSITION, + source: cursorWindow }); this._cursorWindowClone = new Clutter.Clone({ source: cursorWindow }); Main.uiGroup.add_actor(this._cursorWindowClone); // Make sure that the clone has the same position as the source - this._cursorWindowClone.add_constraint(constraint_position); + this._cursorWindowClone.add_constraint(constraintPosition); } else { if (this._cursorWindowClone) { this._cursorWindowClone.destroy();