[gnome-shell] cleanup: Avoid unnecessary braces



commit 67ea4245254ac3f2d5b690874c02477786f6321c
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Aug 20 02:51:42 2019 +0200

    cleanup: Avoid unnecessary braces
    
    Our coding style has always been to avoid braces when all blocks
    are single-lines.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805

 js/gdm/authPrompt.js                 |  9 ++++-----
 js/gdm/batch.js                      | 13 +++++--------
 js/gdm/loginDialog.js                | 16 ++++++----------
 js/gdm/util.js                       |  3 +--
 js/misc/history.js                   |  6 +++---
 js/misc/jsParse.js                   | 19 +++++++------------
 js/misc/objectManager.js             |  3 +--
 js/misc/smartcardManager.js          |  5 ++---
 js/perf/core.js                      |  5 ++---
 js/ui/altTab.js                      |  4 ++--
 js/ui/appDisplay.js                  | 14 +++++---------
 js/ui/background.js                  |  4 ++--
 js/ui/boxpointer.js                  | 16 +++++++---------
 js/ui/calendar.js                    |  3 +--
 js/ui/components/automountManager.js |  3 +--
 js/ui/components/autorunManager.js   |  5 ++---
 js/ui/components/telepathyClient.js  |  5 ++---
 js/ui/dash.js                        | 11 ++++-------
 js/ui/dateMenu.js                    |  6 +++---
 js/ui/dnd.js                         |  6 +++---
 js/ui/extensionSystem.js             |  9 +++------
 js/ui/iconGrid.js                    |  8 ++++----
 js/ui/keyboard.js                    |  3 +--
 js/ui/lookingGlass.js                | 31 +++++++++++++------------------
 js/ui/magnifier.js                   | 13 +++++--------
 js/ui/main.js                        | 16 ++++++++--------
 js/ui/messageTray.js                 |  5 ++---
 js/ui/overviewControls.js            |  5 ++---
 js/ui/panel.js                       | 25 +++++++++++--------------
 js/ui/runDialog.js                   |  5 ++---
 js/ui/screenShield.js                | 11 ++++-------
 js/ui/search.js                      |  8 +++-----
 js/ui/status/network.js              | 13 +++++--------
 js/ui/status/volume.js               |  3 +--
 js/ui/viewSelector.js                |  5 ++---
 js/ui/windowManager.js               |  6 ++----
 js/ui/workspace.js                   |  6 ++----
 js/ui/workspaceThumbnail.js          |  9 +++------
 38 files changed, 136 insertions(+), 201 deletions(-)
