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

671c89
From 660ebe0125b591355116934ee57b08010e05246c Mon Sep 17 00:00:00 2001
671c89
From: Rui Matos <tiagomatos@gmail.com>
671c89
Date: Fri, 8 Nov 2013 11:36:04 +0100
671c89
Subject: [PATCH] shellDBus: Add a DBus method to load a single extension
671c89
671c89
This allows e.g. gnome-tweak-tool to install an extension from a zip
671c89
file and load it into the running shell.
671c89
---
671c89
 .../org.gnome.Shell.Extensions.xml               | 13 +++++++++++++
671c89
 js/ui/shellDBus.js                               | 16 ++++++++++++++++
671c89
 2 files changed, 29 insertions(+)
671c89
671c89
diff --git a/data/dbus-interfaces/org.gnome.Shell.Extensions.xml b/data/dbus-interfaces/org.gnome.Shell.Extensions.xml
671c89
index 34a65af44..ce69439fc 100644
671c89
--- a/data/dbus-interfaces/org.gnome.Shell.Extensions.xml
671c89
+++ b/data/dbus-interfaces/org.gnome.Shell.Extensions.xml
671c89
@@ -189,6 +189,19 @@
671c89
     -->
671c89
     <method name="CheckForUpdates"/>
671c89
 
671c89
+    
671c89
+       LoadUserExtension:
671c89
+       @uuid: The UUID of the extension
671c89
+       @success: Whether the operation was successful
671c89
+
671c89
+       Load a newly installed user extension
671c89
+    -->
671c89
+
671c89
+    <method name="LoadUserExtension">
671c89
+        <arg type="s" direction="in" name="uuid"/>
671c89
+        <arg type="b" direction="out" name="success"/>
671c89
+    </method>
671c89
+
671c89
     <signal name="ExtensionStatusChanged">
671c89
       <arg type="s" name="uuid"/>
671c89
       <arg type="i" name="state"/>
671c89
diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js
671c89
index 19d07acce..112d60feb 100644
671c89
--- a/js/ui/shellDBus.js
671c89
+++ b/js/ui/shellDBus.js
671c89
@@ -341,6 +341,22 @@ var GnomeShellExtensions = class {
671c89
         ExtensionDownloader.checkForUpdates();
671c89
     }
671c89
 
671c89
+    LoadUserExtension(uuid) {
671c89
+        let extension = ExtensionUtils.extensions[uuid];
671c89
+        if (extension)
671c89
+            return true;
671c89
+
671c89
+        let dir = Gio.File.new_for_path(GLib.build_filenamev([global.userdatadir, 'extensions', uuid]));
671c89
+        try {
671c89
+            extension = ExtensionUtils.createExtensionObject(uuid, dir, ExtensionUtils.ExtensionType.PER_USER);
671c89
+            ExtensionSystem.loadExtension(extension);
671c89
+        } catch (e) {
671c89
+            log('Could not load user extension from %s'.format(dir.get_path()));
671c89
+            return false;
671c89
+        }
671c89
+        return true;
671c89
+    }
671c89
+
671c89
     get ShellVersion() {
671c89
         return Config.PACKAGE_VERSION;
671c89
     }
671c89
-- 
671c89
2.21.0
671c89