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:

committed by
Georges Basile Stavracas Neto

parent
c860409da5
commit
07cc84f632
@ -128,12 +128,13 @@ function getSettings(schema) {
|
||||
// SYSTEM extension that has been installed in the same prefix as the shell
|
||||
let schemaDir = extension.dir.get_child('schemas');
|
||||
let schemaSource;
|
||||
if (schemaDir.query_exists(null))
|
||||
if (schemaDir.query_exists(null)) {
|
||||
schemaSource = GioSSS.new_from_directory(schemaDir.get_path(),
|
||||
GioSSS.get_default(),
|
||||
false);
|
||||
else
|
||||
} else {
|
||||
schemaSource = GioSSS.get_default();
|
||||
}
|
||||
|
||||
let schemaObj = schemaSource.lookup(schema, true);
|
||||
if (!schemaObj)
|
||||
|
@ -164,9 +164,10 @@ var IntrospectService = class {
|
||||
if (wmClass != null)
|
||||
windowsList[windowId]['wm-class'] = GLib.Variant.new('s', wmClass);
|
||||
|
||||
if (sandboxedAppId != null)
|
||||
if (sandboxedAppId != null) {
|
||||
windowsList[windowId]['sandboxed-app-id'] =
|
||||
GLib.Variant.new('s', sandboxedAppId);
|
||||
}
|
||||
}
|
||||
}
|
||||
invocation.return_value(new GLib.Variant('(a{ta{sv}})', [windowsList]));
|
||||
|
@ -17,9 +17,10 @@
|
||||
// @params and @defaults
|
||||
function parse(params = {}, defaults, allowExtras) {
|
||||
if (!allowExtras) {
|
||||
for (let prop in params)
|
||||
for (let prop in params) {
|
||||
if (!(prop in defaults))
|
||||
throw new Error(`Unrecognized parameter "${prop}"`);
|
||||
}
|
||||
}
|
||||
|
||||
let defaultsCopy = Object.assign({}, defaults);
|
||||
|
@ -233,9 +233,10 @@ const SystemActions = GObject.registerClass({
|
||||
|
||||
_updateOrientationLock() {
|
||||
let available = false;
|
||||
if (this._sensorProxy.g_name_owner)
|
||||
if (this._sensorProxy.g_name_owner) {
|
||||
available = this._sensorProxy.HasAccelerometer &&
|
||||
this._monitorManager.get_is_builtin_display_on();
|
||||
}
|
||||
|
||||
this._actions.get(LOCK_ORIENTATION_ACTION_ID).available = available;
|
||||
|
||||
@ -273,9 +274,10 @@ const SystemActions = GObject.registerClass({
|
||||
|
||||
let results = [];
|
||||
|
||||
for (let [key, { available, keywords }] of this._actions)
|
||||
for (let [key, { available, keywords }] of this._actions) {
|
||||
if (available && terms.every(t => keywords.some(k => k.startsWith(t))))
|
||||
results.push(key);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
@ -171,23 +171,28 @@ function formatTimeSpan(date) {
|
||||
|
||||
if (minutesAgo < 5)
|
||||
return _("Just now");
|
||||
if (hoursAgo < 1)
|
||||
if (hoursAgo < 1) {
|
||||
return Gettext.ngettext("%d minute ago",
|
||||
"%d minutes ago", minutesAgo).format(minutesAgo);
|
||||
if (daysAgo < 1)
|
||||
}
|
||||
if (daysAgo < 1) {
|
||||
return Gettext.ngettext("%d hour ago",
|
||||
"%d hours ago", hoursAgo).format(hoursAgo);
|
||||
}
|
||||
if (daysAgo < 2)
|
||||
return _("Yesterday");
|
||||
if (daysAgo < 15)
|
||||
if (daysAgo < 15) {
|
||||
return Gettext.ngettext("%d day ago",
|
||||
"%d days ago", daysAgo).format(daysAgo);
|
||||
if (weeksAgo < 8)
|
||||
}
|
||||
if (weeksAgo < 8) {
|
||||
return Gettext.ngettext("%d week ago",
|
||||
"%d weeks ago", weeksAgo).format(weeksAgo);
|
||||
if (yearsAgo < 1)
|
||||
}
|
||||
if (yearsAgo < 1) {
|
||||
return Gettext.ngettext("%d month ago",
|
||||
"%d months ago", monthsAgo).format(monthsAgo);
|
||||
}
|
||||
return Gettext.ngettext("%d year ago",
|
||||
"%d years ago", yearsAgo).format(yearsAgo);
|
||||
}
|
||||
|
Reference in New Issue
Block a user