[evolution-patches] the 3rd part of the gal a11y patch



Hi, JP

Here is the 3rd part of the gal a11y patch.
Please review it.

Thank you very much.

Regards,
Li

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gal/ChangeLog,v
retrieving revision 1.902
diff -u -r1.902 ChangeLog
--- ChangeLog	28 Nov 2004 20:32:01 -0000	1.902
+++ ChangeLog	23 Dec 2004 04:23:56 -0000
@@ -1,3 +1,68 @@
+2004-12-17  Li Yuan  <li yuan sun com>
+
+	* gal/a11y/e-table/Makefile.am:
+	add gal-a11y-e-cell-vbox.h and gal-a11y-e-cell-vbox.c.
+	* gal/a11y/e-table/gal-a11y-e-cell-vbox.c: (ecv_get_n_children),
+	(subcell_destroyed), (ecv_ref_child), (ecv_dispose),
+	(ecv_ref_accessible_at_point), (ecv_class_init), (ecv_init),
+	(ecv_atk_component_iface_init), (gal_a11y_e_cell_vbox_get_type),
+	(gal_a11y_e_cell_vbox_new):
+	* gal/a11y/e-table/gal-a11y-e-cell-vbox.h:
+	implement a11y object of ECellVbox.
+	* gal/a11y/e-table/gal-a11y-e-table-item-factory.c:
+	(gal_a11y_e_table_item_factory_create_accessible):
+	parameters of gal_a11y_e_table_item_new have been changed.
+	* gal/a11y/e-table/gal-a11y-e-table-item.c: 
+	(item_destroyed): add ATK_STATE_DEFUNCT state.
+	(eti_ref_state_set): just ref state_set.
+	(eti_dispose): do not clear parent here.
+	(eti_ref_child): remove support for column header. use eti_ref_at
+	instead of atk_table_ref_at.
+	(eti_get_extents): add support for click to add.
+	(eti_ref_accessible_at_point): e-tree and e-table are different here.
+	(cell_destroyed): and a check and unref item.
+	(eti_ref_at): if e-table-item has DEFUNCT state, return NULL.
+	do not add SHOWING and VISIBLE states here.
+	(eti_get_column_header): use column name as the a11y name. set it role
+	as ATK_ROLE_TABLE_COLUMN_HEADER.	
+	(table_is_row_selected): use view_to_model_row to convert row when 
+	uses source model.
+	(table_get_selected_rows): if e-table-item has DEFUNCT state, return 0.
+	(table_remove_row_selection): use view_to_model_row to convert row 
+	when uses source model.
+	(eti_class_init): add eti_ref_state_set, remove eti_get_parent 
+	and eti_get_index_in_parent.
+	(eti_init): init parent and index_in_parent.
+	(gal_a11y_e_table_item_new): add some states. get name form parents.
+	init role correctly. add FOCUSED state to focused cell.
+	(eti_a11y_selection_changed_cb):  if e-table-item has DEFUNCT state,
+	just return.
+	(eti_a11y_cursor_changed_cb): remove the FOCUESD state form the old cell.
+	(selection_add_selection): if it has been focused already, just return.
+	if another row was focused, clear it first.
+	(selection_ref_selection): use eti_ref_at instead of atk_table_ref_at.
+	(gal_a11y_e_table_item_init): add this function.
+	* gal/a11y/e-table/gal-a11y-e-table-item.h:
+	add gal_a11y_e_table_item_init and change the parameters of 
+	gal_a11y_e_table_item_new.
+	* gal/a11y/e-table/gal-a11y-e-table.c: 
+	(find_first_table_item): find the first item of the group.
+	(eti_ref_accessible), 
+	(find_table_item): find the first table item.
+	(init_child_item): ref every group's first item.
+	(et_ref_accessible_at_point): no need to call init_child_item here.
+	just ref the item.
+	(et_get_n_children): add support for multiple ETableItems.
+	(et_ref_child): add support for multiple ETableItems.
+	(et_get_layer): Set AtkLayer as ATK_LAYER_WIDGET for e-table.
+	(et_atk_component_iface_init): add et_get_layer function.
+	(gal_a11y_e_table_new): ref the a11y and widget, and unref it in 
+	the idle function to avoid crash.
+	* gal/a11y/e-table/gal-a11y-e-tree.c: 
+	(init_child_item): just get the a11y object of the child item.
+	(et_get_layer): Set AtkLayer as ATK_LAYER_WIDGET for etree.
+	(et_atk_component_iface_init): add et_get_layer function.
+
 2004-11-28  JP Rosevear  <jpr novell com>
 
 	* configure.in: bump version
Index: gal/a11y/e-table/Makefile.am
===================================================================
RCS file: /cvs/gnome/gal/gal/a11y/e-table/Makefile.am,v
retrieving revision 1.7
diff -u -r1.7 Makefile.am
--- gal/a11y/e-table/Makefile.am	17 Dec 2003 02:35:20 -0000	1.7
+++ gal/a11y/e-table/Makefile.am	23 Dec 2004 04:28:15 -0000
@@ -19,6 +19,7 @@
 	gal-a11y-e-cell-toggle.c		\
 	gal-a11y-e-cell-popup.c			\
 	gal-a11y-e-cell-registry.c		\
+	gal-a11y-e-cell-vbox.c			\
 	gal-a11y-e-table.c			\
 	gal-a11y-e-table-item.c			\
 	gal-a11y-e-table-item-factory.c		\
@@ -37,6 +38,7 @@
 	gal-a11y-e-cell-toggle.h		\
 	gal-a11y-e-cell-popup.h			\
 	gal-a11y-e-cell-registry.h		\
+	gal-a11y-e-cell-vbox.h			\
 	gal-a11y-e-table.h			\
 	gal-a11y-e-table-item.h			\
 	gal-a11y-e-table-click-to-add-factory.h	\
