|
|
ee8c5c |
From 42d5ff3ec2d18d7239eac8a6ce0544d4f69efab3 Mon Sep 17 00:00:00 2001
|
|
|
ee8c5c |
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
|
|
|
ee8c5c |
Date: Tue, 31 Mar 2020 19:53:50 +0200
|
|
|
ee8c5c |
Subject: [PATCH] extensions-app: Add compatibility with GNOME 3.34
|
|
|
ee8c5c |
|
|
|
ee8c5c |
We are currently relying on 3.36 changes:
|
|
|
ee8c5c |
|
|
|
ee8c5c |
- the addition of the UserExtensionsEnabled property
|
|
|
ee8c5c |
|
|
|
ee8c5c |
- the separate org.gnome.Shell.Extensions name to expose
|
|
|
ee8c5c |
the interface
|
|
|
ee8c5c |
|
|
|
ee8c5c |
In order to work with the previous stable release as well, we can
|
|
|
ee8c5c |
fall back to connecting to gnome-shell itself and changing the
|
|
|
ee8c5c |
underlying GSettings directly.
|
|
|
ee8c5c |
---
|
|
|
ee8c5c |
subprojects/extensions-app/data/meson.build | 2 +
|
|
|
ee8c5c |
.../data/org.gnome.Extensions.gschema.xml | 12 +++++
|
|
|
ee8c5c |
subprojects/extensions-app/js/main.js | 47 +++++++++++++++----
|
|
|
ee8c5c |
subprojects/extensions-app/meson.build | 1 +
|
|
|
ee8c5c |
4 files changed, 54 insertions(+), 8 deletions(-)
|
|
|
ee8c5c |
create mode 100644 subprojects/extensions-app/data/org.gnome.Extensions.gschema.xml
|
|
|
ee8c5c |
|
|
|
ee8c5c |
diff --git a/subprojects/extensions-app/data/meson.build b/subprojects/extensions-app/data/meson.build
|
|
|
ee8c5c |
index 0568fafc8..e9399e3b6 100644
|
|
|
ee8c5c |
--- a/subprojects/extensions-app/data/meson.build
|
|
|
ee8c5c |
+++ b/subprojects/extensions-app/data/meson.build
|
|
|
ee8c5c |
@@ -33,5 +33,7 @@ configure_file(
|
|
|
ee8c5c |
install_dir: servicedir,
|
|
|
ee8c5c |
)
|
|
|
ee8c5c |
|
|
|
ee8c5c |
+install_data(app_id + '.gschema.xml', install_dir: schemadir)
|
|
|
ee8c5c |
+
|
|
|
ee8c5c |
subdir('icons')
|
|
|
ee8c5c |
subdir('metainfo')
|
|
|
ee8c5c |
diff --git a/subprojects/extensions-app/data/org.gnome.Extensions.gschema.xml b/subprojects/extensions-app/data/org.gnome.Extensions.gschema.xml
|
|
|
ee8c5c |
new file mode 100644
|
|
|
ee8c5c |
index 000000000..d70d4bd4c
|
|
|
ee8c5c |
--- /dev/null
|
|
|
ee8c5c |
+++ b/subprojects/extensions-app/data/org.gnome.Extensions.gschema.xml
|
|
|
ee8c5c |
@@ -0,0 +1,12 @@
|
|
|
ee8c5c |
+<schemalist>
|
|
|
ee8c5c |
+ <schema id="org.gnome.shell" path="/org/gnome/shell/">
|
|
|
ee8c5c |
+ <key name="disable-user-extensions" type="b">
|
|
|
ee8c5c |
+ <default>false</default>
|
|
|
ee8c5c |
+ <summary>Disable user extensions</summary>
|
|
|
ee8c5c |
+ <description>
|
|
|
ee8c5c |
+ Disable all extensions the user has enabled without affecting
|
|
|
ee8c5c |
+ the “enabled-extension” setting.
|
|
|
ee8c5c |
+ </description>
|
|
|
ee8c5c |
+ </key>
|
|
|
ee8c5c |
+ </schema>
|
|
|
ee8c5c |
+</schemalist>
|
|
|
ee8c5c |
diff --git a/subprojects/extensions-app/js/main.js b/subprojects/extensions-app/js/main.js
|
|
|
ee8c5c |
index d25df9c57..f5ac2e564 100644
|
|
|
ee8c5c |
--- a/subprojects/extensions-app/js/main.js
|
|
|
ee8c5c |
+++ b/subprojects/extensions-app/js/main.js
|
|
|
ee8c5c |
@@ -47,6 +47,10 @@ class Application extends Gtk.Application {
|
|
|
ee8c5c |
return this._shellProxy;
|
|
|
ee8c5c |
}
|
|
|
ee8c5c |
|
|
|
ee8c5c |
+ get legacyMode() {
|
|
|
ee8c5c |
+ return this._legacyMode;
|
|
|
ee8c5c |
+ }
|
|
|
ee8c5c |
+
|
|
|
ee8c5c |
vfunc_activate() {
|
|
|
ee8c5c |
this._shellProxy.CheckForUpdatesRemote();
|
|
|
ee8c5c |
this._window.present();
|
|
|
ee8c5c |
@@ -69,6 +73,13 @@ class Application extends Gtk.Application {
|
|
|
ee8c5c |
this._shellProxy = new GnomeShellProxy(Gio.DBus.session,
|
|
|
ee8c5c |
'org.gnome.Shell.Extensions', '/org/gnome/Shell/Extensions');
|
|
|
ee8c5c |
|
|
|
ee8c5c |
+ this._legacyMode = this._shellProxy.g_name_owner === null;
|
|
|
ee8c5c |
+
|
|
|
ee8c5c |
+ if (this._legacyMode) {
|
|
|
ee8c5c |
+ this._shellProxy = new GnomeShellProxy(Gio.DBus.session,
|
|
|
ee8c5c |
+ 'org.gnome.Shell', '/org/gnome/Shell');
|
|
|
ee8c5c |
+ }
|
|
|
ee8c5c |
+
|
|
|
ee8c5c |
this._window = new ExtensionsWindow({ application: this });
|
|
|
ee8c5c |
}
|
|
|
ee8c5c |
});
|
|
|
ee8c5c |
@@ -89,6 +100,10 @@ var ExtensionsWindow = GObject.registerClass({
|
|
|
ee8c5c |
_init(params) {
|
|
|
ee8c5c |
super._init(params);
|
|
|
ee8c5c |
|
|
|
ee8c5c |
+ this._settings = this.application.legacyMode
|
|
|
ee8c5c |
+ ? new Gio.Settings({ schema_id: 'org.gnome.shell' })
|
|
|
ee8c5c |
+ : null;
|
|
|
ee8c5c |
+
|
|
|
ee8c5c |
this._updatesCheckId = 0;
|
|
|
ee8c5c |
|
|
|
ee8c5c |
this._exporter = new Shew.WindowExporter({ window: this });
|
|
|
ee8c5c |
@@ -111,7 +126,12 @@ var ExtensionsWindow = GObject.registerClass({
|
|
|
ee8c5c |
});
|
|
|
ee8c5c |
action.connect('activate', toggleState);
|
|
|
ee8c5c |
action.connect('change-state', (a, state) => {
|
|
|
ee8c5c |
- this._shellProxy.UserExtensionsEnabled = state.get_boolean();
|
|
|
ee8c5c |
+ const value = state.get_boolean();
|
|
|
ee8c5c |
+
|
|
|
ee8c5c |
+ if (this._settings)
|
|
|
ee8c5c |
+ this._settings.set_boolean('disable-user-extensions', !value);
|
|
|
ee8c5c |
+ else
|
|
|
ee8c5c |
+ this._shellProxy.UserExtensionsEnabled = value;
|
|
|
ee8c5c |
});
|
|
|
ee8c5c |
this.add_action(action);
|
|
|
ee8c5c |
|
|
|
ee8c5c |
@@ -124,8 +144,13 @@ var ExtensionsWindow = GObject.registerClass({
|
|
|
ee8c5c |
this._shellProxy.connectSignal('ExtensionStateChanged',
|
|
|
ee8c5c |
this._onExtensionStateChanged.bind(this));
|
|
|
ee8c5c |
|
|
|
ee8c5c |
- this._shellProxy.connect('g-properties-changed',
|
|
|
ee8c5c |
- this._onUserExtensionsEnabledChanged.bind(this));
|
|
|
ee8c5c |
+ if (this._settings) {
|
|
|
ee8c5c |
+ this._settings.connect('changed::disable-user-extensions',
|
|
|
ee8c5c |
+ this._onUserExtensionsEnabledChanged.bind(this));
|
|
|
ee8c5c |
+ } else {
|
|
|
ee8c5c |
+ this._shellProxy.connect('g-properties-changed',
|
|
|
ee8c5c |
+ this._onUserExtensionsEnabledChanged.bind(this));
|
|
|
ee8c5c |
+ }
|
|
|
ee8c5c |
this._onUserExtensionsEnabledChanged();
|
|
|
ee8c5c |
|
|
|
ee8c5c |
this._scanExtensions();
|
|
|
ee8c5c |
@@ -166,9 +191,13 @@ var ExtensionsWindow = GObject.registerClass({
|
|
|
ee8c5c |
}
|
|
|
ee8c5c |
}
|
|
|
ee8c5c |
|
|
|
ee8c5c |
- this._shellProxy.OpenExtensionPrefsRemote(uuid,
|
|
|
ee8c5c |
- this._exportedHandle,
|
|
|
ee8c5c |
- { modal: new GLib.Variant('b', true) });
|
|
|
ee8c5c |
+ if (this.application.legacyMode) {
|
|
|
ee8c5c |
+ this._shellProxy.LaunchExtensionPrefsRemote(uuid);
|
|
|
ee8c5c |
+ } else {
|
|
|
ee8c5c |
+ this._shellProxy.OpenExtensionPrefsRemote(uuid,
|
|
|
ee8c5c |
+ this._exportedHandle,
|
|
|
ee8c5c |
+ { modal: new GLib.Variant('b', true) });
|
|
|
ee8c5c |
+ }
|
|
|
ee8c5c |
}
|
|
|
ee8c5c |
|
|
|
ee8c5c |
_showAbout() {
|
|
|
ee8c5c |
@@ -228,8 +257,10 @@ var ExtensionsWindow = GObject.registerClass({
|
|
|
ee8c5c |
|
|
|
ee8c5c |
_onUserExtensionsEnabledChanged() {
|
|
|
ee8c5c |
let action = this.lookup_action('user-extensions-enabled');
|
|
|
ee8c5c |
- action.set_state(
|
|
|
ee8c5c |
- new GLib.Variant('b', this._shellProxy.UserExtensionsEnabled));
|
|
|
ee8c5c |
+ const newState = this._settings
|
|
|
ee8c5c |
+ ? !this._settings.get_boolean('disable-user-extensions')
|
|
|
ee8c5c |
+ : this._shellProxy.UserExtensionsEnabled;
|
|
|
ee8c5c |
+ action.set_state(new GLib.Variant('b', newState));
|
|
|
ee8c5c |
}
|
|
|
ee8c5c |
|
|
|
ee8c5c |
_onExtensionStateChanged(proxy, senderName, [uuid, newState]) {
|
|
|
ee8c5c |
diff --git a/subprojects/extensions-app/meson.build b/subprojects/extensions-app/meson.build
|
|
|
ee8c5c |
index 88536236a..ebf3da942 100644
|
|
|
ee8c5c |
--- a/subprojects/extensions-app/meson.build
|
|
|
ee8c5c |
+++ b/subprojects/extensions-app/meson.build
|
|
|
ee8c5c |
@@ -34,6 +34,7 @@ icondir = join_paths(datadir, 'icons')
|
|
|
ee8c5c |
localedir = join_paths(datadir, 'locale')
|
|
|
ee8c5c |
metainfodir = join_paths(datadir, 'metainfo')
|
|
|
ee8c5c |
servicedir = join_paths(datadir, 'dbus-1', 'services')
|
|
|
ee8c5c |
+schemadir = join_paths(datadir, 'glib-2.0', 'schemas')
|
|
|
ee8c5c |
|
|
|
ee8c5c |
gjs = find_program('gjs')
|
|
|
ee8c5c |
appstream_util = find_program('appstream-util', required: false)
|
|
|
ee8c5c |
--
|
|
|
ee8c5c |
2.25.1
|
|
|
ee8c5c |
|