[gnome-shell/wip/aggregate-menu: 95/99] panel: Move statuses to the aggregate menu



commit aa46f91f38768e57b0f1e9538e5e27f3d4362998
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.

 js/Makefile.am                 |    2 -
 js/gdm/powerMenu.js            |  129 ----------------------------------------
 js/ui/panel.js                 |   49 ++++++++++-----
 js/ui/panelMenu.js             |    9 +--
 js/ui/sessionMode.js           |   10 +--
 js/ui/status/lockScreenMenu.js |   62 -------------------
 6 files changed, 40 insertions(+), 221 deletions(-)
---
diff --git a/js/Makefile.am b/js/Makefile.am
index c388d26..c6f5dac 100644
--- a/js/Makefile.am
+++ b/js/Makefile.am
@@ -20,7 +20,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  \
@@ -90,7 +89,6 @@ nobase_dist_js_DATA =         \
        ui/status/accessibility.js      \
        ui/status/brightness.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 dbd03fb..6cdf7a5 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -921,31 +921,48 @@ 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);
+
+        let network = new imports.ui.status.network.NMApplet();
+        let power = new imports.ui.status.power.Indicator();
+        let volume = new imports.ui.status.volume.Indicator();
+        let brightness = new imports.ui.status.brightness.Indicator();
+        let system = new imports.ui.status.system.Indicator();
+
+        this._indicators.add_child(network.indicators);
+        this._indicators.add_child(power.indicators);
+        this._indicators.add_child(volume.indicators);
+        this._indicators.add_child(system.indicators);
+        this._indicators.add_child(new St.Label({ text: '\u25BE' }));
+
+        this.menu.addMenuItem(volume.menu);
+        this.menu.addMenuItem(brightness.menu);
+        this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
+        this.menu.addMenuItem(network.menu);
+        this.menu.addMenuItem(power.menu);
+        this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
+        this.menu.addMenuItem(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 a27b328..5006b62 100644
--- a/js/ui/panelMenu.js
+++ b/js/ui/panelMenu.js
@@ -233,14 +233,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) {
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]