[gnome] Update extensions
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
export default {
|
||||
PACKAGE_VERSION: 71,
|
||||
PACKAGE_VERSION: 72,
|
||||
PACKAGE_URL: 'https://github.com/GSConnect/gnome-shell-extension-gsconnect',
|
||||
PACKAGE_BUGREPORT: 'https://github.com/GSConnect/gnome-shell-extension-gsconnect/issues/new',
|
||||
PACKAGE_DATADIR: '/usr/local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io',
|
||||
|
||||
@ -1,104 +1,19 @@
|
||||
#!/usr/bin/env -S gjs -m
|
||||
#!/bin/sh
|
||||
|
||||
// SPDX-FileCopyrightText: GSConnect Developers https://github.com/GSConnect
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
# SPDX-FileCopyrightText: GSConnect Developers https://github.com/GSConnect
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
// -*- mode: js; -*-
|
||||
fallback_dir=$HOME/.local/share/gnome-shell/extensions/gsconnect@andyholmes.github.io/
|
||||
|
||||
import Gdk from 'gi://Gdk?version=3.0';
|
||||
import 'gi://GdkPixbuf?version=2.0';
|
||||
import Gio from 'gi://Gio?version=2.0';
|
||||
import GLib from 'gi://GLib?version=2.0';
|
||||
import GObject from 'gi://GObject?version=2.0';
|
||||
import Gtk from 'gi://Gtk?version=3.0';
|
||||
if [ ! -f "./gsconnect-preferences.js" ]; then
|
||||
# Try to find home path
|
||||
extension_dir="$(dirname "$(realpath "$(command -v "$0")")")"
|
||||
# try even harder
|
||||
if [ ! -d "$extension_dir" ]; then
|
||||
extension_dir="$fallback_dir"
|
||||
fi
|
||||
cd "$extension_dir" || exit 1
|
||||
fi
|
||||
exec /usr/bin/env gjs -m gsconnect-preferences.js
|
||||
|
||||
import system from 'system';
|
||||
|
||||
import './preferences/init.js';
|
||||
import {Window} from './preferences/service.js';
|
||||
import Config from './config.js';
|
||||
|
||||
import('gi://GioUnix?version=2.0').catch(() => {}); // Set version for optional dependency
|
||||
|
||||
|
||||
/**
|
||||
* Class representing the GSConnect service daemon.
|
||||
*/
|
||||
const Preferences = GObject.registerClass({
|
||||
GTypeName: 'GSConnectPreferences',
|
||||
Implements: [Gio.ActionGroup],
|
||||
}, class Preferences extends Gtk.Application {
|
||||
|
||||
_init() {
|
||||
super._init({
|
||||
application_id: 'org.gnome.Shell.Extensions.GSConnect.Preferences',
|
||||
resource_base_path: '/org/gnome/Shell/Extensions/GSConnect',
|
||||
});
|
||||
|
||||
GLib.set_prgname('gsconnect-preferences');
|
||||
GLib.set_application_name(_('GSConnect Preferences'));
|
||||
}
|
||||
|
||||
vfunc_activate() {
|
||||
if (this._window === undefined) {
|
||||
this._window = new Window({
|
||||
application: this,
|
||||
});
|
||||
}
|
||||
|
||||
this._window.present();
|
||||
}
|
||||
|
||||
vfunc_startup() {
|
||||
super.vfunc_startup();
|
||||
|
||||
// Init some resources
|
||||
const provider = new Gtk.CssProvider();
|
||||
provider.load_from_resource(`${Config.APP_PATH}/application.css`);
|
||||
Gtk.StyleContext.add_provider_for_screen(
|
||||
Gdk.Screen.get_default(),
|
||||
provider,
|
||||
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
|
||||
);
|
||||
|
||||
const actions = [
|
||||
['refresh', null],
|
||||
['connect', GLib.VariantType.new('s')],
|
||||
];
|
||||
|
||||
for (const [name, type] of actions) {
|
||||
const action = new Gio.SimpleAction({
|
||||
name: name,
|
||||
parameter_type: type,
|
||||
});
|
||||
this.add_action(action);
|
||||
}
|
||||
}
|
||||
|
||||
vfunc_activate_action(action_name, parameter) {
|
||||
try {
|
||||
const paramArray = [];
|
||||
|
||||
if (parameter instanceof GLib.Variant)
|
||||
paramArray[0] = parameter;
|
||||
|
||||
this.get_dbus_connection().call(
|
||||
'org.gnome.Shell.Extensions.GSConnect',
|
||||
'/org/gnome/Shell/Extensions/GSConnect',
|
||||
'org.freedesktop.Application',
|
||||
'ActivateAction',
|
||||
GLib.Variant.new('(sava{sv})', [action_name, paramArray, {}]),
|
||||
null,
|
||||
Gio.DBusCallFlags.NONE,
|
||||
-1,
|
||||
null,
|
||||
null
|
||||
);
|
||||
} catch (e) {
|
||||
logError(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
await (new Preferences()).runAsync([system.programInvocationName].concat(ARGV));
|
||||
|
||||
@ -0,0 +1,102 @@
|
||||
// SPDX-FileCopyrightText: GSConnect Developers https://github.com/GSConnect
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
// -*- mode: js; -*-
|
||||
|
||||
import Gdk from 'gi://Gdk?version=3.0';
|
||||
import 'gi://GdkPixbuf?version=2.0';
|
||||
import Gio from 'gi://Gio?version=2.0';
|
||||
import GLib from 'gi://GLib?version=2.0';
|
||||
import GObject from 'gi://GObject?version=2.0';
|
||||
import Gtk from 'gi://Gtk?version=3.0';
|
||||
|
||||
import system from 'system';
|
||||
|
||||
import './preferences/init.js';
|
||||
import {Window} from './preferences/service.js';
|
||||
import Config from './config.js';
|
||||
|
||||
import('gi://GioUnix?version=2.0').catch(() => {}); // Set version for optional dependency
|
||||
|
||||
|
||||
/**
|
||||
* Class representing the GSConnect service daemon.
|
||||
*/
|
||||
const Preferences = GObject.registerClass({
|
||||
GTypeName: 'GSConnectPreferences',
|
||||
Implements: [Gio.ActionGroup],
|
||||
}, class Preferences extends Gtk.Application {
|
||||
|
||||
_init() {
|
||||
super._init({
|
||||
application_id: 'org.gnome.Shell.Extensions.GSConnect.Preferences',
|
||||
resource_base_path: '/org/gnome/Shell/Extensions/GSConnect',
|
||||
});
|
||||
|
||||
GLib.set_prgname('gsconnect-preferences');
|
||||
GLib.set_application_name(_('GSConnect Preferences'));
|
||||
}
|
||||
|
||||
vfunc_activate() {
|
||||
if (this._window === undefined) {
|
||||
this._window = new Window({
|
||||
application: this,
|
||||
});
|
||||
}
|
||||
|
||||
this._window.present();
|
||||
}
|
||||
|
||||
vfunc_startup() {
|
||||
super.vfunc_startup();
|
||||
|
||||
// Init some resources
|
||||
const provider = new Gtk.CssProvider();
|
||||
provider.load_from_resource(`${Config.APP_PATH}/application.css`);
|
||||
Gtk.StyleContext.add_provider_for_screen(
|
||||
Gdk.Screen.get_default(),
|
||||
provider,
|
||||
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
|
||||
);
|
||||
|
||||
const actions = [
|
||||
['refresh', null],
|
||||
['connect', GLib.VariantType.new('s')],
|
||||
];
|
||||
|
||||
for (const [name, type] of actions) {
|
||||
const action = new Gio.SimpleAction({
|
||||
name: name,
|
||||
parameter_type: type,
|
||||
});
|
||||
this.add_action(action);
|
||||
}
|
||||
}
|
||||
|
||||
vfunc_activate_action(action_name, parameter) {
|
||||
try {
|
||||
const paramArray = [];
|
||||
|
||||
if (parameter instanceof GLib.Variant)
|
||||
paramArray[0] = parameter;
|
||||
|
||||
this.get_dbus_connection().call(
|
||||
'org.gnome.Shell.Extensions.GSConnect',
|
||||
'/org/gnome/Shell/Extensions/GSConnect',
|
||||
'org.freedesktop.Application',
|
||||
'ActivateAction',
|
||||
GLib.Variant.new('(sava{sv})', [action_name, paramArray, {}]),
|
||||
null,
|
||||
Gio.DBusCallFlags.NONE,
|
||||
-1,
|
||||
null,
|
||||
null
|
||||
);
|
||||
} catch (e) {
|
||||
logError(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
await (new Preferences()).runAsync([system.programInvocationName].concat(ARGV));
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -6,9 +6,10 @@
|
||||
"46",
|
||||
"47",
|
||||
"48",
|
||||
"49"
|
||||
"49",
|
||||
"50"
|
||||
],
|
||||
"url": "https://github.com/GSConnect/gnome-shell-extension-gsconnect/wiki",
|
||||
"uuid": "gsconnect@andyholmes.github.io",
|
||||
"version": 71
|
||||
"version": 72
|
||||
}
|
||||
@ -26,7 +26,8 @@ export default class GSConnectExtensionPreferences extends ExtensionPreferences
|
||||
window.close();
|
||||
});
|
||||
|
||||
Gio.Subprocess.new([`${this.path}/gsconnect-preferences`], 0);
|
||||
const _launcher = Gio.SubprocessLauncher.new({flags: Gio.SubprocessFlags.NONE});
|
||||
_launcher.set_cwd(this.path);
|
||||
_launcher.spawnv(['gjs', '-m', 'gsconnect-preferences.js']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -411,9 +411,9 @@ export const ChannelService = GObject.registerClass({
|
||||
/**
|
||||
* Broadcast an identity packet
|
||||
*
|
||||
* If @address is not %null it may specify an IPv4 or IPv6 address to send
|
||||
* the identity packet directly to, otherwise it will be broadcast to the
|
||||
* default address, 255.255.255.255.
|
||||
* If {@link address] is not %null it may specify an IPv4 or IPv6 address
|
||||
* to send the identity packet directly to, otherwise it will be broadcast
|
||||
* to the default address, 255.255.255.255.
|
||||
*
|
||||
* @param {string} [address] - An optional target IPv4 or IPv6 address
|
||||
*/
|
||||
@ -773,9 +773,8 @@ export const Channel = GObject.registerClass({
|
||||
|
||||
// Starting with protocol version 8, the devices are expected to
|
||||
// exchange identity packets again after TLS negotiation
|
||||
if (this.identity.body.protocolVersion >= 8) {
|
||||
if (this.identity.body.protocolVersion >= 8)
|
||||
await this._exchangeIdentities();
|
||||
}
|
||||
} catch (e) {
|
||||
this.close();
|
||||
throw e;
|
||||
@ -803,9 +802,8 @@ export const Channel = GObject.registerClass({
|
||||
|
||||
// Starting with protocol version 8, the devices are expected to
|
||||
// exchange identity packets again after TLS negotiation
|
||||
if (this.identity.body.protocolVersion >= 8) {
|
||||
if (this.identity.body.protocolVersion >= 8)
|
||||
await this._exchangeIdentities();
|
||||
}
|
||||
} catch (e) {
|
||||
this.close();
|
||||
throw e;
|
||||
|
||||
@ -463,8 +463,8 @@ const Store = GObject.registerClass({
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup a contact for each address object in @addresses and return a
|
||||
* dictionary of address (eg. phone number) to contact object.
|
||||
* Lookup a contact for each address object in {@link addresses} and return
|
||||
* a dictionary of address (eg. phone number) to contact object.
|
||||
*
|
||||
* { "555-5555": { "name": "...", "numbers": [], ... } }
|
||||
*
|
||||
|
||||
@ -41,7 +41,7 @@ const Default = new Map();
|
||||
* followed by a call to `release()`.
|
||||
*
|
||||
* @param {string} name - The module name
|
||||
* @returns {*} The default instance of a component
|
||||
* @returns {object} The default instance of a component
|
||||
*/
|
||||
export function acquire(name) {
|
||||
if (functionOverrides.acquire)
|
||||
|
||||
@ -9,6 +9,12 @@ import GObject from 'gi://GObject';
|
||||
|
||||
import * as DBus from '../utils/dbus.js';
|
||||
|
||||
// DesktopAppInfo is no longer in Gio in GNOME 49
|
||||
let GioUnix;
|
||||
GioUnix = import('gi://GioUnix?version=2.0').catch(() => {
|
||||
GioUnix = Gio;
|
||||
});
|
||||
|
||||
|
||||
const _nodeInfo = Gio.DBusNodeInfo.new_for_xml(`
|
||||
<node>
|
||||
@ -100,7 +106,7 @@ const Listener = GObject.registerClass({
|
||||
path: `/org/gnome/desktop/notifications/application/${app}/`,
|
||||
});
|
||||
|
||||
const appInfo = Gio.DesktopAppInfo.new(
|
||||
const appInfo = GioUnix.DesktopAppInfo.new(
|
||||
appSettings.get_string('application-id')
|
||||
);
|
||||
|
||||
@ -140,10 +146,10 @@ const Listener = GObject.registerClass({
|
||||
}
|
||||
|
||||
/**
|
||||
* Try and find a well-known name for @sender on the session bus
|
||||
* Try and find a well-known name for {@link sender} on the session bus
|
||||
*
|
||||
* @param {string} sender - A DBus unique name (eg. :1.2282)
|
||||
* @param {string} appName - @appName passed to Notify() (Optional)
|
||||
* @param {string} appName - appName passed to Notify() (Optional)
|
||||
* @returns {string} A well-known name or %null
|
||||
*/
|
||||
async _getAppId(sender, appName) {
|
||||
@ -185,7 +191,7 @@ const Listener = GObject.registerClass({
|
||||
}
|
||||
|
||||
/**
|
||||
* Try and find the application name for @sender
|
||||
* Try and find the application name for {@link sender}
|
||||
*
|
||||
* @param {string} sender - A DBus unique name
|
||||
* @param {string} [appName] - `appName` supplied by Notify()
|
||||
@ -198,7 +204,7 @@ const Listener = GObject.registerClass({
|
||||
|
||||
try {
|
||||
const appId = await this._getAppId(sender, appName);
|
||||
const appInfo = Gio.DesktopAppInfo.new(`${appId}.desktop`);
|
||||
const appInfo = GioUnix.DesktopAppInfo.new(`${appId}.desktop`);
|
||||
this._names[appName] = appInfo.get_name();
|
||||
appName = appInfo.get_name();
|
||||
} catch {
|
||||
@ -213,10 +219,26 @@ const Listener = GObject.registerClass({
|
||||
*
|
||||
* @param {DBus.Interface} iface - The DBus interface
|
||||
* @param {string} name - The DBus method name
|
||||
* @param {GLib.Variant} parameters - The method parameters
|
||||
* @param {Gio.DBusMethodInvocation} invocation - The method invocation info
|
||||
* @param {GLib.Variant|Gio.DBusMethodInvocation} param1 - The method parameters or invocation (GNOME 50+ changed order)
|
||||
* @param {Gio.DBusMethodInvocation|GLib.Variant} param2 - The method invocation or parameters (GNOME 50+ changed order)
|
||||
*/
|
||||
async _onHandleMethodCall(iface, name, parameters, invocation) {
|
||||
async _onHandleMethodCall(iface, name, param1, param2) {
|
||||
let invocation, parameters;
|
||||
|
||||
// GNOME 50+ changed the callback signature from
|
||||
// (iface, name, parameters, invocation) to
|
||||
// (iface, name, invocation, parameters)
|
||||
// Detect which order is being used
|
||||
if (param1 instanceof GLib.Variant) {
|
||||
// Old order: parameters, invocation
|
||||
parameters = param1;
|
||||
invocation = param2;
|
||||
} else {
|
||||
// New order: invocation, parameters
|
||||
invocation = param1;
|
||||
parameters = param2;
|
||||
}
|
||||
|
||||
try {
|
||||
// Check if notifications are disabled in desktop settings
|
||||
if (!this._settings.get_boolean('show-banners'))
|
||||
@ -357,7 +379,7 @@ const Listener = GObject.registerClass({
|
||||
if (application === 'org.gnome.Shell.Extensions.GSConnect')
|
||||
return;
|
||||
|
||||
const appInfo = Gio.DesktopAppInfo.new(`${application}.desktop`);
|
||||
const appInfo = GioUnix.DesktopAppInfo.new(`${application}.desktop`);
|
||||
|
||||
// Try to get an icon for the notification
|
||||
if (!notification.hasOwnProperty('icon'))
|
||||
|
||||
@ -80,7 +80,7 @@ class Stream {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gradually raise or lower the stream volume to @value
|
||||
* Gradually raise or lower the stream volume to {@link value}
|
||||
*
|
||||
* @param {number} value - A number in the range 0-1
|
||||
* @param {number} [duration] - Duration to fade in seconds
|
||||
|
||||
@ -107,7 +107,7 @@ export class Packet {
|
||||
/**
|
||||
* Check if the packet has a payload.
|
||||
*
|
||||
* @returns {boolean} %true if @packet has a payload
|
||||
* @returns {boolean} %true if the packet has a payload
|
||||
*/
|
||||
hasPayload() {
|
||||
if (!this.hasOwnProperty('payloadSize'))
|
||||
@ -386,7 +386,7 @@ export const ChannelService = GObject.registerClass({
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcast directly to @address or the whole network if %null
|
||||
* Broadcast directly to {@link address} or the whole network if %null
|
||||
*
|
||||
* @param {string} [address] - A string address
|
||||
*/
|
||||
|
||||
@ -17,7 +17,11 @@ import('gi://GIRepository?version=3.0').catch(() => {
|
||||
import('gi://GIRepository?version=2.0').catch(() => {});
|
||||
});
|
||||
|
||||
import('gi://GioUnix?version=2.0').catch(() => {}); // Set version for optional dependency
|
||||
// DesktopAppInfo is no longer in Gio in GNOME 49
|
||||
let GioUnix;
|
||||
GioUnix = import('gi://GioUnix?version=2.0').catch(() => {
|
||||
GioUnix = Gio;
|
||||
});
|
||||
|
||||
import system from 'system';
|
||||
|
||||
@ -206,10 +210,11 @@ const Service = GObject.registerClass({
|
||||
}
|
||||
|
||||
_preferences() {
|
||||
Gio.Subprocess.new(
|
||||
[`${Config.PACKAGE_DATADIR}/gsconnect-preferences`],
|
||||
Gio.SubprocessFlags.NONE
|
||||
const _launcher = Gio.SubprocessLauncher.new(
|
||||
{flags: Gio.SubprocessFlags.NONE}
|
||||
);
|
||||
_launcher.set_cwd(Config.PACKAGE_DATADIR);
|
||||
_launcher.spawnv(['gjs', '-m', 'gsconnect-preferences.js']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -296,7 +301,7 @@ const Service = GObject.registerClass({
|
||||
|
||||
// Ensure our handlers are registered
|
||||
try {
|
||||
const appInfo = Gio.DesktopAppInfo.new(`${Config.APP_ID}.desktop`);
|
||||
const appInfo = GioUnix.DesktopAppInfo.new(`${Config.APP_ID}.desktop`);
|
||||
appInfo.add_supports_type('x-scheme-handler/sms');
|
||||
appInfo.add_supports_type('x-scheme-handler/tel');
|
||||
} catch (e) {
|
||||
@ -435,6 +440,15 @@ const Service = GObject.registerClass({
|
||||
'<device-id>'
|
||||
);
|
||||
|
||||
this.add_main_option(
|
||||
'name',
|
||||
'n'.charCodeAt(0),
|
||||
GLib.OptionFlags.NONE,
|
||||
GLib.OptionArg.STRING,
|
||||
_('Target Device Name'),
|
||||
'<device-name>'
|
||||
);
|
||||
|
||||
/**
|
||||
* Pairing
|
||||
*/
|
||||
@ -710,6 +724,32 @@ const Service = GObject.registerClass({
|
||||
this._cliAction(device, 'shareText', GLib.Variant.new_string(text));
|
||||
}
|
||||
|
||||
_findDeviceID(name) {
|
||||
const result = Gio.DBus.session.call_sync(
|
||||
'org.gnome.Shell.Extensions.GSConnect',
|
||||
'/org/gnome/Shell/Extensions/GSConnect',
|
||||
'org.freedesktop.DBus.ObjectManager',
|
||||
'GetManagedObjects',
|
||||
null,
|
||||
null,
|
||||
Gio.DBusCallFlags.NONE,
|
||||
-1,
|
||||
null
|
||||
);
|
||||
|
||||
const variant = result.unpack()[0].unpack();
|
||||
let device;
|
||||
|
||||
for (let object of Object.values(variant)) {
|
||||
object = object.recursiveUnpack();
|
||||
device = object['org.gnome.Shell.Extensions.GSConnect.Device'];
|
||||
|
||||
if (name === device.Name)
|
||||
return device.Id;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
vfunc_handle_local_options(options) {
|
||||
try {
|
||||
if (options.contains('version')) {
|
||||
@ -731,11 +771,15 @@ const Service = GObject.registerClass({
|
||||
|
||||
// We need a device for anything else; exit since this is probably
|
||||
// the daemon being started.
|
||||
if (!options.contains('device'))
|
||||
let id = null;
|
||||
if (options.contains('device')) {
|
||||
id = options.lookup_value('device', null).unpack();
|
||||
} else if (options.contains('name')) {
|
||||
const name = options.lookup_value('name', null).unpack();
|
||||
id = this._findDeviceID(name); // May return null if no match found
|
||||
}
|
||||
if (id === null)
|
||||
return -1;
|
||||
|
||||
const id = options.lookup_value('device', null).unpack();
|
||||
|
||||
// Pairing
|
||||
if (options.contains('pair')) {
|
||||
this._cliAction(id, 'pair');
|
||||
|
||||
@ -531,8 +531,8 @@ const Device = GObject.registerClass({
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the position of a GMenuItem with @actionName in the top level of the
|
||||
* device menu.
|
||||
* Get the position of a GMenuItem with {@link actionName} in the top level
|
||||
* of the device menu.
|
||||
*
|
||||
* @param {string} actionName - An action name with scope (eg. device.foo)
|
||||
* @returns {number} An 0-based index or -1 if not found
|
||||
@ -755,7 +755,7 @@ const Device = GObject.registerClass({
|
||||
}
|
||||
|
||||
/**
|
||||
* Reject the transfer payload described by @packet.
|
||||
* Reject the transfer payload described by {@link packet}.
|
||||
*
|
||||
* @param {Core.Packet} packet - A packet
|
||||
* @returns {void}
|
||||
|
||||
@ -194,7 +194,7 @@ String.prototype.toPhoneNumber = function () {
|
||||
* A simple equality check for phone numbers based on `toPhoneNumber()`
|
||||
*
|
||||
* @param {string} number - A phone number string to compare
|
||||
* @returns {boolean} If `this` and @number are equivalent phone numbers
|
||||
* @returns {boolean} If `this` and {@link number} are equivalent phone numbers
|
||||
*/
|
||||
String.prototype.equalsPhoneNumber = function (number) {
|
||||
const a = this.toPhoneNumber();
|
||||
@ -241,7 +241,7 @@ Gio.File.rm_rf = function (file) {
|
||||
/**
|
||||
* Extend GLib.Variant with a static method to recursively pack a variant
|
||||
*
|
||||
* @param {*} [obj] - May be a GLib.Variant, Array, standard Object or literal.
|
||||
* @param {object} [obj] - May be a GLib.Variant, Array, standard Object or literal.
|
||||
* @returns {GLib.Variant} The resulting GVariant
|
||||
*/
|
||||
function _full_pack(obj) {
|
||||
@ -297,8 +297,8 @@ GLib.Variant.full_pack = _full_pack;
|
||||
/**
|
||||
* Extend GLib.Variant with a method to recursively deepUnpack() a variant
|
||||
*
|
||||
* @param {*} [obj] - May be a GLib.Variant, Array, standard Object or literal.
|
||||
* @returns {*} The resulting object
|
||||
* @param {object} [obj] - May be a GLib.Variant, Array, standard Object or literal.
|
||||
* @returns {object} The resulting object
|
||||
*/
|
||||
function _full_unpack(obj) {
|
||||
obj = (obj === undefined) ? this : obj;
|
||||
@ -353,7 +353,7 @@ GLib.Variant.prototype.full_unpack = _full_unpack;
|
||||
* @param {string} keyPath - Absolute path to a private key in PEM format
|
||||
* @param {string} commonName - A unique common name for the certificate
|
||||
* @returns {Gio.TlsCertificate} A TLS certificate
|
||||
* @throws MissingOpensslError on missing openssl binary
|
||||
* @throws {MissingOpensslError} on missing openssl binary
|
||||
*/
|
||||
Gio.TlsCertificate.new_for_paths = function (certPath, keyPath, commonName = null) {
|
||||
if (GLib.find_program_in_path(Config.OPENSSL_PATH) === null) {
|
||||
|
||||
@ -394,7 +394,7 @@ const Manager = GObject.registerClass({
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a device for @packet, creating it and adding it to the list of
|
||||
* Return a device for {@link packet}, creating it and adding it to the list of
|
||||
* of known devices if it doesn't exist.
|
||||
*
|
||||
* @param {Core.Packet} packet - An identity packet for the device
|
||||
|
||||
@ -440,7 +440,7 @@ const ContactsPlugin = GObject.registerClass({
|
||||
}
|
||||
|
||||
/**
|
||||
* Request the vCards for @uids.
|
||||
* Request the vCards for {@link uids}.
|
||||
*
|
||||
* @param {string[]} uids - A list of contact UIDs
|
||||
*/
|
||||
|
||||
@ -316,7 +316,7 @@ const MousepadPlugin = GObject.registerClass({
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an echo/ACK of @input, if requested
|
||||
* Send an echo/ACK of {@link input}, if requested
|
||||
*
|
||||
* @param {object} input - The body of a 'kdeconnect.mousepad.request'
|
||||
*/
|
||||
|
||||
@ -120,7 +120,7 @@ const RunCommandPlugin = GObject.registerClass({
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a request to execute the local command with the UUID @key
|
||||
* Handle a request to execute the local command with the UUID {@link key}
|
||||
*
|
||||
* @param {string} key - The UUID of the local command
|
||||
*/
|
||||
@ -233,7 +233,7 @@ const RunCommandPlugin = GObject.registerClass({
|
||||
commands() {}
|
||||
|
||||
/**
|
||||
* Send a request to execute the remote command with the UUID @key
|
||||
* Send a request to execute the remote command with the UUID {@link key}
|
||||
*
|
||||
* @param {string} key - The UUID of the remote command
|
||||
*/
|
||||
|
||||
@ -263,8 +263,8 @@ const SFTPPlugin = GObject.registerClass({
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all host keys from ~/.ssh/known_hosts for @host in the port range
|
||||
* used by KDE Connect (1739-1764).
|
||||
* Remove all host keys from ~/.ssh/known_hosts for {@link host} in the
|
||||
* port range used by KDE Connect (1739-1764).
|
||||
*
|
||||
* @param {string} host - A hostname or IP address
|
||||
*/
|
||||
|
||||
@ -506,7 +506,7 @@ const SMSPlugin = GObject.registerClass({
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to find a thread_id in @smsPlugin for @addresses.
|
||||
* Try to find a thread_id in for {@link addresses}.
|
||||
*
|
||||
* @param {object[]} addresses - a list of address objects
|
||||
* @returns {string|null} a thread ID
|
||||
|
||||
@ -113,7 +113,7 @@ const SystemVolumePlugin = GObject.registerClass({
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the cache for @stream
|
||||
* Update the cache for {@link stream}
|
||||
*
|
||||
* @param {"Gvc.MixerStream"} stream - The stream to cache
|
||||
* @returns {object} The updated cache object
|
||||
|
||||
@ -14,7 +14,7 @@ import system from 'system';
|
||||
/**
|
||||
* Return a random color
|
||||
*
|
||||
* @param {*} [salt] - If not %null, will be used as salt for generating a color
|
||||
* @param {string} [salt] - If not %null, will be used as salt for generating a color
|
||||
* @param {number} alpha - A value in the [0...1] range for the alpha channel
|
||||
* @returns {Gdk.RGBA} A new Gdk.RGBA object generated from the input
|
||||
*/
|
||||
@ -72,8 +72,8 @@ function getFgRGBA(rgba) {
|
||||
|
||||
|
||||
/**
|
||||
* Get a GdkPixbuf for @path, allowing the corrupt JPEG's KDE Connect sometimes
|
||||
* sends. This function is synchronous.
|
||||
* Get a GdkPixbuf for {@link path}, allowing the corrupt JPEG's KDE Connect
|
||||
* sometimes sends. This function is synchronous.
|
||||
*
|
||||
* @param {string} path - A local file path
|
||||
* @param {number} size - Size in pixels
|
||||
@ -159,7 +159,7 @@ function getNumberTypeLabel(type) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a display number from @contact for @address.
|
||||
* Get a display number from {@link contact} for {@link address}.
|
||||
*
|
||||
* @param {object} contact - A contact object
|
||||
* @param {string} address - A phone number
|
||||
|
||||
@ -1077,7 +1077,7 @@ export const Window = GObject.registerClass({
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the thread row for @contacts
|
||||
* Find the thread row for {@link contacts}
|
||||
*
|
||||
* @param {object[]} contacts - A contact group
|
||||
* @returns {ConversationSummary|null} The thread row or %null
|
||||
@ -1160,7 +1160,7 @@ export const Window = GObject.registerClass({
|
||||
}
|
||||
|
||||
/**
|
||||
* Try and find an existing conversation widget for @message.
|
||||
* Try and find an existing conversation widget for {@link message}.
|
||||
*
|
||||
* @param {object} message - A message object
|
||||
* @returns {Conversation|null} A conversation widget or %null
|
||||
@ -1202,8 +1202,8 @@ export const Window = GObject.registerClass({
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the contents of the message entry. If @pending is %false set the
|
||||
* message of the currently selected conversation, otherwise mark the
|
||||
* Set the contents of the message entry. If {@link pending} is %false set
|
||||
* the message of the currently selected conversation, otherwise mark the
|
||||
* message to be set for the next selected conversation.
|
||||
*
|
||||
* @param {string} message - The message to place in the entry
|
||||
|
||||
@ -111,11 +111,26 @@ export const Interface = GObject.registerClass({
|
||||
* @param {Gio.DBusInterfaceInfo} info - The DBus interface
|
||||
* @param {Gio.DBusInterface} iface - The DBus interface
|
||||
* @param {string} name - The DBus method name
|
||||
* @param {GLib.Variant} parameters - The method parameters
|
||||
* @param {Gio.DBusMethodInvocation} invocation - The method invocation info
|
||||
* @param {GLib.Variant|Gio.DBusMethodInvocation} param1 - The method parameters or invocation (GNOME 50+ changed order)
|
||||
* @param {Gio.DBusMethodInvocation|GLib.Variant} param2 - The method invocation or parameters (GNOME 50+ changed order)
|
||||
*/
|
||||
async _call(info, iface, name, parameters, invocation) {
|
||||
async _call(info, iface, name, param1, param2) {
|
||||
let retval;
|
||||
let invocation, parameters;
|
||||
|
||||
// GNOME 50+ changed the callback signature from
|
||||
// (iface, name, parameters, invocation) to
|
||||
// (iface, name, invocation, parameters)
|
||||
// Detect which order is being used
|
||||
if (param1 instanceof GLib.Variant) {
|
||||
// Old order: parameters, invocation
|
||||
parameters = param1;
|
||||
invocation = param2;
|
||||
} else {
|
||||
// New order: invocation, parameters
|
||||
invocation = param1;
|
||||
parameters = param2;
|
||||
}
|
||||
|
||||
// Invoke the instance method
|
||||
try {
|
||||
@ -241,7 +256,7 @@ export const Interface = GObject.registerClass({
|
||||
});
|
||||
|
||||
/**
|
||||
* Get a new, dedicated DBus connection on @busType
|
||||
* Get a new, dedicated DBus connection on {@link busType}
|
||||
*
|
||||
* @param {Gio.BusType} [busType] - a Gio.BusType constant
|
||||
* @param {Gio.Cancellable} [cancellable] - an optional Gio.Cancellable
|
||||
|
||||
@ -74,9 +74,9 @@ const _numberRegex = new RegExp(
|
||||
|
||||
|
||||
/**
|
||||
* Searches @str for URLs and returns an array of objects with %url
|
||||
* Searches {@link str} for URLs and returns an array of objects with %url
|
||||
* properties showing the matched URL string, and %pos properties indicating
|
||||
* the position within @str where the URL was found.
|
||||
* the position within {@link str} where the URL was found.
|
||||
*
|
||||
* @param {string} str - the string to search
|
||||
* @returns {object[]} the list of match objects, as described above
|
||||
|
||||
@ -137,8 +137,23 @@ export const Clipboard = GObject.registerClass({
|
||||
}
|
||||
}
|
||||
|
||||
async _onHandleMethodCall(iface, name, parameters, invocation) {
|
||||
async _onHandleMethodCall(iface, name, param1, param2) {
|
||||
let retval;
|
||||
let invocation, parameters;
|
||||
|
||||
// GNOME 50+ changed the callback signature from
|
||||
// (iface, name, parameters, invocation) to
|
||||
// (iface, name, invocation, parameters)
|
||||
// Detect which order is being used
|
||||
if (param1 instanceof GLib.Variant) {
|
||||
// Old order: parameters, invocation
|
||||
parameters = param1;
|
||||
invocation = param2;
|
||||
} else {
|
||||
// New order: invocation, parameters
|
||||
invocation = param1;
|
||||
parameters = param2;
|
||||
}
|
||||
|
||||
try {
|
||||
const args = parameters.recursiveUnpack();
|
||||
@ -267,7 +282,7 @@ export const Clipboard = GObject.registerClass({
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the content of the clipboard with the type @mimetype.
|
||||
* Get the content of the clipboard with the type {@link mimetype}.
|
||||
*
|
||||
* @param {string} mimetype - the mimetype to request
|
||||
* @returns {Promise<Uint8Array>} The content of the clipboard
|
||||
@ -296,7 +311,8 @@ export const Clipboard = GObject.registerClass({
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the content of the clipboard to @value with the type @mimetype.
|
||||
* Set the content of the clipboard to {@link value} with the type
|
||||
* {@link mimetype}.
|
||||
*
|
||||
* @param {Uint8Array} value - the value to set
|
||||
* @param {string} mimetype - the mimetype of the value
|
||||
|
||||
@ -19,7 +19,7 @@ import Tooltip from './tooltip.js';
|
||||
* Get a dictionary of a GMenuItem's attributes
|
||||
*
|
||||
* @param {Gio.MenuModel} model - The menu model containing the item
|
||||
* @param {number} index - The index of the item in @model
|
||||
* @param {number} index - The index of the item in {@link model}
|
||||
* @returns {object} A dictionary of the item's attributes
|
||||
*/
|
||||
function getItemInfo(model, index) {
|
||||
|
||||
@ -6,6 +6,10 @@ import * as Main from 'resource:///org/gnome/shell/ui/main.js';
|
||||
import Meta from 'gi://Meta';
|
||||
import Shell from 'gi://Shell';
|
||||
|
||||
/**
|
||||
* @callback KeybindingCallback
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Keybindings.Manager is a simple convenience class for managing keyboard
|
||||
@ -48,8 +52,8 @@ export class Manager {
|
||||
* Add a keybinding with callback
|
||||
*
|
||||
* @param {string} accelerator - An accelerator in the form '<Control>q'
|
||||
* @param {Function} callback - A callback for the accelerator
|
||||
* @returns {*} A non-zero action id on success, or 0 on failure
|
||||
* @param {KeybindingCallback} callback - A callback for the accelerator
|
||||
* @returns {number} A non-zero action id on success, or 0 on failure
|
||||
*/
|
||||
add(accelerator, callback) {
|
||||
try {
|
||||
@ -65,6 +69,7 @@ export class Manager {
|
||||
return action;
|
||||
} catch (e) {
|
||||
logError(e);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ import {gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js'
|
||||
import {HAS_MESSAGELIST_NOTIFICATIONMESSAGE, getIcon} from './utils.js';
|
||||
|
||||
const {NotificationMessage} = HAS_MESSAGELIST_NOTIFICATIONMESSAGE
|
||||
? await import('resource:///org/gnome/shell/ui/messageList.js') // GNOME 48
|
||||
? await import('resource:///org/gnome/shell/ui/messageList.js') // GNOME 48+
|
||||
: await import('resource:///org/gnome/shell/ui/calendar.js'); // GNOME 46/47
|
||||
|
||||
const APP_ID = 'org.gnome.Shell.Extensions.GSConnect';
|
||||
|
||||
@ -106,8 +106,23 @@ export const Clipboard = GObject.registerClass(
|
||||
}
|
||||
}
|
||||
|
||||
async _onHandleMethodCall(iface, name, parameters, invocation) {
|
||||
async _onHandleMethodCall(iface, name, param1, param2) {
|
||||
let retval;
|
||||
let invocation, parameters;
|
||||
|
||||
// GNOME 50+ changed the callback signature from
|
||||
// (iface, name, parameters, invocation) to
|
||||
// (iface, name, invocation, parameters)
|
||||
// Detect which order is being used
|
||||
if (param1 instanceof GLib.Variant) {
|
||||
// Old order: parameters, invocation
|
||||
parameters = param1;
|
||||
invocation = param2;
|
||||
} else {
|
||||
// New order: invocation, parameters
|
||||
invocation = param1;
|
||||
parameters = param2;
|
||||
}
|
||||
|
||||
try {
|
||||
const args = parameters.recursiveUnpack();
|
||||
|
||||
Reference in New Issue
Block a user