cleanup: Use more template strings
xgettext got better at recognizing template strings, so we can replace more string concatenations. Alas xgettext is still buggy (surprise, regular expressions are hard), so there are still a handful of holdouts that prevent us from making a complete switch. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/792
This commit is contained in:
parent
2c62e45168
commit
f309d98bc8
@ -76,13 +76,13 @@ function loadInterfaceXML(iface) {
|
|||||||
if (!_ifaceResource) {
|
if (!_ifaceResource) {
|
||||||
// don't use global.datadir so the method is usable from tests/tools
|
// don't use global.datadir so the method is usable from tests/tools
|
||||||
let dir = GLib.getenv ('GNOME_SHELL_DATADIR') || Config.PKGDATADIR;
|
let dir = GLib.getenv ('GNOME_SHELL_DATADIR') || Config.PKGDATADIR;
|
||||||
let path = dir + '/gnome-shell-dbus-interfaces.gresource';
|
let path = `${dir}/gnome-shell-dbus-interfaces.gresource`;
|
||||||
_ifaceResource = Gio.Resource.load(path);
|
_ifaceResource = Gio.Resource.load(path);
|
||||||
_ifaceResource._register();
|
_ifaceResource._register();
|
||||||
}
|
}
|
||||||
|
|
||||||
let xml = null;
|
let xml = null;
|
||||||
let uri = 'resource:///org/gnome/shell/dbus-interfaces/' + iface + '.xml';
|
let uri = `resource:///org/gnome/shell/dbus-interfaces/${iface}.xml`;
|
||||||
let f = Gio.File.new_for_uri(uri);
|
let f = Gio.File.new_for_uri(uri);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -21,7 +21,7 @@ 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_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');
|
||||||
|
@ -66,7 +66,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/${name}`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
keyfile.load_from_data_dirs(path, GLib.KeyFileFlags.NONE);
|
keyfile.load_from_data_dirs(path, GLib.KeyFileFlags.NONE);
|
||||||
@ -469,7 +469,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 = `${this._folderSettings.path}folders/${id}/`;
|
||||||
let icon = this._items[id];
|
let icon = this._items[id];
|
||||||
if (!icon) {
|
if (!icon) {
|
||||||
icon = new FolderIcon(id, path, this);
|
icon = new FolderIcon(id, path, this);
|
||||||
|
@ -137,7 +137,7 @@ var ShellMagnifier = class ShellMagnifier {
|
|||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
// Got a ZoomRegion with no DBus proxy, make one.
|
// Got a ZoomRegion with no DBus proxy, make one.
|
||||||
let newPath = ZOOM_SERVICE_PATH + '/zoomer' + _zoomRegionInstanceCount;
|
let newPath = `${ZOOM_SERVICE_PATH}/zoomer${_zoomRegionInstanceCount}`;
|
||||||
_zoomRegionInstanceCount++;
|
_zoomRegionInstanceCount++;
|
||||||
let zoomRegionProxy = new ShellMagnifierZoomRegion(newPath, aZoomRegion);
|
let zoomRegionProxy = new ShellMagnifierZoomRegion(newPath, aZoomRegion);
|
||||||
let proxyAndZoomer = {};
|
let proxyAndZoomer = {};
|
||||||
|
@ -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/${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(`${global.datadir}/theme/${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(`${global.datadir}/gnome-shell-theme.gresource`);
|
||||||
_themeResource._register();
|
_themeResource._register();
|
||||||
}
|
}
|
||||||
|
|
||||||
function _loadOskLayouts() {
|
function _loadOskLayouts() {
|
||||||
_oskResource = Gio.Resource.load(global.datadir + '/gnome-shell-osk-layouts.gresource');
|
_oskResource = Gio.Resource.load(`${global.datadir}/gnome-shell-osk-layouts.gresource`);
|
||||||
_oskResource._register();
|
_oskResource._register();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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://${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 += `${str}<span foreground="${this._linkColor}"><u>${url.url}</u></span>`;
|
||||||
pos = url.pos + url.url.length;
|
pos = url.pos + url.url.length;
|
||||||
}
|
}
|
||||||
markup += this._text.substr(pos);
|
markup += this._text.substr(pos);
|
||||||
|
@ -844,7 +844,8 @@ var PadOsd = GObject.registerClass({
|
|||||||
this._tipLabel.set_text(_("Press any key to exit"));
|
this._tipLabel.set_text(_("Press any key to exit"));
|
||||||
}
|
}
|
||||||
|
|
||||||
this._titleLabel.clutter_text.set_markup('<span size="larger"><b>' + title + '</b></span>');
|
this._titleLabel.clutter_text.set_markup(
|
||||||
|
`<span size="larger"><b>${title}</b></span>`);
|
||||||
}
|
}
|
||||||
|
|
||||||
_isEditedAction(type, number, dir) {
|
_isEditedAction(type, number, dir) {
|
||||||
|
@ -210,7 +210,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 = `${GLib.get_home_dir()}/${input}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GLib.file_test(path, GLib.FileTest.EXISTS)) {
|
if (GLib.file_test(path, GLib.FileTest.EXISTS)) {
|
||||||
|
@ -189,7 +189,7 @@ var NotificationsBox = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
let label = new St.Label({ style_class: 'screen-shield-notification-count-text' });
|
let label = new St.Label({ style_class: 'screen-shield-notification-count-text' });
|
||||||
label.clutter_text.set_markup('<b>' + n.title + '</b> ' + body);
|
label.clutter_text.set_markup(`<b>${n.title}</b> ${body}`);
|
||||||
textBox.add(label);
|
textBox.add(label);
|
||||||
|
|
||||||
visible = true;
|
visible = true;
|
||||||
|
@ -304,7 +304,7 @@ var GnomeShellExtensions = class {
|
|||||||
let app = appSys.lookup_app('gnome-shell-extension-prefs.desktop');
|
let app = appSys.lookup_app('gnome-shell-extension-prefs.desktop');
|
||||||
let info = app.get_app_info();
|
let info = app.get_app_info();
|
||||||
let timestamp = global.display.get_current_time_roundtrip();
|
let timestamp = global.display.get_current_time_roundtrip();
|
||||||
info.launch_uris(['extension:///' + uuid],
|
info.launch_uris([`extension:///${uuid}`],
|
||||||
global.create_app_launch_context(timestamp, -1));
|
global.create_app_launch_context(timestamp, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user