[cairo-commit] goocanvas/src goocanvasatk.c, 1.1, 1.2 goocanvasellipseview.c, 1.8, 1.9 goocanvasgroup.c, 1.7, 1.8 goocanvasgroup.h, 1.5, 1.6 goocanvasgroupview.c, 1.11, 1.12 goocanvasimageview.c, 1.8, 1.9 goocanvasitem.c, 1.6, 1.7 goocanvasitemsimple.c, 1.7, 1.8 goocanvasitemsimple.h, 1.6, 1.7 goocanvasitemviewsimple.c, 1.3, 1.4 goocanvasitemviewsimple.h, 1.2, 1.3 goocanvaspathview.c, 1.6, 1.7 goocanvaspolylineview.c, 1.9, 1.10 goocanvasrectview.c, 1.8, 1.9 goocanvastextview.c, 1.9, 1.10

Damon Chaplin commit at pdx.freedesktop.org
Wed Apr 19 02:40:46 EEST 2006


Committed by: damon

Update of /cvs/cairo/goocanvas/src
In directory kemper:/tmp/cvs-serv14589/src

Modified Files:
	goocanvasatk.c goocanvasellipseview.c goocanvasgroup.c 
	goocanvasgroup.h goocanvasgroupview.c goocanvasimageview.c 
	goocanvasitem.c goocanvasitemsimple.c goocanvasitemsimple.h 
	goocanvasitemviewsimple.c goocanvasitemviewsimple.h 
	goocanvaspathview.c goocanvaspolylineview.c 
	goocanvasrectview.c goocanvastextview.c 
Log Message:
2006-04-19  Damon Chaplin  <damon at gnome.org>

	* src/goocanvasitem.c (goo_canvas_item_base_init): added "title" and
	"description" properties for accessibility. Note that we only support
	per-item settings for the standard canvas items, though more complex
	items may want to support per-view settings.

	* src/goocanvasitemsimple.c: 
	* src/goocanvasgroup.c: implemented "title" and "description"
	properties.

	* src/goocanvas*view.c: set the accessible name & description based
	on the item's settings, and update them if changed.

	* src/goocanvasatk.c (goo_canvas_item_view_accessible_ref_child): 
	return the accessible rather than the item view.



Index: goocanvasatk.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasatk.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- goocanvasatk.c	18 Apr 2006 15:43:07 -0000	1.1
+++ goocanvasatk.c	18 Apr 2006 23:40:44 -0000	1.2
@@ -346,6 +346,7 @@
 					   gint       child_num)
 {
   GooCanvasItemView *item_view, *child_view;
+  AtkObject *atk_object;
   GObject *object;
 
   g_return_val_if_fail (GOO_IS_CANVAS_ITEM_VIEW_ACCESSIBLE (accessible), NULL);
@@ -357,10 +358,13 @@
   item_view = GOO_CANVAS_ITEM_VIEW (object);
 
   child_view = goo_canvas_item_view_get_child (item_view, child_num);
-  if (child_view)
-    return g_object_ref (child_view);
+  if (!child_view)
+    return NULL;
 
-  return NULL;
+  atk_object = atk_gobject_accessible_for_object (G_OBJECT (child_view));
+  g_object_ref (atk_object);
+
+  return atk_object;
 }
 
 

Index: goocanvasellipseview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasellipseview.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- goocanvasellipseview.c	16 Apr 2006 22:29:44 -0000	1.8
+++ goocanvasellipseview.c	18 Apr 2006 23:40:44 -0000	1.9
@@ -78,6 +78,8 @@
   view->parent_view = parent_view;
   view->item = g_object_ref (ellipse);
 
+  goo_canvas_item_view_simple_setup_accessibility (view);
+
   g_signal_connect (ellipse, "changed",
 		    G_CALLBACK (goo_canvas_item_view_simple_item_changed),
 		    view);

Index: goocanvasgroup.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasgroup.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- goocanvasgroup.c	16 Apr 2006 10:39:51 -0000	1.7
+++ goocanvasgroup.c	18 Apr 2006 23:40:44 -0000	1.8
@@ -43,7 +43,9 @@
   PROP_TRANSFORM,
   PROP_VISIBILITY,
   PROP_VISIBILITY_THRESHOLD,
