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, // Runs @argv in the background. If launching @argv fails,
// this will throw an error. // this will throw an error.
function trySpawn(argv) function trySpawn(argv) {
{
var success, pid; var success, pid;
try { try {
[success, pid] = GLib.spawn_async(null, argv, null, [success, pid] = GLib.spawn_async(null, argv, null,

View File

@ -795,8 +795,9 @@ class AppSwitcher extends SwitcherPopup.SwitcherList {
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
}); });
GLib.Source.set_name_by_id(this._mouseTimeOutId, '[gnome-shell] this._enterItem'); GLib.Source.set_name_by_id(this._mouseTimeOutId, '[gnome-shell] this._enterItem');
} else } else {
this._itemEntered(index); this._itemEntered(index);
}
} }
_enterItem(index) { _enterItem(index) {

View File

@ -464,9 +464,9 @@ var Background = class Background {
let cache = Meta.BackgroundImageCache.get_default(); let cache = Meta.BackgroundImageCache.get_default();
let image = cache.load(file); let image = cache.load(file);
if (image.is_loaded()) if (image.is_loaded()) {
this._setLoaded(); this._setLoaded();
else { } else {
let id = image.connect('loaded', () => { let id = image.connect('loaded', () => {
this._setLoaded(); this._setLoaded();
image.disconnect(id); image.disconnect(id);

View File

@ -143,8 +143,7 @@ function _datesEqual(a, b) {
return true; return true;
} }
function _dateIntervalsOverlap(a0, a1, b0, b1) function _dateIntervalsOverlap(a0, a1, b0, b1) {
{
if (a1 <= b0) if (a1 <= b0)
return false; return false;
else if (b1 <= a0) else if (b1 <= a0)
@ -466,8 +465,7 @@ var Calendar = class Calendar {
let day = 32 - new Date(newDate.getFullYear() - 1, 11, 32).getDate(); let day = 32 - new Date(newDate.getFullYear() - 1, 11, 32).getDate();
newDate = new Date(newDate.getFullYear() - 1, 11, day); newDate = new Date(newDate.getFullYear() - 1, 11, day);
} }
} } else {
else {
newDate.setMonth(oldMonth - 1); newDate.setMonth(oldMonth - 1);
if (newDate.getMonth() != oldMonth - 1) { if (newDate.getMonth() != oldMonth - 1) {
let day = 32 - new Date(newDate.getFullYear(), oldMonth - 1, 32).getDate(); 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(); let day = 32 - new Date(newDate.getFullYear() + 1, 0, 32).getDate();
newDate = new Date(newDate.getFullYear() + 1, 0, day); newDate = new Date(newDate.getFullYear() + 1, 0, day);
} }
} } else {
else {
newDate.setMonth(oldMonth + 1); newDate.setMonth(oldMonth + 1);
if (newDate.getMonth() != oldMonth + 1) { if (newDate.getMonth() != oldMonth + 1) {
let day = 32 - new Date(newDate.getFullYear(), oldMonth + 1, 32).getDate(); 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'); button.add_style_pseudo_class('selected');
if (this._shouldDateGrabFocus) if (this._shouldDateGrabFocus)
button.grab_key_focus(); button.grab_key_focus();
} } else {
else
button.remove_style_pseudo_class('selected'); button.remove_style_pseudo_class('selected');
}
}); });
} }
}; };

View File

@ -80,8 +80,9 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
secret.valid = secret.value.length > 0; secret.valid = secret.value.length > 0;
this._updateOkButton(); this._updateOkButton();
}); });
} else } else {
secret.valid = true; secret.valid = true;
}
if (rtl) { if (rtl) {
layout.attach(secret.entry, 0, pos, 1, 1); layout.attach(secret.entry, 0, pos, 1, 1);
@ -188,8 +189,9 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
|| (value[i] >= 'A' && value[i] <= 'Z'))) || (value[i] >= 'A' && value[i] <= 'Z')))
return false; return false;
} }
} else } else {
return false; return false;
}
} else if (secret.wep_key_type == NM.WepKeyType.PASSPHRASE) { } else if (secret.wep_key_type == NM.WepKeyType.PASSPHRASE) {
if (value.length < 0 || value.length > 64) if (value.length < 0 || value.length > 64)
return false; return false;
@ -458,8 +460,9 @@ var VPNRequestHandler = class {
this._agent.respond(this._requestId, Shell.NetworkAgentResponse.USER_CANCELED); this._agent.respond(this._requestId, Shell.NetworkAgentResponse.USER_CANCELED);
else else
this._agent.respond(this._requestId, Shell.NetworkAgentResponse.CONFIRMED); this._agent.respond(this._requestId, Shell.NetworkAgentResponse.CONFIRMED);
} else } else {
this._agent.respond(this._requestId, Shell.NetworkAgentResponse.INTERNAL_ERROR); this._agent.respond(this._requestId, Shell.NetworkAgentResponse.INTERNAL_ERROR);
}
this.destroy(); this.destroy();
} }

