[gnome-shell] style: Fix brace style



commit 8fda3116f03d95fabf3fac6d082b5fa268158d00
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Jan 29 22:02:57 2019 +0100

    style: Fix brace style
    
    Opening braces should be on the same line as the associated statement,
    and only be omitted if both surrounding blocks are one-liners.
    
    Partially spotted by eslint.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/607

 js/misc/util.js                  |  3 +--
 js/ui/altTab.js                  |  3 ++-
 js/ui/background.js              |  4 ++--
 js/ui/calendar.js                | 13 +++++--------
 js/ui/components/networkAgent.js |  9 ++++++---
 js/ui/dnd.js                     |  3 ++-
 js/ui/iconGrid.js                |  3 ++-
 js/ui/lookingGlass.js            |  4 ++--
 js/ui/magnifier.js               | 23 +++++++++--------------
 js/ui/magnifierDBus.js           |  4 ++--
 js/ui/popupMenu.js               |  3 ++-
 js/ui/screenshot.js              |  4 ++--
 js/ui/status/network.js          |  3 ++-
 js/ui/tweener.js                 |  6 ++++--
 js/ui/windowManager.js           |  8 ++++----
 15 files changed, 47 insertions(+), 46 deletions(-)
---
diff --git a/js/misc/util.js b/js/misc/util.js
index a5ad0b0a2..9fd31256e 100644
--- a/js/misc/util.js
+++ b/js/misc/util.js
@@ -103,8 +103,7 @@ function spawnApp(argv) {
 //
 // Runs @argv in the background. If launching @argv fails,
 // this will throw an error.
-function trySpawn(argv)
-{
+function trySpawn(argv) {
     var success, pid;
     try {
         [success, pid] = GLib.spawn_async(null, argv, null,
diff --git a/js/ui/altTab.js b/js/ui/altTab.js
index c7b175df2..83e26cf8a 100644
--- a/js/ui/altTab.js
+++ b/js/ui/altTab.js
@@ -795,8 +795,9 @@ class AppSwitcher extends SwitcherPopup.SwitcherList {
                                                             return GLib.SOURCE_REMOVE;
                                                         });
             GLib.Source.set_name_by_id(this._mouseTimeOutId, '[gnome-shell] this._enterItem');
-        } else
+        } else {
            this._itemEntered(index);
+        }
     }
 
     _enterItem(index) {
diff --git a/js/ui/background.js b/js/ui/background.js
index 6ce0d6093..592b9498d 100644
--- a/js/ui/background.js
+++ b/js/ui/background.js
@@ -464,9 +464,9 @@ var Background = class Background {
 
         let cache = Meta.BackgroundImageCache.get_default();
         let image = cache.load(file);
-        if (image.is_loaded())
+        if (image.is_loaded()) {
             this._setLoaded();
-        else {
+        } else {
             let id = image.connect('loaded', () => {
                 this._setLoaded();
                 image.disconnect(id);
diff --git a/js/ui/calendar.js b/js/ui/calendar.js
index bcd28d784..e253f8469 100644
--- a/js/ui/calendar.js
+++ b/js/ui/calendar.js
@@ -143,8 +143,7 @@ function _datesEqual(a, b) {
     return true;
 }
 
-function _dateIntervalsOverlap(a0, a1, b0, b1)
-{
+function _dateIntervalsOverlap(a0, a1, b0, b1) {
     if (a1 <= b0)
         return false;
     else if (b1 <= a0)
@@ -466,8 +465,7 @@ var Calendar = class Calendar {
                 let day = 32 - new Date(newDate.getFullYear() - 1, 11, 32).getDate();
                 newDate = new Date(newDate.getFullYear() - 1, 11, day);
             }
-        }
-        else {
+        } else {
             newDate.setMonth(oldMonth - 1);
             if (newDate.getMonth() != oldMonth - 1) {
                 let day = 32 - new Date(newDate.getFullYear(), oldMonth - 1, 32).getDate();
@@ -490,8 +488,7 @@ var Calendar = class Calendar {
                 let day = 32 - new Date(newDate.getFullYear() + 1, 0, 32).getDate();
                 newDate = new Date(newDate.getFullYear() + 1, 0, day);
             }
-        }
-        else {
+        } else {
             newDate.setMonth(oldMonth + 1);
             if (newDate.getMonth() != oldMonth + 1) {
                 let day = 32 - new Date(newDate.getFullYear(), oldMonth + 1, 32).getDate();
@@ -646,9 +643,9 @@ var Calendar = class Calendar {
                 button.add_style_pseudo_class('selected');
                 if (this._shouldDateGrabFocus)
                     button.grab_key_focus();
-            }
-            else
+            } else {
                 button.remove_style_pseudo_class('selected');
+            }
         });
     }
 };
diff --git a/js/ui/components/networkAgent.js b/js/ui/components/networkAgent.js
index a66331385..4c57e785a 100644
--- a/js/ui/components/networkAgent.js
+++ b/js/ui/components/networkAgent.js
@@ -80,8 +80,9 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
                         secret.valid = secret.value.length > 0;
                     this._updateOkButton();
                 });
-            } else
+            } else {
                 secret.valid = true;
+            }
 
             if (rtl) {
                 layout.attach(secret.entry, 0, pos, 1, 1);
@@ -188,8 +189,9 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
                           || (value[i] >= 'A' && value[i] <= 'Z')))
                         return false;
                 }