-  PROP_POINTER_EVENTS
+  PROP_POINTER_EVENTS,
+  PROP_TITLE,
+  PROP_DESCRIPTION
 };
 
 
@@ -85,6 +87,12 @@
 
   g_object_class_override_property (gobject_class, PROP_POINTER_EVENTS,
 				    "pointer-events");
+
+  g_object_class_override_property (gobject_class, PROP_TITLE,
+				    "title");
+
+  g_object_class_override_property (gobject_class, PROP_DESCRIPTION,
+				    "description");
 }
 
 
@@ -323,6 +331,12 @@
     case PROP_POINTER_EVENTS:
       g_value_set_enum (value, group->pointer_events);
       break;
+    case PROP_TITLE:
+      g_value_set_string (value, group->title);
+      break;
+    case PROP_DESCRIPTION:
+      g_value_set_string (value, group->description);
+      break;
 
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -355,6 +369,14 @@
     case PROP_POINTER_EVENTS:
       group->pointer_events = g_value_get_enum (value);
       break;
+    case PROP_TITLE:
+      g_free (group->title);
+      group->title = g_value_dup_string (value);
+      break;
+    case PROP_DESCRIPTION:
+      g_free (group->description);
+      group->description = g_value_dup_string (value);
+      break;
 
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);

Index: goocanvasgroup.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasgroup.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- goocanvasgroup.h	16 Apr 2006 10:39:51 -0000	1.5
+++ goocanvasgroup.h	18 Apr 2006 23:40:44 -0000	1.6
@@ -56,6 +56,10 @@
 
   /* What events the group should receive. */
   GooCanvasPointerEvents pointer_events;
+
+  /* The title and description of the item for accessibility. */
+  gchar *title;
+  gchar *description;
 };
 
 struct _GooCanvasGroupClass

Index: goocanvasgroupview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasgroupview.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- goocanvasgroupview.c	18 Apr 2006 15:43:07 -0000	1.11
+++ goocanvasgroupview.c	18 Apr 2006 23:40:44 -0000	1.12
@@ -92,6 +92,30 @@
 }
 
 
