[gnome] Update extensions for version 48
This commit is contained in:
@ -7,6 +7,7 @@ import GLib from 'gi://GLib';
|
||||
import GObject from 'gi://GObject';
|
||||
|
||||
import Config from '../config.js';
|
||||
import * as Core from './core.js';
|
||||
import * as DBus from './utils/dbus.js';
|
||||
import Device from './device.js';
|
||||
|
||||
@ -42,6 +43,13 @@ const Manager = GObject.registerClass({
|
||||
GObject.ParamFlags.READWRITE,
|
||||
false
|
||||
),
|
||||
'certificate': GObject.ParamSpec.object(
|
||||
'certificate',
|
||||
'Certificate',
|
||||
'The local TLS certificate',
|
||||
GObject.ParamFlags.READABLE,
|
||||
Gio.TlsCertificate
|
||||
),
|
||||
'discoverable': GObject.ParamSpec.boolean(
|
||||
'discoverable',
|
||||
'Discoverable',
|
||||
@ -53,7 +61,7 @@ const Manager = GObject.registerClass({
|
||||
'id',
|
||||
'Id',
|
||||
'The hostname or other network unique id',
|
||||
GObject.ParamFlags.READWRITE,
|
||||
GObject.ParamFlags.READABLE,
|
||||
null
|
||||
),
|
||||
'name': GObject.ParamSpec.string(
|
||||
@ -92,6 +100,17 @@ const Manager = GObject.registerClass({
|
||||
return this._backends;
|
||||
}
|
||||
|
||||
get certificate() {
|
||||
if (this._certificate === undefined) {
|
||||
this._certificate = Gio.TlsCertificate.new_for_paths(
|
||||
GLib.build_filenamev([Config.CONFIGDIR, 'certificate.pem']),
|
||||
GLib.build_filenamev([Config.CONFIGDIR, 'private.pem']),
|
||||
null);
|
||||
}
|
||||
|
||||
return this._certificate;
|
||||
}
|
||||
|
||||
get debug() {
|
||||
if (this._debug === undefined)
|
||||
this._debug = this.settings.get_boolean('debug');
|
||||
@ -156,18 +175,7 @@ const Manager = GObject.registerClass({
|
||||
}
|
||||
|
||||
get id() {
|
||||
if (this._id === undefined)
|
||||
this._id = this.settings.get_string('id');
|
||||
|
||||
return this._id;
|
||||
}
|
||||
|
||||
set id(value) {
|
||||
if (this.id === value)
|
||||
return;
|
||||
|
||||
this._id = value;
|
||||
this.notify('id');
|
||||
return this.certificate.common_name;
|
||||
}
|
||||
|
||||
get name() {
|
||||
@ -217,17 +225,12 @@ const Manager = GObject.registerClass({
|
||||
* GSettings
|
||||
*/
|
||||
_initSettings() {
|
||||
// Initialize the ID and name of the service
|
||||
if (this.settings.get_string('id').length === 0)
|
||||
this.settings.set_string('id', GLib.uuid_string_random());
|
||||
|
||||
if (this.settings.get_string('name').length === 0)
|
||||
this.settings.set_string('name', GLib.get_host_name());
|
||||
|
||||
// Bound Properties
|
||||
this.settings.bind('debug', this, 'debug', 0);
|
||||
this.settings.bind('discoverable', this, 'discoverable', 0);
|
||||
this.settings.bind('id', this, 'id', 0);
|
||||
this.settings.bind('name', this, 'name', 0);
|
||||
}
|
||||
|
||||
@ -382,7 +385,7 @@ const Manager = GObject.registerClass({
|
||||
* of known devices if it doesn't exist.
|
||||
*
|
||||
* @param {Core.Packet} packet - An identity packet for the device
|
||||
* @return {Device} A device object
|
||||
* @returns {Device} A device object
|
||||
*/
|
||||
_ensureDevice(packet) {
|
||||
let device = this.devices.get(packet.body.deviceId);
|
||||
@ -422,7 +425,7 @@ const Manager = GObject.registerClass({
|
||||
*/
|
||||
_removeDevice(id) {
|
||||
// Delete all GSettings
|
||||
const settings_path = `/org/gnome/shell/extensions/gsconnect/${id}/`;
|
||||
const settings_path = `/org/gnome/shell/extensions/gsconnect/device/${id}/`;
|
||||
GLib.spawn_command_line_async(`dconf reset -f ${settings_path}`);
|
||||
|
||||
// Delete the cache
|
||||
@ -438,7 +441,7 @@ const Manager = GObject.registerClass({
|
||||
* A GSourceFunc that tries to reconnect to each paired device, while
|
||||
* pruning unpaired devices that have disconnected.
|
||||
*
|
||||
* @return {boolean} Always %true
|
||||
* @returns {boolean} Always %true
|
||||
*/
|
||||
_reconnect() {
|
||||
for (const [id, device] of this.devices) {
|
||||
|
||||
Reference in New Issue
Block a user