[gnome-shell/wip/aggregate-menu: 59/62] panel: Move statuses to the aggregate menu



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

 data/theme/gnome-shell.css     |    4 -
 js/Makefile.am                 |    2 -
 js/gdm/powerMenu.js            |  129 ----------------------------------------
 js/ui/panel.js                 |   49 ++++++++++-----
 js/ui/panelMenu.js             |   10 +--
 js/ui/sessionMode.js           |   10 +--
 js/ui/status/lockScreenMenu.js |   62 -------------------
 7 files changed, 41 insertions(+), 225 deletions(-)
---
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index 1274377..43ed451 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -618,10 +618,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 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..f694a8b 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);
+
+        this._network = new imports.ui.status.network.NMApplet();
+        this._power = new imports.ui.status.power.Indicator();
+        this._volume = new imports.ui.status.volume.Indicator();
+        this._brightness = new imports.ui.status.brightness.Indicator();
+        this._system = new imports.ui.status.system.Indicator();
+
+        this._indicators.add_child(this._network.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(this._brightness.menu);
+        this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
+        this.menu.addMenuItem(this._network.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 a27b328..4d13ddd 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) {
@@ -250,3 +247,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]