style: Use camelCase for variable names

Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/607
This commit is contained in:
Florian Müllner 2019-01-31 14:43:52 +01:00
parent 8fda3116f0
commit 4c5206954a
20 changed files with 100 additions and 100 deletions

View File

@ -26,33 +26,33 @@ function _getMobileProvidersDatabase() {
} }
// _findProviderForMccMnc: // _findProviderForMccMnc:
// @operator_name: operator name // @operatorName: operator name
// @operator_code: operator code // @operatorCode: operator code
// //
// Given an operator name string (which may not be a real operator name) and an // 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. // operator code string, tries to find a proper operator name to display.
// //
function _findProviderForMccMnc(operator_name, operator_code) { function _findProviderForMccMnc(operatorName, operatorCode) {
if (operator_name) { if (operatorName) {
if (operator_name.length != 0 && if (operatorName.length != 0 &&
(operator_name.length > 6 || operator_name.length < 5)) { (operatorName.length > 6 || operatorName.length < 5)) {
// this looks like a valid name, i.e. not an MCCMNC (that some // this looks like a valid name, i.e. not an MCCMNC (that some
// devices return when not yet connected // 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 // name is definitely not a MCCMNC, so it may be a name
// after all; return that // after all; return that
return operator_name; return operatorName;
} }
} }
let needle; let needle;
if ((!operator_name || operator_name.length == 0) && operator_code) if ((!operatorName || operatorName.length == 0) && operatorCode)
needle = operator_code; needle = operatorCode;
else if (operator_name && (operator_name.length == 6 || operator_name.length == 5)) else if (operatorName && (operatorName.length == 6 || operatorName.length == 5))
needle = operator_name; needle = operatorName;
else // nothing to search else // nothing to search
return null; return null;
@ -230,17 +230,17 @@ var BroadbandModem = class {
} }
_reloadOperatorName() { _reloadOperatorName() {
let new_name = ""; let newName = "";
if (this.operator_name_3gpp && this.operator_name_3gpp.length > 0) 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 (this.operator_name_cdma && this.operator_name_cdma.length > 0) {
if (new_name != "") if (newName != "")
new_name += ", "; newName += ", ";
new_name += this.operator_name_cdma; newName += this.operator_name_cdma;
} }
this.operator_name = new_name; this.operator_name = newName;
this.emit('notify::operator-name'); this.emit('notify::operator-name');
} }

View File

