[gnome-shell] status/system: Fix session submenu visibility



commit a205f4e2493e9c84bffba6837ee26554b537396f
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Feb 4 02:35:43 2020 +0100

    status/system: Fix session submenu visibility
    
    Commit 147a743d8d7 moved the suspend and power-off actions into
    the submenu that contains the log-out and switch-user actions,
    but did not update the submenu visibility logic to account for
    the additional actions.
    
    As a result, the submenu is hidden when log-out and switch-user
    are unavailable (like on the login screen), even if suspend and
    power-off are enabled.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/issues/2169

 js/ui/status/system.js | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/status/system.js b/js/ui/status/system.js
index 195e9a1c8a..279ebcf0cf 100644
--- a/js/ui/status/system.js
+++ b/js/ui/status/system.js
@@ -20,9 +20,13 @@ class Indicator extends PanelMenu.SystemIndicator {
         this._createSubMenu();
 
         this._loginScreenItem.connect('notify::visible',
-                                      () => this._updateMultiUser());
+            () => this._updateSessionSubMenu());
         this._logoutItem.connect('notify::visible',
-                                 () => this._updateMultiUser());
+            () => this._updateSessionSubMenu());
+        this._suspendItem.connect('notify::visible',
+            () => this._updateSessionSubMenu());
+        this._powerOffItem.connect('notify::visible',
+            () => this._updateSessionSubMenu());
         // Whether shutdown is available or not depends on both lockdown
         // settings (disable-log-out) and Polkit policy - the latter doesn't
         // notify, so we update the menu item each time the menu opens or
@@ -33,7 +37,7 @@ class Indicator extends PanelMenu.SystemIndicator {
 
             this._systemActions.forceUpdate();
         });
-        this._updateMultiUser();
+        this._updateSessionSubMenu();
 
         Main.sessionMode.connect('updated', this._sessionUpdated.bind(this));
         this._sessionUpdated();
@@ -43,11 +47,12 @@ class Indicator extends PanelMenu.SystemIndicator {
         this._settingsItem.visible = Main.sessionMode.allowSettings;
     }
 
-    _updateMultiUser() {
-        let hasSwitchUser = this._loginScreenItem.visible;
-        let hasLogout = this._logoutItem.visible;
-
-        this._sessionSubMenu.visible = hasSwitchUser || hasLogout;
+    _updateSessionSubMenu() {
+        this._sessionSubMenu.visible =
+            this._loginScreenItem.visible ||
+            this._logoutItem.visible ||
+            this._suspendItem.visible ||
+            this._powerOffItem.visible;
     }
 
     _createSubMenu() {


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