diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-05-20 15:04:44 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-05-20 16:07:50 -0400 |
commit | ee2c55379cb2360da8a5adae46e634f31100c1a4 (patch) | |
tree | be7477e9775cceb3f79c67c9e9ae706a2c3c539d /gtk/gtkmediacontrols.c | |
parent | be8a83149669e72d7331b6116a0195b79b15d60a (diff) | |
download | gtk+-ee2c55379cb2360da8a5adae46e634f31100c1a4.tar.gz |
mediacontrols: Make volume control react to has-audio
Diffstat (limited to 'gtk/gtkmediacontrols.c')
-rw-r--r-- | gtk/gtkmediacontrols.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gtk/gtkmediacontrols.c b/gtk/gtkmediacontrols.c index 4f09d59feb..417f2d0ff7 100644 --- a/gtk/gtkmediacontrols.c +++ b/gtk/gtkmediacontrols.c @@ -51,6 +51,7 @@ struct _GtkMediaControls GtkWidget *time_label; GtkWidget *seek_scale; GtkWidget *duration_label; + GtkWidget *volume_button; }; enum @@ -288,6 +289,7 @@ gtk_media_controls_class_init (GtkMediaControlsClass *klass) gtk_widget_class_bind_template_child (widget_class, GtkMediaControls, time_label); gtk_widget_class_bind_template_child (widget_class, GtkMediaControls, seek_scale); gtk_widget_class_bind_template_child (widget_class, GtkMediaControls, duration_label); + gtk_widget_class_bind_template_child (widget_class, GtkMediaControls, volume_button); gtk_widget_class_bind_template_callback (widget_class, play_button_clicked); gtk_widget_class_bind_template_callback (widget_class, time_adjustment_changed); @@ -439,6 +441,10 @@ update_volume (GtkMediaControls *controls) volume = gtk_media_stream_get_volume (controls->stream); gtk_adjustment_set_value (controls->volume_adjustment, volume); + + gtk_widget_set_sensitive (controls->volume_button, + controls->stream == NULL || + gtk_media_stream_has_audio (controls->stream)); } static void @@ -468,6 +474,8 @@ gtk_media_controls_notify_cb (GtkMediaStream *stream, update_volume (controls); else if (g_str_equal (pspec->name, "volume")) update_volume (controls); + else if (g_str_equal (pspec->name, "has-audio")) + update_volume (controls); } /** |