Index: gal/a11y/e-table/gal-a11y-e-cell-vbox.c
===================================================================
RCS file: gal/a11y/e-table/gal-a11y-e-cell-vbox.c
diff -N gal/a11y/e-table/gal-a11y-e-cell-vbox.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gal/a11y/e-table/gal-a11y-e-cell-vbox.c	23 Dec 2004 04:28:15 -0000
@@ -0,0 +1,214 @@
+/* Evolution Accessibility: gal-a11y-e-cell-vbox.c
+ *
+ * Copyright (C) 2004 Sun Microsystem, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Eric Zhao <eric zhao sun com> Sun Microsystem Inc., 2004
+ *
+ */
+#include "gal-a11y-e-cell-vbox.h"
+#include "gal-a11y-e-cell-registry.h"
+#include <gal/e-table/e-cell-vbox.h>
+#include <atk/atkcomponent.h>
+
+static GObjectClass *parent_class;
+static AtkComponentIface *component_parent_iface;
+#define PARENT_TYPE (gal_a11y_e_cell_get_type ())
+
+static gint
+ecv_get_n_children (AtkObject *a11y)
+{
+	g_return_val_if_fail (GAL_A11Y_IS_E_CELL_VBOX (a11y), 0);
+	GalA11yECellVbox *gaev = GAL_A11Y_E_CELL_VBOX (a11y);
+	return (gaev->a11y_subcell_count);
+}
+
+static void
+subcell_destroyed (gpointer data)
+{
+	GalA11yECell *cell;
+	AtkObject *parent;
+	GalA11yECellVbox *gaev;
+	
+	g_return_if_fail (GAL_A11Y_IS_E_CELL (data));
+	cell = GAL_A11Y_E_CELL (data);
+
+	parent = atk_object_get_parent (ATK_OBJECT (cell));
+	g_return_if_fail (GAL_A11Y_IS_E_CELL_VBOX (parent));
+	gaev = GAL_A11Y_E_CELL_VBOX (parent);
+
+	if (cell->view_col < gaev->a11y_subcell_count)
+		gaev->a11y_subcells[cell->view_col] = NULL;
+}
+
+static AtkObject*
+ecv_ref_child (AtkObject *a11y, gint i)
+{
+	GalA11yECellVbox *gaev = GAL_A11Y_E_CELL_VBOX (a11y);
+	GalA11yECell *gaec = GAL_A11Y_E_CELL (a11y);
+	ECellVboxView *ecvv = (ECellVboxView *) (gaec->cell_view);
+	AtkObject *ret;
+	if (i < gaev->a11y_subcell_count) {
+		if (gaev->a11y_subcells[i] == NULL) {
+			gint model_col, row;
+			row = gaec->row;
+			model_col = ecvv->model_cols[i];
+			ECellView *subcell_view = ecvv->subcell_views[i];
+			ret = gal_a11y_e_cell_registry_get_object (NULL,
+				gaec->item,
+				subcell_view,
+				a11y,
+				model_col,
+				gaec->view_col, /* FIXME should the view column use a fake one or the same as its parent? */
+				row);
+			gaev->a11y_subcells[i] = ret;
+			g_object_ref (ret);
+			g_object_weak_ref (G_OBJECT (ret),
+					(GWeakNotify) subcell_destroyed,
+					ret);
+		} else {
+			ret = (AtkObject *) gaev->a11y_subcells[i];
+			if (ATK_IS_OBJECT (ret))
+				g_object_ref (ret);
+			else
+				ret = NULL;
+		}
+	} else {
+		ret = NULL;
+	}
+
+	return ret;
+}
+
+static void
+ecv_dispose (GObject *object)
+{
+	GalA11yECellVbox *gaev = GAL_A11Y_E_CELL_VBOX (object);
+	if (gaev->a11y_subcells)
+		g_free (gaev->a11y_subcells);
+
+	if (parent_class->dispose)
+		parent_class->dispose (object);
+}
+
+/* AtkComponet interface */
+static AtkObject*
+ecv_ref_accessible_at_point (AtkComponent *component,
+			     gint x,
+			     gint y,
+			     AtkCoordType coord_type)
+{
+	gint x0, y0, width, height;
+	int subcell_height, i;
+
+	GalA11yECell *gaec = GAL_A11Y_E_CELL (component);
+	ECellVboxView *ecvv = (ECellVboxView *) (gaec->cell_view);
+
+	atk_component_get_extents (component, &x0, &y0, &width, &height, coord_type);
+	x -= x0;
+	y -= y0;
+	if (x < 0 || x > width || y < 0 || y > height)
+		return NULL;
+
+	for (i = 0; i < ecvv->subcell_view_count; i++) {
+		subcell_height = e_cell_height (ecvv->subcell_views[i], ecvv->model_cols[i], gaec->view_col, gaec->row);
+		if ( 0 <= y && y <= subcell_height) {
+			return ecv_ref_child ((AtkObject *)component, i);
+		} else
+			y -= subcell_height;
+	}
+
+	return NULL;
+}
+
+static void
+ecv_class_init (GalA11yECellVboxClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+	AtkObjectClass *a11y_class = ATK_OBJECT_CLASS (klass);
+	parent_class		   = g_type_class_ref (PARENT_TYPE);
+
+	object_class->dispose	   = ecv_dispose;
+
+	a11y_class->get_n_children = ecv_get_n_children;
+	a11y_class->ref_child	   = ecv_ref_child;
+}
+
+static void
+ecv_init (GalA11yECellVbox *a11y)
+{
+}
+
+static void
+ecv_atk_component_iface_init (AtkComponentIface *iface)
+{
+	component_parent_iface         = g_type_interface_peek_parent (iface);
+
+	iface->ref_accessible_at_point = ecv_ref_accessible_at_point;
+}
+
+GType
+gal_a11y_e_cell_vbox_get_type (void)
+{
+	static GType type = 0;
+	if (!type) {
+		GTypeInfo info = {
+			sizeof (GalA11yECellVboxClass),
+			(GBaseInitFunc) NULL,
+			(GBaseFinalizeFunc) NULL,
+			(GClassInitFunc) ecv_class_init,
+			(GClassFinalizeFunc) NULL,
+			NULL, /* class_data */
+			sizeof (GalA11yECellVbox),
+			0,
+			(GInstanceInitFunc) ecv_init,
+			NULL /* value_cell */
+		};
+
+		static const GInterfaceInfo atk_component_info = {
+			(GInterfaceInitFunc) ecv_atk_component_iface_init,
+			(GInterfaceFinalizeFunc) NULL,
+			NULL
+		};
+
+		type = g_type_register_static (PARENT_TYPE, "GalA11yECellVbox", &info, 0);
+		gal_a11y_e_cell_type_add_action_interface (type);
+		g_type_add_interface_static (type, ATK_TYPE_COMPONENT, &atk_component_info);
+	}
+
+	return type;
+}
+
+AtkObject *gal_a11y_e_cell_vbox_new	(ETableItem *item,
+					 ECellView  *cell_view,
+					 AtkObject  *parent, 
+					 int         model_col, 
+					 int         view_col, 
+					 int         row)
+{
+	AtkObject *a11y;
+
+	a11y = g_object_new (gal_a11y_e_cell_vbox_get_type (), NULL);
+	
+	gal_a11y_e_cell_construct (a11y, item, cell_view, parent, model_col, view_col, row);
+
+	GalA11yECell *gaec = GAL_A11Y_E_CELL (a11y);
+	GalA11yECellVbox *gaev = GAL_A11Y_E_CELL_VBOX (a11y);
+	ECellVboxView *ecvv = (ECellVboxView *) (gaec->cell_view);
+	gaev->a11y_subcell_count = ecvv->subcell_view_count; 
+	gaev->a11y_subcells = g_malloc0 (sizeof(AtkObject *)*gaev->a11y_subcell_count);
+	return a11y;
+}
Index: gal/a11y/e-table/gal-a11y-e-cell-vbox.h
===================================================================
RCS file: gal/a11y/e-table/gal-a11y-e-cell-vbox.h
diff -N gal/a11y/e-table/gal-a11y-e-cell-vbox.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gal/a11y/e-table/gal-a11y-e-cell-vbox.h	23 Dec 2004 04:28:15 -0000
@@ -0,0 +1,64 @@
+/* Evolution Accessibility: gal-a11y-e-cell-vbox.h
+ *
+ * Copyright (C) 2004 Sun Microsystem, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Eric Zhao <eric zhao sun com> Sun Microsystem Inc., 2004
+ *
+ */
+#ifndef __GAL_A11Y_E_CELL_VBOX_H__
+#define __GAL_A11Y_E_CELL_VBOX_H__
+
+#include "gal-a11y-e-cell.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define GAL_A11Y_TYPE_E_CELL_VBOX            (gal_a11y_e_cell_vbox_get_type ())
+#define GAL_A11Y_E_CELL_VBOX(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_CELL_VBOX, GalA11yECellVbox))
+#define GAL_A11Y_E_CELL_VBOX_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_A11Y_E_CELL_VBOX, GalA11yECellVboxClass))
+#define GAL_A11Y_IS_E_CELL_VBOX(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_A11Y_TYPE_E_CELL_VBOX))
+#define GAL_A11Y_IS_E_CELL_VBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAL_A11Y_TYPE_E_CELL_VBOX))
+#define GAL_A11Y_E_CELL_VBOX_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GAL_A11Y_TYPE_E_CELL_VBOX, GalA11yECellVboxClass))
+
+typedef struct _GalA11yECellVbox	GalA11yECellVbox;
+typedef struct _GalA11yECellVboxClass	GalA11yECellVboxClass;
+
+struct _GalA11yECellVbox
+{
+	GalA11yECell	object;
+	int 		a11y_subcell_count;
+	gpointer       *a11y_subcells;
+};
+
+struct _GalA11yECellVboxClass
+{
+	GalA11yECellClass parent_class;
+};
+
+GType gal_a11y_e_cell_vbox_get_type	(void);
+AtkObject *gal_a11y_e_cell_vbox_new	(ETableItem *item,
+					 ECellView  *cell_view,
+					 AtkObject  *parent, 
+					 int         model_col, 
+					 int         view_col, 
+					 int         row);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* __GAL_A11Y_E_CELL_VBOX_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.3
diff -u -r1.3 gal-a11y-e-table-item-factory.c
--- gal/a11y/e-table/gal-a11y-e-table-item-factory.c	10 Jun 2004 17:00:45 -0000	1.3
+++ gal/a11y/e-table/gal-a11y-e-table-item-factory.c	23 Dec 2004 04:28:16 -0000
@@ -31,7 +31,7 @@
 	AtkObject *accessible;
 
 	g_return_val_if_fail (E_IS_TABLE_ITEM(obj), NULL);
