Support reporting the current mute setting

This commit is contained in:
Pierre Pronchery 2017-06-06 19:24:16 +02:00
parent 13474e6cd0
commit 2dca9f77c9

View File

@ -211,6 +211,8 @@ static void _channels_destroy(MixerControlPlugin * channels)
/* accessors */
static gboolean _get_mute(MixerControlPlugin * channels);
static int _channels_get(MixerControlPlugin * channels, va_list properties)
{
String const * p;
@ -234,6 +236,11 @@ static int _channels_get(MixerControlPlugin * channels, va_list properties)
u = va_arg(properties, unsigned int *);
*u = channels->delta;
}
if(string_compare(p, "mute") == 0)
{
b = va_arg(properties, gboolean *);
*b = _get_mute(channels);
}
else if(string_compare(p, "value") == 0)
{
if(channels->channels_cnt == 0)
@ -260,6 +267,15 @@ static int _channels_get(MixerControlPlugin * channels, va_list properties)
return 0;
}
static gboolean _get_mute(MixerControlPlugin * channels)
{
#if GTK_CHECK_VERSION(3, 0, 0)
return gtk_switch_get_active(GTK_SWITCH(channels->mute));
#else
return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(channels->mute));
#endif
}
/* channels_get_type */
static String const * _channels_get_type(MixerControlPlugin * channels)