[gnome-shell] cleanup: Don't shadow variables



commit 682bd7e97ce956bed45d137812d569aaa58c55be
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Aug 20 02:20:08 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/merge_requests/805

 js/gdm/loginDialog.js                |  2 +-
 js/misc/ibusManager.js               |  4 ++--
 js/misc/loginManager.js              |  4 ++--
 js/misc/util.js                      |  2 +-
 js/misc/weather.js                   |  8 ++++----
 js/ui/appDisplay.js                  |  2 +-
 js/ui/background.js                  |  2 +-
 js/ui/backgroundMenu.js              |  2 +-
 js/ui/calendar.js                    |  4 ++--
 js/ui/components/automountManager.js |  4 ++--
 js/ui/components/autorunManager.js   |  5 +++--
 js/ui/components/telepathyClient.js  |  2 +-
 js/ui/dash.js                        |  2 +-
 js/ui/dnd.js                         |  2 +-
 js/ui/extensionDownloader.js         | 21 ++++++++++-----------
 js/ui/extensionSystem.js             | 12 ++++++------
 js/ui/inhibitShortcutsDialog.js      |  6 +++---
 js/ui/layout.js                      |  3 +--
 js/ui/lookingGlass.js                |  8 ++++----
 js/ui/main.js                        |  2 +-
 js/ui/notificationDaemon.js          |  2 +-
 js/ui/pointerA11yTimeout.js          |  4 ++--
 js/ui/popupMenu.js                   |  8 ++++----
 js/ui/runDialog.js                   |  4 ++--
 js/ui/screenShield.js                |  6 +++---
 js/ui/screenshot.js                  |  4 ++--
 js/ui/status/accessibility.js        |  2 +-
 js/ui/status/keyboard.js             | 10 +++++-----
 js/ui/status/network.js              |  6 +++---
 js/ui/status/remoteAccess.js         |  2 +-
 js/ui/switcherPopup.js               |  2 +-
 js/ui/windowAttentionHandler.js      |  2 +-
 js/ui/windowManager.js               | 20 ++++++++++----------
 js/ui/workspaceThumbnail.js          |  2 +-
 34 files changed, 85 insertions(+), 86 deletions(-)