-	accessible = gal_a11y_e_table_item_new(NULL, E_TABLE_ITEM (obj), 0);
+	accessible = gal_a11y_e_table_item_new (E_TABLE_ITEM (obj));
                                                                                 
 	return accessible;
 }
Index: gal/a11y/e-table/gal-a11y-e-table-item.c
===================================================================
RCS file: /cvs/gnome/gal/gal/a11y/e-table/gal-a11y-e-table-item.c,v
retrieving revision 1.14
diff -u -r1.14 gal-a11y-e-table-item.c
--- gal/a11y/e-table/gal-a11y-e-table-item.c	21 Jun 2004 12:02:31 -0000	1.14
+++ gal/a11y/e-table/gal-a11y-e-table-item.c	23 Dec 2004 04:28:19 -0000
@@ -10,11 +10,14 @@
 #include <config.h>
 #include <string.h>
 #include "gal-a11y-e-table-item.h"
+#include "gal-a11y-e-table-click-to-add.h"
 #include "gal-a11y-e-cell-registry.h"
 #include "gal-a11y-e-cell.h"
 #include "gal-a11y-util.h"
 #include <gal/e-table/e-table-subset.h>
+#include <gal/widgets/e-selection-model.h>
 #include <gal/e-table/e-table.h>
+#include <gal/e-table/e-table-click-to-add.h>
 #include <gal/e-table/e-tree.h>
 
 #include <atk/atkobject.h>
@@ -32,10 +35,9 @@
 static GQuark		quark_accessible_object = 0;
 #define GET_PRIVATE(object) ((GalA11yETableItemPrivate *) (((char *) object) + priv_offset))
 #define PARENT_TYPE (parent_type)
