mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-19 18:00:09 +00:00
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.
This commit is contained in:
parent
ee91e272a8
commit
63ddb3f2c7
@ -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,
|
||||
|
@ -25,7 +25,6 @@ struct _GtkIconViewItem
|
||||
{
|
||||
GdkRectangle cell_area;
|
||||
|
||||
GtkTreeIter iter;
|
||||
gint index;
|
||||
|
||||
gint row, col;
|
||||
|
Loading…
Reference in New Issue
Block a user