js: Port dbusUtils to ESM
The module is shared between the various D-Bus services and the main gnome-shell process, so it was originally left out to allow porting different bits at their own speed. Now that everything has been ported to ESM, there is no reason to not move that particular module as well. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2868>
This commit is contained in:
parent
3f80470e26
commit
477011a364
@ -7,7 +7,7 @@ import {ExtensionPrefsDialog} from './extensionPrefsDialog.js';
|
||||
import {ServiceImplementation} from './dbusService.js';
|
||||
|
||||
import {deserializeExtension} from './misc/extensionUtils.js';
|
||||
const {loadInterfaceXML} = imports.misc.dbusUtils;
|
||||
import {loadInterfaceXML} from './misc/dbusUtils.js';
|
||||
|
||||
const ExtensionsIface = loadInterfaceXML('org.gnome.Shell.Extensions');
|
||||
const ExtensionsProxy = Gio.DBusProxy.makeProxyWrapper(ExtensionsIface);
|
||||
|
@ -4,7 +4,7 @@ import GLib from 'gi://GLib';
|
||||
|
||||
import {ServiceImplementation} from './dbusService.js';
|
||||
|
||||
const {loadInterfaceXML} = imports.misc.dbusUtils;
|
||||
import {loadInterfaceXML} from './misc/dbusUtils.js';
|
||||
|
||||
const NotificationsIface = loadInterfaceXML('org.freedesktop.Notifications');
|
||||
const NotificationsProxy = Gio.DBusProxy.makeProxyWrapper(NotificationsIface);
|
||||
|
@ -6,7 +6,7 @@ import Gtk from 'gi://Gtk?version=4.0';
|
||||
|
||||
import {ServiceImplementation} from './dbusService.js';
|
||||
|
||||
const {loadInterfaceXML, loadSubInterfaceXML} = imports.misc.dbusUtils;
|
||||
import {loadInterfaceXML, loadSubInterfaceXML} from './misc/dbusUtils.js';
|
||||
import * as Signals from './misc/signals.js';
|
||||
|
||||
const ScreencastIface = loadInterfaceXML('org.gnome.Shell.Screencast');
|
||||
|
@ -4,7 +4,7 @@ import GLib from 'gi://GLib';
|
||||
|
||||
import {ServiceImplementation} from './dbusService.js';
|
||||
|
||||
const {loadInterfaceXML} = imports.misc.dbusUtils;
|
||||
import {loadInterfaceXML} from './misc/dbusUtils.js';
|
||||
|
||||
const ScreenSaverIface = loadInterfaceXML('org.gnome.ScreenSaver');
|
||||
const ScreenSaverProxy = Gio.DBusProxy.makeProxyWrapper(ScreenSaverIface);
|
||||
|
@ -1,5 +0,0 @@
|
||||
overrides:
|
||||
- files:
|
||||
- dbusUtils.js
|
||||
parserOptions:
|
||||
sourceType: script
|
@ -1,8 +1,7 @@
|
||||
/* exported loadInterfaceXML, loadSubInterfaceXML */
|
||||
import Gio from 'gi://Gio';
|
||||
import GLib from 'gi://GLib';
|
||||
|
||||
const Config = imports.misc.config;
|
||||
const Gio = imports.gi.Gio;
|
||||
const GLib = imports.gi.GLib;
|
||||
|
||||
let _ifaceResource = null;
|
||||
|
||||
@ -24,7 +23,7 @@ function _ensureIfaceResource() {
|
||||
* @param {string} iface the interface name
|
||||
* @returns {string | null} the XML string or null if it is not found
|
||||
*/
|
||||
function loadInterfaceXML(iface) {
|
||||
export function loadInterfaceXML(iface) {
|
||||
_ensureIfaceResource();
|
||||
|
||||
let uri = `resource:///org/gnome/shell/dbus-interfaces/${iface}.xml`;
|
||||
@ -45,7 +44,7 @@ function loadInterfaceXML(iface) {
|
||||
* @param {string} ifaceFile the interface filename
|
||||
* @returns {string | null} the XML string or null if it is not found
|
||||
*/
|
||||
function loadSubInterfaceXML(iface, ifaceFile) {
|
||||
export function loadSubInterfaceXML(iface, ifaceFile) {
|
||||
let xml = loadInterfaceXML(ifaceFile);
|
||||
if (!xml)
|
||||
return null;
|
||||
|
@ -3,7 +3,7 @@
|
||||
import GLib from 'gi://GLib';
|
||||
import Gio from 'gi://Gio';
|
||||
|
||||
export const {loadInterfaceXML} = imports.misc.dbusUtils;
|
||||
export {loadInterfaceXML} from './dbusUtils.js';
|
||||
|
||||
/**
|
||||
* @typedef {object} SubdirInfo
|
||||
|
@ -11,7 +11,7 @@ import * as Util from '../../misc/util.js';
|
||||
|
||||
import {Spinner} from '../animation.js';
|
||||
import {QuickToggle, SystemIndicator} from '../quickSettings.js';
|
||||
const {loadInterfaceXML} = imports.misc.dbusUtils;
|
||||
import {loadInterfaceXML} from '../../misc/dbusUtils.js';
|
||||
|
||||
const DBUS_NAME = 'org.freedesktop.background.Monitor';
|
||||
const DBUS_OBJECT_PATH = '/org/freedesktop/background/monitor';
|
||||
|
Loading…
Reference in New Issue
Block a user