+static gpointer * eti_reinit_data (AtkTable *table, ETableItem *item);
 
 struct _GalA11yETableItemPrivate {
-	AtkObject *parent;
-	gint index_in_parent;
 	gint cols;
 	gint rows;
 	gpointer *cell_data;
@@ -43,6 +45,7 @@
 	int cursor_change_id;
 	ETableCol ** columns;
 	ESelectionModel *selection;
+	AtkStateSet *state_set;
 	GtkWidget *widget;
 };
 
@@ -52,15 +55,28 @@
 
 static gpointer *eti_reinit_data (AtkTable *table, ETableItem *item);
 
-#if 0
+static AtkObject* eti_ref_at (AtkTable *table, gint row, gint column);
+
 static void
-unref_accessible (gpointer user_data, GObject *obj_loc)
+item_destroyed (GtkObject *item, gpointer user_data)
 {
 	GalA11yETableItem *a11y = GAL_A11Y_E_TABLE_ITEM (user_data);
-	GET_PRIVATE (a11y)->item = NULL;
-	g_object_unref (a11y);
+	GalA11yETableItemPrivate *priv = GET_PRIVATE (a11y);
+
+	atk_state_set_add_state (priv->state_set, ATK_STATE_DEFUNCT);
+	atk_object_notify_state_change (ATK_OBJECT (a11y), ATK_STATE_DEFUNCT, TRUE);
+
+}
+
+static AtkStateSet *
+eti_ref_state_set (AtkObject *accessible)
+{
+	GalA11yETableItemPrivate *priv = GET_PRIVATE (accessible);
+
+        g_object_ref(priv->state_set);
+
+        return priv->state_set;
 }
-#endif
 
 inline static gint
 view_to_model_row(ETableItem *eti, int row)
@@ -131,8 +147,6 @@
 	GalA11yETableItem *a11y = GAL_A11Y_E_TABLE_ITEM (object);
 	GalA11yETableItemPrivate *priv = GET_PRIVATE (a11y);
 
-	priv->parent = NULL;
-
 	if ( priv->cell_data != NULL ) {
 		g_free(priv->cell_data);
 		priv->cell_data = NULL;
@@ -150,20 +164,6 @@
 }
 
 /* Static functions */
-static AtkObject *
-eti_get_parent (AtkObject *accessible)
-{
-	GalA11yETableItem *a11y;
-
-	g_return_val_if_fail (GAL_A11Y_IS_E_TABLE_ITEM (accessible), NULL);
-	if (!eti_a11y_get_gobject (accessible))
-		/* defunct */
-		return NULL;
-
-	a11y = GAL_A11Y_E_TABLE_ITEM (accessible);
-	return GET_PRIVATE (a11y)->parent;
-}
-
 static gint
 eti_get_n_children (AtkObject *accessible)
 {
@@ -186,34 +186,12 @@
 	if (!item)
 		return NULL;
 
-	if (index < item->cols) {
-		AtkObject *child;
+	/* don't support column header now */
 
-		/* A column header is required */
-		child = atk_table_get_column_header (ATK_TABLE (accessible), index);
-		if (child)
-			g_object_ref (child);
-		return child;
-	}
-
-	index -= item->cols;
 	col = index % item->cols;
 	row = index / item->cols;
 
-	return atk_table_ref_at (ATK_TABLE (accessible), row, col);
-}
-
-static gint
-eti_get_index_in_parent (AtkObject *accessible)
-{
-	GalA11yETableItem *a11y;
-
-	g_return_val_if_fail (GAL_A11Y_IS_E_TABLE_ITEM (accessible), -1);
-	if (!eti_a11y_get_gobject (accessible))
-		return -1;
-
-	a11y = GAL_A11Y_E_TABLE_ITEM (accessible);
-	return GET_PRIVATE (a11y)->index_in_parent;
+	return eti_ref_at (ATK_TABLE (accessible), row, col);
 }
 
 static void
@@ -229,29 +207,25 @@
 	double real_height;
 	int fake_width;
 	int fake_height;
+	AtkObject *parent;
 
 	item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (component)));
 	if (!item)
 		return;
 
-	if (component_parent_iface &&
-	    component_parent_iface->get_extents)
-		component_parent_iface->get_extents (component,
-						     x,
-						     y,
-						     &fake_width,
-						     &fake_height,
-						     coord_type);
-
-	gtk_object_get (GTK_OBJECT (item),
-			"width", &real_width,
-			"height", &real_height,
-			NULL);
-
-	if (width)
-		*width = real_width;
-	if (height) 
-		*height = real_height;
+	parent = ATK_OBJECT (component)->accessible_parent;
+	if (parent && ATK_IS_COMPONENT (parent))
+		atk_component_get_extents (ATK_COMPONENT (parent), x, y, 
+					width, height,
+					coord_type);
+
+	if (parent && GAL_A11Y_IS_E_TABLE_CLICK_TO_ADD (parent)) {
+		ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (parent)));
+		if (etcta) {
+			*width = etcta->width;
+			*height = etcta->height;
+		}
+	}
 }
 
 static AtkObject*
@@ -264,6 +238,7 @@
 	int col = -1;
 	int x_origin, y_origin;
 	ETableItem *item;
+	GtkWidget *tableOrTree;
 
 	item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (component)));
 	if (!item)
@@ -276,11 +251,15 @@
 	x -= x_origin;
 	y -= y_origin;
 
-	e_table_item_compute_location (item, &x, &y,
-				       &row, &col);
+	tableOrTree = gtk_widget_get_parent (GTK_WIDGET (item->parent.canvas));
+
+	if (E_IS_TREE(tableOrTree))
+		e_tree_get_cell_at (E_TREE (tableOrTree), x, y, &row, &col);
+	else
+		e_table_get_cell_at (E_TABLE (tableOrTree), x, y, &row, &col);
 
 	if (row != -1 && col != -1) {
-		return atk_table_ref_at (ATK_TABLE (component), row, col);
+		return eti_ref_at (ATK_TABLE (component), row, col);
 	} else {
 		return NULL;
 	}
