Merge branch 'media-controls' into 'main'

mediacontrols: Add tooltip text to play button

See merge request GNOME/gtk!5794
This commit is contained in:
Matthias Clasen 2023-04-06 17:59:54 +00:00
commit e0dbc6a0ee
3 changed files with 12 additions and 2 deletions

View File

@ -399,6 +399,7 @@ update_playing (GtkMediaControls *controls)
{ {
gboolean playing; gboolean playing;
const char *icon_name; const char *icon_name;
const char *tooltip_text;
if (controls->stream) if (controls->stream)
playing = gtk_media_stream_get_playing (controls->stream); playing = gtk_media_stream_get_playing (controls->stream);
@ -406,11 +407,18 @@ update_playing (GtkMediaControls *controls)
playing = FALSE; playing = FALSE;
if (playing) if (playing)
{
icon_name = "media-playback-pause-symbolic"; icon_name = "media-playback-pause-symbolic";
tooltip_text = C_("media controls tooltip", "Stop");
}
else else
{
icon_name = "media-playback-start-symbolic"; icon_name = "media-playback-start-symbolic";
tooltip_text = C_("media controls tooltip", "Play");
}
gtk_button_set_icon_name (GTK_BUTTON (controls->play_button), icon_name); gtk_button_set_icon_name (GTK_BUTTON (controls->play_button), icon_name);
gtk_widget_set_tooltip_text (controls->play_button, tooltip_text);
} }
static void static void

View File

@ -25,6 +25,7 @@
<property name="valign">3</property> <property name="valign">3</property>
<property name="has-frame">0</property> <property name="has-frame">0</property>
<property name="icon-name">media-playback-start-symbolic</property> <property name="icon-name">media-playback-start-symbolic</property>
<property name="tooltip-text" context="media controls tooltip" translatable="yes">Play</property>
<signal name="clicked" handler="play_button_clicked" object="GtkMediaControls" swapped="no"/> <signal name="clicked" handler="play_button_clicked" object="GtkMediaControls" swapped="no"/>
</object> </object>
</child> </child>

View File

@ -399,6 +399,7 @@ gtk/ui/gtkfilechooserwidget.ui
gtk/ui/gtkfontchooserdialog.ui gtk/ui/gtkfontchooserdialog.ui
gtk/ui/gtkfontchooserwidget.ui gtk/ui/gtkfontchooserwidget.ui
gtk/ui/gtklockbutton.ui gtk/ui/gtklockbutton.ui
gtk/ui/gtkmediacontrols.ui
gtk/ui/gtkmessagedialog.ui gtk/ui/gtkmessagedialog.ui
gtk/ui/gtkpagesetupunixdialog.ui gtk/ui/gtkpagesetupunixdialog.ui
gtk/ui/gtkplacesviewrow.ui gtk/ui/gtkplacesviewrow.ui