@ -69,16 +69,16 @@ function spawn(argv) {
} }
// spawnCommandLine: // 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. // occur when trying to parse or start the program.
function spawnCommandLine(command_line) { function spawnCommandLine(commandLine) {
try { try {
let [success, argv] = GLib.shell_parse_argv(command_line); let [success, argv] = GLib.shell_parse_argv(commandLine);
trySpawn(argv); trySpawn(argv);
} catch (err) { } catch (err) {
_handleSpawnError(command_line, err); _handleSpawnError(commandLine, err);
} }
} }
@ -134,15 +134,15 @@ function trySpawn(argv) {
} }
// trySpawnCommandLine: // 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. // fails, this will throw an error.
function trySpawnCommandLine(command_line) { function trySpawnCommandLine(commandLine) {
let success, argv; let success, argv;
try { try {
[success, argv] = GLib.shell_parse_argv(command_line); [success, argv] = GLib.shell_parse_argv(commandLine);
} catch (err) { } catch (err) {
// Replace "Error invoking GLib.shell_parse_argv: " with // Replace "Error invoking GLib.shell_parse_argv: " with
// something nicer // something nicer

View File

@ -62,9 +62,9 @@ var Animation = class {
if (!validResourceScale) if (!validResourceScale)
return; 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; let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
this._animations = texture_cache.load_sliced_image(file, width, height, this._animations = textureCache.load_sliced_image(file, width, height,
scaleFactor, resourceScale, scaleFactor, resourceScale,
this._animationsLoaded.bind(this)); this._animationsLoaded.bind(this));
this.actor.set_child(this._animations); this.actor.set_child(this._animations);

View File

@ -250,14 +250,14 @@ var AuthenticationDialog = GObject.registerClass({
} }
} }
_onSessionRequest(session, request, echo_on) { _onSessionRequest(session, request, echoOn) {
// Cheap localization trick // Cheap localization trick
if (request == 'Password:' || request == 'Password: ') if (request == 'Password:' || request == 'Password: ')
this._passwordLabel.set_text(_("Password:")); this._passwordLabel.set_text(_("Password:"));
else else
this._passwordLabel.set_text(request); this._passwordLabel.set_text(request);
if (echo_on) if (echoOn)
this._passwordEntry.clutter_text.set_password_char(''); this._passwordEntry.clutter_text.set_password_char('');
else else
this._passwordEntry.clutter_text.set_password_char('\u25cf'); // ● U+25CF BLACK CIRCLE this._passwordEntry.clutter_text.set_password_char('\u25cf'); // ● U+25CF BLACK CIRCLE

View File

@ -181,7 +181,7 @@ class TelepathyClient extends Tp.BaseClient {
} }
vfunc_handle_channels(...args) { 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); this._handlingChannels(account, conn, channels, true);
context.accept(); context.accept();
} }

View File

@ -1442,8 +1442,8 @@ var Keyboard = class Keyboard {
numOfVertSlots = rows.length; numOfVertSlots = rows.length;
for (let i = 0; i < rows.length; ++i) { for (let i = 0; i < rows.length; ++i) {
let keyboard_row = rows[i]; let keyboardRow = rows[i];
let keys = keyboard_row.get_children(); let keys = keyboardRow.get_children();
numOfHorizSlots = Math.max(numOfHorizSlots, keys.length); numOfHorizSlots = Math.max(numOfHorizSlots, keys.length);
} }

View File

@ -147,13 +147,13 @@ var MonitorConstraint = GObject.registerClass({
}); });
var Monitor = class Monitor { var Monitor = class Monitor {
constructor(index, geometry, geometry_scale) { constructor(index, geometry, geometryScale) {
this.index = index; this.index = index;
this.x = geometry.x; this.x = geometry.x;
this.y = geometry.y; this.y = geometry.y;
this.width = geometry.width; this.width = geometry.width;
this.height = geometry.height; this.height = geometry.height;
this.geometry_scale = geometry_scale; this.geometry_scale = geometryScale;
} }
get inFullscreen() { get inFullscreen() {

View File

@ -135,17 +135,17 @@ var URLHighlighter = class URLHighlighter {
let success; let success;
let [x, y] = event.get_coords(); let [x, y] = event.get_coords();
[success, x, y] = this.actor.transform_stage_point(x, y); [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++) { 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); let [success, px, py, lineHeight] = this.actor.clutter_text.position_to_coords(i);
if (py > y || py + line_height < y || x < px) if (py > y || py + lineHeight < y || x < px)
continue; continue;
find_pos = i; findPos = i;
} }
if (find_pos != -1) { if (findPos != -1) {
for (let i = 0; i < this._urls.length; i++) for (let i = 0; i < this._urls.length; i++)
if (find_pos >= this._urls[i].pos && if (findPos >= this._urls[i].pos &&
this._urls[i].pos + this._urls[i].url.length > find_pos) this._urls[i].pos + this._urls[i].url.length > findPos)
return i; return i;
} }
return -1; return -1;

View File

@ -590,11 +590,11 @@ class SourceActor extends St.Widget {
}); });
this._actorDestroyed = false; 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, this._iconBin = new St.Bin({ x_fill: true,
x_expand: true, x_expand: true,
height: size * scale_factor, height: size * scaleFactor,
width: size * scale_factor }); width: size * scaleFactor });
this.add_actor(this._iconBin); this.add_actor(this._iconBin);

View File

@ -170,11 +170,11 @@ var FdoNotificationDaemon = class FdoNotificationDaemon {
// Ignore replacesId since we already sent back a // Ignore replacesId since we already sent back a
// NotificationClosed for that id. // NotificationClosed for that id.
id = this._nextNotificationId++; id = this._nextNotificationId++;
let idle_id = Mainloop.idle_add(() => { let idleId = Mainloop.idle_add(() => {
this._emitNotificationClosed(id, NotificationClosedReason.DISMISSED); this._emitNotificationClosed(id, NotificationClosedReason.DISMISSED);
return GLib.SOURCE_REMOVE; 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])); return invocation.return_value(GLib.Variant.new('(u)', [id]));
} }