@@ -296,7 +275,8 @@
 
 	g_return_if_fail (GAL_A11Y_IS_E_CELL (data));
 	cell = GAL_A11Y_E_CELL (data);
-		
+
+	g_return_if_fail (cell->item && G_IS_OBJECT (cell->item));
 	item = GAL_A11Y_E_TABLE_ITEM (atk_gobject_accessible_for_object (G_OBJECT (GAL_A11Y_E_CELL(data)->item)));
 
 	g_return_if_fail (item && GAL_A11Y_IS_E_TABLE_ITEM (item));
@@ -307,6 +287,11 @@
                                                                    
 	if (GET_PRIVATE (item)->cell_data && GET_PRIVATE (item)->cell_data [index] == data)
 		GET_PRIVATE (item)->cell_data [index] = NULL;
+
+        if (cell->item) {
+                g_object_unref (G_OBJECT (cell->item));  
+                cell->item = NULL;
+        }
 }
 
 /* atk table */
@@ -315,6 +300,11 @@
 {
 	ETableItem *item;
 	AtkObject* ret;
+	GalA11yETableItemPrivate *priv = GET_PRIVATE (table);
+
+	if (atk_state_set_contains_state (priv->state_set, ATK_STATE_DEFUNCT))
+		return NULL;
+
 
 	item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (table)));
 	if (!item)
@@ -343,8 +333,7 @@
 							    row);
 			cell_data[row*item->cols + column] = ret;
 			if (ATK_IS_OBJECT (ret)) {
-				gal_a11y_e_cell_add_state(ret, ATK_STATE_SHOWING, FALSE);
-				gal_a11y_e_cell_add_state(ret, ATK_STATE_VISIBLE, FALSE);
+				g_object_ref (ret);
 				g_object_weak_ref (G_OBJECT (ret),
 						   (GWeakNotify) cell_destroyed,
 						   ret);
@@ -501,16 +490,21 @@
 	ETableItem *item;
 	ETableCol *ecol;
 	AtkObject *atk_obj = NULL;
-	ECell *ecell;
 
 	item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (table)));
 	if (!item)
 		return NULL;
 
 	ecol = e_table_header_get_column (item->header, column);
-	ecell = ecol->ecell;
-	if (ecell)
-		atk_obj = atk_gobject_accessible_for_object (G_OBJECT (ecell));
+	if (ecol) {
+		atk_obj = atk_gobject_accessible_for_object (G_OBJECT (ecol));
+		if (atk_obj) {
+			if (ecol->text)
+				atk_object_set_name (atk_obj, ecol->text);
+			atk_object_set_role (atk_obj, ATK_ROLE_TABLE_COLUMN_HEADER);
+		}
+	}
+
 	return atk_obj;
 }
 
@@ -541,12 +535,16 @@
 table_is_row_selected (AtkTable *table, gint row)
 {
 	ETableItem *item;
+	GalA11yETableItemPrivate *priv = GET_PRIVATE (table);
+
+	if (atk_state_set_contains_state (priv->state_set, ATK_STATE_DEFUNCT))
+		return FALSE;
 
 	item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (table)));
 	if (!item)
 		return FALSE;
 
-	return e_selection_model_is_row_selected(item->selection, row);
+	return e_selection_model_is_row_selected(item->selection, view_to_model_row (item, row));
 }
 
 static gboolean 
@@ -560,6 +558,10 @@
 {
 	ETableItem *item;
 	gint n_selected, row, index_selected;
+	GalA11yETableItemPrivate *priv = GET_PRIVATE (table);
+
+	if (atk_state_set_contains_state (priv->state_set, ATK_STATE_DEFUNCT))
+		return 0;
 
 	item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (table)));
 	if (!item)
@@ -601,14 +603,20 @@
 table_remove_row_selection (AtkTable *table, gint row)
 {
 	ETableItem *item;
+	GalA11yETableItemPrivate *priv = GET_PRIVATE (table);
+
+	if (atk_state_set_contains_state (priv->state_set, ATK_STATE_DEFUNCT))
+		return FALSE;
 
 	item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (table)));
 	if (!item)
 		return FALSE;
+	/* we need to make the item get focus */
+	e_canvas_item_grab_focus (GNOME_CANVAS_ITEM (item), TRUE);
 
 	if (!atk_table_is_row_selected (table, row))
 		return TRUE;
-	e_selection_model_toggle_single_row (item->selection, row);
+	e_selection_model_toggle_single_row (item->selection, view_to_model_row (item, row));
 	return TRUE;
 }
 
@@ -655,6 +663,7 @@
 	GalA11yETableItem * item_a11y;
 	gint old_nrows;
 
+
 	g_return_if_fail (table_item);
  	item_a11y = GAL_A11Y_E_TABLE_ITEM (table_item);
 
@@ -1040,11 +1049,10 @@
 
 	object_class->dispose                 = eti_dispose;
 
-	atk_object_class->get_parent          = eti_get_parent;
 	atk_object_class->get_n_children      = eti_get_n_children;
 	atk_object_class->ref_child           = eti_ref_child;
-	atk_object_class->get_index_in_parent = eti_get_index_in_parent;
 	atk_object_class->initialize	      = eti_real_initialize;
+	atk_object_class->ref_state_set       = eti_ref_state_set;
 }
 
 static void
@@ -1054,8 +1062,6 @@
 
 	priv = GET_PRIVATE (a11y);
 
-	priv->parent = NULL;
-	priv->index_in_parent = -1;
 	priv->selection_change_id = 0;
 	priv->cursor_change_id = 0;
 	priv->selection = NULL;
@@ -1149,24 +1155,31 @@
 }
 
 AtkObject *
