[gnome-shell] Add org.gnome.shell.enabled-extensions complementing disabled-extensions



commit 33a3b8046d9028dd1e3d3e3f5da526ef087f1692
Author: Tassilo Horn <tassilo member fsf org>
Date:   Wed May 25 21:34:33 2011 +0200

    Add org.gnome.shell.enabled-extensions complementing disabled-extensions
    
    If the former is empty (default), only the extensions not contained in
    the latter are loaded.  Else, all extensions in the former that are
    not contained in the latter are loaded.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=651088

 data/org.gnome.shell.gschema.xml.in |   14 ++++++++++++--
 js/ui/extensionSystem.js            |    9 +++++++--
 2 files changed, 19 insertions(+), 4 deletions(-)
---
diff --git a/data/org.gnome.shell.gschema.xml.in b/data/org.gnome.shell.gschema.xml.in
index 698ebc1..050c413 100644
--- a/data/org.gnome.shell.gschema.xml.in
+++ b/data/org.gnome.shell.gschema.xml.in
@@ -15,8 +15,18 @@
       <default>[]</default>
       <_summary>Uuids of extensions to disable</_summary>
       <_description>
-        GNOME Shell extensions have a uuid property;
-        this key lists extensions which should not be loaded.
+        GNOME Shell extensions have a uuid property; this key lists extensions
+        which should not be loaded.  This setting overrides enabled-extensions
+        for extensions that appear in both lists.
+      </_description>
+    </key>
+    <key name="enabled-extensions" type="as">
+      <default>[]</default>
+      <_summary>Uuids of extensions to enable</_summary>
+      <_description>
+        GNOME Shell extensions have a uuid property; this key lists extensions
+        which should be loaded.  disabled-extensions overrides this setting for
+        extensions that appear in both lists.
       </_description>
     </key>
     <key name="enable-app-monitoring" type="b">
diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js
index 9dd3a47..f722007 100644
--- a/js/ui/extensionSystem.js
+++ b/js/ui/extensionSystem.js
@@ -23,8 +23,9 @@ const ExtensionType = {
 const extensionMeta = {};
 // Maps uuid -> importer object (extension directory tree)
 const extensions = {};
-// Array of uuids
+// Arrays of uuids
 var disabledExtensions;
+var enabledExtensions;
 // GFile for user extensions
 var userExtensionsDir = null;
 
@@ -178,6 +179,7 @@ function init() {
     }
 
     disabledExtensions = global.settings.get_strv('disabled-extensions', -1);
+    enabledExtensions = global.settings.get_strv('enabled-extensions', -1);
 }
 
 function _loadExtensionsIn(dir, type) {
@@ -195,7 +197,10 @@ function _loadExtensionsIn(dir, type) {
         if (fileType != Gio.FileType.DIRECTORY)
             continue;
         let name = info.get_name();
-        let enabled = disabledExtensions.indexOf(name) < 0;
+	// Enable all but disabled extensions if enabledExtensions is not set.
+	// If it is set, enable one those, except they are disabled as well.
+        let enabled = (enabledExtensions.length == 0 || enabledExtensions.indexOf(name) >= 0)
+	    && disabledExtensions.indexOf(name) < 0;
         let child = dir.get_child(name);
         loadExtension(child, enabled, type);
     }



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