+static void
+goo_canvas_group_view_title_changed (GooCanvasGroup     *group,
+				     GParamSpec         *pspec,
+				     GooCanvasGroupView *group_view)
+{
+  AtkObject *accessible;
+
+  accessible = atk_gobject_accessible_for_object (G_OBJECT (group_view));
+  atk_object_set_name (accessible, group->title);
+}
+
+
+static void
+goo_canvas_group_view_description_changed (GooCanvasGroup     *group,
+					   GParamSpec         *pspec,
+					   GooCanvasGroupView *group_view)
+{
+  AtkObject *accessible;
+
+  accessible = atk_gobject_accessible_for_object (G_OBJECT (group_view));
+  atk_object_set_description (accessible, group->description);
+}
+
+
 /**
  * goo_canvas_group_view_new:
  * @canvas_view: the canvas view.
@@ -111,12 +135,26 @@
 				GooCanvasGroup    *group)
 {
   GooCanvasGroupView *group_view;
+  AtkObject *accessible;
 
   group_view = GOO_CANVAS_GROUP_VIEW (g_object_new (GOO_TYPE_CANVAS_GROUP_VIEW, NULL));
   group_view->canvas_view = canvas_view;
   group_view->parent_view = parent_view;
   group_view->group = g_object_ref (group);
 
+  accessible = atk_gobject_accessible_for_object (G_OBJECT (group_view));
+  if (group->title)
+    atk_object_set_name (accessible, group->title);
+  if (group->description)
+    atk_object_set_description (accessible, group->description);
+
+  g_signal_connect (group, "notify::title",
+		    G_CALLBACK (goo_canvas_group_view_title_changed),
+		    group_view);
+  g_signal_connect (group, "notify::description",
+		    G_CALLBACK (goo_canvas_group_view_description_changed),
+		    group_view);
+
   add_child_views_recursively (group_view);
   connect_group_signals (group_view);
 

Index: goocanvasimageview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasimageview.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- goocanvasimageview.c	16 Apr 2006 22:29:44 -0000	1.8
+++ goocanvasimageview.c	18 Apr 2006 23:40:44 -0000	1.9
@@ -75,6 +75,8 @@
   view->parent_view = parent_view;
   view->item = g_object_ref (image);
 
+  goo_canvas_item_view_simple_setup_accessibility (view);
+
   g_signal_connect (image, "changed",
 		    G_CALLBACK (goo_canvas_item_view_simple_item_changed),
 		    view);

Index: goocanvasitem.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitem.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- goocanvasitem.c	16 Apr 2006 13:20:05 -0000	1.6
+++ goocanvasitem.c	18 Apr 2006 23:40:44 -0000	1.7
@@ -176,6 +176,20 @@
 							      GOO_CANVAS_EVENTS_VISIBLE_PAINTED,
 							      G_PARAM_READWRITE));
 
+      g_object_interface_install_property (g_iface,
+					   g_param_spec_string ("title",
+								_("Title"),
+								_("A short context-rich description of the item for use by assistive technologies"),
+								NULL,
+								G_PARAM_READWRITE));
+
+      g_object_interface_install_property (g_iface,
+					   g_param_spec_string ("description",
+								_("Description"),
+								_("A description of the item for use by assistive technologies"),
+								NULL,
+								G_PARAM_READWRITE));
+
       initialized = TRUE;
     }
 }

Index: goocanvasitemsimple.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitemsimple.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- goocanvasitemsimple.c	16 Apr 2006 13:20:05 -0000	1.7
+++ goocanvasitemsimple.c	18 Apr 2006 23:40:44 -0000	1.8
@@ -55,7 +55,9 @@
   PROP_TRANSFORM,
   PROP_VISIBILITY,
   PROP_VISIBILITY_THRESHOLD,
-  PROP_POINTER_EVENTS
+  PROP_POINTER_EVENTS,
+  PROP_TITLE,
+  PROP_DESCRIPTION
 };
 
 
@@ -325,6 +327,12 @@
 
   g_object_class_override_property (gobject_class, PROP_POINTER_EVENTS,
 				    "pointer-events");
+
+  g_object_class_override_property (gobject_class, PROP_TITLE,
+				    "title");
+
+  g_object_class_override_property (gobject_class, PROP_DESCRIPTION,
+				    "description");
 }
 
 
@@ -419,6 +427,12 @@
     case PROP_POINTER_EVENTS:
       g_value_set_enum (value, item->pointer_events);
       break;
+    case PROP_TITLE:
+      g_value_set_string (value, item->title);
+      break;
+    case PROP_DESCRIPTION:
+      g_value_set_string (value, item->description);
+      break;
 
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -590,6 +604,14 @@
     case PROP_POINTER_EVENTS:
       item->pointer_events = g_value_get_enum (value);
       break;
+    case PROP_TITLE:
+      g_free (item->title);
+      item->title = g_value_dup_string (value);
+      break;
+    case PROP_DESCRIPTION:
+      g_free (item->description);
+      item->description = g_value_dup_string (value);
+      break;
 
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);

Index: goocanvasitemsimple.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitemsimple.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- goocanvasitemsimple.h	16 Apr 2006 10:39:51 -0000	1.6
+++ goocanvasitemsimple.h	18 Apr 2006 23:40:44 -0000	1.7
@@ -136,6 +136,10 @@
 
   /* What events the item should receive. */
   GooCanvasPointerEvents pointer_events;
+
+  /* The title and description of the item for accessibility. */
+  gchar *title;
+  gchar *description;
 };
 
 struct _GooCanvasItemSimpleClass

Index: goocanvasitemviewsimple.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitemviewsimple.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- goocanvasitemviewsimple.c	18 Apr 2006 15:43:07 -0000	1.3
+++ goocanvasitemviewsimple.c	18 Apr 2006 23:40:44 -0000	1.4
@@ -359,4 +359,56 @@
 }
 
 
