[gnome-shell-extensions] cleanup: Don't shadow variables
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions] cleanup: Don't shadow variables
- Date: Wed, 21 Aug 2019 17:21:42 +0000 (UTC)
commit 63c07bdc7320e5bacda23168476ee2f110441960
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Aug 7 04:05:17 2019 +0200
cleanup: Don't shadow variables
Having variables that share the same name in overlapping scopes is
confusing and error-prone, and is best avoided.
https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/91
extensions/apps-menu/extension.js | 6 +++---
extensions/auto-move-windows/prefs.js | 4 ++--
extensions/native-window-placement/extension.js | 4 ++--
extensions/places-menu/placeDisplay.js | 14 +++++++-------
extensions/window-list/workspaceIndicator.js | 2 +-
5 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
index e2c9a9c..d7e108d 100644
--- a/extensions/apps-menu/extension.js
+++ b/extensions/apps-menu/extension.js
@@ -77,8 +77,8 @@ class ApplicationMenuItem extends PopupMenu.PopupBaseMenuItem {
super.setActive(active, params);
}
- setDragEnabled(enable) {
- this._dragEnabled = enable;
+ setDragEnabled(enabled) {
+ this._dragEnabled = enabled;
}
getDragActor() {
@@ -630,7 +630,7 @@ class ApplicationsButton extends PanelMenu.Button {
this.applicationsByCategory[categoryId] = [];
this._loadCategory(categoryId, dir);
if (this.applicationsByCategory[categoryId].length > 0) {
- let categoryMenuItem = new CategoryMenuItem(this, dir);
+ categoryMenuItem = new CategoryMenuItem(this, dir);
this.categoriesBox.add_actor(categoryMenuItem);
}
}
diff --git a/extensions/auto-move-windows/prefs.js b/extensions/auto-move-windows/prefs.js
index bd20aab..f89a669 100644
--- a/extensions/auto-move-windows/prefs.js
+++ b/extensions/auto-move-windows/prefs.js
@@ -147,13 +147,13 @@ const Widget = GObject.registerClass({
grid.attach(dialog._spin, 1, 1, 1, 1);
dialog.get_content_area().add(grid);
- dialog.connect('response', (dialog, id) => {
+ dialog.connect('response', (dlg, id) => {
if (id != Gtk.ResponseType.OK) {
dialog.destroy();
return;
}
- let appInfo = dialog._appChooser.get_app_info();
+ appInfo = dialog._appChooser.get_app_info();
if (!appInfo)
return;
let index = Math.floor(dialog._spin.value);
diff --git a/extensions/native-window-placement/extension.js b/extensions/native-window-placement/extension.js
index 8d39d0f..383322f 100644
--- a/extensions/native-window-placement/extension.js
+++ b/extensions/native-window-placement/extension.js
@@ -157,7 +157,7 @@ class NaturalLayoutStrategy extends Workspace.LayoutStrategy {
let xSection = Math.round((rects[i].x - bounds.x) / (bounds.width / 3));
let ySection = Math.round((rects[i].y - bounds.y) / (bounds.height / 3));
- let iCenter = rects[i].center();
+ iCenter = rects[i].center();
diff[0] = 0;
diff[1] = 0;
if (xSection != 1 || ySection != 1) { // Remove this if you want the center to
pull as well
@@ -183,7 +183,7 @@ class NaturalLayoutStrategy extends Workspace.LayoutStrategy {
diff[1] = bounds.y + bounds.height - iCenter[1];
}
if (diff[0] != 0 || diff[1] != 0) {
- let length = Math.sqrt(diff[0] * diff[0] + diff[1] * diff[1]);
+ length = Math.sqrt(diff[0] * diff[0] + diff[1] * diff[1]);
diff[0] *= WINDOW_PLACEMENT_NATURAL_ACCURACY / length / 2; // /2 to make
it less influencing than the normal center-move above
diff[1] *= WINDOW_PLACEMENT_NATURAL_ACCURACY / length / 2;
rects[i].translate(diff[0], diff[1]);
diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js
index add57be..03189b9 100644
--- a/extensions/places-menu/placeDisplay.js
+++ b/extensions/places-menu/placeDisplay.js
@@ -41,9 +41,9 @@ class PlaceInfo {
async _ensureMountAndLaunch(context, tryMount) {
try {
await this._launchDefaultForUri(this.file.get_uri(), context, null);
- } catch (e) {
- if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_MOUNTED)) {
- Main.notifyError(_('Failed to launch “%sâ€').format(this.name), e.message);
+ } catch (err) {
+ if (!err.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_MOUNTED)) {
+ Main.notifyError(_('Failed to launch “%sâ€').format(this.name), err.message);
return;
}
@@ -505,16 +505,16 @@ var PlacesManager = class {
continue;
let duplicate = false;
- for (let i = 0; i < this._places.special.length; i++) {
- if (file.equal(this._places.special[i].file)) {
+ for (let j = 0; i < this._places.special.length; j++) {
+ if (file.equal(this._places.special[j].file)) {
duplicate = true;
break;
}
}
if (duplicate)
continue;
- for (let i = 0; i < bookmarks.length; i++) {
- if (file.equal(bookmarks[i].file)) {
+ for (let j = 0; j < bookmarks.length; j++) {
+ if (file.equal(bookmarks[j].file)) {
duplicate = true;
break;
}
diff --git a/extensions/window-list/workspaceIndicator.js b/extensions/window-list/workspaceIndicator.js
index 84dccac..33b2e49 100644
--- a/extensions/window-list/workspaceIndicator.js
+++ b/extensions/window-list/workspaceIndicator.js
@@ -344,7 +344,7 @@ var WorkspaceIndicator = GObject.registerClass({
let item = new PopupMenu.PopupMenuItem(name);
item.workspaceId = i;
- item.connect('activate', (item, _event) => {
+ item.connect('activate', () => {
this._activate(item.workspaceId);
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]