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.
This commit is contained in:
parent
b474ea0b7c
commit
7d9a39c72c
@ -322,6 +322,10 @@ const GnomeShellExtensionsIface = '<node> \
|
|||||||
</method> \
|
</method> \
|
||||||
<method name="CheckForUpdates"> \
|
<method name="CheckForUpdates"> \
|
||||||
</method> \
|
</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" /> \
|
<property name="ShellVersion" type="s" access="read" /> \
|
||||||
</interface> \
|
</interface> \
|
||||||
</node>';
|
</node>';
|
||||||
@ -424,6 +428,22 @@ var GnomeShellExtensions = new Lang.Class({
|
|||||||
ExtensionDownloader.checkForUpdates();
|
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,
|
ShellVersion: Config.PACKAGE_VERSION,
|
||||||
|
|
||||||
_extensionStateChanged(_, newState) {
|
_extensionStateChanged(_, newState) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user