shellDBus: Add UserExtensionsEnabled property
The 'disable-user-extensions' GSettings key is the last extensions-related setting that isn't exposed over D-Bus, and therefore requires consumers to access the GSettings directly. Expose the setting as UserExtensionsEnabled readwrite property in the org.gnome.Shell.Extensions interface to allow consumers to manage extensions purely via D-Bus. The 'disable-user-extensions' setting is the last extension-related bit from the org.gnome.shell GSettings schema that is not exposed via D-Bus. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1074
This commit is contained in:
parent
1a0ec782b5
commit
3a39fb5ab8
@ -234,5 +234,11 @@
|
|||||||
-->
|
-->
|
||||||
<property name="ShellVersion" type="s" access="read"/>
|
<property name="ShellVersion" type="s" access="read"/>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
UserExtensionsEnabled:
|
||||||
|
Whether user extensions are enabled
|
||||||
|
-->
|
||||||
|
<property name="UserExtensionsEnabled" type="b" access="readwrite"/>
|
||||||
|
|
||||||
</interface>
|
</interface>
|
||||||
</node>
|
</node>
|
||||||
|
@ -255,6 +255,17 @@ var GnomeShellExtensions = class {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(GnomeShellExtensionsIface, this);
|
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(GnomeShellExtensionsIface, this);
|
||||||
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/Shell');
|
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/Shell');
|
||||||
|
|
||||||
|
this._userExtensionsEnabled = this.UserExtensionsEnabled;
|
||||||
|
global.settings.connect('changed::disable-user-extensions', () => {
|
||||||
|
if (this._userExtensionsEnabled === this.UserExtensionsEnabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this._userExtensionsEnabled = this.UserExtensionsEnabled;
|
||||||
|
this._dbusImpl.emit_property_changed('UserExtensionsEnabled',
|
||||||
|
new GLib.Variant('b', this._userExtensionsEnabled));
|
||||||
|
});
|
||||||
|
|
||||||
Main.extensionManager.connect('extension-state-changed',
|
Main.extensionManager.connect('extension-state-changed',
|
||||||
this._extensionStateChanged.bind(this));
|
this._extensionStateChanged.bind(this));
|
||||||
}
|
}
|
||||||
@ -325,6 +336,14 @@ var GnomeShellExtensions = class {
|
|||||||
return Config.PACKAGE_VERSION;
|
return Config.PACKAGE_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get UserExtensionsEnabled() {
|
||||||
|
return !global.settings.get_boolean('disable-user-extensions');
|
||||||
|
}
|
||||||
|
|
||||||
|
set UserExtensionsEnabled(enable) {
|
||||||
|
global.settings.set_boolean('disable-user-extensions', !enable);
|
||||||
|
}
|
||||||
|
|
||||||
_extensionStateChanged(_, newState) {
|
_extensionStateChanged(_, newState) {
|
||||||
let state = ExtensionUtils.serializeExtension(newState);
|
let state = ExtensionUtils.serializeExtension(newState);
|
||||||
this._dbusImpl.emit_signal('ExtensionStateChanged',
|
this._dbusImpl.emit_signal('ExtensionStateChanged',
|
||||||
|
Loading…
Reference in New Issue
Block a user