extensionPrefs: Fix opening extension preferences on startup

gnome-shell-extension-prefs supports opening a specific extension's
preferences directly from the command line by passing the UUID.
However this broke when extension loading was changed to be processed
asynchronously, as no extension has been loaded when the command
line argument is processed. Fix by deferring opening the extension's
preferences until all extensions have been loaded.

https://bugzilla.gnome.org/show_bug.cgi?id=694858
This commit is contained in:
Florian Müllner 2013-02-28 14:50:56 +01:00
parent e99d69b7d9
commit 6e89d2f46a

View File

@ -45,6 +45,7 @@ const Application = new Lang.Class({
this._extensionPrefsModules = {};
this._extensionIters = {};
this._startupUuid = null;
},
_buildModel: function() {
@ -203,6 +204,7 @@ const Application = new Lang.Class({
_scanExtensions: function() {
let finder = new ExtensionUtils.ExtensionFinder();
finder.connect('extension-found', Lang.bind(this, this._extensionFound));
finder.connect('extensions-loaded', Lang.bind(this, this._extensionsLoaded));
finder.scanExtensions();
},
@ -212,6 +214,11 @@ const Application = new Lang.Class({
this._extensionIters[extension.uuid] = iter;
},
_extensionsLoaded: function() {
if (this._startupUuid && this._extensionAvailable(this._startupUuid))
this._selectExtension(this._startupUuid);
this._startupUuid = null;
},
_onActivate: function() {
this._window.present();
@ -232,10 +239,10 @@ const Application = new Lang.Class({
// Strip off "extension:///" prefix which fakes a URI, if it exists
uuid = stripPrefix(uuid, "extension:///");
if (!this._extensionAvailable(uuid))
return 1;
this._selectExtension(uuid);
if (this._extensionAvailable(uuid))
this._selectExtension(uuid);
else
this._startupUuid = uuid;
}
return 0;
}