? ChangeLog.sv
? docs/gal-api.html
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gal/ChangeLog,v
retrieving revision 1.836
diff -u -r1.836 ChangeLog
--- ChangeLog	8 Dec 2003 05:52:30 -0000	1.836
+++ ChangeLog	17 Dec 2003 02:34:31 -0000
@@ -1,3 +1,39 @@
+2003-12-16  Yuedong Du  <yuedong.du@sun.com>
+
+	Fixed bug 51917, add atk support for ClickToAdd
+
+	* gal/a11y/e-table/Makefile.am: add files.
+	* gal/a11y/e-table/gal-a11y-e-table-click-to-add-factory.c:
+	(gal_a11y_e_table_click_to_add_factory_get_accessible_type),
+	(gal_a11y_e_table_click_to_add_factory_create_accessible),
+	(gal_a11y_e_table_click_to_add_factory_class_init),
+	(gal_a11y_e_table_click_to_add_factory_init),
+	(gal_a11y_e_table_click_to_add_factory_get_type): factory
+	for ClickToAdd
+	* gal/a11y/e-table/gal-a11y-e-table-click-to-add-factory.h:
+	ditto
+	* gal/a11y/e-table/gal-a11y-e-table-click-to-add.c:
+	(etcta_get_n_actions), (etcta_get_description),
+	(etcta_action_get_name), (idle_do_action), (etcta_do_action),
+	(atk_action_interface_init): a "click" action interface.
+	(etcta_get_name),
+	(etcta_get_n_children), (etcta_ref_child): create accessible
+	according to which child is available. Either rect or row.
+	(etcta_class_init),
+	(etcta_init), (gal_a11y_e_table_click_to_add_get_type),
+	(etcta_event): listen to canvas event, emit children-changed signal
+	when it found rect/row was changed.
+	(gal_a11y_e_table_click_to_add_new):
+	* gal/a11y/e-table/gal-a11y-e-table-click-to-add.h:
+	* gal/a11y/e-table/gal-a11y-e-table-item-factory.c:
+	(gal_a11y_e_table_item_factory_create_accessible):
+	* gal/a11y/e-table/gal-a11y-e-table.c: (init_child_item),
+	(et_get_n_children), (et_ref_child): change the trick way to
+	create a11y object for a table item. Because ClickToAdd is also
+	a table item, previous way do not work for clicktoadd.
+	* gal/e-table/e-table-click-to-add.c: (etcta_class_init):
+	atk_register the new a11y factory.
+
 2003-12-08  Andrew Wu <yang.wu@sun.com>
 	Fixed #50844
 
Index: gal/a11y/e-table/Makefile.am
===================================================================
RCS file: /cvs/gnome/gal/gal/a11y/e-table/Makefile.am,v
retrieving revision 1.6
diff -u -r1.6 Makefile.am
--- gal/a11y/e-table/Makefile.am	8 Dec 2003 05:52:31 -0000	1.6
+++ gal/a11y/e-table/Makefile.am	17 Dec 2003 02:34:31 -0000
@@ -22,6 +22,8 @@
 	gal-a11y-e-table.c			\
 	gal-a11y-e-table-item.c			\
 	gal-a11y-e-table-item-factory.c		\
+	gal-a11y-e-table-click-to-add.c		\
+	gal-a11y-e-table-click-to-add-factory.c	\
 	gal-a11y-e-table-factory.c
 
 libgal_a11y_etableincludedir = $(includedir)/gal-$(GAL_API_VERSION)/gal/a11y/e-table
@@ -37,5 +39,7 @@
 	gal-a11y-e-cell-registry.h		\
 	gal-a11y-e-table.h			\
 	gal-a11y-e-table-item.h			\
+	gal-a11y-e-table-click-to-add-factory.h	\
+	gal-a11y-e-table-click-to-add.h		\
 	gal-a11y-e-table-item-factory.h		\
 	gal-a11y-e-table-factory.h
Index: gal/a11y/e-table/gal-a11y-e-table-item-factory.c
===================================================================
RCS file: /cvs/gnome/gal/gal/a11y/e-table/gal-a11y-e-table-item-factory.c,v
retrieving revision 1.1
diff -u -r1.1 gal-a11y-e-table-item-factory.c
--- gal/a11y/e-table/gal-a11y-e-table-item-factory.c	11 Oct 2003 02:59:24 -0000	1.1
+++ gal/a11y/e-table/gal-a11y-e-table-item-factory.c	17 Dec 2003 02:34:31 -0000
@@ -28,20 +28,14 @@
 static AtkObject*
 gal_a11y_e_table_item_factory_create_accessible (GObject *obj)
 {
-	AtkObject * accessible;
+	AtkObject *accessible;
 	ETableItem * eti;
 	GnomeCanvas * gc;
 	GtkWidget * table;
 
 	g_return_if_fail (E_IS_TABLE_ITEM(obj));
-	eti = E_TABLE_ITEM(obj);
-	gc = GNOME_CANVAS_ITEM(eti)->canvas;
-
-	table = gtk_widget_get_parent(GTK_WIDGET(gc));
-
-	accessible = gtk_widget_get_accessible (table);
-	accessible = atk_object_ref_accessible_child (accessible, 0);
-
+	accessible = gal_a11y_e_table_item_new(NULL, obj, 0);
+                                                                                
 	return accessible;
 }
 
