[gnome-shell] extensionPrefs: Sync list visibility on status changes



commit 7d94bfa6429514e7258b33f045e71250d22bf977
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Mar 12 22:55:43 2020 +0100

    extensionPrefs: Sync list visibility on status changes
    
    We only show the list of system- and user extensions if corresponding
    extensions are installed, however we only update the visibility
    after loading the initial list of extensions.
    
    As it's possible for the first user extension to be installed while the
    app is open or the last one to be removed, we should also update the
    list visibility after extension state changes.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1088

 js/extensionPrefs/js/main.js | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)
---
diff --git a/js/extensionPrefs/js/main.js b/js/extensionPrefs/js/main.js
index 9dab3c3928..d1da73a025 100644
--- a/js/extensionPrefs/js/main.js
+++ b/js/extensionPrefs/js/main.js
@@ -423,9 +423,11 @@ var ExtensionsWindow = GObject.registerClass({
         if (row) {
             if (extension.state === ExtensionState.UNINSTALLED)
                 row.destroy();
-            return; // we only deal with new and deleted extensions here
+        } else {
+            this._addExtensionRow(extension);
         }
-        this._addExtensionRow(extension);
+
+        this._syncListVisibility();
     }
 
     _scanExtensions() {
@@ -471,6 +473,16 @@ var ExtensionsWindow = GObject.registerClass({
             });
     }
 
+    _syncListVisibility() {
+        this._userList.visible = this._userList.get_children().length > 0;
+        this._systemList.visible = this._systemList.get_children().length > 0;
+
+        if (this._userList.visible || this._systemList.visible)
+            this._mainStack.visible_child_name = 'main';
+        else
+            this._mainStack.visible_child_name = 'placeholder';
+    }
+
     _checkUpdates() {
         let nUpdates = this._userList.get_children().filter(c => c.hasUpdate).length;
 
@@ -482,14 +494,7 @@ var ExtensionsWindow = GObject.registerClass({
     }
 
     _extensionsLoaded() {
-        this._userList.visible = this._userList.get_children().length > 0;
-        this._systemList.visible = this._systemList.get_children().length > 0;
-
-        if (this._userList.visible || this._systemList.visible)
-            this._mainStack.visible_child_name = 'main';
-        else
-            this._mainStack.visible_child_name = 'placeholder';
-
+        this._syncListVisibility();
         this._checkUpdates();
 
         if (this._startupUuid)


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