-gal_a11y_e_table_item_new (AtkObject *parent,
-			   ETableItem *item,
-			   int index_in_parent)
+gal_a11y_e_table_item_new (ETableItem *item)
 {
 	GalA11yETableItem *a11y;
 	AtkObject *accessible;
 	int n;
+	ESelectionModel * esm;
+	AtkObject * cell;
+	AtkObject *parent;
+	const char *name;
 
 	g_return_val_if_fail (item && item->cols >= 0 && item->rows >= 0, NULL);
 	a11y = g_object_new (gal_a11y_e_table_item_get_type (), NULL);
 
 	atk_object_initialize (ATK_OBJECT (a11y), item);
 
-	GET_PRIVATE (a11y)->parent = parent;
-	GET_PRIVATE (a11y)->index_in_parent = index_in_parent;
+	GET_PRIVATE (a11y)->state_set = atk_state_set_new ();
+
+	atk_state_set_add_state (GET_PRIVATE(a11y)->state_set, ATK_STATE_TRANSIENT);
+        atk_state_set_add_state (GET_PRIVATE(a11y)->state_set, ATK_STATE_ENABLED);
+        atk_state_set_add_state (GET_PRIVATE(a11y)->state_set, ATK_STATE_SENSITIVE);
+        atk_state_set_add_state (GET_PRIVATE(a11y)->state_set, ATK_STATE_SHOWING);
+        atk_state_set_add_state (GET_PRIVATE(a11y)->state_set, ATK_STATE_VISIBLE);
+
 
 	accessible  = ATK_OBJECT(a11y);
-	accessible->role = ATK_ROLE_TREE_TABLE;
 
 	/* Initialize cell data. */
 	n = item->cols * item->rows;
@@ -1196,22 +1209,49 @@
 
 		/* find the TableItem's parent: table or tree */
 		GET_PRIVATE (a11y)->widget = gtk_widget_get_parent (GTK_WIDGET (item->parent.canvas));
+		parent = gtk_widget_get_accessible (GET_PRIVATE (a11y)->widget);
+		name = atk_object_get_name (parent);
+		if (name)
+			atk_object_set_name (accessible, name);
+		atk_object_set_parent (accessible, parent);
+
 		if (E_IS_TREE (GET_PRIVATE (a11y)->widget)) {
 			ETreeModel *model;
 			model = e_tree_get_model (E_TREE (GET_PRIVATE (a11y)->widget));
 			g_signal_connect (G_OBJECT(model), "node_changed",
 					G_CALLBACK (eti_tree_model_node_changed_cb), item);
+			accessible->role = ATK_ROLE_TREE_TABLE;
+		} else if (E_IS_TABLE (GET_PRIVATE (a11y)->widget)) {
+			accessible->role = ATK_ROLE_TABLE;
 		} 
 	}
-	if (parent)
-		g_object_ref (parent);
 
-#if 0
 	if (item)
-		g_object_weak_ref (G_OBJECT (item),
-				   unref_accessible,
+		g_signal_connect (G_OBJECT (item), "destroy",
+				   G_CALLBACK (item_destroyed),
 				   a11y);
-#endif
+	esm = item->selection;
+
+	if (esm != NULL) {
+		int cursor_row, cursor_col, view_row, view_col;
+
+        	cursor_row = e_selection_model_cursor_row(esm);
+        	cursor_col = e_selection_model_cursor_col(esm);
+
+		view_row = model_to_view_row (item, cursor_row);
+		view_col = model_to_view_col (item, cursor_col);
+
+		if (view_row == -1)
+			view_row = 0;
+		if (view_col == -1)
+			view_col = 0;
+
+		cell = eti_ref_at (ATK_TABLE (a11y), view_row, view_col);
+		if (cell != NULL) {
+        		g_object_set_data (G_OBJECT(a11y), "gail-focus-object", cell);
+			gal_a11y_e_cell_add_state(GAL_A11Y_E_CELL (cell), ATK_STATE_FOCUSED, FALSE);
+		}
+	}
 
 	return ATK_OBJECT (a11y);
 }
@@ -1304,6 +1344,11 @@
 static void
 eti_a11y_selection_changed_cb (ESelectionModel *selection, GalA11yETableItem *a11y)
 {
+	GalA11yETableItemPrivate *priv = GET_PRIVATE (a11y);
+
+        if (atk_state_set_contains_state (priv->state_set, ATK_STATE_DEFUNCT))
+		return;
+
 	g_return_if_fail (GAL_A11Y_IS_E_TABLE_ITEM (a11y));
 
 	g_signal_emit_by_name (a11y, "selection_changed");
@@ -1316,27 +1361,38 @@
 	AtkObject * cell;
 	int view_row, view_col;
 	ETableItem *item;
+	GalA11yETableItemPrivate *priv = GET_PRIVATE (a11y);
 
 	g_return_if_fail (GAL_A11Y_IS_E_TABLE_ITEM (a11y));
 
-	g_signal_emit_by_name (a11y, "selection_changed");
+	if (atk_state_set_contains_state (priv->state_set, ATK_STATE_DEFUNCT)) 
+                return;
 
 	item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (a11y)));
 
 	g_return_if_fail (item);
 
+	if (row == -1 && col == -1)
+		return;
+
 	view_row = model_to_view_row (item, row);
 	view_col = model_to_view_col (item, col);
 
-	cell = atk_table_ref_at (ATK_TABLE (a11y), view_row, view_col);
+	cell = eti_ref_at (ATK_TABLE (a11y), view_row, view_col);
 	if (cell != NULL) {
-		gal_a11y_e_cell_add_state (GAL_A11Y_E_CELL (cell), ATK_STATE_FOCUSED, FALSE);
+		AtkObject *old_cell = (AtkObject *)g_object_get_data (G_OBJECT(a11y), "gail-focus-object");
+		if (old_cell && GAL_A11Y_IS_E_CELL (old_cell))
+			gal_a11y_e_cell_remove_state (GAL_A11Y_E_CELL (old_cell), ATK_STATE_FOCUSED, FALSE);
+		if (old_cell)
+			g_object_unref (old_cell);
+
+        	g_object_set_data (G_OBJECT(a11y), "gail-focus-object", cell);
+		gal_a11y_e_cell_add_state(GAL_A11Y_E_CELL (cell), ATK_STATE_FOCUSED, FALSE);
 
         	if (ATK_IS_OBJECT (cell))
                 	g_signal_emit_by_name  (a11y,
                                         "active-descendant-changed",
                                         cell);
-		atk_focus_tracker_notify (cell);
 	}
 
 }
