a11y: Remove in_use member

After the latest changes, it is now always TRUE, so adjust the code
accordingly.
This commit is contained in:
Benjamin Otte 2011-11-11 20:30:39 +01:00
parent 40b7e3044e
commit bd1bc88ed2

View File

@ -41,7 +41,6 @@ struct _GtkTreeViewAccessibleCellInfo
GtkTreeRowReference *cell_row_ref;
GtkTreeViewColumn *cell_col_ref;
GtkTreeViewAccessible *view;
gboolean in_use;
};
/* signal handling */
@ -1345,7 +1344,7 @@ gtk_tree_view_accessible_get_cell_area (GtkCellAccessibleParent *parent,
return;
path = gtk_tree_row_reference_get_path (cell_info->cell_row_ref);
tv_col = cell_info->cell_col_ref;
if (path && cell_info->in_use)
if (path)
{
GtkTreeViewColumn *expander_column;
gint focus_line_width;
@ -1484,15 +1483,12 @@ gtk_tree_view_accessible_grab_cell_focus (GtkCellAccessibleParent *parent,
GList *renderers;
renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (tv_col));
if (cell_info->in_use)
{
index = atk_object_get_index_in_parent (cell_object);
renderer = g_list_nth_data (renderers, index);
}
g_list_free (renderers);
}
path = gtk_tree_row_reference_get_path (cell_info->cell_row_ref);
if (path && cell_info->in_use)
if (path)
{
if (renderer)
gtk_tree_view_set_cursor_on_cell (tree_view, path, tv_col, renderer, FALSE);
@ -1712,8 +1708,6 @@ selection_changed_cb (GtkTreeSelection *selection,
/* FIXME: clean rows iterates through all cells too */
g_hash_table_iter_init (&iter, accessible->cell_infos);
while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&info))
{
if (info->in_use)
{
_gtk_cell_accessible_remove_state (info->cell, ATK_STATE_SELECTED, TRUE);
@ -1722,7 +1716,6 @@ selection_changed_cb (GtkTreeSelection *selection,
_gtk_cell_accessible_add_state (info->cell, ATK_STATE_SELECTED, TRUE);
gtk_tree_path_free (path);
}
}
if (gtk_widget_get_realized (widget))
g_signal_emit_by_name (accessible, "selection-changed");
}
@ -1946,8 +1939,6 @@ model_row_changed (GtkTreeModel *tree_model,
/* Must loop through them all */
g_hash_table_iter_init (&hash_iter, accessible->cell_infos);
while (g_hash_table_iter_next (&hash_iter, NULL, (gpointer *)&cell_info))
{
if (cell_info->in_use)
{
cell_path = gtk_tree_row_reference_get_path (cell_info->cell_row_ref);
@ -1962,7 +1953,6 @@ model_row_changed (GtkTreeModel *tree_model,
gtk_tree_path_free (cell_path);
}
}
}
g_signal_emit_by_name (accessible, "visible-data-changed");
}
@ -1989,8 +1979,6 @@ column_visibility_changed (GObject *object,
g_hash_table_iter_init (&iter, accessible->cell_infos);
while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&cell_info))
{
if (cell_info->in_use)
{
tv_col = cell_info->cell_col_ref;
if (tv_col == this_col)
@ -2013,7 +2001,6 @@ column_visibility_changed (GObject *object,
}
}
}
}
}
static void
@ -2336,7 +2323,7 @@ update_cell_value (GtkRendererCellAccessible *renderer_cell,
if (!cell_info || !cell_info->cell_col_ref || !cell_info->cell_row_ref)
return FALSE;
if (emit_change_signal && cell_info->in_use)
if (emit_change_signal)
{
tree_view = GTK_TREE_VIEW (gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)));
tree_model = gtk_tree_view_get_model (tree_view);
@ -2371,18 +2358,12 @@ update_cell_value (GtkRendererCellAccessible *renderer_cell,
* in the list. Otherwise, we assume that the cell is represented
* by the first renderer in the list
*/
if (cell_info->in_use)
{
parent = atk_object_get_parent (ATK_OBJECT (cell));
if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (parent))
cur_renderer = g_list_nth (renderers, atk_object_get_index_in_parent (ATK_OBJECT (cell)));
else
cur_renderer = renderers;
}
else
return FALSE;
if (cur_renderer == NULL)
return FALSE;
@ -2716,8 +2697,6 @@ clean_cell_info (GtkTreeViewAccessible *accessible,
{
GObject *obj;
if (cell_info->in_use)
{
obj = G_OBJECT (cell_info->cell);
_gtk_cell_accessible_add_state (cell_info->cell, ATK_STATE_DEFUNCT, FALSE);
@ -2725,7 +2704,6 @@ clean_cell_info (GtkTreeViewAccessible *accessible,
gtk_tree_view_accessible_get_data_quark (),
NULL);
g_hash_table_remove (accessible->cell_infos, cell_info);
}
}
static void
@ -2802,8 +2780,6 @@ traverse_cells (GtkTreeViewAccessible *accessible,
GtkTreePath *row_path;
gboolean act_on_cell;
if (cell_info->in_use)
{
row_path = gtk_tree_row_reference_get_path (cell_info->cell_row_ref);
g_return_if_fail (row_path != NULL);
if (tree_path == NULL)
@ -2820,10 +2796,7 @@ traverse_cells (GtkTreeViewAccessible *accessible,
act_on_cell = FALSE;
}
if (!cell_info->in_use)
g_warning ("warning: cell info destroyed during traversal");
if (act_on_cell && cell_info->in_use)
if (act_on_cell)
{
set_cell_visibility (GTK_TREE_VIEW (widget),
cell_info->cell,
@ -2832,7 +2805,6 @@ traverse_cells (GtkTreeViewAccessible *accessible,
}
gtk_tree_path_free (row_path);
}
}
g_signal_emit_by_name (accessible, "visible-data-changed");
}
@ -2864,8 +2836,6 @@ set_expand_state (GtkTreeView *tree_view,
g_hash_table_iter_init (&hash_iter, accessible->cell_infos);
while (g_hash_table_iter_next (&hash_iter, NULL, (gpointer *) &cell_info))
{
if (cell_info->in_use)
{
cell_path = gtk_tree_row_reference_get_path (cell_info->cell_row_ref);
found = FALSE;
@ -2931,7 +2901,6 @@ set_expand_state (GtkTreeView *tree_view,
}
gtk_tree_path_free (cell_path);
}
}
}
static void
@ -3081,12 +3050,7 @@ cell_destroyed (gpointer data)
{
GtkTreeViewAccessibleCellInfo *cell_info = data;
if (!cell_info)
return;
if (cell_info->in_use)
{
g_hash_table_remove (cell_info->view->cell_infos, cell_info);
}
}
static int
@ -3122,7 +3086,6 @@ cell_info_new (GtkTreeViewAccessible *accessible,
cell_info->cell_col_ref = tv_col;
cell_info->cell = cell;
cell_info->in_use = TRUE; /* if we've created it, assume it's in use */
cell_info->view = accessible;
g_object_set_qdata_full (G_OBJECT (cell),
@ -3534,15 +3497,8 @@ find_cell_info (GtkTreeViewAccessible *accessible,
GtkCellAccessible *cell,
gboolean live_only)
{
GtkTreeViewAccessibleCellInfo *cell_info;
cell_info = g_object_get_qdata (G_OBJECT (cell),
return g_object_get_qdata (G_OBJECT (cell),
gtk_tree_view_accessible_get_data_quark ());
if (live_only && cell_info && !cell_info->in_use)
cell_info = NULL;
return cell_info;
}
static AtkObject *