gtk_tree_model_build_level() always needs to emit row-inserted when
requested, this should not depend on whether the level has a parent
level or a virtual root, which is a check whether or not we need to
reference the node in the child model. Furthermore, we also need
to emit row-has-child-toggled after row-inserted when appropriate.
When gtk_tree_model_filter_row_changed() pulls in the root level, it
must request build_level() to emit signals for this. The refilter
function uses row_changed to process the changes, so build_level() in
the first call to row_changed() might pull in multiple new nodes in this
scenario, for all of these signals need to be emitted. Of course,
build_level() will then also emit the signals for the node row_changed()
is processing, we should not emit a duplicate signal, this is now
accounted for.
Add a unit test for this. For this small functionality to block the
row-changed signal has been implemented, so that we can simulate calls
to the refilter function using the current visible column setup.
Rework the sort and filter models to store their reference to the parent
element as an array index instead of a pointer to an array element.
These pointers could become invalid with any array modification, whereas
indices do not.
If we have a level with zero visible nodes and the first node becomes
visible in that level, then parent has just become a "real" parent node.
In such a case we need to emit row-has-child-toggled. This only applies
to non-root levels that have a parent. This problem was also found when
writing the unit test, the respective cases in the unit test have been
corrected.
This fixes bugs:
Bug 372010 - Filtering not working properly
Bug 525965 - Filtered and sorted GtkTreeView is missing rows
When a filter function is used that determines the visibility property
of a node using whether or it it has children, the state of this node
very likely changes when the filter model receives a
row-has-child-toggled signal. Therefore, we need to handle state
changes in the row-has-child-toggled handler.
Added checks to see whether the passed iterators are not the same in
convert_child_iter_to_iter() and iter_to_child_iter() functions in both
the sort and filter models.
Fixes bug 573321, suggestion by Vadim Godunko.
2008-03-05 Kristian Rietveld <kris@imendio.com>
* gtk/gtktreemodelfilter.c (gtk_tree_model_filter_row_inserted):
short-circuit in case an empty root level would be build (and thus
directly destroyed) if no virtual root has been set.
svn path=/trunk/; revision=19712
2008-01-10 Kristian Rietveld <kris@imendio.com>
* gtk/gtktreemodelfilter.c (gtk_tree_model_filter_get_path): Fix
a leak of the path (#504611, patch from Sadrul Habib Chowdhury).
svn path=/trunk/; revision=19332
2006-09-26 Kristian Rietveld <kris@imendio.com>
* gtk/gtktreemodelfilter.c (gtk_tree_model_filter_free_level),
(gtk_tree_model_filter_ref_node),
(gtk_tree_model_filter_real_unref_node): bring zero ref count loops
in sync with each other and the sort model.
2006-09-26 Kristian Rietveld <kris@imendio.com>
* gtk/gtktreemodelfilter.c (gtk_tree_model_filter_init),
(gtk_tree_model_filter_finalize), (gtk_tree_model_filter_row_deleted),
(gtk_tree_model_filter_new): unref the virtual root path once that
node (or one if its ancestors) is deleted, set virtual_root_deleted
so we only unref it once.
2006-09-10 Matthias Clasen <mclasen@redhat.com>
* Commit a patch by Behdad to fix typos, omissions and other
errors in the symbol aliasing, and add checks for local PLT
entries. (#354687, Behdad Esfahbod)
2006-08-16 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreemodelfilter.c (gtk_tree_model_filter_fetch_child):
update the refs from children to parents for all nodes, since
they may all have been moved by the insert operation. (#346800,
patch from Jonathan Matthew).
2006-06-12 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreemodelfilter.[ch]
(gtk_tree_model_filter_convert_child_iter_to_iter),
(gtk_tree_model_filter_convert_child_path_to_path): report status
in return value instead of spewing assertions. (#335729, Yevgen
Muntyan).
2006-06-12 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktreemodelfilter.c (gtk_tree_model_filter_finalize):
Clean up user data. (#344624, Christian Weiske)
2006-06-02 Kristian Rietveld <kris@imendio.com>
* gtk/gtktreemodelfilter.c
(gtk_tree_model_filter_convert_child_path_to_path): need to use
gtk_tree_model_filter_get_iter_full() since the path returned
by gtk_real_tree_model_filter_convert_child_path_to_path() includes
invisible nodes.
2006-05-27 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreemodelfilter.c (gtk_tree_model_filter_remove_node):
only unref if elt->ref_count > 0,
(gtk_tree_model_filter_row_deleted): likewise. (Fixes#340839,
reported by Yevgen Muntyan).
2006-02-21 Kristian Rietveld <kris@imendio.com>
* gtk/gtktreemodelfilter.c (gtk_tree_model_filter_rows_reordered):
Make sure we always update the virtual root, also when ->priv->root
is still NULL. (Markku Vire)
2006-02-17 Kristian Rietveld <kris@imendio.com>
* gtk/gtktreemodelfilter.c (gtk_tree_model_filter_rows_reordered):
Only update the virtual root if the child path is an ancestor
of the virtual root. (Patch from Markku Vire).
2006-02-08 Kristian Rietveld <kris@imendio.com>
* gtk/gtktreemodelfilter.c (gtk_tree_model_filter_ref_path),
(gtk_tree_model_filter_unref_path): free temporary paths after
usage (patch from maemo-gtk),
(gtk_tree_model_filter_clear_cache): fix little typo in the docs
(patch from maemo-gtk).
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_deleted): remove
stale FIXME.
2005-10-25 Kristian Rietveld <kris@gtk.org>
Fixes#311955, reported by Markku Vire; and a lot more.
* gtk/gtktreemodelfilter.c: Made this thing work correctly.
Levels can now have invisible nodes cached, functions have been
rewritten/refactored to take this into account; also the logic in
some functions has been corrected.
Each referenced node now references all visible children or a single
invisible child, in order to be able to monitor all changes in the
child model required for correct operation.
When a virtual root is set, all nodes on the virtual root level are
referenced.
At last, a bunch of random bug fixes and comment updates.
2005-09-01 Matthias Clasen <mclasen@redhat.com>
* gdk/*.c: Intern some more strings.
* gtk/gtkintl.h:
* gtk/*.c: Define an I_() macro and use it instead of the
bulky g_intern_static_string().
2005-08-31 Matthias Clasen <mclasen@redhat.com>
* gdk/Makefile.am:
* gtk/Makefile.am: Intern type names in code generated by
glib-mkenums, too.
* gtk/*.c:
* gdk/x11/*.c:
* gdk/*.c: Intern type names before registering the type to avoid
unnecessary copies.
2005-03-29 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktreemodelfilter.c (gtk_tree_model_filter_set_visible_func):
Document the need to refilter if parameters of the visibility function
change. (#169516, Olivier Sessink)
2005-03-21 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkprivate.h: Define macros GTK_PARAM_READABLE,
GTK_PARAM_WRITABLE, GTK_PARAM_READWRITE which are like
their G_ counterparts, but also mark the name, nick
and blurb as static.
* gtk/*.c: Mark param spec strings as static, using
the new macros.
2005-03-20 Matthias Clasen <mclasen@redhat.com>
Make PLT-reduction work with gcc4, and don't include
everything in gdkalias.h:
* gtk/grk.symbols: Group symbols by header and source file.
* gtk/makegtkalias.pl: Protect definitions by the same
preprocessor symbols used to guard the headers. Move
the alias declarations to a separate file which is
produced when calling makegtkalias.pl -def
* gdk/Makefile.am (gtkaliasdef.c): Add a rule to generate
this file.
* gtk/*.c: Include gtkalias.h after the other headers,
include gtkaliasdef.c at the bottom.
* gtk/*.h: Small cleanups.