[gnome] Update extensions for version 48
This commit is contained in:
@ -62,7 +62,7 @@ export default class Controller {
|
||||
|
||||
modifier = keymap.get_entries_for_keyval(Gdk.KEY_Super_L)[1][0];
|
||||
XKeycode.Super_L = modifier.keycode;
|
||||
} catch (e) {
|
||||
} catch {
|
||||
debug('using default modifier keycodes');
|
||||
}
|
||||
}
|
||||
@ -304,9 +304,8 @@ export default class Controller {
|
||||
destroy() {
|
||||
try {
|
||||
Atspi.exit();
|
||||
} catch (e) {
|
||||
} catch {
|
||||
// Silence errors
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ try {
|
||||
EBook = (await import('gi://EBook')).default;
|
||||
EBookContacts = (await import('gi://EBookContacts')).default;
|
||||
EDataServer = (await import('gi://EDataServer')).default;
|
||||
} catch (e) {
|
||||
} catch {
|
||||
HAVE_EDS = false;
|
||||
}
|
||||
|
||||
@ -267,7 +267,7 @@ const Store = GObject.registerClass({
|
||||
this._ebooks = new Map();
|
||||
|
||||
// Get the current EBooks
|
||||
const registry = await this._getESourceRegistry();
|
||||
const registry = await EDataServer.SourceRegistry.new(null);
|
||||
|
||||
for (const source of registry.list_sources('Address Book'))
|
||||
await this._onAppeared(null, source);
|
||||
@ -329,7 +329,7 @@ const Store = GObject.registerClass({
|
||||
* Save a Uint8Array to file and return the path
|
||||
*
|
||||
* @param {Uint8Array} contents - An image byte array
|
||||
* @return {string|undefined} File path or %undefined on failure
|
||||
* @returns {string|undefined} File path or %undefined on failure
|
||||
*/
|
||||
async storeAvatar(contents) {
|
||||
const md5 = GLib.compute_checksum_for_data(GLib.ChecksumType.MD5,
|
||||
@ -353,10 +353,10 @@ const Store = GObject.registerClass({
|
||||
/**
|
||||
* Query the Store for a contact by name and/or number.
|
||||
*
|
||||
* @param {Object} query - A query object
|
||||
* @param {object} query - A query object
|
||||
* @param {string} [query.name] - The contact's name
|
||||
* @param {string} query.number - The contact's number
|
||||
* @return {Object} A contact object
|
||||
* @returns {object} A contact object
|
||||
*/
|
||||
query(query) {
|
||||
// First look for an existing contact by number
|
||||
@ -410,7 +410,7 @@ const Store = GObject.registerClass({
|
||||
/**
|
||||
* Add a contact, checking for validity
|
||||
*
|
||||
* @param {Object} contact - A contact object
|
||||
* @param {object} contact - A contact object
|
||||
* @param {boolean} write - Write to disk
|
||||
*/
|
||||
add(contact, write = true) {
|
||||
@ -468,8 +468,8 @@ const Store = GObject.registerClass({
|
||||
*
|
||||
* { "555-5555": { "name": "...", "numbers": [], ... } }
|
||||
*
|
||||
* @param {Object[]} addresses - A list of address objects
|
||||
* @return {Object} A dictionary of phone numbers and contacts
|
||||
* @param {object[]} addresses - A list of address objects
|
||||
* @returns {object} A dictionary of phone numbers and contacts
|
||||
*/
|
||||
lookupAddresses(addresses) {
|
||||
const contacts = {};
|
||||
@ -502,7 +502,7 @@ const Store = GObject.registerClass({
|
||||
/**
|
||||
* Update the contact store from a dictionary of our custom contact objects.
|
||||
*
|
||||
* @param {Object} json - an Object of contact Objects
|
||||
* @param {object} json - an Object of contact Objects
|
||||
*/
|
||||
async update(json = {}) {
|
||||
try {
|
||||
@ -610,4 +610,3 @@ const Store = GObject.registerClass({
|
||||
});
|
||||
|
||||
export default Store;
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ const Default = new Map();
|
||||
* followed by a call to `release()`.
|
||||
*
|
||||
* @param {string} name - The module name
|
||||
* @return {*} The default instance of a component
|
||||
* @returns {*} The default instance of a component
|
||||
*/
|
||||
export function acquire(name) {
|
||||
if (functionOverrides.acquire)
|
||||
@ -78,7 +78,7 @@ export function acquire(name) {
|
||||
* holder, the component will be freed.
|
||||
*
|
||||
* @param {string} name - The module name
|
||||
* @return {null} A %null value, useful for overriding a traced variable
|
||||
* @returns {null} A %null value, useful for overriding a traced variable
|
||||
*/
|
||||
export function release(name) {
|
||||
if (functionOverrides.release)
|
||||
@ -99,4 +99,3 @@ export function release(name) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ const RemoteSession = GObject.registerClass({
|
||||
get session_id() {
|
||||
try {
|
||||
return this.get_cached_property('SessionId').unpack();
|
||||
} catch (e) {
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -327,22 +327,24 @@ export default class Controller {
|
||||
}
|
||||
|
||||
async _ensureAdapter() {
|
||||
// Update the timestamp of the last event
|
||||
this._sessionExpiry = Math.floor((Date.now() / 1000) + SESSION_TIMEOUT);
|
||||
|
||||
// Session is active
|
||||
if (this._session !== null)
|
||||
return this._session;
|
||||
|
||||
// Mutter's RemoteDesktop is not available, fall back to Atspi
|
||||
if (this.connection === null) {
|
||||
debug('Falling back to Atspi');
|
||||
|
||||
this._session = new AtspiController();
|
||||
return this._session;
|
||||
}
|
||||
|
||||
try {
|
||||
// Update the timestamp of the last event
|
||||
this._sessionExpiry = Math.floor((Date.now() / 1000) + SESSION_TIMEOUT);
|
||||
|
||||
// Session is active
|
||||
if (this._session !== null)
|
||||
return;
|
||||
|
||||
// Mutter's RemoteDesktop is not available, fall back to Atspi
|
||||
if (this.connection === null) {
|
||||
debug('Falling back to Atspi');
|
||||
|
||||
this._session = new AtspiController();
|
||||
|
||||
// Mutter is available and there isn't another session starting
|
||||
} else if (this._sessionStarting === false) {
|
||||
if (this._sessionStarting === false) {
|
||||
this._sessionStarting = true;
|
||||
|
||||
debug('Creating Mutter RemoteDesktop session');
|
||||
@ -368,18 +370,17 @@ export default class Controller {
|
||||
this._onSessionExpired.bind(this)
|
||||
);
|
||||
}
|
||||
|
||||
this._sessionStarting = false;
|
||||
}
|
||||
return this._session;
|
||||
} catch (e) {
|
||||
logError(e);
|
||||
|
||||
if (this._session !== null) {
|
||||
this._session.destroy();
|
||||
this._session = null;
|
||||
}
|
||||
|
||||
this._sessionStarting = false;
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@ -387,111 +388,81 @@ export default class Controller {
|
||||
* Pointer Events
|
||||
*/
|
||||
movePointer(dx, dy) {
|
||||
try {
|
||||
if (dx === 0 && dy === 0)
|
||||
return;
|
||||
if (dx === 0 && dy === 0)
|
||||
return;
|
||||
|
||||
this._ensureAdapter();
|
||||
this._session.movePointer(dx, dy);
|
||||
} catch (e) {
|
||||
debug(e);
|
||||
}
|
||||
this._ensureAdapter()
|
||||
.then(session => session?.movePointer(dx, dy))
|
||||
.catch(e => debug(e));
|
||||
}
|
||||
|
||||
pressPointer(button) {
|
||||
try {
|
||||
this._ensureAdapter();
|
||||
this._session.pressPointer(button);
|
||||
} catch (e) {
|
||||
debug(e);
|
||||
}
|
||||
this._ensureAdapter()
|
||||
.then(session => session?.pressPointer(button))
|
||||
.catch(e => debug(e));
|
||||
}
|
||||
|
||||
releasePointer(button) {
|
||||
try {
|
||||
this._ensureAdapter();
|
||||
this._session.releasePointer(button);
|
||||
} catch (e) {
|
||||
debug(e);
|
||||
}
|
||||
this._ensureAdapter()
|
||||
.then(session => session?.releasePointer(button))
|
||||
.catch(e => debug(e));
|
||||
}
|
||||
|
||||
clickPointer(button) {
|
||||
try {
|
||||
this._ensureAdapter();
|
||||
this._session.clickPointer(button);
|
||||
} catch (e) {
|
||||
debug(e);
|
||||
}
|
||||
this._ensureAdapter()
|
||||
.then(session => session?.clickPointer(button))
|
||||
.catch(e => debug(e));
|
||||
}
|
||||
|
||||
doubleclickPointer(button) {
|
||||
try {
|
||||
this._ensureAdapter();
|
||||
this._session.doubleclickPointer(button);
|
||||
} catch (e) {
|
||||
debug(e);
|
||||
}
|
||||
this._ensureAdapter()
|
||||
.then(session => session?.doubleclickPointer(button))
|
||||
.catch(e => debug(e));
|
||||
}
|
||||
|
||||
scrollPointer(dx, dy) {
|
||||
if (dx === 0 && dy === 0)
|
||||
return;
|
||||
|
||||
try {
|
||||
this._ensureAdapter();
|
||||
this._session.scrollPointer(dx, dy);
|
||||
} catch (e) {
|
||||
debug(e);
|
||||
}
|
||||
this._ensureAdapter()
|
||||
.then(session => session?.scrollPointer(dx, dy))
|
||||
.catch(e => debug(e));
|
||||
}
|
||||
|
||||
/*
|
||||
* Keyboard Events
|
||||
*/
|
||||
pressKeysym(keysym) {
|
||||
try {
|
||||
this._ensureAdapter();
|
||||
this._session.pressKeysym(keysym);
|
||||
} catch (e) {
|
||||
debug(e);
|
||||
}
|
||||
this._ensureAdapter()
|
||||
.then(session => session?.pressKeysym(keysym))
|
||||
.catch(e => debug(e));
|
||||
}
|
||||
|
||||
releaseKeysym(keysym) {
|
||||
try {
|
||||
this._ensureAdapter();
|
||||
this._session.releaseKeysym(keysym);
|
||||
} catch (e) {
|
||||
debug(e);
|
||||
}
|
||||
this._ensureAdapter()
|
||||
.then(session => session?.releaseKeysym(keysym))
|
||||
.catch(e => debug(e));
|
||||
}
|
||||
|
||||
pressreleaseKeysym(keysym) {
|
||||
try {
|
||||
this._ensureAdapter();
|
||||
this._session.pressreleaseKeysym(keysym);
|
||||
} catch (e) {
|
||||
debug(e);
|
||||
}
|
||||
this._ensureAdapter()
|
||||
.then(session => session?.pressreleaseKeysym(keysym))
|
||||
.catch(e => debug(e));
|
||||
}
|
||||
|
||||
/*
|
||||
* High-level keyboard input
|
||||
*/
|
||||
pressKeys(input, modifiers) {
|
||||
try {
|
||||
this._ensureAdapter();
|
||||
|
||||
this._ensureAdapter()
|
||||
.then(session => {
|
||||
if (typeof input === 'string') {
|
||||
for (let i = 0; i < input.length; i++)
|
||||
this._session.pressKey(input[i], modifiers);
|
||||
session?.pressKey(input[i], modifiers);
|
||||
} else {
|
||||
this._session.pressKey(input, modifiers);
|
||||
session?.pressKey(input, modifiers);
|
||||
}
|
||||
} catch (e) {
|
||||
debug(e);
|
||||
}
|
||||
}).catch(e => debug(e));
|
||||
}
|
||||
|
||||
destroy() {
|
||||
|
||||
@ -472,6 +472,10 @@ const PlayerProxy = GObject.registerClass({
|
||||
GTypeName: 'GSConnectMPRISPlayer',
|
||||
}, class PlayerProxy extends Player {
|
||||
|
||||
/**
|
||||
* @constructs GSConnectMPRISPlayer
|
||||
* @param {string} name - The name of the player
|
||||
*/
|
||||
_init(name) {
|
||||
super._init();
|
||||
|
||||
@ -539,7 +543,7 @@ const PlayerProxy = GObject.registerClass({
|
||||
_get(proxy, name, fallback = null) {
|
||||
try {
|
||||
return proxy.get_cached_property(name).recursiveUnpack();
|
||||
} catch (e) {
|
||||
} catch {
|
||||
return fallback;
|
||||
}
|
||||
}
|
||||
@ -707,7 +711,7 @@ const PlayerProxy = GObject.registerClass({
|
||||
);
|
||||
|
||||
return reply.recursiveUnpack()[0];
|
||||
} catch (e) {
|
||||
} catch {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -914,7 +918,7 @@ const Manager = GObject.registerClass({
|
||||
* Check for a player by its Identity.
|
||||
*
|
||||
* @param {string} identity - A player name
|
||||
* @return {boolean} %true if the player was found
|
||||
* @returns {boolean} %true if the player was found
|
||||
*/
|
||||
hasPlayer(identity) {
|
||||
for (const player of this._players.values()) {
|
||||
@ -929,7 +933,7 @@ const Manager = GObject.registerClass({
|
||||
* Get a player by its Identity.
|
||||
*
|
||||
* @param {string} identity - A player name
|
||||
* @return {GSConnectMPRISPlayer|null} A player or %null
|
||||
* @returns {GSConnectMPRISPlayer|null} A player or %null
|
||||
*/
|
||||
getPlayer(identity) {
|
||||
for (const player of this._players.values()) {
|
||||
@ -943,7 +947,7 @@ const Manager = GObject.registerClass({
|
||||
/**
|
||||
* Get a list of player identities.
|
||||
*
|
||||
* @return {string[]} A list of player identities
|
||||
* @returns {string[]} A list of player identities
|
||||
*/
|
||||
getIdentities() {
|
||||
const identities = [];
|
||||
@ -1000,4 +1004,3 @@ const Manager = GObject.registerClass({
|
||||
* The service class for this component
|
||||
*/
|
||||
export default Manager;
|
||||
|
||||
|
||||
@ -144,7 +144,7 @@ const Listener = GObject.registerClass({
|
||||
*
|
||||
* @param {string} sender - A DBus unique name (eg. :1.2282)
|
||||
* @param {string} appName - @appName passed to Notify() (Optional)
|
||||
* @return {string} A well-known name or %null
|
||||
* @returns {string} A well-known name or %null
|
||||
*/
|
||||
async _getAppId(sender, appName) {
|
||||
try {
|
||||
@ -189,7 +189,7 @@ const Listener = GObject.registerClass({
|
||||
*
|
||||
* @param {string} sender - A DBus unique name
|
||||
* @param {string} [appName] - `appName` supplied by Notify()
|
||||
* @return {string} A well-known name or %null
|
||||
* @returns {string} A well-known name or %null
|
||||
*/
|
||||
async _getAppName(sender, appName = null) {
|
||||
// Check the cache first
|
||||
@ -201,7 +201,7 @@ const Listener = GObject.registerClass({
|
||||
const appInfo = Gio.DesktopAppInfo.new(`${appId}.desktop`);
|
||||
this._names[appName] = appInfo.get_name();
|
||||
appName = appInfo.get_name();
|
||||
} catch (e) {
|
||||
} catch {
|
||||
// Silence errors
|
||||
}
|
||||
|
||||
@ -261,7 +261,7 @@ const Listener = GObject.registerClass({
|
||||
/**
|
||||
* Export interfaces for proxying notifications and become a monitor
|
||||
*
|
||||
* @return {Promise} A promise for the operation
|
||||
* @returns {Promise} A promise for the operation
|
||||
*/
|
||||
_monitorConnection() {
|
||||
// libnotify Interface
|
||||
|
||||
@ -19,7 +19,7 @@ try {
|
||||
GIRepository.Repository.prepend_library_path(typelibDir);
|
||||
|
||||
Gvc = (await import('gi://Gvc')).default;
|
||||
} catch (e) {}
|
||||
} catch {}
|
||||
|
||||
|
||||
/**
|
||||
@ -33,7 +33,7 @@ if (Gvc) {
|
||||
return this.description;
|
||||
|
||||
return `${this.get_port().human_port} (${this.description})`;
|
||||
} catch (e) {
|
||||
} catch {
|
||||
return this.description;
|
||||
}
|
||||
},
|
||||
|
||||
@ -9,7 +9,7 @@ import GLib from 'gi://GLib';
|
||||
let GSound = null;
|
||||
try {
|
||||
GSound = (await import('gi://GSound')).default;
|
||||
} catch (e) {}
|
||||
} catch {}
|
||||
|
||||
|
||||
const Player = class Player {
|
||||
@ -169,4 +169,3 @@ const Player = class Player {
|
||||
* The service class for this component
|
||||
*/
|
||||
export default Player;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user