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:
parent
c860409da5
commit
07cc84f632
@ -330,9 +330,9 @@ 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,
|
||||
@ -340,6 +340,7 @@ var AuthPrompt = GObject.registerClass({
|
||||
mode: Clutter.AnimationMode.LINEAR
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this._defaultButtonWellActor = actor;
|
||||
}
|
||||
|
@ -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,11 +164,12 @@ 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,10 +17,11 @@
|
||||
// @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);
|
||||
return Object.assign(defaultsCopy, params);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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 });
|
||||
|
@ -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);
|
||||
|
@ -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');
|
||||
|
@ -777,12 +777,13 @@ 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) {
|
||||
this.setIcon(this._getIcon());
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -231,12 +231,13 @@ 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) {
|
||||
let [targetHandle_, targetHandleType] = channel.get_handle();
|
||||
@ -386,11 +387,12 @@ 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() {
|
||||
Main.overview.hide();
|
||||
@ -601,11 +603,12 @@ 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) {
|
||||
let idx = this._pendingMessages.indexOf(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');
|
||||
|
@ -90,13 +90,14 @@ 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,
|
||||
proxy: windows[i].get_compositor_private(),
|
||||
|
@ -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];
|
||||
|
@ -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)
|
||||
|
@ -61,12 +61,13 @@ 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 {
|
||||
constructor(actor, params) {
|
||||
@ -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:
|
||||
@ -564,6 +565,7 @@ var _Draggable = class _Draggable {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// At this point it is too late to cancel a drag by destroying
|
||||
// the actor, the fate of which is decided by acceptDrop and its
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
@ -52,6 +52,7 @@ function _patchLayoutClass(layoutClass, styleProps) {
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function _makeEaseCallback(params, cleanup) {
|
||||
let onComplete = params.onComplete;
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -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,10 +806,11 @@ 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
|
||||
_updateIconSizes() {
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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,10 +971,11 @@ 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) {
|
||||
return global.get_window_actors().filter(actor => {
|
||||
|
@ -771,16 +771,17 @@ 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) {
|
||||
let component = event.source.get_component_iface();
|
||||
@ -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();
|
||||
|
@ -150,11 +150,12 @@ 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,14 +171,15 @@ 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();
|
||||
@ -185,6 +187,7 @@ class ScaleLayout extends Clutter.BinLayout {
|
||||
this._signals.push(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vfunc_get_preferred_width(container, forHeight) {
|
||||
this._connectContainer(container);
|
||||
|
@ -900,10 +900,11 @@ 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();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var MessageTray = GObject.registerClass({
|
||||
|
@ -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 = '';
|
||||
}
|
||||
|
||||
|
@ -310,14 +310,15 @@ 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);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hasDefaultAction) {
|
||||
notification.connect('activated', () => {
|
||||
@ -427,14 +428,15 @@ 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() {
|
||||
if (this.app && this.app.get_app_info()) {
|
||||
|
@ -113,15 +113,16 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setMaxLevel(maxLevel = 1) {
|
||||
this._level.maximum_value = maxLevel;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -1044,10 +1044,11 @@ 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() {
|
||||
if (this._arrowAnimationId) {
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
});
|
||||
|
@ -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}`, () => {
|
||||
|
@ -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,13 +516,14 @@ 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);
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -199,10 +199,11 @@ 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() {
|
||||
let devices = this._devicesToEnroll;
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user