[Xfce4-commits] [panel-plugins/xfce4-pulseaudio-plugin] 01/01: Show volume change notifications when triggered without multimedia keys (bug #13677)
noreply at xfce.org
noreply at xfce.org
Wed Nov 22 12:38:18 CET 2017
This is an automated email from the git hooks/post-receive script.
b l u e s a b r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository panel-plugins/xfce4-pulseaudio-plugin.
commit f96e213b84af927e6b427322bb0e7b4ca907911a
Author: Sean Davis <smd.seandavis at gmail.com>
Date: Wed Nov 22 06:38:09 2017 -0500
Show volume change notifications when triggered without multimedia keys (bug #13677)
---
panel-plugin/pulseaudio-volume.c | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/panel-plugin/pulseaudio-volume.c b/panel-plugin/pulseaudio-volume.c
index 6a2f1a0..b4f6597 100644
--- a/panel-plugin/pulseaudio-volume.c
+++ b/panel-plugin/pulseaudio-volume.c
@@ -64,6 +64,8 @@ struct _PulseaudioVolume
pa_glib_mainloop *pa_mainloop;
pa_context *pa_context;
gboolean connected;
+ gboolean sink_connected;
+ gboolean source_connected;
gdouble volume;
gboolean muted;
@@ -203,16 +205,22 @@ pulseaudio_volume_sink_info_cb (pa_context *context,
{
pulseaudio_debug ("Updated Mute: %d -> %d", volume->muted, muted);
volume->muted = muted;
- g_signal_emit (G_OBJECT (volume), pulseaudio_volume_signals [VOLUME_CHANGED], 0, FALSE);
+
+ if (volume->sink_connected)
+ g_signal_emit (G_OBJECT (volume), pulseaudio_volume_signals [VOLUME_CHANGED], 0, TRUE);
}
if (ABS (volume->volume - vol) > 2e-3)
{
pulseaudio_debug ("Updated Volume: %04.3f -> %04.3f", volume->volume, vol);
volume->volume = vol;
- g_signal_emit (G_OBJECT (volume), pulseaudio_volume_signals [VOLUME_CHANGED], 0, FALSE);
+
+ if (volume->sink_connected)
+ g_signal_emit(G_OBJECT(volume), pulseaudio_volume_signals[VOLUME_CHANGED], 0, TRUE);
}
+
pulseaudio_debug ("volume: %f, muted: %d", vol, muted);
+ volume->sink_connected = TRUE;
}
@@ -240,16 +248,22 @@ pulseaudio_volume_source_info_cb (pa_context *context,
{
pulseaudio_debug ("Updated Mute Mic: %d -> %d", volume->muted_mic, muted_mic);
volume->muted_mic = muted_mic;
- g_signal_emit (G_OBJECT (volume), pulseaudio_volume_signals [VOLUME_MIC_CHANGED], 0, FALSE);
+
+ if (volume->source_connected)
+ g_signal_emit (G_OBJECT (volume), pulseaudio_volume_signals [VOLUME_MIC_CHANGED], 0, FALSE);
}
if (ABS (volume->volume_mic - vol_mic) > 2e-3)
{
pulseaudio_debug ("Updated Volume Mic: %04.3f -> %04.3f", volume->volume_mic, vol_mic);
volume->volume_mic = vol_mic;
- g_signal_emit (G_OBJECT (volume), pulseaudio_volume_signals [VOLUME_MIC_CHANGED], 0, FALSE);
+
+ if (volume->source_connected)
+ g_signal_emit(G_OBJECT(volume), pulseaudio_volume_signals[VOLUME_MIC_CHANGED], 0, FALSE);
}
+
pulseaudio_debug ("volume mic: %f, muted mic: %d", vol_mic, muted_mic);
+ volume->source_connected = TRUE;
}
@@ -421,6 +435,9 @@ pulseaudio_volume_context_state_cb (pa_context *context,
g_signal_emit (G_OBJECT (volume), pulseaudio_volume_signals [VOLUME_CHANGED], 0, FALSE);
g_signal_emit (G_OBJECT (volume), pulseaudio_volume_signals [VOLUME_MIC_CHANGED], 0, FALSE);
+ volume->sink_connected = FALSE;
+ volume->source_connected = FALSE;
+
pa_context_get_server_info (volume->pa_context, pulseaudio_volume_get_server_info_cb, volume);
break;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list