[gnome-shell] panel: Move statuses to the aggregate menu



commit 5c8c4e0aad4c1e2d05960efdfded7c69225e2d95
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Jun 6 17:27:32 2013 -0400

    panel: Move statuses to the aggregate menu
    
    Swap out the implementation of SystemIndicator with a dummy,
    and build the aggregate menu. At the same time, remove the
    poweroff and login screen menus, as those were fake aggregate
    menus beforehand.
    
    We lose some flexibility as we lose session-mode-based menu
    layout, but as each component of the aggregate menu is supposed
    to be "smart" in response to updating itself when session
    state changes, I believe it's better than a declarative model.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=705845

 data/theme/gnome-shell.css     |    4 -
 js/Makefile.am                 |    2 -
 js/gdm/powerMenu.js            |  129 ----------------------------------------
 js/ui/panel.js                 |   50 +++++++++++-----
 js/ui/panelMenu.js             |   10 +--
 js/ui/sessionMode.js           |   10 +--
 js/ui/status/lockScreenMenu.js |   62 -------------------
 7 files changed, 42 insertions(+), 225 deletions(-)
---
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index a63c5e7..6bf7095 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -616,10 +616,6 @@ StScrollBar StButton#vhandle:active {
 
 .panel-status-indicators-box,
 .panel-status-menu-box {
-    spacing: 4px;
-}
-
-.lock-screen-status-button-box {
     spacing: 8px;
 }
 
diff --git a/js/Makefile.am b/js/Makefile.am
index 86fa470..5184bb2 100644
--- a/js/Makefile.am
+++ b/js/Makefile.am
@@ -21,7 +21,6 @@ nobase_dist_js_DATA =         \
        gdm/batch.js            \
        gdm/fingerprint.js      \
        gdm/loginDialog.js      \
-       gdm/powerMenu.js        \
        gdm/realmd.js           \
        gdm/util.js             \
        extensionPrefs/main.js  \
@@ -91,7 +90,6 @@ nobase_dist_js_DATA =         \
        ui/shellDBus.js         \
        ui/status/accessibility.js      \
        ui/status/keyboard.js   \
-       ui/status/lockScreenMenu.js     \
        ui/status/network.js    \
        ui/status/power.js      \
        ui/status/volume.js     \
diff --git a/js/ui/panel.js b/js/ui/panel.js
index 342de77..1450051 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -837,31 +837,49 @@ const PanelCorner = new Lang.Class({
     }
 });
 
+const AggregateMenu = new Lang.Class({
+    Name: 'AggregateMenu',
+    Extends: PanelMenu.Button,
+
+    _init: function() {
+        this.parent(0.0, _("Settings Menu"), false);
+
+        this._indicators = new St.BoxLayout({ style_class: 'panel-status-indicators-box' });
+        this.actor.add_child(this._indicators);
+
+        this._network = new imports.ui.status.network.NMApplet();
+        this._bluetooth = new imports.ui.status.bluetooth.Indicator();
+        this._power = new imports.ui.status.power.Indicator();
+        this._volume = new imports.ui.status.volume.Indicator();
+        this._system = new imports.ui.status.system.Indicator();
+
+        this._indicators.add_child(this._network.indicators);
+        this._indicators.add_child(this._bluetooth.indicators);
+        this._indicators.add_child(this._power.indicators);
+        this._indicators.add_child(this._volume.indicators);
+        this._indicators.add_child(this._system.indicators);
+        this._indicators.add_child(new St.Label({ text: '\u25BE' }));
+
+        this.menu.addMenuItem(this._volume.menu);
+        this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
+        this.menu.addMenuItem(this._network.menu);
+        this.menu.addMenuItem(this._bluetooth.menu);
+        this.menu.addMenuItem(this._power.menu);
+        this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
+        this.menu.addMenuItem(this._system.menu);
+    },
+});
+
 const PANEL_ITEM_IMPLEMENTATIONS = {
     'activities': ActivitiesButton,
+    'aggregateMenu': AggregateMenu,
     'appMenu': AppMenuButton,
     'dateMenu': imports.ui.dateMenu.DateMenuButton,
     'a11y': imports.ui.status.accessibility.ATIndicator,
     'a11yGreeter': imports.ui.status.accessibility.ATGreeterIndicator,
-    'volume': imports.ui.status.volume.Indicator,
-    'battery': imports.ui.status.power.Indicator,
-    'lockScreen': imports.ui.status.lockScreenMenu.Indicator,
     'keyboard': imports.ui.status.keyboard.InputSourceIndicator,
-    'powerMenu': imports.gdm.powerMenu.PowerMenuButton,
-    'system': imports.ui.status.system.Indicator,
 };
 