View File

@ -650,14 +650,14 @@ var PopupMenuBase = class {
} }
addMenuItem(menuItem, position) { addMenuItem(menuItem, position) {
let before_item = null; let beforeItem = null;
if (position == undefined) { if (position == undefined) {
this.box.add(menuItem.actor); this.box.add(menuItem.actor);
} else { } else {
let items = this._getMenuItems(); let items = this._getMenuItems();
if (position < items.length) { if (position < items.length) {
before_item = items[position].actor; beforeItem = items[position].actor;
this.box.insert_child_below(menuItem.actor, before_item); this.box.insert_child_below(menuItem.actor, beforeItem);
} else { } else {
this.box.add(menuItem.actor); this.box.add(menuItem.actor);
} }
@ -687,10 +687,10 @@ var PopupMenuBase = class {
this.length--; this.length--;
}); });
} else if (menuItem instanceof PopupSubMenuMenuItem) { } else if (menuItem instanceof PopupSubMenuMenuItem) {
if (before_item == null) if (beforeItem == null)
this.box.add(menuItem.menu.actor); this.box.add(menuItem.menu.actor);
else else
this.box.insert_child_below(menuItem.menu.actor, before_item); this.box.insert_child_below(menuItem.menu.actor, beforeItem);
this._connectItemSignals(menuItem); this._connectItemSignals(menuItem);
let subMenuActiveChangeId = menuItem.menu.connect('active-changed', this._subMenuActiveChanged.bind(this)); let subMenuActiveChangeId = menuItem.menu.connect('active-changed', this._subMenuActiveChanged.bind(this));

View File

@ -191,18 +191,18 @@ var RemoteSearchProvider = class {
if (!proxyInfo) if (!proxyInfo)
proxyInfo = SearchProviderProxyInfo; proxyInfo = SearchProviderProxyInfo;
let g_flags = Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES; let gFlags = Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES;
if (autoStart) if (autoStart)
g_flags |= Gio.DBusProxyFlags.DO_NOT_AUTO_START_AT_CONSTRUCTION; gFlags |= Gio.DBusProxyFlags.DO_NOT_AUTO_START_AT_CONSTRUCTION;
else 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, this.proxy = new Gio.DBusProxy({ g_bus_type: Gio.BusType.SESSION,
g_name: dbusName, g_name: dbusName,
g_object_path: dbusPath, g_object_path: dbusPath,
g_interface_info: proxyInfo, g_interface_info: proxyInfo,
g_interface_name: proxyInfo.name, g_interface_name: proxyInfo.name,
g_flags }); gFlags });
this.proxy.init_async(GLib.PRIORITY_DEFAULT, null, null); this.proxy.init_async(GLib.PRIORITY_DEFAULT, null, null);
this.appInfo = appInfo; this.appInfo = appInfo;

View File

