browser-plugin: Provide new APIs for launching extension preferences

Add two new APIs, "launchExtensionPrefs" to let SweetTooth let the user
launch the extension preferences tool directly from the browser. To allow
SweetTooth to check if an extension can be configured, add a new key to
the 'metadata', 'hasPrefs', which is returned by the GetExtensionInfo/
ListExtensions DBus methods.

https://bugzilla.gnome.org/show_bug.cgi?id=668429
This commit is contained in:
Jasper St. Pierre
2012-01-18 21:30:06 -05:00
parent b8a54faf94
commit 831099cca5
3 changed files with 55 additions and 2 deletions

View File

@ -3,6 +3,7 @@
const Lang = imports.lang;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const Shell = imports.gi.Shell;
const Config = imports.misc.config;
const ExtensionSystem = imports.ui.extensionSystem;
@ -60,6 +61,9 @@ const GnomeShellIface = <interface name="org.gnome.Shell">
<arg type="s" direction="in" name="uuid"/>
<arg type="b" direction="out" name="success"/>
</method>
<method name="LaunchExtensionPrefs">
<arg type="s" direction="in" name="uuid"/>
</method>
<property name="OverviewActive" type="b" access="readwrite" />
<property name="ApiVersion" type="i" access="read" />
<property name="ShellVersion" type="s" access="read" />
@ -198,6 +202,9 @@ const GnomeShell = new Lang.Class({
case 'number':
type = 'd';
break;
case 'boolean':
type = 'b';
break;
default:
continue;
}
@ -232,6 +239,13 @@ const GnomeShell = new Lang.Class({
return ExtensionSystem.uninstallExtensionFromUUID(uuid);
},
LaunchExtensionPrefs: function(uuid) {
let appSys = Shell.AppSystem.get_default();
let app = appSys.lookup_app('gnome-shell-extension-prefs.desktop');
app.launch(global.display.get_current_time_roundtrip(),
['extension:///' + uuid], -1, null);
},
get OverviewActive() {
return Main.overview.visible;
},