[gtk+/gtk-3-4] iconview: Don't cache iters



commit 141875cebda2b6837cf0deae4e083bf695ea84a8
Author: Benjamin Otte <otte redhat com>
Date:   Fri May 4 18:44:39 2012 +0200

    iconview: Don't cache iters
    
    This is a huge quest to remove all caching from GtkIconview to simplify
    the code. As it turns out, iconview performance is a joke, so the caches
    are kinda unnecessary.
    
    If we need caching, we can add it in a useful way later.

 gtk/gtkiconview.c        |   31 +++++--------------------------
 gtk/gtkiconviewprivate.h |    1 -
 2 files changed, 5 insertions(+), 27 deletions(-)
---
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index 5f3bf5b..1afeed67 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -3186,22 +3186,16 @@ gtk_icon_view_row_inserted (GtkTreeModel *model,
   GtkIconView *icon_view = GTK_ICON_VIEW (data);
   gint index;
   GtkIconViewItem *item;
-  gboolean iters_persist;
   GList *list;
 
   /* ignore changes in branches */
   if (gtk_tree_path_get_depth (path) > 1)
     return;
 
-  iters_persist = gtk_tree_model_get_flags (icon_view->priv->model) & GTK_TREE_MODEL_ITERS_PERSIST;
-  
   index = gtk_tree_path_get_indices(path)[0];
 
   item = gtk_icon_view_item_new ();
 
-  if (iters_persist)
-    item->iter = *iter;
-
   item->index = index;
 
   /* FIXME: We can be more efficient here,
@@ -3330,11 +3324,8 @@ gtk_icon_view_build_items (GtkIconView *icon_view)
 {
   GtkTreeIter iter;
   int i;
-  gboolean iters_persist;
   GList *items = NULL;
 
-  iters_persist = gtk_tree_model_get_flags (icon_view->priv->model) & GTK_TREE_MODEL_ITERS_PERSIST;
-  
   if (!gtk_tree_model_get_iter_first (icon_view->priv->model,
 				      &iter))
     return;
@@ -3345,9 +3336,6 @@ gtk_icon_view_build_items (GtkIconView *icon_view)
     {
       GtkIconViewItem *item = gtk_icon_view_item_new ();
 
-      if (iters_persist)
-	item->iter = iter;
-
       item->index = i;
       
       i++;
@@ -4075,22 +4063,13 @@ void
 _gtk_icon_view_set_cell_data (GtkIconView     *icon_view,
 			      GtkIconViewItem *item)
 {
-  gboolean iters_persist;
   GtkTreeIter iter;
+  GtkTreePath *path;
 
-  iters_persist = gtk_tree_model_get_flags (icon_view->priv->model) & GTK_TREE_MODEL_ITERS_PERSIST;
-  
-  if (!iters_persist)
-    {
-      GtkTreePath *path;
-
-      path = gtk_tree_path_new_from_indices (item->index, -1);
-      if (!gtk_tree_model_get_iter (icon_view->priv->model, &iter, path))
-        return;
-      gtk_tree_path_free (path);
-    }
-  else
-    iter = item->iter;
+  path = gtk_tree_path_new_from_indices (item->index, -1);
+  if (!gtk_tree_model_get_iter (icon_view->priv->model, &iter, path))
+    return;
+  gtk_tree_path_free (path);
 
   gtk_cell_area_apply_attributes (icon_view->priv->cell_area, 
 				  icon_view->priv->model,
diff --git a/gtk/gtkiconviewprivate.h b/gtk/gtkiconviewprivate.h
index 81ffd99..b510037 100644
--- a/gtk/gtkiconviewprivate.h
+++ b/gtk/gtkiconviewprivate.h
@@ -25,7 +25,6 @@ struct _GtkIconViewItem
 {
   GdkRectangle cell_area;
 
-  GtkTreeIter iter;
   gint index;
   
   gint row, col;



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