[gtk+] a11y: Make find by index lookup use the hash table again



commit 0b26a15b6223e490a8553cbf5b4be0ebb28c24b8
Author: Benjamin Otte <otte redhat com>
Date:   Sat Nov 12 06:37:08 2011 +0100

    a11y: Make find by index lookup use the hash table again
    
    This should give back the performance that was lost with the commit
    "a11y: Make the cache lookup function inefficient".

 gtk/a11y/gtktreeviewaccessible.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/gtk/a11y/gtktreeviewaccessible.c b/gtk/a11y/gtktreeviewaccessible.c
index ebab327..51d8167 100644
--- a/gtk/a11y/gtktreeviewaccessible.c
+++ b/gtk/a11y/gtktreeviewaccessible.c
@@ -3079,20 +3079,25 @@ static GtkCellAccessible *
 find_cell (GtkTreeViewAccessible *accessible,
            gint                   index)
 {
-  GtkTreeViewAccessibleCellInfo *info;
-  GHashTableIter iter;
+  GtkTreeViewAccessibleCellInfo lookup, *cell_info;
   GtkTreeView *tree_view;
 
   tree_view = GTK_TREE_VIEW (gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)));
 
-  g_hash_table_iter_init (&iter, accessible->cell_infos);
-  while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &info))
+  if (!_gtk_rbtree_find_index (_gtk_tree_view_get_rbtree (tree_view),
+                               index / accessible->n_cols - 1,
+                               &lookup.tree,
+                               &lookup.node))
     {
-      if (index == cell_info_get_index (tree_view, info))
-        return info->cell;
+      g_assert_not_reached ();
     }
+  lookup.cell_col_ref = gtk_tree_view_get_column (tree_view, index % accessible->n_cols);
 
-  return NULL;
+  cell_info = g_hash_table_lookup (accessible->cell_infos, &lookup);
+  if (cell_info == NULL)
+    return NULL;
+
+  return cell_info->cell;
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]