gtk_tree_model_filter_row_deleted was emitting ::row-deleted while
the internal state of the model was still in disarray, causing
segfaults e.g. when mapping the file chooser with accessibility
turned on. This is just a bandaid fix, and doesn't try address
any of the deeper problems of the filter model code.
I did take the time to reduce rampant variable shadowing in that
function, though.
The old version wasn't introspectable as it didn't have a length
return parameter. Also, delete gtk_tree_path_get_indices_with_depth,
since it's no longer needed.
This makes it possible to create filter subclasses by implementing the vcalls.
You can optionally chain up to the parent class' implementation, to make it
possible to have "your filter + additional custom filtering".
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=604150
This commit was created using a script that searched for all docstrings
containing a parameter and the string 'or %NULL'.
Gdk backends and demos excluded as they are not part of a public API
https://bugzilla.gnome.org/show_bug.cgi?id=610474
The Gtk-custom.c file in gir-repository contained a number of
introspection annotations. Merge those into the GTK source files.
Some documentation was moved from the tmpl/ files to accomodate
the addition of annotations.
gtk_tree_model_filter_set_visible_func() is checking for
priv->visible_func, but that is always going to be NULL since there's
no way to call this function twice.
Besides that the code itself is wrong, since it tries to call
priv->visible_destroy without making sure that it's not NULL
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).