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
This commit is contained in:
Jasper St. Pierre
2013-06-06 17:27:32 -04:00
parent 5cca26a565
commit 5c8c4e0aad
7 changed files with 42 additions and 225 deletions

View File

@ -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',