[gnome-shell] extensionPrefs: Fix opening extension preferences on startup



commit 6e89d2f46afa675ea1f53c66d95eb1539ac2226f
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Feb 28 14:50:56 2013 +0100

    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

 js/extensionPrefs/main.js |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/js/extensionPrefs/main.js b/js/extensionPrefs/main.js
index 53a6966..683fcc3 100644
--- a/js/extensionPrefs/main.js
+++ b/js/extensionPrefs/main.js
@@ -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;
     }


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