cleanup: Only omit braces for single-line blocks

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

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

View File

@ -330,9 +330,9 @@ var AuthPrompt = GObject.registerClass({
if (isSpinner) if (isSpinner)
this._spinner.play(); this._spinner.play();
if (!animate) if (!animate) {
actor.opacity = 255; actor.opacity = 255;
else } else {
actor.ease({ actor.ease({
opacity: 255, opacity: 255,
duration: DEFAULT_BUTTON_WELL_ANIMATION_TIME, duration: DEFAULT_BUTTON_WELL_ANIMATION_TIME,
@ -340,6 +340,7 @@ var AuthPrompt = GObject.registerClass({
mode: Clutter.AnimationMode.LINEAR mode: Clutter.AnimationMode.LINEAR
}); });
} }
}
this._defaultButtonWellActor = actor; this._defaultButtonWellActor = actor;
} }

View File

@ -128,12 +128,13 @@ function getSettings(schema) {
// SYSTEM extension that has been installed in the same prefix as the shell // SYSTEM extension that has been installed in the same prefix as the shell
let schemaDir = extension.dir.get_child('schemas'); let schemaDir = extension.dir.get_child('schemas');
let schemaSource; let schemaSource;
if (schemaDir.query_exists(null)) if (schemaDir.query_exists(null)) {
schemaSource = GioSSS.new_from_directory(schemaDir.get_path(), schemaSource = GioSSS.new_from_directory(schemaDir.get_path(),
GioSSS.get_default(), GioSSS.get_default(),
false); false);
else } else {
schemaSource = GioSSS.get_default(); schemaSource = GioSSS.get_default();
}
let schemaObj = schemaSource.lookup(schema, true); let schemaObj = schemaSource.lookup(schema, true);
if (!schemaObj) if (!schemaObj)

View File

@ -164,11 +164,12 @@ var IntrospectService = class {
if (wmClass != null) if (wmClass != null)
windowsList[windowId]['wm-class'] = GLib.Variant.new('s', wmClass); windowsList[windowId]['wm-class'] = GLib.Variant.new('s', wmClass);
if (sandboxedAppId != null) if (sandboxedAppId != null) {
windowsList[windowId]['sandboxed-app-id'] = windowsList[windowId]['sandboxed-app-id'] =
GLib.Variant.new('s', sandboxedAppId); GLib.Variant.new('s', sandboxedAppId);
} }
} }
}
invocation.return_value(new GLib.Variant('(a{ta{sv}})', [windowsList])); invocation.return_value(new GLib.Variant('(a{ta{sv}})', [windowsList]));
} }
}; };

View File

@ -17,10 +17,11 @@
// @params and @defaults // @params and @defaults
function parse(params = {}, defaults, allowExtras) { function parse(params = {}, defaults, allowExtras) {
if (!allowExtras) { if (!allowExtras) {
for (let prop in params) for (let prop in params) {
if (!(prop in defaults)) if (!(prop in defaults))
throw new Error(`Unrecognized parameter "${prop}"`); throw new Error(`Unrecognized parameter "${prop}"`);
} }
}
let defaultsCopy = Object.assign({}, defaults); let defaultsCopy = Object.assign({}, defaults);
return Object.assign(defaultsCopy, params); return Object.assign(defaultsCopy, params);

View File

@ -233,9 +233,10 @@ const SystemActions = GObject.registerClass({
_updateOrientationLock() { _updateOrientationLock() {
let available = false; let available = false;
if (this._sensorProxy.g_name_owner) if (this._sensorProxy.g_name_owner) {
available = this._sensorProxy.HasAccelerometer && available = this._sensorProxy.HasAccelerometer &&
this._monitorManager.get_is_builtin_display_on(); this._monitorManager.get_is_builtin_display_on();
}
this._actions.get(LOCK_ORIENTATION_ACTION_ID).available = available; this._actions.get(LOCK_ORIENTATION_ACTION_ID).available = available;
@ -273,9 +274,10 @@ const SystemActions = GObject.registerClass({
let results = []; 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)))) if (available && terms.every(t => keywords.some(k => k.startsWith(t))))
results.push(key); results.push(key);
}
return results; return results;
} }

View File

@ -171,23 +171,28 @@ function formatTimeSpan(date) {
if (minutesAgo < 5) if (minutesAgo < 5)
return _("Just now"); return _("Just now");
if (hoursAgo < 1) if (hoursAgo < 1) {
return Gettext.ngettext("%d minute ago", return Gettext.ngettext("%d minute ago",
"%d minutes ago", minutesAgo).format(minutesAgo); "%d minutes ago", minutesAgo).format(minutesAgo);
if (daysAgo < 1) }
if (daysAgo < 1) {
return Gettext.ngettext("%d hour ago", return Gettext.ngettext("%d hour ago",
"%d hours ago", hoursAgo).format(hoursAgo); "%d hours ago", hoursAgo).format(hoursAgo);
}
if (daysAgo < 2) if (daysAgo < 2)
return _("Yesterday"); return _("Yesterday");
if (daysAgo < 15) if (daysAgo < 15) {
return Gettext.ngettext("%d day ago", return Gettext.ngettext("%d day ago",
"%d days ago", daysAgo).format(daysAgo); "%d days ago", daysAgo).format(daysAgo);
if (weeksAgo < 8) }
if (weeksAgo < 8) {
return Gettext.ngettext("%d week ago", return Gettext.ngettext("%d week ago",
"%d weeks ago", weeksAgo).format(weeksAgo); "%d weeks ago", weeksAgo).format(weeksAgo);
if (yearsAgo < 1) }
if (yearsAgo < 1) {
return Gettext.ngettext("%d month ago", return Gettext.ngettext("%d month ago",
"%d months ago", monthsAgo).format(monthsAgo); "%d months ago", monthsAgo).format(monthsAgo);
}
return Gettext.ngettext("%d year ago", return Gettext.ngettext("%d year ago",
"%d years ago", yearsAgo).format(yearsAgo); "%d years ago", yearsAgo).format(yearsAgo);
} }

