[gnome-shell] cleanup: Only omit braces for single-line blocks
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] cleanup: Only omit braces for single-line blocks
- Date: Mon, 11 Nov 2019 20:54:30 +0000 (UTC)
commit 07cc84f6327c3dedd0e3d726c04e29105a342d33
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Aug 20 02:51:42 2019 +0200
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
js/gdm/authPrompt.js | 5 +++--
js/misc/extensionUtils.js | 5 +++--
js/misc/introspect.js | 3 ++-
js/misc/params.js | 3 ++-
js/misc/systemActions.js | 6 ++++--
js/misc/util.js | 15 ++++++++++-----
js/perf/core.js | 3 ++-
js/ui/altTab.js | 3 ++-
js/ui/appDisplay.js | 9 ++++++---
js/ui/audioDeviceSelection.js | 3 ++-
js/ui/backgroundMenu.js | 3 ++-
js/ui/barLevel.js | 3 ++-
js/ui/calendar.js | 10 ++++++----
js/ui/closeDialog.js | 5 +++--
js/ui/components/networkAgent.js | 14 +++++++++-----
js/ui/components/telepathyClient.js | 14 +++++++++-----
js/ui/ctrlAltTab.js | 5 +++--
js/ui/dash.js | 3 ++-
js/ui/dateMenu.js | 3 ++-
js/ui/dnd.js | 6 ++++--
js/ui/endSessionDialog.js | 3 ++-
js/ui/environment.js | 3 ++-
js/ui/ibusCandidatePopup.js | 6 ++++--
js/ui/iconGrid.js | 6 ++++--
js/ui/inhibitShortcutsDialog.js | 3 ++-
js/ui/keyboard.js | 3 ++-
js/ui/layout.js | 6 ++++--
js/ui/magnifier.js | 8 +++++---
js/ui/messageList.js | 9 ++++++---
js/ui/messageTray.js | 3 ++-
js/ui/mpris.js | 9 ++++++---
js/ui/notificationDaemon.js | 10 ++++++----
js/ui/osdWindow.js | 5 +++--
js/ui/overviewControls.js | 4 ++--
js/ui/panel.js | 11 +++++++----
js/ui/popupMenu.js | 6 ++++--
js/ui/screenShield.js | 3 ++-
js/ui/search.js | 8 +++++---
js/ui/sessionMode.js | 8 +++++---
js/ui/shellMountOperation.js | 5 +++--
js/ui/status/accessibility.js | 10 ++++++----
js/ui/status/keyboard.js | 7 ++++---
js/ui/status/network.js | 6 ++++--
js/ui/status/thunderbolt.js | 3 ++-
js/ui/viewSelector.js | 8 +++++---
js/ui/workspaceThumbnail.js | 5 +++--
46 files changed, 178 insertions(+), 101 deletions(-)
---
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
index 0d12e9d1ab..4951741e3b 100644
--- a/js/gdm/authPrompt.js
+++ b/js/gdm/authPrompt.js
@@ -330,15 +330,16 @@ var AuthPrompt = GObject.registerClass({
if (isSpinner)
this._spinner.play();
- if (!animate)
+ if (!animate) {
actor.opacity = 255;
- else
+ } else {
actor.ease({
opacity: 255,
duration: DEFAULT_BUTTON_WELL_ANIMATION_TIME,
delay: DEFAULT_BUTTON_WELL_ANIMATION_DELAY,
mode: Clutter.AnimationMode.LINEAR
});
+ }
}
this._defaultButtonWellActor = actor;
diff --git a/js/misc/extensionUtils.js b/js/misc/extensionUtils.js
index 2b3c11704f..939984fe0f 100644
--- a/js/misc/extensionUtils.js
+++ b/js/misc/extensionUtils.js
@@ -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)
diff --git a/js/misc/introspect.js b/js/misc/introspect.js
index f256555cb8..0d1e47bc87 100644
--- a/js/misc/introspect.js
+++ b/js/misc/introspect.js
@@ -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]));
diff --git a/js/misc/params.js b/js/misc/params.js
index 92adeb0064..817d66ceb8 100644
--- a/js/misc/params.js
+++ b/js/misc/params.js
@@ -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);
diff --git a/js/misc/systemActions.js b/js/misc/systemActions.js
index 7607efc65f..2f23ada1cf 100644
--- a/js/misc/systemActions.js
+++ b/js/misc/systemActions.js
@@ -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;
}
diff --git a/js/misc/util.js b/js/misc/util.js
index a9194e3a0c..d40597f7e4 100644
--- a/js/misc/util.js
+++ b/js/misc/util.js
@@ -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);
}
diff --git a/js/perf/core.js b/js/perf/core.js
index d731890b77..afd03cd161 100644
--- a/js/perf/core.js
+++ b/js/perf/core.js
@@ -94,11 +94,12 @@ function *run() {
let config = WINDOW_CONFIGS[i / 2];
yield Scripting.destroyTestWindows();
- for (let k = 0; k < config.count; k++)
+ for (let k = 0; k < config.count; k++) {
yield Scripting.createTestWindow({ width: config.width,
height: config.height,
alpha: config.alpha,
maximized: config.maximized });
+ }
yield Scripting.waitTestWindows();
yield Scripting.sleep(1000);
diff --git a/js/ui/altTab.js b/js/ui/altTab.js
index cedd198559..603e9b56be 100644
--- a/js/ui/altTab.js
+++ b/js/ui/altTab.js
@@ -997,9 +997,10 @@ class WindowIcon extends St.BoxLayout {
size = WINDOW_PREVIEW_SIZE;
this._icon.add_actor(_createWindowClone(mutterWindow, size * scaleFactor));
- if (this.app)
+ if (this.app) {
this._icon.add_actor(this._createAppIcon(this.app,
APP_ICON_SIZE_SMALL));
+ }
break;
case AppIconMode.APP_ICON_ONLY:
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index c0cb047f06..fa8952e4e1 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -55,9 +55,10 @@ function _getCategories(info) {
}
function _listsIntersect(a, b) {
- for (let itemA of a)
+ for (let itemA of a) {
if (b.includes(itemA))
return true;
+ }
return false;
}
@@ -525,13 +526,14 @@ var AllView = GObject.registerClass({
super.animateSwitch(animationDirection);
if (this._currentPopup && this._displayingPopup &&
- animationDirection == IconGrid.AnimationDirection.OUT)
+ animationDirection == IconGrid.AnimationDirection.OUT) {
this._currentPopup.ease({
opacity: 0,
duration: VIEWS_SWITCH_TIME,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
onComplete: () => (this.opacity = 255)
});
+ }
if (animationDirection == IconGrid.AnimationDirection.OUT)
this._pageIndicators.animateIndicators(animationDirection);
@@ -2478,11 +2480,12 @@ var AppIconMenu = class AppIconMenu extends PopupMenu.PopupMenu {
w => !w.skip_taskbar
);
- if (windows.length > 0)
+ if (windows.length > 0) {
this.addMenuItem(
/* Translators: This is the heading of a list of open windows */
new PopupMenu.PopupSeparatorMenuItem(_("Open Windows"))
);
+ }
windows.forEach(window => {
let title = window.title
diff --git a/js/ui/audioDeviceSelection.js b/js/ui/audioDeviceSelection.js
index f8c8ea6baf..3a411881b7 100644
--- a/js/ui/audioDeviceSelection.js
+++ b/js/ui/audioDeviceSelection.js
@@ -49,9 +49,10 @@ var AudioDeviceSelectionDialog = GObject.registerClass({
});
this.contentLayout.add_child(this._selectionBox);
- if (Main.sessionMode.allowSettings)
+ if (Main.sessionMode.allowSettings) {
this.addButton({ action: this._openSettings.bind(this),
label: _("Sound Settings") });
+ }
this.addButton({ action: this.close.bind(this),
label: _("Cancel"),
key: Clutter.KEY_Escape });
diff --git a/js/ui/backgroundMenu.js b/js/ui/backgroundMenu.js
index 33e9416cbd..bbe8b36815 100644
--- a/js/ui/backgroundMenu.js
+++ b/js/ui/backgroundMenu.js
@@ -36,10 +36,11 @@ function addBackgroundMenu(actor, layoutManager) {
let clickAction = new Clutter.ClickAction();
clickAction.connect('long-press', (action, theActor, state) => {
- if (state == Clutter.LongPressState.QUERY)
+ if (state == Clutter.LongPressState.QUERY) {
return ((action.get_button() == 0 ||
action.get_button() == 1) &&
!actor._backgroundMenu.isOpen);
+ }
if (state == Clutter.LongPressState.ACTIVATE) {
let [x, y] = action.get_coords();
openMenu(x, y);
diff --git a/js/ui/barLevel.js b/js/ui/barLevel.js
index 89f9d62d64..a2baffd93f 100644
--- a/js/ui/barLevel.js
+++ b/js/ui/barLevel.js
@@ -88,9 +88,10 @@ var BarLevel = GObject.registerClass({
if (this._overdriveStart == value)
return;
- if (value > this._maxValue)
+ if (value > this._maxValue) {
throw new Error(`Tried to set overdrive value to ${value}, ` +
`which is a number greater than the maximum allowed value ${this._maxValue}`);
+ }
this._overdriveStart = value;
this.notify('overdrive-start');
diff --git a/js/ui/calendar.js b/js/ui/calendar.js
index 107c096146..6e20bf98ef 100644
--- a/js/ui/calendar.js
+++ b/js/ui/calendar.js
@@ -777,11 +777,12 @@ class NotificationMessage extends MessageList.Message {
}
_getIcon() {
- if (this.notification.gicon)
+ if (this.notification.gicon) {
return new St.Icon({ gicon: this.notification.gicon,
icon_size: MESSAGE_ICON_SIZE });
- else
+ } else {
return this.notification.source.createIcon(MESSAGE_ICON_SIZE);
+ }
}
_onUpdated(n, _clear) {
@@ -860,14 +861,15 @@ class EventsSection extends MessageList.MessageListSection {
let dayFormat;
let now = new Date();
- if (sameYear(this._date, now))
+ if (sameYear(this._date, now)) {
/* Translators: Shown on calendar heading when selected day occurs on current year */
dayFormat = Shell.util_translate_time_string(NC_("calendar heading",
"%A, %B %-d"));
- else
+ } else {
/* Translators: Shown on calendar heading when selected day occurs on different year */
dayFormat = Shell.util_translate_time_string(NC_("calendar heading",
"%A, %B %-d, %Y"));
+ }
this._title.label = this._date.toLocaleFormat(dayFormat);
}
diff --git a/js/ui/closeDialog.js b/js/ui/closeDialog.js
index 4d43196ba6..15222e5b62 100644
--- a/js/ui/closeDialog.js
+++ b/js/ui/closeDialog.js
@@ -124,11 +124,12 @@ var CloseDialog = GObject.registerClass({
if (this._tracked === shouldTrack)
return;
- if (shouldTrack)
+ if (shouldTrack) {
Main.layoutManager.trackChrome(this._dialog,
{ affectsInputRegion: true });
- else
+ } else {
Main.layoutManager.untrackChrome(this._dialog);
+ }
// The buttons are broken when they aren't added to the input region,
// so disable them properly in that case
diff --git a/js/ui/components/networkAgent.js b/js/ui/components/networkAgent.js
index 57a8b41fae..c31af2177e 100644
--- a/js/ui/components/networkAgent.js
+++ b/js/ui/components/networkAgent.js
@@ -222,11 +222,12 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
validate: this._validateStaticWep, password: true });
break;
case 'ieee8021x':
- if (wirelessSecuritySetting.auth_alg == 'leap') // Cisco LEAP
+ if (wirelessSecuritySetting.auth_alg == 'leap') { // Cisco LEAP
secrets.push({ label: _("Password: "), key: 'leap-password',
value: wirelessSecuritySetting.leap_password || '', password: true });
- else // Dynamic (IEEE 802.1x) WEP
+ } else { // Dynamic (IEEE 802.1x) WEP
this._get8021xSecrets(secrets);
+ }
break;
case 'wpa-eap':
this._get8021xSecrets(secrets);
@@ -241,15 +242,18 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
/* If hints were given we know exactly what we need to ask */
if (this._settingName == "802-1x" && this._hints.length) {
- if (this._hints.includes('identity'))
+ if (this._hints.includes('identity')) {
secrets.push({ label: _("Username: "), key: 'identity',
value: ieee8021xSetting.identity || '', password: false });
- if (this._hints.includes('password'))
+ }
+ if (this._hints.includes('password')) {
secrets.push({ label: _("Password: "), key: 'password',
value: ieee8021xSetting.password || '', password: true });
- if (this._hints.includes('private-key-password'))
+ }
+ if (this._hints.includes('private-key-password')) {
secrets.push({ label: _("Private key password: "), key: 'private-key-password',
value: ieee8021xSetting.private_key_password || '', password: true });
+ }
return;
}
diff --git a/js/ui/components/telepathyClient.js b/js/ui/components/telepathyClient.js
index 90fc03ca84..69b6f606e3 100644
--- a/js/ui/components/telepathyClient.js
+++ b/js/ui/components/telepathyClient.js
@@ -231,11 +231,12 @@ class TelepathyClient extends Tp.BaseClient {
return;
}
- if (chanType == Tp.IFACE_CHANNEL_TYPE_TEXT)
+ if (chanType == Tp.IFACE_CHANNEL_TYPE_TEXT) {
this._approveTextChannel(account, conn, channel, dispatchOp, context);
- else
+ } else {
context.fail(new Tp.Error({ code: Tp.Error.INVALID_ARGUMENT,
message: 'Unsupported channel type' }));
+ }
}
_approveTextChannel(account, conn, channel, dispatchOp, context) {
@@ -386,10 +387,11 @@ class ChatSource extends MessageTray.Source {
_updateAvatarIcon() {
this.iconUpdated();
- if (this._notifiction)
+ if (this._notifiction) {
this._notification.update(this._notification.title,
this._notification.bannerBodyText,
{ gicon: this.getIcon() });
+ }
}
open() {
@@ -601,10 +603,11 @@ class ChatSource extends MessageTray.Source {
}
_presenceChanged(_contact, _presence, _status, _message) {
- if (this._notification)
+ if (this._notification) {
this._notification.update(this._notification.title,
this._notification.bannerBodyText,
{ secondaryGIcon: this.getSecondaryIcon() });
+ }
}
_pendingRemoved(channel, message) {
@@ -674,10 +677,11 @@ var ChatNotification = HAVE_TP ? GObject.registerClass({
styles.push('chat-action');
}
- if (message.direction == NotificationDirection.RECEIVED)
+ if (message.direction == NotificationDirection.RECEIVED) {
this.update(this.source.title, messageBody,
{ datetime: GLib.DateTime.new_from_unix_local(message.timestamp),
bannerMarkup: true });
+ }
let group = (message.direction == NotificationDirection.RECEIVED
? 'received' : 'sent');
diff --git a/js/ui/ctrlAltTab.js b/js/ui/ctrlAltTab.js
index b7b3939af9..e8f548b3ba 100644
--- a/js/ui/ctrlAltTab.js
+++ b/js/ui/ctrlAltTab.js
@@ -90,12 +90,13 @@ var CtrlAltTabManager = class CtrlAltTabManager {
iconName = 'video-display-symbolic';
} else {
let app = windowTracker.get_window_app(windows[i]);
- if (app)
+ if (app) {
icon = app.create_icon_texture(POPUP_APPICON_SIZE);
- else
+ } else {
icon = textureCache.bind_cairo_surface_property(windows[i],
'icon',
POPUP_APPICON_SIZE);
+ }
}
items.push({ name: windows[i].title,
diff --git a/js/ui/dash.js b/js/ui/dash.js
index 760c23df5c..fa9d14ae76 100644
--- a/js/ui/dash.js
+++ b/js/ui/dash.js
@@ -728,9 +728,10 @@ var Dash = GObject.registerClass({
}
}
- for (let i = 0; i < addedItems.length; i++)
+ for (let i = 0; i < addedItems.length; i++) {
this._box.insert_child_at_index(addedItems[i].item,
addedItems[i].pos);
+ }
for (let i = 0; i < removedActors.length; i++) {
let item = removedActors[i];
diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js
index 224366c451..4d8189b4de 100644
--- a/js/ui/dateMenu.js
+++ b/js/ui/dateMenu.js
@@ -203,9 +203,10 @@ class WorldClocksSection extends St.Button {
}
if (this._grid.get_n_children() > 1) {
- if (!this._clockNotifyId)
+ if (!this._clockNotifyId) {
this._clockNotifyId =
this._clock.connect('notify::clock', this._updateLabels.bind(this));
+ }
this._updateLabels();
} else {
if (this._clockNotifyId)
diff --git a/js/ui/dnd.js b/js/ui/dnd.js
index fc7d228807..167374eda3 100644
--- a/js/ui/dnd.js
+++ b/js/ui/dnd.js
@@ -61,11 +61,12 @@ function addDragMonitor(monitor) {
}
function removeDragMonitor(monitor) {
- for (let i = 0; i < dragMonitors.length; i++)
+ for (let i = 0; i < dragMonitors.length; i++) {
if (dragMonitors[i] == monitor) {
dragMonitors.splice(i, 1);
return;
}
+ }
}
var _Draggable = class _Draggable {
@@ -555,7 +556,7 @@ var _Draggable = class _Draggable {
};
for (let i = 0; i < dragMonitors.length; i++) {
let dropFunc = dragMonitors[i].dragDrop;
- if (dropFunc)
+ if (dropFunc) {
switch (dropFunc(dropEvent)) {
case DragDropResult.FAILURE:
case DragDropResult.SUCCESS:
@@ -563,6 +564,7 @@ var _Draggable = class _Draggable {
case DragDropResult.CONTINUE:
continue;
}
+ }
}
// At this point it is too late to cancel a drag by destroying
diff --git a/js/ui/endSessionDialog.js b/js/ui/endSessionDialog.js
index c87cf59dd1..86115af430 100644
--- a/js/ui/endSessionDialog.js
+++ b/js/ui/endSessionDialog.js
@@ -681,11 +681,12 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
continue;
let sessionId = GLib.getenv('XDG_SESSION_ID');
- if (!sessionId)
+ if (!sessionId) {
this._loginManager.getCurrentSessionProxy(currentSessionProxy => {
sessionId = currentSessionProxy.Id;
log(`endSessionDialog: No XDG_SESSION_ID, fetched from logind: ${sessionId}`);
});
+ }
if (proxy.Id == sessionId)
continue;
diff --git a/js/ui/environment.js b/js/ui/environment.js
index b4e8cf93f6..6689fe555e 100644
--- a/js/ui/environment.js
+++ b/js/ui/environment.js
@@ -40,7 +40,7 @@ function _patchContainerClass(containerClass) {
}
function _patchLayoutClass(layoutClass, styleProps) {
- if (styleProps)
+ if (styleProps) {
layoutClass.prototype.hookup_style = function (container) {
container.connect('style-changed', () => {
let node = container.get_theme_node();
@@ -51,6 +51,7 @@ function _patchLayoutClass(layoutClass, styleProps) {
}
});
};
+ }
}
function _makeEaseCallback(params, cleanup) {
diff --git a/js/ui/ibusCandidatePopup.js b/js/ui/ibusCandidatePopup.js
index cdd547d2a7..683e608888 100644
--- a/js/ui/ibusCandidatePopup.js
+++ b/js/ui/ibusCandidatePopup.js
@@ -215,9 +215,10 @@ class IbusCandidatePopup extends BoxPointer.BoxPointer {
this._preeditText.text = text.get_text();
let attrs = text.get_attributes();
- if (attrs)
+ if (attrs) {
this._setTextAttributes(this._preeditText.clutter_text,
attrs);
+ }
});
panelService.connect('show-preedit-text', () => {
this._preeditText.show();
@@ -316,8 +317,9 @@ class IbusCandidatePopup extends BoxPointer.BoxPointer {
_setTextAttributes(clutterText, ibusAttrList) {
let attr;
- for (let i = 0; (attr = ibusAttrList.get(i)); ++i)
+ for (let i = 0; (attr = ibusAttrList.get(i)); ++i) {
if (attr.get_attr_type() == IBus.AttrType.BACKGROUND)
clutterText.set_selection(attr.get_start_index(), attr.get_end_index());
+ }
}
});
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index dbde037634..7187f520eb 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -455,9 +455,10 @@ var IconGrid = GObject.registerClass({
}
animatePulse(animationDirection) {
- if (animationDirection != AnimationDirection.IN)
+ if (animationDirection != AnimationDirection.IN) {
throw new GObject.NotImplementedError("Pulse animation only implements " +
"'in' animation direction");
+ }
this._resetAnimationActors();
@@ -805,9 +806,10 @@ var IconGrid = GObject.registerClass({
this._updateSpacingForSize(availWidth, availHeight);
}
- if (!this._updateIconSizesLaterId)
+ if (!this._updateIconSizesLaterId) {
this._updateIconSizesLaterId = Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
this._updateIconSizes.bind(this));
+ }
}
// Note that this is ICON_SIZE as used by BaseIcon, not elsewhere in IconGrid; it's a bit messed up
diff --git a/js/ui/inhibitShortcutsDialog.js b/js/ui/inhibitShortcutsDialog.js
index 24699cff05..0fd14827ea 100644
--- a/js/ui/inhibitShortcutsDialog.js
+++ b/js/ui/inhibitShortcutsDialog.js
@@ -84,10 +84,11 @@ var InhibitShortcutsDialog = GObject.registerClass({
let contentParams = { icon, title };
let restoreAccel = this._getRestoreAccel();
- if (restoreAccel)
+ if (restoreAccel) {
contentParams.subtitle =
/* Translators: %s is a keyboard shortcut like "Super+x" */
_("You can restore shortcuts by pressing %s.").format(restoreAccel);
+ }
let content = new Dialog.MessageDialogContent(contentParams);
this._dialog.contentLayout.add_actor(content);
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index f51ac77762..c0a02972ff 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -1307,9 +1307,10 @@ class Keyboard extends St.BoxLayout {
this._connectSignal(global.stage, 'notify::key-focus',
this._onKeyFocusChanged.bind(this));
- if (Meta.is_wayland_compositor())
+ if (Meta.is_wayland_compositor()) {
this._connectSignal(this._keyboardController, 'emoji-visible',
this._onEmojiKeyVisible.bind(this));
+ }
this._relayout();
}
diff --git a/js/ui/layout.js b/js/ui/layout.js
index b1c3d92646..2943f06004 100644
--- a/js/ui/layout.js
+++ b/js/ui/layout.js
@@ -339,10 +339,11 @@ var LayoutManager = GObject.registerClass({
this.monitors = [];
let nMonitors = display.get_n_monitors();
- for (let i = 0; i < nMonitors; i++)
+ for (let i = 0; i < nMonitors; i++) {
this.monitors.push(new Monitor(i,
display.get_monitor_geometry(i),
display.get_monitor_scale(i)));
+ }
if (nMonitors == 0) {
this.primaryIndex = this.bottomIndex = -1;
@@ -970,9 +971,10 @@ var LayoutManager = GObject.registerClass({
if (this._startingUp)
return;
- if (!this._updateRegionIdle)
+ if (!this._updateRegionIdle) {
this._updateRegionIdle = Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
this._updateRegions.bind(this));
+ }
}
_getWindowActorsForWorkspace(workspace) {
diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js
index e38c3a4176..afec089d53 100644
--- a/js/ui/magnifier.js
+++ b/js/ui/magnifier.js
@@ -771,15 +771,16 @@ var ZoomRegion = class ZoomRegion {
}
_updateScreenPosition() {
- if (this._screenPosition == GDesktopEnums.MagnifierScreenPosition.NONE)
+ if (this._screenPosition == GDesktopEnums.MagnifierScreenPosition.NONE) {
this._setViewPort({
x: this._viewPortX,
y: this._viewPortY,
width: this._viewPortWidth,
height: this._viewPortHeight
});
- else
+ } else {
this.setScreenPosition(this._screenPosition);
+ }
}
_updateFocus(caller, event) {
@@ -1400,11 +1401,12 @@ var ZoomRegion = class ZoomRegion {
// If in lens mode, move the magnified view such that it is centered
// over the actual mouse. However, in full screen mode, the "lens" is
// the size of the screen -- pointless to move such a large lens around.
- if (this._lensMode && !this._isFullScreen())
+ if (this._lensMode && !this._isFullScreen()) {
this._setViewPort({ x: this._xCenter - this._viewPortWidth / 2,
y: this._yCenter - this._viewPortHeight / 2,
width: this._viewPortWidth,
height: this._viewPortHeight }, true);
+ }
this._updateCloneGeometry();
this._updateMousePosition();
diff --git a/js/ui/messageList.js b/js/ui/messageList.js
index 01f1da4850..195262cf5d 100644
--- a/js/ui/messageList.js
+++ b/js/ui/messageList.js
@@ -150,10 +150,11 @@ class URLHighlighter extends St.Label {
findPos = i;
}
if (findPos != -1) {
- for (let i = 0; i < this._urls.length; i++)
+ for (let i = 0; i < this._urls.length; i++) {
if (findPos >= this._urls[i].pos &&
this._urls[i].pos + this._urls[i].url.length > findPos)
return i;
+ }
}
return -1;
}
@@ -170,20 +171,22 @@ class ScaleLayout extends Clutter.BinLayout {
if (this._container == container)
return;
- if (this._container)
+ if (this._container) {
for (let id of this._signals)
this._container.disconnect(id);
+ }
this._container = container;
this._signals = [];
- if (this._container)
+ if (this._container) {
for (let signal of ['notify::scale-x', 'notify::scale-y']) {
let id = this._container.connect(signal, () => {
this.layout_changed();
});
this._signals.push(id);
}
+ }
}
vfunc_get_preferred_width(container, forHeight) {
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 4a62cdb6ac..695a676bf1 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -900,9 +900,10 @@ var Source = GObject.registerClass({
}
destroyNonResidentNotifications() {
- for (let i = this.notifications.length - 1; i >= 0; i--)
+ for (let i = this.notifications.length - 1; i >= 0; i--) {
if (!this.notifications[i].resident)
this.notifications[i].destroy();
+ }
}
});
diff --git a/js/ui/mpris.js b/js/ui/mpris.js
index 2b251546d3..5a936b5af9 100644
--- a/js/ui/mpris.js
+++ b/js/ui/mpris.js
@@ -191,28 +191,31 @@ var MprisPlayer = class MprisPlayer {
this._trackArtists = metadata['xesam:artist'];
if (!Array.isArray(this._trackArtists) ||
!this._trackArtists.every(artist => typeof artist === 'string')) {
- if (typeof this._trackArtists !== 'undefined')
+ if (typeof this._trackArtists !== 'undefined') {
log(`Received faulty track artist metadata from ${
this._busName}; expected an array of strings, got ${
this._trackArtists} (${typeof this._trackArtists})`);
+ }
this._trackArtists = [_("Unknown artist")];
}
this._trackTitle = metadata['xesam:title'];
if (typeof this._trackTitle !== 'string') {
- if (typeof this._trackTitle !== 'undefined')
+ if (typeof this._trackTitle !== 'undefined') {
log(`Received faulty track title metadata from ${
this._busName}; expected a string, got ${
this._trackTitle} (${typeof this._trackTitle})`);
+ }
this._trackTitle = _("Unknown title");
}
this._trackCoverUrl = metadata['mpris:artUrl'];
if (typeof this._trackCoverUrl !== 'string') {
- if (typeof this._trackCoverUrl !== 'undefined')
+ if (typeof this._trackCoverUrl !== 'undefined') {
log(`Received faulty track cover art metadata from ${
this._busName}; expected a string, got ${
this._trackCoverUrl} (${typeof this._trackCoverUrl})`);
+ }
this._trackCoverUrl = '';
}
diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js
index e9109dd51d..93348567b1 100644
--- a/js/ui/notificationDaemon.js
+++ b/js/ui/notificationDaemon.js
@@ -310,12 +310,13 @@ var FdoNotificationDaemon = class FdoNotificationDaemon {
if (actions.length) {
for (let i = 0; i < actions.length - 1; i += 2) {
let [actionId, label] = [actions[i], actions[i + 1]];
- if (actionId == 'default')
+ if (actionId == 'default') {
hasDefaultAction = true;
- else
+ } else {
notification.addAction(label, () => {
this._emitActionInvoked(ndata.id, actionId);
});
+ }
}
}
@@ -427,13 +428,14 @@ class FdoNotificationDaemonSource extends MessageTray.Source {
else
this.useNotificationIcon = true;
- if (sender)
+ if (sender) {
this._nameWatcherId = Gio.DBus.session.watch_name(sender,
Gio.BusNameWatcherFlags.NONE,
null,
this._onNameVanished.bind(this));
- else
+ } else {
this._nameWatcherId = 0;
+ }
}
_createPolicy() {
diff --git a/js/ui/osdWindow.js b/js/ui/osdWindow.js
index a91bcc7b8f..59dce86213 100644
--- a/js/ui/osdWindow.js
+++ b/js/ui/osdWindow.js
@@ -113,13 +113,14 @@ class OsdWindow extends St.Widget {
setLevel(value) {
this._level.visible = (value != undefined);
if (value != undefined) {
- if (this.visible)
+ if (this.visible) {
this._level.ease_property('value', value, {
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
duration: LEVEL_ANIMATION_TIME
});
- else
+ } else {
this._level.value = value;
+ }
}
}
diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js
index a529b83251..a97711b0ef 100644
--- a/js/ui/overviewControls.js
+++ b/js/ui/overviewControls.js
@@ -13,10 +13,10 @@ var SIDE_CONTROLS_ANIMATION_TIME = 160;
function getRtlSlideDirection(direction, actor) {
let rtl = (actor.text_direction == Clutter.TextDirection.RTL);
- if (rtl)
+ if (rtl) {
direction = (direction == SlideDirection.LEFT)
? SlideDirection.RIGHT : SlideDirection.LEFT;
-
+ }
return direction;
}
diff --git a/js/ui/panel.js b/js/ui/panel.js
index 46080987ce..f288aaf5d0 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -343,9 +343,10 @@ var AppMenuButton = GObject.registerClass({
if (focusedApp && focusedApp.is_on_workspace(workspace))
return focusedApp;
- for (let i = 0; i < this._startingApps.length; i++)
+ for (let i = 0; i < this._startingApps.length; i++) {
if (this._startingApps[i].is_on_workspace(workspace))
return this._startingApps[i];
+ }
return null;
}
@@ -470,9 +471,10 @@ class ActivitiesButton extends PanelMenu.Button {
vfunc_event(event) {
if (event.type() == Clutter.EventType.TOUCH_END ||
- event.type() == Clutter.EventType.BUTTON_RELEASE)
+ event.type() == Clutter.EventType.BUTTON_RELEASE) {
if (Main.overview.shouldToggleByCornerOrButton())
Main.overview.toggle();
+ }
return Clutter.EVENT_PROPAGATE;
}
@@ -622,14 +624,15 @@ class PanelCorner extends St.DrawingArea {
cr.setOperator(Cairo.Operator.SOURCE);
cr.moveTo(0, offsetY);
- if (this._side == St.Side.LEFT)
+ if (this._side == St.Side.LEFT) {
cr.arc(cornerRadius,
borderWidth + cornerRadius,
cornerRadius, Math.PI, 3 * Math.PI / 2);
- else
+ } else {
cr.arc(0,
borderWidth + cornerRadius,
cornerRadius, 3 * Math.PI / 2, 2 * Math.PI);
+ }
cr.lineTo(cornerRadius, offsetY);
cr.closePath();
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index 34e0413ddd..919e3d4089 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -19,9 +19,10 @@ var Ornament = {
};
function isPopupMenuItemVisible(child) {
- if (child._delegate instanceof PopupMenuSection)
+ if (child._delegate instanceof PopupMenuSection) {
if (child._delegate.isEmpty())
return false;
+ }
return child.visible;
}
@@ -809,9 +810,10 @@ var PopupMenu = class extends PopupMenuBase {
global.focus_manager.add_group(this.actor);
this.actor.reactive = true;
- if (this.sourceActor)
+ if (this.sourceActor) {
this._keyPressId = this.sourceActor.connect('key-press-event',
this._onKeyPress.bind(this));
+ }
this._openedSubMenu = null;
}
diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
index 3e5ee17e4e..4629e9fd60 100644
--- a/js/ui/screenShield.js
+++ b/js/ui/screenShield.js
@@ -1044,9 +1044,10 @@ var ScreenShield = class {
this._animateArrows();
}
- if (!this._arrowWatchId)
+ if (!this._arrowWatchId) {
this._arrowWatchId = this.idleMonitor.add_idle_watch(ARROW_IDLE_TIME,
this._pauseArrowAnimation.bind(this));
+ }
}
_pauseArrowAnimation() {
diff --git a/js/ui/search.js b/js/ui/search.js
index af927fc577..fe62f104e6 100644
--- a/js/ui/search.js
+++ b/js/ui/search.js
@@ -53,9 +53,10 @@ class SearchResult extends St.Button {
activate() {
this.provider.activateResult(this.metaInfo.id, this._resultsView.terms);
- if (this.metaInfo.clipboardText)
+ if (this.metaInfo.clipboardText) {
St.Clipboard.get_default().set_text(
St.ClipboardType.CLIPBOARD, this.metaInfo.clipboardText);
+ }
Main.overview.toggle();
}
});
@@ -549,19 +550,20 @@ var SearchResultsView = GObject.registerClass({
provider.searchInProgress = true;
let previousProviderResults = previousResults[provider.id];
- if (this._isSubSearch && previousProviderResults)
+ if (this._isSubSearch && previousProviderResults) {
provider.getSubsearchResultSet(previousProviderResults,
this._terms,
results => {
this._gotResults(results, provider);
},
this._cancellable);
- else
+ } else {
provider.getInitialResultSet(this._terms,
results => {
this._gotResults(results, provider);
},
this._cancellable);
+ }
});
this._updateSearchProgress();
diff --git a/js/ui/sessionMode.js b/js/ui/sessionMode.js
index e47bb97b13..220ea61239 100644
--- a/js/ui/sessionMode.js
+++ b/js/ui/sessionMode.js
@@ -143,9 +143,10 @@ function listModes() {
let loop = new GLib.MainLoop(null, false);
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
let names = Object.getOwnPropertyNames(_modes);
- for (let i = 0; i < names.length; i++)
+ for (let i = 0; i < names.length; i++) {
if (_modes[names[i]].isPrimary)
print(names[i]);
+ }
loop.quit();
});
GLib.Source.set_name_by_id(id, '[gnome-shell] listModes');
@@ -188,11 +189,12 @@ var SessionMode = class {
_sync() {
let params = _modes[this.currentMode];
let defaults;
- if (params.parentMode)
+ if (params.parentMode) {
defaults = Params.parse(_modes[params.parentMode],
_modes[DEFAULT_MODE]);
- else
+ } else {
defaults = _modes[DEFAULT_MODE];
+ }
params = Params.parse(params, defaults);
// A simplified version of Lang.copyProperties, handles
diff --git a/js/ui/shellMountOperation.js b/js/ui/shellMountOperation.js
index f8bda055f7..db9bdd1185 100644
--- a/js/ui/shellMountOperation.js
+++ b/js/ui/shellMountOperation.js
@@ -474,15 +474,16 @@ var ShellMountPasswordDialog = GObject.registerClass({
_onOpenDisksButton() {
let app = Shell.AppSystem.get_default().lookup_app('org.gnome.DiskUtility.desktop');
- if (app)
+ if (app) {
app.activate();
- else
+ } else {
Main.notifyError(
/* Translators: %s is the Disks application */
_("Unable to start %s").format(app.get_name()),
/* Translators: %s is the Disks application */
_("Couldn’t find the %s application").format(app.get_name())
);
+ }
this._onCancelButton();
}
});
diff --git a/js/ui/status/accessibility.js b/js/ui/status/accessibility.js
index 6ac7233a1b..6e07118fe2 100644
--- a/js/ui/status/accessibility.js
+++ b/js/ui/status/accessibility.js
@@ -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}`, () => {
diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js
index 1180e258c5..b5751023d4 100644
--- a/js/ui/status/keyboard.js
+++ b/js/ui/status/keyboard.js
@@ -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);
}
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 3835ffbc35..6008d64224 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -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();
}
diff --git a/js/ui/status/thunderbolt.js b/js/ui/status/thunderbolt.js
index 1424a8b789..c99cacac94 100644
--- a/js/ui/status/thunderbolt.js
+++ b/js/ui/status/thunderbolt.js
@@ -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() {
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index ab238e4454..4a618057f6 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -310,13 +310,14 @@ var ViewSelector = GObject.registerClass({
let page = new St.Bin({ child: actor });
- if (params.a11yFocus)
+ if (params.a11yFocus) {
Main.ctrlAltTabManager.addGroup(params.a11yFocus, name, a11yIcon);
- else
+ } else {
Main.ctrlAltTabManager.addGroup(actor, name, a11yIcon, {
proxy: this,
focusCallback: () => this._a11yFocusPage(page),
});
+ }
page.hide();
this.add_actor(page);
return page;
@@ -524,9 +525,10 @@ var ViewSelector = GObject.registerClass({
this._entry.set_secondary_icon(this._clearIcon);
- if (this._iconClickedId == 0)
+ if (this._iconClickedId == 0) {
this._iconClickedId = this._entry.connect('secondary-icon-clicked',
this.reset.bind(this));
+ }
} else {
if (this._iconClickedId > 0) {
this._entry.disconnect(this._iconClickedId);
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index 8101ae39e4..6f635c5bb6 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -1204,11 +1204,12 @@ var ThumbnailsBox = GObject.registerClass({
}
_updatePorthole() {
- if (!Main.layoutManager.primaryMonitor)
+ if (!Main.layoutManager.primaryMonitor) {
this._porthole = { width: global.stage.width, height: global.stage.height,
x: global.stage.x, y: global.stage.y };
- else
+ } else {
this._porthole = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex);
+ }
this.queue_relayout();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]