-if (Config.HAVE_BLUETOOTH)
-    PANEL_ITEM_IMPLEMENTATIONS['bluetooth'] =
-        imports.ui.status.bluetooth.Indicator;
-
-try {
-    PANEL_ITEM_IMPLEMENTATIONS['network'] =
-        imports.ui.status.network.NMApplet;
-} catch(e) {
-    log('NMApplet is not supported. It is possible that your NetworkManager version is too old');
-}
-
 const Panel = new Lang.Class({
     Name: 'Panel',
 
diff --git a/js/ui/panelMenu.js b/js/ui/panelMenu.js
index fb21566..5dd8d44 100644
--- a/js/ui/panelMenu.js
+++ b/js/ui/panelMenu.js
@@ -242,14 +242,11 @@ Signals.addSignalMethods(Button.prototype);
  */
 const SystemIndicator = new Lang.Class({
     Name: 'SystemIndicator',
-    Extends: Button,
 
     _init: function() {
-        this.parent(0.0);
-        this.actor.add_style_class_name('panel-status-button');
-
-        this.indicators = new St.BoxLayout({ style_class: 'panel-status-indicators-box' });
-        this.actor.add_actor(this.indicators);
+        this.indicators = new St.BoxLayout({ style_class: 'panel-status-indicators-box',
+                                             reactive: true });
+        this.menu = new PopupMenu.PopupMenuSection();
     },
 
     addIndicator: function(gicon) {
@@ -259,3 +256,4 @@ const SystemIndicator = new Lang.Class({
         return icon;
     }
 });
+Signals.addSignalMethods(SystemIndicator.prototype);
diff --git a/js/ui/sessionMode.js b/js/ui/sessionMode.js
index 035739c..0f8b091 100644
--- a/js/ui/sessionMode.js
+++ b/js/ui/sessionMode.js
@@ -48,8 +48,7 @@ const _modes = {
         panel: {
             left: [],
             center: ['dateMenu'],
-            right: ['a11yGreeter', 'display', 'keyboard',
-                    'volume', 'battery', 'powerMenu']
+            right: ['a11yGreeter', 'keyboard', 'aggregateMenu'],
         },
         panelStyle: 'login-screen'
     },
@@ -62,7 +61,7 @@ const _modes = {
         panel: {
             left: [],
             center: [],
-            right: ['lockScreen']
+            right: ['aggregateMenu']
         },
         panelStyle: 'lock-screen'
     },
@@ -74,7 +73,7 @@ const _modes = {
         panel: {
             left: [],
             center: [],
-            right: ['a11y', 'keyboard', 'lockScreen']
+            right: ['a11y', 'keyboard', 'aggregateMenu']
         },
         panelStyle: 'unlock-screen'
     },
@@ -96,8 +95,7 @@ const _modes = {
         panel: {
             left: ['activities', 'appMenu'],
             center: ['dateMenu'],
-            right: ['a11y', 'keyboard', 'volume', 'bluetooth',
-                    'network', 'battery', 'system']
+            right: ['a11y', 'keyboard', 'aggregateMenu']
         }
     }
 };


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