View File

@ -94,11 +94,12 @@ function *run() {
let config = WINDOW_CONFIGS[i / 2]; let config = WINDOW_CONFIGS[i / 2];
yield Scripting.destroyTestWindows(); 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, yield Scripting.createTestWindow({ width: config.width,
height: config.height, height: config.height,
alpha: config.alpha, alpha: config.alpha,
maximized: config.maximized }); maximized: config.maximized });
}
yield Scripting.waitTestWindows(); yield Scripting.waitTestWindows();
yield Scripting.sleep(1000); yield Scripting.sleep(1000);

View File

@ -997,9 +997,10 @@ class WindowIcon extends St.BoxLayout {
size = WINDOW_PREVIEW_SIZE; size = WINDOW_PREVIEW_SIZE;
this._icon.add_actor(_createWindowClone(mutterWindow, size * scaleFactor)); this._icon.add_actor(_createWindowClone(mutterWindow, size * scaleFactor));
if (this.app) if (this.app) {
this._icon.add_actor(this._createAppIcon(this.app, this._icon.add_actor(this._createAppIcon(this.app,
APP_ICON_SIZE_SMALL)); APP_ICON_SIZE_SMALL));
}
break; break;
case AppIconMode.APP_ICON_ONLY: case AppIconMode.APP_ICON_ONLY:

View File

@ -55,9 +55,10 @@ function _getCategories(info) {
} }
function _listsIntersect(a, b) { function _listsIntersect(a, b) {
for (let itemA of a) for (let itemA of a) {
if (b.includes(itemA)) if (b.includes(itemA))
return true; return true;
}
return false; return false;
} }
@ -525,13 +526,14 @@ var AllView = GObject.registerClass({
super.animateSwitch(animationDirection); super.animateSwitch(animationDirection);
if (this._currentPopup && this._displayingPopup && if (this._currentPopup && this._displayingPopup &&
animationDirection == IconGrid.AnimationDirection.OUT) animationDirection == IconGrid.AnimationDirection.OUT) {
this._currentPopup.ease({ this._currentPopup.ease({
opacity: 0, opacity: 0,
duration: VIEWS_SWITCH_TIME, duration: VIEWS_SWITCH_TIME,
mode: Clutter.AnimationMode.EASE_OUT_QUAD, mode: Clutter.AnimationMode.EASE_OUT_QUAD,
onComplete: () => (this.opacity = 255) onComplete: () => (this.opacity = 255)
}); });
}
if (animationDirection == IconGrid.AnimationDirection.OUT) if (animationDirection == IconGrid.AnimationDirection.OUT)
this._pageIndicators.animateIndicators(animationDirection); this._pageIndicators.animateIndicators(animationDirection);
@ -2478,11 +2480,12 @@ var AppIconMenu = class AppIconMenu extends PopupMenu.PopupMenu {
w => !w.skip_taskbar w => !w.skip_taskbar
); );
if (windows.length > 0) if (windows.length > 0) {
this.addMenuItem( this.addMenuItem(
/* Translators: This is the heading of a list of open windows */ /* Translators: This is the heading of a list of open windows */
new PopupMenu.PopupSeparatorMenuItem(_("Open Windows")) new PopupMenu.PopupSeparatorMenuItem(_("Open Windows"))
); );
}
windows.forEach(window => { windows.forEach(window => {
let title = window.title let title = window.title

View File

@ -49,9 +49,10 @@ var AudioDeviceSelectionDialog = GObject.registerClass({
}); });
this.contentLayout.add_child(this._selectionBox); this.contentLayout.add_child(this._selectionBox);
if (Main.sessionMode.allowSettings) if (Main.sessionMode.allowSettings) {
this.addButton({ action: this._openSettings.bind(this), this.addButton({ action: this._openSettings.bind(this),
label: _("Sound Settings") }); label: _("Sound Settings") });
}
this.addButton({ action: this.close.bind(this), this.addButton({ action: this.close.bind(this),
label: _("Cancel"), label: _("Cancel"),
key: Clutter.KEY_Escape }); key: Clutter.KEY_Escape });

View File

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

View File

@ -88,9 +88,10 @@ var BarLevel = GObject.registerClass({
if (this._overdriveStart == value) if (this._overdriveStart == value)
return; return;
if (value > this._maxValue) if (value > this._maxValue) {
throw new Error(`Tried to set overdrive value to ${value}, ` + throw new Error(`Tried to set overdrive value to ${value}, ` +
`which is a number greater than the maximum allowed value ${this._maxValue}`); `which is a number greater than the maximum allowed value ${this._maxValue}`);
}
this._overdriveStart = value; this._overdriveStart = value;
this.notify('overdrive-start'); this.notify('overdrive-start');

View File

@ -777,12 +777,13 @@ class NotificationMessage extends MessageList.Message {
} }
_getIcon() { _getIcon() {
if (this.notification.gicon) if (this.notification.gicon) {
return new St.Icon({ gicon: this.notification.gicon, return new St.Icon({ gicon: this.notification.gicon,
icon_size: MESSAGE_ICON_SIZE }); icon_size: MESSAGE_ICON_SIZE });
else } else {
return this.notification.source.createIcon(MESSAGE_ICON_SIZE); return this.notification.source.createIcon(MESSAGE_ICON_SIZE);
} }
}
_onUpdated(n, _clear) { _onUpdated(n, _clear) {
this.setIcon(this._getIcon()); this.setIcon(this._getIcon());
@ -860,14 +861,15 @@ class EventsSection extends MessageList.MessageListSection {
let dayFormat; let dayFormat;
let now = new Date(); 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 */ /* Translators: Shown on calendar heading when selected day occurs on current year */
dayFormat = Shell.util_translate_time_string(NC_("calendar heading", dayFormat = Shell.util_translate_time_string(NC_("calendar heading",
"%A, %B %-d")); "%A, %B %-d"));
else } else {
/* Translators: Shown on calendar heading when selected day occurs on different year */ /* Translators: Shown on calendar heading when selected day occurs on different year */
dayFormat = Shell.util_translate_time_string(NC_("calendar heading", dayFormat = Shell.util_translate_time_string(NC_("calendar heading",
"%A, %B %-d, %Y")); "%A, %B %-d, %Y"));
}
this._title.label = this._date.toLocaleFormat(dayFormat); this._title.label = this._date.toLocaleFormat(dayFormat);
} }

View File

@ -124,11 +124,12 @@ var CloseDialog = GObject.registerClass({
if (this._tracked === shouldTrack) if (this._tracked === shouldTrack)
return; return;
if (shouldTrack) if (shouldTrack) {
Main.layoutManager.trackChrome(this._dialog, Main.layoutManager.trackChrome(this._dialog,
{ affectsInputRegion: true }); { affectsInputRegion: true });
else } else {
Main.layoutManager.untrackChrome(this._dialog); Main.layoutManager.untrackChrome(this._dialog);
}
// The buttons are broken when they aren't added to the input region, // The buttons are broken when they aren't added to the input region,
// so disable them properly in that case // so disable them properly in that case

View File

@ -222,11 +222,12 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
validate: this._validateStaticWep, password: true }); validate: this._validateStaticWep, password: true });
break; break;
case 'ieee8021x': case 'ieee8021x':
if (wirelessSecuritySetting.auth_alg == 'leap') // Cisco LEAP if (wirelessSecuritySetting.auth_alg == 'leap') { // Cisco LEAP
secrets.push({ label: _("Password: "), key: 'leap-password', secrets.push({ label: _("Password: "), key: 'leap-password',
value: wirelessSecuritySetting.leap_password || '', password: true }); value: wirelessSecuritySetting.leap_password || '', password: true });
else // Dynamic (IEEE 802.1x) WEP } else { // Dynamic (IEEE 802.1x) WEP
this._get8021xSecrets(secrets); this._get8021xSecrets(secrets);
}
break; break;
case 'wpa-eap': case 'wpa-eap':
this._get8021xSecrets(secrets); 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 hints were given we know exactly what we need to ask */
if (this._settingName == "802-1x" && this._hints.length) { if (this._settingName == "802-1x" && this._hints.length) {
if (this._hints.includes('identity')) if (this._hints.includes('identity')) {
secrets.push({ label: _("Username: "), key: 'identity', secrets.push({ label: _("Username: "), key: 'identity',
value: ieee8021xSetting.identity || '', password: false }); value: ieee8021xSetting.identity || '', password: false });
if (this._hints.includes('password')) }
if (this._hints.includes('password')) {
secrets.push({ label: _("Password: "), key: 'password', secrets.push({ label: _("Password: "), key: 'password',
value: ieee8021xSetting.password || '', password: true }); 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', secrets.push({ label: _("Private key password: "), key: 'private-key-password',
value: ieee8021xSetting.private_key_password || '', password: true }); value: ieee8021xSetting.private_key_password || '', password: true });
}
return; return;
} }

