|
Hi , with this patch, the atk table and atk selection interface are believed to be complete. atk selection signals for gal-a11y-e-table-item (http://bugzilla.ximian.com/show_bug.cgi?id=50480) This patch also add two new signals in e-table-item ("selection_model_removed" and "selection_model_added") Thanks, Bolian |
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gal/ChangeLog,v
retrieving revision 1.818
diff -u -r1.818 ChangeLog
--- ChangeLog 3 Nov 2003 06:55:14 -0000 1.818
+++ ChangeLog 3 Nov 2003 08:06:27 -0000
@@ -1,5 +1,9 @@
2003-11-03 Bolian Yin <bolian yin sun com>
+ * gal/a11y/e-table/gal-a11y-e-table-item: listen on "selection_model_removed" and "selection_model_added".
+
+2003-11-03 Bolian Yin <bolian yin sun com>
+
* gal/a11y/e-table/gal-a11y-e-table-item: defunct widget checking, selection interface
2003-10-30 Tim Wo <tim wo sun com>
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.2
diff -u -r1.2 gal-a11y-e-table-item.c
--- gal/a11y/e-table/gal-a11y-e-table-item.c 3 Nov 2003 06:40:50 -0000 1.2
+++ gal/a11y/e-table/gal-a11y-e-table-item.c 3 Nov 2003 08:06:28 -0000
@@ -32,6 +32,8 @@
struct _GalA11yETableItemPrivate {
AtkObject *parent;
gint index_in_parent;
+ int selection_change_id;
+ int cursor_change_id;
};
#if 0
@@ -430,7 +432,7 @@
return table_is_row_selected (table, row);
}
-static gint
+static gint
table_get_selected_rows (AtkTable *table, gint **rows_selected)
{
ETableItem *item;
@@ -550,6 +552,8 @@
priv->parent = NULL;
priv->index_in_parent = -1;
+ priv->selection_change_id = 0;
+ priv->cursor_change_id = 0;
}
/* atk selection */
@@ -564,6 +568,16 @@
static gboolean selection_is_child_selected (AtkSelection *selection,
gint i);
+/* callbacks */
+static void eti_a11y_selection_model_removed_cb (ETableItem *eti,
+ ESelectionModel *selection,
+ gpointer data);
+static void eti_a11y_selection_model_added_cb (ETableItem *eti,
+ ESelectionModel *selection,
+ gpointer data);
+static void eti_a11y_selection_changed_cb (ESelectionModel *selection, GalA11yETableItem *a11y);
+static void eti_a11y_cursor_changed_cb (ESelectionModel *selection,
+ int row, int col, GalA11yETableItem *a11y);
/**
* gal_a11y_e_table_item_get_type:
@@ -641,6 +655,22 @@
GET_PRIVATE (a11y)->parent = parent;
GET_PRIVATE (a11y)->index_in_parent = index_in_parent;
+ if (item) {
+ g_signal_connect (G_OBJECT(item), "selection_model_removed",
+ G_CALLBACK (eti_a11y_selection_model_removed_cb), NULL);
+ g_signal_connect (G_OBJECT(item), "selection_model_added",
+ G_CALLBACK (eti_a11y_selection_model_added_cb), NULL);
+ if (item->selection) {
+ GET_PRIVATE (a11y)->selection_change_id = g_signal_connect (
+ G_OBJECT(item->selection), "selection_changed",
+ G_CALLBACK (eti_a11y_selection_changed_cb), a11y);
+ GET_PRIVATE (a11y)->cursor_change_id = g_signal_connect (
+ G_OBJECT(item->selection), "cursor_changed",
+ G_CALLBACK (eti_a11y_cursor_changed_cb), a11y);
+
+ g_object_ref (item->selection);
+ }
+ }
if (parent)
g_object_ref (parent);
@@ -654,6 +684,74 @@
return ATK_OBJECT (a11y);
}
+
+/* callbacks */
+
+static void
+eti_a11y_selection_model_removed_cb (ETableItem *eti, ESelectionModel *selection,
+ gpointer data)
+{
+ AtkObject *atk_obj;
+ GalA11yETableItem *a11y;
+
+ g_return_if_fail (E_IS_TABLE_ITEM (eti));
+ g_return_if_fail (E_IS_SELECTION_MODEL (selection));
+
+ atk_obj = atk_gobject_accessible_for_object (G_OBJECT (eti));
+ a11y = GAL_A11Y_E_TABLE_ITEM (atk_obj);
+
+ if (GET_PRIVATE (a11y)->selection_change_id != 0 &&
+ GET_PRIVATE (a11y)->cursor_change_id != 0) {
+ g_signal_handler_disconnect (selection,
+ GET_PRIVATE (a11y)->selection_change_id);
+ g_signal_handler_disconnect (selection,
+ GET_PRIVATE (a11y)->cursor_change_id);
+ GET_PRIVATE (a11y)->cursor_change_id = 0;
+ GET_PRIVATE (a11y)->selection_change_id = 0;
+ g_object_unref (selection);
+ }
+}
+
+static void
+eti_a11y_selection_model_added_cb (ETableItem *eti, ESelectionModel *selection,
+ gpointer data)
+{
+ AtkObject *atk_obj;
+ GalA11yETableItem *a11y;
+
+ g_return_if_fail (E_IS_TABLE_ITEM (eti));
+ g_return_if_fail (E_IS_SELECTION_MODEL (selection));
+
+ atk_obj = atk_gobject_accessible_for_object (G_OBJECT (eti));
+ a11y = GAL_A11Y_E_TABLE_ITEM (atk_obj);
+
+ GET_PRIVATE (a11y)->selection_change_id = g_signal_connect (
+ G_OBJECT(selection), "selection_changed",
+ G_CALLBACK (eti_a11y_selection_changed_cb), a11y);
+ GET_PRIVATE (a11y)->cursor_change_id = g_signal_connect (
+ G_OBJECT(selection), "cursor_changed",
+ G_CALLBACK (eti_a11y_cursor_changed_cb), a11y);
+
+ g_object_ref (selection);
+}
+
+static void
+eti_a11y_selection_changed_cb (ESelectionModel *selection, GalA11yETableItem *a11y)
+{
+ g_return_if_fail (GAL_A11Y_IS_E_TABLE_ITEM (a11y));
+
+ g_signal_emit_by_name (a11y, "selection_changed");
+}
+
+static void
+eti_a11y_cursor_changed_cb (ESelectionModel *selection,
+ int row, int col, GalA11yETableItem *a11y)
+{
+ g_return_if_fail (GAL_A11Y_IS_E_TABLE_ITEM (a11y));
+
+ g_signal_emit_by_name (a11y, "selection_changed");
+}
+
/* atk selection */
static void atk_selection_interface_init (AtkSelectionIface *iface)
@@ -708,7 +806,7 @@
return TRUE;
}
-static AtkObject*
+static AtkObject *
selection_ref_selection (AtkSelection *selection, gint index)
{
AtkTable *table;
Index: gal/e-table/ChangeLog
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/ChangeLog,v
retrieving revision 1.917
diff -u -r1.917 ChangeLog
--- gal/e-table/ChangeLog 23 Oct 2003 20:18:55 -0000 1.917
+++ gal/e-table/ChangeLog 3 Nov 2003 08:06:34 -0000
@@ -1,3 +1,7 @@
+2003-11-03 Bolian Yin <bolian yin sun com>
+
+ * e-table-item: add two signals: "selection_model_removed" and "selection_model_added"
+
2003-10-23 Hans Petter Jansson <hpj ximian com>
* e-table-item.c (eti_get_cell_background_color): Allocate
Index: gal/e-table/e-table-item.c
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-table-item.c,v
retrieving revision 1.228
diff -u -r1.228 e-table-item.c
--- gal/e-table/e-table-item.c 23 Oct 2003 20:18:55 -0000 1.228
+++ gal/e-table/e-table-item.c 3 Nov 2003 08:06:36 -0000
@@ -75,6 +75,8 @@
KEY_PRESS,
START_DRAG,
STYLE_SET,
+ SELECTION_MODEL_REMOVED,
+ SELECTION_MODEL_ADDED,
LAST_SIGNAL
};
@@ -551,6 +553,8 @@
eti->cursor_change_id);
g_signal_handler_disconnect (eti->selection,
eti->cursor_activated_id);
+ g_signal_emit_by_name (G_OBJECT(eti),
+ "selection_model_removed", eti->selection);
g_object_unref (eti->selection);
eti->selection_change_id = 0;
@@ -1315,6 +1319,8 @@
G_CALLBACK (eti_cursor_activated), eti);
eti_selection_change(selection, eti);
+ g_signal_emit_by_name (G_OBJECT(eti),
+ "selection_model_added", eti->selection);
}
static void
@@ -2897,6 +2903,8 @@
eti_class->key_press = NULL;
eti_class->start_drag = NULL;
eti_class->style_set = eti_style_set;
+ eti_class->selection_model_removed = NULL;
+ eti_class->selection_model_added = NULL;
g_object_class_install_property (object_class, PROP_TABLE_HEADER,
g_param_spec_object ("ETableHeader",
@@ -3071,6 +3079,26 @@
NULL, NULL,
e_marshal_NONE__OBJECT,
G_TYPE_NONE, 1, GTK_TYPE_STYLE);
+
+ eti_signals[SELECTION_MODEL_REMOVED] =
+ g_signal_new ("selection_model_removed",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (ETableItemClass, selection_model_removed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
+
+ eti_signals[SELECTION_MODEL_ADDED] =
+ g_signal_new ("selection_model_added",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (ETableItemClass, selection_model_added),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
atk_registry_set_factory_type (atk_get_default_registry (),
E_TABLE_ITEM_TYPE,
Index: gal/e-table/e-table-item.h
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-table-item.h,v
retrieving revision 1.68
diff -u -r1.68 e-table-item.h
--- gal/e-table/e-table-item.h 15 Aug 2003 20:23:12 -0000 1.68
+++ gal/e-table/e-table-item.h 3 Nov 2003 08:06:36 -0000
@@ -182,6 +182,8 @@
gint (*key_press) (ETableItem *eti, int row, int col, GdkEvent *event);
gint (*start_drag) (ETableItem *eti, int row, int col, GdkEvent *event);
void (*style_set) (ETableItem *eti, GtkStyle *previous_style);
+ void (*selection_model_removed) (ETableItem *eti, ESelectionModel *selection);
+ void (*selection_model_added) (ETableItem *eti, ESelectionModel *selection);
} ETableItemClass;
GType e_table_item_get_type (void);