cleanup: Only omit braces for single-line blocks

Braces can be avoided when a block consists of a single statement,
but readability suffers when the statement spans more than a single
line.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805
This commit is contained in:
Florian Müllner
2019-08-20 02:51:42 +02:00
committed by Georges Basile Stavracas Neto
parent c860409da5
commit 07cc84f632
46 changed files with 178 additions and 101 deletions

View File

@@ -101,12 +101,13 @@ class ATIndicator extends PanelMenu.Button {
_buildItemExtended(string, initialValue, writable, onSet) {
let widget = new PopupMenu.PopupSwitchMenuItem(string, initialValue);
if (!writable)
if (!writable) {
widget.reactive = false;
else
} else {
widget.connect('toggled', item => {
onSet(item.state);
});
}
return widget;
}
@@ -178,11 +179,12 @@ class ATIndicator extends PanelMenu.Button {
initialSetting,
settings.is_writable(KEY_TEXT_SCALING_FACTOR),
enabled => {
if (enabled)
if (enabled) {
settings.set_double(
KEY_TEXT_SCALING_FACTOR, DPI_FACTOR_LARGE);
else
} else {
settings.reset(KEY_TEXT_SCALING_FACTOR);
}
});
settings.connect(`changed::${KEY_TEXT_SCALING_FACTOR}`, () => {

View File

@@ -437,13 +437,13 @@ var InputSourceManager = class {
this.emit('current-source-changed', oldSource);
for (let i = 1; i < this._mruSources.length; ++i)
for (let i = 1; i < this._mruSources.length; ++i) {
if (this._mruSources[i] == newSource) {
let currentSource = this._mruSources.splice(i, 1);
this._mruSources = currentSource.concat(this._mruSources);
break;
}
}
this._changePerWindowSource();
}
@@ -516,12 +516,13 @@ var InputSourceManager = class {
let mruSources = [];
for (let i = 0; i < this._mruSources.length; i++) {
for (let j = 0; j < sourcesList.length; j++)
for (let j = 0; j < sourcesList.length; j++) {
if (this._mruSources[i].type == sourcesList[j].type &&
this._mruSources[i].id == sourcesList[j].id) {
mruSources = mruSources.concat(sourcesList.splice(j, 1));
break;
}
}
}
this._mruSources = mruSources.concat(sourcesList);
}

View File

@@ -161,9 +161,10 @@ var NMConnectionItem = class {
this._activeConnection = activeConnection;
if (this._activeConnection)
if (this._activeConnection) {
this._activeConnectionChangedId = this._activeConnection.connect('notify::state',
this._connectionStateChanged.bind(this));
}
this._sync();
}
@@ -1441,9 +1442,10 @@ var NMVpnConnectionItem = class extends NMConnectionItem {
this._activeConnection = activeConnection;
if (this._activeConnection)
if (this._activeConnection) {
this._activeConnectionChangedId = this._activeConnection.connect('vpn-state-changed',
this._connectionStateChanged.bind(this));
}
this._sync();
}

View File

@@ -199,9 +199,10 @@ var AuthRobot = class {
*/
this._enrolling = this._devicesToEnroll.length > 0;
if (this._enrolling)
if (this._enrolling) {
GLib.idle_add(GLib.PRIORITY_DEFAULT,
this._enrollDevicesIdle.bind(this));
}
}
_enrollDevicesIdle() {