|
|
c7fac9 |
From f6023e2f4ae939a03bb9285e32444be909340bcf Mon Sep 17 00:00:00 2001
|
|
|
c7fac9 |
From: Rui Matos <tiagomatos@gmail.com>
|
|
|
c7fac9 |
Date: Fri, 8 Nov 2013 11:36:04 +0100
|
|
|
c7fac9 |
Subject: [PATCH] shellDBus: Add a DBus method to load a single extension
|
|
|
c7fac9 |
|
|
|
c7fac9 |
This allows e.g. gnome-tweak-tool to install an extension from a zip
|
|
|
c7fac9 |
file and load it into the running shell.
|
|
|
c7fac9 |
---
|
|
|
c7fac9 |
js/ui/shellDBus.js | 20 ++++++++++++++++++++
|
|
|
c7fac9 |
1 file changed, 20 insertions(+)
|
|
|
c7fac9 |
|
|
|
c7fac9 |
diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js
|
|
|
c7fac9 |
index c35e7f19c..3a095ae5c 100644
|
|
|
c7fac9 |
--- a/js/ui/shellDBus.js
|
|
|
c7fac9 |
+++ b/js/ui/shellDBus.js
|
|
|
c7fac9 |
@@ -322,6 +322,10 @@ const GnomeShellExtensionsIface = '<node> \
|
|
|
c7fac9 |
</method> \
|
|
|
c7fac9 |
<method name="CheckForUpdates"> \
|
|
|
c7fac9 |
</method> \
|
|
|
c7fac9 |
+<method name="LoadUserExtension"> \
|
|
|
c7fac9 |
+ <arg type="s" direction="in" name="uuid"/> \
|
|
|
c7fac9 |
+ <arg type="b" direction="out" name="success"/> \
|
|
|
c7fac9 |
+</method> \
|
|
|
c7fac9 |
<property name="ShellVersion" type="s" access="read" /> \
|
|
|
c7fac9 |
</interface> \
|
|
|
c7fac9 |
</node>';
|
|
|
c7fac9 |
@@ -424,6 +428,22 @@ var GnomeShellExtensions = new Lang.Class({
|
|
|
c7fac9 |
ExtensionDownloader.checkForUpdates();
|
|
|
c7fac9 |
},
|
|
|
c7fac9 |
|
|
|
c7fac9 |
+ LoadUserExtension(uuid) {
|
|
|
c7fac9 |
+ let extension = ExtensionUtils.extensions[uuid];
|
|
|
c7fac9 |
+ if (extension)
|
|
|
c7fac9 |
+ return true;
|
|
|
c7fac9 |
+
|
|
|
c7fac9 |
+ let dir = Gio.File.new_for_path(GLib.build_filenamev([global.userdatadir, 'extensions', uuid]));
|
|
|
c7fac9 |
+ try {
|
|
|
c7fac9 |
+ extension = ExtensionUtils.createExtensionObject(uuid, dir, ExtensionUtils.ExtensionType.PER_USER);
|
|
|
c7fac9 |
+ ExtensionSystem.loadExtension(extension);
|
|
|
c7fac9 |
+ } catch (e) {
|
|
|
c7fac9 |
+ log('Could not load user extension from %s'.format(dir.get_path()));
|
|
|
c7fac9 |
+ return false;
|
|
|
c7fac9 |
+ }
|
|
|
c7fac9 |
+ return true;
|
|
|
c7fac9 |
+ },
|
|
|
c7fac9 |
+
|
|
|
c7fac9 |
ShellVersion: Config.PACKAGE_VERSION,
|
|
|
c7fac9 |
|
|
|
c7fac9 |
_extensionStateChanged(_, newState) {
|
|
|
c7fac9 |
--
|
|
|
c7fac9 |
2.20.1
|
|
|
c7fac9 |
|