[gnome] Fix version for gjsosk and gsconnect, add impatience
This commit is contained in:
@ -1,71 +0,0 @@
|
||||
// SPDX-FileCopyrightText: GSConnect Developers https://github.com/GSConnect
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
/*
|
||||
* Singleton Tracker
|
||||
*/
|
||||
const Default = new Map();
|
||||
|
||||
|
||||
/**
|
||||
* Acquire a reference to a component. Calls to this function should always be
|
||||
* followed by a call to `release()`.
|
||||
*
|
||||
* @param {string} name - The module name
|
||||
* @return {*} The default instance of a component
|
||||
*/
|
||||
function acquire(name) {
|
||||
let component;
|
||||
|
||||
try {
|
||||
let info = Default.get(name);
|
||||
|
||||
if (info === undefined) {
|
||||
const module = imports.service.components[name];
|
||||
|
||||
info = {
|
||||
instance: new module.Component(),
|
||||
refcount: 0,
|
||||
};
|
||||
|
||||
Default.set(name, info);
|
||||
}
|
||||
|
||||
info.refcount++;
|
||||
component = info.instance;
|
||||
} catch (e) {
|
||||
debug(e, name);
|
||||
}
|
||||
|
||||
return component;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Release a reference on a component. If the caller was the last reference
|
||||
* holder, the component will be freed.
|
||||
*
|
||||
* @param {string} name - The module name
|
||||
* @return {null} A %null value, useful for overriding a traced variable
|
||||
*/
|
||||
function release(name) {
|
||||
try {
|
||||
const info = Default.get(name);
|
||||
|
||||
if (info.refcount === 1) {
|
||||
info.instance.destroy();
|
||||
Default.delete(name);
|
||||
}
|
||||
|
||||
info.refcount--;
|
||||
} catch (e) {
|
||||
debug(e, name);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -2,12 +2,8 @@
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
'use strict';
|
||||
|
||||
imports.gi.versions.Atspi = '2.0';
|
||||
|
||||
const Atspi = imports.gi.Atspi;
|
||||
const Gdk = imports.gi.Gdk;
|
||||
import Atspi from 'gi://Atspi?version=2.0';
|
||||
import Gdk from 'gi://Gdk';
|
||||
|
||||
|
||||
/**
|
||||
@ -30,7 +26,7 @@ const XKeycode = {
|
||||
/**
|
||||
* A thin wrapper around Atspi for X11 sessions without Pipewire support.
|
||||
*/
|
||||
var Controller = class {
|
||||
export default class Controller {
|
||||
constructor() {
|
||||
// Atspi.init() return 2 on fail, but still marks itself as inited. We
|
||||
// uninit before throwing an error otherwise any future call to init()
|
||||
@ -312,5 +308,5 @@ var Controller = class {
|
||||
// Silence errors
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -2,20 +2,21 @@
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
'use strict';
|
||||
|
||||
const Gdk = imports.gi.Gdk;
|
||||
const GLib = imports.gi.GLib;
|
||||
const Gtk = imports.gi.Gtk;
|
||||
const Gio = imports.gi.Gio;
|
||||
const GObject = imports.gi.GObject;
|
||||
import Gdk from 'gi://Gdk';
|
||||
import GLib from 'gi://GLib';
|
||||
import Gtk from 'gi://Gtk';
|
||||
import Gio from 'gi://Gio';
|
||||
import GObject from 'gi://GObject';
|
||||
|
||||
|
||||
const DBUS_NAME = 'org.gnome.Shell.Extensions.GSConnect.Clipboard';
|
||||
const DBUS_PATH = '/org/gnome/Shell/Extensions/GSConnect/Clipboard';
|
||||
|
||||
|
||||
var Clipboard = GObject.registerClass({
|
||||
/**
|
||||
* The service class for this component
|
||||
*/
|
||||
const Clipboard = GObject.registerClass({
|
||||
GTypeName: 'GSConnectClipboard',
|
||||
Properties: {
|
||||
'text': GObject.ParamSpec.string(
|
||||
@ -98,7 +99,7 @@ var Clipboard = GObject.registerClass({
|
||||
if (!globalThis.HAVE_GNOME) {
|
||||
// Directly subscrible signal
|
||||
this.signalHandler = Gio.DBus.session.signal_subscribe(
|
||||
DBUS_NAME,
|
||||
null,
|
||||
DBUS_NAME,
|
||||
'OwnerChange',
|
||||
DBUS_PATH,
|
||||
@ -219,10 +220,6 @@ var Clipboard = GObject.registerClass({
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* The service class for this component
|
||||
*/
|
||||
var Component = Clipboard;
|
||||
export default Clipboard;
|
||||
|
||||
// vim:tabstop=2:shiftwidth=2:expandtab
|
||||
|
||||
@ -2,23 +2,21 @@
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
'use strict';
|
||||
import Gio from 'gi://Gio';
|
||||
import GLib from 'gi://GLib';
|
||||
import GObject from 'gi://GObject';
|
||||
|
||||
const Gio = imports.gi.Gio;
|
||||
const GLib = imports.gi.GLib;
|
||||
const GObject = imports.gi.GObject;
|
||||
import Config from '../../config.js';
|
||||
|
||||
const Config = imports.config;
|
||||
|
||||
var HAVE_EDS = true;
|
||||
var EBook = null;
|
||||
var EBookContacts = null;
|
||||
var EDataServer = null;
|
||||
let HAVE_EDS = true;
|
||||
let EBook = null;
|
||||
let EBookContacts = null;
|
||||
let EDataServer = null;
|
||||
|
||||
try {
|
||||
EBook = imports.gi.EBook;
|
||||
EBookContacts = imports.gi.EBookContacts;
|
||||
EDataServer = imports.gi.EDataServer;
|
||||
EBook = (await import('gi://EBook')).default;
|
||||
EBookContacts = (await import('gi://EBookContacts')).default;
|
||||
EDataServer = (await import('gi://EDataServer')).default;
|
||||
} catch (e) {
|
||||
HAVE_EDS = false;
|
||||
}
|
||||
@ -27,7 +25,7 @@ try {
|
||||
/**
|
||||
* A store for contacts
|
||||
*/
|
||||
var Store = GObject.registerClass({
|
||||
const Store = GObject.registerClass({
|
||||
GTypeName: 'GSConnectContactsStore',
|
||||
Properties: {
|
||||
'context': GObject.ParamSpec.string(
|
||||
@ -611,9 +609,5 @@ var Store = GObject.registerClass({
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* The service class for this component
|
||||
*/
|
||||
var Component = Store;
|
||||
export default Store;
|
||||
|
||||
|
||||
@ -2,15 +2,15 @@
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
'use strict';
|
||||
import Gdk from 'gi://Gdk';
|
||||
import Gio from 'gi://Gio';
|
||||
import GLib from 'gi://GLib';
|
||||
import GObject from 'gi://GObject';
|
||||
|
||||
const Gdk = imports.gi.Gdk;
|
||||
const Gio = imports.gi.Gio;
|
||||
const GLib = imports.gi.GLib;
|
||||
const GObject = imports.gi.GObject;
|
||||
import AtspiController from './atspi.js';
|
||||
|
||||
|
||||
const SESSION_TIMEOUT = 15;
|
||||
const SESSION_TIMEOUT = 300;
|
||||
|
||||
|
||||
const RemoteSession = GObject.registerClass({
|
||||
@ -229,7 +229,7 @@ const RemoteSession = GObject.registerClass({
|
||||
});
|
||||
|
||||
|
||||
class Controller {
|
||||
export default class Controller {
|
||||
constructor() {
|
||||
this._nameAppearedId = 0;
|
||||
this._session = null;
|
||||
@ -339,8 +339,7 @@ class Controller {
|
||||
if (this.connection === null) {
|
||||
debug('Falling back to Atspi');
|
||||
|
||||
const fallback = imports.service.components.atspi;
|
||||
this._session = new fallback.Controller();
|
||||
this._session = new AtspiController();
|
||||
|
||||
// Mutter is available and there isn't another session starting
|
||||
} else if (this._sessionStarting === false) {
|
||||
@ -513,9 +512,3 @@ class Controller {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The service class for this component
|
||||
*/
|
||||
var Component = Controller;
|
||||
|
||||
@ -2,14 +2,12 @@
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
'use strict';
|
||||
|
||||
const Gio = imports.gi.Gio;
|
||||
const GLib = imports.gi.GLib;
|
||||
const GObject = imports.gi.GObject;
|
||||
import Gio from 'gi://Gio';
|
||||
import GLib from 'gi://GLib';
|
||||
import GObject from 'gi://GObject';
|
||||
|
||||
|
||||
var Player = GObject.registerClass({
|
||||
export const Player = GObject.registerClass({
|
||||
GTypeName: 'GSConnectMediaPlayerInterface',
|
||||
Properties: {
|
||||
// Application Properties
|
||||
@ -790,7 +788,7 @@ const PlayerProxy = GObject.registerClass({
|
||||
/**
|
||||
* A manager for media players
|
||||
*/
|
||||
var Manager = GObject.registerClass({
|
||||
const Manager = GObject.registerClass({
|
||||
GTypeName: 'GSConnectMPRISManager',
|
||||
Signals: {
|
||||
'player-added': {
|
||||
@ -1001,5 +999,5 @@ var Manager = GObject.registerClass({
|
||||
/**
|
||||
* The service class for this component
|
||||
*/
|
||||
var Component = Manager;
|
||||
export default Manager;
|
||||
|
||||
|
||||
@ -2,14 +2,12 @@
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
'use strict';
|
||||
import Gio from 'gi://Gio';
|
||||
import GLib from 'gi://GLib';
|
||||
import GjsPrivate from 'gi://GjsPrivate';
|
||||
import GObject from 'gi://GObject';
|
||||
|
||||
const Gio = imports.gi.Gio;
|
||||
const GLib = imports.gi.GLib;
|
||||
const GjsPrivate = imports.gi.GjsPrivate;
|
||||
const GObject = imports.gi.GObject;
|
||||
|
||||
const DBus = imports.service.utils.dbus;
|
||||
import * as DBus from '../utils/dbus.js';
|
||||
|
||||
|
||||
const _nodeInfo = Gio.DBusNodeInfo.new_for_xml(`
|
||||
@ -408,4 +406,4 @@ const Listener = GObject.registerClass({
|
||||
/**
|
||||
* The service class for this component
|
||||
*/
|
||||
var Component = Listener;
|
||||
export default Listener;
|
||||
|
||||
@ -2,40 +2,43 @@
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
'use strict';
|
||||
import GIRepository from 'gi://GIRepository';
|
||||
import GLib from 'gi://GLib';
|
||||
import GObject from 'gi://GObject';
|
||||
|
||||
import Config from '../../config.js';
|
||||
|
||||
const Tweener = imports.tweener.tweener;
|
||||
|
||||
const GIRepository = imports.gi.GIRepository;
|
||||
const GLib = imports.gi.GLib;
|
||||
const GObject = imports.gi.GObject;
|
||||
|
||||
const Config = imports.config;
|
||||
let Gvc = null;
|
||||
try {
|
||||
// Add gnome-shell's typelib dir to the search path
|
||||
const typelibDir = GLib.build_filenamev([Config.GNOME_SHELL_LIBDIR, 'gnome-shell']);
|
||||
GIRepository.Repository.prepend_search_path(typelibDir);
|
||||
GIRepository.Repository.prepend_library_path(typelibDir);
|
||||
|
||||
|
||||
// Add gnome-shell's typelib dir to the search path
|
||||
const typelibDir = GLib.build_filenamev([Config.GNOME_SHELL_LIBDIR, 'gnome-shell']);
|
||||
GIRepository.Repository.prepend_search_path(typelibDir);
|
||||
GIRepository.Repository.prepend_library_path(typelibDir);
|
||||
|
||||
const Gvc = imports.gi.Gvc;
|
||||
Gvc = (await import('gi://Gvc')).default;
|
||||
} catch (e) {}
|
||||
|
||||
|
||||
/**
|
||||
* Extend Gvc.MixerStream with a property for returning a user-visible name
|
||||
*/
|
||||
Object.defineProperty(Gvc.MixerStream.prototype, 'display_name', {
|
||||
get: function () {
|
||||
try {
|
||||
if (!this.get_ports().length)
|
||||
return this.description;
|
||||
if (Gvc) {
|
||||
Object.defineProperty(Gvc.MixerStream.prototype, 'display_name', {
|
||||
get: function () {
|
||||
try {
|
||||
if (!this.get_ports().length)
|
||||
return this.description;
|
||||
|
||||
return `${this.get_port().human_port} (${this.description})`;
|
||||
} catch (e) {
|
||||
return this.description;
|
||||
}
|
||||
},
|
||||
});
|
||||
return `${this.get_port().human_port} (${this.description})`;
|
||||
} catch (e) {
|
||||
return this.description;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -110,7 +113,7 @@ class Stream {
|
||||
* The Mixer class uses GNOME Shell's Gvc library to control the system volume
|
||||
* and offers a few convenience functions.
|
||||
*/
|
||||
const Mixer = GObject.registerClass({
|
||||
const Mixer = !Gvc ? null : GObject.registerClass({
|
||||
GTypeName: 'GSConnectAudioMixer',
|
||||
}, class Mixer extends Gvc.MixerControl {
|
||||
_init(params) {
|
||||
@ -265,4 +268,4 @@ const Mixer = GObject.registerClass({
|
||||
/**
|
||||
* The service class for this component
|
||||
*/
|
||||
var Component = Mixer;
|
||||
export default Mixer;
|
||||
|
||||
@ -2,10 +2,8 @@
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
'use strict';
|
||||
|
||||
const Gio = imports.gi.Gio;
|
||||
const GLib = imports.gi.GLib;
|
||||
import Gio from 'gi://Gio';
|
||||
import GLib from 'gi://GLib';
|
||||
|
||||
|
||||
const Session = class {
|
||||
@ -82,5 +80,5 @@ const Session = class {
|
||||
/**
|
||||
* The service class for this component
|
||||
*/
|
||||
var Component = Session;
|
||||
export default Session;
|
||||
|
||||
|
||||
@ -2,23 +2,17 @@
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
'use strict';
|
||||
import Gdk from 'gi://Gdk';
|
||||
import Gio from 'gi://Gio';
|
||||
import GLib from 'gi://GLib';
|
||||
|
||||
const Gdk = imports.gi.Gdk;
|
||||
const Gio = imports.gi.Gio;
|
||||
const GLib = imports.gi.GLib;
|
||||
let GSound = null;
|
||||
try {
|
||||
GSound = (await import('gi://GSound')).default;
|
||||
} catch (e) {}
|
||||
|
||||
|
||||
/*
|
||||
* Used to ensure 'audible-bell' is enabled for fallback
|
||||
*/
|
||||
const WM_SETTINGS = new Gio.Settings({
|
||||
schema_id: 'org.gnome.desktop.wm.preferences',
|
||||
path: '/org/gnome/desktop/wm/preferences/',
|
||||
});
|
||||
|
||||
|
||||
var Player = class Player {
|
||||
const Player = class Player {
|
||||
|
||||
constructor() {
|
||||
this._playing = new Set();
|
||||
@ -27,22 +21,20 @@ var Player = class Player {
|
||||
get backend() {
|
||||
if (this._backend === undefined) {
|
||||
// Prefer GSound
|
||||
try {
|
||||
this._gsound = new imports.gi.GSound.Context();
|
||||
if (GSound !== null) {
|
||||
this._gsound = new GSound.Context();
|
||||
this._gsound.init(null);
|
||||
this._backend = 'gsound';
|
||||
|
||||
// Try falling back to libcanberra, otherwise just re-run the test
|
||||
// in case one or the other is installed later
|
||||
} catch (e) {
|
||||
if (GLib.find_program_in_path('canberra-gtk-play') !== null) {
|
||||
this._canberra = new Gio.SubprocessLauncher({
|
||||
flags: Gio.SubprocessFlags.NONE,
|
||||
});
|
||||
this._backend = 'libcanberra';
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else if (GLib.find_program_in_path('canberra-gtk-play') !== null) {
|
||||
this._canberra = new Gio.SubprocessLauncher({
|
||||
flags: Gio.SubprocessFlags.NONE,
|
||||
});
|
||||
this._backend = 'libcanberra';
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -176,5 +168,5 @@ var Player = class Player {
|
||||
/**
|
||||
* The service class for this component
|
||||
*/
|
||||
var Component = Player;
|
||||
export default Player;
|
||||
|
||||
|
||||
@ -2,11 +2,9 @@
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
'use strict';
|
||||
|
||||
const Gio = imports.gi.Gio;
|
||||
const GLib = imports.gi.GLib;
|
||||
const GObject = imports.gi.GObject;
|
||||
import Gio from 'gi://Gio';
|
||||
import GLib from 'gi://GLib';
|
||||
import GObject from 'gi://GObject';
|
||||
|
||||
|
||||
/**
|
||||
@ -49,7 +47,7 @@ const DeviceState = {
|
||||
/**
|
||||
* A class representing the system battery.
|
||||
*/
|
||||
var Battery = GObject.registerClass({
|
||||
const Battery = GObject.registerClass({
|
||||
GTypeName: 'GSConnectSystemBattery',
|
||||
Signals: {
|
||||
'changed': {
|
||||
@ -213,5 +211,5 @@ var Battery = GObject.registerClass({
|
||||
/**
|
||||
* The service class for this component
|
||||
*/
|
||||
var Component = Battery;
|
||||
export default Battery;
|
||||
|
||||
|
||||
@ -2,10 +2,8 @@
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
'use strict';
|
||||
|
||||
const Gio = imports.gi.Gio;
|
||||
const Gdk = imports.gi.Gdk;
|
||||
import Gio from 'gi://Gio';
|
||||
import Gdk from 'gi://Gdk';
|
||||
|
||||
const keyCodes = new Map([
|
||||
['1', 2],
|
||||
@ -55,7 +53,7 @@ const keyCodes = new Map([
|
||||
['/', 53],
|
||||
['\\', 43],
|
||||
]);
|
||||
class Controller {
|
||||
export default class Controller {
|
||||
constructor() {
|
||||
// laucher for wl-clipboard
|
||||
this._launcher = new Gio.SubprocessLauncher({
|
||||
@ -137,7 +135,7 @@ class Controller {
|
||||
modifiers_codes.push(input);
|
||||
} else if (typeof input === 'string') {
|
||||
input = input.toUpperCase();
|
||||
for (var i = 0; i < input.length; i++) {
|
||||
for (let i = 0; i < input.length; i++) {
|
||||
if (keyCodes.get(input[i])) {
|
||||
modifiers_codes.push(keyCodes.get(input[i]));
|
||||
} else {
|
||||
@ -160,8 +158,3 @@ class Controller {
|
||||
this._args = [];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The service class for this component
|
||||
*/
|
||||
var Component = Controller;
|
||||
|
||||
Reference in New Issue
Block a user