[gnome-shell] status/system: Add separate 'Restart' item



commit 263320696e639ec3c2492736fa7873e27e34567d
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Jul 1 17:15:48 2020 +0200

    status/system: Add separate 'Restart' item
    
    A side effect of removing the action buttons in favor of a regular
    submenu is that we are a lot less constrained by size. So instead
    of lumping "Restart" in with "Power Off", make it a separate menu
    item.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2202

 js/ui/status/system.js | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
diff --git a/js/ui/status/system.js b/js/ui/status/system.js
index c5673913e4..6f71109c52 100644
--- a/js/ui/status/system.js
+++ b/js/ui/status/system.js
@@ -27,6 +27,8 @@ class Indicator extends PanelMenu.SystemIndicator {
             () => this._updateSessionSubMenu());
         this._powerOffItem.connect('notify::visible',
             () => this._updateSessionSubMenu());
+        this._restartItem.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
@@ -52,6 +54,7 @@ class Indicator extends PanelMenu.SystemIndicator {
             this._loginScreenItem.visible ||
             this._logoutItem.visible ||
             this._suspendItem.visible ||
+            this._restartItem.visible ||
             this._powerOffItem.visible;
     }
 
@@ -124,6 +127,17 @@ class Indicator extends PanelMenu.SystemIndicator {
             this._suspendItem, 'visible',
             bindFlags);
 
+        item = new PopupMenu.PopupMenuItem(_('Restart…'));
+        item.connect('activate', () => {
+            this.menu.itemActivated(BoxPointer.PopupAnimation.NONE);
+            this._systemActions.activateRestart();
+        });
+        this._sessionSubMenu.menu.addMenuItem(item);
+        this._restartItem = item;
+        this._systemActions.bind_property('can-restart',
+            this._restartItem, 'visible',
+            bindFlags);
+
         item = new PopupMenu.PopupMenuItem(_('Power Off…'));
         item.connect('activate', () => {
             this.menu.itemActivated(BoxPointer.PopupAnimation.NONE);


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