---
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
index 62a65725e7..de4bed78ad 100644
--- a/js/gdm/authPrompt.js
+++ b/js/gdm/authPrompt.js
@@ -78,11 +78,10 @@ var AuthPrompt = GObject.registerClass({
         this.connect('next', () => {
             this.updateSensitivity(false);
             this.startSpinning();
-            if (this._queryingService) {
+            if (this._queryingService)
                 this._userVerifier.answerQuery(this._queryingService, this._entry.text);
-            } else {
+            else
                 this._preemptiveAnswer = this._entry.text;
-            }
         });
 
         this.connect('destroy', this._onDestroy.bind(this));
@@ -525,9 +524,9 @@ var AuthPrompt = GObject.registerClass({
     }
 
     cancel() {
-        if (this.verificationStatus == AuthPromptStatus.VERIFICATION_SUCCEEDED) {
+        if (this.verificationStatus == AuthPromptStatus.VERIFICATION_SUCCEEDED)
             return;
-        }
+
         this.reset();
         this.emit('cancelled');
     }
diff --git a/js/gdm/batch.js b/js/gdm/batch.js
index 18662e379e..ca29fc7929 100644
--- a/js/gdm/batch.js
+++ b/js/gdm/batch.js
@@ -112,13 +112,12 @@ var Batch = class extends Task {
         for (let i = 0; i < tasks.length; i++) {
             let task;
 
-            if (tasks[i] instanceof Task) {
+            if (tasks[i] instanceof Task)
                 task = tasks[i];
-            } else if (typeof tasks[i] == 'function') {
+            else if (typeof tasks[i] == 'function')
                 task = new Task(scope, tasks[i]);
-            } else {
+            else
                 throw new Error('Batch tasks must be functions or Task, Hold or Batch objects');
-            }
 
             this.tasks.push(task);
         }
@@ -129,9 +128,8 @@ var Batch = class extends Task {
     }
 
     runTask() {
-        if (!(this._currentTaskIndex in this.tasks)) {
+        if (!(this._currentTaskIndex in this.tasks))
             return null;
-        }
 
         return this.tasks[this._currentTaskIndex].run();
     }
@@ -179,9 +177,8 @@ var ConcurrentBatch = class extends Batch {
     process() {
         let hold = this.runTask();
 
-        if (hold) {
+        if (hold)
             this.hold.acquireUntilAfter(hold);
-        }
 
         // Regardless of the state of the just run task,
         // fire off the next one, so all the tasks can run
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
index 96d8453b70..74b239413d 100644
--- a/js/gdm/loginDialog.js
+++ b/js/gdm/loginDialog.js
@@ -702,9 +702,8 @@ var LoginDialog = GObject.registerClass({
         }
 
         // Finally hand out the allocations
-        if (bannerAllocation) {
+        if (bannerAllocation)
             this._bannerView.allocate(bannerAllocation, flags);
-        }
 
         if (authPromptAllocation)
             this._authPrompt.allocate(authPromptAllocation, flags);
@@ -820,9 +819,9 @@ var LoginDialog = GObject.registerClass({
 
     _resetGreeterProxy() {
         if (GLib.getenv('GDM_GREETER_TEST') != '1') {
-            if (this._greeter) {
+            if (this._greeter)
                 this._greeter.run_dispose();
-            }
+
             this._greeter = this._gdmClient.get_greeter_sync(null);
 
             this._defaultSessionChangedId = this._greeter.connect('default-session-name-changed',
@@ -1039,9 +1038,8 @@ var LoginDialog = GObject.registerClass({
 
                      () => {
                          // If we're just starting out, start on the right item.
-                         if (!this._userManager.is_loaded) {
+                         if (!this._userManager.is_loaded)
                              this._userList.jumpToItem(loginItem);
-                         }
                      },
 
                      () => {
@@ -1092,9 +1090,8 @@ var LoginDialog = GObject.registerClass({
         // Restart timed login on user interaction
         global.stage.connect('captured-event', (actor, event) => {
             if (event.type() == Clutter.EventType.KEY_PRESS ||
-               event.type() == Clutter.EventType.BUTTON_PRESS) {
+                event.type() == Clutter.EventType.BUTTON_PRESS)
                 this._startTimedLogin(userName, seconds);
-            }
 
             return Clutter.EVENT_PROPAGATE;
         });
@@ -1201,9 +1198,8 @@ var LoginDialog = GObject.registerClass({
 
         let users = this._userManager.list_users();
 
-        for (let i = 0; i < users.length; i++) {
+        for (let i = 0; i < users.length; i++)
             this._userList.addUser(users[i]);
-        }
 
         this._updateDisableUserList();
 
diff --git a/js/gdm/util.js b/js/gdm/util.js
index 66d5feec83..f9f25b4be3 100644
--- a/js/gdm/util.js
+++ b/js/gdm/util.js
@@ -571,9 +571,8 @@ var ShellUserVerifier = class {
         // if the password service fails, then cancel everything.
         // But if, e.g., fingerprint fails, still give
         // password authentication a chance to succeed
-        if (this.serviceIsForeground(serviceName)) {
+        if (this.serviceIsForeground(serviceName))
             this._verificationFailed(true);
-        }
     }
 };
 Signals.addSignalMethods(ShellUserVerifier.prototype);
diff --git a/js/misc/history.js b/js/misc/history.js
index 93cf4a7b0c..c82722c5a9 100644
--- a/js/misc/history.js
+++ b/js/misc/history.js
@@ -82,11 +82,11 @@ var HistoryManager = class {
 
     _onEntryKeyPress(entry, event) {
         let symbol = event.get_key_symbol();
-        if (symbol == Clutter.KEY_Up) {
+        if (symbol == Clutter.KEY_Up)
             return this._setPrevItem(entry.get_text());
-        } else if (symbol == Clutter.KEY_Down) {
+        else if (symbol == Clutter.KEY_Down)
             return this._setNextItem(entry.get_text());
-        }
+
         return Clutter.EVENT_PROPAGATE;
     }
 
diff --git a/js/misc/jsParse.js b/js/misc/jsParse.js
index de8f66f82b..16d52267da 100644
--- a/js/misc/jsParse.js
+++ b/js/misc/jsParse.js
@@ -11,9 +11,8 @@ function getCompletions(text, commandHeader, globalCompletionList) {
     let methods = [];
     let expr_, base;
     let attrHead = '';
-    if (globalCompletionList == null) {
+    if (globalCompletionList == null)
         globalCompletionList = [];
-    }
 
     let offset = getExpressionOffset(text, text.length - 1);
     if (offset >= 0) {
@@ -59,9 +58,8 @@ function isStopChar(c) {
 function findMatchingQuote(expr, offset) {
     let quoteChar = expr.charAt(offset);
     for (let i = offset - 1; i >= 0; --i) {
-        if (expr.charAt(i) == quoteChar && expr.charAt(i - 1) != '\\') {
+        if (expr.charAt(i) == quoteChar && expr.charAt(i - 1) != '\\')
             return i;
-        }
     }
     return -1;
 }
@@ -69,9 +67,8 @@ function findMatchingQuote(expr, offset) {
 // Given the ending position of a regex, find where it starts
 function findMatchingSlash(expr, offset) {
     for (let i = offset - 1; i >= 0; --i) {
-        if (expr.charAt(i) == '/' && expr.charAt(i - 1) != '\\') {
+        if (expr.charAt(i) == '/' && expr.charAt(i - 1) != '\\')
             return i;
-        }
     }
     return -1;
 }
@@ -117,13 +114,11 @@ function getExpressionOffset(expr, offset) {
     while (offset >= 0) {
         let currChar = expr.charAt(offset);
 
-        if (isStopChar(currChar)) {
+        if (isStopChar(currChar))
             return offset + 1;
-        }
 
-        if (currChar.match(/[)\]]/)) {
+        if (currChar.match(/[)\]]/))
             offset = findMatchingBrace(expr, offset);
-        }
 
         --offset;
     }
@@ -140,9 +135,9 @@ function isValidPropertyName(w) {
 // To get all properties (enumerable and not), we need to walk
 // the prototype chain ourselves
 function getAllProps(obj) {
-    if (obj === null || obj === undefined) {
+    if (obj === null || obj === undefined)
         return [];
-    }
+
     return Object.getOwnPropertyNames(obj).concat( getAllProps(Object.getPrototypeOf(obj)) );
 }
 
diff --git a/js/misc/objectManager.js b/js/misc/objectManager.js
index 3743c4da7f..dfeac0e1e5 100644
--- a/js/misc/objectManager.js
+++ b/js/misc/objectManager.js
@@ -192,9 +192,8 @@ var ObjectManager = class {
     _onNameAppeared() {
         this._managerProxy.GetManagedObjectsRemote((result, error) => {
             if (!result) {
-                if (error) {
+                if (error)
                     logError(error, `could not get remote objects for service ${this._serviceName} path 
${this._managerPath}`);
-                }
 
                 this._tryToCompleteLoad();
                 return;
diff --git a/js/misc/smartcardManager.js b/js/misc/smartcardManager.js
index c1a23ddadb..e1d0f1bce8 100644
--- a/js/misc/smartcardManager.js
+++ b/js/misc/smartcardManager.js
@@ -72,11 +72,10 @@ var SmartcardManager = class {
             if ('IsInserted' in properties.deep_unpack()) {
                 this._updateToken(token);
 
-                if (token.IsInserted) {
+                if (token.IsInserted)
                     this.emit('smartcard-inserted', token);
-                } else {
+                else
                     this.emit('smartcard-removed', token);
-                }
             }
         });
 
diff --git a/js/perf/core.js b/js/perf/core.js
index 9d4a89cd09..d731890b77 100644
--- a/js/perf/core.js
+++ b/js/perf/core.js
@@ -174,11 +174,10 @@ function script_applicationsShowDone(time) {
 }
 
 function script_afterShowHide(_time) {
-    if (overviewShowCount == 1) {
+    if (overviewShowCount == 1)
         METRICS.usedAfterOverview.value = mallocUsedSize;
-    } else {
+    else
         METRICS.leakedAfterOverview.value = mallocUsedSize - METRICS.usedAfterOverview.value;
-    }
 }
 
 function malloc_usedSize(time, bytes) {
diff --git a/js/ui/altTab.js b/js/ui/altTab.js
index e81199dc83..5f93944a6a 100644
--- a/js/ui/altTab.js
+++ b/js/ui/altTab.js
@@ -722,9 +722,9 @@ class AppSwitcher extends SwitcherPopup.SwitcherList {
 
     _setIconSize() {
         let j = 0;
-        while (this._items.length > 1 && this._items[j].style_class != 'item-box') {
+        while (this._items.length > 1 && this._items[j].style_class != 'item-box')
             j++;
-        }
+
         let themeNode = this._items[j].get_theme_node();
         this._list.ensure_style();
 
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 51d108b0c2..f205519591 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -110,9 +110,8 @@ function _findBestFolderName(apps) {
             // If a category is present in all apps, its counter will
             // reach appInfos.length
             if (category.length > 0 &&
-                categoryCounter[category] == appInfos.length) {
+                categoryCounter[category] == appInfos.length)
                 categories.push(category);
-            }
         }
         return categories;
     }, commonCategories);
@@ -764,9 +763,8 @@ var AllView = GObject.registerClass({
 
         // Within the grid boundaries, or already animating
         if (dragEvent.y > gridY && dragEvent.y < gridBottom ||
-            this._adjustment.get_transition('value') != null) {
+            this._adjustment.get_transition('value') != null)
             return;
-        }
 
         // Moving above the grid
         let currentY = this._adjustment.value;
@@ -777,9 +775,8 @@ var AllView = GObject.registerClass({
 
         // Moving below the grid
         let maxY = this._adjustment.upper - this._adjustment.page_size;
-        if (dragEvent.y >= gridBottom && currentY < maxY) {
+        if (dragEvent.y >= gridBottom && currentY < maxY)
             this.goToPage(this._grid.currentPage + 1);
-        }
     }
 
     _onDragBegin() {
@@ -2257,11 +2254,10 @@ var AppIcon = GObject.registerClass({
     }
 
     activateWindow(metaWindow) {
-        if (metaWindow) {
+        if (metaWindow)
             Main.activateWindow(metaWindow);
-        } else {
+        else
             Main.overview.hide();
-        }
     }
 
     _onMenuPoppedDown() {
diff --git a/js/ui/background.js b/js/ui/background.js
index 4dde09101d..b7b69482fd 100644
--- a/js/ui/background.js
+++ b/js/ui/background.js
@@ -269,9 +269,9 @@ var Background = GObject.registerClass({
 
         let i;
         let keys = Object.keys(this._fileWatches);
-        for (i = 0; i < keys.length; i++) {
+        for (i = 0; i < keys.length; i++)
             this._cache.disconnect(this._fileWatches[keys[i]]);
-        }
+
         this._fileWatches = null;
 
         if (this._timezoneChangedId != 0)
diff --git a/js/ui/boxpointer.js b/js/ui/boxpointer.js
index 3197024035..0a2537fe05 100644
--- a/js/ui/boxpointer.js
+++ b/js/ui/boxpointer.js
@@ -247,11 +247,10 @@ var BoxPointer = GObject.registerClass({
             let [absX, absY] = this.get_transformed_position();
 
             if (this._arrowSide == St.Side.TOP ||
-                this._arrowSide == St.Side.BOTTOM) {
+                this._arrowSide == St.Side.BOTTOM)
                 this._arrowOrigin = sourceX - absX + sourceWidth / 2;
-            } else {
+            else
                 this._arrowOrigin = sourceY - absY + sourceHeight / 2;
-            }
         }
 
         let borderWidth = themeNode.get_length('-arrow-border-width');
@@ -266,20 +265,19 @@ var BoxPointer = GObject.registerClass({
 
         let [width, height] = area.get_surface_size();
         let [boxWidth, boxHeight] = [width, height];
-        if (this._arrowSide == St.Side.TOP || this._arrowSide == St.Side.BOTTOM) {
+        if (this._arrowSide == St.Side.TOP || this._arrowSide == St.Side.BOTTOM)
             boxHeight -= rise;
-        } else {
+        else
             boxWidth -= rise;
-        }
+
         let cr = area.get_context();
 
         // Translate so that box goes from 0,0 to boxWidth,boxHeight,
         // with the arrow poking out of that
-        if (this._arrowSide == St.Side.TOP) {
+        if (this._arrowSide == St.Side.TOP)
             cr.translate(0, rise);
-        } else if (this._arrowSide == St.Side.LEFT) {
+        else if (this._arrowSide == St.Side.LEFT)
             cr.translate(rise, 0);
-        }
 
         let [x1, y1] = [halfBorder, halfBorder];
         let [x2, y2] = [boxWidth - halfBorder, boxHeight - halfBorder];
diff --git a/js/ui/calendar.js b/js/ui/calendar.js
index e4d8be922b..03611a3abd 100644
--- a/js/ui/calendar.js
+++ b/js/ui/calendar.js
@@ -326,9 +326,8 @@ class DBusEventSource extends EventSourceBase {
         for (let n = 0; n < this._events.length; n++) {
             let event = this._events[n];
 
-            if (_dateIntervalsOverlap (event.date, event.end, begin, end)) {
+            if (_dateIntervalsOverlap(event.date, event.end, begin, end))
                 result.push(event);
-            }
         }
         result.sort((event1, event2) => {
             // sort events by end time on ending day
diff --git a/js/ui/components/automountManager.js b/js/ui/components/automountManager.js
index 5c23c6615d..6d46a1e23d 100644
--- a/js/ui/components/automountManager.js
+++ b/js/ui/components/automountManager.js
@@ -58,9 +58,8 @@ var AutomountManager = class {
     _InhibitorsChanged(_object, _senderName, [_inhibitor]) {
         this._session.IsInhibitedRemote(GNOME_SESSION_AUTOMOUNT_INHIBIT,
             (result, error) => {
-                if (!error) {
+                if (!error)
                     this._inhibited = result[0];
-                }
             });
     }
 
diff --git a/js/ui/components/autorunManager.js b/js/ui/components/autorunManager.js
index 82f8b9ecb0..222d34751d 100644
--- a/js/ui/components/autorunManager.js
+++ b/js/ui/components/autorunManager.js
@@ -245,11 +245,10 @@ var AutorunDispatcher = class {
         let success = false;
         let app = null;
 
-        if (setting == AutorunSetting.RUN) {
+        if (setting == AutorunSetting.RUN)
             app = Gio.app_info_get_default_for_type(contentTypes[0], false);
-        } else if (setting == AutorunSetting.FILES) {
+        else if (setting == AutorunSetting.FILES)
             app = Gio.app_info_get_default_for_type('inode/directory', false);
-        }
 
         if (app)
             success = startAppForMount(app, mount);
diff --git a/js/ui/components/telepathyClient.js b/js/ui/components/telepathyClient.js
index 4dacc16407..68d4f53ab2 100644
--- a/js/ui/components/telepathyClient.js
+++ b/js/ui/components/telepathyClient.js
@@ -349,11 +349,10 @@ class ChatSource extends MessageTray.Source {
 
     getIcon() {
         let file = this._contact.get_avatar_file();
-        if (file) {
+        if (file)
             return new Gio.FileIcon({ file: file });
-        } else {
+        else
             return new Gio.ThemedIcon({ name: 'avatar-default' });
-        }
     }
 
     getSecondaryIcon() {
diff --git a/js/ui/dash.js b/js/ui/dash.js
index b033eb2ac7..4b72ec4087 100644
--- a/js/ui/dash.js
+++ b/js/ui/dash.js
@@ -16,11 +16,10 @@ var DASH_ITEM_LABEL_HIDE_TIME = 100;
 var DASH_ITEM_HOVER_TIMEOUT = 300;
 
 function getAppFromSource(source) {
-    if (source instanceof AppDisplay.AppIcon) {
+    if (source instanceof AppDisplay.AppIcon)
         return source.app;
-    } else {
+    else
         return null;
-    }
 }
 
 var DashIcon = GObject.registerClass(
@@ -755,9 +754,8 @@ var Dash = GObject.registerClass({
         if (!this._shownInitially)
             this._shownInitially = true;
 
-        for (let i = 0; i < addedItems.length; i++) {
+        for (let i = 0; i < addedItems.length; i++)
             addedItems[i].item.show(animate);
-        }
 
         // Workaround for https://bugzilla.gnome.org/show_bug.cgi?id=692744
         // Without it, StBoxLayout may use a stale size cache
@@ -865,9 +863,8 @@ var Dash = GObject.registerClass({
         let app = getAppFromSource(source);
 
         // Don't allow favoriting of transient apps
-        if (app == null || app.is_window_backed()) {
+        if (app == null || app.is_window_backed())
             return false;
-        }
 
         if (!global.settings.is_writable('favorite-apps'))
             return false;
diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js
index 960c5f4bdd..ec0cbc3fb1 100644
--- a/js/ui/dateMenu.js
+++ b/js/ui/dateMenu.js
@@ -635,11 +635,11 @@ class DateMenuButton extends PanelMenu.Button {
     _sessionUpdated() {
         let eventSource;
         let showEvents = Main.sessionMode.showCalendarEvents;
-        if (showEvents) {
+        if (showEvents)
             eventSource = this._getEventSource();
-        } else {
+        else
             eventSource = new Calendar.EmptyEventSource();
-        }
+
         this._setEventSource(eventSource);
 
         // Displays are not actually expected to launch Settings when activated
diff --git a/js/ui/dnd.js b/js/ui/dnd.js
index 2ec939740d..30da86be63 100644
--- a/js/ui/dnd.js
+++ b/js/ui/dnd.js
@@ -258,11 +258,11 @@ var _Draggable = class _Draggable {
         } else if (event.type() == Clutter.EventType.MOTION ||
                    (event.type() == Clutter.EventType.TOUCH_UPDATE &&
                     global.display.is_pointer_emulating_sequence(event.get_event_sequence()))) {
-            if (this._dragActor && this._dragState == DragState.DRAGGING) {
+            if (this._dragActor && this._dragState == DragState.DRAGGING)
                 return this._updateDragPosition(event);
-            } else if (this._dragActor == null && this._dragState != DragState.CANCELLED) {
+            else if (this._dragActor == null && this._dragState != DragState.CANCELLED)
                 return this._maybeStartDrag(event);
-            }
+
         // We intercept KEY_PRESS event so that we can process Esc key press to cancel
         // dragging and ignore all other key presses.
         } else if (event.type() == Clutter.EventType.KEY_PRESS && this._dragState == DragState.DRAGGING) {
diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js
index 7c36d70903..87ea221f9c 100644
--- a/js/ui/extensionSystem.js
+++ b/js/ui/extensionSystem.js
@@ -200,9 +200,8 @@ var ExtensionManager = class {
 
     createExtensionObject(uuid, dir, type) {
         let metadataFile = dir.get_child('metadata.json');
-        if (!metadataFile.query_exists(null)) {
+        if (!metadataFile.query_exists(null))
             throw new Error('Missing metadata.json');
-        }
 
         let metadataContents, success_;
         try {
@@ -222,14 +221,12 @@ var ExtensionManager = class {
         let requiredProperties = ['uuid', 'name', 'description', 'shell-version'];
         for (let i = 0; i < requiredProperties.length; i++) {
             let prop = requiredProperties[i];
-            if (!meta[prop]) {
+            if (!meta[prop])
                 throw new Error(`missing "${prop}" property in metadata.json`);
-            }
         }
 
-        if (uuid != meta.uuid) {
+        if (uuid != meta.uuid)
             throw new Error(`uuid "${meta.uuid}" from metadata.json does not match directory name 
"${uuid}"`);
-        }
 
         let extension = {
             metadata: meta,
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index 74aac7ad33..9de20966ae 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -815,9 +815,9 @@ var IconGrid = GObject.registerClass({
         this._updateIconSizesLaterId = 0;
         let scale = Math.min(this._fixedHItemSize, this._fixedVItemSize) / Math.max(this._hItemSize, 
this._vItemSize);
         let newIconSize = Math.floor(ICON_SIZE * scale);
-        for (let i in this._items) {
+        for (let i in this._items)
             this._items[i].icon.setIconSize(newIconSize);
-        }
+
         return GLib.SOURCE_REMOVE;
     }
 });
@@ -879,9 +879,9 @@ var PaginatedIconGrid = GObject.registerClass({
             children[i].show();
 
             columnIndex++;
-            if (columnIndex == nColumns) {
+            if (columnIndex == nColumns)
                 columnIndex = 0;
-            }
+
             if (columnIndex == 0) {
                 y += this._getVItemSize() + spacing;
                 if ((i + 1) % this._childrenPerPage == 0)
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index e12d83a968..2a55872748 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -311,9 +311,8 @@ var Key = GObject.registerClass({
     _press(key) {
         this.emit('activated');
 
-        if (key != this.key || this._extended_keys.length == 0) {
+        if (key != this.key || this._extended_keys.length == 0)
             this.emit('pressed', this._getKeyval(key), key);
-        }
 
         if (key == this.key) {
             this._pressTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js
index 284282c787..8a8675fd29 100644
--- a/js/ui/lookingGlass.js
+++ b/js/ui/lookingGlass.js
@@ -54,9 +54,9 @@ var AutoComplete = class AutoComplete {
     }
 
     _processCompletionRequest(event) {
-        if (event.completions.length == 0) {
+        if (event.completions.length == 0)
             return;
-        }
+
         // Unique match = go ahead and complete; multiple matches + single tab = complete the common 
starting string;
         // multiple matches + double tab = emit a suggest event with all possible options
         if (event.completions.length == 1) {
@@ -78,10 +78,10 @@ var AutoComplete = class AutoComplete {
     _entryKeyPressEvent(actor, event) {
         let cursorPos = this._entry.clutter_text.get_cursor_position();
         let text = this._entry.get_text();
-        if (cursorPos != -1) {
+        if (cursorPos != -1)
             text = text.slice(0, cursorPos);
-        }
-        if (event.get_key_symbol() === Clutter.KEY_Tab) {
+
+        if (event.get_key_symbol() == Clutter.KEY_Tab) {
             let [completions, attrHead] = JsParse.getCompletions(text, commandHeader, 
AUTO_COMPLETE_GLOBAL_KEYWORDS);
             let currTime = global.get_current_time();
             if ((currTime - this._lastTabTime) < AUTO_COMPLETE_DOUBLE_TAB_DELAY) {
@@ -224,18 +224,16 @@ var Notebook = GObject.registerClass({
 
     nextTab() {
         let nextIndex = this._selectedIndex;
-        if (nextIndex < this._tabs.length - 1) {
+        if (nextIndex < this._tabs.length - 1)
             ++nextIndex;
-        }
 
         this.selectIndex(nextIndex);
     }
 
     prevTab() {
         let prevIndex = this._selectedIndex;
-        if (prevIndex > 0) {
+        if (prevIndex > 0)
             --prevIndex;
-        }
 
         this.selectIndex(prevIndex);
     }
@@ -412,9 +410,8 @@ class ObjInspector extends St.ScrollView {
         hbox.add(button);
         if (typeof obj == typeof {}) {
             let properties = [];
-            for (let propName in obj) {
+            for (let propName in obj)
                 properties.push(propName);
-            }
             properties.sort();
 
             for (let i = 0; i < properties.length; i++) {
@@ -1096,21 +1093,19 @@ class LookingGlass extends St.BoxLayout {
     // Handle key events which are relevant for all tabs of the LookingGlass
     vfunc_key_press_event(keyPressEvent) {
         let symbol = keyPressEvent.keyval;
-        if (symbol === Clutter.KEY_Escape) {
-            if (this._objInspector.visible) {
+        if (symbol == Clutter.KEY_Escape) {
+            if (this._objInspector.visible)
                 this._objInspector.close();
-            } else {
+            else
                 this.close();
-            }
             return Clutter.EVENT_STOP;
         }
         // Ctrl+PgUp and Ctrl+PgDown switches tabs in the notebook view
         if (keyPressEvent.modifier_state & Clutter.ModifierType.CONTROL_MASK) {
-            if (symbol == Clutter.KEY_Page_Up) {
+            if (symbol == Clutter.KEY_Page_Up)
                 this._notebook.prevTab();
-            } else if (symbol == Clutter.KEY_Page_Down) {
+            else if (symbol == Clutter.KEY_Page_Down)
                 this._notebook.nextTab();
-            }
         }
         return Clutter.EVENT_PROPAGATE;
     }
diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js
index 6893e1fe9d..1d8c243f2f 100644
--- a/js/ui/magnifier.js
+++ b/js/ui/magnifier.js
@@ -623,9 +623,8 @@ var Magnifier = class Magnifier {
 
     _updateLensMode() {
         // Applies only to the first zoom region.
-        if (this._zoomRegions.length) {
+        if (this._zoomRegions.length)
             this._zoomRegions[0].setLensMode(this._settings.get_boolean(LENS_MODE_KEY));
-        }
     }
 
     _updateClampMode() {
@@ -1182,9 +1181,8 @@ var ZoomRegion = class ZoomRegion {
 
         // If the crossHairs is not already within a larger container, add it
         // to this zoom region.  Otherwise, add a clone.
-        if (crossHairs && this.isActive()) {
+        if (crossHairs && this.isActive())
             this._crossHairsActor = crossHairs.addToZoomRegion(this, this._mouseActor);
-        }
     }
 
     /**
@@ -1448,13 +1446,12 @@ var ZoomRegion = class ZoomRegion {
         let xMouse = this._magnifier.xMouse;
         let yMouse = this._magnifier.yMouse;
 
-        if (this._mouseTrackingMode == GDesktopEnums.MagnifierMouseTrackingMode.PROPORTIONAL) {
+        if (this._mouseTrackingMode == GDesktopEnums.MagnifierMouseTrackingMode.PROPORTIONAL)
             return this._centerFromPointProportional(xMouse, yMouse);
-        } else if (this._mouseTrackingMode == GDesktopEnums.MagnifierMouseTrackingMode.PUSH) {
+        else if (this._mouseTrackingMode == GDesktopEnums.MagnifierMouseTrackingMode.PUSH)
             return this._centerFromPointPush(xMouse, yMouse);
-        } else if (this._mouseTrackingMode == GDesktopEnums.MagnifierMouseTrackingMode.CENTERED) {
+        else if (this._mouseTrackingMode == GDesktopEnums.MagnifierMouseTrackingMode.CENTERED)
             return this._centerFromPointCentered(xMouse, yMouse);
-        }
 
         return null; // Should never be hit
     }
diff --git a/js/ui/main.js b/js/ui/main.js
index 5e0de5e87a..454b155b9c 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -248,12 +248,12 @@ function _initializeUI() {
     }
 
     layoutManager.connect('startup-complete', () => {
-        if (actionMode == Shell.ActionMode.NONE) {
+        if (actionMode == Shell.ActionMode.NONE)
             actionMode = Shell.ActionMode.NORMAL;
-        }
-        if (screenShield) {
+
+        if (screenShield)
             screenShield.lockIfWasLocked();
-        }
+
         if (sessionMode.currentMode != 'gdm' &&
             sessionMode.currentMode != 'initial-setup') {
             GLib.log_structured(LOG_DOMAIN, GLib.LogLevelFlags.LEVEL_MESSAGE, {
@@ -573,16 +573,16 @@ function popModal(actor, timestamp) {
 }
 
 function createLookingGlass() {
-    if (lookingGlass == null) {
+    if (lookingGlass == null)
         lookingGlass = new LookingGlass.LookingGlass();
-    }
+
     return lookingGlass;
 }
 
 function openRunDialog() {
-    if (runDialog == null) {
+    if (runDialog == null)
         runDialog = new RunDialog.RunDialog();
-    }
+
     runDialog.open();
 }
 
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 0c738fd55b..e8d4e55707 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -856,11 +856,10 @@ var Source = GObject.registerClass({
         notification.acknowledged = false;
         this.pushNotification(notification);
 
-        if (this.policy.showBanners || notification.urgency == Urgency.CRITICAL) {
+        if (this.policy.showBanners || notification.urgency == Urgency.CRITICAL)
             this.emit('notification-show', notification);
-        } else {
+        else
             notification.playSound();
-        }
     }
 
     notify(propName) {
diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js
index 3eea6f06ca..0342a468ab 100644
--- a/js/ui/overviewControls.js
+++ b/js/ui/overviewControls.js
@@ -179,11 +179,10 @@ class SlidingControl extends St.Widget {
         let translation = this._getTranslation();
 
         let shouldShow = (this._getSlide() > 0);
-        if (shouldShow) {
+        if (shouldShow)
             translationStart = translation;
-        } else {
+        else
             translationEnd = translation;
-        }
 
         if (this.layout.translation_x == translationEnd)
             return;
diff --git a/js/ui/panel.js b/js/ui/panel.js
index 60a4d7c0f0..5672b00888 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -708,16 +708,15 @@ class AggregateMenu extends PanelMenu.Button {
         this._indicators = new St.BoxLayout({ style_class: 'panel-status-indicators-box' });
         this.add_child(this._indicators);
 
-        if (Config.HAVE_NETWORKMANAGER) {
+        if (Config.HAVE_NETWORKMANAGER)
             this._network = new imports.ui.status.network.NMApplet();
-        } else {
+        else
             this._network = null;
-        }
-        if (Config.HAVE_BLUETOOTH) {
+
+        if (Config.HAVE_BLUETOOTH)
             this._bluetooth = new imports.ui.status.bluetooth.Indicator();
-        } else {
+        else
             this._bluetooth = null;
-        }
 
         this._remoteAccess = new imports.ui.status.remoteAccess.RemoteAccessApplet();
         this._power = new imports.ui.status.power.Indicator();
@@ -734,12 +733,10 @@ class AggregateMenu extends PanelMenu.Button {
         this._indicators.add_child(this._screencast);
         this._indicators.add_child(this._location);
         this._indicators.add_child(this._nightLight);
-        if (this._network) {
+        if (this._network)
             this._indicators.add_child(this._network);
-        }
-        if (this._bluetooth) {
+        if (this._bluetooth)
             this._indicators.add_child(this._bluetooth);
-        }
         this._indicators.add_child(this._remoteAccess);
         this._indicators.add_child(this._rfkill);
         this._indicators.add_child(this._volume);
@@ -749,12 +746,12 @@ class AggregateMenu extends PanelMenu.Button {
         this.menu.addMenuItem(this._volume.menu);
         this.menu.addMenuItem(this._brightness.menu);
         this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
-        if (this._network) {
+        if (this._network)
             this.menu.addMenuItem(this._network.menu);
-        }
-        if (this._bluetooth) {
+
+        if (this._bluetooth)
             this.menu.addMenuItem(this._bluetooth.menu);
-        }
+
         this.menu.addMenuItem(this._remoteAccess.menu);
         this.menu.addMenuItem(this._location.menu);
         this.menu.addMenuItem(this._rfkill.menu);
diff --git a/js/ui/runDialog.js b/js/ui/runDialog.js
index edb9bc9ca9..8ba0404b49 100644
--- a/js/ui/runDialog.js
+++ b/js/ui/runDialog.js
@@ -175,11 +175,10 @@ class RunDialog extends ModalDialog.ModalDialog {
     }
 
     _getCompletion(text) {
-        if (text.includes('/')) {
+        if (text.includes('/'))
             return this._pathCompleter.get_completion_suffix(text);
-        } else {
+        else
             return this._getCommandCompletion(text);
-        }
     }
 
     _run(input, inTerminal) {
diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
index b640962444..c96003acd4 100644
--- a/js/ui/screenShield.js
+++ b/js/ui/screenShield.js
@@ -123,9 +123,8 @@ var NotificationsBox = GObject.registerClass({
         }
 
         let items = this._sources.entries();
-        for (let [source, obj] of items) {
+        for (let [source, obj] of items)
             this._removeSource(source, obj);
-        }
     }
 
     _updateVisibility() {
@@ -205,11 +204,10 @@ var NotificationsBox = GObject.registerClass({
     }
 
     _showSource(source, obj, box) {
-        if (obj.detailed) {
+        if (obj.detailed)
             [obj.titleLabel, obj.countLabel] = this._makeNotificationDetailedSource(source, box);
-        } else {
+        else
             [obj.titleLabel, obj.countLabel] = this._makeNotificationSource(source, box);
-        }
 
         box.visible = obj.visible && (source.unseenCount > 0);
     }
@@ -704,9 +702,8 @@ var ScreenShield = class {
         this._lockScreenScrollCounter += delta;
 
         // 7 standard scrolls to lift up
-        if (this._lockScreenScrollCounter > 35) {
+        if (this._lockScreenScrollCounter > 35)
             this._liftShield(true, 0);
-        }
 
         return Clutter.EVENT_STOP;
     }
diff --git a/js/ui/search.js b/js/ui/search.js
index 6c0d05a79e..af927fc577 100644
--- a/js/ui/search.js
+++ b/js/ui/search.js
@@ -87,9 +87,8 @@ class ListSearchResult extends SearchResult {
 
         // An icon for, or thumbnail of, content
         let icon = this.metaInfo['createIcon'](this.ICON_SIZE);
-        if (icon) {
+        if (icon)
             titleBox.add(icon);
-        }
 
         let title = new St.Label({
             text: this.metaInfo['name'],
@@ -689,11 +688,10 @@ var SearchResultsView = GObject.registerClass({
         this._statusBin.visible = !haveResults;
 
         if (!haveResults) {
-            if (this.searchInProgress) {
+            if (this.searchInProgress)
                 this._statusText.set_text(_("Searching…"));
-            } else {
+            else
                 this._statusText.set_text(_("No results."));
-            }
         }
     }
 
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index b7e36c87a7..753f3e5639 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -362,9 +362,8 @@ var NMConnectionDevice = class NMConnectionDevice extends NMConnectionSection {
            if the reason is no secrets, as that indicates the user
            cancelled the agent dialog */
         if (newstate == NM.DeviceState.FAILED &&
-            reason != NM.DeviceStateReason.NO_SECRETS) {
+            reason != NM.DeviceStateReason.NO_SECRETS)
             this.emit('activation-failed', reason);
-        }
 
         this._sync();
     }
@@ -1053,9 +1052,8 @@ class NMWirelessDialog extends ModalDialog.ModalDialog {
     _checkConnections(network, accessPoint) {
         this._connections.forEach(connection => {
             if (accessPoint.connection_valid(connection) &&
-                !network.connections.includes(connection)) {
+                !network.connections.includes(connection))
                 network.connections.push(connection);
-            }
         });
     }
 
@@ -1241,9 +1239,8 @@ var NMDeviceWireless = class {
            if the reason is no secrets, as that indicates the user
            cancelled the agent dialog */
         if (newstate == NM.DeviceState.FAILED &&
-            reason != NM.DeviceStateReason.NO_SECRETS) {
+            reason != NM.DeviceStateReason.NO_SECRETS)
             this.emit('activation-failed', reason);
-        }
 
         this._sync();
     }
@@ -1511,9 +1508,9 @@ var NMVpnSection = class extends NMConnectionSection {
 
     setActiveConnections(vpnConnections) {
         let connections = this._connectionItems.values();
-        for (let item of connections) {
+        for (let item of connections)
             item.setActiveConnection(null);
-        }
+
         vpnConnections.forEach(a => {
             if (a.connection) {
                 let item = this._connectionItems.get(a.connection.get_uuid());
diff --git a/js/ui/status/volume.js b/js/ui/status/volume.js
index bed847d91d..0fb9d6386e 100644
--- a/js/ui/status/volume.js
+++ b/js/ui/status/volume.js
@@ -59,9 +59,8 @@ var StreamSlider = class {
     }
 
     set stream(stream) {
-        if (this._stream) {
+        if (this._stream)
             this._disconnectStream(this._stream);
-        }
 
         this._stream = stream;
 
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index 618dbd6df9..6dbb0d3fc6 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -85,11 +85,10 @@ var ShowOverviewAction = GObject.registerClass({
         for (let i = 0; i < this.get_n_current_points(); i++) {
             let x, y;
 
-            if (motion == true) {
+            if (motion == true)
                 [x, y] = this.get_motion_coords(i);
-            } else {
+            else
                 [x, y] = this.get_press_coords(i);
-            }
 
             if (i == 0) {
                 minX = maxX = x;
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index c19043faeb..38abd20b53 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -1023,9 +1023,8 @@ var WindowManager = class {
         this._gsdWacomProxy = new GsdWacomProxy(Gio.DBus.session, GSD_WACOM_BUS_NAME,
                                                 GSD_WACOM_OBJECT_PATH,
                                                 (proxy, error) => {
-                                                    if (error) {
+                                                    if (error)
                                                         log(error.message);
-                                                    }
                                                 });
 
         global.display.connect('pad-mode-switch', (display, pad, group, mode) => {
@@ -1170,9 +1169,8 @@ var WindowManager = class {
 
     _lookupIndex(windows, metaWindow) {
         for (let i = 0; i < windows.length; i++) {
-            if (windows[i].metaWindow == metaWindow) {
+            if (windows[i].metaWindow == metaWindow)
                 return i;
-            }
         }
         return -1;
     }
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index 15d9be503f..1713e74361 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -1588,15 +1588,13 @@ class Workspace extends St.Widget {
     }
 
     _windowEnteredMonitor(metaDisplay, monitorIndex, metaWin) {
-        if (monitorIndex == this.monitorIndex) {
+        if (monitorIndex == this.monitorIndex)
             this._doAddWindow(metaWin);
-        }
     }
 
     _windowLeftMonitor(metaDisplay, monitorIndex, metaWin) {
-        if (monitorIndex == this.monitorIndex) {
+        if (monitorIndex == this.monitorIndex)
             this._doRemoveWindow(metaWin);
-        }
     }
 
     // check for maximized windows on the workspace
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index 7604d503c7..edcf54303e 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -293,9 +293,8 @@ var WorkspaceThumbnail = GObject.registerClass({
             this._allWindows.push(windows[i].meta_window);
             this._minimizedChangedIds.push(minimizedChangedId);
 
-            if (this._isMyWindow(windows[i]) && this._isOverviewWindow(windows[i])) {
+            if (this._isMyWindow(windows[i]) && this._isOverviewWindow(windows[i]))
                 this._addWindowClone(windows[i]);
-            }
         }
 
         // Track window changes
@@ -450,15 +449,13 @@ var WorkspaceThumbnail = GObject.registerClass({
     }
 
     _windowEnteredMonitor(metaDisplay, monitorIndex, metaWin) {
-        if (monitorIndex == this.monitorIndex) {
+        if (monitorIndex == this.monitorIndex)
             this._doAddWindow(metaWin);
-        }
     }
 
     _windowLeftMonitor(metaDisplay, monitorIndex, metaWin) {
-        if (monitorIndex == this.monitorIndex) {
+        if (monitorIndex == this.monitorIndex)
             this._doRemoveWindow(metaWin);
-        }
     }
 
     _updateMinimized(metaWin) {



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