Blame SOURCES/0001-shellDBus-Add-a-DBus-method-to-load-a-single-extensi.patch

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