a11y: Don't duplicate information anymore

We do provide the expandable and expanded information via
GtkCellRendererState now so there is no need to use extra flags.
This commit is contained in:
Benjamin Otte
2011-12-11 03:02:12 +01:00
parent bb029420fd
commit acfb3b3d88
5 changed files with 11 additions and 48 deletions

View File

@@ -109,7 +109,6 @@ gtk_cell_accessible_ref_state_set (AtkObject *accessible)
GtkCellAccessible *cell_accessible;
AtkStateSet *state_set;
GtkCellRendererState flags;
gboolean expandable, expanded;
cell_accessible = GTK_CELL_ACCESSIBLE (accessible);
@@ -121,7 +120,7 @@ gtk_cell_accessible_ref_state_set (AtkObject *accessible)
return state_set;
}
flags = _gtk_cell_accessible_get_state (cell_accessible, &expandable, &expanded);
flags = _gtk_cell_accessible_get_state (cell_accessible);
atk_state_set_add_state (state_set, ATK_STATE_TRANSIENT);
@@ -151,9 +150,9 @@ gtk_cell_accessible_ref_state_set (AtkObject *accessible)
atk_state_set_add_state (state_set, ATK_STATE_FOCUSED);
}
if (expandable)
if (flags & GTK_CELL_RENDERER_EXPANDABLE)
atk_state_set_add_state (state_set, ATK_STATE_EXPANDABLE);
if (expanded)
if (flags & GTK_CELL_RENDERER_EXPANDED)
atk_state_set_add_state (state_set, ATK_STATE_EXPANDED);
return state_set;
@@ -475,35 +474,21 @@ _gtk_cell_accessible_set_cell_data (GtkCellAccessible *cell)
/**
* _gtk_cell_accessible_get_state:
* @cell: a #GtkCellAccessible
* @expandable: (out): %NULL or pointer to boolean that gets set to
* whether the cell can be expanded
* @expanded: (out): %NULL or pointer to boolean that gets set to
* whether the cell is expanded
*
* Gets the state that would be used to render the area referenced by @cell.
*
* Returns: the #GtkCellRendererState for cell
**/
GtkCellRendererState
_gtk_cell_accessible_get_state (GtkCellAccessible *cell,
gboolean *expandable,
gboolean *expanded)
_gtk_cell_accessible_get_state (GtkCellAccessible *cell)
{
AtkObject *parent;
g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE (cell), 0);
if (expandable)
*expandable = FALSE;
if (expanded)
*expanded = FALSE;
parent = gtk_widget_get_accessible (cell->widget);
if (parent == NULL)
return 0;
return _gtk_cell_accessible_parent_get_renderer_state (GTK_CELL_ACCESSIBLE_PARENT (parent),
cell,
expandable,
expanded);
return _gtk_cell_accessible_parent_get_renderer_state (GTK_CELL_ACCESSIBLE_PARENT (parent), cell);
}

View File

@@ -50,9 +50,7 @@ struct _GtkCellAccessibleClass
GType _gtk_cell_accessible_get_type (void);
GtkCellRendererState
_gtk_cell_accessible_get_state (GtkCellAccessible *cell,
gboolean *expandable,
gboolean *expanded);
_gtk_cell_accessible_get_state (GtkCellAccessible *cell);
void _gtk_cell_accessible_set_cell_data (GtkCellAccessible *cell);
void _gtk_cell_accessible_initialise (GtkCellAccessible *cell,

View File

@@ -114,9 +114,7 @@ _gtk_cell_accessible_parent_get_child_index (GtkCellAccessibleParent *parent,
GtkCellRendererState
_gtk_cell_accessible_parent_get_renderer_state (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell,
gboolean *expandable,
gboolean *expanded)
GtkCellAccessible *cell)
{
GtkCellAccessibleParentIface *iface;
@@ -125,13 +123,8 @@ _gtk_cell_accessible_parent_get_renderer_state (GtkCellAccessibleParent *parent,
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
if (expandable)
*expandable = FALSE;
if (expanded)
*expanded = FALSE;
if (iface->get_renderer_state)
return (iface->get_renderer_state) (parent, cell, expandable, expanded);
return (iface->get_renderer_state) (parent, cell);
else
return 0;
}

View File

@@ -62,9 +62,7 @@ struct _GtkCellAccessibleParentIface
GtkCellAccessible *cell);
GtkCellRendererState
( *get_renderer_state) (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell,
gboolean *expandable,
gboolean *expanded);
GtkCellAccessible *cell);
void ( *set_cell_data) (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell);
@@ -88,9 +86,7 @@ int _gtk_cell_accessible_parent_get_child_index (GtkCellAccessibleParent *
GtkCellAccessible *cell);
GtkCellRendererState
_gtk_cell_accessible_parent_get_renderer_state(GtkCellAccessibleParent *parent,
GtkCellAccessible *cell,
gboolean *expandable,
gboolean *expanded);
GtkCellAccessible *cell);
void _gtk_cell_accessible_parent_set_cell_data (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell);

View File

@@ -1516,9 +1516,7 @@ gtk_tree_view_accessible_get_child_index (GtkCellAccessibleParent *parent,
static GtkCellRendererState
gtk_tree_view_accessible_get_renderer_state (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell,
gboolean *expandable,
gboolean *expanded)
GtkCellAccessible *cell)
{
GtkTreeViewAccessibleCellInfo *cell_info;
GtkTreeView *treeview;
@@ -1572,13 +1570,6 @@ gtk_tree_view_accessible_get_renderer_state (GtkCellAccessibleParent *parent,
flags |= GTK_CELL_RENDERER_FOCUSED;
}
if (expandable)
*expandable = GTK_RBNODE_FLAG_SET (cell_info->node, GTK_RBNODE_IS_PARENT)
&& cell_info->cell_col_ref == gtk_tree_view_get_expander_column (treeview);
if (expanded)
*expanded = cell_info->node->children
&& cell_info->cell_col_ref == gtk_tree_view_get_expander_column (treeview);
return flags;
}