---
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
index 74b239413d..e9cd564c88 100644
--- a/js/gdm/loginDialog.js
+++ b/js/gdm/loginDialog.js
@@ -984,7 +984,7 @@ var LoginDialog = GObject.registerClass({
         let hold = new Batch.Hold();
         let signalId = this._userList.connect('item-added',
             () => {
-                let item = this._userList.getItemFromUserName(userName);
+                item = this._userList.getItemFromUserName(userName);
 
                 if (item)
                     hold.release();
diff --git a/js/misc/ibusManager.js b/js/misc/ibusManager.js
index e43f88c7ce..9b0aebb5f9 100644
--- a/js/misc/ibusManager.js
+++ b/js/misc/ibusManager.js
@@ -157,10 +157,10 @@ var IBusManager = class {
             } catch (e) {
             }
             // If an engine is already active we need to get its properties
-            this._ibus.get_global_engine_async(-1, this._cancellable, (_bus, result) => {
+            this._ibus.get_global_engine_async(-1, this._cancellable, (_bus, res) => {
                 let engine;
                 try {
-                    engine = this._ibus.get_global_engine_async_finish(result);
+                    engine = this._ibus.get_global_engine_async_finish(res);
                     if (!engine)
                         return;
                 } catch (e) {
diff --git a/js/misc/loginManager.js b/js/misc/loginManager.js
index f1ab2572f5..bbcf0022c0 100644
--- a/js/misc/loginManager.js
+++ b/js/misc/loginManager.js
@@ -110,14 +110,14 @@ var LoginManagerSystemd = class {
         let sessionId = GLib.getenv('XDG_SESSION_ID');
         if (!sessionId) {
             log('Unset XDG_SESSION_ID, getCurrentSessionProxy() called outside a user session. Asking logind 
directly.');
-            let [session, objectPath_] = this._userProxy.Display;
+            let [session, objectPath] = this._userProxy.Display;
             if (session) {
                 log(`Will monitor session ${session}`);
                 sessionId = session;
             } else {
                 log('Failed to find "Display" session; are we the greeter?');
 
-                for (let [session, objectPath] of this._userProxy.Sessions) {
+                for ([session, objectPath] of this._userProxy.Sessions) {
                     let sessionProxy = new SystemdLoginSession(Gio.DBus.system,
                                                                'org.freedesktop.login1',
                                                                objectPath);
diff --git a/js/misc/util.js b/js/misc/util.js
index bdffffc529..7d5874bef3 100644
--- a/js/misc/util.js
+++ b/js/misc/util.js
@@ -405,7 +405,7 @@ function ensureActorVisibleInScrollView(scrollView, actor) {
         if (!parent)
             throw new Error("actor not in scroll view");
 
-        let box = parent.get_allocation_box();
+        box = parent.get_allocation_box();
         y1 += box.y1;
         y2 += box.y1;
         parent = parent.get_parent();
diff --git a/js/misc/weather.js b/js/misc/weather.js
index 51dd8acde8..b22cac17f1 100644
--- a/js/misc/weather.js
+++ b/js/misc/weather.js
@@ -47,11 +47,11 @@ var WeatherClient = class {
                 return;
             }
 
-            this._permStore.LookupRemote('gnome', 'geolocation', (res, error) => {
-                if (error)
-                    log(`Error looking up permission: ${error.message}`);
+            this._permStore.LookupRemote('gnome', 'geolocation', (res, err) => {
+                if (err)
+                    log(`Error looking up permission: ${err.message}`);
 
-                let [perms, data] = error ? [{}, null] : res;
+                let [perms, data] = err ? [{}, null] : res;
                 let  params = ['gnome', 'geolocation', false, data, perms];
                 this._onPermStoreChanged(this._permStore, '', params);
             });
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index f205519591..9193c121be 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -673,7 +673,7 @@ var AllView = GObject.registerClass({
 
     addFolderPopup(popup) {
         this._stack.add_actor(popup);
-        popup.connect('open-state-changed', (popup, isOpen) => {
+        popup.connect('open-state-changed', (o, isOpen) => {
             this._eventBlocker.reactive = isOpen;
 
             if (this._currentPopup) {
diff --git a/js/ui/background.js b/js/ui/background.js
index b7b69482fd..9302cedea8 100644
--- a/js/ui/background.js
+++ b/js/ui/background.js
@@ -145,7 +145,7 @@ var BackgroundCache = class BackgroundCache {
 
         let monitor = file.monitor(Gio.FileMonitorFlags.NONE, null);
         monitor.connect('changed',
-                        (obj, file, otherFile, eventType) => {
+                        (obj, theFile, otherFile, eventType) => {
                             // Ignore CHANGED and CREATED events, since in both cases
                             // we'll get a CHANGES_DONE_HINT event when done.
                             if (eventType != Gio.FileMonitorEvent.CHANGED &&
diff --git a/js/ui/backgroundMenu.js b/js/ui/backgroundMenu.js
index ec39d1290b..33e9416cbd 100644
--- a/js/ui/backgroundMenu.js
+++ b/js/ui/backgroundMenu.js
@@ -35,7 +35,7 @@ function addBackgroundMenu(actor, layoutManager) {
     }
 
     let clickAction = new Clutter.ClickAction();
-    clickAction.connect('long-press', (action, actor, state) => {
+    clickAction.connect('long-press', (action, theActor, state) => {
         if (state == Clutter.LongPressState.QUERY)
             return ((action.get_button() == 0 ||
                      action.get_button() == 1) &&
diff --git a/js/ui/calendar.js b/js/ui/calendar.js
index 03611a3abd..40d49cc6ba 100644
--- a/js/ui/calendar.js
+++ b/js/ui/calendar.js
@@ -996,7 +996,7 @@ class NotificationSection extends MessageList.MessageListSection {
             notificationAddedId: 0,
         };
 
-        obj.destroyId = source.connect('destroy', source => {
+        obj.destroyId = source.connect('destroy', () => {
             this._onSourceDestroy(source, obj);
         });
         obj.notificationAddedId = source.connect('notification-added',
@@ -1170,7 +1170,7 @@ class CalendarMessageList extends St.Widget {
             Util.ensureActorVisibleInScrollView(this._scrollView, messageActor);
         }));
 
-        connectionsIds.push(section.connect('destroy', (section) => {
+        connectionsIds.push(section.connect('destroy', () => {
             connectionsIds.forEach(id => section.disconnect(id));
             this._sectionList.remove_actor(section);
         }));
diff --git a/js/ui/components/automountManager.js b/js/ui/components/automountManager.js
index 6d46a1e23d..467829f735 100644
--- a/js/ui/components/automountManager.js
+++ b/js/ui/components/automountManager.js
@@ -109,7 +109,7 @@ var AutomountManager = class {
         // mount operation object
         if (drive.can_stop()) {
             drive.stop(Gio.MountUnmountFlags.FORCE, null, null,
-                (drive, res) => {
+                (o, res) => {
                     try {
                         drive.stop_finish(res);
                     } catch (e) {
@@ -118,7 +118,7 @@ var AutomountManager = class {
                 });
         } else if (drive.can_eject()) {
             drive.eject_with_operation(Gio.MountUnmountFlags.FORCE, null, null,
-                (drive, res) => {
+                (o, res) => {
                     try {
                         drive.eject_with_operation_finish(res);
                     } catch (e) {
diff --git a/js/ui/components/autorunManager.js b/js/ui/components/autorunManager.js
index 222d34751d..cf5acb83c4 100644
--- a/js/ui/components/autorunManager.js
+++ b/js/ui/components/autorunManager.js
@@ -115,7 +115,8 @@ var ContentTypeDiscoverer = class {
 
             let hotplugSniffer = new HotplugSniffer();
             hotplugSniffer.SniffURIRemote(root.get_uri(),
-                ([contentTypes]) => {
+                result => {
+                    [contentTypes] = result;
                     this._emitCallback(mount, contentTypes);
                 });
         }
@@ -166,7 +167,7 @@ var AutorunManager = class {
         if (!this._session.SessionIsActive)
             return;
 
-        let discoverer = new ContentTypeDiscoverer((mount, apps, contentTypes) => {
+        let discoverer = new ContentTypeDiscoverer((m, apps, contentTypes) => {
             this._dispatcher.addMount(mount, apps, contentTypes);
         });
         discoverer.guessContentTypes(mount);
diff --git a/js/ui/components/telepathyClient.js b/js/ui/components/telepathyClient.js
index 68d4f53ab2..75ccb897ac 100644
--- a/js/ui/components/telepathyClient.js
+++ b/js/ui/components/telepathyClient.js
@@ -248,7 +248,7 @@ class TelepathyClient extends Tp.BaseClient {
         }
 
         // Approve private text channels right away as we are going to handle it
-        dispatchOp.claim_with_async(this, (dispatchOp, result) => {
+        dispatchOp.claim_with_async(this, (o, result) => {
             try {
                 dispatchOp.claim_with_finish(result);
                 this._handlingChannels(account, conn, [channel], false);
diff --git a/js/ui/dash.js b/js/ui/dash.js
index 4b72ec4087..17b864ed89 100644
--- a/js/ui/dash.js
+++ b/js/ui/dash.js
@@ -481,7 +481,7 @@ var Dash = GObject.registerClass({
         let appIcon = new DashIcon(app);
 
         appIcon.connect('menu-state-changed',
-                        (appIcon, opened) => {
+                        (o, opened) => {
                             this._itemMenuStateChanged(item, opened);
                         });
 
diff --git a/js/ui/dnd.js b/js/ui/dnd.js
index 30da86be63..d9abb04505 100644
--- a/js/ui/dnd.js
+++ b/js/ui/dnd.js
@@ -155,7 +155,7 @@ var _Draggable = class _Draggable {
         this._grabbedDevice = pointer;
         this._touchSequence = touchSequence;
 
-        this._capturedEventId = global.stage.connect('captured-event', (actor, event) => {
+        this._capturedEventId = global.stage.connect('captured-event', (o, event) => {
             let device = event.get_device();
             if (device != this._grabbedDevice &&
                 device.get_device_type() != Clutter.InputDeviceType.KEYBOARD_DEVICE)
diff --git a/js/ui/extensionDownloader.js b/js/ui/extensionDownloader.js
index a19aa832be..4cf0414ddf 100644
--- a/js/ui/extensionDownloader.js
+++ b/js/ui/extensionDownloader.js
@@ -24,7 +24,7 @@ function installExtension(uuid, invocation) {
 
     let message = Soup.form_request_new_from_hash('GET', REPOSITORY_URL_INFO, params);
 
-    _httpSession.queue_message(message, (session, message) => {
+    _httpSession.queue_message(message, () => {
         if (message.status_code != Soup.KnownStatusCode.OK) {
             Main.extensionManager.logExtensionError(uuid, `downloading info: ${message.status_code}`);
             invocation.return_dbus_error('org.gnome.Shell.DownloadInfoError', 
message.status_code.toString());
@@ -90,7 +90,7 @@ function gotExtensionZipFile(session, message, uuid, dir, callback, errback) {
         return;
     }
 
-    GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid, (pid, status) => {
+    GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid, (o, status) => {
         GLib.spawn_close_pid(pid);
 
         if (status != 0)
@@ -113,7 +113,7 @@ function updateExtension(uuid) {
     let url = REPOSITORY_URL_DOWNLOAD.format(uuid);
     let message = Soup.form_request_new_from_hash('GET', url, params);
 
-    _httpSession.queue_message(message, (session, message) => {
+    _httpSession.queue_message(message, session => {
         gotExtensionZipFile(session, message, uuid, newExtensionTmpDir, () => {
             let oldExtension = Main.extensionManager.lookup(uuid);
             let extensionDir = oldExtension.dir;
@@ -145,8 +145,8 @@ function updateExtension(uuid) {
             }
 
             FileUtils.recursivelyDeleteDir(oldExtensionTmpDir, true);
-        }, (code, message) => {
-            log('Error while updating extension %s: %s (%s)'.format(uuid, code, message ? message : ''));
+        }, (code, msg) => {
+            log(`Error while updating extension ${uuid}: ${code} (${msg})`);
         });
     });
 }
@@ -162,7 +162,7 @@ function checkForUpdates() {
 
     let url = REPOSITORY_URL_UPDATE;
     let message = Soup.form_request_new_from_hash('GET', url, params);
-    _httpSession.queue_message(message, (session, message) => {
+    _httpSession.queue_message(message, () => {
         if (message.status_code != Soup.KnownStatusCode.OK)
             return;
 
@@ -220,10 +220,9 @@ class InstallExtensionDialog extends ModalDialog.ModalDialog {
         let uuid = this._uuid;
         let dir = Gio.File.new_for_path(GLib.build_filenamev([global.userdatadir, 'extensions', uuid]));
         let invocation = this._invocation;
-        function errback(code, message) {
-            let msg = message ? message.toString() : '';
-            log('Error while installing %s: %s (%s)'.format(uuid, code, msg));
-            invocation.return_dbus_error(`org.gnome.Shell.${code}`, msg);
+        function errback(code, msg) {
+            log(`Error while installing ${uuid}: ${code} (${msg})`);
+            invocation.return_dbus_error(`org.gnome.Shell.${code}`, msg || '');
         }
 
         function callback() {
@@ -241,7 +240,7 @@ class InstallExtensionDialog extends ModalDialog.ModalDialog {
             invocation.return_value(GLib.Variant.new('(s)', ['successful']));
         }
 
-        _httpSession.queue_message(message, (session, message) => {
+        _httpSession.queue_message(message, session => {
             gotExtensionZipFile(session, message, uuid, dir, callback, errback);
         });
 
diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js
index 87ea221f9c..b58d4f580e 100644
--- a/js/ui/extensionSystem.js
+++ b/js/ui/extensionSystem.js
@@ -60,11 +60,11 @@ var ExtensionManager = class {
         let orderReversed = order.slice().reverse();
 
         for (let i = 0; i < orderReversed.length; i++) {
-            let uuid = orderReversed[i];
+            let otherUuid = orderReversed[i];
             try {
-                this.lookup(uuid).stateObj.disable();
+                this.lookup(otherUuid).stateObj.disable();
             } catch (e) {
-                this.logExtensionError(uuid, e);
+                this.logExtensionError(otherUuid, e);
             }
         }
 
@@ -81,11 +81,11 @@ var ExtensionManager = class {
         }
 
         for (let i = 0; i < order.length; i++) {
-            let uuid = order[i];
+            let otherUuid = order[i];
             try {
-                this.lookup(uuid).stateObj.enable();
+                this.lookup(otherUuid).stateObj.enable();
             } catch (e) {
-                this.logExtensionError(uuid, e);
+                this.logExtensionError(otherUuid, e);
             }
         }
 
diff --git a/js/ui/inhibitShortcutsDialog.js b/js/ui/inhibitShortcutsDialog.js
index 76960e2336..24699cff05 100644
--- a/js/ui/inhibitShortcutsDialog.js
+++ b/js/ui/inhibitShortcutsDialog.js
@@ -134,10 +134,10 @@ var InhibitShortcutsDialog = GObject.registerClass({
 
             this._permStore.LookupRemote(APP_PERMISSIONS_TABLE,
                                          APP_PERMISSIONS_ID,
-                (res, error) => {
-                    if (error) {
+                (res, err) => {
+                    if (err) {
                         this._dialog.open();
-                        log(error.message);
+                        log(err.message);
                         return;
                     }
 
diff --git a/js/ui/layout.js b/js/ui/layout.js
index 6729f87c40..ab3d6deb0c 100644
--- a/js/ui/layout.js
+++ b/js/ui/layout.js
@@ -469,8 +469,7 @@ var LayoutManager = GObject.registerClass({
     }
 
     _updateBackgrounds() {
-        let i;
-        for (i = 0; i < this._bgManagers.length; i++)
+        for (let i = 0; i < this._bgManagers.length; i++)
             this._bgManagers[i].destroy();
 
         this._bgManagers = [];
diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js
index 8a8675fd29..184cafc0ce 100644
--- a/js/ui/lookingGlass.js
+++ b/js/ui/lookingGlass.js
@@ -423,10 +423,10 @@ class ObjInspector extends St.ScrollView {
                 } catch (e) {
                     link = new St.Label({ text: '<error>' });
                 }
-                let hbox = new St.BoxLayout();
-                hbox.add(new St.Label({ text: `${propName}: ` }));
-                hbox.add(link);
-                this._container.add_actor(hbox);
+                let box = new St.BoxLayout();
+                box.add(new St.Label({ text: `${propName}: ` }));
+                box.add(link);
+                this._container.add_actor(box);
             }
         }
     }
diff --git a/js/ui/main.js b/js/ui/main.js
index 454b155b9c..ff564027ed 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -296,7 +296,7 @@ function _getStylesheet(name) {
     let dataDirs = GLib.get_system_data_dirs();
     for (let i = 0; i < dataDirs.length; i++) {
         let path = GLib.build_filenamev([dataDirs[i], 'gnome-shell', 'theme', name]);
-        let stylesheet = Gio.file_new_for_path(path);
+        stylesheet = Gio.file_new_for_path(path);
         if (stylesheet.query_exists(null))
             return stylesheet;
     }
diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js
index a5dd2ada23..d9be574a56 100644
--- a/js/ui/notificationDaemon.js
+++ b/js/ui/notificationDaemon.js
@@ -245,7 +245,7 @@ var FdoNotificationDaemon = class FdoNotificationDaemon {
                 return;
             }
 
-            let [pid] = result;
+            [pid] = result;
             source = this._getSource(appName, pid, ndata, sender, null);
 
             this._senderToPid[sender] = pid;
diff --git a/js/ui/pointerA11yTimeout.js b/js/ui/pointerA11yTimeout.js
index 516dcf039c..20233d43fe 100644
--- a/js/ui/pointerA11yTimeout.js
+++ b/js/ui/pointerA11yTimeout.js
@@ -110,7 +110,7 @@ var PointerA11yTimeout = class PointerA11yTimeout {
     constructor() {
         let manager = Clutter.DeviceManager.get_default();
 
-        manager.connect('ptr-a11y-timeout-started', (manager, device, type, timeout) => {
+        manager.connect('ptr-a11y-timeout-started', (o, device, type, timeout) => {
             let [x, y] = global.get_pointer();
 
             this._pieTimer = new PieTimer();
@@ -123,7 +123,7 @@ var PointerA11yTimeout = class PointerA11yTimeout {
                 global.display.set_cursor(Meta.Cursor.CROSSHAIR);
         });
 
-        manager.connect('ptr-a11y-timeout-stopped', (manager, device, type, clicked) => {
+        manager.connect('ptr-a11y-timeout-stopped', (o, device, type, clicked) => {
             if (!clicked)
                 this._pieTimer.destroy();
 
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index c168e00dc1..1a5b90d5cf 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -507,7 +507,7 @@ var PopupMenuBase = class {
             menuItem = new PopupMenuItem(title);
 
         this.addMenuItem(menuItem);
-        menuItem.connect('activate', (menuItem, event) => {
+        menuItem.connect('activate', (o, event) => {
             callback(event);
         });
 
@@ -565,7 +565,7 @@ var PopupMenuBase = class {
     }
 
     _connectItemSignals(menuItem) {
-        menuItem._activeChangeId = menuItem.connect('notify::active', menuItem => {
+        menuItem._activeChangeId = menuItem.connect('notify::active', () => {
             let active = menuItem.active;
             if (active && this._activeMenuItem != menuItem) {
                 if (this._activeMenuItem)
@@ -589,7 +589,7 @@ var PopupMenuBase = class {
                     menuItem.actor.grab_key_focus();
             }
         });
-        menuItem._activateId = menuItem.connect_after('activate', (menuItem, _event) => {
+        menuItem._activateId = menuItem.connect_after('activate', () => {
             this.emit('activate', menuItem);
             this.itemActivated(BoxPointer.PopupAnimation.FULL);
         });
@@ -602,7 +602,7 @@ var PopupMenuBase = class {
         // the menuItem may have, called destroyId
         // (FIXME: in the future it may make sense to have container objects
         // like PopupMenuManager does)
-        menuItem._popupMenuDestroyId = menuItem.connect('destroy', menuItem => {
+        menuItem._popupMenuDestroyId = menuItem.connect('destroy', () => {
             menuItem.disconnect(menuItem._popupMenuDestroyId);
             menuItem.disconnect(menuItem._activateId);
             menuItem.disconnect(menuItem._activeChangeId);
diff --git a/js/ui/runDialog.js b/js/ui/runDialog.js
index 8ba0404b49..2881ec2d98 100644
--- a/js/ui/runDialog.js
+++ b/js/ui/runDialog.js
@@ -217,12 +217,12 @@ class RunDialog extends ModalDialog.ModalDialog {
                     try {
                         Gio.app_info_launch_default_for_uri(file.get_uri(),
                                                             global.create_app_launch_context(0, -1));
-                    } catch (e) {
+                    } catch (err) {
                         // The exception from gjs contains an error string like:
                         //     Error invoking Gio.app_info_launch_default_for_uri: No application
                         //     is registered as handling this file
                         // We are only interested in the part after the first colon.
-                        let message = e.message.replace(/[^:]*: *(.+)/, '$1');
+                        let message = err.message.replace(/[^:]*: *(.+)/, '$1');
                         this._showError(message);
                     }
                 } else {
diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
index c96003acd4..732bb69a4f 100644
--- a/js/ui/screenShield.js
+++ b/js/ui/screenShield.js
@@ -230,10 +230,10 @@ var NotificationsBox = GObject.registerClass({
         this._showSource(source, obj, obj.sourceBox);
         this._notificationBox.add_child(obj.sourceBox);
 
-        obj.sourceCountChangedId = source.connect('notify::count', source => {
+        obj.sourceCountChangedId = source.connect('notify::count', () => {
             this._countChanged(source, obj);
         });
-        obj.sourceTitleChangedId = source.connect('notify::title', source => {
+        obj.sourceTitleChangedId = source.connect('notify::title', () => {
             this._titleChanged(source, obj);
         });
         obj.policyChangedId = source.policy.connect('notify', (policy, pspec) => {
@@ -242,7 +242,7 @@ var NotificationsBox = GObject.registerClass({
             else
                 this._detailedChanged(source, obj);
         });
-        obj.sourceDestroyId = source.connect('destroy', source => {
+        obj.sourceDestroyId = source.connect('destroy', () => {
             this._onSourceDestroy(source, obj);
         });
 
diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js
index 11f8afa445..08133dbfb2 100644
--- a/js/ui/screenshot.js
+++ b/js/ui/screenshot.js
@@ -230,7 +230,7 @@ var ScreenshotService = class {
     SelectAreaAsync(params, invocation) {
         let selectArea = new SelectArea();
         selectArea.show();
-        selectArea.connect('finished', (selectArea, areaRectangle) => {
+        selectArea.connect('finished', (o, areaRectangle) => {
             if (areaRectangle) {
                 let retRectangle = this._unscaleArea(areaRectangle.x, areaRectangle.y,
                                                      areaRectangle.width, areaRectangle.height);
@@ -260,7 +260,7 @@ var ScreenshotService = class {
     PickColorAsync(params, invocation) {
         let pickPixel = new PickPixel();
         pickPixel.show();
-        pickPixel.connect('finished', (pickPixel, coords) => {
+        pickPixel.connect('finished', (obj, coords) => {
             if (coords) {
                 let screenshot = this._createScreenshot(invocation, false);
                 if (!screenshot)
diff --git a/js/ui/status/accessibility.js b/js/ui/status/accessibility.js
index b323b4f419..6ac7233a1b 100644
--- a/js/ui/status/accessibility.js
+++ b/js/ui/status/accessibility.js
@@ -186,7 +186,7 @@ class ATIndicator extends PanelMenu.Button {
             });
 
         settings.connect(`changed::${KEY_TEXT_SCALING_FACTOR}`, () => {
-            let factor = settings.get_double(KEY_TEXT_SCALING_FACTOR);
+            factor = settings.get_double(KEY_TEXT_SCALING_FACTOR);
             let active = (factor > 1.0);
             widget.setToggleState(active);
 
diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js
index d6423e5ab5..1591c31567 100644
--- a/js/ui/status/keyboard.js
+++ b/js/ui/status/keyboard.js
@@ -986,16 +986,16 @@ class InputSourceIndicator extends PanelMenu.Button {
                         return;
 
                     let group = item.radioGroup;
-                    for (let i = 0; i < group.length; ++i) {
-                        if (group[i] == item) {
+                    for (let j = 0; j < group.length; ++j) {
+                        if (group[j] == item) {
                             item.setOrnament(PopupMenu.Ornament.DOT);
                             item.prop.set_state(IBus.PropState.CHECKED);
                             ibusManager.activateProperty(item.prop.get_key(),
                                                          IBus.PropState.CHECKED);
                         } else {
-                            group[i].setOrnament(PopupMenu.Ornament.NONE);
-                            group[i].prop.set_state(IBus.PropState.UNCHECKED);
-                            ibusManager.activateProperty(group[i].prop.get_key(),
+                            group[j].setOrnament(PopupMenu.Ornament.NONE);
+                            group[j].prop.set_state(IBus.PropState.UNCHECKED);
+                            ibusManager.activateProperty(group[j].prop.get_key(),
                                                          IBus.PropState.UNCHECKED);
                         }
                     }
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 753f3e5639..ed5f4cd135 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -271,7 +271,7 @@ var NMConnectionSection = class NMConnectionSection {
             return;
 
         item.connect('icon-changed', () => this._iconChanged());
-        item.connect('activation-failed', (item, reason) => {
+        item.connect('activation-failed', (o, reason) => {
             this.emit('activation-failed', reason);
         });
         item.connect('name-changed', this._sync.bind(this));
@@ -1987,9 +1987,9 @@ class Indicator extends PanelMenu.SystemIndicator {
         } else if (result == PortalHelperResult.COMPLETED) {
             this._closeConnectivityCheck(path);
         } else if (result == PortalHelperResult.RECHECK) {
-            this._client.check_connectivity_async(null, (client, result) => {
+            this._client.check_connectivity_async(null, (client, res) => {
                 try {
-                    let state = client.check_connectivity_finish(result);
+                    let state = client.check_connectivity_finish(res);
                     if (state >= NM.ConnectivityState.FULL)
                         this._closeConnectivityCheck(path);
                 } catch (e) { }
diff --git a/js/ui/status/remoteAccess.js b/js/ui/status/remoteAccess.js
index 0e13c04cf4..0bacb73db1 100644
--- a/js/ui/status/remoteAccess.js
+++ b/js/ui/status/remoteAccess.js
@@ -28,7 +28,7 @@ class RemoteAccessApplet extends PanelMenu.SystemIndicator {
         this._indicator = null;
         this._menuSection = null;
 
-        controller.connect('new-handle', (controller, handle) => {
+        controller.connect('new-handle', (o, handle) => {
             this._onNewHandle(handle);
         });
     }
diff --git a/js/ui/switcherPopup.js b/js/ui/switcherPopup.js
index 04c4d3337e..e2b6cca4ad 100644
--- a/js/ui/switcherPopup.js
+++ b/js/ui/switcherPopup.js
@@ -509,7 +509,7 @@ var SwitcherList = GObject.registerClass({
             maxChildNat = Math.max(childNat, maxChildNat);
 
             if (this._squareItems) {
-                let [childMin, childNat] = this._items[i].get_preferred_height(-1);
+                [childMin, childNat] = this._items[i].get_preferred_height(-1);
                 maxChildMin = Math.max(childMin, maxChildMin);
                 maxChildNat = Math.max(childNat, maxChildNat);
             }
diff --git a/js/ui/windowAttentionHandler.js b/js/ui/windowAttentionHandler.js
index 650bca4986..f95ce4bc76 100644
--- a/js/ui/windowAttentionHandler.js
+++ b/js/ui/windowAttentionHandler.js
@@ -48,7 +48,7 @@ var WindowAttentionHandler = class {
         source.showNotification(notification);
 
         source.signalIDs.push(window.connect('notify::title', () => {
-            let [title, banner] = this._getTitleAndBanner(app, window);
+            [title, banner] = this._getTitleAndBanner(app, window);
             notification.update(title, banner);
         }));
     }
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index 382e6c7de1..e37c7fc224 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -30,7 +30,8 @@ var WINDOW_ANIMATION_TIME = 250;
 var DIM_BRIGHTNESS = -0.3;
 var DIM_TIME = 500;
 var UNDIM_TIME = 250;
-var MOTION_THRESHOLD = 100;
+var WS_MOTION_THRESHOLD = 100;
+var APP_MOTION_THRESHOLD = 30;
 
 var ONE_SECOND = 1000; // in ms
 
@@ -493,13 +494,13 @@ var TouchpadWorkspaceSwitchAction = class {
     _checkActivated() {
         let dir;
 
-        if (this._dy < -MOTION_THRESHOLD)
+        if (this._dy < -WS_MOTION_THRESHOLD)
             dir = Meta.MotionDirection.DOWN;
-        else if (this._dy > MOTION_THRESHOLD)
+        else if (this._dy > WS_MOTION_THRESHOLD)
             dir = Meta.MotionDirection.UP;
-        else if (this._dx < -MOTION_THRESHOLD)
+        else if (this._dx < -WS_MOTION_THRESHOLD)
             dir = Meta.MotionDirection.RIGHT;
-        else if (this._dx > MOTION_THRESHOLD)
+        else if (this._dx > WS_MOTION_THRESHOLD)
             dir = Meta.MotionDirection.LEFT;
         else
             return false;
@@ -586,8 +587,8 @@ var WorkspaceSwitchAction = GObject.registerClass({
     vfunc_swipe(actor, direction) {
         let [x, y] = this.get_motion_coords(0);
         let [xPress, yPress] = this.get_press_coords(0);
-        if (Math.abs(x - xPress) < MOTION_THRESHOLD &&
-            Math.abs(y - yPress) < MOTION_THRESHOLD) {
+        if (Math.abs(x - xPress) < WS_MOTION_THRESHOLD &&
+            Math.abs(y - yPress) < WS_MOTION_THRESHOLD) {
             this.emit('cancel');
             return;
         }
@@ -654,15 +655,14 @@ var AppSwitchAction = GObject.registerClass({
     }
 
     vfunc_gesture_progress(_actor) {
-        const MOTION_THRESHOLD = 30;
 
         if (this.get_n_current_points() == 3) {
             for (let i = 0; i < this.get_n_current_points(); i++) {
                 let [startX, startY] = this.get_press_coords(i);
                 let [x, y] = this.get_motion_coords(i);
 
-                if (Math.abs(x - startX) > MOTION_THRESHOLD ||
-                    Math.abs(y - startY) > MOTION_THRESHOLD)
+                if (Math.abs(x - startX) > APP_MOTION_THRESHOLD ||
+                    Math.abs(y - startY) > APP_MOTION_THRESHOLD)
                     return false;
             }
 
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index edcf54303e..397f521403 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -508,7 +508,7 @@ var WorkspaceThumbnail = GObject.registerClass({
     _addWindowClone(win) {
         let clone = new WindowClone(win);
 
-        clone.connect('selected', (clone, time) => {
+        clone.connect('selected', (o, time) => {
             this.activate(time);
         });
         clone.connect('drag-begin', () => {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]