[gnome-shell/wip/rstrode/login-screen-extensions: 48/134] extensionSystem: Add hasUpdate state




commit c98213dc1726251c16df3ed6147fa6741b9f793c
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Jan 22 14:45:15 2020 +0100

    extensionSystem: Add hasUpdate state
    
    The current support for extension updates is half-baked at best.
    We are about to change that, and implement offline updates similar
    to gnome-software.
    
    As a first step, add a hasUpdate property to the extension state
    which will communicate available updates.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/945

 js/misc/extensionUtils.js | 10 +++++++++-
 js/ui/extensionSystem.js  | 10 ++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)
---
diff --git a/js/misc/extensionUtils.js b/js/misc/extensionUtils.js
index 62b25d46c7..a812acdb1a 100644
--- a/js/misc/extensionUtils.js
+++ b/js/misc/extensionUtils.js
@@ -29,7 +29,15 @@ var ExtensionState = {
     UNINSTALLED: 99
 };
 
-const SERIALIZED_PROPERTIES = ['type', 'state', 'path', 'error', 'hasPrefs', 'canChange'];
+const SERIALIZED_PROPERTIES = [
+    'type',
+    'state',
+    'path',
+    'error',
+    'hasPrefs',
+    'hasUpdate',
+    'canChange',
+];
 
 /**
  * getCurrentExtension:
diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js
index cd3e78301e..93faf48d45 100644
--- a/js/ui/extensionSystem.js
+++ b/js/ui/extensionSystem.js
@@ -165,6 +165,15 @@ var ExtensionManager = class {
         return true;
     }
 
+    notifyExtensionUpdate(uuid) {
+        let extension = this.lookup(uuid);
+        if (!extension)
+            return;
+
+        extension.hasUpdate = true;
+        this.emit('extension-state-changed', extension);
+    }
+
     logExtensionError(uuid, error) {
         let extension = this.lookup(uuid);
         if (!extension)
@@ -223,6 +232,7 @@ var ExtensionManager = class {
             path: dir.get_path(),
             error: '',
             hasPrefs: dir.get_child('prefs.js').query_exists(null),
+            hasUpdate: false,
             canChange: false
         };
         this._extensions.set(uuid, extension);


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