Add accessible names to csd buttons

Its the right thing to do.
This commit is contained in:
Matthias Clasen 2013-09-20 15:01:24 -04:00
parent b4ab4a96cb
commit dab146fe30
2 changed files with 14 additions and 0 deletions

View File

@ -203,6 +203,7 @@ add_close_button (GtkHeaderBar *bar)
GtkWidget *image; GtkWidget *image;
GtkWidget *separator; GtkWidget *separator;
GtkStyleContext *context; GtkStyleContext *context;
AtkObject *accessible;
priv = gtk_header_bar_get_instance_private (bar); priv = gtk_header_bar_get_instance_private (bar);
@ -218,6 +219,9 @@ add_close_button (GtkHeaderBar *bar)
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE); gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (close_button_clicked), NULL); G_CALLBACK (close_button_clicked), NULL);
accessible = gtk_widget_get_accessible (button);
if (GTK_IS_ACCESSIBLE (accessible))
atk_object_set_name (accessible, _("Close"));
gtk_widget_show_all (button); gtk_widget_show_all (button);
gtk_widget_set_parent (button, GTK_WIDGET (bar)); gtk_widget_set_parent (button, GTK_WIDGET (bar));

View File

@ -5207,6 +5207,7 @@ update_window_buttons (GtkWindow *window)
{ {
GtkWidget *button = NULL; GtkWidget *button = NULL;
GtkWidget *image = NULL; GtkWidget *image = NULL;
AtkObject *accessible;
if (strcmp (t[j], "icon") == 0) if (strcmp (t[j], "icon") == 0)
{ {
@ -5236,6 +5237,9 @@ update_window_buttons (GtkWindow *window)
gtk_widget_show_all (button); gtk_widget_show_all (button);
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (gtk_window_titlebar_min_clicked), window); G_CALLBACK (gtk_window_titlebar_min_clicked), window);
accessible = gtk_widget_get_accessible (button);
if (GTK_IS_ACCESSIBLE (accessible))
atk_object_set_name (accessible, _("Minimize"));
priv->titlebar_min_button = button; priv->titlebar_min_button = button;
} }
else if (strcmp (t[j], "maximize") == 0 && else if (strcmp (t[j], "maximize") == 0 &&
@ -5254,6 +5258,9 @@ update_window_buttons (GtkWindow *window)
gtk_widget_show_all (button); gtk_widget_show_all (button);
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (gtk_window_titlebar_max_clicked), window); G_CALLBACK (gtk_window_titlebar_max_clicked), window);
accessible = gtk_widget_get_accessible (button);
if (GTK_IS_ACCESSIBLE (accessible))
atk_object_set_name (accessible, maximized ? _("Restore") : _("Maximize"));
priv->titlebar_max_button = button; priv->titlebar_max_button = button;
} }
else if (strcmp (t[j], "close") == 0 && else if (strcmp (t[j], "close") == 0 &&
@ -5269,6 +5276,9 @@ update_window_buttons (GtkWindow *window)
gtk_widget_show_all (button); gtk_widget_show_all (button);
g_signal_connect_swapped (button, "clicked", g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_window_close), window); G_CALLBACK (gtk_window_close), window);
accessible = gtk_widget_get_accessible (button);
if (GTK_IS_ACCESSIBLE (accessible))
atk_object_set_name (accessible, _("Close"));
priv->titlebar_close_button = button; priv->titlebar_close_button = button;
} }