]> Pileus Git - ~andy/gtk/commitdiff
a11y: Make the cache lookup function inefficient
authorBenjamin Otte <otte@redhat.com>
Fri, 11 Nov 2011 00:40:36 +0000 (01:40 +0100)
committerBenjamin Otte <otte@redhat.com>
Wed, 16 Nov 2011 03:31:06 +0000 (04:31 +0100)
Ahem.

This is in preparation for future changes and is not meant to stay this
way. But I want to change the hash table's keys and this is way easier
when nobody is using them.

gtk/a11y/gtktreeviewaccessible.c

index 83667947c83df527cedace56c14fb7cc1f93b90e..b6faa75377616ffeaf95df00159afd065be54077 100644 (file)
@@ -3206,12 +3206,19 @@ find_cell (GtkTreeViewAccessible *accessible,
            gint                   index)
 {
   GtkTreeViewAccessibleCellInfo *info;
+  GHashTableIter iter;
+  GtkTreeView *tree_view;
 
-  info = g_hash_table_lookup (accessible->cell_info_by_index, &index);
-  if (!info)
-    return NULL;
+  tree_view = GTK_TREE_VIEW (gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)));
 
-  return info->cell;
+  g_hash_table_iter_init (&iter, accessible->cell_info_by_index);
+  while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &info))
+    {
+      if (index == cell_info_get_index (tree_view, info))
+        return info->cell;
+    }
+
+  return NULL;
 }
 
 static void