aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/com.canonical.indicator.sound4
-rw-r--r--src/volume-control.vala44
2 files changed, 33 insertions, 15 deletions
diff --git a/data/com.canonical.indicator.sound b/data/com.canonical.indicator.sound
index eca0e4a..ae5fd5d 100644
--- a/data/com.canonical.indicator.sound
+++ b/data/com.canonical.indicator.sound
@@ -14,3 +14,7 @@ ObjectPath=/com/canonical/indicator/sound/desktop_greeter
[ubiquity]
ObjectPath=/com/canonical/indicator/sound/desktop_greeter
+
+[phone_greeter]
+ObjectPath=/com/canonical/indicator/sound/desktop_greeter
+
diff --git a/src/volume-control.vala b/src/volume-control.vala
index 4ca9537..c6db38c 100644
--- a/src/volume-control.vala
+++ b/src/volume-control.vala
@@ -128,12 +128,14 @@ public class VolumeControl : Object
context.get_server_info (server_info_cb_for_props);
}
+ private void update_source_get_server_info_cb (PulseAudio.Context c, PulseAudio.ServerInfo? i) {
+ if (i != null)
+ context.get_source_info_by_name (i.default_source_name, source_info_cb);
+ }
+
private void update_source ()
{
- context.get_server_info ( (c, i) => {
- if (i != null)
- context.get_source_info_by_name (i.default_source_name, source_info_cb);
- });
+ context.get_server_info (update_source_get_server_info_cb);
}
private void source_output_info_cb (Context c, SourceOutputInfo? i, int eol)
@@ -199,15 +201,25 @@ public class VolumeControl : Object
warning( "pa_context_connect() failed: %s\n", PulseAudio.strerror(context.errno()));
}
+ void sink_info_list_callback_set_mute (PulseAudio.Context context, PulseAudio.SinkInfo? sink, int eol) {
+ if (sink != null)
+ context.set_sink_mute_by_index (sink.index, true, null);
+ }
+
+ void sink_info_list_callback_unset_mute (PulseAudio.Context context, PulseAudio.SinkInfo? sink, int eol) {
+ if (sink != null)
+ context.set_sink_mute_by_index (sink.index, false, null);
+ }
+
/* Mute operations */
public void set_mute (bool mute)
{
return_if_fail (context.get_state () == Context.State.READY);
- context.get_sink_info_list ((context, sink, eol) => {
- if (sink != null)
- context.set_sink_mute_by_index (sink.index, mute, null);
- });
+ if (mute)
+ context.get_sink_info_list (sink_info_list_callback_set_mute);
+ else
+ context.get_sink_info_list (sink_info_list_callback_unset_mute);
}
public void toggle_mute ()
@@ -277,19 +289,21 @@ public class VolumeControl : Object
mic_volume_changed (_mic_volume);
}
+ void set_mic_volume_get_server_info_cb (PulseAudio.Context c, PulseAudio.ServerInfo? i) {
+ if (i != null) {
+ unowned CVolume cvol = CVolume ();
+ cvol = vol_set (cvol, 1, double_to_volume (_mic_volume));
+ c.set_source_volume_by_name (i.default_source_name, cvol, set_mic_volume_success_cb);
+ }
+ }
+
public void set_mic_volume (double volume)
{
return_if_fail (context.get_state () == Context.State.READY);
_mic_volume = volume;
- context.get_server_info ( (c, i) => {
- if (i != null) {
- unowned CVolume cvol = CVolume ();
- cvol = vol_set (cvol, 1, double_to_volume (_mic_volume));
- c.set_source_volume_by_name (i.default_source_name, cvol, set_mic_volume_success_cb);
- }
- });
+ context.get_server_info (set_mic_volume_get_server_info_cb);
}
public double get_volume ()