[gnome-shell] extensionSystem: Add a gsettings key to disable version validation



commit 1af40b1345441c925f444ca19fe7914893e12863
Author: Adel Gadllah <adel gadllah gmail com>
Date:   Tue Feb 18 18:10:22 2014 +0100

    extensionSystem: Add a gsettings key to disable version validation
    
    Add a key 'disable-extension-version-validation' key that disables
    the validation of extension's claimed to be supported shell version
    with the shell version and just load all extensions unconditionally.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=724683

 data/org.gnome.shell.gschema.xml.in.in |    9 +++++++++
 js/ui/extensionSystem.js               |   16 +++++++++++++++-
 2 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/data/org.gnome.shell.gschema.xml.in.in b/data/org.gnome.shell.gschema.xml.in.in
index d8eac18..0f96e64 100644
--- a/data/org.gnome.shell.gschema.xml.in.in
+++ b/data/org.gnome.shell.gschema.xml.in.in
@@ -21,6 +21,15 @@
         EnableExtension and DisableExtension D-Bus methods on org.gnome.Shell.
       </_description>
     </key>
+    <key name="disable-extension-version-validation" type="b">
+      <default>false</default>
+      <_summary>Disables the validation of extension version compatibility</_summary>
+      <_description>
+        GNOME Shell will only load extensions that claim to support the current
+        running version. Enabling this option will disable this check and try to
+        load all extensions regardless of the versions they claim to support.
+      </_description>
+    </key>
     <key name="favorite-apps" type="as">
       <default>[ 'epiphany.desktop', 'evolution.desktop', 'empathy.desktop', 'rhythmbox.desktop', 
'shotwell.desktop', 'libreoffice-writer.desktop', 'nautilus.desktop', 'gnome-documents.desktop' ]</default>
       <_summary>List of desktop file IDs for favorite applications</_summary>
diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js
index 40a4887..3f0e170 100644
--- a/js/ui/extensionSystem.js
+++ b/js/ui/extensionSystem.js
@@ -38,6 +38,7 @@ const connect = Lang.bind(_signals, _signals.connect);
 const disconnect = Lang.bind(_signals, _signals.disconnect);
 
 const ENABLED_EXTENSIONS_KEY = 'enabled-extensions';
+const EXTENSION_DISABLE_VERSION_CHECK_KEY = 'disable-extension-version-validation';
 
 var initted = false;
 var enabled;
@@ -156,7 +157,9 @@ function loadExtension(extension) {
     // Default to error, we set success as the last step
     extension.state = ExtensionState.ERROR;
 
-    if (ExtensionUtils.isOutOfDate(extension)) {
+    let checkVersion = !global.settings.get_boolean(EXTENSION_DISABLE_VERSION_CHECK_KEY);
+
+    if (checkVersion && ExtensionUtils.isOutOfDate(extension)) {
         extension.state = ExtensionState.OUT_OF_DATE;
     } else {
         let enabled = enabledExtensions.indexOf(extension.uuid) != -1;
@@ -267,8 +270,19 @@ function onEnabledExtensionsChanged() {
     enabledExtensions = newEnabledExtensions;
 }
 
+function _onVersionValidationChanged() {
+    if (Main.sessionMode.allowExtensions) {
+        enabledExtensions.forEach(function(uuid) {
+            if (ExtensionUtils.extensions[uuid])
+                reloadExtension(ExtensionUtils.extensions[uuid]);
+        });
+    }
+}
+
 function _loadExtensions() {
     global.settings.connect('changed::' + ENABLED_EXTENSIONS_KEY, onEnabledExtensionsChanged);
+    global.settings.connect('changed::' + EXTENSION_DISABLE_VERSION_CHECK_KEY, _onVersionValidationChanged);
+
     enabledExtensions = getEnabledExtensions();
 
     let finder = new ExtensionUtils.ExtensionFinder();


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