View File

@ -231,12 +231,13 @@ class TelepathyClient extends Tp.BaseClient {
return; return;
} }
if (chanType == Tp.IFACE_CHANNEL_TYPE_TEXT) if (chanType == Tp.IFACE_CHANNEL_TYPE_TEXT) {
this._approveTextChannel(account, conn, channel, dispatchOp, context); this._approveTextChannel(account, conn, channel, dispatchOp, context);
else } else {
context.fail(new Tp.Error({ code: Tp.Error.INVALID_ARGUMENT, context.fail(new Tp.Error({ code: Tp.Error.INVALID_ARGUMENT,
message: 'Unsupported channel type' })); message: 'Unsupported channel type' }));
} }
}
_approveTextChannel(account, conn, channel, dispatchOp, context) { _approveTextChannel(account, conn, channel, dispatchOp, context) {
let [targetHandle_, targetHandleType] = channel.get_handle(); let [targetHandle_, targetHandleType] = channel.get_handle();
@ -386,11 +387,12 @@ class ChatSource extends MessageTray.Source {
_updateAvatarIcon() { _updateAvatarIcon() {
this.iconUpdated(); this.iconUpdated();
if (this._notifiction) if (this._notifiction) {
this._notification.update(this._notification.title, this._notification.update(this._notification.title,
this._notification.bannerBodyText, this._notification.bannerBodyText,
{ gicon: this.getIcon() }); { gicon: this.getIcon() });
} }
}
open() { open() {
Main.overview.hide(); Main.overview.hide();
@ -601,11 +603,12 @@ class ChatSource extends MessageTray.Source {
} }
_presenceChanged(_contact, _presence, _status, _message) { _presenceChanged(_contact, _presence, _status, _message) {
if (this._notification) if (this._notification) {
this._notification.update(this._notification.title, this._notification.update(this._notification.title,
this._notification.bannerBodyText, this._notification.bannerBodyText,
{ secondaryGIcon: this.getSecondaryIcon() }); { secondaryGIcon: this.getSecondaryIcon() });
} }
}
_pendingRemoved(channel, message) { _pendingRemoved(channel, message) {
let idx = this._pendingMessages.indexOf(message); let idx = this._pendingMessages.indexOf(message);
@ -674,10 +677,11 @@ var ChatNotification = HAVE_TP ? GObject.registerClass({
styles.push('chat-action'); styles.push('chat-action');
} }
if (message.direction == NotificationDirection.RECEIVED) if (message.direction == NotificationDirection.RECEIVED) {
this.update(this.source.title, messageBody, this.update(this.source.title, messageBody,
{ datetime: GLib.DateTime.new_from_unix_local(message.timestamp), { datetime: GLib.DateTime.new_from_unix_local(message.timestamp),
bannerMarkup: true }); bannerMarkup: true });
}
let group = (message.direction == NotificationDirection.RECEIVED let group = (message.direction == NotificationDirection.RECEIVED
? 'received' : 'sent'); ? 'received' : 'sent');

View File

@ -90,13 +90,14 @@ var CtrlAltTabManager = class CtrlAltTabManager {
iconName = 'video-display-symbolic'; iconName = 'video-display-symbolic';
} else { } else {
let app = windowTracker.get_window_app(windows[i]); let app = windowTracker.get_window_app(windows[i]);
if (app) if (app) {
icon = app.create_icon_texture(POPUP_APPICON_SIZE); icon = app.create_icon_texture(POPUP_APPICON_SIZE);
else } else {
icon = textureCache.bind_cairo_surface_property(windows[i], icon = textureCache.bind_cairo_surface_property(windows[i],
'icon', 'icon',
POPUP_APPICON_SIZE); POPUP_APPICON_SIZE);
} }
}
items.push({ name: windows[i].title, items.push({ name: windows[i].title,
proxy: windows[i].get_compositor_private(), proxy: windows[i].get_compositor_private(),

View File

@ -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, this._box.insert_child_at_index(addedItems[i].item,
addedItems[i].pos); addedItems[i].pos);
}
for (let i = 0; i < removedActors.length; i++) { for (let i = 0; i < removedActors.length; i++) {
let item = removedActors[i]; let item = removedActors[i];

View File

@ -203,9 +203,10 @@ class WorldClocksSection extends St.Button {
} }
if (this._grid.get_n_children() > 1) { if (this._grid.get_n_children() > 1) {
if (!this._clockNotifyId) if (!this._clockNotifyId) {
this._clockNotifyId = this._clockNotifyId =
this._clock.connect('notify::clock', this._updateLabels.bind(this)); this._clock.connect('notify::clock', this._updateLabels.bind(this));
}
this._updateLabels(); this._updateLabels();
} else { } else {
if (this._clockNotifyId) if (this._clockNotifyId)

View File

@ -61,12 +61,13 @@ function addDragMonitor(monitor) {
} }
function removeDragMonitor(monitor) { function removeDragMonitor(monitor) {
for (let i = 0; i < dragMonitors.length; i++) for (let i = 0; i < dragMonitors.length; i++) {
if (dragMonitors[i] == monitor) { if (dragMonitors[i] == monitor) {
dragMonitors.splice(i, 1); dragMonitors.splice(i, 1);
return; return;
} }
} }
}
var _Draggable = class _Draggable { var _Draggable = class _Draggable {
constructor(actor, params) { constructor(actor, params) {
@ -555,7 +556,7 @@ var _Draggable = class _Draggable {
}; };
for (let i = 0; i < dragMonitors.length; i++) { for (let i = 0; i < dragMonitors.length; i++) {
let dropFunc = dragMonitors[i].dragDrop; let dropFunc = dragMonitors[i].dragDrop;
if (dropFunc) if (dropFunc) {
switch (dropFunc(dropEvent)) { switch (dropFunc(dropEvent)) {
case DragDropResult.FAILURE: case DragDropResult.FAILURE:
case DragDropResult.SUCCESS: case DragDropResult.SUCCESS:
@ -564,6 +565,7 @@ var _Draggable = class _Draggable {
continue; continue;
} }
} }
}
// At this point it is too late to cancel a drag by destroying // 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 // the actor, the fate of which is decided by acceptDrop and its

View File

@ -681,11 +681,12 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
continue; continue;
let sessionId = GLib.getenv('XDG_SESSION_ID'); let sessionId = GLib.getenv('XDG_SESSION_ID');
if (!sessionId) if (!sessionId) {
this._loginManager.getCurrentSessionProxy(currentSessionProxy => { this._loginManager.getCurrentSessionProxy(currentSessionProxy => {
sessionId = currentSessionProxy.Id; sessionId = currentSessionProxy.Id;
log(`endSessionDialog: No XDG_SESSION_ID, fetched from logind: ${sessionId}`); log(`endSessionDialog: No XDG_SESSION_ID, fetched from logind: ${sessionId}`);
}); });
}
if (proxy.Id == sessionId) if (proxy.Id == sessionId)
continue; continue;

View File

@ -40,7 +40,7 @@ function _patchContainerClass(containerClass) {
} }
function _patchLayoutClass(layoutClass, styleProps) { function _patchLayoutClass(layoutClass, styleProps) {
if (styleProps) if (styleProps) {
layoutClass.prototype.hookup_style = function (container) { layoutClass.prototype.hookup_style = function (container) {
container.connect('style-changed', () => { container.connect('style-changed', () => {
let node = container.get_theme_node(); let node = container.get_theme_node();
@ -52,6 +52,7 @@ function _patchLayoutClass(layoutClass, styleProps) {
}); });
}; };
} }
}
function _makeEaseCallback(params, cleanup) { function _makeEaseCallback(params, cleanup) {
let onComplete = params.onComplete; let onComplete = params.onComplete;

View File

@ -215,9 +215,10 @@ class IbusCandidatePopup extends BoxPointer.BoxPointer {
this._preeditText.text = text.get_text(); this._preeditText.text = text.get_text();
let attrs = text.get_attributes(); let attrs = text.get_attributes();
if (attrs) if (attrs) {
this._setTextAttributes(this._preeditText.clutter_text, this._setTextAttributes(this._preeditText.clutter_text,
attrs); attrs);
}
}); });
panelService.connect('show-preedit-text', () => { panelService.connect('show-preedit-text', () => {
this._preeditText.show(); this._preeditText.show();
@ -316,8 +317,9 @@ class IbusCandidatePopup extends BoxPointer.BoxPointer {
_setTextAttributes(clutterText, ibusAttrList) { _setTextAttributes(clutterText, ibusAttrList) {
let attr; 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) if (attr.get_attr_type() == IBus.AttrType.BACKGROUND)
clutterText.set_selection(attr.get_start_index(), attr.get_end_index()); clutterText.set_selection(attr.get_start_index(), attr.get_end_index());
} }
}
}); });

View File

@ -455,9 +455,10 @@ var IconGrid = GObject.registerClass({
} }
animatePulse(animationDirection) { animatePulse(animationDirection) {
if (animationDirection != AnimationDirection.IN) if (animationDirection != AnimationDirection.IN) {
throw new GObject.NotImplementedError("Pulse animation only implements " + throw new GObject.NotImplementedError("Pulse animation only implements " +
"'in' animation direction"); "'in' animation direction");
}
this._resetAnimationActors(); this._resetAnimationActors();
@ -805,10 +806,11 @@ var IconGrid = GObject.registerClass({
this._updateSpacingForSize(availWidth, availHeight); this._updateSpacingForSize(availWidth, availHeight);
} }
if (!this._updateIconSizesLaterId) if (!this._updateIconSizesLaterId) {
this._updateIconSizesLaterId = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, this._updateIconSizesLaterId = Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
this._updateIconSizes.bind(this)); this._updateIconSizes.bind(this));
} }
}
// Note that this is ICON_SIZE as used by BaseIcon, not elsewhere in IconGrid; it's a bit messed up // Note that this is ICON_SIZE as used by BaseIcon, not elsewhere in IconGrid; it's a bit messed up
_updateIconSizes() { _updateIconSizes() {

View File

@ -84,10 +84,11 @@ var InhibitShortcutsDialog = GObject.registerClass({
let contentParams = { icon, title }; let contentParams = { icon, title };
let restoreAccel = this._getRestoreAccel(); let restoreAccel = this._getRestoreAccel();
if (restoreAccel) if (restoreAccel) {
contentParams.subtitle = contentParams.subtitle =
/* Translators: %s is a keyboard shortcut like "Super+x" */ /* Translators: %s is a keyboard shortcut like "Super+x" */
_("You can restore shortcuts by pressing %s.").format(restoreAccel); _("You can restore shortcuts by pressing %s.").format(restoreAccel);
}
let content = new Dialog.MessageDialogContent(contentParams); let content = new Dialog.MessageDialogContent(contentParams);
this._dialog.contentLayout.add_actor(content); this._dialog.contentLayout.add_actor(content);

View File

@ -1307,9 +1307,10 @@ class Keyboard extends St.BoxLayout {
this._connectSignal(global.stage, 'notify::key-focus', this._connectSignal(global.stage, 'notify::key-focus',
this._onKeyFocusChanged.bind(this)); this._onKeyFocusChanged.bind(this));
if (Meta.is_wayland_compositor()) if (Meta.is_wayland_compositor()) {
this._connectSignal(this._keyboardController, 'emoji-visible', this._connectSignal(this._keyboardController, 'emoji-visible',
this._onEmojiKeyVisible.bind(this)); this._onEmojiKeyVisible.bind(this));
}
this._relayout(); this._relayout();
} }

View File

@ -339,10 +339,11 @@ var LayoutManager = GObject.registerClass({
this.monitors = []; this.monitors = [];
let nMonitors = display.get_n_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, this.monitors.push(new Monitor(i,
display.get_monitor_geometry(i), display.get_monitor_geometry(i),
display.get_monitor_scale(i))); display.get_monitor_scale(i)));
}
if (nMonitors == 0) { if (nMonitors == 0) {
this.primaryIndex = this.bottomIndex = -1; this.primaryIndex = this.bottomIndex = -1;
@ -970,10 +971,11 @@ var LayoutManager = GObject.registerClass({
if (this._startingUp) if (this._startingUp)
return; return;
if (!this._updateRegionIdle) if (!this._updateRegionIdle) {
this._updateRegionIdle = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, this._updateRegionIdle = Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
this._updateRegions.bind(this)); this._updateRegions.bind(this));
} }
}
_getWindowActorsForWorkspace(workspace) { _getWindowActorsForWorkspace(workspace) {
return global.get_window_actors().filter(actor => { return global.get_window_actors().filter(actor => {

View File

@ -771,16 +771,17 @@ var ZoomRegion = class ZoomRegion {
} }
_updateScreenPosition() { _updateScreenPosition() {
if (this._screenPosition == GDesktopEnums.MagnifierScreenPosition.NONE) if (this._screenPosition == GDesktopEnums.MagnifierScreenPosition.NONE) {
this._setViewPort({ this._setViewPort({
x: this._viewPortX, x: this._viewPortX,
y: this._viewPortY, y: this._viewPortY,
width: this._viewPortWidth, width: this._viewPortWidth,
height: this._viewPortHeight height: this._viewPortHeight
}); });
else } else {
this.setScreenPosition(this._screenPosition); this.setScreenPosition(this._screenPosition);
} }
}
_updateFocus(caller, event) { _updateFocus(caller, event) {
let component = event.source.get_component_iface(); 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 // 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 // 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. // 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, this._setViewPort({ x: this._xCenter - this._viewPortWidth / 2,
y: this._yCenter - this._viewPortHeight / 2, y: this._yCenter - this._viewPortHeight / 2,
width: this._viewPortWidth, width: this._viewPortWidth,
height: this._viewPortHeight }, true); height: this._viewPortHeight }, true);
}
this._updateCloneGeometry(); this._updateCloneGeometry();
this._updateMousePosition(); this._updateMousePosition();

View File

@ -150,11 +150,12 @@ class URLHighlighter extends St.Label {
findPos = i; findPos = i;
} }
if (findPos != -1) { 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 && if (findPos >= this._urls[i].pos &&
this._urls[i].pos + this._urls[i].url.length > findPos) this._urls[i].pos + this._urls[i].url.length > findPos)
return i; return i;
} }
}
return -1; return -1;
} }
}); });
@ -170,14 +171,15 @@ class ScaleLayout extends Clutter.BinLayout {
if (this._container == container) if (this._container == container)
return; return;
if (this._container) if (this._container) {
for (let id of this._signals) for (let id of this._signals)
this._container.disconnect(id); this._container.disconnect(id);
}
this._container = container; this._container = container;
this._signals = []; this._signals = [];
if (this._container) if (this._container) {
for (let signal of ['notify::scale-x', 'notify::scale-y']) { for (let signal of ['notify::scale-x', 'notify::scale-y']) {
let id = this._container.connect(signal, () => { let id = this._container.connect(signal, () => {
this.layout_changed(); this.layout_changed();
@ -185,6 +187,7 @@ class ScaleLayout extends Clutter.BinLayout {
this._signals.push(id); this._signals.push(id);
} }
} }
}
vfunc_get_preferred_width(container, forHeight) { vfunc_get_preferred_width(container, forHeight) {
this._connectContainer(container); this._connectContainer(container);

View File

@ -900,10 +900,11 @@ var Source = GObject.registerClass({
} }
destroyNonResidentNotifications() { 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) if (!this.notifications[i].resident)
this.notifications[i].destroy(); this.notifications[i].destroy();
} }
}
}); });
var MessageTray = GObject.registerClass({ var MessageTray = GObject.registerClass({

View File

@ -191,28 +191,31 @@ var MprisPlayer = class MprisPlayer {
this._trackArtists = metadata['xesam:artist']; this._trackArtists = metadata['xesam:artist'];
if (!Array.isArray(this._trackArtists) || if (!Array.isArray(this._trackArtists) ||
!this._trackArtists.every(artist => typeof artist === 'string')) { !this._trackArtists.every(artist => typeof artist === 'string')) {
if (typeof this._trackArtists !== 'undefined') if (typeof this._trackArtists !== 'undefined') {
log(`Received faulty track artist metadata from ${ log(`Received faulty track artist metadata from ${
this._busName}; expected an array of strings, got ${ this._busName}; expected an array of strings, got ${
this._trackArtists} (${typeof this._trackArtists})`); this._trackArtists} (${typeof this._trackArtists})`);
}
this._trackArtists = [_("Unknown artist")]; this._trackArtists = [_("Unknown artist")];
} }
this._trackTitle = metadata['xesam:title']; this._trackTitle = metadata['xesam:title'];
if (typeof this._trackTitle !== 'string') { if (typeof this._trackTitle !== 'string') {
if (typeof this._trackTitle !== 'undefined') if (typeof this._trackTitle !== 'undefined') {
log(`Received faulty track title metadata from ${ log(`Received faulty track title metadata from ${
this._busName}; expected a string, got ${ this._busName}; expected a string, got ${
this._trackTitle} (${typeof this._trackTitle})`); this._trackTitle} (${typeof this._trackTitle})`);
}
this._trackTitle = _("Unknown title"); this._trackTitle = _("Unknown title");
} }
this._trackCoverUrl = metadata['mpris:artUrl']; this._trackCoverUrl = metadata['mpris:artUrl'];
if (typeof this._trackCoverUrl !== 'string') { if (typeof this._trackCoverUrl !== 'string') {
if (typeof this._trackCoverUrl !== 'undefined') if (typeof this._trackCoverUrl !== 'undefined') {
log(`Received faulty track cover art metadata from ${ log(`Received faulty track cover art metadata from ${
this._busName}; expected a string, got ${ this._busName}; expected a string, got ${
this._trackCoverUrl} (${typeof this._trackCoverUrl})`); this._trackCoverUrl} (${typeof this._trackCoverUrl})`);
}
this._trackCoverUrl = ''; this._trackCoverUrl = '';
} }

View File

@ -310,14 +310,15 @@ var FdoNotificationDaemon = class FdoNotificationDaemon {
if (actions.length) { if (actions.length) {
for (let i = 0; i < actions.length - 1; i += 2) { for (let i = 0; i < actions.length - 1; i += 2) {
let [actionId, label] = [actions[i], actions[i + 1]]; let [actionId, label] = [actions[i], actions[i + 1]];
if (actionId == 'default') if (actionId == 'default') {
hasDefaultAction = true; hasDefaultAction = true;
else } else {
notification.addAction(label, () => { notification.addAction(label, () => {
this._emitActionInvoked(ndata.id, actionId); this._emitActionInvoked(ndata.id, actionId);
}); });
} }
} }
}
if (hasDefaultAction) { if (hasDefaultAction) {
notification.connect('activated', () => { notification.connect('activated', () => {
@ -427,14 +428,15 @@ class FdoNotificationDaemonSource extends MessageTray.Source {
else else
this.useNotificationIcon = true; this.useNotificationIcon = true;
if (sender) if (sender) {
this._nameWatcherId = Gio.DBus.session.watch_name(sender, this._nameWatcherId = Gio.DBus.session.watch_name(sender,
Gio.BusNameWatcherFlags.NONE, Gio.BusNameWatcherFlags.NONE,
null, null,
this._onNameVanished.bind(this)); this._onNameVanished.bind(this));
else } else {
this._nameWatcherId = 0; this._nameWatcherId = 0;
} }
}
_createPolicy() { _createPolicy() {
if (this.app && this.app.get_app_info()) { if (this.app && this.app.get_app_info()) {

View File

@ -113,15 +113,16 @@ class OsdWindow extends St.Widget {
setLevel(value) { setLevel(value) {
this._level.visible = (value != undefined); this._level.visible = (value != undefined);
if (value != undefined) { if (value != undefined) {
if (this.visible) if (this.visible) {
this._level.ease_property('value', value, { this._level.ease_property('value', value, {
mode: Clutter.AnimationMode.EASE_OUT_QUAD, mode: Clutter.AnimationMode.EASE_OUT_QUAD,
duration: LEVEL_ANIMATION_TIME duration: LEVEL_ANIMATION_TIME
}); });
else } else {
this._level.value = value; this._level.value = value;
} }
} }
}
setMaxLevel(maxLevel = 1) { setMaxLevel(maxLevel = 1) {
this._level.maximum_value = maxLevel; this._level.maximum_value = maxLevel;

View File

@ -13,10 +13,10 @@ var SIDE_CONTROLS_ANIMATION_TIME = 160;
function getRtlSlideDirection(direction, actor) { function getRtlSlideDirection(direction, actor) {
let rtl = (actor.text_direction == Clutter.TextDirection.RTL); let rtl = (actor.text_direction == Clutter.TextDirection.RTL);
if (rtl) if (rtl) {
direction = (direction == SlideDirection.LEFT) direction = (direction == SlideDirection.LEFT)
? SlideDirection.RIGHT : SlideDirection.LEFT; ? SlideDirection.RIGHT : SlideDirection.LEFT;
}
return direction; return direction;
} }

View File

@ -343,9 +343,10 @@ var AppMenuButton = GObject.registerClass({
if (focusedApp && focusedApp.is_on_workspace(workspace)) if (focusedApp && focusedApp.is_on_workspace(workspace))
return focusedApp; 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)) if (this._startingApps[i].is_on_workspace(workspace))
return this._startingApps[i]; return this._startingApps[i];
}
return null; return null;
} }
@ -470,9 +471,10 @@ class ActivitiesButton extends PanelMenu.Button {
vfunc_event(event) { vfunc_event(event) {
if (event.type() == Clutter.EventType.TOUCH_END || if (event.type() == Clutter.EventType.TOUCH_END ||
event.type() == Clutter.EventType.BUTTON_RELEASE) event.type() == Clutter.EventType.BUTTON_RELEASE) {
if (Main.overview.shouldToggleByCornerOrButton()) if (Main.overview.shouldToggleByCornerOrButton())
Main.overview.toggle(); Main.overview.toggle();
}
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
} }
@ -622,14 +624,15 @@ class PanelCorner extends St.DrawingArea {
cr.setOperator(Cairo.Operator.SOURCE); cr.setOperator(Cairo.Operator.SOURCE);
cr.moveTo(0, offsetY); cr.moveTo(0, offsetY);
if (this._side == St.Side.LEFT) if (this._side == St.Side.LEFT) {
cr.arc(cornerRadius, cr.arc(cornerRadius,
borderWidth + cornerRadius, borderWidth + cornerRadius,
cornerRadius, Math.PI, 3 * Math.PI / 2); cornerRadius, Math.PI, 3 * Math.PI / 2);
else } else {
cr.arc(0, cr.arc(0,
borderWidth + cornerRadius, borderWidth + cornerRadius,
cornerRadius, 3 * Math.PI / 2, 2 * Math.PI); cornerRadius, 3 * Math.PI / 2, 2 * Math.PI);
}
cr.lineTo(cornerRadius, offsetY); cr.lineTo(cornerRadius, offsetY);
cr.closePath(); cr.closePath();

View File

@ -19,9 +19,10 @@ var Ornament = {
}; };
function isPopupMenuItemVisible(child) { function isPopupMenuItemVisible(child) {
if (child._delegate instanceof PopupMenuSection) if (child._delegate instanceof PopupMenuSection) {
if (child._delegate.isEmpty()) if (child._delegate.isEmpty())
return false; return false;
}
return child.visible; return child.visible;
} }
@ -809,9 +810,10 @@ var PopupMenu = class extends PopupMenuBase {
global.focus_manager.add_group(this.actor); global.focus_manager.add_group(this.actor);
this.actor.reactive = true; this.actor.reactive = true;
if (this.sourceActor) if (this.sourceActor) {
this._keyPressId = this.sourceActor.connect('key-press-event', this._keyPressId = this.sourceActor.connect('key-press-event',
this._onKeyPress.bind(this)); this._onKeyPress.bind(this));
}
this._openedSubMenu = null; this._openedSubMenu = null;
} }

View File

@ -1044,10 +1044,11 @@ var ScreenShield = class {
this._animateArrows(); this._animateArrows();
} }
if (!this._arrowWatchId) if (!this._arrowWatchId) {
this._arrowWatchId = this.idleMonitor.add_idle_watch(ARROW_IDLE_TIME, this._arrowWatchId = this.idleMonitor.add_idle_watch(ARROW_IDLE_TIME,
this._pauseArrowAnimation.bind(this)); this._pauseArrowAnimation.bind(this));
} }
}
_pauseArrowAnimation() { _pauseArrowAnimation() {
if (this._arrowAnimationId) { if (this._arrowAnimationId) {

View File

@ -53,9 +53,10 @@ class SearchResult extends St.Button {
activate() { activate() {
this.provider.activateResult(this.metaInfo.id, this._resultsView.terms); this.provider.activateResult(this.metaInfo.id, this._resultsView.terms);
if (this.metaInfo.clipboardText) if (this.metaInfo.clipboardText) {
St.Clipboard.get_default().set_text( St.Clipboard.get_default().set_text(
St.ClipboardType.CLIPBOARD, this.metaInfo.clipboardText); St.ClipboardType.CLIPBOARD, this.metaInfo.clipboardText);
}
Main.overview.toggle(); Main.overview.toggle();
} }
}); });
@ -549,19 +550,20 @@ var SearchResultsView = GObject.registerClass({
provider.searchInProgress = true; provider.searchInProgress = true;
let previousProviderResults = previousResults[provider.id]; let previousProviderResults = previousResults[provider.id];
if (this._isSubSearch && previousProviderResults) if (this._isSubSearch && previousProviderResults) {
provider.getSubsearchResultSet(previousProviderResults, provider.getSubsearchResultSet(previousProviderResults,
this._terms, this._terms,
results => { results => {
this._gotResults(results, provider); this._gotResults(results, provider);
}, },
this._cancellable); this._cancellable);
else } else {
provider.getInitialResultSet(this._terms, provider.getInitialResultSet(this._terms,
results => { results => {
this._gotResults(results, provider); this._gotResults(results, provider);
}, },
this._cancellable); this._cancellable);
}
}); });
this._updateSearchProgress(); this._updateSearchProgress();

View File

@ -143,9 +143,10 @@ function listModes() {
let loop = new GLib.MainLoop(null, false); let loop = new GLib.MainLoop(null, false);
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => { let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
let names = Object.getOwnPropertyNames(_modes); 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) if (_modes[names[i]].isPrimary)
print(names[i]); print(names[i]);
}
loop.quit(); loop.quit();
}); });
GLib.Source.set_name_by_id(id, '[gnome-shell] listModes'); GLib.Source.set_name_by_id(id, '[gnome-shell] listModes');
@ -188,11 +189,12 @@ var SessionMode = class {
_sync() { _sync() {
let params = _modes[this.currentMode]; let params = _modes[this.currentMode];
let defaults; let defaults;
if (params.parentMode) if (params.parentMode) {
defaults = Params.parse(_modes[params.parentMode], defaults = Params.parse(_modes[params.parentMode],
_modes[DEFAULT_MODE]); _modes[DEFAULT_MODE]);
else } else {
defaults = _modes[DEFAULT_MODE]; defaults = _modes[DEFAULT_MODE];
}
params = Params.parse(params, defaults); params = Params.parse(params, defaults);
// A simplified version of Lang.copyProperties, handles // A simplified version of Lang.copyProperties, handles

View File

@ -474,15 +474,16 @@ var ShellMountPasswordDialog = GObject.registerClass({
_onOpenDisksButton() { _onOpenDisksButton() {
let app = Shell.AppSystem.get_default().lookup_app('org.gnome.DiskUtility.desktop'); let app = Shell.AppSystem.get_default().lookup_app('org.gnome.DiskUtility.desktop');
if (app) if (app) {
app.activate(); app.activate();
else } else {
Main.notifyError( Main.notifyError(
/* Translators: %s is the Disks application */ /* Translators: %s is the Disks application */
_("Unable to start %s").format(app.get_name()), _("Unable to start %s").format(app.get_name()),
/* Translators: %s is the Disks application */ /* Translators: %s is the Disks application */
_("Couldnt find the %s application").format(app.get_name()) _("Couldnt find the %s application").format(app.get_name())
); );
}
this._onCancelButton(); this._onCancelButton();
} }
}); });

View File

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

View File

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

View File

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

View File

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

View File

@ -310,13 +310,14 @@ var ViewSelector = GObject.registerClass({
let page = new St.Bin({ child: actor }); let page = new St.Bin({ child: actor });
if (params.a11yFocus) if (params.a11yFocus) {
Main.ctrlAltTabManager.addGroup(params.a11yFocus, name, a11yIcon); Main.ctrlAltTabManager.addGroup(params.a11yFocus, name, a11yIcon);
else } else {
Main.ctrlAltTabManager.addGroup(actor, name, a11yIcon, { Main.ctrlAltTabManager.addGroup(actor, name, a11yIcon, {
proxy: this, proxy: this,
focusCallback: () => this._a11yFocusPage(page), focusCallback: () => this._a11yFocusPage(page),
}); });
}
page.hide(); page.hide();
this.add_actor(page); this.add_actor(page);
return page; return page;
@ -524,9 +525,10 @@ var ViewSelector = GObject.registerClass({
this._entry.set_secondary_icon(this._clearIcon); this._entry.set_secondary_icon(this._clearIcon);
if (this._iconClickedId == 0) if (this._iconClickedId == 0) {
this._iconClickedId = this._entry.connect('secondary-icon-clicked', this._iconClickedId = this._entry.connect('secondary-icon-clicked',
this.reset.bind(this)); this.reset.bind(this));
}
} else { } else {
if (this._iconClickedId > 0) { if (this._iconClickedId > 0) {
this._entry.disconnect(this._iconClickedId); this._entry.disconnect(this._iconClickedId);

View File

@ -1204,11 +1204,12 @@ var ThumbnailsBox = GObject.registerClass({
} }
_updatePorthole() { _updatePorthole() {
if (!Main.layoutManager.primaryMonitor) if (!Main.layoutManager.primaryMonitor) {
this._porthole = { width: global.stage.width, height: global.stage.height, this._porthole = { width: global.stage.width, height: global.stage.height,
x: global.stage.x, y: global.stage.y }; x: global.stage.x, y: global.stage.y };
else } else {
this._porthole = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex); this._porthole = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex);
}
this.queue_relayout(); this.queue_relayout();
} }