@@ -1357,7 +1413,7 @@
 selection_add_selection (AtkSelection *selection, gint index)
 {
 	AtkTable *table;
-	gint row, col;
+	gint row, col, cursor_row, cursor_col, model_row, model_col;
 	ETableItem *item;
 
 	item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (selection)));
@@ -1367,18 +1423,33 @@
 	table = ATK_TABLE (selection);
 
 	row = atk_table_get_row_at_index (table, index);
-	atk_table_add_row_selection (table, row);
-
 	col = atk_table_get_column_at_index (table, index);
+
+	model_row = view_to_model_row (item, row);
+	model_col = view_to_model_col (item, col);
+
+	cursor_row = e_selection_model_cursor_row (item->selection);
+	cursor_col = e_selection_model_cursor_col (item->selection);
+
+	/* check whether is selected already */
+	if (model_row == cursor_row && model_col == cursor_col)
+		return TRUE;
+
+	if (model_row != cursor_row) {
+		/* FIXME, currently we only support single row selection */
+		atk_selection_clear_selection (selection);
+		atk_table_add_row_selection (table, row);
+	}
+
 	e_selection_model_change_cursor (item->selection,
-					 view_to_model_row (item, row),
-					 view_to_model_col (item, col));
+					 model_row,
+					 model_col);
 	e_selection_model_cursor_changed (item->selection,
-					  view_to_model_row (item, row),
-					  view_to_model_col (item, col));
+					  model_row,
+					  model_col);
 	e_selection_model_cursor_activated (item->selection,
-					    view_to_model_row (item, row),
-					    view_to_model_col (item, col));
+					    model_row,
+					    model_col);
 	return TRUE;
 }
 
@@ -1407,7 +1478,7 @@
 	if (!atk_table_is_row_selected (table, row))
 		return NULL;
 
-	return atk_table_ref_at (table, row, col);
+	return eti_ref_at (table, row, col);
 }
 
 static gint
@@ -1430,4 +1501,12 @@
 
 	row = atk_table_get_row_at_index (ATK_TABLE (selection), i);
 	return atk_table_is_row_selected (ATK_TABLE (selection), row);
+}
+
+void
+gal_a11y_e_table_item_init (void)
+{
+        atk_registry_set_factory_type (atk_get_default_registry (),
+                                       E_TABLE_ITEM_TYPE,
+                                       gal_a11y_e_table_item_factory_get_type ());
 }
Index: gal/a11y/e-table/gal-a11y-e-table-item.h
===================================================================
RCS file: /cvs/gnome/gal/gal/a11y/e-table/gal-a11y-e-table-item.h,v
retrieving revision 1.2
diff -u -r1.2 gal-a11y-e-table-item.h
--- gal/a11y/e-table/gal-a11y-e-table-item.h	3 Nov 2003 06:40:50 -0000	1.2
+++ gal/a11y/e-table/gal-a11y-e-table-item.h	23 Dec 2004 04:28:19 -0000
@@ -37,8 +37,8 @@
 
 /* Standard Glib function */
 GType      gal_a11y_e_table_item_get_type  (void);
-AtkObject *gal_a11y_e_table_item_new       (AtkObject  *parent,
-					    ETableItem *item,
-					    int         index_in_parent);
+AtkObject *gal_a11y_e_table_item_new       (ETableItem *item);
+
+void gal_a11y_e_table_item_init (void);
 
 #endif /* ! __GAL_A11Y_E_TABLE_ITEM_H__ */
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.3
diff -u -r1.3 gal-a11y-e-table.c
--- gal/a11y/e-table/gal-a11y-e-table.c	17 Dec 2003 02:35:20 -0000	1.3
+++ gal/a11y/e-table/gal-a11y-e-table.c	23 Dec 2004 04:28:19 -0000
@@ -12,6 +12,7 @@
 #include "gal-a11y-util.h"
 #include <gal/e-table/e-table.h>
 #include <gal/e-table/e-table-group.h>
+#include <gal/e-table/e-table-group-container.h>
 #include <gal/e-table/e-table-group-leaf.h>
 #include <gal/e-table/e-table-click-to-add.h>
 
@@ -27,16 +28,82 @@
 };
 
 /* Static functions */
+static ETableItem *
+find_first_table_item (ETableGroup *group)
+{
+	GnomeCanvasGroup *cgroup;
+	GList *l;
 
-static void
+	cgroup = GNOME_CANVAS_GROUP (group);
+
+	for (l = cgroup->item_list; l; l = l->next) {
+		GnomeCanvasItem *i;
+
+		i = GNOME_CANVAS_ITEM (l->data);
+
+		if (E_IS_TABLE_GROUP (i))
+			return find_first_table_item (E_TABLE_GROUP (i));
+		else if (E_IS_TABLE_ITEM (i)) {
+			return E_TABLE_ITEM (i);
+		}
+	}
+
+	return NULL;
+}
+
+static AtkObject*
+eti_ref_accessible (ETableItem *eti, AtkObject *parent)
+{
+	AtkObject *a11y = NULL;
+
+	g_return_val_if_fail (eti, NULL);
+
+	a11y = atk_gobject_accessible_for_object (G_OBJECT (eti));
+	g_return_val_if_fail (a11y, NULL);
+
+	g_object_ref (a11y);
+	return a11y;
+}
+
+static ETableItem *
+find_table_item (ETable *table)
+{
+	if (e_table_model_row_count(table->model) < 1)
+		return NULL;
+	else {
+		if (table->group)
+			return find_first_table_item (table->group);
+	}
+
+	return NULL;
+}
+
+static gboolean 
 init_child_item (GalA11yETable *a11y)
 {
-	GalA11yETablePrivate *priv = GET_PRIVATE (a11y);
-	ETable *table = E_TABLE (GTK_ACCESSIBLE (a11y)->widget);
-	if (priv->child_item == NULL) {
-		priv->child_item = atk_gobject_accessible_for_object (G_OBJECT(E_TABLE_GROUP_LEAF (table->group)->item));
-		priv->child_item->role = ATK_ROLE_TABLE;
+	ETable *table;
+
+	if (!a11y || !GTK_IS_ACCESSIBLE (a11y))
+		return FALSE;
+
+	table = E_TABLE (GTK_ACCESSIBLE (a11y)->widget);
+	if (table && GTK_WIDGET_MAPPED (GTK_WIDGET (table)) && table->group && E_IS_TABLE_GROUP_CONTAINER(table->group)) {
+		/* we need to init all the children for multiple table items */
+		ETableGroupContainer *etgc =  (ETableGroupContainer *)table->group;
+		GList *list;
+
+		for (list = etgc->children; list; list = g_list_next (list)) {
+			ETableGroupContainerChildNode *child_node = list->data;
+			ETableGroup *child = child_node->child;
+			ETableItem *eti = find_first_table_item (child);
+
+			eti_ref_accessible (eti, ATK_OBJECT (a11y));
+		}
 	}
+	g_object_unref (a11y);
+	g_object_unref (table);
+
+	return FALSE;
 }
 
 static AtkObject*
@@ -46,7 +113,8 @@
 			     AtkCoordType coord_type)
 {
 	GalA11yETable *a11y = GAL_A11Y_E_TABLE (component);
-	init_child_item (a11y);
+	if (GET_PRIVATE (a11y)->child_item)
+		g_object_ref (GET_PRIVATE (a11y)->child_item);
 	return GET_PRIVATE (a11y)->child_item;
 }
 
