[gnome] Update extensions for version 48
This commit is contained in:
@ -60,7 +60,7 @@ export function rowSeparators(row, before) {
|
||||
*
|
||||
* @param {Gtk.ListBoxRow} row1 - The first row
|
||||
* @param {Gtk.ListBoxRow} row2 - The second row
|
||||
* @return {number} -1, 0 or 1
|
||||
* @returns {number} -1, 0 or 1
|
||||
*/
|
||||
export function titleSortFunc(row1, row2) {
|
||||
if (!row1.title || !row2.title)
|
||||
@ -605,7 +605,7 @@ export const Panel = GObject.registerClass({
|
||||
const isPresent = value.get_boolean();
|
||||
|
||||
resolve(isPresent);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
resolve(false);
|
||||
}
|
||||
}
|
||||
@ -614,7 +614,7 @@ export const Panel = GObject.registerClass({
|
||||
|
||||
this.battery_system_label.visible = hasBattery;
|
||||
this.battery_system.visible = hasBattery;
|
||||
} catch (e) {
|
||||
} catch {
|
||||
this.battery_system_label.visible = false;
|
||||
this.battery_system.visible = false;
|
||||
}
|
||||
@ -814,7 +814,7 @@ export const Panel = GObject.registerClass({
|
||||
|
||||
try {
|
||||
applications = JSON.parse(settings.get_string('applications'));
|
||||
} catch (e) {
|
||||
} catch {
|
||||
applications = {};
|
||||
}
|
||||
|
||||
@ -858,7 +858,7 @@ export const Panel = GObject.registerClass({
|
||||
|
||||
try {
|
||||
applications = JSON.parse(settings.get_string('applications'));
|
||||
} catch (e) {
|
||||
} catch {
|
||||
applications = {};
|
||||
}
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
import GLib from 'gi://GLib';
|
||||
|
||||
import setup, {setupGettext} from '../utils/setup.js';
|
||||
import {setup, setupGettext} from '../utils/setup.js';
|
||||
|
||||
|
||||
// Bootstrap
|
||||
|
||||
@ -205,7 +205,7 @@ export const ShortcutChooserDialog = GObject.registerClass({
|
||||
* @param {string} accelerator - An accelerator
|
||||
* @param {number} [modeFlags] - Mode Flags
|
||||
* @param {number} [grabFlags] - Grab Flags
|
||||
* @param {boolean} %true if available, %false on error or unavailable
|
||||
* @returns {boolean} %true if available, %false on error or unavailable
|
||||
*/
|
||||
export async function checkAccelerator(accelerator, modeFlags = 0, grabFlags = 0) {
|
||||
try {
|
||||
@ -272,7 +272,7 @@ export async function checkAccelerator(accelerator, modeFlags = 0, grabFlags = 0
|
||||
*
|
||||
* @param {string} summary - A description of the keybinding's function
|
||||
* @param {string} accelerator - An accelerator as taken by Gtk.ShortcutLabel
|
||||
* @return {string} An accelerator or %null if it should be unset.
|
||||
* @returns {string} An accelerator or %null if it should be unset.
|
||||
*/
|
||||
export async function getAccelerator(summary, accelerator = null) {
|
||||
try {
|
||||
@ -311,4 +311,3 @@ export async function getAccelerator(summary, accelerator = null) {
|
||||
return accelerator;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -422,6 +422,28 @@ export const Window = GObject.registerClass({
|
||||
dialog.show_all();
|
||||
}
|
||||
|
||||
_validateName(name) {
|
||||
// None of the forbidden characters and at least one non-whitespace
|
||||
if (name.trim() && /^[^"',;:.!?()[\]<>]{1,32}$/.test(name))
|
||||
return true;
|
||||
|
||||
const dialog = new Gtk.MessageDialog({
|
||||
text: _('Invalid Device Name'),
|
||||
// TRANSLATOR: %s is a list of forbidden characters
|
||||
secondary_text: _('Device name must not contain any of %s ' +
|
||||
'and have a length of 1-32 characters')
|
||||
.format('<b><tt>^"\',;:.!?()[]<></tt></b>'),
|
||||
secondary_use_markup: true,
|
||||
buttons: Gtk.ButtonsType.OK,
|
||||
modal: true,
|
||||
transient_for: this,
|
||||
});
|
||||
dialog.connect('response', (dialog) => dialog.destroy());
|
||||
dialog.show_all();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* "Help" GAction
|
||||
*/
|
||||
@ -456,7 +478,7 @@ export const Window = GObject.registerClass({
|
||||
}
|
||||
|
||||
_onSetServiceName(widget) {
|
||||
if (this.rename_entry.text.length) {
|
||||
if (this._validateName(this.rename_entry.text)) {
|
||||
this.headerbar.title = this.rename_entry.text;
|
||||
this.settings.set_string('name', this.rename_entry.text);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user