VolumeStatus: track PulseAudio state and hide when disconnected
Only show the menu when the associated GvcMixerControl is ready, as the connection can fail or PulseAudio may not be installed. https://bugzilla.gnome.org/show_bug.cgi?id=645708
This commit is contained in:
parent
270e82e3db
commit
a64e0e1f49
@ -29,7 +29,7 @@ Indicator.prototype = {
|
|||||||
PanelMenu.SystemStatusButton.prototype._init.call(this, 'audio-volume-muted', null);
|
PanelMenu.SystemStatusButton.prototype._init.call(this, 'audio-volume-muted', null);
|
||||||
|
|
||||||
this._control = new Gvc.MixerControl({ name: 'GNOME Shell Volume Control' });
|
this._control = new Gvc.MixerControl({ name: 'GNOME Shell Volume Control' });
|
||||||
this._control.connect('ready', Lang.bind(this, this._onControlReady));
|
this._control.connect('state-changed', Lang.bind(this, this._onControlStateChanged));
|
||||||
this._control.connect('default-sink-changed', Lang.bind(this, this._readOutput));
|
this._control.connect('default-sink-changed', Lang.bind(this, this._readOutput));
|
||||||
this._control.connect('default-source-changed', Lang.bind(this, this._readInput));
|
this._control.connect('default-source-changed', Lang.bind(this, this._readInput));
|
||||||
this._control.connect('stream-added', Lang.bind(this, this._maybeShowInput));
|
this._control.connect('stream-added', Lang.bind(this, this._maybeShowInput));
|
||||||
@ -102,9 +102,14 @@ Indicator.prototype = {
|
|||||||
this._notifyVolumeChange();
|
this._notifyVolumeChange();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onControlReady: function() {
|
_onControlStateChanged: function() {
|
||||||
this._readOutput();
|
if (this._control.get_state() == Gvc.MixerControlState.READY) {
|
||||||
this._readInput();
|
this._readOutput();
|
||||||
|
this._readInput();
|
||||||
|
this.actor.show();
|
||||||
|
} else {
|
||||||
|
this.actor.hide();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_readOutput: function() {
|
_readOutput: function() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user