@@ -55,13 +123,23 @@
 {
 	GalA11yETable *a11y = GAL_A11Y_E_TABLE (accessible);
 	ETable * et;
+	int n = 0;
 
 	et = E_TABLE(GTK_ACCESSIBLE (a11y)->widget);
-	if (et && et->use_click_to_add) {
-		return 2;
-	}
 
-	return 1;
+	if (et->group) {
+		if (E_IS_TABLE_GROUP_LEAF (et->group))
+			n = 1;
+		else if (E_IS_TABLE_GROUP_CONTAINER (et->group)) {
+			ETableGroupContainer *etgc = (ETableGroupContainer *)et->group;
+			n = g_list_length (etgc->children);
+		}
+	}
+	
+	if (et && et->use_click_to_add && et->click_to_add) {
+		n++;
+	}
+	return n;
 }
 
 static AtkObject*
@@ -70,24 +148,34 @@
 {
 	GalA11yETable *a11y = GAL_A11Y_E_TABLE (accessible);
 	ETable * et;
+	gint child_no;
 
 	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) {
+	child_no = et_get_n_children (accessible);
+	if (i == 0 || i < child_no - 1) {
+		if (E_IS_TABLE_GROUP_LEAF (et->group)) {
+			ETableItem *eti = find_first_table_item (et->group);
+			return eti_ref_accessible (eti, accessible);
+
+		} else if (E_IS_TABLE_GROUP_CONTAINER (et->group)) {
+			ETableGroupContainer *etgc =  (ETableGroupContainer *) et->group;
+			ETableGroupContainerChildNode *child_node = g_list_nth_data (etgc->children, i);
+			if (child_node) {
+				ETableGroup *child = child_node->child;
+				ETableItem * eti = find_first_table_item (child);
+				return eti_ref_accessible (eti, accessible);
+			}
+		}
+	} else if (i == child_no -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));
-			}
+			accessible = atk_gobject_accessible_for_object (G_OBJECT(etcta));
+			if (accessible)
+				g_object_ref (accessible);
 			return accessible;
 		}
 	}
@@ -95,6 +183,12 @@
 	return NULL;
 }
 
+static AtkLayer
+et_get_layer (AtkComponent *component)
+{
+	return ATK_LAYER_WIDGET;
+}
+
 static void
 et_class_init (GalA11yETableClass *klass)
 {
@@ -110,6 +204,7 @@
 et_atk_component_iface_init (AtkComponentIface *iface)
 {
 	iface->ref_accessible_at_point = et_ref_accessible_at_point;
+	iface->get_layer = et_get_layer;
 }
 
 static void
@@ -180,6 +275,13 @@
 	a11y = g_object_new (gal_a11y_e_table_get_type (), NULL);
 
 	GTK_ACCESSIBLE (a11y)->widget = GTK_WIDGET (widget);
+
+	/* Ref it here so that it is still valid in the idle function */
+	/* It will be unrefed in the idle function */
+	g_object_ref (a11y);
+	g_object_ref (widget);
+
+	g_idle_add ((GSourceFunc)init_child_item, a11y);
 
 	return ATK_OBJECT (a11y);
 }
Index: gal/a11y/e-table/gal-a11y-e-tree.c
===================================================================
RCS file: /cvs/gnome/gal/gal/a11y/e-table/gal-a11y-e-tree.c,v
retrieving revision 1.4
diff -u -r1.4 gal-a11y-e-tree.c
--- gal/a11y/e-table/gal-a11y-e-tree.c	10 Jun 2004 17:00:45 -0000	1.4
+++ gal/a11y/e-table/gal-a11y-e-tree.c	23 Dec 2004 04:28:19 -0000
@@ -35,11 +35,6 @@
 	eti = e_tree_get_item (tree);
 	if (priv->child_item == NULL) {
 		priv->child_item = atk_gobject_accessible_for_object (G_OBJECT (eti));
-		if (!priv->child_item)
-			priv->child_item = gal_a11y_e_table_item_new (ATK_OBJECT (a11y),eti, 0);
-
-		g_return_if_fail (priv->child_item);
-		priv->child_item->role = ATK_ROLE_TREE_TABLE;
 	}
 }
 
@@ -72,6 +67,12 @@
 	return GET_PRIVATE (a11y)->child_item;
 }
 
+static AtkLayer
+et_get_layer (AtkComponent *component)
+{
+	return ATK_LAYER_WIDGET;
+}
+
 static void
 et_class_init (GalA11yETreeClass *klass)
 {
@@ -87,6 +88,7 @@
 et_atk_component_iface_init (AtkComponentIface *iface)
 {
 	iface->ref_accessible_at_point = et_ref_accessible_at_point;
+	iface->get_layer = et_get_layer;
 }
 
 static void




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