View File

@ -588,8 +588,9 @@ var _Draggable = class _Draggable {
if (this._restoreOnSuccess) { if (this._restoreOnSuccess) {
this._restoreDragActor(event.get_time()); this._restoreDragActor(event.get_time());
return true; return true;
} else } else {
this._dragActor.destroy(); this._dragActor.destroy();
}
} }
this._dragState = DragState.INIT; this._dragState = DragState.INIT;

View File

@ -834,8 +834,9 @@ var PaginatedIconGrid = GObject.registerClass({
if ((i + 1) % this._childrenPerPage == 0) if ((i + 1) % this._childrenPerPage == 0)
y += this._spaceBetweenPages - spacing + this.bottomPadding + this.topPadding; y += this._spaceBetweenPages - spacing + this.bottomPadding + this.topPadding;
x = box.x1 + leftEmptySpace + this.leftPadding; x = box.x1 + leftEmptySpace + this.leftPadding;
} else } else {
x += this._getHItemSize() + spacing; x += this._getHItemSize() + spacing;
}
} }
} }

View File

@ -185,9 +185,9 @@ var Notebook = class Notebook {
} }
selectChild(child) { selectChild(child) {
if (child == null) if (child == null) {
this.selectIndex(-1); this.selectIndex(-1);
else { } else {
for (let i = 0; i < this._tabs.length; i++) { for (let i = 0; i < this._tabs.length; i++) {
let tabData = this._tabs[i]; let tabData = this._tabs[i];
if (tabData.child == child) { if (tabData.child == child) {

View File

@ -347,8 +347,7 @@ var Magnifier = class Magnifier {
if (!this._crossHairs) if (!this._crossHairs)
this.addCrosshairs(); this.addCrosshairs();
this._crossHairs.show(); this._crossHairs.show();
} } else {
else {
if (this._crossHairs) if (this._crossHairs)
this._crossHairs.hide(); this._crossHairs.hide();
} }
@ -375,9 +374,9 @@ var Magnifier = class Magnifier {
if (this._crossHairs) { if (this._crossHairs) {
let clutterColor = this._crossHairs.getColor(); let clutterColor = this._crossHairs.getColor();
return clutterColor.to_string(); return clutterColor.to_string();
} } else {
else
return '#00000000'; return '#00000000';
}
} }
/** /**
@ -457,8 +456,7 @@ var Magnifier = class Magnifier {
if (clip) { if (clip) {
if (this._crossHairs) if (this._crossHairs)
this._crossHairs.setClip(CROSSHAIRS_CLIP_SIZE); this._crossHairs.setClip(CROSSHAIRS_CLIP_SIZE);
} } else {
else {
// Setting no clipping on crosshairs means a zero sized clip // Setting no clipping on crosshairs means a zero sized clip
// rectangle. // rectangle.
if (this._crossHairs) if (this._crossHairs)
@ -475,9 +473,9 @@ var Magnifier = class Magnifier {
if (this._crossHairs) { if (this._crossHairs) {
let [clipWidth, clipHeight] = this._crossHairs.getClip(); let [clipWidth, clipHeight] = this._crossHairs.getClip();
return (clipWidth > 0 && clipHeight > 0); return (clipWidth > 0 && clipHeight > 0);
} } else {
else
return false; return false;
}
} }
//// Private methods //// //// Private methods ////
@ -1458,11 +1456,9 @@ var ZoomRegion = class ZoomRegion {
if (this._mouseTrackingMode == GDesktopEnums.MagnifierMouseTrackingMode.PROPORTIONAL) { if (this._mouseTrackingMode == GDesktopEnums.MagnifierMouseTrackingMode.PROPORTIONAL) {
return this._centerFromPointProportional(xMouse, yMouse); return this._centerFromPointProportional(xMouse, yMouse);
} } else if (this._mouseTrackingMode == GDesktopEnums.MagnifierMouseTrackingMode.PUSH) {
else if (this._mouseTrackingMode == GDesktopEnums.MagnifierMouseTrackingMode.PUSH) {
return this._centerFromPointPush(xMouse, yMouse); 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 this._centerFromPointCentered(xMouse, yMouse);
} }
@ -1776,8 +1772,7 @@ var Crosshairs = class Crosshairs {
// mouse. // mouse.
this._clipSize = size; this._clipSize = size;
this.reCenter(); this.reCenter();
} } else {
else {
// Restore the missing chunk. // Restore the missing chunk.
this._clipSize = [0, 0]; this._clipSize = [0, 0];
this.reCenter(); this.reCenter();

View File

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

View File

@ -851,8 +851,9 @@ var PopupMenu = class extends PopupMenuBase {
this.toggle(); this.toggle();
this.actor.navigate_focus(null, St.DirectionType.TAB_FORWARD, false); this.actor.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} else } else {
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
}
} }
setArrowOrigin(origin) { setArrowOrigin(origin) {

View File

@ -72,9 +72,9 @@ var ScreenshotService = class {
flashspot.fire(() => { flashspot.fire(() => {
this._removeShooterForSender(invocation.get_sender()); this._removeShooterForSender(invocation.get_sender());
}); });
} } else {
else
this._removeShooterForSender(invocation.get_sender()); this._removeShooterForSender(invocation.get_sender());
}
} }
let retval = GLib.Variant.new('(bs)', [result, filenameUsed]); let retval = GLib.Variant.new('(bs)', [result, filenameUsed]);

View File

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

View File

@ -85,8 +85,9 @@ function _addHandler(target, params, name, handler) {
oldHandler.apply(eventScope, oldParams); oldHandler.apply(eventScope, oldParams);
handler(target); handler(target);
}; };
} else } else {
params[name] = () => { handler(target); }; params[name] = () => { handler(target); };
}
} }
function _actorDestroyed(target) { function _actorDestroyed(target) {
@ -116,8 +117,9 @@ function removeTweens(...args) {
if (Tweener.getTweenCount(scope) == 0) if (Tweener.getTweenCount(scope) == 0)
_tweenCompleted(scope); _tweenCompleted(scope);
return true; return true;
} else } else {
return false; return false;
}
} }
function pauseTweens(...args) { 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, // 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 // this only needs to be checked on the first 4th finger press
if (this._longPressStartTime != null && if (this._longPressStartTime != null &&
event.get_time() < this._longPressStartTime + LONG_PRESS_TIMEOUT) event.get_time() < this._longPressStartTime + LONG_PRESS_TIMEOUT) {
this.cancel(); this.cancel();
else { } else {
this._longPressStartTime = null; this._longPressStartTime = null;
this.emit('activated'); this.emit('activated');
} }
@ -1183,9 +1183,9 @@ var WindowManager = class {
let focusWindow = global.display.focus_window; let focusWindow = global.display.focus_window;
let nextWindow; let nextWindow;
if (focusWindow == null) if (focusWindow == null) {
nextWindow = windows[0].metaWindow; nextWindow = windows[0].metaWindow;
else { } else {
let index = this._lookupIndex (windows, focusWindow) + 1; let index = this._lookupIndex (windows, focusWindow) + 1;
if (index >= windows.length) if (index >= windows.length)