[gtk+] Add some accessible labels



commit cc127c64a933da51f2f3ae6024b958eaa1fa6106
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Feb 3 02:09:44 2012 -0500

    Add some accessible labels

 gtk/gtkcolorplane.c |   11 +++++++++++
 gtk/gtkcolorscale.c |   13 +++++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcolorplane.c b/gtk/gtkcolorplane.c
index 95f092a..efc205c 100644
--- a/gtk/gtkcolorplane.c
+++ b/gtk/gtkcolorplane.c
@@ -22,8 +22,10 @@
 #include "gtkhsv.h"
 #include "gtkcolorplane.h"
 #include "gtkcontainer.h"
+#include "gtkaccessible.h"
 #include "gtkwindow.h"
 #include "gtkbutton.h"
+#include "gtkintl.h"
 
 struct _GtkColorPlanePrivate
 {
@@ -385,6 +387,8 @@ sv_key_press (GtkWidget      *widget,
 static void
 gtk_color_plane_init (GtkColorPlane *plane)
 {
+  AtkObject *atk_obj;
+
   plane->priv = G_TYPE_INSTANCE_GET_PRIVATE (plane,
                                              GTK_TYPE_COLOR_PLANE,
                                              GtkColorPlanePrivate);
@@ -393,6 +397,13 @@ gtk_color_plane_init (GtkColorPlane *plane)
                                              | GDK_BUTTON_PRESS_MASK
                                              | GDK_BUTTON_RELEASE_MASK
                                              | GDK_POINTER_MOTION_MASK);
+
+  atk_obj = gtk_widget_get_accessible (GTK_WIDGET (plane));
+  if (GTK_IS_ACCESSIBLE (atk_obj))
+    {
+      atk_object_set_name (atk_obj, _("Color Plane"));
+      atk_object_set_role (atk_obj, ATK_ROLE_COLOR_CHOOSER);
+    }
 }
 
 static void
diff --git a/gtk/gtkcolorscale.c b/gtk/gtkcolorscale.c
index 60ef228..9e8401e 100644
--- a/gtk/gtkcolorscale.c
+++ b/gtk/gtkcolorscale.c
@@ -23,6 +23,7 @@
 #include "gtkhsv.h"
 #include "gtkorientable.h"
 #include "gtkstylecontext.h"
+#include "gtkaccessible.h"
 #include "gtkintl.h"
 
 struct _GtkColorScalePrivate
@@ -312,11 +313,23 @@ void
 gtk_color_scale_set_type (GtkColorScale     *scale,
                           GtkColorScaleType  type)
 {
+  AtkObject *atk_obj;
+
   scale->priv->type = type;
   cairo_surface_destroy (scale->priv->surface);
   scale->priv->surface = NULL;
   create_surface (scale);
   gtk_widget_queue_draw (GTK_WIDGET (scale));
+
+  atk_obj = gtk_widget_get_accessible (GTK_WIDGET (scale));
+  if (GTK_IS_ACCESSIBLE (atk_obj))
+    {
+      if (type == GTK_COLOR_SCALE_HUE)
+        atk_object_set_name (atk_obj, C_("Color channel", "Hue"));
+      else if (type == GTK_COLOR_SCALE_ALPHA)
+        atk_object_set_name (atk_obj, C_("Color channel", "Alpha"));
+      atk_object_set_role (gtk_widget_get_accessible (GTK_WIDGET (scale)), ATK_ROLE_COLOR_CHOOSER);
+    }
 }
 
 GtkWidget *



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