cleanup: Stop using string concatenation

It's unfortunate that we cannot fully embrace template strings, but
we aren't limited to "legacy" formatting either; replace the last
remaining places where we still use string concatenation to reduce
the difference between regular and legacy style a bit.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2200>
This commit is contained in:
Florian Müllner 2020-03-24 05:02:20 +01:00 committed by Marge Bot
parent 3d3ed850fe
commit 696965c9f7
5 changed files with 15 additions and 14 deletions

View File

@ -10,13 +10,13 @@ const dbusInterface = 'org.vmware.viewagent.Credentials';
var SERVICE_NAME = 'gdm-vmwcred'; var SERVICE_NAME = 'gdm-vmwcred';
const VmwareCredentialsIface = '<node> \ const VmwareCredentialsIface = `<node>
<interface name="' + dbusInterface + '"> \ <interface name="${dbusInterface}">
<signal name="UserAuthenticated"> \ <signal name="UserAuthenticated">
<arg type="s" name="token"/> \ <arg type="s" name="token"/>
</signal> \ </signal>
</interface> \ </interface>
</node>'; </node>`;
const VmwareCredentialsInfo = Gio.DBusInterfaceInfo.new_for_xml(VmwareCredentialsIface); const VmwareCredentialsInfo = Gio.DBusInterfaceInfo.new_for_xml(VmwareCredentialsIface);

View File

@ -816,7 +816,8 @@ var ChatNotification = HAVE_TP ? GObject.registerClass({
/* Translators: this is the other person changing their old IM name to their new /* Translators: this is the other person changing their old IM name to their new
IM name. */ IM name. */
let message = '<i>' + _("%s is now known as %s").format(oldAlias, newAlias) + '</i>'; const message = `<i>${
_('%s is now known as %s').format(oldAlias, newAlias)}</i>`;
this._append({ body: message, this._append({ body: message,
group: 'meta', group: 'meta',

View File

@ -545,7 +545,7 @@ const FdoApplicationIface = loadInterfaceXML('org.freedesktop.Application');
const FdoApplicationProxy = Gio.DBusProxy.makeProxyWrapper(FdoApplicationIface); const FdoApplicationProxy = Gio.DBusProxy.makeProxyWrapper(FdoApplicationIface);
function objectPathFromAppId(appId) { function objectPathFromAppId(appId) {
return '/' + appId.replace(/\./g, '/').replace(/-/g, '_'); return `/${appId.replace(/\./g, '/').replace(/-/g, '_')}`;
} }
function getPlatformData() { function getPlatformData() {

View File

@ -359,9 +359,10 @@ var PadDiagram = GObject.registerClass({
} }
_wrappingSvgFooter() { _wrappingSvgFooter() {
return '</style>' + return '%s%s%s'.format(
'<xi:include href="' + this._imagePath + '" />' + '</style>',
'</svg>'; '<xi:include href="%s" />'.format(this._imagePath),
'</svg>');
} }
_cssString() { _cssString() {
@ -885,7 +886,7 @@ var PadOsd = GObject.registerClass({
this._endActionEdition(); this._endActionEdition();
this._editedAction = { type, number, dir, mode }; this._editedAction = { type, number, dir, mode };
let settingsPath = this._settings.path + key + '/'; const settingsPath = `${this._settings.path}${key}/`;
this._editedActionSettings = Gio.Settings.new_with_path('org.gnome.desktop.peripherals.tablet.pad-button', this._editedActionSettings = Gio.Settings.new_with_path('org.gnome.desktop.peripherals.tablet.pad-button',
settingsPath); settingsPath);
this._actionEditor.setSettings(this._editedActionSettings, type); this._actionEditor.setSettings(this._editedActionSettings, type);

View File

@ -24,5 +24,4 @@ rules:
object-curly-newline: object-curly-newline:
- error - error
- consistent: true - consistent: true
prefer-template: off
quotes: off quotes: off