-            } else
+            } else {
                 return false;
+            }
        } else if (secret.wep_key_type == NM.WepKeyType.PASSPHRASE) {
            if (value.length < 0 || value.length > 64)
                return false;
@@ -458,8 +460,9 @@ var VPNRequestHandler = class {
                 this._agent.respond(this._requestId, Shell.NetworkAgentResponse.USER_CANCELED);
             else
                 this._agent.respond(this._requestId, Shell.NetworkAgentResponse.CONFIRMED);
-        } else
+        } else {
             this._agent.respond(this._requestId, Shell.NetworkAgentResponse.INTERNAL_ERROR);
+        }
 
         this.destroy();
     }
diff --git a/js/ui/dnd.js b/js/ui/dnd.js
index 37e48cb41..3f533e9af 100644
--- a/js/ui/dnd.js
+++ b/js/ui/dnd.js
@@ -588,8 +588,9 @@ var _Draggable = class _Draggable {
                         if (this._restoreOnSuccess) {
                             this._restoreDragActor(event.get_time());
                             return true;
-                        } else
+                        } else {
                             this._dragActor.destroy();
+                        }
                     }
 
                     this._dragState = DragState.INIT;
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index 20a27f94d..44ccf4dd7 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -834,8 +834,9 @@ var PaginatedIconGrid = GObject.registerClass({
                 if ((i + 1) % this._childrenPerPage == 0)
                     y +=  this._spaceBetweenPages - spacing + this.bottomPadding + this.topPadding;
                 x = box.x1 + leftEmptySpace + this.leftPadding;
-            } else
+            } else {
                 x += this._getHItemSize() + spacing;
+            }
         }
     }
 
diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js
index b51365fcb..4e5b988ba 100644
--- a/js/ui/lookingGlass.js
+++ b/js/ui/lookingGlass.js
@@ -185,9 +185,9 @@ var Notebook = class Notebook {
     }
 
     selectChild(child) {
-        if (child == null)
+        if (child == null) {
             this.selectIndex(-1);
-        else {
+        } else {
             for (let i = 0; i < this._tabs.length; i++) {
                 let tabData = this._tabs[i];
                 if (tabData.child == child) {
diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js
index 22517d55a..9e857f1a2 100644
--- a/js/ui/magnifier.js
+++ b/js/ui/magnifier.js
@@ -347,8 +347,7 @@ var Magnifier = class Magnifier {
             if (!this._crossHairs)
                 this.addCrosshairs();
             this._crossHairs.show();
-        }
-        else {
+        } else {
             if (this._crossHairs)
                 this._crossHairs.hide();
         }
@@ -375,9 +374,9 @@ var Magnifier = class Magnifier {
         if (this._crossHairs) {
             let clutterColor = this._crossHairs.getColor();
             return clutterColor.to_string();
-        }
-        else
+        } else {
             return '#00000000';
+        }
     }
 
     /**
@@ -457,8 +456,7 @@ var Magnifier = class Magnifier {
         if (clip) {
             if (this._crossHairs)
                 this._crossHairs.setClip(CROSSHAIRS_CLIP_SIZE);
-        }
-        else {
+        } else {
             // Setting no clipping on crosshairs means a zero sized clip
             // rectangle.
             if (this._crossHairs)
@@ -475,9 +473,9 @@ var Magnifier = class Magnifier {
         if (this._crossHairs) {
             let [clipWidth, clipHeight] = this._crossHairs.getClip();
             return (clipWidth > 0 && clipHeight > 0);
-        }
-        else
+        } else {
             return false;
+        }
      }
 
     //// Private methods ////
@@ -1458,11 +1456,9 @@ var ZoomRegion = class ZoomRegion {
 
         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);
         }
 
@@ -1776,8 +1772,7 @@ var Crosshairs = class Crosshairs {
             // mouse.
             this._clipSize = size;
             this.reCenter();
-        }
-        else {
+        } else {
             // Restore the missing chunk.
             this._clipSize = [0, 0];
             this.reCenter();
diff --git a/js/ui/magnifierDBus.js b/js/ui/magnifierDBus.js
index e26724544..2449cf8b9 100644
--- a/js/ui/magnifierDBus.js
+++ b/js/ui/magnifierDBus.js
@@ -106,9 +106,9 @@ var ShellMagnifier = class ShellMagnifier {
         if (proxyAndZoomRegion && proxyAndZoomRegion.zoomRegion) {
             Main.magnifier.addZoomRegion(proxyAndZoomRegion.zoomRegion);
             return true;
-        }
-        else
+        } else {
             return false;
+        }
     }
 
     /**
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index 5c672d5e2..0cd0a0a84 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -851,8 +851,9 @@ var PopupMenu = class extends PopupMenuBase {
                 this.toggle();
             this.actor.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
             return Clutter.EVENT_STOP;
-        } else
+        } else {
             return Clutter.EVENT_PROPAGATE;
+        }
     }
 
     setArrowOrigin(origin) {
diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js
index 664bcfa4e..d7433ba90 100644
--- a/js/ui/screenshot.js
+++ b/js/ui/screenshot.js
@@ -72,9 +72,9 @@ var ScreenshotService = class {
                 flashspot.fire(() => {
                     this._removeShooterForSender(invocation.get_sender());
                 });
-            }
-            else
+            } else {
                 this._removeShooterForSender(invocation.get_sender());
+            }
         }
 
         let retval = GLib.Variant.new('(bs)', [result, filenameUsed]);
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index bac124d85..67cacba54 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -498,8 +498,9 @@ var NMDeviceWired = class extends NMConnectionDevice {
             } else {
                 return 'network-wired-disconnected-symbolic';
             }
-        } else
+        } else {
             return 'network-wired-disconnected-symbolic';
+        }
     }
 };
 
diff --git a/js/ui/tweener.js b/js/ui/tweener.js
index ceff456a1..b4f7a8bcd 100644
--- a/js/ui/tweener.js
+++ b/js/ui/tweener.js
@@ -85,8 +85,9 @@ function _addHandler(target, params, name, handler) {
             oldHandler.apply(eventScope, oldParams);
             handler(target);
         };
-    } else
+    } else {
         params[name] = () => { handler(target); };
+    }
 }
 
 function _actorDestroyed(target) {
@@ -116,8 +117,9 @@ function removeTweens(...args) {
         if (Tweener.getTweenCount(scope) == 0)
             _tweenCompleted(scope);
         return true;
-    } else
+    } else {
         return false;
+    }
 }
 
 function pauseTweens(...args) {
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index f8ea86f74..398defd35 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -630,9 +630,9 @@ var AppSwitchAction = GObject.registerClass({
             // Check whether the 4th finger press happens after a 3-finger long press,
             // this only needs to be checked on the first 4th finger press
             if (this._longPressStartTime != null &&
-                event.get_time() < this._longPressStartTime + LONG_PRESS_TIMEOUT)
+                event.get_time() < this._longPressStartTime + LONG_PRESS_TIMEOUT) {
                 this.cancel();
-            else {
+            } else {
                 this._longPressStartTime = null;
                 this.emit('activated');
             }
@@ -1183,9 +1183,9 @@ var WindowManager = class {
         let focusWindow = global.display.focus_window;
         let nextWindow;
 
-        if (focusWindow == null)
+        if (focusWindow == null) {
             nextWindow = windows[0].metaWindow;
-        else {
+        } else {
             let index = this._lookupIndex (windows, focusWindow) + 1;
 
             if (index >= windows.length)


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