[gnome-shell/wip/rstrode/rhel-8.0.0: 16/50] shellDBus: Add a DBus method to load a single extension



commit 7d9a39c72c7837590fd49faa2ea357c7194e3df0
Author: Rui Matos <tiagomatos gmail com>
Date:   Fri Nov 8 11:36:04 2013 +0100

    shellDBus: Add a DBus method to load a single extension
    
    This allows e.g. gnome-tweak-tool to install an extension from a zip
    file and load it into the running shell.

 js/ui/shellDBus.js | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
---
diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js
index c35e7f19c..3a095ae5c 100644
--- a/js/ui/shellDBus.js
+++ b/js/ui/shellDBus.js
@@ -322,6 +322,10 @@ const GnomeShellExtensionsIface = '<node> \
 </method> \
 <method name="CheckForUpdates"> \
 </method> \
+<method name="LoadUserExtension"> \
+    <arg type="s" direction="in" name="uuid"/> \
+    <arg type="b" direction="out" name="success"/> \
+</method> \
 <property name="ShellVersion" type="s" access="read" /> \
 </interface> \
 </node>';
@@ -424,6 +428,22 @@ var GnomeShellExtensions = new Lang.Class({
         ExtensionDownloader.checkForUpdates();
     },
 
+    LoadUserExtension(uuid) {
+        let extension = ExtensionUtils.extensions[uuid];
+        if (extension)
+            return true;
+
+        let dir = Gio.File.new_for_path(GLib.build_filenamev([global.userdatadir, 'extensions', uuid]));
+        try {
+            extension = ExtensionUtils.createExtensionObject(uuid, dir, 
ExtensionUtils.ExtensionType.PER_USER);
+            ExtensionSystem.loadExtension(extension);
+        } catch (e) {
+            log('Could not load user extension from %s'.format(dir.get_path()));
+            return false;
+        }
+        return true;
+    },
+
     ShellVersion: Config.PACKAGE_VERSION,
 
     _extensionStateChanged(_, newState) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]