[gnome-shell/wip/rstrode/login-screen-extensions: 33/134] shellDBus: Add a DBus method to load a single extension
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/rstrode/login-screen-extensions: 33/134] shellDBus: Add a DBus method to load a single extension
- Date: Thu, 26 Aug 2021 19:30:58 +0000 (UTC)
commit d70c095c7ebcf631799863322103f1cd3b5390a1
Author: Rui Matos <tiagomatos gmail com>
Date: Fri Nov 8 11:36:04 2013 +0100
shellDBus: Add a DBus method to load a single extension
This allows e.g. gnome-tweak-tool to install an extension from a zip
file and load it into the running shell.
data/dbus-interfaces/org.gnome.Shell.Extensions.xml | 13 +++++++++++++
js/ui/shellDBus.js | 16 ++++++++++++++++
2 files changed, 29 insertions(+)
---
diff --git a/data/dbus-interfaces/org.gnome.Shell.Extensions.xml
b/data/dbus-interfaces/org.gnome.Shell.Extensions.xml
index 34a65af44c..ce69439fcf 100644
--- a/data/dbus-interfaces/org.gnome.Shell.Extensions.xml
+++ b/data/dbus-interfaces/org.gnome.Shell.Extensions.xml
@@ -189,6 +189,19 @@
-->
<method name="CheckForUpdates"/>
+ <!--
+ LoadUserExtension:
+ @uuid: The UUID of the extension
+ @success: Whether the operation was successful
+
+ Load a newly installed user extension
+ -->
+
+ <method name="LoadUserExtension">
+ <arg type="s" direction="in" name="uuid"/>
+ <arg type="b" direction="out" name="success"/>
+ </method>
+
<signal name="ExtensionStatusChanged">
<arg type="s" name="uuid"/>
<arg type="i" name="state"/>
diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js
index 19d07acce6..112d60feb8 100644
--- a/js/ui/shellDBus.js
+++ b/js/ui/shellDBus.js
@@ -341,6 +341,22 @@ var GnomeShellExtensions = class {
ExtensionDownloader.checkForUpdates();
}
+ LoadUserExtension(uuid) {
+ let extension = ExtensionUtils.extensions[uuid];
+ if (extension)
+ return true;
+
+ let dir = Gio.File.new_for_path(GLib.build_filenamev([global.userdatadir, 'extensions', uuid]));
+ try {
+ extension = ExtensionUtils.createExtensionObject(uuid, dir,
ExtensionUtils.ExtensionType.PER_USER);
+ ExtensionSystem.loadExtension(extension);
+ } catch (e) {
+ log('Could not load user extension from %s'.format(dir.get_path()));
+ return false;
+ }
+ return true;
+ }
+
get ShellVersion() {
return Config.PACKAGE_VERSION;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]