+static void
+goo_canvas_item_view_simple_title_changed (GooCanvasItemSimple     *simple,
+					   GParamSpec              *pspec,
+					   GooCanvasItemViewSimple *simple_view)
+{
+  AtkObject *accessible;
+
+  accessible = atk_gobject_accessible_for_object (G_OBJECT (simple_view));
+  atk_object_set_name (accessible, simple->title);
+}
+
+
+static void
+goo_canvas_item_view_simple_description_changed (GooCanvasItemSimple     *simple,
+						 GParamSpec              *pspec,
+						 GooCanvasItemViewSimple *simple_view)
+{
+  AtkObject *accessible;
+
+  accessible = atk_gobject_accessible_for_object (G_OBJECT (simple_view));
+  atk_object_set_description (accessible, simple->description);
+}
+
+
+/**
+ * goo_canvas_item_view_simple_setup_accessibility:
+ * @simple_view: a #GooCanvasItemViewSimple.
+ * 
+ * Sets the accessible name and description of the view based on the "title"
+ * and "description" settings of the underlying canvas item.
+ *
+ * It also connects to the "notify::title" and "notify::description" signals
+ * to update the name and description when they are changed.
+ **/
+void
+goo_canvas_item_view_simple_setup_accessibility (GooCanvasItemViewSimple *simple_view)
+{
+  GooCanvasItemSimple *simple = simple_view->item;
+  AtkObject *accessible;
 
+  accessible = atk_gobject_accessible_for_object (G_OBJECT (simple_view));
+  if (simple->title)
+    atk_object_set_name (accessible, simple->title);
+  if (simple->description)
+    atk_object_set_description (accessible, simple->description);
+
+  g_signal_connect (simple, "notify::title",
+		    G_CALLBACK (goo_canvas_item_view_simple_title_changed),
+		    simple_view);
+  g_signal_connect (simple, "notify::description",
+		    G_CALLBACK (goo_canvas_item_view_simple_description_changed),
+		    simple_view);
+}

Index: goocanvasitemviewsimple.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitemviewsimple.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- goocanvasitemviewsimple.h	18 Apr 2006 15:43:07 -0000	1.2
+++ goocanvasitemviewsimple.h	18 Apr 2006 23:40:44 -0000	1.3
@@ -76,6 +76,8 @@
 						gboolean                 recompute_bounds,
 						GooCanvasItemViewSimple *simple_view);
 
+void  goo_canvas_item_view_simple_setup_accessibility (GooCanvasItemViewSimple *simple_view);
+
 G_END_DECLS
 
 #endif /* __GOO_CANVAS_ITEM_VIEW_SIMPLE_H__ */

Index: goocanvaspathview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvaspathview.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- goocanvaspathview.c	16 Apr 2006 22:29:44 -0000	1.6
+++ goocanvaspathview.c	18 Apr 2006 23:40:44 -0000	1.7
@@ -77,6 +77,8 @@
   view->parent_view = parent_view;
   view->item = g_object_ref (path);
 
+  goo_canvas_item_view_simple_setup_accessibility (view);
+
   g_signal_connect (path, "changed",
 		    G_CALLBACK (goo_canvas_item_view_simple_item_changed),
 		    view);

Index: goocanvaspolylineview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvaspolylineview.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- goocanvaspolylineview.c	16 Apr 2006 22:29:44 -0000	1.9
+++ goocanvaspolylineview.c	18 Apr 2006 23:40:44 -0000	1.10
@@ -76,6 +76,8 @@
   view->parent_view = parent_view;
   view->item = g_object_ref (polyline);
 
+  goo_canvas_item_view_simple_setup_accessibility (view);
+
   g_signal_connect (polyline, "changed",
 		    G_CALLBACK (goo_canvas_item_view_simple_item_changed),
 		    view);

Index: goocanvasrectview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasrectview.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- goocanvasrectview.c	16 Apr 2006 22:29:44 -0000	1.8
+++ goocanvasrectview.c	18 Apr 2006 23:40:44 -0000	1.9
@@ -79,6 +79,8 @@
   view->parent_view = parent_view;
   view->item = g_object_ref (rect);
 
+  goo_canvas_item_view_simple_setup_accessibility (view);
+
   g_signal_connect (rect, "changed",
 		    G_CALLBACK (goo_canvas_item_view_simple_item_changed),
 		    view);

Index: goocanvastextview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvastextview.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- goocanvastextview.c	16 Apr 2006 22:29:44 -0000	1.9
+++ goocanvastextview.c	18 Apr 2006 23:40:44 -0000	1.10
@@ -81,6 +81,8 @@
   view->parent_view = parent_view;
   view->item = g_object_ref (text);
 
+  goo_canvas_item_view_simple_setup_accessibility (view);
+
   g_signal_connect (text, "changed",
 		    G_CALLBACK (goo_canvas_item_view_simple_item_changed),
 		    view);



More information about the cairo-commit mailing list