summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Ratajsky <[email protected]>2014-11-20 16:55:56 +0100
committerMichal Ratajsky <[email protected]>2014-11-20 16:55:56 +0100
commiteab574a3b8362cceafc0417eab66b62edd2399e3 (patch)
treea0f4264afa96f69b2ef4607d1a8e9f230fe56cb6
parentfba7bd8e24abd215bbce6c704d4c112014f23a82 (diff)
downloadlibmatemixer-eab574a3b8362cceafc0417eab66b62edd2399e3.tar.bz2
libmatemixer-eab574a3b8362cceafc0417eab66b62edd2399e3.tar.xz
alsa: Emit "stream-added" after the stream element is added and the stream is gettable
Fixes mate_mixer_context_get_stream() not working when the signal is received
-rw-r--r--backends/alsa/alsa-device.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/backends/alsa/alsa-device.c b/backends/alsa/alsa-device.c
index 78d8bbc..f76478f 100644
--- a/backends/alsa/alsa-device.c
+++ b/backends/alsa/alsa-device.c
@@ -459,22 +459,13 @@ static void
add_element (AlsaDevice *device, AlsaStream *stream, AlsaElement *element)
{
snd_mixer_elem_t *el;
+ gboolean add_stream = FALSE;
if (alsa_element_load (element) == FALSE)
return;
- if (alsa_stream_has_controls_or_switches (stream) == FALSE) {
- const gchar *name =
- mate_mixer_stream_get_name (MATE_MIXER_STREAM (stream));
-
- free_stream_list (device);
-
- /* Pretend the stream has just been created now that we are adding
- * the first control */
- g_signal_emit_by_name (G_OBJECT (device),
- "stream-added",
- name);
- }
+ if (alsa_stream_has_controls_or_switches (stream) == FALSE)
+ add_stream = TRUE;
/* Add element to the stream depending on its type */
if (ALSA_IS_STREAM_CONTROL (element))
@@ -488,6 +479,19 @@ add_element (AlsaDevice *device, AlsaStream *stream, AlsaElement *element)
return;
}
+ if (add_stream == TRUE) {
+ const gchar *name =
+ mate_mixer_stream_get_name (MATE_MIXER_STREAM (stream));
+
+ free_stream_list (device);
+
+ /* Pretend the stream has just been created now that we have added
+ * the first control */
+ g_signal_emit_by_name (G_OBJECT (device),
+ "stream-added",
+ name);
+ }
+
el = alsa_element_get_snd_element (element);
/* Register to receive callbacks for element changes */