diff options
author | Michal Ratajsky <[email protected]> | 2014-11-12 23:04:10 +0100 |
---|---|---|
committer | Michal Ratajsky <[email protected]> | 2014-11-12 23:04:10 +0100 |
commit | 52fd538bd1d823b6263efa3526bab797f0ab0827 (patch) | |
tree | a2c7b64d04f032d5df3930008130dc4fa6f75702 /mate-volume-control/src | |
parent | cededb5aec8b2dc6aea20c712555729cdb59317d (diff) | |
download | mate-media-52fd538bd1d823b6263efa3526bab797f0ab0827.tar.bz2 mate-media-52fd538bd1d823b6263efa3526bab797f0ab0827.tar.xz |
Make sure the selected card has a sink before providing speaker test
Diffstat (limited to 'mate-volume-control/src')
-rw-r--r-- | mate-volume-control/src/gvc-mixer-dialog.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/mate-volume-control/src/gvc-mixer-dialog.c b/mate-volume-control/src/gvc-mixer-dialog.c index 8db0ebf..0e155e3 100644 --- a/mate-volume-control/src/gvc-mixer-dialog.c +++ b/mate-volume-control/src/gvc-mixer-dialog.c @@ -1552,6 +1552,9 @@ on_card_selection_changed (GtkTreeSelection *selection, GtkTreeModel *model; GtkTreeIter iter; const GList *profiles; + GSList *sinks; + gint card_index; + gboolean has_sink = FALSE; guint id; GvcMixerCard *card; GvcMixerCardProfile *current_profile; @@ -1590,9 +1593,23 @@ on_card_selection_changed (GtkTreeSelection *selection, gtk_box_pack_start (GTK_BOX (dialog->priv->hw_settings_box), dialog->priv->hw_profile_combo, TRUE, TRUE, 6); + + sinks = gvc_mixer_control_get_sinks (dialog->priv->mixer_control); + card_index = gvc_mixer_card_get_index (card); + while (sinks != NULL) { + GvcMixerStream *s = sinks->data; + + if (gvc_mixer_stream_get_card_index (s) == card_index) { + has_sink = TRUE; + break; + } + sinks = sinks->next; + } + g_object_set (G_OBJECT (dialog->priv->hw_profile_combo), - "show-button", current_profile->n_sinks == 1, + "show-button", has_sink, NULL); + gtk_widget_show (dialog->priv->hw_profile_combo); g_object_set_data (G_OBJECT (dialog->priv->hw_profile_combo), "card", card); |