cleanup: Use consistent brace style of blocks

Our coding style has always been to avoid braces when all blocks
are single-lines. Make sure we apply that style consistently.

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/91
This commit is contained in:
Florian Müllner
2019-08-07 03:49:42 +02:00
committed by Florian Müllner
parent 63c07bdc73
commit eceff51ba1
8 changed files with 26 additions and 22 deletions

View File

@@ -73,12 +73,13 @@ class MountMenuItem extends PopupMenu.PopupBaseMenuItem {
null // Gio.Cancellable
];
if (this.mount.can_eject())
if (this.mount.can_eject()) {
this.mount.eject_with_operation(...unmountArgs,
this._ejectFinish.bind(this));
else
} else {
this.mount.unmount_with_operation(...unmountArgs,
this._unmountFinish.bind(this));
}
}
_unmountFinish(mount, result) {

View File

@@ -98,9 +98,9 @@ class NaturalLayoutStrategy extends Workspace.LayoutStrategy {
// This is used when the window is on the edge of the screen to try to use as much screen real estate as possible.
directions[i] = direction;
direction++;
if (direction == 4) {
if (direction == 4)
direction = 0;
}
}
let loopCounter = 0;
@@ -212,9 +212,9 @@ class NaturalLayoutStrategy extends Workspace.LayoutStrategy {
bounds.height = areaRect.height / scale;
// Move all windows back onto the screen and set their scale
for (let i = 0; i < rects.length; i++) {
for (let i = 0; i < rects.length; i++)
rects[i].translate(-bounds.x, -bounds.y);
}
// rescale to workspace
let slots = [];

View File

@@ -204,12 +204,13 @@ class PlaceDeviceInfo extends PlaceInfo {
null // Gio.Cancellable
];
if (this._mount.can_eject())
if (this._mount.can_eject()) {
this._mount.eject_with_operation(...unmountArgs,
this._ejectFinish.bind(this));
else
} else {
this._mount.unmount_with_operation(...unmountArgs,
this._unmountFinish.bind(this));
}
}
_ejectFinish(mount, result) {
@@ -462,9 +463,9 @@ var PlacesManager = class {
this._addVolume('network', networkVolumes[i]);
}
for (let i = 0; i < networkMounts.length; i++) {
for (let i = 0; i < networkMounts.length; i++)
this._addMount('network', networkMounts[i]);
}
this.emit('devices-updated');
this.emit('network-updated');

View File

@@ -184,13 +184,14 @@ const WindowTitle = GObject.registerClass({
_updateIcon() {
let app = Shell.WindowTracker.get_default().get_window_app(this._metaWindow);
if (app)
if (app) {
this._icon.child = app.create_icon_texture(ICON_TEXTURE_SIZE);
else
} else {
this._icon.child = new St.Icon({
icon_name: 'icon-missing',
icon_size: ICON_TEXTURE_SIZE
});
}
}
_onDestroy() {

View File

@@ -24,9 +24,10 @@ let MyWorkspacesDisplay = class extends WorkspacesDisplay {
}
show(...args) {
if (this._scrollEventId == 0)
if (this._scrollEventId == 0) {
this._scrollEventId = Main.windowPicker.connect('scroll-event',
this._onScrollEvent.bind(this));
}
super.show(...args);
}

View File

@@ -382,13 +382,12 @@ var WorkspaceIndicator = GObject.registerClass({
_onScrollEvent(actor, event) {
let direction = event.get_scroll_direction();
let diff = 0;
if (direction == Clutter.ScrollDirection.DOWN) {
if (direction == Clutter.ScrollDirection.DOWN)
diff = 1;
} else if (direction == Clutter.ScrollDirection.UP) {
else if (direction == Clutter.ScrollDirection.UP)
diff = -1;
} else {
else
return;
}
let newIndex = this._currentWorkspace + diff;
this._activate(newIndex);

View File

@@ -55,8 +55,9 @@ var MyWorkspace = class extends Workspace.Workspace {
this.actor.connect('notify::scale-x', () => {
this._tip.set_scale(1 / this.actor.scale_x, 1 / this.actor.scale_x);
});
} else
} else {
this._tip = null;
}
}
showTooltip() {

View File

@@ -387,13 +387,13 @@ class WorkspaceIndicator extends PanelMenu.Button {
_onScrollEvent(actor, event) {
let direction = event.get_scroll_direction();
let diff = 0;
if (direction == Clutter.ScrollDirection.DOWN) {
if (direction == Clutter.ScrollDirection.DOWN)
diff = 1;
} else if (direction == Clutter.ScrollDirection.UP) {
else if (direction == Clutter.ScrollDirection.UP)
diff = -1;
} else {
else
return;
}
let newIndex = global.workspace_manager.get_active_workspace_index() + diff;
this._activate(newIndex);