js: Don't use templates in files with translations

xgettext gained some support for template strings, and no longer
fails when encountering '/' somewhere between backticks.

Unfortunately its support is still buggy as hell, and it is now
silently dropping translatable strings, yay. I hate making the
code worse, but until xgettext really gets its shit together,
the only viable way forward seems to be to not use template
strings in any files listed in POTFILES.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1014
This commit is contained in:
Florian Müllner 2020-02-14 16:10:34 +01:00
parent 0c232876c3
commit 9d941f8202
43 changed files with 219 additions and 212 deletions

View File

@ -277,10 +277,10 @@ var ExtensionsWindow = GObject.registerClass({
}); });
box.add(expander); box.add(expander);
let errortext = `${exc}\n\nStack trace:\n${ let errortext = '%s\n\nStack trace:\n'.format(exc);
// Indent stack trace. // Indent stack trace.
exc.stack.split('\n').map(line => ` ${line}`).join('\n') errortext +=
}`; exc.stack.split('\n').map(line => ' %s'.format(line)).join('\n');
let buffer = new Gtk.TextBuffer({ text: errortext }); let buffer = new Gtk.TextBuffer({ text: errortext });
let textview = new Gtk.TextView({ let textview = new Gtk.TextView({
@ -315,9 +315,9 @@ var ExtensionsWindow = GObject.registerClass({
let clipboard = Gtk.Clipboard.get_default(w.get_display()); let clipboard = Gtk.Clipboard.get_default(w.get_display());
// markdown for pasting in gitlab issues // markdown for pasting in gitlab issues
let lines = [ let lines = [
`The settings of extension ${row.uuid} had an error:`, 'The settings of extension %s had an error:'.format(row.uuid),
'```', // '`' (xgettext throws up on odd number of backticks) '```', // '`' (xgettext throws up on odd number of backticks)
`${exc}`, exc.toString(),
'```', // '`' '```', // '`'
'', '',
'Stack trace:', 'Stack trace:',
@ -403,7 +403,7 @@ var ExtensionsWindow = GObject.registerClass({
this._shellProxy.ListExtensionsRemote(([extensionsMap], e) => { this._shellProxy.ListExtensionsRemote(([extensionsMap], e) => {
if (e) { if (e) {
if (e instanceof Gio.DBusError) { if (e instanceof Gio.DBusError) {
log(`Failed to connect to shell proxy: ${e}`); log('Failed to connect to shell proxy: %s'.format(e.toString()));
this._mainStack.visible_child_name = 'noshell'; this._mainStack.visible_child_name = 'noshell';
} else { } else {
throw e; throw e;
@ -703,10 +703,10 @@ var ExtensionRow = GObject.registerClass({
this._updatesIcon.visible = this.hasUpdate; this._updatesIcon.visible = this.hasUpdate;
this._versionLabel.label = `${this.version}`; this._versionLabel.label = this.version;
this._versionLabel.visible = this.version !== ''; this._versionLabel.visible = this.version !== '';
this._authorLabel.label = `${this.creator}`; this._authorLabel.label = this.creator;
this._authorLabel.visible = this.creator !== ''; this._authorLabel.visible = this.creator !== '';
} }
@ -747,7 +747,7 @@ function initEnvironment() {
}, },
logError(s) { logError(s) {
log(`ERROR: ${s}`); log('ERROR: %s'.format(s));
}, },
userdatadir: GLib.build_filenamev([GLib.get_user_data_dir(), 'gnome-shell']), userdatadir: GLib.build_filenamev([GLib.get_user_data_dir(), 'gnome-shell']),

View File

@ -421,13 +421,13 @@ var LoginDialog = GObject.registerClass({
this._settings = new Gio.Settings({ schema_id: GdmUtil.LOGIN_SCREEN_SCHEMA }); this._settings = new Gio.Settings({ schema_id: GdmUtil.LOGIN_SCREEN_SCHEMA });
this._settings.connect(`changed::${GdmUtil.BANNER_MESSAGE_KEY}`, this._settings.connect('changed::%s'.format(GdmUtil.BANNER_MESSAGE_KEY),
this._updateBanner.bind(this)); this._updateBanner.bind(this));
this._settings.connect(`changed::${GdmUtil.BANNER_MESSAGE_TEXT_KEY}`, this._settings.connect('changed::%s'.format(GdmUtil.BANNER_MESSAGE_TEXT_KEY),
this._updateBanner.bind(this)); this._updateBanner.bind(this));
this._settings.connect(`changed::${GdmUtil.DISABLE_USER_LIST_KEY}`, this._settings.connect('changed::%s'.format(GdmUtil.DISABLE_USER_LIST_KEY),
this._updateDisableUserList.bind(this)); this._updateDisableUserList.bind(this));
this._settings.connect(`changed::${GdmUtil.LOGO_KEY}`, this._settings.connect('changed::%s'.format(GdmUtil.LOGO_KEY),
this._updateLogo.bind(this)); this._updateLogo.bind(this));
this._textureCache = St.TextureCache.get_default(); this._textureCache = St.TextureCache.get_default();

View File

@ -151,17 +151,17 @@ const SystemActions = GObject.registerClass({
this._userManager.connect('user-removed', this._userManager.connect('user-removed',
() => this._updateMultiUser()); () => this._updateMultiUser());
this._lockdownSettings.connect(`changed::${DISABLE_USER_SWITCH_KEY}`, this._lockdownSettings.connect('changed::%s'.format(DISABLE_USER_SWITCH_KEY),
() => this._updateSwitchUser()); () => this._updateSwitchUser());
this._lockdownSettings.connect(`changed::${DISABLE_LOG_OUT_KEY}`, this._lockdownSettings.connect('changed::%s'.format(DISABLE_LOG_OUT_KEY),
() => this._updateLogout()); () => this._updateLogout());
global.settings.connect(`changed::${ALWAYS_SHOW_LOG_OUT_KEY}`, global.settings.connect('changed::%s'.format(ALWAYS_SHOW_LOG_OUT_KEY),
() => this._updateLogout()); () => this._updateLogout());
this._lockdownSettings.connect(`changed::${DISABLE_LOCK_SCREEN_KEY}`, this._lockdownSettings.connect('changed::%s'.format(DISABLE_LOCK_SCREEN_KEY),
() => this._updateLockScreen()); () => this._updateLockScreen());
this._lockdownSettings.connect(`changed::${DISABLE_LOG_OUT_KEY}`, this._lockdownSettings.connect('changed::%s'.format(DISABLE_LOG_OUT_KEY),
() => this._updateHaveShutdown()); () => this._updateHaveShutdown());
this.forceUpdate(); this.forceUpdate();

View File

@ -21,7 +21,7 @@ const _leadingJunk = '[\\s`(\\[{\'\\"<\u00AB\u201C\u2018]';
const _notTrailingJunk = '[^\\s`!()\\[\\]{};:\'\\".,<>?\u00AB\u00BB\u200E\u200F\u201C\u201D\u2018\u2019\u202A\u202C]'; const _notTrailingJunk = '[^\\s`!()\\[\\]{};:\'\\".,<>?\u00AB\u00BB\u200E\u200F\u201C\u201D\u2018\u2019\u202A\u202C]';
const _urlRegexp = new RegExp( const _urlRegexp = new RegExp(
`(^|${_leadingJunk})` + '(^|%s)'.format(_leadingJunk) +
'(' + '(' +
'(?:' + '(?:' +
'(?:http|https|ftp)://' + // scheme:// '(?:http|https|ftp)://' + // scheme://
@ -33,12 +33,12 @@ const _urlRegexp = new RegExp(
'(?:' + // one or more: '(?:' + // one or more:
'[^\\s()<>]+' + // run of non-space non-() '[^\\s()<>]+' + // run of non-space non-()
'|' + // or '|' + // or
`${_balancedParens}` + // balanced parens '%s'.format(_balancedParens) + // balanced parens
')+' + ')+' +
'(?:' + // end with: '(?:' + // end with:
`${_balancedParens}` + // balanced parens '%s'.format(_balancedParens) + // balanced parens
'|' + // or '|' + // or
`${_notTrailingJunk}` + // last non-junk char '%s'.format(_notTrailingJunk) + // last non-junk char
')' + ')' +
')', 'gi'); ')', 'gi');
@ -153,7 +153,7 @@ function trySpawnCommandLine(commandLine) {
} catch (err) { } catch (err) {
// Replace "Error invoking GLib.shell_parse_argv: " with // Replace "Error invoking GLib.shell_parse_argv: " with
// something nicer // something nicer
err.message = err.message.replace(/[^:]*: /, `${_("Could not parse command:")}\n`); err.message = err.message.replace(/[^:]*: /, '%s\n'.format(_('Could not parse command:')));
throw err; throw err;
} }

View File

@ -23,7 +23,6 @@ const PortalHelperSecurityLevel = {
}; };
const CONNECTIVITY_CHECK_HOST = 'nmcheck.gnome.org'; const CONNECTIVITY_CHECK_HOST = 'nmcheck.gnome.org';
const CONNECTIVITY_CHECK_URI = `http://${CONNECTIVITY_CHECK_HOST}`;
const CONNECTIVITY_RECHECK_RATELIMIT_TIMEOUT = 30 * GLib.USEC_PER_SEC; const CONNECTIVITY_RECHECK_RATELIMIT_TIMEOUT = 30 * GLib.USEC_PER_SEC;
const HelperDBusInterface = loadInterfaceXML('org.gnome.Shell.PortalHelper'); const HelperDBusInterface = loadInterfaceXML('org.gnome.Shell.PortalHelper');
@ -103,7 +102,7 @@ class PortalWindow extends Gtk.ApplicationWindow {
this._headerBar.show(); this._headerBar.show();
if (!url) { if (!url) {
url = CONNECTIVITY_CHECK_URI; url = 'http://%s'.format(CONNECTIVITY_CHECK_HOST);
this._originalUrlWasGnome = true; this._originalUrlWasGnome = true;
} else { } else {
this._originalUrlWasGnome = false; this._originalUrlWasGnome = false;

View File

@ -138,7 +138,7 @@ var AccessDialogDBus = class {
let [handle, appId, parentWindow_, title, description, body, options] = params; let [handle, appId, parentWindow_, title, description, body, options] = params;
// We probably want to use parentWindow and global.display.focus_window // We probably want to use parentWindow and global.display.focus_window
// for this check in the future // for this check in the future
if (appId && `${appId}.desktop` != this._windowTracker.focus_app.id) { if (appId && '%s.desktop'.format(appId) != this._windowTracker.focus_app.id) {
invocation.return_error_literal(Gio.DBusError, invocation.return_error_literal(Gio.DBusError,
Gio.DBusError.ACCESS_DENIED, Gio.DBusError.ACCESS_DENIED,
'Only the focused app is allowed to show a system access dialog'); 'Only the focused app is allowed to show a system access dialog');

View File

@ -72,7 +72,7 @@ function _getFolderName(folder) {
if (folder.get_boolean('translate')) { if (folder.get_boolean('translate')) {
let keyfile = new GLib.KeyFile(); let keyfile = new GLib.KeyFile();
let path = `desktop-directories/${name}`; let path = 'desktop-directories/%s'.format(name);
try { try {
keyfile.load_from_data_dirs(path, GLib.KeyFileFlags.NONE); keyfile.load_from_data_dirs(path, GLib.KeyFileFlags.NONE);
@ -219,7 +219,7 @@ var BaseAppView = GObject.registerClass({
if (this._items.has(id)) if (this._items.has(id))
this._items.get(id).navigate_focus(null, St.DirectionType.TAB_FORWARD, false); this._items.get(id).navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
else else
log(`No such application ${id}`); log('No such application %s'.format(id));
} }
selectApp(id) { selectApp(id) {
@ -293,7 +293,7 @@ var BaseAppView = GObject.registerClass({
} }
adaptToSize(_width, _height) { adaptToSize(_width, _height) {
throw new GObject.NotImplementedError(`adaptToSize in ${this.constructor.name}`); throw new GObject.NotImplementedError('adaptToSize in %s'.format(this.constructor.name));
} }
}); });
@ -492,7 +492,7 @@ var AllView = GObject.registerClass({
let folders = this._folderSettings.get_strv('folder-children'); let folders = this._folderSettings.get_strv('folder-children');
folders.forEach(id => { folders.forEach(id => {
let path = `${this._folderSettings.path}folders/${id}/`; let path = '%sfolders/%s/'.format(this._folderSettings.path, id);
let icon = this._items.get(id); let icon = this._items.get(id);
if (!icon) { if (!icon) {
icon = new FolderIcon(id, path, this); icon = new FolderIcon(id, path, this);
@ -2278,7 +2278,7 @@ var AppIcon = GObject.registerClass({
shellWorkspaceLaunch(params) { shellWorkspaceLaunch(params) {
let { stack } = new Error(); let { stack } = new Error();
log(`shellWorkspaceLaunch is deprecated, use app.open_new_window() instead\n${stack}`); log('shellWorkspaceLaunch is deprecated, use app.open_new_window() instead\n%s'.format(stack));
params = Params.parse(params, { workspace: -1, params = Params.parse(params, { workspace: -1,
timestamp: 0 }); timestamp: 0 });

View File

@ -66,7 +66,7 @@ class AppFavorites {
constructor() { constructor() {
this.FAVORITE_APPS_KEY = 'favorite-apps'; this.FAVORITE_APPS_KEY = 'favorite-apps';
this._favorites = {}; this._favorites = {};
global.settings.connect(`changed::${this.FAVORITE_APPS_KEY}`, this._onFavsChanged.bind(this)); global.settings.connect('changed::%s'.format(this.FAVORITE_APPS_KEY), this._onFavsChanged.bind(this));
this.reload(); this.reload();
} }

View File

@ -120,7 +120,7 @@ var AudioDeviceSelectionDialog = GObject.registerClass({
let app = Shell.AppSystem.get_default().lookup_app(desktopFile); let app = Shell.AppSystem.get_default().lookup_app(desktopFile);
if (!app) { if (!app) {
log(`Settings panel for desktop file ${desktopFile} could not be loaded!`); log('Settings panel for desktop file %s could not be loaded!'.format(desktopFile));
return; return;
} }

View File

@ -18,7 +18,7 @@ var ELLIPSIS_CHAR = '\u2026';
var MESSAGE_ICON_SIZE = -1; // pick up from CSS var MESSAGE_ICON_SIZE = -1; // pick up from CSS
var NC_ = (context, str) => `${context}\u0004${str}`; var NC_ = (context, str) => '%s\u0004%s'.format(context, str);
function sameYear(dateA, dateB) { function sameYear(dateA, dateB) {
return dateA.getYear() == dateB.getYear(); return dateA.getYear() == dateB.getYear();
@ -114,26 +114,26 @@ var EventSourceBase = GObject.registerClass({
Signals: { 'changed': {} }, Signals: { 'changed': {} },
}, class EventSourceBase extends GObject.Object { }, class EventSourceBase extends GObject.Object {
get isLoading() { get isLoading() {
throw new GObject.NotImplementedError(`isLoading in ${this.constructor.name}`); throw new GObject.NotImplementedError('isLoading in %s'.format(this.constructor.name));
} }
get hasCalendars() { get hasCalendars() {
throw new GObject.NotImplementedError(`hasCalendars in ${this.constructor.name}`); throw new GObject.NotImplementedError('hasCalendars in %s'.format(this.constructor.name));
} }
destroy() { destroy() {
} }
requestRange(_begin, _end) { requestRange(_begin, _end) {
throw new GObject.NotImplementedError(`requestRange in ${this.constructor.name}`); throw new GObject.NotImplementedError('requestRange in %s'.format(this.constructor.name));
} }
getEvents(_begin, _end) { getEvents(_begin, _end) {
throw new GObject.NotImplementedError(`getEvents in ${this.constructor.name}`); throw new GObject.NotImplementedError('getEvents in %s'.format(this.constructor.name));
} }
hasEvents(_day) { hasEvents(_day) {
throw new GObject.NotImplementedError(`hasEvents in ${this.constructor.name}`); throw new GObject.NotImplementedError('hasEvents in %s'.format(this.constructor.name));
} }
}); });
@ -215,7 +215,7 @@ class DBusEventSource extends EventSourceBase {
// about the HasCalendars property and would cause an exception trying // about the HasCalendars property and would cause an exception trying
// to read it) // to read it)
} else { } else {
log(`Error loading calendars: ${e.message}`); log('Error loading calendars: %s'.format(e.message));
return; return;
} }
} }
@ -359,7 +359,7 @@ var Calendar = GObject.registerClass({
this._weekStart = Shell.util_get_week_start(); this._weekStart = Shell.util_get_week_start();
this._settings = new Gio.Settings({ schema_id: 'org.gnome.desktop.calendar' }); this._settings = new Gio.Settings({ schema_id: 'org.gnome.desktop.calendar' });
this._settings.connect(`changed::${SHOW_WEEKDATE_KEY}`, this._onSettingsChange.bind(this)); this._settings.connect('changed::%s'.format(SHOW_WEEKDATE_KEY), this._onSettingsChange.bind(this));
this._useWeekdate = this._settings.get_boolean(SHOW_WEEKDATE_KEY); this._useWeekdate = this._settings.get_boolean(SHOW_WEEKDATE_KEY);
/** /**
@ -626,13 +626,13 @@ var Calendar = GObject.registerClass({
// Hack used in lieu of border-collapse - see gnome-shell.css // Hack used in lieu of border-collapse - see gnome-shell.css
if (row == 2) if (row == 2)
styleClass = `calendar-day-top ${styleClass}`; styleClass = 'calendar-day-top %s'.format(styleClass);
let leftMost = rtl let leftMost = rtl
? iter.getDay() == (this._weekStart + 6) % 7 ? iter.getDay() == (this._weekStart + 6) % 7
: iter.getDay() == this._weekStart; : iter.getDay() == this._weekStart;
if (leftMost) if (leftMost)
styleClass = `calendar-day-left ${styleClass}`; styleClass = 'calendar-day-left %s'.format(styleClass);
if (sameDay(now, iter)) if (sameDay(now, iter))
styleClass += ' calendar-today'; styleClass += ' calendar-today';
@ -738,15 +738,15 @@ class EventMessage extends MessageList.Message {
let rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL; let rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL;
if (this._event.date < periodBegin && !this._event.allDay) { if (this._event.date < periodBegin && !this._event.allDay) {
if (rtl) if (rtl)
title = `${title}${ELLIPSIS_CHAR}`; title = '%s%s'.format(title, ELLIPSIS_CHAR);
else else
title = `${ELLIPSIS_CHAR}${title}`; title = '%s%s'.format(ELLIPSIS_CHAR, title);
} }
if (this._event.end > periodEnd && !this._event.allDay) { if (this._event.end > periodEnd && !this._event.allDay) {
if (rtl) if (rtl)
title = `${ELLIPSIS_CHAR}${title}`; title = '%s%s'.format(ELLIPSIS_CHAR, title);
else else
title = `${title}${ELLIPSIS_CHAR}`; title = '%s%s'.format(title, ELLIPSIS_CHAR);
} }
return title; return title;
} }
@ -1204,7 +1204,7 @@ class CalendarMessageList extends St.Widget {
for (let prop of ['visible', 'empty', 'can-clear']) { for (let prop of ['visible', 'empty', 'can-clear']) {
connectionsIds.push( connectionsIds.push(
section.connect(`notify::${prop}`, this._sync.bind(this))); section.connect('notify::%s'.format(prop), this._sync.bind(this)));
} }
connectionsIds.push(section.connect('message-focused', (_s, messageActor) => { connectionsIds.push(section.connect('message-focused', (_s, messageActor) => {
Util.ensureActorVisibleInScrollView(this._scrollView, messageActor); Util.ensureActorVisibleInScrollView(this._scrollView, messageActor);

View File

@ -113,7 +113,7 @@ var AutomountManager = class {
try { try {
drive.stop_finish(res); drive.stop_finish(res);
} catch (e) { } catch (e) {
log(`Unable to stop the drive after drive-eject-button ${e.toString()}`); log('Unable to stop the drive after drive-eject-button %s'.format(e.toString()));
} }
}); });
} else if (drive.can_eject()) { } else if (drive.can_eject()) {
@ -122,7 +122,7 @@ var AutomountManager = class {
try { try {
drive.eject_with_operation_finish(res); drive.eject_with_operation_finish(res);
} catch (e) { } catch (e) {
log(`Unable to eject the drive after drive-eject-button ${e.toString()}`); log('Unable to eject the drive after drive-eject-button %s'.format(e.toString()));
} }
}); });
} }
@ -210,7 +210,7 @@ var AutomountManager = class {
} }
if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED_HANDLED)) if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED_HANDLED))
log(`Unable to mount volume ${volume.get_name()}: ${e.toString()}`); log('Unable to mount volume %s: %s'.format(volume.get_name(), e.toString()));
this._closeOperation(volume); this._closeOperation(volume);
} }
} }

View File

@ -66,7 +66,7 @@ function startAppForMount(app, mount) {
retval = app.launch(files, retval = app.launch(files,
global.create_app_launch_context(0, -1)); global.create_app_launch_context(0, -1));
} catch (e) { } catch (e) {
log(`Unable to launch the application ${app.get_name()}: ${e}`); log('Unable to launch the application %s: %s'.format(app.get_name(), e.toString()));
} }
return retval; return retval;
@ -105,7 +105,7 @@ var ContentTypeDiscoverer = class {
try { try {
contentTypes = mount.guess_content_type_finish(res); contentTypes = mount.guess_content_type_finish(res);
} catch (e) { } catch (e) {
log(`Unable to guess content types on added mount ${mount.get_name()}: ${e}`); log('Unable to guess content types on added mount %s: %s'.format(mount.get_name(), e.toString()));
} }
if (contentTypes.length) { if (contentTypes.length) {

View File

@ -204,10 +204,14 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
validate: this._validateWpaPsk, password: true }); validate: this._validateWpaPsk, password: true });
break; break;
case 'none': // static WEP case 'none': // static WEP
secrets.push({ label: _('Key'), key: `wep-key${wirelessSecuritySetting.wep_tx_keyidx}`, secrets.push({
value: wirelessSecuritySetting.get_wep_key(wirelessSecuritySetting.wep_tx_keyidx) || '', label: _('Key'),
wep_key_type: wirelessSecuritySetting.wep_key_type, key: 'wep-key%s'.format(wirelessSecuritySetting.wep_tx_keyidx),
validate: this._validateStaticWep, password: true }); value: wirelessSecuritySetting.get_wep_key(wirelessSecuritySetting.wep_tx_keyidx) || '',
wep_key_type: wirelessSecuritySetting.wep_key_type,
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
@ -221,7 +225,7 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
this._get8021xSecrets(secrets); this._get8021xSecrets(secrets);
break; break;
default: default:
log(`Invalid wireless key management: ${wirelessSecuritySetting.key_mgmt}`); log('Invalid wireless key management: %s'.format(wirelessSecuritySetting.key_mgmt));
} }
} }
@ -266,7 +270,7 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
value: ieee8021xSetting.private_key_password || '', password: true }); value: ieee8021xSetting.private_key_password || '', password: true });
break; break;
default: default:
log(`Invalid EAP/IEEE802.1x method: ${ieee8021xSetting.get_eap_method(0)}`); log('Invalid EAP/IEEE802.1x method: %s'.format(ieee8021xSetting.get_eap_method(0)));
} }
} }
@ -336,7 +340,7 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
this._getMobileSecrets(content.secrets, connectionType); this._getMobileSecrets(content.secrets, connectionType);
break; break;
default: default:
log(`Invalid connection type: ${connectionType}`); log('Invalid connection type: %s'.format(connectionType));
} }
return content; return content;
@ -581,12 +585,12 @@ var VPNRequestHandler = class {
try { try {
vpnSetting.foreach_data_item((key, value) => { vpnSetting.foreach_data_item((key, value) => {
this._stdin.write(`DATA_KEY=${key}\n`, null); this._stdin.write('DATA_KEY=%s\n'.format(key), null);
this._stdin.write(`DATA_VAL=${value || ''}\n\n`, null); this._stdin.write('DATA_VAL=%s\n\n'.format(value || ''), null);
}); });
vpnSetting.foreach_secret((key, value) => { vpnSetting.foreach_secret((key, value) => {
this._stdin.write(`SECRET_KEY=${key}\n`, null); this._stdin.write('SECRET_KEY=%s\n'.format(key), null);
this._stdin.write(`SECRET_VAL=${value || ''}\n\n`, null); this._stdin.write('SECRET_VAL=%s\n\n'.format(value || ''), null);
}); });
this._stdin.write('DONE\n\n', null); this._stdin.write('DONE\n\n', null);
} catch (e) { } catch (e) {
@ -616,7 +620,7 @@ var NetworkAgent = class {
let monitor = this._pluginDir.monitor(Gio.FileMonitorFlags.NONE, null); let monitor = this._pluginDir.monitor(Gio.FileMonitorFlags.NONE, null);
monitor.connect('changed', () => (this._vpnCacheBuilt = false)); monitor.connect('changed', () => (this._vpnCacheBuilt = false));
} catch (e) { } catch (e) {
log(`Failed to create monitor for VPN plugin dir: ${e.message}`); log('Failed to create monitor for VPN plugin dir: %s'.format(e.message));
} }
this._native.connect('new-request', this._newRequest.bind(this)); this._native.connect('new-request', this._newRequest.bind(this));
@ -707,7 +711,7 @@ var NetworkAgent = class {
body = _("A password is required to connect to “%s”.").format(connectionSetting.get_id()); body = _("A password is required to connect to “%s”.").format(connectionSetting.get_id());
break; break;
default: default:
log(`Invalid connection type: ${connectionType}`); log('Invalid connection type: %s'.format(connectionType));
this._native.respond(requestId, Shell.NetworkAgentResponse.INTERNAL_ERROR); this._native.respond(requestId, Shell.NetworkAgentResponse.INTERNAL_ERROR);
return; return;
} }

View File

@ -44,7 +44,7 @@ var AuthenticationDialog = GObject.registerClass({
let bodyContent = new Dialog.MessageDialogContent(); let bodyContent = new Dialog.MessageDialogContent();
if (userNames.length > 1) { if (userNames.length > 1) {
log(`polkitAuthenticationAgent: Received ${userNames.length} ` + log('polkitAuthenticationAgent: Received %d'.format(userNames.length) +
'identities that can be used for authentication. Only ' + 'identities that can be used for authentication. Only ' +
'considering one.'); 'considering one.');
} }
@ -194,8 +194,8 @@ var AuthenticationDialog = GObject.registerClass({
// We could add retrying if this turns out to be a problem // We could add retrying if this turns out to be a problem
log('polkitAuthenticationAgent: Failed to show modal dialog. ' + log('polkitAuthenticationAgent: Failed to show modal dialog. ' +
`Dismissing authentication request for action-id ${this.actionId} ` + 'Dismissing authentication request for action-id %s '.format(this.actionId) +
`cookie ${this._cookie}`); 'cookie %s'.format(this._cookie));
this._emitDone(true); this._emitDone(true);
} }
} }

View File

@ -87,7 +87,7 @@ var TelepathyComponent = class {
try { try {
this._client.register(); this._client.register();
} catch (e) { } catch (e) {
throw new Error(`Could not register Telepathy client. Error: ${e}`); throw new Error('Could not register Telepathy client. Error: %s'.format(e.toString()));
} }
if (!this._client.account_manager.is_prepared(Tp.AccountManager.get_feature_quark_core())) if (!this._client.account_manager.is_prepared(Tp.AccountManager.get_feature_quark_core()))
@ -254,7 +254,7 @@ class TelepathyClient extends Tp.BaseClient {
dispatchOp.claim_with_finish(result); dispatchOp.claim_with_finish(result);
this._handlingChannels(account, conn, [channel], false); this._handlingChannels(account, conn, [channel], false);
} catch (err) { } catch (err) {
log(`Failed to Claim channel: ${err}`); log('Failed to Claim channel: %s'.format(err.toString()));
} }
}); });

View File

@ -230,7 +230,7 @@ class WorldClocksSection extends St.Button {
_onProxyReady(proxy, error) { _onProxyReady(proxy, error) {
if (error) { if (error) {
log(`Failed to create GNOME Clocks proxy: ${error}`); log('Failed to create GNOME Clocks proxy: %s'.format(error));
return; return;
} }

View File

@ -299,7 +299,7 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
try { try {
this._updatesPermission = Polkit.Permission.new_finish(res); this._updatesPermission = Polkit.Permission.new_finish(res);
} catch (e) { } catch (e) {
log(`No permission to trigger offline updates: ${e}`); log('No permission to trigger offline updates: %s'.format(e.toString()));
} }
}); });
} }
@ -563,7 +563,7 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
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: %d'.format(sessionId));
}); });
} }

View File

@ -10,10 +10,9 @@ const FileUtils = imports.misc.fileUtils;
const Main = imports.ui.main; const Main = imports.ui.main;
const ModalDialog = imports.ui.modalDialog; const ModalDialog = imports.ui.modalDialog;
var REPOSITORY_URL_BASE = 'https://extensions.gnome.org'; var REPOSITORY_URL_DOWNLOAD = 'https://extensions.gnome.org/download-extension/%s.shell-extension.zip';
var REPOSITORY_URL_DOWNLOAD = `${REPOSITORY_URL_BASE}/download-extension/%s.shell-extension.zip`; var REPOSITORY_URL_INFO = 'https://extensions.gnome.org/extension-info/';
var REPOSITORY_URL_INFO = `${REPOSITORY_URL_BASE}/extension-info/`; var REPOSITORY_URL_UPDATE = 'https://extensions.gnome.org/update-info/';
var REPOSITORY_URL_UPDATE = `${REPOSITORY_URL_BASE}/update-info/`;
let _httpSession; let _httpSession;
@ -25,7 +24,7 @@ function installExtension(uuid, invocation) {
_httpSession.queue_message(message, () => { _httpSession.queue_message(message, () => {
if (message.status_code != Soup.KnownStatusCode.OK) { if (message.status_code != Soup.KnownStatusCode.OK) {
Main.extensionManager.logExtensionError(uuid, `downloading info: ${message.status_code}`); Main.extensionManager.logExtensionError(uuid, 'downloading info: %d'.format(message.status_code));
invocation.return_dbus_error('org.gnome.Shell.DownloadInfoError', message.status_code.toString()); invocation.return_dbus_error('org.gnome.Shell.DownloadInfoError', message.status_code.toString());
return; return;
} }
@ -34,7 +33,7 @@ function installExtension(uuid, invocation) {
try { try {
info = JSON.parse(message.response_body.data); info = JSON.parse(message.response_body.data);
} catch (e) { } catch (e) {
Main.extensionManager.logExtensionError(uuid, `parsing info: ${e}`); Main.extensionManager.logExtensionError(uuid, 'parsing info: %s'.format(e.toString()));
invocation.return_dbus_error('org.gnome.Shell.ParseInfoError', e.toString()); invocation.return_dbus_error('org.gnome.Shell.ParseInfoError', e.toString());
return; return;
} }
@ -112,7 +111,7 @@ function downloadExtensionUpdate(uuid) {
gotExtensionZipFile(session, message, uuid, dir, () => { gotExtensionZipFile(session, message, uuid, dir, () => {
Main.extensionManager.notifyExtensionUpdate(uuid); Main.extensionManager.notifyExtensionUpdate(uuid);
}, (code, msg) => { }, (code, msg) => {
log(`Error while downloading update for extension ${uuid}: ${code} (${msg})`); log('Error while downloading update for extension %s: %s (%s)'.format(uuid, code, msg));
}); });
}); });
} }
@ -133,7 +132,7 @@ function checkForUpdates() {
let params = { let params = {
shell_version: Config.PACKAGE_VERSION, shell_version: Config.PACKAGE_VERSION,
installed: JSON.stringify(metadatas), installed: JSON.stringify(metadatas),
disable_version_validation: `${versionCheck}`, disable_version_validation: versionCheck.toString(),
}; };
let url = REPOSITORY_URL_UPDATE; let url = REPOSITORY_URL_UPDATE;
@ -195,8 +194,8 @@ class InstallExtensionDialog extends ModalDialog.ModalDialog {
let dir = Gio.File.new_for_path(GLib.build_filenamev([global.userdatadir, 'extensions', uuid])); let dir = Gio.File.new_for_path(GLib.build_filenamev([global.userdatadir, 'extensions', uuid]));
let invocation = this._invocation; let invocation = this._invocation;
function errback(code, msg) { function errback(code, msg) {
log(`Error while installing ${uuid}: ${code} (${msg})`); log('Error while installing %s: %s (%s)'.format(uuid, code, msg));
invocation.return_dbus_error(`org.gnome.Shell.${code}`, msg || ''); invocation.return_dbus_error('org.gnome.Shell.%s'.format(code), msg || '');
} }
function callback() { function callback() {
@ -204,7 +203,7 @@ class InstallExtensionDialog extends ModalDialog.ModalDialog {
let extension = Main.extensionManager.createExtensionObject(uuid, dir, ExtensionUtils.ExtensionType.PER_USER); let extension = Main.extensionManager.createExtensionObject(uuid, dir, ExtensionUtils.ExtensionType.PER_USER);
Main.extensionManager.loadExtension(extension); Main.extensionManager.loadExtension(extension);
if (!Main.extensionManager.enableExtension(uuid)) if (!Main.extensionManager.enableExtension(uuid))
throw new Error(`Cannot add ${uuid} to enabled extensions gsettings key`); throw new Error('Cannot add %s to enabled extensions gsettings key'.format(uuid));
} catch (e) { } catch (e) {
uninstallExtension(uuid); uninstallExtension(uuid);
errback('LoadExtensionError', e); errback('LoadExtensionError', e);

View File

@ -42,7 +42,7 @@ var ExtensionManager = class {
try { try {
disableFile.create(Gio.FileCreateFlags.REPLACE_DESTINATION, null); disableFile.create(Gio.FileCreateFlags.REPLACE_DESTINATION, null);
} catch (e) { } catch (e) {
log(`Failed to create file ${disableFilename}: ${e.message}`); log('Failed to create file %s: %s'.format(disableFilename, e.message));
} }
GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 60, () => { GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 60, () => {
@ -140,7 +140,7 @@ var ExtensionManager = class {
if (extension.state != ExtensionState.DISABLED) if (extension.state != ExtensionState.DISABLED)
return; return;
let stylesheetNames = [`${global.session_mode}.css`, 'stylesheet.css']; let stylesheetNames = ['%s.css'.format(global.session_mode), 'stylesheet.css'];
let theme = St.ThemeContext.get_for_stage(global.stage).get_theme(); let theme = St.ThemeContext.get_for_stage(global.stage).get_theme();
for (let i = 0; i < stylesheetNames.length; i++) { for (let i = 0; i < stylesheetNames.length; i++) {
try { try {
@ -236,7 +236,7 @@ var ExtensionManager = class {
if (!extension) if (!extension)
return; return;
let message = `${error}`; let message = error.toString();
extension.error = message; extension.error = message;
extension.state = ExtensionState.ERROR; extension.state = ExtensionState.ERROR;
@ -244,7 +244,7 @@ var ExtensionManager = class {
extension.errors = []; extension.errors = [];
extension.errors.push(message); extension.errors.push(message);
logError(error, `Extension ${uuid}`); logError(error, 'Extension %s'.format(uuid));
this.emit('extension-state-changed', extension); this.emit('extension-state-changed', extension);
} }
@ -259,24 +259,24 @@ var ExtensionManager = class {
if (metadataContents instanceof Uint8Array) if (metadataContents instanceof Uint8Array)
metadataContents = imports.byteArray.toString(metadataContents); metadataContents = imports.byteArray.toString(metadataContents);
} catch (e) { } catch (e) {
throw new Error(`Failed to load metadata.json: ${e}`); throw new Error('Failed to load metadata.json: %s'.format(e.toString()));
} }
let meta; let meta;
try { try {
meta = JSON.parse(metadataContents); meta = JSON.parse(metadataContents);
} catch (e) { } catch (e) {
throw new Error(`Failed to parse metadata.json: ${e}`); throw new Error('Failed to parse metadata.json: %s'.format(e.toString()));
} }
let requiredProperties = ['uuid', 'name', 'description', 'shell-version']; let requiredProperties = ['uuid', 'name', 'description', 'shell-version'];
for (let i = 0; i < requiredProperties.length; i++) { for (let i = 0; i < requiredProperties.length; i++) {
let prop = requiredProperties[i]; let prop = requiredProperties[i];
if (!meta[prop]) if (!meta[prop])
throw new Error(`missing "${prop}" property in metadata.json`); throw new Error('missing "%s" property in metadata.json'.format(prop));
} }
if (uuid != meta.uuid) if (uuid != meta.uuid)
throw new Error(`uuid "${meta.uuid}" from metadata.json does not match directory name "${uuid}"`); throw new Error('uuid "%s" from metadata.json does not match directory name "%s"'.format(meta.uuid, uuid));
let extension = { let extension = {
metadata: meta, metadata: meta,
@ -496,17 +496,17 @@ var ExtensionManager = class {
} }
_loadExtensions() { _loadExtensions() {
global.settings.connect(`changed::${ENABLED_EXTENSIONS_KEY}`, global.settings.connect('changed::%s'.format(ENABLED_EXTENSIONS_KEY),
this._onEnabledExtensionsChanged.bind(this)); this._onEnabledExtensionsChanged.bind(this));
global.settings.connect(`changed::${DISABLED_EXTENSIONS_KEY}`, global.settings.connect('changed::%s'.format(DISABLED_EXTENSIONS_KEY),
this._onEnabledExtensionsChanged.bind(this)); this._onEnabledExtensionsChanged.bind(this));
global.settings.connect(`changed::${DISABLE_USER_EXTENSIONS_KEY}`, global.settings.connect('changed::%s'.format(DISABLE_USER_EXTENSIONS_KEY),
this._onUserExtensionsEnabledChanged.bind(this)); this._onUserExtensionsEnabledChanged.bind(this));
global.settings.connect(`changed::${EXTENSION_DISABLE_VERSION_CHECK_KEY}`, global.settings.connect('changed::%s'.format(EXTENSION_DISABLE_VERSION_CHECK_KEY),
this._onVersionValidationChanged.bind(this)); this._onVersionValidationChanged.bind(this));
global.settings.connect(`writable-changed::${ENABLED_EXTENSIONS_KEY}`, global.settings.connect('writable-changed::%s'.format(ENABLED_EXTENSIONS_KEY),
this._onSettingsWritableChanged.bind(this)); this._onSettingsWritableChanged.bind(this));
global.settings.connect(`writable-changed::${DISABLED_EXTENSIONS_KEY}`, global.settings.connect('writable-changed::%s'.format(DISABLED_EXTENSIONS_KEY),
this._onSettingsWritableChanged.bind(this)); this._onSettingsWritableChanged.bind(this));
this._enabledExtensions = this._getEnabledExtensions(); this._enabledExtensions = this._getEnabledExtensions();
@ -519,7 +519,7 @@ var ExtensionManager = class {
let uuid = info.get_name(); let uuid = info.get_name();
let existing = this.lookup(uuid); let existing = this.lookup(uuid);
if (existing) { if (existing) {
log(`Extension ${uuid} already installed in ${existing.path}. ${dir.get_path()} will not be loaded`); log('Extension %s already installed in %s. %s will not be loaded'.format(uuid, existing.path, dir.get_path()));
return; return;
} }
@ -530,7 +530,7 @@ var ExtensionManager = class {
try { try {
extension = this.createExtensionObject(uuid, dir, type); extension = this.createExtensionObject(uuid, dir, type);
} catch (e) { } catch (e) {
logError(e, `Could not load extension ${uuid}`); logError(e, 'Could not load extension %s'.format(uuid));
return; return;
} }
this.loadExtension(extension); this.loadExtension(extension);

View File

@ -244,7 +244,7 @@ function objectToString(o) {
// special case this since the default is way, way too verbose // special case this since the default is way, way too verbose
return '<js function>'; return '<js function>';
} else { } else {
return `${o}`; return o.toString();
} }
} }
@ -291,7 +291,7 @@ class Result extends St.BoxLayout {
this.add(cmdTxt); this.add(cmdTxt);
let box = new St.BoxLayout({}); let box = new St.BoxLayout({});
this.add(box); this.add(box);
let resultTxt = new St.Label({ text: `r(${index}) = ` }); let resultTxt = new St.Label({ text: 'r(%d) = '.format(index) });
resultTxt.clutter_text.ellipsize = Pango.EllipsizeMode.END; resultTxt.clutter_text.ellipsize = Pango.EllipsizeMode.END;
box.add(resultTxt); box.add(resultTxt);
let objLink = new ObjLink(this._lookingGlass, o); let objLink = new ObjLink(this._lookingGlass, o);
@ -331,7 +331,7 @@ var WindowList = GObject.registerClass({
box.add_child(windowLink); box.add_child(windowLink);
let propsBox = new St.BoxLayout({ vertical: true, style: 'padding-left: 6px;' }); let propsBox = new St.BoxLayout({ vertical: true, style: 'padding-left: 6px;' });
box.add(propsBox); box.add(propsBox);
propsBox.add(new St.Label({ text: `wmclass: ${metaWindow.get_wm_class()}` })); propsBox.add(new St.Label({ text: 'wmclass: %s'.format(metaWindow.get_wm_class()) }));
let app = tracker.get_window_app(metaWindow); let app = tracker.get_window_app(metaWindow);
if (app != null && !app.is_window_backed()) { if (app != null && !app.is_window_backed()) {
let icon = app.create_icon_texture(22); let icon = app.create_icon_texture(22);
@ -424,7 +424,7 @@ class ObjInspector extends St.ScrollView {
link = new St.Label({ text: '<error>' }); link = new St.Label({ text: '<error>' });
} }
let box = new St.BoxLayout(); let box = new St.BoxLayout();
box.add(new St.Label({ text: `${propName}: ` })); box.add(new St.Label({ text: '%s: '.format(propName) }));
box.add(link); box.add(link);
this._container.add_actor(box); this._container.add_actor(box);
} }
@ -641,9 +641,9 @@ var Inspector = GObject.registerClass({
this._target = target; this._target = target;
this._pointerTarget = target; this._pointerTarget = target;
let position = `[inspect x: ${stageX} y: ${stageY}]`; let position = '[inspect x: %d y: %d]'.format(stageX, stageY);
this._displayText.text = ''; this._displayText.text = '';
this._displayText.text = `${position} ${this._target}`; this._displayText.text = '%s %s'.format(position, this._target);
this._lookingGlass.setBorderPaintTarget(this._target); this._lookingGlass.setBorderPaintTarget(this._target);
} }
@ -846,7 +846,7 @@ class LookingGlass extends St.BoxLayout {
inspectIcon.connect('button-press-event', () => { inspectIcon.connect('button-press-event', () => {
let inspector = new Inspector(this); let inspector = new Inspector(this);
inspector.connect('target', (i, target, stageX, stageY) => { inspector.connect('target', (i, target, stageX, stageY) => {
this._pushResult(`inspect(${Math.round(stageX)}, ${Math.round(stageY)})`, target); this._pushResult('inspect(%d, %d)'.format(Math.round(stageX), Math.round(stageY)), target);
}); });
inspector.connect('closed', () => { inspector.connect('closed', () => {
this.show(); this.show();
@ -952,9 +952,8 @@ class LookingGlass extends St.BoxLayout {
// monospace font to be bold/oblique/etc. Could easily be added here. // monospace font to be bold/oblique/etc. Could easily be added here.
let size = fontDesc.get_size() / 1024.; let size = fontDesc.get_size() / 1024.;
let unit = fontDesc.get_size_is_absolute() ? 'px' : 'pt'; let unit = fontDesc.get_size_is_absolute() ? 'px' : 'pt';
this.style = ` this.style = 'font-size: %d%s; font-family: "%s";'.format(
font-size: ${size}${unit}; size, unit, fontDesc.get_family());
font-family: "${fontDesc.get_family()}";`;
} }
setBorderPaintTarget(obj) { setBorderPaintTarget(obj) {
@ -1035,7 +1034,7 @@ class LookingGlass extends St.BoxLayout {
this._history.addItem(command); this._history.addItem(command);
let lines = command.split(';'); let lines = command.split(';');
lines.push(`return ${lines.pop()}`); lines.push('return %s'.format(lines.pop()));
let fullCmd = commandHeader + lines.join(';'); let fullCmd = commandHeader + lines.join(';');
@ -1043,7 +1042,7 @@ class LookingGlass extends St.BoxLayout {
try { try {
resultObj = Function(fullCmd)(); resultObj = Function(fullCmd)();
} catch (e) { } catch (e) {
resultObj = `<exception ${e}>`; resultObj = '<exception %s>'.format(e.toString());
} }
this._pushResult(command, resultObj); this._pushResult(command, resultObj);
@ -1062,7 +1061,7 @@ class LookingGlass extends St.BoxLayout {
try { try {
return this._resultsArea.get_child_at_index(idx - this._offset).o; return this._resultsArea.get_child_at_index(idx - this._offset).o;
} catch (e) { } catch (e) {
throw new Error(`Unknown result at index ${idx}`); throw new Error('Unknown result at index %d'.format(idx));
} }
} }

View File

@ -257,7 +257,7 @@ function _initializeUI() {
if (sessionMode.currentMode != 'gdm' && if (sessionMode.currentMode != 'gdm' &&
sessionMode.currentMode != 'initial-setup') { sessionMode.currentMode != 'initial-setup') {
GLib.log_structured(LOG_DOMAIN, GLib.LogLevelFlags.LEVEL_MESSAGE, { GLib.log_structured(LOG_DOMAIN, GLib.LogLevelFlags.LEVEL_MESSAGE, {
'MESSAGE': `GNOME Shell started at ${_startDate}`, 'MESSAGE': 'GNOME Shell started at %s'.format(_startDate),
'MESSAGE_ID': GNOMESHELL_STARTED_MESSAGE_ID, 'MESSAGE_ID': GNOMESHELL_STARTED_MESSAGE_ID,
}); });
} }
@ -280,7 +280,7 @@ function _initializeUI() {
let perfModuleName = GLib.getenv("SHELL_PERF_MODULE"); let perfModuleName = GLib.getenv("SHELL_PERF_MODULE");
if (perfModuleName) { if (perfModuleName) {
let perfOutput = GLib.getenv("SHELL_PERF_OUTPUT"); let perfOutput = GLib.getenv("SHELL_PERF_OUTPUT");
let module = eval(`imports.perf.${perfModuleName};`); let module = eval('imports.perf.%s;'.format(perfModuleName));
Scripting.runPerfScript(module, perfOutput); Scripting.runPerfScript(module, perfOutput);
} }
}); });
@ -289,7 +289,7 @@ function _initializeUI() {
function _getStylesheet(name) { function _getStylesheet(name) {
let stylesheet; let stylesheet;
stylesheet = Gio.File.new_for_uri(`resource:///org/gnome/shell/theme/${name}`); stylesheet = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/%s'.format(name));
if (stylesheet.query_exists(null)) if (stylesheet.query_exists(null))
return stylesheet; return stylesheet;
@ -301,7 +301,7 @@ function _getStylesheet(name) {
return stylesheet; return stylesheet;
} }
stylesheet = Gio.File.new_for_path(`${global.datadir}/theme/${name}`); stylesheet = Gio.File.new_for_path('%s/theme/%s'.format(global.datadir, name));
if (stylesheet.query_exists(null)) if (stylesheet.query_exists(null))
return stylesheet; return stylesheet;
@ -359,12 +359,12 @@ function reloadThemeResource() {
if (_themeResource) if (_themeResource)
_themeResource._unregister(); _themeResource._unregister();
_themeResource = Gio.Resource.load(`${global.datadir}/gnome-shell-theme.gresource`); _themeResource = Gio.Resource.load('%s/gnome-shell-theme.gresource'.format(global.datadir));
_themeResource._register(); _themeResource._register();
} }
function _loadOskLayouts() { function _loadOskLayouts() {
_oskResource = Gio.Resource.load(`${global.datadir}/gnome-shell-osk-layouts.gresource`); _oskResource = Gio.Resource.load('%s/gnome-shell-osk-layouts.gresource'.format(global.datadir));
_oskResource._register(); _oskResource._register();
} }
@ -418,9 +418,9 @@ function notify(msg, details) {
function notifyError(msg, details) { function notifyError(msg, details) {
// Also print to stderr so it's logged somewhere // Also print to stderr so it's logged somewhere
if (details) if (details)
log(`error: ${msg}: ${details}`); log('error: %s: %s'.format(msg, details));
else else
log(`error: ${msg}`); log('error: %s'.format(msg));
notify(msg, details); notify(msg, details);
} }
@ -687,7 +687,7 @@ function _queueBeforeRedraw(workId) {
*/ */
function initializeDeferredWork(actor, callback) { function initializeDeferredWork(actor, callback) {
// Turn into a string so we can use as an object property // Turn into a string so we can use as an object property
let workId = `${++_deferredWorkSequence}`; let workId = (++_deferredWorkSequence).toString();
_deferredWorkData[workId] = { actor, _deferredWorkData[workId] = { actor,
callback }; callback };
actor.connect('notify::mapped', () => { actor.connect('notify::mapped', () => {

View File

@ -79,7 +79,7 @@ class URLHighlighter extends St.Label {
if (urlId != -1) { if (urlId != -1) {
let url = this._urls[urlId].url; let url = this._urls[urlId].url;
if (!url.includes(':')) if (!url.includes(':'))
url = `http://${url}`; url = 'http://%s'.format(url);
Gio.app_info_launch_default_for_uri( Gio.app_info_launch_default_for_uri(
url, global.create_app_launch_context(0, -1)); url, global.create_app_launch_context(0, -1));
@ -132,7 +132,7 @@ class URLHighlighter extends St.Label {
for (let i = 0; i < urls.length; i++) { for (let i = 0; i < urls.length; i++) {
let url = urls[i]; let url = urls[i];
let str = this._text.substr(pos, url.pos - pos); let str = this._text.substr(pos, url.pos - pos);
markup += `${str}<span foreground="${this._linkColor}"><u>${url.url}</u></span>`; markup += '%s<span foreground="%s"><u>%s</u></span>'.format(str, this._linkColor, url.url);
pos = url.pos + url.url.length; pos = url.pos + url.url.length;
} }
markup += this._text.substr(pos); markup += this._text.substr(pos);

View File

@ -229,15 +229,17 @@ var NotificationApplicationPolicy = GObject.registerClass({
this._canonicalId = this._canonicalizeId(id); this._canonicalId = this._canonicalizeId(id);
this._masterSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.notifications' }); this._masterSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.notifications' });
this._settings = new Gio.Settings({ schema_id: 'org.gnome.desktop.notifications.application', this._settings = new Gio.Settings({
path: `/org/gnome/desktop/notifications/application/${this._canonicalId}/` }); schema_id: 'org.gnome.desktop.notifications.application',
path: '/org/gnome/desktop/notifications/application/%s/'.format(this._canonicalId),
});
this._masterSettings.connect('changed', this._changed.bind(this)); this._masterSettings.connect('changed', this._changed.bind(this));
this._settings.connect('changed', this._changed.bind(this)); this._settings.connect('changed', this._changed.bind(this));
} }
store() { store() {
this._settings.set_string('application-id', `${this.id}.desktop`); this._settings.set_string('application-id', '%s.desktop'.format(this.id));
let apps = this._masterSettings.get_strv('application-children'); let apps = this._masterSettings.get_strv('application-children');
if (!apps.includes(this._canonicalId)) { if (!apps.includes(this._canonicalId)) {
@ -1077,7 +1079,7 @@ var MessageTray = GObject.registerClass({
add(source) { add(source) {
if (this.contains(source)) { if (this.contains(source)) {
log(`Trying to re-add source ${source.title}`); log('Trying to re-add source %s'.format(source.title));
return; return;
} }

View File

@ -147,7 +147,7 @@ var MprisPlayer = class MprisPlayer {
// so prefer activating the app via .desktop file if possible // so prefer activating the app via .desktop file if possible
let app = null; let app = null;
if (this._mprisProxy.DesktopEntry) { if (this._mprisProxy.DesktopEntry) {
let desktopId = `${this._mprisProxy.DesktopEntry}.desktop`; let desktopId = '%s.desktop'.format(this._mprisProxy.DesktopEntry);
app = Shell.AppSystem.get_default().lookup_app(desktopId); app = Shell.AppSystem.get_default().lookup_app(desktopId);
} }
@ -192,9 +192,9 @@ var MprisPlayer = class MprisPlayer {
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 %s; ' +
this._busName}; expected an array of strings, got ${ 'expected an array of strings, got %s (%s)').format(
this._trackArtists} (${typeof this._trackArtists})`); this._busName, this._trackArtists, typeof this._trackArtists));
} }
this._trackArtists = [_("Unknown artist")]; this._trackArtists = [_("Unknown artist")];
} }
@ -202,9 +202,9 @@ var MprisPlayer = class MprisPlayer {
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 %s; ' +
this._busName}; expected a string, got ${ 'expected a string, got %s (%s)').format(
this._trackTitle} (${typeof this._trackTitle})`); this._busName, this._trackTitle, typeof this._trackTitle));
} }
this._trackTitle = _("Unknown title"); this._trackTitle = _("Unknown title");
} }
@ -212,9 +212,9 @@ var MprisPlayer = class MprisPlayer {
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 %s; ' +
this._busName}; expected a string, got ${ 'expected a string, got %s (%s)').format(
this._trackCoverUrl} (${typeof this._trackCoverUrl})`); this._busName, this._trackCoverUrl, typeof this._trackCoverUrl));
} }
this._trackCoverUrl = ''; this._trackCoverUrl = '';
} }

View File

@ -477,7 +477,7 @@ class FdoNotificationDaemonSource extends MessageTray.Source {
return app; return app;
if (appId) { if (appId) {
app = Shell.AppSystem.get_default().lookup_app(`${appId}.desktop`); app = Shell.AppSystem.get_default().lookup_app('%s.desktop'.format(appId));
if (app != null) if (app != null)
return app; return app;
} }
@ -614,7 +614,7 @@ function objectPathFromAppId(appId) {
} }
function getPlatformData() { function getPlatformData() {
let startupId = GLib.Variant.new('s', `_TIME${global.get_current_time()}`); let startupId = GLib.Variant.new('s', '_TIME%s'.format(global.get_current_time()));
return { "desktop-startup-id": startupId }; return { "desktop-startup-id": startupId };
} }
@ -627,7 +627,7 @@ class GtkNotificationDaemonAppSource extends MessageTray.Source {
if (!GLib.Variant.is_object_path(objectPath)) if (!GLib.Variant.is_object_path(objectPath))
throw new InvalidAppError(); throw new InvalidAppError();
let app = Shell.AppSystem.get_default().lookup_app(`${appId}.desktop`); let app = Shell.AppSystem.get_default().lookup_app('%s.desktop'.format(appId));
if (!app) if (!app)
throw new InvalidAppError(); throw new InvalidAppError();

View File

@ -127,7 +127,7 @@ class SlidingControl extends St.Widget {
} }
_getSlide() { _getSlide() {
throw new GObject.NotImplementedError(`_getSlide in ${this.constructor.name}`); throw new GObject.NotImplementedError('_getSlide in %s'.format(this.constructor.name));
} }
_updateSlide() { _updateSlide() {

View File

@ -347,9 +347,7 @@ var PadDiagram = GObject.registerClass({
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" ' + '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" ' +
'xmlns:xi="http://www.w3.org/2001/XInclude" ' + 'xmlns:xi="http://www.w3.org/2001/XInclude" ' +
`width="${ // " (give xgettext the paired quotes it expects) 'width="%d" height="%d">'.format(this._imageWidth, this._imageHeight) +
this._imageWidth
}" height="${this._imageHeight}"> ` + // "
'<style type="text/css">'; '<style type="text/css">';
} }
@ -364,10 +362,10 @@ var PadDiagram = GObject.registerClass({
for (let i = 0; i < this._activeButtons.length; i++) { for (let i = 0; i < this._activeButtons.length; i++) {
let ch = String.fromCharCode('A'.charCodeAt() + this._activeButtons[i]); let ch = String.fromCharCode('A'.charCodeAt() + this._activeButtons[i]);
css += `.${ch} { css += '.%s {'.format(ch);
stroke: ${ACTIVE_COLOR} !important; css += ' stroke: %s !important;'.format(ACTIVE_COLOR);
fill: ${ACTIVE_COLOR} !important; css += ' fill: %s !important;'.format(ACTIVE_COLOR);
}`; css += '}';
} }
return css; return css;
@ -477,12 +475,12 @@ var PadDiagram = GObject.registerClass({
let leaderPos, leaderSize, pos; let leaderPos, leaderSize, pos;
let found, direction; let found, direction;
[found, pos] = this._handle.get_position_sub(`#${labelName}`); [found, pos] = this._handle.get_position_sub('#%s'.format(labelName));
if (!found) if (!found)
return [false]; return [false];
[found, leaderPos] = this._handle.get_position_sub(`#${leaderName}`); [found, leaderPos] = this._handle.get_position_sub('#%s'.format(leaderName));
[found, leaderSize] = this._handle.get_dimensions_sub(`#${leaderName}`); [found, leaderSize] = this._handle.get_dimensions_sub('#%s'.format(leaderName));
if (!found) if (!found)
return [false]; return [false];
@ -504,8 +502,8 @@ var PadDiagram = GObject.registerClass({
getButtonLabelCoords(button) { getButtonLabelCoords(button) {
let ch = String.fromCharCode('A'.charCodeAt() + button); let ch = String.fromCharCode('A'.charCodeAt() + button);
let labelName = `Label${ch}`; let labelName = 'Label%s'.format(ch);
let leaderName = `Leader${ch}`; let leaderName = 'Leader%s'.format(ch);
return this._getItemLabelCoords(labelName, leaderName); return this._getItemLabelCoords(labelName, leaderName);
} }
@ -513,8 +511,8 @@ var PadDiagram = GObject.registerClass({
getRingLabelCoords(number, dir) { getRingLabelCoords(number, dir) {
let numStr = number > 0 ? (number + 1).toString() : ''; let numStr = number > 0 ? (number + 1).toString() : '';
let dirStr = dir == CW ? 'CW' : 'CCW'; let dirStr = dir == CW ? 'CW' : 'CCW';
let labelName = `LabelRing${numStr}${dirStr}`; let labelName = 'LabelRing%s%s'.format(numStr, dirStr);
let leaderName = `LeaderRing${numStr}${dirStr}`; let leaderName = 'LeaderRing%s%s'.format(numStr, dirStr);
return this._getItemLabelCoords(labelName, leaderName); return this._getItemLabelCoords(labelName, leaderName);
} }
@ -522,8 +520,8 @@ var PadDiagram = GObject.registerClass({
getStripLabelCoords(number, dir) { getStripLabelCoords(number, dir) {
let numStr = number > 0 ? (number + 1).toString() : ''; let numStr = number > 0 ? (number + 1).toString() : '';
let dirStr = dir == UP ? 'Up' : 'Down'; let dirStr = dir == UP ? 'Up' : 'Down';
let labelName = `LabelStrip${numStr}${dirStr}`; let labelName = 'LabelStrip%s%s'.format(numStr, dirStr);
let leaderName = `LeaderStrip${numStr}${dirStr}`; let leaderName = 'LeaderStrip%s%s'.format(numStr, dirStr);
return this._getItemLabelCoords(labelName, leaderName); return this._getItemLabelCoords(labelName, leaderName);
} }
@ -870,7 +868,7 @@ var PadOsd = GObject.registerClass({
} }
this._titleLabel.clutter_text.set_markup( this._titleLabel.clutter_text.set_markup(
`<span size="larger"><b>${title}</b></span>`); '<span size="larger"><b>%s</b></span>'.format(title));
} }
_isEditedAction(type, number, dir) { _isEditedAction(type, number, dir) {
@ -932,7 +930,7 @@ var PadOsd = GObject.registerClass({
_startButtonActionEdition(button) { _startButtonActionEdition(button) {
let ch = String.fromCharCode('A'.charCodeAt() + button); let ch = String.fromCharCode('A'.charCodeAt() + button);
let key = `button${ch}`; let key = 'button%s'.format(ch);
this._startActionEdition(key, Meta.PadActionType.BUTTON, button); this._startActionEdition(key, Meta.PadActionType.BUTTON, button);
} }

View File

@ -1099,7 +1099,7 @@ class Panel extends St.Widget {
addToStatusArea(role, indicator, position, box) { addToStatusArea(role, indicator, position, box) {
if (this.statusArea[role]) if (this.statusArea[role])
throw new Error(`Extension point conflict: there is already a status indicator for role ${role}`); throw new Error('Extension point conflict: there is already a status indicator for role %s'.format(role));
if (!(indicator instanceof PanelMenu.Button)) if (!(indicator instanceof PanelMenu.Button))
throw new TypeError('Status indicator must be an instance of PanelMenu.Button'); throw new TypeError('Status indicator must be an instance of PanelMenu.Button');

View File

@ -462,7 +462,7 @@ class PopupImageMenuItem extends PopupBaseMenuItem {
var PopupMenuBase = class { var PopupMenuBase = class {
constructor(sourceActor, styleClass) { constructor(sourceActor, styleClass) {
if (this.constructor === PopupMenuBase) if (this.constructor === PopupMenuBase)
throw new TypeError(`Cannot instantiate abstract class ${this.constructor.name}`); throw new TypeError('Cannot instantiate abstract class %s'.format(this.constructor.name));
this.sourceActor = sourceActor; this.sourceActor = sourceActor;
this.focusActor = sourceActor; this.focusActor = sourceActor;
@ -546,7 +546,7 @@ var PopupMenuBase = class {
let app = Shell.AppSystem.get_default().lookup_app(desktopFile); let app = Shell.AppSystem.get_default().lookup_app(desktopFile);
if (!app) { if (!app) {
log(`Settings panel for desktop file ${desktopFile} could not be loaded!`); log('Settings panel for desktop file %s could not be loaded!'.format(desktopFile));
return; return;
} }

View File

@ -194,7 +194,7 @@ class RunDialog extends ModalDialog.ModalDialog {
if (inTerminal) { if (inTerminal) {
let exec = this._terminalSettings.get_string(EXEC_KEY); let exec = this._terminalSettings.get_string(EXEC_KEY);
let execArg = this._terminalSettings.get_string(EXEC_ARG_KEY); let execArg = this._terminalSettings.get_string(EXEC_ARG_KEY);
command = `${exec} ${execArg} ${input}`; command = '%s %s %s'.format(exec, execArg, input);
} }
Util.trySpawnCommandLine(command); Util.trySpawnCommandLine(command);
} catch (e) { } catch (e) {
@ -205,7 +205,7 @@ class RunDialog extends ModalDialog.ModalDialog {
} else { } else {
if (input.charAt(0) == '~') if (input.charAt(0) == '~')
input = input.slice(1); input = input.slice(1);
path = `${GLib.get_home_dir()}/${input}`; path = '%s/%s'.format(GLib.get_home_dir(), input);
} }
if (GLib.file_test(path, GLib.FileTest.EXISTS)) { if (GLib.file_test(path, GLib.FileTest.EXISTS)) {

View File

@ -112,10 +112,10 @@ var ScreenShield = class {
}); });
this._settings = new Gio.Settings({ schema_id: SCREENSAVER_SCHEMA }); this._settings = new Gio.Settings({ schema_id: SCREENSAVER_SCHEMA });
this._settings.connect(`changed::${LOCK_ENABLED_KEY}`, this._syncInhibitor.bind(this)); this._settings.connect('changed::%s'.format(LOCK_ENABLED_KEY), this._syncInhibitor.bind(this));
this._lockSettings = new Gio.Settings({ schema_id: LOCKDOWN_SCHEMA }); this._lockSettings = new Gio.Settings({ schema_id: LOCKDOWN_SCHEMA });
this._lockSettings.connect(`changed::${DISABLE_LOCK_KEY}`, this._syncInhibitor.bind(this)); this._lockSettings.connect('changed::%s'.format(DISABLE_LOCK_KEY), this._syncInhibitor.bind(this));
this._isModal = false; this._isModal = false;
this._isGreeter = false; this._isGreeter = false;

View File

@ -231,18 +231,18 @@ var SearchResultsBase = GObject.registerClass({
this.provider.getResultMetas(metasNeeded, metas => { this.provider.getResultMetas(metasNeeded, metas => {
if (this._cancellable.is_cancelled()) { if (this._cancellable.is_cancelled()) {
if (metas.length > 0) if (metas.length > 0)
log(`Search provider ${this.provider.id} returned results after the request was canceled`); log('Search provider %s returned results after the request was canceled'.format(this.provider.id));
callback(false); callback(false);
return; return;
} }
if (metas.length != metasNeeded.length) { if (metas.length != metasNeeded.length) {
log(`Wrong number of result metas returned by search provider ${this.provider.id}: ` + log('Wrong number of result metas returned by search provider %s: '.format(this.provider.id) +
`expected ${metasNeeded.length} but got ${metas.length}`); 'expected %d but got %d'.format(metasNeeded.length, metas.length));
callback(false); callback(false);
return; return;
} }
if (metas.some(meta => !meta.name || !meta.id)) { if (metas.some(meta => !meta.name || !meta.id)) {
log(`Invalid result meta returned from search provider ${this.provider.id}`); log('Invalid result meta returned from search provider %s'.format(this.provider.id));
callback(false); callback(false);
return; return;
} }
@ -609,7 +609,7 @@ var SearchResultsView = GObject.registerClass({
this._searchTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 150, this._onSearchTimeout.bind(this)); this._searchTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 150, this._onSearchTimeout.bind(this));
let escapedTerms = this._terms.map(term => Shell.util_regex_escape(term)); let escapedTerms = this._terms.map(term => Shell.util_regex_escape(term));
this._highlightRegex = new RegExp(`(${escapedTerms.join('|')})`, 'gi'); this._highlightRegex = new RegExp('(%s)'.format(escapedTerms.join('|')), 'gi');
this.emit('terms-changed'); this.emit('terms-changed');
} }

View File

@ -570,7 +570,7 @@ var GnomeShellMountOpHandler = class {
_setCurrentRequest(invocation, id, type) { _setCurrentRequest(invocation, id, type) {
let oldId = this._currentId; let oldId = this._currentId;
let oldType = this._currentType; let oldType = this._currentType;
let requestId = `${id}@${invocation.get_sender()}`; let requestId = '%s@%s'.format(id, invocation.get_sender());
this._clearCurrentRequest(Gio.MountOperationResult.UNHANDLED, {}); this._clearCurrentRequest(Gio.MountOperationResult.UNHANDLED, {});

View File

@ -42,7 +42,7 @@ class ATIndicator extends PanelMenu.Button {
this.add_child(this._hbox); this.add_child(this._hbox);
this._a11ySettings = new Gio.Settings({ schema_id: A11Y_SCHEMA }); this._a11ySettings = new Gio.Settings({ schema_id: A11Y_SCHEMA });
this._a11ySettings.connect(`changed::${KEY_ALWAYS_SHOW}`, this._queueSyncMenuVisibility.bind(this)); this._a11ySettings.connect('changed::%s'.format(KEY_ALWAYS_SHOW), this._queueSyncMenuVisibility.bind(this));
let highContrast = this._buildHCItem(); let highContrast = this._buildHCItem();
this.menu.addMenuItem(highContrast); this.menu.addMenuItem(highContrast);
@ -118,7 +118,7 @@ class ATIndicator extends PanelMenu.Button {
settings.is_writable(key), settings.is_writable(key),
enabled => settings.set_boolean(key, enabled)); enabled => settings.set_boolean(key, enabled));
settings.connect(`changed::${key}`, () => { settings.connect('changed::%s'.format(key), () => {
widget.setToggleState(settings.get_boolean(key)); widget.setToggleState(settings.get_boolean(key));
this._queueSyncMenuVisibility(); this._queueSyncMenuVisibility();
@ -150,7 +150,7 @@ class ATIndicator extends PanelMenu.Button {
} }
}); });
interfaceSettings.connect(`changed::${KEY_GTK_THEME}`, () => { interfaceSettings.connect('changed::%s'.format(KEY_GTK_THEME), () => {
let value = interfaceSettings.get_string(KEY_GTK_THEME); let value = interfaceSettings.get_string(KEY_GTK_THEME);
if (value == HIGH_CONTRAST_THEME) { if (value == HIGH_CONTRAST_THEME) {
highContrast.setToggleState(true); highContrast.setToggleState(true);
@ -162,7 +162,7 @@ class ATIndicator extends PanelMenu.Button {
this._queueSyncMenuVisibility(); this._queueSyncMenuVisibility();
}); });
interfaceSettings.connect(`changed::${KEY_ICON_THEME}`, () => { interfaceSettings.connect('changed::%s'.format(KEY_ICON_THEME), () => {
let value = interfaceSettings.get_string(KEY_ICON_THEME); let value = interfaceSettings.get_string(KEY_ICON_THEME);
if (value != HIGH_CONTRAST_THEME) if (value != HIGH_CONTRAST_THEME)
iconTheme = value; iconTheme = value;
@ -187,7 +187,7 @@ class ATIndicator extends PanelMenu.Button {
} }
}); });
settings.connect(`changed::${KEY_TEXT_SCALING_FACTOR}`, () => { settings.connect('changed::%s'.format(KEY_TEXT_SCALING_FACTOR), () => {
factor = settings.get_double(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); widget.setToggleState(active);

View File

@ -45,8 +45,8 @@ class DwellClickIndicator extends PanelMenu.Button {
this.add_child(this._hbox); this.add_child(this._hbox);
this._a11ySettings = new Gio.Settings({ schema_id: MOUSE_A11Y_SCHEMA }); this._a11ySettings = new Gio.Settings({ schema_id: MOUSE_A11Y_SCHEMA });
this._a11ySettings.connect(`changed::${KEY_DWELL_CLICK_ENABLED}`, this._syncMenuVisibility.bind(this)); this._a11ySettings.connect('changed::%s'.format(KEY_DWELL_CLICK_ENABLED), this._syncMenuVisibility.bind(this));
this._a11ySettings.connect(`changed::${KEY_DWELL_MODE}`, this._syncMenuVisibility.bind(this)); this._a11ySettings.connect('changed::%s'.format(KEY_DWELL_MODE), this._syncMenuVisibility.bind(this));
this._seat = Clutter.get_default_backend().get_default_seat(); this._seat = Clutter.get_default_backend().get_default_seat();
this._seat.connect('ptr-a11y-dwell-click-type-changed', this._updateClickType.bind(this)); this._seat.connect('ptr-a11y-dwell-click-type-changed', this._updateClickType.bind(this));

View File

@ -64,7 +64,7 @@ var InputSource = class {
return this.id; return this.id;
if (engineDesc.variant && engineDesc.variant.length > 0) if (engineDesc.variant && engineDesc.variant.length > 0)
return `${engineDesc.layout}+${engineDesc.variant}`; return '%s+%s'.format(engineDesc.layout, engineDesc.variant);
else else
return engineDesc.layout; return engineDesc.layout;
} }
@ -138,7 +138,7 @@ class InputSourceSwitcher extends SwitcherPopup.SwitcherList {
var InputSourceSettings = class { var InputSourceSettings = class {
constructor() { constructor() {
if (this.constructor === InputSourceSettings) if (this.constructor === InputSourceSettings)
throw new TypeError(`Cannot instantiate abstract class ${this.constructor.name}`); throw new TypeError('Cannot instantiate abstract class %s'.format(this.constructor.name));
} }
_emitInputSourcesChanged() { _emitInputSourcesChanged() {
@ -211,7 +211,7 @@ var InputSourceSystemSettings = class extends InputSourceSettings {
try { try {
props = conn.call_finish(result).deep_unpack()[0]; props = conn.call_finish(result).deep_unpack()[0];
} catch (e) { } catch (e) {
log(`Could not get properties from ${this._BUS_NAME}`); log('Could not get properties from %s'.format(this._BUS_NAME));
return; return;
} }
let layouts = props['X11Layout'].unpack(); let layouts = props['X11Layout'].unpack();
@ -239,7 +239,7 @@ var InputSourceSystemSettings = class extends InputSourceSettings {
for (let i = 0; i < layouts.length && !!layouts[i]; i++) { for (let i = 0; i < layouts.length && !!layouts[i]; i++) {
let id = layouts[i]; let id = layouts[i];
if (variants[i]) if (variants[i])
id += `+${variants[i]}`; id += '+%s'.format(variants[i]);
sourcesList.push({ type: INPUT_SOURCE_TYPE_XKB, id }); sourcesList.push({ type: INPUT_SOURCE_TYPE_XKB, id });
} }
return sourcesList; return sourcesList;
@ -261,9 +261,9 @@ var InputSourceSessionSettings = class extends InputSourceSettings {
this._KEY_PER_WINDOW = 'per-window'; this._KEY_PER_WINDOW = 'per-window';
this._settings = new Gio.Settings({ schema_id: this._DESKTOP_INPUT_SOURCES_SCHEMA }); this._settings = new Gio.Settings({ schema_id: this._DESKTOP_INPUT_SOURCES_SCHEMA });
this._settings.connect(`changed::${this._KEY_INPUT_SOURCES}`, this._emitInputSourcesChanged.bind(this)); this._settings.connect('changed::%s'.format(this._KEY_INPUT_SOURCES), this._emitInputSourcesChanged.bind(this));
this._settings.connect(`changed::${this._KEY_KEYBOARD_OPTIONS}`, this._emitKeyboardOptionsChanged.bind(this)); this._settings.connect('changed::%s'.format(this._KEY_KEYBOARD_OPTIONS), this._emitKeyboardOptionsChanged.bind(this));
this._settings.connect(`changed::${this._KEY_PER_WINDOW}`, this._emitPerWindowChanged.bind(this)); this._settings.connect('changed::%s'.format(this._KEY_PER_WINDOW), this._emitPerWindowChanged.bind(this));
} }
_getSourcesList(key) { _getSourcesList(key) {
@ -1071,7 +1071,7 @@ class InputSourceIndicator extends PanelMenu.Button {
let description = xkbLayout; let description = xkbLayout;
if (xkbVariant.length > 0) if (xkbVariant.length > 0)
description = `${description}\t${xkbVariant}`; description = '%s\t%s'.format(description, xkbVariant);
Util.spawn(['gkbd-keyboard-display', '-l', description]); Util.spawn(['gkbd-keyboard-display', '-l', description]);
} }

View File

@ -48,9 +48,9 @@ class Indicator extends PanelMenu.SystemIndicator {
super._init(); super._init();
this._settings = new Gio.Settings({ schema_id: LOCATION_SCHEMA }); this._settings = new Gio.Settings({ schema_id: LOCATION_SCHEMA });
this._settings.connect(`changed::${ENABLED}`, this._settings.connect('changed::%s'.format(ENABLED),
this._onMaxAccuracyLevelChanged.bind(this)); this._onMaxAccuracyLevelChanged.bind(this));
this._settings.connect(`changed::${MAX_ACCURACY_LEVEL}`, this._settings.connect('changed::%s'.format(MAX_ACCURACY_LEVEL),
this._onMaxAccuracyLevelChanged.bind(this)); this._onMaxAccuracyLevelChanged.bind(this));
this._indicator = this._addIndicator(); this._indicator = this._addIndicator();
@ -244,7 +244,7 @@ var AppAuthorizer = class {
this._onAuthDone = onAuthDone; this._onAuthDone = onAuthDone;
let appSystem = Shell.AppSystem.get_default(); let appSystem = Shell.AppSystem.get_default();
this._app = appSystem.lookup_app(`${this.desktopId}.desktop`); this._app = appSystem.lookup_app('%s.desktop'.format(this.desktopId));
if (this._app == null || this._permStoreProxy == null) { if (this._app == null || this._permStoreProxy == null) {
this._completeAuth(); this._completeAuth();

View File

@ -174,7 +174,7 @@ Signals.addSignalMethods(NMConnectionItem.prototype);
var NMConnectionSection = class NMConnectionSection { var NMConnectionSection = class NMConnectionSection {
constructor(client) { constructor(client) {
if (this.constructor === NMConnectionSection) if (this.constructor === NMConnectionSection)
throw new TypeError(`Cannot instantiate abstract type ${this.constructor.name}`); throw new TypeError('Cannot instantiate abstract type %s'.format(this.constructor.name));
this._client = client; this._client = client;
@ -306,7 +306,7 @@ var NMConnectionDevice = class NMConnectionDevice extends NMConnectionSection {
super(client); super(client);
if (this.constructor === NMConnectionDevice) if (this.constructor === NMConnectionDevice)
throw new TypeError(`Cannot instantiate abstract type ${this.constructor.name}`); throw new TypeError('Cannot instantiate abstract type %s'.format(this.constructor.name));
this._device = device; this._device = device;
this._description = ''; this._description = '';
@ -579,7 +579,8 @@ var NMDeviceModem = class extends NMConnectionDevice {
} }
_getSignalIcon() { _getSignalIcon() {
return `network-cellular-signal-${signalToIcon(this._mobileDevice.signal_quality)}-symbolic`; return 'network-cellular-signal-%s-symbolic'.format(
signalToIcon(this._mobileDevice.signal_quality));
} }
}; };
@ -682,10 +683,12 @@ var NMWirelessDialogItem = GObject.registerClass({
} }
_getSignalIcon() { _getSignalIcon() {
if (this._ap.mode == NM80211Mode.ADHOC) if (this._ap.mode == NM80211Mode.ADHOC) {
return 'network-workgroup-symbolic'; return 'network-workgroup-symbolic';
else } else {
return `network-wireless-signal-${signalToIcon(this._ap.strength)}-symbolic`; return 'network-wireless-signal-%s-symbolic'.format(
signalToIcon(this._ap.strength));
}
} }
}); });
@ -1369,7 +1372,7 @@ var NMDeviceWireless = class {
} }
if (this._canReachInternet()) if (this._canReachInternet())
return `network-wireless-signal-${signalToIcon(ap.strength)}-symbolic`; return 'network-wireless-signal-%s-symbolic'.format(signalToIcon(ap.strength));
else else
return 'network-wireless-no-route-symbolic'; return 'network-wireless-no-route-symbolic';
} }
@ -1700,7 +1703,7 @@ class Indicator extends PanelMenu.SystemIndicator {
try { try {
this._deviceAdded(this._client, devices[i], true); this._deviceAdded(this._client, devices[i], true);
} catch (e) { } catch (e) {
log(`Failed to add device ${devices[i]}: ${e}`); log('Failed to add device %s: %s'.format(devices[i], e.toString()));
} }
} }
this._syncDeviceNames(); this._syncDeviceNames();
@ -1998,7 +2001,7 @@ class Indicator extends PanelMenu.SystemIndicator {
} catch (e) { } } catch (e) { }
}); });
} else { } else {
log(`Invalid result from portal helper: ${result}`); log('Invalid result from portal helper: %s'.format(result));
} }
} }
@ -2033,7 +2036,7 @@ class Indicator extends PanelMenu.SystemIndicator {
new PortalHelperProxy(Gio.DBus.session, 'org.gnome.Shell.PortalHelper', new PortalHelperProxy(Gio.DBus.session, 'org.gnome.Shell.PortalHelper',
'/org/gnome/Shell/PortalHelper', (proxy, error) => { '/org/gnome/Shell/PortalHelper', (proxy, error) => {
if (error) { if (error) {
log(`Error launching the portal helper: ${error}`); log('Error launching the portal helper: %s'.format(error));
return; return;
} }

View File

@ -23,7 +23,7 @@ class Indicator extends PanelMenu.SystemIndicator {
super._init(); super._init();
this._desktopSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' }); this._desktopSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' });
this._desktopSettings.connect(`changed::${SHOW_BATTERY_PERCENTAGE}`, this._desktopSettings.connect('changed::%s'.format(SHOW_BATTERY_PERCENTAGE),
this._sync.bind(this)); this._sync.bind(this));
this._indicator = this._addIndicator(); this._indicator = this._addIndicator();
@ -117,7 +117,7 @@ class Indicator extends PanelMenu.SystemIndicator {
fillLevel === 100) fillLevel === 100)
icon = 'battery-level-100-charged-symbolic'; icon = 'battery-level-100-charged-symbolic';
else else
icon = `battery-level-${fillLevel}${chargingState}-symbolic`; icon = 'battery-level-%d%s-symbolic'.format(fillLevel, chargingState);
// Make sure we fall back to fallback-icon-name and not GThemedIcon's // Make sure we fall back to fallback-icon-name and not GThemedIcon's
// default fallbacks // default fallbacks

View File

@ -315,7 +315,8 @@ class Indicator extends PanelMenu.SystemIndicator {
let auth = unlocked && allowed; let auth = unlocked && allowed;
policy[0] = auth; policy[0] = auth;
log(`thunderbolt: [${device.Name}] auto enrollment: ${auth ? 'yes' : 'no'} (allowed: ${allowed ? 'yes' : 'no'})`); log('thunderbolt: [%s] auto enrollment: %s (allowed: %s)'.format(
device.Name, auth ? 'yes' : 'no', allowed ? 'yes' : 'no'));
if (auth) if (auth)
return; /* we are done */ return; /* we are done */

View File

@ -36,7 +36,7 @@ var StreamSlider = class {
this._slider = new Slider.Slider(0); this._slider = new Slider.Slider(0);
this._soundSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.sound' }); this._soundSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.sound' });
this._soundSettings.connect(`changed::${ALLOW_AMPLIFIED_VOLUME_KEY}`, this._amplifySettingsChanged.bind(this)); this._soundSettings.connect('changed::%s'.format(ALLOW_AMPLIFIED_VOLUME_KEY), this._amplifySettingsChanged.bind(this));
this._amplifySettingsChanged(); this._amplifySettingsChanged();
this._sliderChangedId = this._slider.connect('notify::value', this._sliderChangedId = this._slider.connect('notify::value',

View File

@ -98,7 +98,7 @@ var NotificationsBox = GObject.registerClass({
let count = source.unseenCount; let count = source.unseenCount;
let countLabel = new St.Label({ let countLabel = new St.Label({
text: `${count}`, text: count.toString(),
visible: count > 1, visible: count > 1,
style_class: 'unlock-dialog-notification-count-text', style_class: 'unlock-dialog-notification-count-text',
}); });
@ -137,7 +137,7 @@ var NotificationsBox = GObject.registerClass({
} }
let label = new St.Label({ style_class: 'unlock-dialog-notification-count-text' }); let label = new St.Label({ style_class: 'unlock-dialog-notification-count-text' });
label.clutter_text.set_markup(`<b>${n.title}</b> ${body}`); label.clutter_text.set_markup('<b>%s</b> %s'.format(n.title, body));
textBox.add(label); textBox.add(label);
visible = true; visible = true;
@ -262,7 +262,7 @@ var NotificationsBox = GObject.registerClass({
this._showSource(source, obj, obj.sourceBox); this._showSource(source, obj, obj.sourceBox);
} else { } else {
let count = source.unseenCount; let count = source.unseenCount;
obj.countLabel.text = `${count}`; obj.countLabel.text = count.toString();
obj.countLabel.visible = count > 1; obj.countLabel.visible = count > 1;
} }

View File

@ -123,7 +123,8 @@ class WindowDimmer extends Clutter.BrightnessContrastEffect {
} }
_syncEnabled() { _syncEnabled() {
let animating = this.actor.get_transition(`@effects.${this.name}.brightness`) != null; let transitionName = '@effects.%s.brightness'.format(this.name);
let animating = this.actor.get_transition(transitionName) != null;
let dimmed = this.brightness.red != 127; let dimmed = this.brightness.red != 127;
this.enabled = this._enabled && (animating || dimmed); this.enabled = this._enabled && (animating || dimmed);
} }
@ -137,7 +138,8 @@ class WindowDimmer extends Clutter.BrightnessContrastEffect {
let val = 127 * (1 + (dimmed ? 1 : 0) * DIM_BRIGHTNESS); let val = 127 * (1 + (dimmed ? 1 : 0) * DIM_BRIGHTNESS);
let color = Clutter.Color.new(val, val, val, 255); let color = Clutter.Color.new(val, val, val, 255);
this.actor.ease_property(`@effects.${this.name}.brightness`, color, { let transitionName = '@effects.%s.brightness'.format(this.name);
this.actor.ease_property(transitionName, color, {
mode: Clutter.AnimationMode.LINEAR, mode: Clutter.AnimationMode.LINEAR,
duration: (dimmed ? DIM_TIME : UNDIM_TIME) * (animate ? 1 : 0), duration: (dimmed ? DIM_TIME : UNDIM_TIME) * (animate ? 1 : 0),
onComplete: () => this._syncEnabled(), onComplete: () => this._syncEnabled(),