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

21e770
From 660ebe0125b591355116934ee57b08010e05246c 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
---
21e770
 .../org.gnome.Shell.Extensions.xml               | 13 +++++++++++++
21e770
 js/ui/shellDBus.js                               | 16 ++++++++++++++++
21e770
 2 files changed, 29 insertions(+)
c7fac9
21e770
diff --git a/data/dbus-interfaces/org.gnome.Shell.Extensions.xml b/data/dbus-interfaces/org.gnome.Shell.Extensions.xml
21e770
index 34a65af44..ce69439fc 100644
21e770
--- a/data/dbus-interfaces/org.gnome.Shell.Extensions.xml
21e770
+++ b/data/dbus-interfaces/org.gnome.Shell.Extensions.xml
21e770
@@ -189,6 +189,19 @@
21e770
     -->
21e770
     <method name="CheckForUpdates"/>
21e770
 
21e770
+    
21e770
+       LoadUserExtension:
21e770
+       @uuid: The UUID of the extension
21e770
+       @success: Whether the operation was successful
21e770
+
21e770
+       Load a newly installed user extension
21e770
+    -->
21e770
+
21e770
+    <method name="LoadUserExtension">
21e770
+        <arg type="s" direction="in" name="uuid"/>
21e770
+        <arg type="b" direction="out" name="success"/>
21e770
+    </method>
21e770
+
21e770
     <signal name="ExtensionStatusChanged">
21e770
       <arg type="s" name="uuid"/>
21e770
       <arg type="i" name="state"/>
c7fac9
diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js
21e770
index 19d07acce..112d60feb 100644
c7fac9
--- a/js/ui/shellDBus.js
c7fac9
+++ b/js/ui/shellDBus.js
21e770
@@ -341,6 +341,22 @@ var GnomeShellExtensions = class {
c7fac9
         ExtensionDownloader.checkForUpdates();
21e770
     }
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;
21e770
+    }
c7fac9
+
21e770
     get ShellVersion() {
21e770
         return Config.PACKAGE_VERSION;
21e770
     }
c7fac9
-- 
21e770
2.21.0
c7fac9