status: Port to a new SystemIndicator framework

We can't silently replace the old behavior of separate status
icons into a new system. Replace SystemStatusButton with a new
SystemIndicator class which will allow for the flexibility we
need. For now, make it a subclass of Button so that it mostly
feels the same, but we'll soon be swapping it out with a dummy
implementation that the aggregate menu will use.

I think the code cleanup here is worth it.

https://bugzilla.gnome.org/show_bug.cgi?id=705845
This commit is contained in:
Jasper St. Pierre
2013-06-06 17:27:25 -04:00
parent a347f02545
commit 5cca26a565
9 changed files with 62 additions and 74 deletions

View File

@ -296,22 +296,29 @@ const VolumeMenu = new Lang.Class({
const Indicator = new Lang.Class({
Name: 'VolumeIndicator',
Extends: PanelMenu.SystemStatusButton,
Extends: PanelMenu.SystemIndicator,
_init: function() {
this.parent('audio-volume-muted-symbolic', _("Volume"));
this.parent();
this._primaryIndicator = this.addIndicator(null);
this._control = getMixerControl();
this._volumeMenu = new VolumeMenu(this._control);
this._volumeMenu.connect('icon-changed', Lang.bind(this, function(menu) {
let icon = this._volumeMenu.getIcon();
this.actor.visible = (icon != null);
this.setIcon(icon);
if (icon != null) {
this.indicators.show();
this._primaryIndicator.icon_name = icon;
} else {
this.indicators.hide();
}
}));
this.menu.addMenuItem(this._volumeMenu);
this.actor.connect('scroll-event', Lang.bind(this, this._onScrollEvent));
this.indicators.connect('scroll-event', Lang.bind(this, this._onScrollEvent));
},
_onScrollEvent: function(actor, event) {