[gnome-shell] extensionSystem: Start using OUT_OF_DATE



commit 6241a8269fdfc4e5c1a0510813a21edbe50c4f4a
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Jul 5 14:40:48 2011 -0400

    extensionSystem: Start using OUT_OF_DATE
    
    We were defining OUT_OF_DATE as a possible state, but never using it
    properly.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=654770

 js/ui/extensionSystem.js |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js
index 364d106..38eeea3 100644
--- a/js/ui/extensionSystem.js
+++ b/js/ui/extensionSystem.js
@@ -128,6 +128,12 @@ function installExtensionFromManifest(manifest, meta) {
     let uuid = manifest['uuid'];
     let name = manifest['name'];
 
+    if (!versionCheck(manifest['shell-version'], Config.PACKAGE_VERSION)) {
+        meta.state = ExtensionState.OUT_OF_DATE;
+        logExtensionError(uuid, 'version: ' + name + ' is not compatible with current GNOME Shell version', meta.state);
+        return;
+    }
+
     let url = manifest['__installer'];
     _httpSession.queue_message(Soup.Message.new('GET', url),
                                function(session, message) {
@@ -213,13 +219,14 @@ function enableExtension(uuid) {
     _signals.emit('extension-state-changed', meta);
 }
 
-function logExtensionError(uuid, message) {
+function logExtensionError(uuid, message, state) {
     if (!errors[uuid]) errors[uuid] = [];
     errors[uuid].push(message);
     global.logError('Extension "%s" had error: %s'.format(uuid, message));
+    state = state || ExtensionState.ERROR;
     _signals.emit('extension-state-changed', { uuid: uuid,
                                                error: message,
-                                               state: ExtensionState.ERROR });
+                                               state: state });
 }
 
 function loadExtension(dir, enabled, type) {
@@ -285,6 +292,13 @@ function loadExtension(dir, enabled, type) {
     // Default to error, we set success as the last step
     meta.state = ExtensionState.ERROR;
 
+    if (!versionCheck(meta['shell-version'], Config.PACKAGE_VERSION) ||
+        (meta['js-version'] && !versionCheck(meta['js-version'], Config.GJS_VERSION))) {
+        logExtensionError(uuid, 'extension is not compatible with current GNOME Shell and/or GJS version', ExtensionState.OUT_OF_DATE);
+        meta.state = ExtensionState.OUT_OF_DATE;
+        return;
+    }
+
     let extensionJs = dir.get_child('extension.js');
     if (!extensionJs.query_exists(null)) {
         logExtensionError(uuid, 'Missing extension.js');



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