cleanup: Avoid unnecessary parentheses

Extra parentheses usually add noise rather than clarity, so avoid
them.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805
This commit is contained in:
Florian Müllner 2019-08-19 21:38:51 +02:00 committed by Georges Basile Stavracas Neto
parent ebf77748a8
commit e44adb92cf
59 changed files with 199 additions and 200 deletions

View File

@ -490,7 +490,7 @@ class EmptyPlaceholder extends Gtk.Box {
visible: true,
max_width_chars: 50,
hexpand: true,
vexpand: (appInfo == null),
vexpand: appInfo == null,
halign: Gtk.Align.CENTER,
valign: Gtk.Align.START,
});
@ -577,7 +577,7 @@ class ExtensionRow extends Gtk.ListBoxRow {
return;
this._extension = ExtensionUtils.deserializeExtension(newState);
let state = (this._extension.state == ExtensionState.ENABLED);
let state = this._extension.state == ExtensionState.ENABLED;
this._switch.block_signal_handler(this._notifyActiveId);
this._switch.state = state;

View File

@ -20,7 +20,7 @@ function FprintManager() {
g_interface_info: FprintManagerInfo,
g_name: 'net.reactivated.Fprint',
g_object_path: '/net/reactivated/Fprint/Manager',
g_flags: (Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES) });
g_flags: Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES });
try {
self.init(null);

View File

@ -23,7 +23,7 @@ function OVirtCredentials() {
g_interface_info: OVirtCredentialsInfo,
g_name: 'org.ovirt.vdsm.Credentials',
g_object_path: '/org/ovirt/vdsm/Credentials',
g_flags: (Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES) });
g_flags: Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES });
self.init(null);
return self;
}

View File

