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
This commit is contained in:
Florian Müllner 2019-01-29 22:02:57 +01:00
parent 7ac35c644e
commit 8fda3116f0
15 changed files with 47 additions and 46 deletions

View File

@ -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,

View File

@ -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) {

View File

@ -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);

View File

@ -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');
}
});
}
};

View File

@ -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();
}

View File

@ -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;

View File

@ -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;
}
}
}

View File

@ -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) {

View File

@ -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();

View File

@ -106,9 +106,9 @@ var ShellMagnifier = class ShellMagnifier {
if (proxyAndZoomRegion && proxyAndZoomRegion.zoomRegion) {
Main.magnifier.addZoomRegion(proxyAndZoomRegion.zoomRegion);
return true;
}
else
} else {
return false;
}
}
/**

View File

@ -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) {

View File

@ -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]);

View File

@ -498,8 +498,9 @@ var NMDeviceWired = class extends NMConnectionDevice {
} else {
return 'network-wired-disconnected-symbolic';
}
} else
} else {
return 'network-wired-disconnected-symbolic';
}
}
};

View File

@ -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) {

View File

@ -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)