[gtk+] Add accessible names to csd buttons



commit dab146fe302d8f9dd0a3d2d56d63e900fa51df84
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Sep 20 15:01:24 2013 -0400

    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(+), 0 deletions(-)
---
diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c
index 3897a58..4a0481a 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 a8aeceb..5374d3f 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;
                 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]