[gtk+] a11y: Make the cache lookup function inefficient



commit a9dd3e559af6763e86ee615b6fcbc8a506e766c4
Author: Benjamin Otte <otte redhat com>
Date:   Fri Nov 11 01:40:36 2011 +0100

    a11y: Make the cache lookup function inefficient
    
    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 |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/gtk/a11y/gtktreeviewaccessible.c b/gtk/a11y/gtktreeviewaccessible.c
index 8366794..b6faa75 100644
--- a/gtk/a11y/gtktreeviewaccessible.c
+++ b/gtk/a11y/gtktreeviewaccessible.c
@@ -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



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