[gnome-shell] VolumeStatus: track PulseAudio state and hide when disconnected
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] VolumeStatus: track PulseAudio state and hide when disconnected
- Date: Thu, 25 Aug 2011 21:36:38 +0000 (UTC)
commit a64e0e1f49a058eb41583f631bfc71e2731dddf9
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Mon Mar 28 16:10:11 2011 +0200
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
js/ui/status/volume.js | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/status/volume.js b/js/ui/status/volume.js
index 0c02a9e..98e8d30 100644
--- a/js/ui/status/volume.js
+++ b/js/ui/status/volume.js
@@ -29,7 +29,7 @@ Indicator.prototype = {
PanelMenu.SystemStatusButton.prototype._init.call(this, 'audio-volume-muted', null);
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-source-changed', Lang.bind(this, this._readInput));
this._control.connect('stream-added', Lang.bind(this, this._maybeShowInput));
@@ -102,9 +102,14 @@ Indicator.prototype = {
this._notifyVolumeChange();
},
- _onControlReady: function() {
- this._readOutput();
- this._readInput();
+ _onControlStateChanged: function() {
+ if (this._control.get_state() == Gvc.MixerControlState.READY) {
+ this._readOutput();
+ this._readInput();
+ this.actor.show();
+ } else {
+ this.actor.hide();
+ }
},
_readOutput: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]