Index: gal/a11y/e-table/gal-a11y-e-table.c
===================================================================
RCS file: /cvs/gnome/gal/gal/a11y/e-table/gal-a11y-e-table.c,v
retrieving revision 1.2
diff -u -r1.2 gal-a11y-e-table.c
--- gal/a11y/e-table/gal-a11y-e-table.c	11 Oct 2003 02:59:24 -0000	1.2
+++ gal/a11y/e-table/gal-a11y-e-table.c	17 Dec 2003 02:34:31 -0000
@@ -13,6 +13,7 @@
 #include <gal/e-table/e-table.h>
 #include <gal/e-table/e-table-group.h>
 #include <gal/e-table/e-table-group-leaf.h>
+#include <gal/e-table/e-table-click-to-add.h>
 
 #define CS_CLASS(a11y) (G_TYPE_INSTANCE_GET_CLASS ((a11y), C_TYPE_STREAM, GalA11yETableClass))
 static AtkObjectClass *parent_class;
@@ -33,7 +34,7 @@
 	GalA11yETablePrivate *priv = GET_PRIVATE (a11y);
 	ETable *table = E_TABLE (GTK_ACCESSIBLE (a11y)->widget);
 	if (priv->child_item == NULL) {
-		priv->child_item = gal_a11y_e_table_item_new (ATK_OBJECT (a11y), E_TABLE_GROUP_LEAF (table->group)->item, 0);
+		priv->child_item = atk_gobject_accessible_for_object (G_OBJECT(E_TABLE_GROUP_LEAF (table->group)->item));
 		priv->child_item->role = ATK_ROLE_TABLE;
 	}
 }
@@ -52,6 +53,14 @@
 static gint
 et_get_n_children (AtkObject *accessible)
 {
+	GalA11yETable *a11y = GAL_A11Y_E_TABLE (accessible);
+	ETable * et;
+
+	et = E_TABLE(GTK_ACCESSIBLE (a11y)->widget);
+	if (et && et->use_click_to_add) {
+		return 2;
+	}
+
 	return 1;
 }
 
@@ -60,11 +69,30 @@
 	      gint i)
 {
 	GalA11yETable *a11y = GAL_A11Y_E_TABLE (accessible);
-	if (i != 0)
-		return NULL;
-	init_child_item (a11y);
-	g_object_ref (GET_PRIVATE (a11y)->child_item);
-	return GET_PRIVATE (a11y)->child_item;
+	ETable * et;
+
+	et = E_TABLE(GTK_ACCESSIBLE (a11y)->widget);
+
+	if (i == 0) {
+		init_child_item (a11y);
+		g_object_ref (GET_PRIVATE (a11y)->child_item);
+		return GET_PRIVATE (a11y)->child_item;
+	} else if (i == 1) {
+        	AtkObject * accessible;
+		ETableClickToAdd * etcta;
+
+		if (et && et->use_click_to_add && et->click_to_add) {
+			etcta = E_TABLE_CLICK_TO_ADD(et->click_to_add);
+			if (etcta->rect) {
+				accessible = atk_gobject_accessible_for_object (G_OBJECT(etcta));
+			} else {
+				accessible = atk_gobject_accessible_for_object (G_OBJECT(etcta->row));
+			}
+			return accessible;
+		}
+	}
+
+	return NULL;
 }
 
 static void
Index: gal/e-table/e-table-click-to-add.c
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-table-click-to-add.c,v
retrieving revision 1.36
diff -u -r1.36 e-table-click-to-add.c
--- gal/e-table/e-table-click-to-add.c	12 Feb 2003 23:36:21 -0000	1.36
+++ gal/e-table/e-table-click-to-add.c	17 Dec 2003 02:34:31 -0000
@@ -39,6 +39,7 @@
 #include "gal/util/e-util.h"
 #include "gal/util/e-i18n.h"
 #include "gal/util/e-marshal.h"
+#include "gal/a11y/e-table/gal-a11y-e-table-click-to-add-factory.h"
 
 enum {
 	CURSOR_CHANGE,
@@ -494,6 +495,11 @@
 			      NULL, NULL,
 			      e_marshal_VOID__INT_INT,
 			      G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
+
+	atk_registry_set_factory_type (atk_get_default_registry (),
+					E_TABLE_CLICK_TO_ADD_TYPE,
+					gal_a11y_e_table_click_to_add_factory_get_type ());
+
 }
 
 static void
