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
This commit is contained in:
committed by
Florian Müllner
parent
fdc3dda484
commit
63c07bdc73
@@ -77,8 +77,8 @@ class ApplicationMenuItem extends PopupMenu.PopupBaseMenuItem {
|
|||||||
super.setActive(active, params);
|
super.setActive(active, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
setDragEnabled(enable) {
|
setDragEnabled(enabled) {
|
||||||
this._dragEnabled = enable;
|
this._dragEnabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
getDragActor() {
|
getDragActor() {
|
||||||
@@ -630,7 +630,7 @@ class ApplicationsButton extends PanelMenu.Button {
|
|||||||
this.applicationsByCategory[categoryId] = [];
|
this.applicationsByCategory[categoryId] = [];
|
||||||
this._loadCategory(categoryId, dir);
|
this._loadCategory(categoryId, dir);
|
||||||
if (this.applicationsByCategory[categoryId].length > 0) {
|
if (this.applicationsByCategory[categoryId].length > 0) {
|
||||||
let categoryMenuItem = new CategoryMenuItem(this, dir);
|
categoryMenuItem = new CategoryMenuItem(this, dir);
|
||||||
this.categoriesBox.add_actor(categoryMenuItem);
|
this.categoriesBox.add_actor(categoryMenuItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,13 +147,13 @@ const Widget = GObject.registerClass({
|
|||||||
grid.attach(dialog._spin, 1, 1, 1, 1);
|
grid.attach(dialog._spin, 1, 1, 1, 1);
|
||||||
dialog.get_content_area().add(grid);
|
dialog.get_content_area().add(grid);
|
||||||
|
|
||||||
dialog.connect('response', (dialog, id) => {
|
dialog.connect('response', (dlg, id) => {
|
||||||
if (id != Gtk.ResponseType.OK) {
|
if (id != Gtk.ResponseType.OK) {
|
||||||
dialog.destroy();
|
dialog.destroy();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let appInfo = dialog._appChooser.get_app_info();
|
appInfo = dialog._appChooser.get_app_info();
|
||||||
if (!appInfo)
|
if (!appInfo)
|
||||||
return;
|
return;
|
||||||
let index = Math.floor(dialog._spin.value);
|
let index = Math.floor(dialog._spin.value);
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ class NaturalLayoutStrategy extends Workspace.LayoutStrategy {
|
|||||||
let xSection = Math.round((rects[i].x - bounds.x) / (bounds.width / 3));
|
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 ySection = Math.round((rects[i].y - bounds.y) / (bounds.height / 3));
|
||||||
|
|
||||||
let iCenter = rects[i].center();
|
iCenter = rects[i].center();
|
||||||
diff[0] = 0;
|
diff[0] = 0;
|
||||||
diff[1] = 0;
|
diff[1] = 0;
|
||||||
if (xSection != 1 || ySection != 1) { // Remove this if you want the center to pull as well
|
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];
|
diff[1] = bounds.y + bounds.height - iCenter[1];
|
||||||
}
|
}
|
||||||
if (diff[0] != 0 || diff[1] != 0) {
|
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[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;
|
diff[1] *= WINDOW_PLACEMENT_NATURAL_ACCURACY / length / 2;
|
||||||
rects[i].translate(diff[0], diff[1]);
|
rects[i].translate(diff[0], diff[1]);
|
||||||
|
|||||||
@@ -41,9 +41,9 @@ class PlaceInfo {
|
|||||||
async _ensureMountAndLaunch(context, tryMount) {
|
async _ensureMountAndLaunch(context, tryMount) {
|
||||||
try {
|
try {
|
||||||
await this._launchDefaultForUri(this.file.get_uri(), context, null);
|
await this._launchDefaultForUri(this.file.get_uri(), context, null);
|
||||||
} catch (e) {
|
} catch (err) {
|
||||||
if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_MOUNTED)) {
|
if (!err.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_MOUNTED)) {
|
||||||
Main.notifyError(_('Failed to launch “%s”').format(this.name), e.message);
|
Main.notifyError(_('Failed to launch “%s”').format(this.name), err.message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -505,16 +505,16 @@ var PlacesManager = class {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
let duplicate = false;
|
let duplicate = false;
|
||||||
for (let i = 0; i < this._places.special.length; i++) {
|
for (let j = 0; i < this._places.special.length; j++) {
|
||||||
if (file.equal(this._places.special[i].file)) {
|
if (file.equal(this._places.special[j].file)) {
|
||||||
duplicate = true;
|
duplicate = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (duplicate)
|
if (duplicate)
|
||||||
continue;
|
continue;
|
||||||
for (let i = 0; i < bookmarks.length; i++) {
|
for (let j = 0; j < bookmarks.length; j++) {
|
||||||
if (file.equal(bookmarks[i].file)) {
|
if (file.equal(bookmarks[j].file)) {
|
||||||
duplicate = true;
|
duplicate = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -344,7 +344,7 @@ var WorkspaceIndicator = GObject.registerClass({
|
|||||||
let item = new PopupMenu.PopupMenuItem(name);
|
let item = new PopupMenu.PopupMenuItem(name);
|
||||||
item.workspaceId = i;
|
item.workspaceId = i;
|
||||||
|
|
||||||
item.connect('activate', (item, _event) => {
|
item.connect('activate', () => {
|
||||||
this._activate(item.workspaceId);
|
this._activate(item.workspaceId);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user