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

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