aboutsummaryrefslogtreecommitdiff
path: root/src/volume-control-pulse.vala
diff options
context:
space:
mode:
authorcharles kerr <charlesk@canonical.com>2015-12-20 15:42:57 -0600
committercharles kerr <charlesk@canonical.com>2015-12-20 15:42:57 -0600
commit60cd7ac64849bfc21be1a85063f5730ad22f9d72 (patch)
tree33adcf048e6be17c500c2fef2ca8ac4aa37245e8 /src/volume-control-pulse.vala
parent2fedb182f5321d381821178ce10dd395113ab11b (diff)
downloadayatana-indicator-sound-60cd7ac64849bfc21be1a85063f5730ad22f9d72.tar.gz
ayatana-indicator-sound-60cd7ac64849bfc21be1a85063f5730ad22f9d72.tar.bz2
ayatana-indicator-sound-60cd7ac64849bfc21be1a85063f5730ad22f9d72.zip
always keep volume-control's 'stream' property updated
Diffstat (limited to 'src/volume-control-pulse.vala')
-rw-r--r--src/volume-control-pulse.vala32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/volume-control-pulse.vala b/src/volume-control-pulse.vala
index fae113d..a5d3baf 100644
--- a/src/volume-control-pulse.vala
+++ b/src/volume-control-pulse.vala
@@ -53,22 +53,6 @@ public class VolumeControlPulse : VolumeControl
private bool _pulse_use_stream_restore = false;
private int32 _active_sink_input = -1;
private string[] _valid_roles = {"multimedia", "alert", "alarm", "phone"};
- public override string stream {
- get {
- if (_active_sink_input == -1)
- return "alert";
- var path = _sink_input_hash[_active_sink_input];
- if (path == _objp_role_multimedia)
- return "multimedia";
- if (path == _objp_role_alert)
- return "alert";
- if (path == _objp_role_alarm)
- return "alarm";
- if (path == _objp_role_phone)
- return "phone";
- return "alert";
- }
- }
private string? _objp_role_multimedia = null;
private string? _objp_role_alert = null;
private string? _objp_role_alarm = null;
@@ -329,6 +313,21 @@ public class VolumeControlPulse : VolumeControl
return message;
}
+ private VolumeControl.Stream calculate_active_stream()
+ {
+ if (_active_sink_input != -1) {
+ var path = _sink_input_hash[_active_sink_input];
+ if (path == _objp_role_multimedia)
+ return Stream.MULTIMEDIA;
+ if (path == _objp_role_alarm)
+ return Stream.ALARM;
+ if (path == _objp_role_phone)
+ return Stream.PHONE;
+ }
+
+ return VolumeControl.Stream.ALERT;
+ }
+
private async void update_active_sink_input (int32 index)
{
if ((index == -1) || (index != _active_sink_input && index in _sink_input_list)) {
@@ -336,6 +335,7 @@ public class VolumeControlPulse : VolumeControl
if (index != -1)
sink_input_objp = _sink_input_hash.get (index);
_active_sink_input = index;
+ active_stream = calculate_active_stream();
/* Listen for role volume changes from pulse itself (external clients) */
try {