From dab146fe302d8f9dd0a3d2d56d63e900fa51df84 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 20 Sep 2013 15:01:24 -0400 Subject: [PATCH] Add accessible names to csd buttons Its the right thing to do. --- gtk/gtkheaderbar.c | 4 ++++ gtk/gtkwindow.c | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c index 3897a5833d..4a0481a4b0 100644 --- a/gtk/gtkheaderbar.c +++ b/gtk/gtkheaderbar.c @@ -203,6 +203,7 @@ add_close_button (GtkHeaderBar *bar) GtkWidget *image; GtkWidget *separator; GtkStyleContext *context; + AtkObject *accessible; 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); g_signal_connect (button, "clicked", 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_set_parent (button, GTK_WIDGET (bar)); diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index a8aecebcd9..5374d3f953 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -5207,6 +5207,7 @@ update_window_buttons (GtkWindow *window) { GtkWidget *button = NULL; GtkWidget *image = NULL; + AtkObject *accessible; if (strcmp (t[j], "icon") == 0) { @@ -5236,6 +5237,9 @@ update_window_buttons (GtkWindow *window) gtk_widget_show_all (button); g_signal_connect (button, "clicked", 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; } else if (strcmp (t[j], "maximize") == 0 && @@ -5254,6 +5258,9 @@ update_window_buttons (GtkWindow *window) gtk_widget_show_all (button); g_signal_connect (button, "clicked", 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; } else if (strcmp (t[j], "close") == 0 && @@ -5269,6 +5276,9 @@ update_window_buttons (GtkWindow *window) gtk_widget_show_all (button); g_signal_connect_swapped (button, "clicked", 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; }