diff options
author | Kristian Rietveld <kris@gtk.org> | 2003-12-13 15:20:28 +0000 |
---|---|---|
committer | Kristian Rietveld <kristian@src.gnome.org> | 2003-12-13 15:20:28 +0000 |
commit | 5f3cde77ba2c4835e12f8bdee12aeec19a8e0483 (patch) | |
tree | 501c744dd2272806b5e8b2dd69229861d3c6a667 | |
parent | cf98c97946ccd8b92ea924474716325bc053830e (diff) | |
download | gtk+-5f3cde77ba2c4835e12f8bdee12aeec19a8e0483.tar.gz |
A trick for a faster treeview, step 1. Patch to short circuit
Sat Dec 13 16:13:27 2003 Kristian Rietveld <kris@gtk.org>
A trick for a faster treeview, step 1. Patch to short circuit
_build_tree(), inspired by Jonathan (#80868).
* gtk/gtktreeview.c (gtk_tree_view_init): don't put _IS_LIST in
flags by default,
(gtk_tree_view_build_tree): don't even try to recurse when the
model says that it is a list, remove flag unsetter,
(gtk_tree_view_set_model): change flag setting logic.
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_get_flags):
propagate whether or not the child model has _IS_LIST set.
* gtk/gtktreemodelfilter.c (gtk_tree_model_filter_get_flags):
ditto.
-rw-r--r-- | ChangeLog | 17 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 17 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 17 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 17 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 17 | ||||
-rw-r--r-- | gtk/gtktreemodelfilter.c | 8 | ||||
-rw-r--r-- | gtk/gtktreemodelsort.c | 8 | ||||
-rw-r--r-- | gtk/gtktreeview.c | 18 |
8 files changed, 116 insertions, 3 deletions
@@ -1,3 +1,20 @@ +Sat Dec 13 16:13:27 2003 Kristian Rietveld <kris@gtk.org> + + A trick for a faster treeview, step 1. Patch to short circuit + _build_tree(), inspired by Jonathan (#80868). + + * gtk/gtktreeview.c (gtk_tree_view_init): don't put _IS_LIST in + flags by default, + (gtk_tree_view_build_tree): don't even try to recurse when the + model says that it is a list, remove flag unsetter, + (gtk_tree_view_set_model): change flag setting logic. + + * gtk/gtktreemodelsort.c (gtk_tree_model_sort_get_flags): + propagate whether or not the child model has _IS_LIST set. + + * gtk/gtktreemodelfilter.c (gtk_tree_model_filter_get_flags): + ditto. + Sat Dec 13 02:33:17 2003 Matthias Clasen <maclas@gmx.de> * gtk/gtkrange.c (gtk_range_scroll): Undo the last change, diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index c9515970ad..c4bb850dc1 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,20 @@ +Sat Dec 13 16:13:27 2003 Kristian Rietveld <kris@gtk.org> + + A trick for a faster treeview, step 1. Patch to short circuit + _build_tree(), inspired by Jonathan (#80868). + + * gtk/gtktreeview.c (gtk_tree_view_init): don't put _IS_LIST in + flags by default, + (gtk_tree_view_build_tree): don't even try to recurse when the + model says that it is a list, remove flag unsetter, + (gtk_tree_view_set_model): change flag setting logic. + + * gtk/gtktreemodelsort.c (gtk_tree_model_sort_get_flags): + propagate whether or not the child model has _IS_LIST set. + + * gtk/gtktreemodelfilter.c (gtk_tree_model_filter_get_flags): + ditto. + Sat Dec 13 02:33:17 2003 Matthias Clasen <maclas@gmx.de> * gtk/gtkrange.c (gtk_range_scroll): Undo the last change, diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index c9515970ad..c4bb850dc1 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,20 @@ +Sat Dec 13 16:13:27 2003 Kristian Rietveld <kris@gtk.org> + + A trick for a faster treeview, step 1. Patch to short circuit + _build_tree(), inspired by Jonathan (#80868). + + * gtk/gtktreeview.c (gtk_tree_view_init): don't put _IS_LIST in + flags by default, + (gtk_tree_view_build_tree): don't even try to recurse when the + model says that it is a list, remove flag unsetter, + (gtk_tree_view_set_model): change flag setting logic. + + * gtk/gtktreemodelsort.c (gtk_tree_model_sort_get_flags): + propagate whether or not the child model has _IS_LIST set. + + * gtk/gtktreemodelfilter.c (gtk_tree_model_filter_get_flags): + ditto. + Sat Dec 13 02:33:17 2003 Matthias Clasen <maclas@gmx.de> * gtk/gtkrange.c (gtk_range_scroll): Undo the last change, diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index c9515970ad..c4bb850dc1 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,20 @@ +Sat Dec 13 16:13:27 2003 Kristian Rietveld <kris@gtk.org> + + A trick for a faster treeview, step 1. Patch to short circuit + _build_tree(), inspired by Jonathan (#80868). + + * gtk/gtktreeview.c (gtk_tree_view_init): don't put _IS_LIST in + flags by default, + (gtk_tree_view_build_tree): don't even try to recurse when the + model says that it is a list, remove flag unsetter, + (gtk_tree_view_set_model): change flag setting logic. + + * gtk/gtktreemodelsort.c (gtk_tree_model_sort_get_flags): + propagate whether or not the child model has _IS_LIST set. + + * gtk/gtktreemodelfilter.c (gtk_tree_model_filter_get_flags): + ditto. + Sat Dec 13 02:33:17 2003 Matthias Clasen <maclas@gmx.de> * gtk/gtkrange.c (gtk_range_scroll): Undo the last change, diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index c9515970ad..c4bb850dc1 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,20 @@ +Sat Dec 13 16:13:27 2003 Kristian Rietveld <kris@gtk.org> + + A trick for a faster treeview, step 1. Patch to short circuit + _build_tree(), inspired by Jonathan (#80868). + + * gtk/gtktreeview.c (gtk_tree_view_init): don't put _IS_LIST in + flags by default, + (gtk_tree_view_build_tree): don't even try to recurse when the + model says that it is a list, remove flag unsetter, + (gtk_tree_view_set_model): change flag setting logic. + + * gtk/gtktreemodelsort.c (gtk_tree_model_sort_get_flags): + propagate whether or not the child model has _IS_LIST set. + + * gtk/gtktreemodelfilter.c (gtk_tree_model_filter_get_flags): + ditto. + Sat Dec 13 02:33:17 2003 Matthias Clasen <maclas@gmx.de> * gtk/gtkrange.c (gtk_range_scroll): Undo the last change, diff --git a/gtk/gtktreemodelfilter.c b/gtk/gtktreemodelfilter.c index 15aca9ae21..7d08fbf6e5 100644 --- a/gtk/gtktreemodelfilter.c +++ b/gtk/gtktreemodelfilter.c @@ -1752,7 +1752,15 @@ gtk_tree_model_filter_rows_reordered (GtkTreeModel *c_model, static guint gtk_tree_model_filter_get_flags (GtkTreeModel *model) { + GtkTreeModelFlags flags; + g_return_val_if_fail (GTK_IS_TREE_MODEL_FILTER (model), 0); + g_return_val_if_fail (GTK_TREE_MODEL_FILTER (model)->priv->child_model != NULL, 0); + + flags = gtk_tree_model_get_flags (GTK_TREE_MODEL_FILTER (model)->priv->child_model); + + if ((flags & GTK_TREE_MODEL_LIST_ONLY) == GTK_TREE_MODEL_LIST_ONLY) + return GTK_TREE_MODEL_LIST_ONLY; return 0; } diff --git a/gtk/gtktreemodelsort.c b/gtk/gtktreemodelsort.c index e7a31713c5..eacb3d5c0a 100644 --- a/gtk/gtktreemodelsort.c +++ b/gtk/gtktreemodelsort.c @@ -899,7 +899,15 @@ gtk_tree_model_sort_rows_reordered (GtkTreeModel *s_model, static GtkTreeModelFlags gtk_tree_model_sort_get_flags (GtkTreeModel *tree_model) { + GtkTreeModelFlags flags; + g_return_val_if_fail (GTK_IS_TREE_MODEL_SORT (tree_model), 0); + g_return_val_if_fail (GTK_TREE_MODEL_SORT (tree_model)->child_model != NULL, 0); + + flags = gtk_tree_model_get_flags (GTK_TREE_MODEL_SORT (tree_model)->child_model); + + if ((flags & GTK_TREE_MODEL_LIST_ONLY) == GTK_TREE_MODEL_LIST_ONLY) + return GTK_TREE_MODEL_LIST_ONLY; return 0; } diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index d21bc34753..553d7b1a7a 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -1013,7 +1013,9 @@ gtk_tree_view_init (GtkTreeView *tree_view) gtk_widget_set_redraw_on_allocate (GTK_WIDGET (tree_view), FALSE); - tree_view->priv->flags = GTK_TREE_VIEW_IS_LIST | GTK_TREE_VIEW_SHOW_EXPANDERS | GTK_TREE_VIEW_DRAW_KEYFOCUS | GTK_TREE_VIEW_HEADERS_VISIBLE; + tree_view->priv->flags = GTK_TREE_VIEW_SHOW_EXPANDERS + | GTK_TREE_VIEW_DRAW_KEYFOCUS + | GTK_TREE_VIEW_HEADERS_VISIBLE; /* We need some padding */ tree_view->priv->dy = 0; @@ -6912,11 +6914,16 @@ gtk_tree_view_build_tree (GtkTreeView *tree_view, gboolean recurse) { GtkRBNode *temp = NULL; + gboolean is_list = GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_IS_LIST); do { gtk_tree_model_ref_node (tree_view->priv->model, iter); temp = _gtk_rbtree_insert_after (tree, temp, 0, FALSE); + + if (is_list) + continue; + if (recurse) { GtkTreeIter child; @@ -6933,7 +6940,6 @@ gtk_tree_view_build_tree (GtkTreeView *tree_view, { if ((temp->flags>K_RBNODE_IS_PARENT) != GTK_RBNODE_IS_PARENT) temp->flags ^= GTK_RBNODE_IS_PARENT; - GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_IS_LIST); } } while (gtk_tree_model_iter_next (tree_view->priv->model, iter)); @@ -8433,7 +8439,6 @@ gtk_tree_view_set_model (GtkTreeView *tree_view, g_object_unref (tree_view->priv->model); tree_view->priv->search_column = -1; - GTK_TREE_VIEW_SET_FLAG (tree_view, GTK_TREE_VIEW_IS_LIST); tree_view->priv->fixed_height_check = 0; tree_view->priv->dy = tree_view->priv->top_row_dy = 0; } @@ -8446,6 +8451,7 @@ gtk_tree_view_set_model (GtkTreeView *tree_view, gint i; GtkTreePath *path; GtkTreeIter iter; + GtkTreeModelFlags flags; if (tree_view->priv->search_column == -1) { @@ -8483,6 +8489,12 @@ gtk_tree_view_set_model (GtkTreeView *tree_view, G_CALLBACK (gtk_tree_view_rows_reordered), tree_view); + flags = gtk_tree_model_get_flags (tree_view->priv->model); + if ((flags & GTK_TREE_MODEL_LIST_ONLY) == GTK_TREE_MODEL_LIST_ONLY) + GTK_TREE_VIEW_SET_FLAG (tree_view, GTK_TREE_VIEW_IS_LIST); + else + GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_IS_LIST); + path = gtk_tree_path_new_first (); if (gtk_tree_model_get_iter (tree_view->priv->model, &iter, path)) { |