From daf38420dcdd70c090cf146973f0b3f4522a532c Mon Sep 17 00:00:00 2001 From: Rui Matos Date: Fri, 8 Nov 2013 11:36:04 +0100 Subject: [PATCH 1/2] 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 a87ea41..f8b05f4 100644 --- a/js/ui/shellDBus.js +++ b/js/ui/shellDBus.js @@ -283,6 +283,10 @@ const GnomeShellExtensionsIface = ' \ \ \ \ + \ + \ + \ + \ \ \ '; @@ -385,6 +389,22 @@ const GnomeShellExtensions = new Lang.Class({ ExtensionDownloader.checkForUpdates(); }, + LoadUserExtension: function(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: function(_, newState) { -- 2.3.3