Skip to content

Commit

Permalink
mediacontrols: Add tooltip text to play button
Browse files Browse the repository at this point in the history
This makes the button accessible.
  • Loading branch information
A6GibKm committed Apr 6, 2023
1 parent 9608e4e commit 62865bc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
12 changes: 10 additions & 2 deletions gtk/gtkmediacontrols.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,18 +399,26 @@ update_playing (GtkMediaControls *controls)
{
gboolean playing;
const char *icon_name;
const char *tooltip_text;

if (controls->stream)
playing = gtk_media_stream_get_playing (controls->stream);
else
playing = FALSE;

if (playing)
icon_name = "media-playback-pause-symbolic";
{
icon_name = "media-playback-pause-symbolic";
tooltip_text = C_("media controls tooltip", "Stop");
}
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_widget_set_tooltip_text (controls->play_button, tooltip_text);
}

static void
Expand Down
1 change: 1 addition & 0 deletions gtk/ui/gtkmediacontrols.ui
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<property name="valign">3</property>
<property name="has-frame">0</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"/>
</object>
</child>
Expand Down
1 change: 1 addition & 0 deletions po/POTFILES.in
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ gtk/ui/gtkfilechooserwidget.ui
gtk/ui/gtkfontchooserdialog.ui
gtk/ui/gtkfontchooserwidget.ui
gtk/ui/gtklockbutton.ui
gtk/ui/gtkmediacontrols.ui
gtk/ui/gtkmessagedialog.ui
gtk/ui/gtkpagesetupunixdialog.ui
gtk/ui/gtkplacesviewrow.ui
Expand Down

0 comments on commit 62865bc

Please sign in to comment.