@ -129,7 +129,7 @@ class InputMethod extends Clutter.InputMethod {
_onForwardKeyEvent(_context, keyval, keycode, state) {
let press = (state & IBus.ModifierType.RELEASE_MASK) == 0;
state &= ~(IBus.ModifierType.RELEASE_MASK);
state &= ~IBus.ModifierType.RELEASE_MASK;
let curEvent = Clutter.get_current_event();
let time;

View File

@ -70,7 +70,7 @@ var IntrospectService = class {
for (let app of apps) {
let appInfo = {};
let isAppActive = (focusedApp == app);
let isAppActive = focusedApp == app;
if (!this._isStandaloneApp(app))
continue;
@ -104,10 +104,10 @@ var IntrospectService = class {
return false;
let type = window.get_window_type();
return (type == Meta.WindowType.NORMAL ||
return type == Meta.WindowType.NORMAL ||
type == Meta.WindowType.DIALOG ||
type == Meta.WindowType.MODAL_DIALOG ||
type == Meta.WindowType.UTILITY);
type == Meta.WindowType.UTILITY;
}
GetRunningApplicationsAsync(params, invocation) {
@ -152,7 +152,7 @@ var IntrospectService = class {
'app-id': GLib.Variant.new('s', app.get_id()),
'client-type': GLib.Variant.new('u', window.get_client_type()),
'is-hidden': GLib.Variant.new('b', window.is_hidden()),
'has-focus': GLib.Variant.new('b', (window == focusWindow)),
'has-focus': GLib.Variant.new('b', window == focusWindow),
'width': GLib.Variant.new('u', frameRect.width),
'height': GLib.Variant.new('u', frameRect.height),
};

View File

@ -79,7 +79,7 @@ function findMatchingSlash(expr, offset) {
// findMatchingBrace("[(])", 3) returns 1.
function findMatchingBrace(expr, offset) {
let closeBrace = expr.charAt(offset);
let openBrace = ({ ')': '(', ']': '[' })[closeBrace];
let openBrace = { ')': '(', ']': '[' }[closeBrace];
return findTheBrace(expr, offset - 1, openBrace, closeBrace);
}

View File

@ -121,7 +121,7 @@ function trySpawn(argv) {
// We are only interested in the part in the parentheses. (And
// we can't pattern match the text, since it gets localized.)
let message = err.message.replace(/.*\((.+)\)/, '$1');
throw new (err.constructor)({ code: err.code, message });
throw new err.constructor({ code: err.code, message });
} else {
throw err;
}
@ -329,7 +329,7 @@ function lowerBound(array, val, cmp) {
max = mid;
}
return (min == max || cmp(array[min], val) < 0) ? max : min;
return min == max || cmp(array[min], val) < 0 ? max : min;
}
// insertSorted:

View File

@ -169,9 +169,9 @@ var WeatherClient = class {
}
_onInstalledChanged() {
let hadApp = (this._weatherApp != null);
let hadApp = this._weatherApp != null;
this._weatherApp = this._appSystem.lookup_app(WEATHER_APP_ID);
let haveApp = (this._weatherApp != null);
let haveApp = this._weatherApp != null;
if (hadApp !== haveApp)
this.emit('changed');
@ -205,7 +205,7 @@ var WeatherClient = class {
this._weatherInfo.abort();
this._weatherInfo.set_location(location);
this._locationValid = (location != null);
this._locationValid = location != null;
this._weatherInfo.set_enabled_providers(location ? this._providers : 0);

View File

@ -86,7 +86,7 @@ class Animation extends St.Bin {
if (oldFrameActor)
oldFrameActor.hide();
this._frame = (frame % this._animations.get_n_children());
this._frame = frame % this._animations.get_n_children();
let newFrameActor = this._animations.get_child_at_index(this._frame);
if (newFrameActor)

View File

@ -456,7 +456,7 @@ var AllView = GObject.registerClass({
let newApps = [];
this._appInfoList = Shell.AppSystem.get_default().get_installed().filter(appInfo => {
try {
(appInfo.get_id()); // catch invalid file encodings
appInfo.get_id(); // catch invalid file encodings
} catch (e) {
return false;
}

View File

@ -37,9 +37,9 @@ function addBackgroundMenu(actor, layoutManager) {
let clickAction = new Clutter.ClickAction();
clickAction.connect('long-press', (action, theActor, state) => {
if (state == Clutter.LongPressState.QUERY) {
return ((action.get_button() == 0 ||
return (action.get_button() == 0 ||
action.get_button() == 1) &&
!actor._backgroundMenu.isOpen);
!actor._backgroundMenu.isOpen;
}
if (state == Clutter.LongPressState.ACTIVATE) {
let [x, y] = action.get_coords();

View File

@ -72,7 +72,7 @@ var BoxPointer = GObject.registerClass({
open(animate, onComplete) {
let themeNode = this.get_theme_node();
let rise = themeNode.get_length('-arrow-rise');
let animationTime = (animate & PopupAnimation.FULL) ? POPUP_ANIMATION_TIME : 0;
let animationTime = animate & PopupAnimation.FULL ? POPUP_ANIMATION_TIME : 0;
if (animate & PopupAnimation.FADE)
this.opacity = 0;
@ -120,8 +120,8 @@ var BoxPointer = GObject.registerClass({
let translationY = 0;
let themeNode = this.get_theme_node();
let rise = themeNode.get_length('-arrow-rise');
let fade = (animate & PopupAnimation.FADE);
let animationTime = (animate & PopupAnimation.FULL) ? POPUP_ANIMATION_TIME : 0;
let fade = animate & PopupAnimation.FADE;
let animationTime = animate & PopupAnimation.FULL ? POPUP_ANIMATION_TIME : 0;
if (animate & PopupAnimation.SLIDE) {
switch (this._arrowSide) {
@ -473,7 +473,7 @@ var BoxPointer = GObject.registerClass({
let borderWidth = themeNode.get_length('-arrow-border-width');
let arrowBase = themeNode.get_length('-arrow-base');
let borderRadius = themeNode.get_length('-arrow-border-radius');
let margin = (4 * borderRadius + borderWidth + arrowBase);
let margin = 4 * borderRadius + borderWidth + arrowBase;
let gap = themeNode.get_length('-boxpointer-gap');
let padding = themeNode.get_length('-arrow-rise');
@ -524,11 +524,11 @@ var BoxPointer = GObject.registerClass({
arrowOrigin = sourceCenterX - resX;
if (arrowOrigin <= (x1 + (borderRadius + halfBase))) {
if (arrowOrigin > x1)
resX += (arrowOrigin - x1);
resX += arrowOrigin - x1;
arrowOrigin = x1;
} else if (arrowOrigin >= (x2 - (borderRadius + halfBase))) {
if (arrowOrigin < x2)
resX -= (x2 - arrowOrigin);
resX -= x2 - arrowOrigin;
arrowOrigin = x2;
}
break;
@ -543,11 +543,11 @@ var BoxPointer = GObject.registerClass({
arrowOrigin = sourceCenterY - resY;
if (arrowOrigin <= (y1 + (borderRadius + halfBase))) {
if (arrowOrigin > y1)
resY += (arrowOrigin - y1);
resY += arrowOrigin - y1;
arrowOrigin = y1;
} else if (arrowOrigin >= (y2 - (borderRadius + halfBase))) {
if (arrowOrigin < y2)
resX -= (y2 - arrowOrigin);
resX -= y2 - arrowOrigin;
arrowOrigin = y2;
}
break;

View File

@ -20,7 +20,7 @@ var MESSAGE_ICON_SIZE = -1; // pick up from CSS
var NC_ = (context, str) => `${context}\u0004${str}`;
function sameYear(dateA, dateB) {
return (dateA.getYear() == dateB.getYear());
return dateA.getYear() == dateB.getYear();
}
function sameMonth(dateA, dateB) {
@ -712,15 +712,15 @@ class EventMessage extends MessageList.Message {
vfunc_style_changed() {
let iconVisible = this.get_parent().has_style_pseudo_class('first-child');
this._icon.opacity = (iconVisible ? 255 : 0);
this._icon.opacity = iconVisible ? 255 : 0;
super.vfunc_style_changed();
}
_formatEventTime() {
let periodBegin = _getBeginningOfDay(this._date);
let periodEnd = _getEndOfDay(this._date);
let allDay = (this._event.allDay || (this._event.date <= periodBegin &&
this._event.end >= periodEnd));
let allDay = this._event.allDay || (this._event.date <= periodBegin &&
this._event.end >= periodEnd);
let title;
if (allDay) {
/* Translators: Shown in calendar event list for all day events
@ -910,7 +910,7 @@ class EventsSection extends MessageList.MessageListSection {
_appInstalledChanged() {
this._calendarApp = undefined;
this._title.reactive = (this._getCalendarApp() != null);
this._title.reactive = this._getCalendarApp() != null;
}
_getCalendarApp() {

View File

@ -222,7 +222,7 @@ var AutomountManager = class {
delete volume._allowAutorunExpireId;
}
this._volumeQueue =
this._volumeQueue.filter(element => (element != volume));
this._volumeQueue.filter(element => element != volume);
}
_reaskPassword(volume) {

View File

@ -41,7 +41,7 @@ function isMountRootHidden(root) {
let path = root.get_path();
// skip any mounts in hidden directory hierarchies
return (path.includes('/.'));
return path.includes('/.');
}
function isMountNonLocal(mount) {
@ -52,7 +52,7 @@ function isMountNonLocal(mount) {
if (volume == null)
return true;
return (volume.get_identifier("class") == "network");
return volume.get_identifier("class") == "network";
}
function startAppForMount(app, mount) {
@ -125,7 +125,7 @@ var ContentTypeDiscoverer = class {
_emitCallback(mount, contentTypes = []) {
// we're not interested in win32 software content types here
contentTypes = contentTypes.filter(
type => (type != 'x-content/win32-software')
type => type != 'x-content/win32-software'
);
let apps = [];
@ -202,7 +202,7 @@ var AutorunDispatcher = class {
}
_getSourceForMount(mount) {
let filtered = this._sources.filter(source => (source.mount == mount));
let filtered = this._sources.filter(source => source.mount == mount);
// we always make sure not to add two sources for the same
// mount in addMount(), so it's safe to assume filtered.length

View File

@ -96,9 +96,9 @@ class KeyringDialog extends ModalDialog.ModalDialog {
}
if (this.prompt.confirm_visible) {
var label = new St.Label(({ style_class: 'prompt-dialog-password-label',
var label = new St.Label({ style_class: 'prompt-dialog-password-label',
x_align: Clutter.ActorAlign.START,
y_align: Clutter.ActorAlign.CENTER }));
y_align: Clutter.ActorAlign.CENTER });
label.set_text(_("Type again:"));
this._confirmEntry = new St.Entry({ style_class: 'prompt-dialog-password-entry',
text: '',

View File

@ -169,7 +169,7 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
return true;
}
return (value.length >= 8 && value.length <= 63);
return value.length >= 8 && value.length <= 63;
}
_validateStaticWep(secret) {

View File

@ -87,10 +87,10 @@ var AuthenticationDialog = GObject.registerClass({
this._passwordBox = new St.BoxLayout({ vertical: false, style_class: 'prompt-dialog-password-box' });
content.messageBox.add(this._passwordBox);
this._passwordLabel = new St.Label(({
this._passwordLabel = new St.Label({
style_class: 'prompt-dialog-password-label',
y_align: Clutter.ActorAlign.CENTER,
}));
});
this._passwordBox.add_child(this._passwordLabel);
this._passwordEntry = new St.Entry({
style_class: 'prompt-dialog-password-entry',

View File

@ -19,7 +19,7 @@ const MessageTray = imports.ui.messageTray;
const Params = imports.misc.params;
const Util = imports.misc.util;
const HAVE_TP = (Tp != null && Tpl != null);
const HAVE_TP = Tp != null && Tpl != null;
// See Notification.appendMessage
var SCROLLBACK_IMMEDIATE_TIME = 3 * 60; // 3 minutes
@ -158,7 +158,7 @@ class TelepathyClient extends Tp.BaseClient {
continue;
/* Only observe contact text channels */
if ((!(channel instanceof Tp.TextChannel)) ||
if (!(channel instanceof Tp.TextChannel) ||
targetHandleType != Tp.HandleType.CONTACT)
continue;
@ -683,8 +683,8 @@ var ChatNotification = HAVE_TP ? GObject.registerClass({
bannerMarkup: true });
}
let group = (message.direction == NotificationDirection.RECEIVED
? 'received' : 'sent');
let group = message.direction == NotificationDirection.RECEIVED
? 'received' : 'sent';
this._append({ body: messageBody,
group,
@ -698,7 +698,7 @@ var ChatNotification = HAVE_TP ? GObject.registerClass({
return;
let lastMessageTime = this.messages[0].timestamp;
let currentTime = (Date.now() / 1000);
let currentTime = Date.now() / 1000;
// Keep the scrollback from growing too long. If the most
// recent message (before the one we just added) is within
@ -706,7 +706,7 @@ var ChatNotification = HAVE_TP ? GObject.registerClass({
// SCROLLBACK_RECENT_LENGTH previous messages. Otherwise
// we'll keep SCROLLBACK_IDLE_LENGTH messages.
let maxLength = (lastMessageTime < currentTime - SCROLLBACK_RECENT_TIME)
let maxLength = lastMessageTime < currentTime - SCROLLBACK_RECENT_TIME
? SCROLLBACK_IDLE_LENGTH : SCROLLBACK_RECENT_LENGTH;
let filteredHistory = this.messages.filter(item => item.realMessage);
@ -729,7 +729,7 @@ var ChatNotification = HAVE_TP ? GObject.registerClass({
* noTimestamp: suppress timestamp signal?
*/
_append(props) {
let currentTime = (Date.now() / 1000);
let currentTime = Date.now() / 1000;
props = Params.parse(props, { body: null,
group: null,
styles: [],

View File

@ -851,7 +851,7 @@ var Dash = GObject.registerClass({
if (!this._dragPlaceholder)
return DND.DragMotionResult.NO_DROP;
let srcIsFavorite = (favPos != -1);
let srcIsFavorite = favPos != -1;
if (srcIsFavorite)
return DND.DragMotionResult.MOVE_DROP;
@ -874,7 +874,7 @@ var Dash = GObject.registerClass({
let favorites = AppFavorites.getAppFavorites().getFavoriteMap();
let srcIsFavorite = (id in favorites);
let srcIsFavorite = id in favorites;
let favPos = 0;
let children = this._box.get_children();

View File

@ -157,7 +157,7 @@ class WorldClocksSection extends St.Button {
});
let layout = this._grid.layout_manager;
let title = (this._locations.length == 0)
let title = this._locations.length == 0
? _("Add world clocks…")
: _("World Clocks");
let header = new St.Label({ style_class: 'world-clocks-header',
@ -182,8 +182,8 @@ class WorldClocksSection extends St.Button {
let otherOffset = this._getTimeAtLocation(l).get_utc_offset();
let offset = (otherOffset - localOffset) / GLib.TIME_SPAN_HOUR;
let fmt = (Math.trunc(offset) == offset) ? '%s%.0f' : '%s%.1f';
let prefix = (offset >= 0) ? '+' : '-';
let fmt = Math.trunc(offset) == offset ? '%s%.0f' : '%s%.1f';
let prefix = offset >= 0 ? '+' : '-';
let tz = new St.Label({ style_class: 'world-clocks-timezone',
text: fmt.format(prefix, Math.abs(offset)),
x_align: Clutter.ActorAlign.END,
@ -438,7 +438,7 @@ class MessagesIndicator extends St.Icon {
this._sources.forEach(source => (count += source.unseenCount));
count -= Main.messageTray.queueCount;
this.visible = (count > 0);
this.visible = count > 0;
}
});

View File

@ -213,9 +213,9 @@ var _Draggable = class _Draggable {
_eventIsRelease(event) {
if (event.type() == Clutter.EventType.BUTTON_RELEASE) {
let buttonMask = (Clutter.ModifierType.BUTTON1_MASK |
let buttonMask = Clutter.ModifierType.BUTTON1_MASK |
Clutter.ModifierType.BUTTON2_MASK |
Clutter.ModifierType.BUTTON3_MASK);
Clutter.ModifierType.BUTTON3_MASK;
/* We only obey the last button release from the device,
* other buttons may get pressed/released during the DnD op.
*/
@ -644,7 +644,7 @@ var _Draggable = class _Draggable {
_cancelDrag(eventTime) {
this.emit('drag-cancelled', eventTime);
let wasCancelled = (this._dragState == DragState.CANCELLED);
let wasCancelled = this._dragState == DragState.CANCELLED;
this._dragState = DragState.CANCELLED;
if (this._actorDestroyed || wasCancelled) {

View File

@ -37,10 +37,10 @@ var EdgeDragAction = GObject.registerClass({
let [x, y] = this.get_press_coords(0);
let monitorRect = this._getMonitorRect(x, y);
return ((this._side == St.Side.LEFT && x < monitorRect.x + EDGE_THRESHOLD) ||
return (this._side == St.Side.LEFT && x < monitorRect.x + EDGE_THRESHOLD) ||
(this._side == St.Side.RIGHT && x > monitorRect.x + monitorRect.width - EDGE_THRESHOLD) ||
(this._side == St.Side.TOP && y < monitorRect.y + EDGE_THRESHOLD) ||
(this._side == St.Side.BOTTOM && y > monitorRect.y + monitorRect.height - EDGE_THRESHOLD));
(this._side == St.Side.BOTTOM && y > monitorRect.y + monitorRect.height - EDGE_THRESHOLD);
}
vfunc_gesture_progress(_actor) {

View File

@ -218,7 +218,7 @@ function init() {
// This always returns the same singleton object
// By instantiating it initially, we register the
// bus object, etc.
(new EndSessionDialog());
new EndSessionDialog();
}
var EndSessionDialog = GObject.registerClass(
@ -366,7 +366,7 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
}
_sync() {
let open = (this.state == ModalDialog.State.OPENING || this.state == ModalDialog.State.OPENED);
let open = this.state == ModalDialog.State.OPENING || this.state == ModalDialog.State.OPENED;
if (!open)
return;
@ -566,7 +566,7 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
this._timerId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 1, () => {
let currentTime = GLib.get_monotonic_time();
let secondsElapsed = ((currentTime - startTime) / 1000000);
let secondsElapsed = (currentTime - startTime) / 1000000;
this._secondsLeft = this._totalSecondsToStayOpen - secondsElapsed;
if (this._secondsLeft > 0) {
@ -754,14 +754,14 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
let updatesAllowed = this._updatesPermission && this._updatesPermission.allowed;
_setCheckBoxLabel(this._checkBox, dialogContent.checkBoxText || '');
this._checkBox.visible = (dialogContent.checkBoxText && updatePrepared && updatesAllowed);
this._checkBox.checked = (updatePrepared && updateTriggered);
this._checkBox.visible = dialogContent.checkBoxText && updatePrepared && updatesAllowed;
this._checkBox.checked = updatePrepared && updateTriggered;
// We show the warning either together with the checkbox, or when
// updates have already been triggered, but the user doesn't have
// enough permissions to cancel them.
this._batteryWarning.visible = (dialogContent.showBatteryWarning &&
(this._checkBox.visible || updatePrepared && updateTriggered && !updatesAllowed));
this._batteryWarning.visible = dialogContent.showBatteryWarning &&
(this._checkBox.visible || updatePrepared && updateTriggered && !updatesAllowed);
this._updateButtons();

View File

@ -195,7 +195,7 @@ var GrabHelper = class GrabHelper {
}
_takeModalGrab() {
let firstGrab = (this._modalCount == 0);
let firstGrab = this._modalCount == 0;
if (firstGrab) {
if (!Main.pushModal(this._owner, this._modalParams))
return false;

View File

@ -118,7 +118,7 @@ var CandidateArea = GObject.registerClass({
if (!visible)
continue;
box._indexLabel.text = ((indexes && indexes[i]) ? indexes[i] : DEFAULT_INDEX_LABELS[i]);
box._indexLabel.text = indexes && indexes[i] ? indexes[i] : DEFAULT_INDEX_LABELS[i];
box._candidateLabel.text = candidates[i];
}
@ -250,7 +250,7 @@ class IbusCandidatePopup extends BoxPointer.BoxPointer {
let cursorPos = lookupTable.get_cursor_pos();
let pageSize = lookupTable.get_page_size();
let nPages = Math.ceil(nCandidates / pageSize);
let page = ((cursorPos == 0) ? 0 : Math.floor(cursorPos / pageSize));
let page = cursorPos == 0 ? 0 : Math.floor(cursorPos / pageSize);
let startIndex = page * pageSize;
let endIndex = Math.min((page + 1) * pageSize, nCandidates);
@ -301,10 +301,10 @@ class IbusCandidatePopup extends BoxPointer.BoxPointer {
}
_updateVisibility() {
let isVisible = (!Main.keyboard.visible &&
let isVisible = !Main.keyboard.visible &&
(this._preeditText.visible ||
this._auxText.visible ||
this._candidateArea.visible));
this._candidateArea.visible);
if (isVisible) {
this.setPosition(this._dummyCursor, 0);

View File

@ -678,8 +678,8 @@ var IconGrid = GObject.registerClass({
nRows(forWidth) {
let children = this._getVisibleChildren();
let nColumns = (forWidth < 0) ? children.length : this._computeLayout(forWidth)[0];
let nRows = (nColumns > 0) ? Math.ceil(children.length / nColumns) : 0;
let nColumns = forWidth < 0 ? children.length : this._computeLayout(forWidth)[0];
let nRows = nColumns > 0 ? Math.ceil(children.length / nColumns) : 0;
if (this._rowLimit)
nRows = Math.min(nRows, this._rowLimit);
return nRows;
@ -798,7 +798,7 @@ var IconGrid = GObject.registerClass({
let neededWidth = this.usedWidthForNColumns(this._minColumns) - availWidth;
let neededHeight = this.usedHeightForNRows(this._minRows) - availHeight;
let neededSpacePerItem = (neededWidth > neededHeight)
let neededSpacePerItem = neededWidth > neededHeight
? Math.ceil(neededWidth / this._minColumns)
: Math.ceil(neededHeight / this._minRows);
this._fixedHItemSize = Math.max(this._hItemSize - neededSpacePerItem, MIN_ICON_SIZE);
@ -976,7 +976,7 @@ var PaginatedIconGrid = GObject.registerClass({
let childrenPerRow = this._childrenPerPage / this._rowsPerPage;
let sourceRow = Math.floor((index - pageOffset) / childrenPerRow);
let nRowsAbove = (side == St.Side.TOP) ? sourceRow + 1 : sourceRow;
let nRowsAbove = side == St.Side.TOP ? sourceRow + 1 : sourceRow;
let nRowsBelow = this._rowsPerPage - nRowsAbove;
let nRowsUp, nRowsDown;

View File

@ -362,8 +362,8 @@ var Key = GObject.registerClass({
_onCapturedEvent(actor, event) {
let type = event.type();
let press = (type == Clutter.EventType.BUTTON_PRESS || type == Clutter.EventType.TOUCH_BEGIN);
let release = (type == Clutter.EventType.BUTTON_RELEASE || type == Clutter.EventType.TOUCH_END);
let press = type == Clutter.EventType.BUTTON_PRESS || type == Clutter.EventType.TOUCH_BEGIN;
let release = type == Clutter.EventType.BUTTON_RELEASE || type == Clutter.EventType.TOUCH_END;
if (event.get_source() == this._boxPointer.bin ||
this._boxPointer.bin.contains(event.get_source()))
@ -1350,7 +1350,7 @@ class Keyboard extends St.BoxLayout {
* basically). We however make things consistent by skipping that
* second level.
*/
let level = (i >= 1 && levels.length == 3) ? i + 1 : i;
let level = i >= 1 && levels.length == 3 ? i + 1 : i;
let layout = new KeyContainer();
layout.shiftKeys = [];
@ -1439,7 +1439,7 @@ class Keyboard extends St.BoxLayout {
if (switchToLevel != null) {
this._setActiveLayer(switchToLevel);
// Shift only gets latched on long press
this._latched = (switchToLevel != 1);
this._latched = switchToLevel != 1;
} else if (keyval != null) {
this._keyboardController.keyvalPress(keyval);
}
@ -1609,7 +1609,7 @@ class Keyboard extends St.BoxLayout {
else if (state == Clutter.InputPanelState.ON)
enabled = true;
else if (state == Clutter.InputPanelState.TOGGLE)
enabled = (this._keyboardVisible == false);
enabled = this._keyboardVisible == false;
else
return;

View File

@ -194,7 +194,7 @@ var LayoutManager = GObject.registerClass({
_init() {
super._init();
this._rtl = (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL);
this._rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL;
this.monitors = [];
this.primaryMonitor = null;
this.primaryIndex = -1;

View File

@ -118,7 +118,7 @@ var Magnifier = class Magnifier {
});
// Export to dbus.
(new MagnifierDBus.ShellMagnifier());
new MagnifierDBus.ShellMagnifier();
this.setActive(St.Settings.get().magnifier_active);
}
@ -466,7 +466,7 @@ var Magnifier = class Magnifier {
getCrosshairsClip() {
if (this._crossHairs) {
let [clipWidth, clipHeight] = this._crossHairs.getClip();
return (clipWidth > 0 && clipHeight > 0);
return clipWidth > 0 && clipHeight > 0;
} else {
return false;
}
@ -1420,10 +1420,9 @@ var ZoomRegion = class ZoomRegion {
let xMouse = this._magnifier.xMouse;
let yMouse = this._magnifier.yMouse;
mouseIsOver = (
mouseIsOver =
xMouse >= this._viewPortX && xMouse < (this._viewPortX + this._viewPortWidth) &&
yMouse >= this._viewPortY && yMouse < (this._viewPortY + this._viewPortHeight)
);
yMouse >= this._viewPortY && yMouse < (this._viewPortY + this._viewPortHeight);
}
return mouseIsOver;
}
@ -1495,14 +1494,14 @@ var ZoomRegion = class ZoomRegion {
let yRoiBottom = yRoi + heightRoi - cursorHeight;
if (xPoint < xRoi)
xPos -= (xRoi - xPoint);
xPos -= xRoi - xPoint;
else if (xPoint > xRoiRight)
xPos += (xPoint - xRoiRight);
xPos += xPoint - xRoiRight;
if (yPoint < yRoi)
yPos -= (yRoi - yPoint);
yPos -= yRoi - yPoint;
else if (yPoint > yRoiBottom)
yPos += (yPoint - yRoiBottom);
yPos += yPoint - yRoiBottom;
return [xPos, yPos];
}
@ -1868,8 +1867,8 @@ var MagShaderEffects = class MagShaderEffects {
// it modifies the brightness and/or contrast.
let [cRed, cGreen, cBlue] = this._brightnessContrast.get_contrast();
this._brightnessContrast.set_enabled(
(bRed != NO_CHANGE || bGreen != NO_CHANGE || bBlue != NO_CHANGE ||
cRed != NO_CHANGE || cGreen != NO_CHANGE || cBlue != NO_CHANGE)
bRed != NO_CHANGE || bGreen != NO_CHANGE || bBlue != NO_CHANGE ||
cRed != NO_CHANGE || cGreen != NO_CHANGE || cBlue != NO_CHANGE
);
}

View File

@ -199,7 +199,7 @@ function _initializeUI() {
layoutManager.init();
overview.init();
(new PointerA11yTimeout.PointerA11yTimeout());
new PointerA11yTimeout.PointerA11yTimeout();
_a11ySettings = new Gio.Settings({ schema_id: A11Y_SCHEMA });
@ -600,7 +600,7 @@ function openRunDialog() {
function activateWindow(window, time, workspaceNum) {
let workspaceManager = global.workspace_manager;
let activeWorkspaceNum = workspaceManager.get_active_workspace_index();
let windowWorkspaceNum = (workspaceNum !== undefined) ? workspaceNum : window.get_workspace().index();
let windowWorkspaceNum = workspaceNum !== undefined ? workspaceNum : window.get_workspace().index();
if (!time)
time = global.get_current_time();
@ -686,7 +686,7 @@ function _queueBeforeRedraw(workId) {
*/
function initializeDeferredWork(actor, callback) {
// Turn into a string so we can use as an object property
let workId = `${(++_deferredWorkSequence)}`;
let workId = `${++_deferredWorkSequence}`;
_deferredWorkData[workId] = { actor,
callback };
actor.connect('notify::mapped', () => {

View File

@ -235,7 +235,7 @@ var LabelExpanderLayout = GObject.registerClass({
let visibleIndex = this._expansion > 0 ? 1 : 0;
for (let i = 0; this._container && i < this._container.get_n_children(); i++)
this._container.get_child_at_index(i).visible = (i == visibleIndex);
this._container.get_child_at_index(i).visible = i == visibleIndex;
this.layout_changed();
}
@ -382,7 +382,7 @@ var Message = GObject.registerClass({
setIcon(actor) {
this._iconBin.child = actor;
this._iconBin.visible = (actor != null);
this._iconBin.visible = actor != null;
}
setSecondaryActor(actor) {
@ -453,7 +453,7 @@ var Message = GObject.registerClass({
expand(animate) {
this.expanded = true;
this._actionBin.visible = (this._actionBin.get_n_children() > 0);
this._actionBin.visible = this._actionBin.get_n_children() > 0;
if (this._bodyStack.get_n_children() < 2) {
this._expandedLabel = new URLHighlighter(this._bodyText,

View File

@ -1162,7 +1162,7 @@ var MessageTray = GObject.registerClass({
// indicator in the panel; however do make an exception for CRITICAL
// notifications, as only banner mode allows expansion.
let bannerCount = this._notification ? 1 : 0;
let full = (this.queueCount + bannerCount >= MAX_NOTIFICATIONS_IN_QUEUE);
let full = this.queueCount + bannerCount >= MAX_NOTIFICATIONS_IN_QUEUE;
if (!full || notification.urgency == Urgency.CRITICAL) {
notification.connect('destroy',
this._onNotificationDestroy.bind(this));
@ -1309,7 +1309,7 @@ var MessageTray = GObject.registerClass({
let nextNotification = this._notificationQueue[0] || null;
if (hasNotifications && nextNotification) {
let limited = this._busy || Main.layoutManager.primaryMonitor.inFullscreen;
let showNextNotification = (!limited || nextNotification.forFeedback || nextNotification.urgency == Urgency.CRITICAL);
let showNextNotification = !limited || nextNotification.forFeedback || nextNotification.urgency == Urgency.CRITICAL;
if (showNextNotification)
this._showNotification();
}
@ -1319,7 +1319,7 @@ var MessageTray = GObject.registerClass({
this._notification.urgency != Urgency.CRITICAL &&
!this._banner.focused &&
!this._pointerInNotification) || this._notificationExpired;
let mustClose = (this._notificationRemoved || !hasNotifications || expired);
let mustClose = this._notificationRemoved || !hasNotifications || expired;
if (mustClose) {
let animate = hasNotifications && !this._notificationRemoved;

View File

@ -346,7 +346,7 @@ var FdoNotificationDaemon = class FdoNotificationDaemon {
// of the 'transient' hint with hints['transient'] rather than hints.transient
notification.setTransient(!!hints['transient']);
let privacyScope = (hints['x-gnome-privacy-scope'] || 'user');
let privacyScope = hints['x-gnome-privacy-scope'] || 'user';
notification.setPrivacyScope(privacyScope == 'system'
? MessageTray.PrivacyScope.SYSTEM
: MessageTray.PrivacyScope.USER);

View File

@ -66,7 +66,7 @@ var OsdMonitorLabeler = class {
_trackClient(client) {
if (this._client)
return (this._client == client);
return this._client == client;
this._client = client;
this._clientWatchId = Gio.bus_watch_name(Gio.BusType.SESSION, client, 0, null,

View File

@ -105,13 +105,13 @@ class OsdWindow extends St.Widget {
}
setLabel(label) {
this._label.visible = (label != undefined);
this._label.visible = label != undefined;
if (label)
this._label.text = label;
}
setLevel(value) {
this._level.visible = (value != undefined);
this._level.visible = value != undefined;
if (value != undefined) {
if (this.visible) {
this._level.ease_property('value', value, {

View File

@ -614,8 +614,8 @@ var Overview = class {
let event = Clutter.get_current_event();
if (event) {
let type = event.type();
let button = (type == Clutter.EventType.BUTTON_PRESS ||
type == Clutter.EventType.BUTTON_RELEASE);
let button = type == Clutter.EventType.BUTTON_PRESS ||
type == Clutter.EventType.BUTTON_RELEASE;
let ctrl = (event.get_state() & Clutter.ModifierType.CONTROL_MASK) != 0;
if (button && ctrl)
return;

View File

@ -12,9 +12,9 @@ const WorkspaceThumbnail = imports.ui.workspaceThumbnail;
var SIDE_CONTROLS_ANIMATION_TIME = 160;
function getRtlSlideDirection(direction, actor) {
let rtl = (actor.text_direction == Clutter.TextDirection.RTL);
let rtl = actor.text_direction == Clutter.TextDirection.RTL;
if (rtl) {
direction = (direction == SlideDirection.LEFT)
direction = direction == SlideDirection.LEFT
? SlideDirection.RIGHT : SlideDirection.LEFT;
}
return direction;
@ -67,7 +67,7 @@ var SlideLayout = GObject.registerClass({
// flags only determine what to do if the allocated box is bigger
// than the actor's box.
let realDirection = getRtlSlideDirection(this._direction, child);
let alignX = (realDirection == SlideDirection.LEFT)
let alignX = realDirection == SlideDirection.LEFT
? availWidth - natWidth
: availWidth - natWidth * this._slideX;
@ -178,7 +178,7 @@ class SlidingControl extends St.Widget {
let translationEnd = 0;
let translation = this._getTranslation();
let shouldShow = (this._getSlide() > 0);
let shouldShow = this._getSlide() > 0;
if (shouldShow)
translationStart = translation;
else
@ -489,9 +489,9 @@ class ControlsManager extends St.Widget {
return;
let activePage = this.viewSelector.getActivePage();
let dashVisible = (activePage == ViewSelector.ViewPage.WINDOWS ||
activePage == ViewSelector.ViewPage.APPS);
let thumbnailsVisible = (activePage == ViewSelector.ViewPage.WINDOWS);
let dashVisible = activePage == ViewSelector.ViewPage.WINDOWS ||
activePage == ViewSelector.ViewPage.APPS;
let thumbnailsVisible = activePage == ViewSelector.ViewPage.WINDOWS;
if (dashVisible)
this._dashSlider.slideIn();
@ -509,7 +509,7 @@ class ControlsManager extends St.Widget {
return;
let activePage = this.viewSelector.getActivePage();
this._dashSpacer.visible = (activePage == ViewSelector.ViewPage.WINDOWS);
this._dashSpacer.visible = activePage == ViewSelector.ViewPage.WINDOWS;
}
_onPageEmpty() {

View File

@ -233,7 +233,7 @@ var ActionEditor = GObject.registerClass({
this._actionComboBox.setAction(this._currentAction);
this._updateKeybindingEntryState();
let isButton = (action == Meta.PadActionType.BUTTON);
let isButton = action == Meta.PadActionType.BUTTON;
this._actionComboBox.setButtonActionsActive(isButton);
}
@ -344,19 +344,19 @@ var PadDiagram = GObject.registerClass({
}
_wrappingSvgHeader() {
return ('<?xml version="1.0" encoding="UTF-8" standalone="no"?>' +
return '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' +
'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" ' +
'xmlns:xi="http://www.w3.org/2001/XInclude" ' +
`width="${ // " (give xgettext the paired quotes it expects)
this._imageWidth
}" height="${this._imageHeight}"> ` + // "
'<style type="text/css">');
'<style type="text/css">';
}
_wrappingSvgFooter() {
return ('</style>' +
return '</style>' +
'<xi:include href="' + this._imagePath + '" />' +
'</svg>');
'</svg>';
}
_cssString() {
@ -852,15 +852,15 @@ var PadOsd = GObject.registerClass({
if (!this._editedAction)
return false;
return (this._editedAction.type == type &&
return this._editedAction.type == type &&
this._editedAction.number == number &&
this._editedAction.dir == dir);
this._editedAction.dir == dir;
}
_followUpActionEdition(str) {
let { type, dir, number, mode } = this._editedAction;
let hasNextAction = (type == Meta.PadActionType.RING && dir == CCW ||
type == Meta.PadActionType.STRIP && dir == UP);
let hasNextAction = type == Meta.PadActionType.RING && dir == CCW ||
type == Meta.PadActionType.STRIP && dir == UP;
if (!hasNextAction)
return false;

View File

@ -81,7 +81,7 @@ var PageIndicators = GObject.registerClass({
children[i].destroy();
}
this._nPages = nPages;
this.visible = (this._nPages > 1);
this.visible = this._nPages > 1;
}
setCurrentPage(currentPage) {

View File

@ -118,7 +118,7 @@ class AppMenu extends PopupMenu.PopupMenu {
_updateDetailsVisibility() {
let sw = this._appSystem.lookup_app('org.gnome.Software.desktop');
this._detailsItem.visible = (sw != null);
this._detailsItem.visible = sw != null;
}
isEmpty() {
@ -369,21 +369,21 @@ var AppMenuButton = GObject.registerClass({
}
}
let visible = (this._targetApp != null && !Main.overview.visibleTarget);
let visible = this._targetApp != null && !Main.overview.visibleTarget;
if (visible)
this.fadeIn();
else
this.fadeOut();
let isBusy = (this._targetApp != null &&
let isBusy = this._targetApp != null &&
(this._targetApp.get_state() == Shell.AppState.STARTING ||
this._targetApp.get_busy()));
this._targetApp.get_busy());
if (isBusy)
this.startAnimation();
else
this.stopAnimation();
this.reactive = (visible && !isBusy);
this.reactive = visible && !isBusy;
this._syncIcon();
this.menu.setApp(this._targetApp);
@ -530,8 +530,8 @@ class PanelCorner extends St.DrawingArea {
if (index < 0)
return null;
if (!(children[index].has_style_class_name('panel-menu')) &&
!(children[index].has_style_class_name('panel-button')))
if (!children[index].has_style_class_name('panel-menu') &&
!children[index].has_style_class_name('panel-button'))
return this._findRightmostButton(children[index]);
return children[index];
@ -555,8 +555,8 @@ class PanelCorner extends St.DrawingArea {
if (index == children.length)
return null;
if (!(children[index].has_style_class_name('panel-menu')) &&
!(children[index].has_style_class_name('panel-button')))
if (!children[index].has_style_class_name('panel-menu') &&
!children[index].has_style_class_name('panel-button'))
return this._findLeftmostButton(children[index]);
return children[index];

View File

@ -154,7 +154,7 @@ var Button = GObject.registerClass({
if (symbol == Clutter.KEY_Left || symbol == Clutter.KEY_Right) {
let group = global.focus_manager.get_group(this);
if (group) {
let direction = (symbol == Clutter.KEY_Left) ? St.DirectionType.LEFT : St.DirectionType.RIGHT;
let direction = symbol == Clutter.KEY_Left ? St.DirectionType.LEFT : St.DirectionType.RIGHT;
group.navigate_focus(this, direction, false);
return Clutter.EVENT_STOP;
}
@ -179,7 +179,7 @@ var Button = GObject.registerClass({
// measures are in logical pixels, so make sure to consider the scale
// factor when computing max-height
let maxHeight = Math.round((workArea.height - verticalMargins) / scaleFactor);
this.menu.actor.style = ('max-height: %spx;').format(maxHeight);
this.menu.actor.style = 'max-height: %spx;'.format(maxHeight);
}
_onDestroy() {

View File

@ -181,7 +181,7 @@ function loadRemoteSearchProviders(searchSettings, callback) {
return -1;
// finally, if both providers are found, return their order in the list
return (idxA - idxB);
return idxA - idxB;
});
callback(loadedProviders);

View File

@ -671,12 +671,12 @@ var ScreenShield = class {
if (this._lockScreenState != MessageTray.State.SHOWN)
return Clutter.EVENT_PROPAGATE;
let isEnter = (symbol == Clutter.KEY_Return ||
let isEnter = symbol == Clutter.KEY_Return ||
symbol == Clutter.KEY_KP_Enter ||
symbol == Clutter.KEY_ISO_Enter);
let isEscape = (symbol == Clutter.KEY_Escape);
let isLiftChar = (GLib.unichar_isprint(unichar) &&
(this._isLocked || !GLib.unichar_isgraph(unichar)));
symbol == Clutter.KEY_ISO_Enter;
let isEscape = symbol == Clutter.KEY_Escape;
let isLiftChar = GLib.unichar_isprint(unichar) &&
(this._isLocked || !GLib.unichar_isgraph(unichar));
if (!isEnter && !isEscape && !isLiftChar)
return Clutter.EVENT_PROPAGATE;
@ -711,8 +711,8 @@ var ScreenShield = class {
_syncInhibitor() {
let lockEnabled = this._settings.get_boolean(LOCK_ENABLED_KEY);
let lockLocked = this._lockSettings.get_boolean(DISABLE_LOCK_KEY);
let inhibit = (this._loginSession && this._loginSession.Active &&
!this._isActive && lockEnabled && !lockLocked);
let inhibit = this._loginSession && this._loginSession.Active &&
!this._isActive && lockEnabled && !lockLocked;
if (inhibit) {
this._loginManager.inhibit(_("GNOME needs to lock the screen"),
inhibitor => {
@ -793,7 +793,7 @@ var ScreenShield = class {
// restore the lock screen to its original place
// try to use the same speed as the normal animation
let h = global.stage.height;
let duration = MANUAL_FADE_TIME * (-this._lockScreenGroup.y) / h;
let duration = MANUAL_FADE_TIME * -this._lockScreenGroup.y / h;
this._lockScreenGroup.remove_all_transitions();
this._lockScreenGroup.ease({
y: 0,
@ -945,7 +945,7 @@ var ScreenShield = class {
// use the same speed regardless of original position
// if velocity is specified, it's in pixels per milliseconds
let h = global.stage.height;
let delta = (h + this._lockScreenGroup.y);
let delta = h + this._lockScreenGroup.y;
let minVelocity = global.stage.height / CURTAIN_SLIDE_TIME;
velocity = Math.max(minVelocity, velocity);

View File

@ -683,7 +683,7 @@ var SearchResultsView = GObject.registerClass({
_updateSearchProgress() {
let haveResults = this._providers.some(provider => {
let display = provider.display;
return (display.getFirstResult() != null);
return display.getFirstResult() != null;
});
this._scrollView.visible = haveResults;

View File

@ -156,8 +156,8 @@ function listModes() {
var SessionMode = class {
constructor() {
_loadModes();
let isPrimary = (_modes[global.session_mode] &&
_modes[global.session_mode].isPrimary);
let isPrimary = _modes[global.session_mode] &&
_modes[global.session_mode].isPrimary;
let mode = isPrimary ? global.session_mode : 'user';
this._modeStack = [mode];
this._sync();

View File

@ -86,7 +86,7 @@ var EntryMenu = class extends PopupMenu.PopupMenu {
}
_updatePasswordItem() {
let textHidden = (this._entry.clutter_text.password_char);
let textHidden = this._entry.clutter_text.password_char;
if (textHidden)
this._passwordItem.label.set_text(_("Show Text"));
else
@ -110,7 +110,7 @@ var EntryMenu = class extends PopupMenu.PopupMenu {
}
_onPasswordActivated() {
let visible = !!(this._entry.clutter_text.password_char);
let visible = !!this._entry.clutter_text.password_char;
this._entry.clutter_text.set_password_char(visible ? '' : '\u25cf');
}
};

View File

@ -131,7 +131,7 @@ class ATIndicator extends PanelMenu.Button {
let interfaceSettings = new Gio.Settings({ schema_id: DESKTOP_INTERFACE_SCHEMA });
let gtkTheme = interfaceSettings.get_string(KEY_GTK_THEME);
let iconTheme = interfaceSettings.get_string(KEY_ICON_THEME);
let hasHC = (gtkTheme == HIGH_CONTRAST_THEME);
let hasHC = gtkTheme == HIGH_CONTRAST_THEME;
let highContrast = this._buildItemExtended(
_("High Contrast"),
hasHC,
@ -174,7 +174,7 @@ class ATIndicator extends PanelMenu.Button {
_buildFontItem() {
let settings = new Gio.Settings({ schema_id: DESKTOP_INTERFACE_SCHEMA });
let factor = settings.get_double(KEY_TEXT_SCALING_FACTOR);
let initialSetting = (factor > 1.0);
let initialSetting = factor > 1.0;
let widget = this._buildItemExtended(_("Large Text"),
initialSetting,
settings.is_writable(KEY_TEXT_SCALING_FACTOR),
@ -189,7 +189,7 @@ class ATIndicator extends PanelMenu.Button {
settings.connect(`changed::${KEY_TEXT_SCALING_FACTOR}`, () => {
factor = settings.get_double(KEY_TEXT_SCALING_FACTOR);
let active = (factor > 1.0);
let active = factor > 1.0;
widget.setToggleState(active);
this._queueSyncMenuVisibility();

View File

@ -62,8 +62,8 @@ class DwellClickIndicator extends PanelMenu.Button {
_syncMenuVisibility() {
this.visible =
(this._a11ySettings.get_boolean(KEY_DWELL_CLICK_ENABLED) &&
this._a11ySettings.get_string(KEY_DWELL_MODE) == DWELL_MODE_WINDOW);
this._a11ySettings.get_boolean(KEY_DWELL_CLICK_ENABLED) &&
this._a11ySettings.get_string(KEY_DWELL_MODE) == DWELL_MODE_WINDOW;
return GLib.SOURCE_REMOVE;
}

View File

@ -93,7 +93,7 @@ class Indicator extends PanelMenu.SystemIndicator {
this._getMaxAccuracyLevel());
authorizer.authorize(accuracyLevel => {
let ret = (accuracyLevel != GeoclueAccuracyLevel.NONE);
let ret = accuracyLevel != GeoclueAccuracyLevel.NONE;
invocation.return_value(GLib.Variant.new('(bu)',
[ret, accuracyLevel]));
});

View File

@ -208,8 +208,8 @@ var NMConnectionSection = class NMConnectionSection {
_sync() {
let nItems = this._connectionItems.size;
this._radioSection.actor.visible = (nItems > 1);
this._labelSection.actor.visible = (nItems == 1);
this._radioSection.actor.visible = nItems > 1;
this._labelSection.actor.visible = nItems == 1;
this.item.label.text = this._getStatus();
this.item.icon.icon_name = this._getMenuIcon();
@ -392,7 +392,7 @@ var NMConnectionDevice = class NMConnectionDevice extends NMConnectionSection {
_sync() {
let nItems = this._connectionItems.size;
this._autoConnectItem.visible = (nItems == 0);
this._autoConnectItem.visible = nItems == 0;
this._deactivateItem.visible = this._device.state > NM.DeviceState.DISCONNECTED;
if (this._activeConnection == null) {
@ -823,7 +823,7 @@ class NMWirelessDialog extends ModalDialog.ModalDialog {
} else {
this._airplaneBox.hide();
this._noNetworksBox.visible = (this._networks.length == 0);
this._noNetworksBox.visible = this._networks.length == 0;
}
if (this._noNetworksBox.visible)
@ -1473,7 +1473,7 @@ var NMVpnSection = class extends NMConnectionSection {
_sync() {
let nItems = this._connectionItems.size;
this.item.visible = (nItems > 0);
this.item.visible = nItems > 0;
super._sync();
}
@ -1855,7 +1855,7 @@ class Indicator extends PanelMenu.SystemIndicator {
_syncVpnConnections() {
let activeConnections = this._client.get_active_connections() || [];
let vpnConnections = activeConnections.filter(
a => (a instanceof NM.VpnConnection)
a => a instanceof NM.VpnConnection
);
vpnConnections.forEach(a => {
ensureActiveConnectionProps(a);
@ -2068,6 +2068,6 @@ class Indicator extends PanelMenu.SystemIndicator {
}
this._vpnIndicator.icon_name = this._vpnSection.getIndicatorIcon();
this._vpnIndicator.visible = (this._vpnIndicator.icon_name != '');
this._vpnIndicator.visible = this._vpnIndicator.icon_name != '';
}
});

View File

@ -98,8 +98,8 @@ class Indicator extends PanelMenu.SystemIndicator {
let hwAirplaneMode = this._manager.hwAirplaneMode;
let showAirplaneMode = this._manager.shouldShowAirplaneMode;
this._indicator.visible = (airplaneMode && showAirplaneMode);
this._item.visible = (airplaneMode && showAirplaneMode);
this._indicator.visible = airplaneMode && showAirplaneMode;
this._item.visible = airplaneMode && showAirplaneMode;
this._offItem.setSensitive(!hwAirplaneMode);
if (hwAirplaneMode)

View File

@ -138,7 +138,7 @@ var StreamSlider = class {
_updateVolume() {
let muted = this._stream.is_muted;
this._changeSlider(muted
? 0 : (this._stream.volume / this._control.get_vol_max_norm()));
? 0 : this._stream.volume / this._control.get_vol_max_norm());
this.emit('stream-updated');
}
@ -227,9 +227,9 @@ var OutputStreamSlider = class extends StreamSlider {
}
_updateSliderIcon() {
this._icon.icon_name = (this._hasHeadphones
this._icon.icon_name = this._hasHeadphones
? 'audio-headphones-symbolic'
: 'audio-speakers-symbolic');
: 'audio-speakers-symbolic';
}
_portChanged() {

View File

@ -570,7 +570,7 @@ var SwitcherList = GObject.registerClass({
childBox.x2 = childBox.x1 + arrowWidth;
childBox.y2 = childBox.y1 + arrowHeight;
this._leftArrow.allocate(childBox, flags);
this._leftArrow.opacity = (this._scrollableLeft && scrollable) ? 255 : 0;
this._leftArrow.opacity = this._scrollableLeft && scrollable ? 255 : 0;
arrowWidth = Math.floor(rightPadding / 3);
arrowHeight = arrowWidth * 2;
@ -579,7 +579,7 @@ var SwitcherList = GObject.registerClass({
childBox.x2 = childBox.x1 + arrowWidth;
childBox.y2 = childBox.y1 + arrowHeight;
this._rightArrow.allocate(childBox, flags);
this._rightArrow.opacity = (this._scrollableRight && scrollable) ? 255 : 0;
this._rightArrow.opacity = this._scrollableRight && scrollable ? 255 : 0;
}
});

View File

@ -458,8 +458,8 @@ var ViewSelector = GObject.registerClass({
_onStageKeyFocusChanged() {
let focus = global.stage.get_key_focus();
let appearFocused = (this._entry.contains(focus) ||
this._searchResults.contains(focus));
let appearFocused = this._entry.contains(focus) ||
this._searchResults.contains(focus);
this._text.set_cursor_visible(appearFocused);
@ -517,7 +517,7 @@ var ViewSelector = GObject.registerClass({
_onTextChanged() {
let terms = getTermsForSearchString(this._entry.get_text());
this._searchActive = (terms.length > 0);
this._searchActive = terms.length > 0;
this._searchResults.setTerms(terms);
if (this._searchActive) {

View File

@ -402,8 +402,8 @@ class TilePreview extends St.Widget {
if (this._rect && this._rect.equal(tileRect))
return;
let changeMonitor = (this._monitorIndex == -1 ||
this._monitorIndex != monitorIndex);
let changeMonitor = this._monitorIndex == -1 ||
this._monitorIndex != monitorIndex;
this._monitorIndex = monitorIndex;
this._rect = tileRect;
@ -527,7 +527,7 @@ var TouchpadWorkspaceSwitchAction = class {
// Scale deltas up a bit to make it feel snappier
this._dx += dx * 2;
if (!(this._touchpadSettings.get_boolean('natural-scroll')))
if (!this._touchpadSettings.get_boolean('natural-scroll'))
this._dy -= dy * 2;
else
this._dy += dy * 2;
@ -569,7 +569,7 @@ var WorkspaceSwitchAction = GObject.registerClass({
if (!super.vfunc_gesture_prepare(actor))
return false;
return (this._allowedModes & Main.actionMode);
return this._allowedModes & Main.actionMode;
}
vfunc_gesture_progress(_actor) {
@ -1180,8 +1180,8 @@ var WindowManager = class {
let win = actor.metaWindow;
let workspaceManager = global.workspace_manager;
let activeWorkspace = workspaceManager.get_active_workspace();
return (!win.is_override_redirect() &&
win.located_on_workspace(activeWorkspace));
return !win.is_override_redirect() &&
win.located_on_workspace(activeWorkspace);
});
if (windows.length == 0)

View File

@ -399,7 +399,7 @@ var WindowClone = GObject.registerClass({
vfunc_key_press_event(keyEvent) {
let symbol = keyEvent.keyval;
let isEnter = (symbol == Clutter.KEY_Return || symbol == Clutter.KEY_KP_Enter);
let isEnter = symbol == Clutter.KEY_Return || symbol == Clutter.KEY_KP_Enter;
if (isEnter) {
this._activate();
return true;
@ -1111,10 +1111,10 @@ function rectEqual(one, two) {
if (!one || !two)
return false;
return (one.x == two.x &&
return one.x == two.x &&
one.y == two.y &&
one.width == two.width &&
one.height == two.height);
one.height == two.height;
}
/**
@ -1448,9 +1448,9 @@ class Workspace extends St.Widget {
_delayedWindowRepositioning() {
let [x, y] = global.get_pointer();
let pointerHasMoved = (this._cursorX != x && this._cursorY != y);
let inWorkspace = (this._fullGeometry.x < x && x < this._fullGeometry.x + this._fullGeometry.width &&
this._fullGeometry.y < y && y < this._fullGeometry.y + this._fullGeometry.height);
let pointerHasMoved = this._cursorX != x && this._cursorY != y;
let inWorkspace = this._fullGeometry.x < x && x < this._fullGeometry.x + this._fullGeometry.width &&
this._fullGeometry.y < y && y < this._fullGeometry.y + this._fullGeometry.height;
if (pointerHasMoved && inWorkspace) {
// store current cursor position

View File

@ -808,7 +808,7 @@ var ThumbnailsBox = GObject.registerClass({
let [, h] = this._thumbnails[i].get_transformed_size();
let targetBottom = targetBase + WORKSPACE_CUT_SIZE;
let nextTargetBase = targetBase + h + spacing;
let nextTargetTop = nextTargetBase - spacing - ((i == length - 1) ? 0 : WORKSPACE_CUT_SIZE);
let nextTargetTop = nextTargetBase - spacing - (i == length - 1 ? 0 : WORKSPACE_CUT_SIZE);
// Expand the target to include the placeholder, if it exists.
if (i == this._dropPlaceholderPos)
@ -1217,7 +1217,7 @@ var ThumbnailsBox = GObject.registerClass({
vfunc_allocate(box, flags) {
this.set_allocation(box, flags);
let rtl = (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL);
let rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL;
if (this._thumbnails.length == 0) // not visible
return;
@ -1352,7 +1352,7 @@ var ThumbnailsBox = GObject.registerClass({
childBox.x1 -= indicatorLeftFullBorder;
childBox.x2 += indicatorRightFullBorder;
childBox.y1 = indicatorY1 - indicatorTopFullBorder;
childBox.y2 = (indicatorY2 ? indicatorY2 : (indicatorY1 + thumbnailHeight)) + indicatorBottomFullBorder;
childBox.y2 = (indicatorY2 ? indicatorY2 : indicatorY1 + thumbnailHeight) + indicatorBottomFullBorder;
this._indicator.allocate(childBox, flags);
}

View File

@ -228,9 +228,9 @@ class WorkspacesView extends WorkspacesViewBase {
if (this._animating || this._scrolling || this._gestureActive)
workspace.show();
else if (this._inDrag)
workspace.visible = (Math.abs(w - active) <= 1);
workspace.visible = Math.abs(w - active) <= 1;
else
workspace.visible = (w == active);
workspace.visible = w == active;
}
}
@ -753,7 +753,7 @@ class WorkspacesDisplay extends St.Widget {
let monitors = Main.layoutManager.monitors;
for (let i = 0; i < monitors.length; i++) {
let geometry = (i == this._primaryIndex) ? this._fullGeometry : monitors[i];
let geometry = i == this._primaryIndex ? this._fullGeometry : monitors[i];
this._workspacesViews[i].setFullGeometry(geometry);
}
}
@ -770,7 +770,7 @@ class WorkspacesDisplay extends St.Widget {
let monitors = Main.layoutManager.monitors;
for (let i = 0; i < monitors.length; i++) {
let geometry = (i == this._primaryIndex) ? primaryGeometry : monitors[i];
let geometry = i == this._primaryIndex ? primaryGeometry : monitors[i];
this._workspacesViews[i].setActualGeometry(geometry);
}
}