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:
// @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');
}

View File

@ -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

View File

@ -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);
}

View File

@ -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

View File

@ -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();
}

View File

@ -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);
}

View File

@ -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() {

View File

@ -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;

View File

@ -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);

View File

@ -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]));
}

View File

@ -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));

View File

@ -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;

View File

@ -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) {

View File

@ -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,

View File

@ -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] =

View File

@ -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)

View File

@ -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;
}
}

View File

@ -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)

View File

@ -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() {

View File

@ -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();