@ -202,8 +202,8 @@ class RunDialog extends ModalDialog.ModalDialog {
try { try {
if (inTerminal) { if (inTerminal) {
let exec = this._terminalSettings.get_string(EXEC_KEY); let exec = this._terminalSettings.get_string(EXEC_KEY);
let exec_arg = this._terminalSettings.get_string(EXEC_ARG_KEY); let execArg = this._terminalSettings.get_string(EXEC_ARG_KEY);
command = exec + ' ' + exec_arg + ' ' + input; command = exec + ' ' + execArg + ' ' + input;
} }
Util.trySpawnCommandLine(command); Util.trySpawnCommandLine(command);
} catch (e) { } catch (e) {

View File

@ -381,11 +381,11 @@ class ScreenShieldArrow extends St.Bin {
if (!this._shadow) if (!this._shadow)
return true; return true;
let shadow_box = new Clutter.ActorBox(); let shadowBox = new Clutter.ActorBox();
this._shadow.get_box(this._drawingArea.get_allocation_box(), shadow_box); 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_width(Math.max(shadowBox.x2 - shadowBox.x1, volume.get_width()));
volume.set_height(Math.max(shadow_box.y2 - shadow_box.y1, volume.get_height())); volume.set_height(Math.max(shadowBox.y2 - shadowBox.y1, volume.get_height()));
return true; return true;
} }
@ -933,9 +933,9 @@ var ScreenShield = class {
// if velocity is specified, it's in pixels per milliseconds // if velocity is specified, it's in pixels per milliseconds
let h = global.stage.height; let h = global.stage.height;
let delta = (h + this._lockScreenGroup.y); 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; let time = (delta / velocity) / 1000;
Tweener.addTween(this._lockScreenGroup, Tweener.addTween(this._lockScreenGroup,

View File

@ -125,11 +125,11 @@ var ScreenshotService = class {
} }
ScreenshotWindowAsync(params, invocation) { ScreenshotWindowAsync(params, invocation) {
let [include_frame, include_cursor, flash, filename] = params; let [includeFrame, includeCursor, flash, filename] = params;
let screenshot = this._createScreenshot(invocation); let screenshot = this._createScreenshot(invocation);
if (!screenshot) if (!screenshot)
return; return;
screenshot.screenshot_window (include_frame, include_cursor, filename, screenshot.screenshot_window (includeFrame, includeCursor, filename,
(o, res) => { (o, res) => {
try { try {
let [result, area, filenameUsed] = let [result, area, filenameUsed] =
@ -143,11 +143,11 @@ var ScreenshotService = class {
} }
ScreenshotAsync(params, invocation) { ScreenshotAsync(params, invocation) {
let [include_cursor, flash, filename] = params; let [includeCursor, flash, filename] = params;
let screenshot = this._createScreenshot(invocation); let screenshot = this._createScreenshot(invocation);
if (!screenshot) if (!screenshot)
return; return;
screenshot.screenshot(include_cursor, filename, screenshot.screenshot(includeCursor, filename,
(o, res) => { (o, res) => {
try { try {
let [result, area, filenameUsed] = let [result, area, filenameUsed] =

View File

@ -99,13 +99,13 @@ class ATIndicator extends PanelMenu.Button {
GLib.Source.set_name_by_id(this._syncMenuVisibilityIdle, '[gnome-shell] this._syncMenuVisibility'); GLib.Source.set_name_by_id(this._syncMenuVisibilityIdle, '[gnome-shell] this._syncMenuVisibility');
} }
_buildItemExtended(string, initial_value, writable, on_set) { _buildItemExtended(string, initialValue, writable, onSet) {
let widget = new PopupMenu.PopupSwitchMenuItem(string, initial_value); let widget = new PopupMenu.PopupSwitchMenuItem(string, initialValue);
if (!writable) if (!writable)
widget.actor.reactive = false; widget.actor.reactive = false;
else else
widget.connect('toggled', item => { widget.connect('toggled', item => {
on_set(item.state); onSet(item.state);
}); });
return widget; return widget;
} }
@ -173,9 +173,9 @@ class ATIndicator extends PanelMenu.Button {
_buildFontItem() { _buildFontItem() {
let settings = new Gio.Settings({ schema_id: DESKTOP_INTERFACE_SCHEMA }); let settings = new Gio.Settings({ schema_id: DESKTOP_INTERFACE_SCHEMA });
let factor = settings.get_double(KEY_TEXT_SCALING_FACTOR); 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"), let widget = this._buildItemExtended(_("Large Text"),
initial_setting, initialSetting,
settings.is_writable(KEY_TEXT_SCALING_FACTOR), settings.is_writable(KEY_TEXT_SCALING_FACTOR),
enabled => { enabled => {
if (enabled) if (enabled)

View File

@ -71,9 +71,9 @@ class DwellClickIndicator extends PanelMenu.Button {
this.menu.addAction(mode.name, this._setClickType.bind(this, mode), mode.icon); 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) { 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; this._icon.icon_name = DWELL_CLICK_MODES[mode].icon;
} }
} }

View File

@ -937,19 +937,19 @@ class NMWirelessDialog extends ModalDialog.ModalDialog {
return accessPoint._secType; return accessPoint._secType;
let flags = accessPoint.flags; let flags = accessPoint.flags;
let wpa_flags = accessPoint.wpa_flags; let wpaFlags = accessPoint.wpa_flags;
let rsn_flags = accessPoint.rsn_flags; let rsnFlags = accessPoint.rsn_flags;
let type; let type;
if (rsn_flags != NM80211ApSecurityFlags.NONE) { if (rsnFlags != NM80211ApSecurityFlags.NONE) {
/* RSN check first so that WPA+WPA2 APs are treated as RSN/WPA2 */ /* 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; type = NMAccessPointSecurity.WPA2_ENT;
else if (rsn_flags & NM80211ApSecurityFlags.KEY_MGMT_PSK) else if (rsnFlags & NM80211ApSecurityFlags.KEY_MGMT_PSK)
type = NMAccessPointSecurity.WPA2_PSK; type = NMAccessPointSecurity.WPA2_PSK;
} else if (wpa_flags != NM80211ApSecurityFlags.NONE) { } else if (wpaFlags != NM80211ApSecurityFlags.NONE) {
if (wpa_flags & NM80211ApSecurityFlags.KEY_MGMT_802_1X) if (wpaFlags & NM80211ApSecurityFlags.KEY_MGMT_802_1X)
type = NMAccessPointSecurity.WPA_ENT; type = NMAccessPointSecurity.WPA_ENT;
else if (wpa_flags & NM80211ApSecurityFlags.KEY_MGMT_PSK) else if (wpaFlags & NM80211ApSecurityFlags.KEY_MGMT_PSK)
type = NMAccessPointSecurity.WPA_PSK; type = NMAccessPointSecurity.WPA_PSK;
} else { } else {
if (flags & NM80211ApFlags.PRIVACY) if (flags & NM80211ApFlags.PRIVACY)

View File

@ -173,11 +173,11 @@ var ClutterFrameTicker = class {
this._onNewFrame(frame); this._onNewFrame(frame);
}); });
let perf_log = Shell.PerfLog.get_default(); let perfLog = Shell.PerfLog.get_default();
perf_log.define_event("tweener.framePrepareStart", perfLog.define_event("tweener.framePrepareStart",
"Start of a new animation frame", "Start of a new animation frame",
""); "");
perf_log.define_event("tweener.framePrepareDone", perfLog.define_event("tweener.framePrepareDone",
"Finished preparing frame", "Finished preparing frame",
""); "");
} }
@ -196,11 +196,11 @@ var ClutterFrameTicker = class {
this._startTime = GLib.get_monotonic_time() / 1000.0; this._startTime = GLib.get_monotonic_time() / 1000.0;
// currentTime is in milliseconds // 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; this._currentTime = GLib.get_monotonic_time() / 1000.0 - this._startTime;
perf_log.event("tweener.framePrepareStart"); perfLog.event("tweener.framePrepareStart");
this.emit('prepare-frame'); this.emit('prepare-frame');
perf_log.event("tweener.framePrepareDone"); perfLog.event("tweener.framePrepareDone");
} }
getTime() { getTime() {

View File

@ -62,14 +62,14 @@ var XdndHandler = class {
if (!cursorWindow.get_meta_window().is_override_redirect()) if (!cursorWindow.get_meta_window().is_override_redirect())
return; return;
let constraint_position = new Clutter.BindConstraint({ coordinate: Clutter.BindCoordinate.POSITION, let constraintPosition = new Clutter.BindConstraint({ coordinate: Clutter.BindCoordinate.POSITION,
source: cursorWindow }); source: cursorWindow });
this._cursorWindowClone = new Clutter.Clone({ source: cursorWindow }); this._cursorWindowClone = new Clutter.Clone({ source: cursorWindow });
Main.uiGroup.add_actor(this._cursorWindowClone); Main.uiGroup.add_actor(this._cursorWindowClone);
// Make sure that the clone has the same position as the source // Make sure that the clone has the same position as the source
this._cursorWindowClone.add_constraint(constraint_position); this._cursorWindowClone.add_constraint(constraintPosition);
} else { } else {
if (this._cursorWindowClone) { if (this._cursorWindowClone) {
this._cursorWindowClone.destroy(); this._cursorWindowClone.destroy();