aboutsummaryrefslogtreecommitdiff
path: root/src/pulseaudio-mgr.c
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2012-03-01 16:00:38 +0000
committerConor Curran <conor.curran@canonical.com>2012-03-01 16:00:38 +0000
commit40837488c4fa94e96cdfefae65020e2b443e46f5 (patch)
treef8bd29096ef7dd3920cce3d9e6e606ca44ad2de7 /src/pulseaudio-mgr.c
parentee55f50a379890e68ab9af68d02565b52a24655d (diff)
downloadayatana-indicator-sound-40837488c4fa94e96cdfefae65020e2b443e46f5.tar.gz
ayatana-indicator-sound-40837488c4fa94e96cdfefae65020e2b443e46f5.tar.bz2
ayatana-indicator-sound-40837488c4fa94e96cdfefae65020e2b443e46f5.zip
check the state of the pulse context to ensure it's ready for interaction
Diffstat (limited to 'src/pulseaudio-mgr.c')
-rw-r--r--src/pulseaudio-mgr.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/pulseaudio-mgr.c b/src/pulseaudio-mgr.c
index aca156a..fee504e 100644
--- a/src/pulseaudio-mgr.c
+++ b/src/pulseaudio-mgr.c
@@ -177,6 +177,12 @@ pm_update_volume (gint sink_index, pa_cvolume new_volume)
g_warning ("pm_update_volume sink index is negative or the context is null");
return;
}
+
+ if (pa_context_get_state (pulse_context) != PA_CONTEXT_READY ){
+ g_warning ("pm_update_volume context is not in a ready state");
+ return;
+ }
+
pa_operation *operation = NULL;
operation = pa_context_set_sink_volume_by_index (pulse_context,
@@ -198,6 +204,12 @@ pm_update_mute (gboolean update)
g_warning ("pm_update_mute - the context is null");
return;
}
+
+ if (pa_context_get_state (pulse_context) != PA_CONTEXT_READY ){
+ g_warning ("pm_update_mute context is not in a ready state");
+ return;
+ }
+
pa_operation *operation = NULL;
operation = pa_context_get_sink_info_list (pulse_context,
@@ -217,6 +229,12 @@ pm_update_mic_gain (gint source_index, pa_cvolume new_gain)
g_warning ("pm_update_mic_gain source index is negative or the context is null");
return;
}
+
+ if (pa_context_get_state (pulse_context) != PA_CONTEXT_READY ){
+ g_warning ("pm_update_mic_gain context is not in a ready state");
+ return;
+ }
+
pa_operation *operation = NULL;
operation = pa_context_set_source_volume_by_index (pulse_context,
@@ -237,6 +255,12 @@ pm_update_mic_mute (gint source_index, gint mute_update)
if (source_index < 0){
return;
}
+
+ if (pa_context_get_state (pulse_context) != PA_CONTEXT_READY ){
+ g_warning ("pm_update_mic_mute context is not in a ready state");
+ return;
+ }
+
pa_operation *operation = NULL;
operation = pa_context_set_source_mute_by_index (pulse_context,