summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Ratajsky <[email protected]>2016-01-04 20:48:42 +0100
committerMichal Ratajsky <[email protected]>2016-01-04 20:48:42 +0100
commit44f5c4d6c55389e427916c86a963de20191ad86b (patch)
treec4d0785d2553a6ec3bcf84c53ae99636b60f290e
parent0de529565d045e51200a111c9d2bee71e5d20af6 (diff)
downloadlibmatemixer-44f5c4d6c55389e427916c86a963de20191ad86b.tar.bz2
libmatemixer-44f5c4d6c55389e427916c86a963de20191ad86b.tar.xz
Make sure each stream has a default control to match documented behaviour
-rw-r--r--libmatemixer/matemixer-stream.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/libmatemixer/matemixer-stream.c b/libmatemixer/matemixer-stream.c
index b5db39a..9110e22 100644
--- a/libmatemixer/matemixer-stream.c
+++ b/libmatemixer/matemixer-stream.c
@@ -393,9 +393,19 @@ mate_mixer_stream_get_switch (MateMixerStream *stream, const gchar *name)
MateMixerStreamControl *
mate_mixer_stream_get_default_control (MateMixerStream *stream)
{
+ const GList *list;
+
g_return_val_if_fail (MATE_MIXER_IS_STREAM (stream), NULL);
- return stream->priv->control;
+ if (stream->priv->control != NULL)
+ return stream->priv->control;
+
+ /* If the stream does not have a default control, just return the first one */
+ list = mate_mixer_stream_list_controls (stream);
+ if (list != NULL)
+ return MATE_MIXER_STREAM_CONTROL (list->data);
+
+ return NULL;
}
/**