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

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