Index: ChangeLog
===================================================================
RCS file: /export/src/cvs/gal/ChangeLog,v
retrieving revision 1.20
diff -u -r1.20 ChangeLog
--- ChangeLog	2003/11/17 09:29:32	1.20
+++ ChangeLog	2003/11/18 10:18:47
@@ -1,3 +1,28 @@
+2003-11-17  Tim Wo  <tim.wo@sun.com>
+
+	* gal/a11y/e-table/gal-a11y-e-cell-text.c: (ect_get_name): override
+	the function in base class, to retrieve the content of the text.
+	(ect_do_action_edit): begin edit the cell when issuing the action.
+	(ect_class_init): override the "get_name" function.
+	(ect_init): add an action "edit" to the object.
+	(gal_a11y_e_cell_text_get_type): add AtkAction interface to this type.
+	* gal/a11y/e-table/gal-a11y-e-cell-toggle.c
+	(gal_a11y_e_cell_toggle_dispose): disconnect the connected signal when
+	disposing.
+	(gal_a11y_e_cell_toggle_class_init): to override the dispose function.
+	(toggle_cell_action): set position of the click event more precisely.
+	(model_change_cb): set or remove the ATK_STATE_CHECKED flag according
+	to the value in the model when it changes.
+	(gal_a11y_e_cell_toggle_new): init the ATK_STATE_CHECKED flag and
+	connect	to the model cell change signal.
+	* gal/a11y/e-table/gal-a11y-e-cell-toggle.h: add one member to save
+	the connected signal id.
+	* gal/a11y/e-table/gal-a11y-e-cell.c: (gal_a11y_e_cell_grab_focus):
+	notify the selection model that the cursor has been changed.
+	* gal/a11y/e-table/gal-a11y-e-table-item.c:
+	(eti_a11y_cursor_changed_cb): emiting a signal to notify the AT
+	applictions that the active descendant has been changed. (#51055)
+
 2003-11-17 Yuedong Du  <yuedong.du@sun.com>
 
 	* gal/a11y/e-table/gal-a11y-e-cell.c: (gal_a11y_e_cell_dispose):
Index: gal/a11y/e-table/gal-a11y-e-cell-text.c
===================================================================
RCS file: /export/src/cvs/gal/gal/a11y/e-table/gal-a11y-e-cell-text.c,v
retrieving revision 1.2
diff -u -r1.2 gal-a11y-e-cell-text.c
--- gal/a11y/e-table/gal-a11y-e-cell-text.c	2003/11/10 00:49:30	1.2
+++ gal/a11y/e-table/gal-a11y-e-cell-text.c	2003/11/18 10:18:47
@@ -13,6 +13,7 @@
 #include <atk/atkobject.h>
 #include <atk/atktext.h>
 #include <atk/atkeditabletext.h>
+#include <atk/atkaction.h>
 
 #define CS_CLASS(a11y) (G_TYPE_INSTANCE_GET_CLASS ((a11y), C_TYPE_STREAM, GalA11yECellTextClass))
 static AtkObjectClass *parent_class;
@@ -23,6 +24,14 @@
 #define e_cell_text_set_selection(a,b,c,d,e) FALSE
 
 /* Static functions */
+static G_CONST_RETURN gchar*
+ect_get_name (AtkObject * a11y)
+{
+	GalA11yECell *gaec = GAL_A11Y_E_CELL (a11y);
+	ECellText *ect = E_CELL_TEXT (gaec->cell_view->ecell);
+	return e_cell_text_get_text (ect, gaec->item->table_model, gaec->model_col, gaec->row);
+}
+
 static gchar *
 ect_get_text (AtkText *text,
 	      gint start_offset,
@@ -375,6 +384,13 @@
 
 
 static void
+ect_do_action_edit (AtkAction *action)
+{
+	GalA11yECell *a11y = GAL_A11Y_E_CELL (action);
+	e_table_item_enter_edit (a11y->item, a11y->view_col, a11y->row);
+}
+
+static void
 ect_atk_text_iface_init (AtkTextIface *iface)
 {
 	iface->get_text                = ect_get_text;
@@ -411,12 +427,19 @@
 static void
 ect_class_init (GalA11yECellTextClass *klass)
 {
-	parent_class                          = g_type_class_ref (PARENT_TYPE);
+	AtkObjectClass *a11y      = ATK_OBJECT_CLASS (klass);
+	parent_class              = g_type_class_ref (PARENT_TYPE);
+	a11y->get_name            = ect_get_name;
 }
 
 static void
 ect_init (GalA11yECellText *a11y)
 {
+	gal_a11y_e_cell_add_action (a11y,
+				    "edit",
+				    "begin editing this cell",
+				    NULL,
+				    (ACTION_FUNC)ect_do_action_edit);
 }
 
 /**
@@ -462,6 +485,7 @@
 		type = g_type_register_static (PARENT_TYPE, "GalA11yECellText", &info, 0);
 		g_type_add_interface_static (type, ATK_TYPE_TEXT, &atk_text_info);
 		g_type_add_interface_static (type, ATK_TYPE_EDITABLE_TEXT, &atk_editable_text_info);
+		gal_a11y_e_cell_type_add_action_interface (type);
 	}
 
 	return type;
Index: gal/a11y/e-table/gal-a11y-e-cell-toggle.c
===================================================================
RCS file: /export/src/cvs/gal/gal/a11y/e-table/gal-a11y-e-cell-toggle.c,v
retrieving revision 1.1
diff -u -r1.1 gal-a11y-e-cell-toggle.c
--- gal/a11y/e-table/gal-a11y-e-cell-toggle.c	2003/10/28 06:55:15	1.1
+++ gal/a11y/e-table/gal-a11y-e-cell-toggle.c	2003/11/18 10:18:47
@@ -3,8 +3,25 @@
 #include <gal/e-table/e-cell-toggle.h>
 #include <gal/e-table/e-table-model.h>
 
+#define PARENT_TYPE  (gal_a11y_e_cell_get_type ())
+static GObjectClass *parent_class;
+
 static void gal_a11y_e_cell_toggle_class_init (GalA11yECellToggleClass *klass);
 
+static void
+gal_a11y_e_cell_toggle_dispose (GObject *object)
+{
+	GalA11yECellToggle *a11y = GAL_A11Y_E_CELL_TOGGLE (object);
+
+	ETableModel *e_table_model = GAL_A11Y_E_CELL (a11y)->cell_view->e_table_model;
+
+	if (e_table_model)
+		g_signal_handler_disconnect (e_table_model, a11y->model_id);
+
+	if (parent_class->dispose)
+		parent_class->dispose (object);
+}
+
 GType
 gal_a11y_e_cell_toggle_get_type (void)
 {
@@ -39,6 +56,10 @@
 static void 
 gal_a11y_e_cell_toggle_class_init (GalA11yECellToggleClass *klass)
 {
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+	object_class->dispose      = gal_a11y_e_cell_toggle_dispose;
+	parent_class               = g_type_class_ref (PARENT_TYPE);
 }
 
 static void
@@ -55,8 +76,10 @@
 
 	e_table_item_get_cell_geometry (cell->item, &row, &col,
 					&x, &y, &width, &height);
-	event.x = x ;
-	event.y = y ;
+
+	event.x = x + width / 2 + (int)(GNOME_CANVAS_ITEM (cell->item)->x1);
+	event.y = y + height / 2 + (int)(GNOME_CANVAS_ITEM (cell->item)->y1);
+
 	event.type = GDK_BUTTON_PRESS;
 	event.window = GTK_LAYOUT(GNOME_CANVAS_ITEM(cell->item)->canvas)->bin_window;
         event.button = 1;
@@ -67,6 +90,27 @@
 	g_signal_emit_by_name (cell->item, "event", &event, &finished);
 }
 
+static void
+model_change_cb (ETableModel *etm,
+		 gint row,
+		 gint col,
+		 GalA11yECell *cell)
+{
+	gint value;
+
+	if (col == cell->model_col && row == cell->row) {
+
+	        value = GPOINTER_TO_INT (
+			e_table_model_value_at (cell->cell_view->e_table_model,
+						cell->model_col, cell->row));
+		if (value)
+			gal_a11y_e_cell_add_state (cell, ATK_STATE_CHECKED, TRUE);
+		else
+			gal_a11y_e_cell_remove_state (cell, ATK_STATE_CHECKED, TRUE);
+	}
+}
+
+
 AtkObject* 
 gal_a11y_e_cell_toggle_new (ETableItem *item,
 			    ECellView  *cell_view,
@@ -78,6 +122,7 @@
 	AtkObject *a11y;
 	GalA11yECell *cell;
 	GalA11yECellToggle *toggle_cell;
+	gint value;
 
 	a11y = ATK_OBJECT(g_object_new (GAL_A11Y_TYPE_E_CELL_TOGGLE, NULL));
 
@@ -100,6 +145,19 @@
 				    "toggle the cell", /* action description */
 				    NULL,              /* action keybinding */
 				    toggle_cell_action);
+
+	toggle_cell->model_id = g_signal_connect (cell_view->e_table_model,
+						  "model_cell_changed",
+						  (GCallback) model_change_cb,
+						  a11y);
+
+	value = GPOINTER_TO_INT (
+			e_table_model_value_at (cell->cell_view->e_table_model,
+                                                cell->model_col, cell->row));
+	if (value)
+		gal_a11y_e_cell_add_state (cell, ATK_STATE_CHECKED, FALSE);
+	else
+		gal_a11y_e_cell_remove_state (cell, ATK_STATE_CHECKED, FALSE);
 
 	return a11y;
 }
Index: gal/a11y/e-table/gal-a11y-e-cell-toggle.h
===================================================================
RCS file: /export/src/cvs/gal/gal/a11y/e-table/gal-a11y-e-cell-toggle.h,v
retrieving revision 1.1
diff -u -r1.1 gal-a11y-e-cell-toggle.h
--- gal/a11y/e-table/gal-a11y-e-cell-toggle.h	2003/10/28 06:55:15	1.1
+++ gal/a11y/e-table/gal-a11y-e-cell-toggle.h	2003/11/18 10:18:47
@@ -22,7 +22,7 @@
 struct _GalA11yECellToggle
 {
   GalA11yECell parent;
-  gboolean cell_value;
+  gint         model_id;
 };
 
 GType gal_a11y_e_cell_toggle_get_type (void);
Index: gal/a11y/e-table/gal-a11y-e-cell.c
===================================================================
RCS file: /export/src/cvs/gal/gal/a11y/e-table/gal-a11y-e-cell.c,v
retrieving revision 1.7
diff -u -r1.7 gal-a11y-e-cell.c
--- gal/a11y/e-table/gal-a11y-e-cell.c	2003/11/17 09:29:33	1.7
+++ gal/a11y/e-table/gal-a11y-e-cell.c	2003/11/18 10:18:47
@@ -120,8 +120,8 @@
 	e_table = gtk_widget_get_parent (GNOME_CANVAS_ITEM (a11y->item)->canvas);
 	view_row = e_table_view_to_model_row (E_TABLE (e_table), a11y->row);
 
-	e_selection_model_clear (a11y->item->selection);
 	e_selection_model_select_single_row (a11y->item->selection, view_row);
+	e_selection_model_change_cursor (a11y->item->selection, view_row, a11y->view_col);
 
 	gtk_widget_grab_focus (e_table);
 	toplevel = gtk_widget_get_toplevel (e_table);
Index: gal/a11y/e-table/gal-a11y-e-table-item.c
===================================================================
RCS file: /export/src/cvs/gal/gal/a11y/e-table/gal-a11y-e-table-item.c,v
retrieving revision 1.11
diff -u -r1.11 gal-a11y-e-table-item.c
--- gal/a11y/e-table/gal-a11y-e-table-item.c	2003/11/17 09:29:33	1.11
+++ gal/a11y/e-table/gal-a11y-e-table-item.c	2003/11/18 10:18:47
@@ -961,9 +961,16 @@
 eti_a11y_cursor_changed_cb (ESelectionModel *selection,
 			    int row, int col,  GalA11yETableItem *a11y)
 {
+	AtkObject * cell;
 	g_return_if_fail (GAL_A11Y_IS_E_TABLE_ITEM (a11y));
 
 	g_signal_emit_by_name (a11y, "selection_changed");
+
+        cell = atk_table_ref_at (ATK_TABLE (a11y), row, col);
+        if (ATK_IS_OBJECT (cell))
+                g_signal_emit_by_name  (a11y,
+                                        "active-descendant-changed",
+                                        cell);
 }
 
 /* atk selection */
