aboutsummaryrefslogtreecommitdiffstats
path: root/a11y/e-table
diff options
context:
space:
mode:
authorTim Wo <tim.wo@sun.com>2003-12-02 14:14:34 +0800
committerGilbert Fang <gilbertfang@src.gnome.org>2003-12-02 14:14:34 +0800
commit3e2e35b2a2fda14262d3fb50b0442441e0fcada0 (patch)
treec5352960c0f9b41dc68c0230680e7e09d7ddf5ab /a11y/e-table
parent86ec8d221e158ff53f47766464ddb1c5baff5167 (diff)
downloadgsoc2013-evolution-3e2e35b2a2fda14262d3fb50b0442441e0fcada0.tar
gsoc2013-evolution-3e2e35b2a2fda14262d3fb50b0442441e0fcada0.tar.gz
gsoc2013-evolution-3e2e35b2a2fda14262d3fb50b0442441e0fcada0.tar.bz2
gsoc2013-evolution-3e2e35b2a2fda14262d3fb50b0442441e0fcada0.tar.lz
gsoc2013-evolution-3e2e35b2a2fda14262d3fb50b0442441e0fcada0.tar.xz
gsoc2013-evolution-3e2e35b2a2fda14262d3fb50b0442441e0fcada0.tar.zst
gsoc2013-evolution-3e2e35b2a2fda14262d3fb50b0442441e0fcada0.zip
use table item to get the model. (gal_a11y_e_cell_toggle_new): use table
2003-12-02 Tim Wo <tim.wo@sun.com> * gal/a11y/e-table/gal-a11y-e-cell-toggle.c: (gal_a11y_e_cell_toggle_dispose): use table item to get the model. (gal_a11y_e_cell_toggle_new): use table item to get the model. * gal/a11y/e-table/gal-a11y-e-cell-tree.c: (ectr_model_row_changed_cb): new function to deal with tree cell expansion and collapse (ectr_subcell_weak_ref): destroy the cell_tree a11y instance along with it's subcell's a11y instance. (gal_a11y_e_cell_tree_new): init the atk state of the tree cell, and connect to the model_row_change signal of table model, so that when the tree cell expands or collapses, the corresponding AtkState could be set. * gal/a11y/e-table/gal-a11y-e-cell-tree.h: add one member to save the connected signal id. svn path=/trunk/; revision=23567
Diffstat (limited to 'a11y/e-table')
-rw-r--r--a11y/e-table/gal-a11y-e-cell-toggle.c4
-rw-r--r--a11y/e-table/gal-a11y-e-cell-tree.c127
-rw-r--r--a11y/e-table/gal-a11y-e-cell-tree.h2
3 files changed, 95 insertions, 38 deletions
diff --git a/a11y/e-table/gal-a11y-e-cell-toggle.c b/a11y/e-table/gal-a11y-e-cell-toggle.c
index 497483d255..f3b5bf2879 100644
--- a/a11y/e-table/gal-a11y-e-cell-toggle.c
+++ b/a11y/e-table/gal-a11y-e-cell-toggle.c
@@ -13,7 +13,7 @@ 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;
+ ETableModel *e_table_model = GAL_A11Y_E_CELL (a11y)->item->table_model;
if (e_table_model)
g_signal_handler_disconnect (e_table_model, a11y->model_id);
@@ -146,7 +146,7 @@ gal_a11y_e_cell_toggle_new (ETableItem *item,
NULL, /* action keybinding */
toggle_cell_action);
- toggle_cell->model_id = g_signal_connect (cell_view->e_table_model,
+ toggle_cell->model_id = g_signal_connect (item->table_model,
"model_cell_changed",
(GCallback) model_change_cb,
a11y);
diff --git a/a11y/e-table/gal-a11y-e-cell-tree.c b/a11y/e-table/gal-a11y-e-cell-tree.c
index 3f7071d72b..e6ff75667b 100644
--- a/a11y/e-table/gal-a11y-e-cell-tree.c
+++ b/a11y/e-table/gal-a11y-e-cell-tree.c
@@ -7,7 +7,7 @@
*/
#include <config.h>
-#include <atk/atkaction.h>
+#include <atk/atk.h>
#include "gal-a11y-e-cell-tree.h"
#include "gal-a11y-util.h"
#include "gal/e-table/e-cell-tree.h"
@@ -19,6 +19,41 @@ static AtkObjectClass *a11y_parent_class;
#define A11Y_PARENT_TYPE (gal_a11y_e_cell_get_type ())
static void
+ectr_model_row_changed_cb (ETableModel *etm,
+ gint row,
+ GalA11yECell *a11y)
+{
+ ETreePath node;
+ ETreeModel *tree_model;
+ ETreeTableAdapter *tree_table_adapter;
+
+ g_return_if_fail (a11y);
+ if (a11y->row != row)
+ return;
+
+ node = e_table_model_value_at (etm, -1, a11y->row);
+ tree_model = e_table_model_value_at (etm, -2, a11y->row);
+ tree_table_adapter = e_table_model_value_at (etm, -3, a11y->row);
+
+ if (e_tree_model_node_is_expandable (tree_model, node)) {
+ gboolean is_exp = e_tree_table_adapter_node_is_expanded (tree_table_adapter, node);
+ if (is_exp)
+ gal_a11y_e_cell_add_state (a11y, ATK_STATE_EXPANDED, TRUE);
+ else
+ gal_a11y_e_cell_remove_state (a11y, ATK_STATE_EXPANDED, TRUE);
+ }
+}
+
+static void
+ectr_subcell_weak_ref (GalA11yECellTree *a11y,
+ GalA11yECell *subcell_a11y)
+{
+ g_signal_handler_disconnect (GAL_A11Y_E_CELL (a11y)->item->table_model,
+ a11y->model_row_changed_id);
+ g_object_unref (a11y);
+}
+
+static void
ectr_do_action_expand (AtkAction *action)
{
GalA11yECell *a11y;
@@ -109,46 +144,66 @@ gal_a11y_e_cell_tree_new (ETableItem *item,
int view_col,
int row)
{
- GalA11yECell *a11y;
+ AtkObject *subcell_a11y;
+ GalA11yECellTree *a11y;
GtkWidget *e_table;
- gint model_row;
+ ETreePath node;
+ ETreeModel *tree_model;
+ ETreeTableAdapter *tree_table_adapter;
+
ECellView *subcell_view;
subcell_view = e_cell_tree_view_get_subcell_view (cell_view);
if (subcell_view->ecell) {
- a11y = gal_a11y_e_cell_registry_get_object (NULL,
- item,
- subcell_view,
- parent,
- model_col,
- view_col,
- row);
- } else {
- a11y = g_object_new (gal_a11y_e_cell_tree_get_type (), NULL);
-
- gal_a11y_e_cell_construct (a11y,
- item,
- cell_view,
- parent,
- model_col,
- view_col,
- row);
+ subcell_a11y = gal_a11y_e_cell_registry_get_object (NULL,
+ item,
+ subcell_view,
+ parent,
+ model_col,
+ view_col,
+ row);
+ gal_a11y_e_cell_add_action (subcell_a11y,
+ "expand",
+ "expands the row in the ETree containing this cell",
+ NULL,
+ (ACTION_FUNC)ectr_do_action_expand);
+
+ gal_a11y_e_cell_add_action (subcell_a11y,
+ "collapse",
+ "collapses the row in the ETree containing this cell",
+ NULL,
+ (ACTION_FUNC)ectr_do_action_collapse);
+
+ /* init AtkStates for the cell's a11y object */
+ node = e_table_model_value_at (item->table_model, -1, row);
+ tree_model = e_table_model_value_at (item->table_model, -2, row);
+ tree_table_adapter = e_table_model_value_at (item->table_model, -3, row);
+ if (e_tree_model_node_is_expandable (tree_model, node)) {
+ gal_a11y_e_cell_add_state (subcell_a11y, ATK_STATE_EXPANDABLE, FALSE);
+ if (e_tree_table_adapter_node_is_expanded (tree_table_adapter, node))
+ gal_a11y_e_cell_add_state (subcell_a11y, ATK_STATE_EXPANDED, FALSE);
+ }
}
-
- gal_a11y_e_cell_add_action (a11y,
- "expand",
- "expands the row in the ETree containing this cell",
- NULL,
- (ACTION_FUNC)ectr_do_action_expand);
-
- gal_a11y_e_cell_add_action (a11y,
- "collapse",
- "collapses the row in the ETree containing this cell",
- NULL,
- (ACTION_FUNC)ectr_do_action_collapse);
-
- gal_a11y_e_cell_add_state (a11y, ATK_STATE_EXPANDABLE, FALSE);
-
- return a11y;
+ else
+ subcell_a11y = NULL;
+
+ /* create a companion a11y object, this object has type GalA11yECellTree
+ and it connects to some signals to determine whether a tree cell is
+ expanded or collapsed */
+ a11y = g_object_new (gal_a11y_e_cell_tree_get_type (), NULL);
+ gal_a11y_e_cell_construct (a11y,
+ item,
+ cell_view,
+ parent,
+ model_col,
+ view_col,
+ row);
+ a11y->model_row_changed_id =
+ g_signal_connect (item->table_model, "model_row_changed",
+ G_CALLBACK (ectr_model_row_changed_cb),
+ subcell_a11y);
+ g_object_weak_ref (subcell_a11y, ectr_subcell_weak_ref, a11y);
+
+ return subcell_a11y;
}
diff --git a/a11y/e-table/gal-a11y-e-cell-tree.h b/a11y/e-table/gal-a11y-e-cell-tree.h
index 4d48b66de4..355670b5a4 100644
--- a/a11y/e-table/gal-a11y-e-cell-tree.h
+++ b/a11y/e-table/gal-a11y-e-cell-tree.h
@@ -29,6 +29,8 @@ typedef struct _GalA11yECellTreePrivate GalA11yECellTreePrivate;
**/
struct _GalA11yECellTree {
GalA11yECell object;
+
+ int model_row_changed_id;
};
struct _GalA11yECellTreeClass {