mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 19:00:08 +00:00
When the filter removes a node, it needs to remove its children too
In gtk_tree_model_filter_remove_node(), we check if the given elt has children. If so, this level will be freed. This action is recursive.
This commit is contained in:
parent
bf573a1e1e
commit
0c4f29e857
@ -1008,9 +1008,13 @@ gtk_tree_model_filter_remove_node (GtkTreeModelFilter *filter,
|
|||||||
GtkTreePath *path;
|
GtkTreePath *path;
|
||||||
FilterElt *tmp;
|
FilterElt *tmp;
|
||||||
|
|
||||||
/* we emit row-deleted, and remove the node from the cache.
|
/* We emit row-deleted, and remove the node from the cache.
|
||||||
|
* If it has any children, these will be removed here as well.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (elt->children)
|
||||||
|
gtk_tree_model_filter_free_level (filter, elt->children);
|
||||||
|
|
||||||
path = gtk_tree_model_get_path (GTK_TREE_MODEL (filter), iter);
|
path = gtk_tree_model_get_path (GTK_TREE_MODEL (filter), iter);
|
||||||
elt->visible = FALSE;
|
elt->visible = FALSE;
|
||||||
gtk_tree_model_filter_increment_stamp (filter);
|
gtk_tree_model_filter_increment_stamp (filter);
|
||||||
@ -1052,10 +1056,16 @@ gtk_tree_model_filter_remove_node (GtkTreeModelFilter *filter,
|
|||||||
{
|
{
|
||||||
GtkTreePath *path;
|
GtkTreePath *path;
|
||||||
|
|
||||||
/* we emit row-deleted, but keep the node in the cache and
|
/* We emit row-deleted, but keep the node in the cache and
|
||||||
* referenced.
|
* referenced. Its children will be removed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (elt->children)
|
||||||
|
{
|
||||||
|
gtk_tree_model_filter_free_level (filter, elt->children);
|
||||||
|
elt->children = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
path = gtk_tree_model_get_path (GTK_TREE_MODEL (filter), iter);
|
path = gtk_tree_model_get_path (GTK_TREE_MODEL (filter), iter);
|
||||||
elt->visible = FALSE;
|
elt->visible = FALSE;
|
||||||
gtk_tree_model_filter_increment_stamp (filter);
|
gtk_tree_model_filter_increment_stamp (filter);
|
||||||
@ -1066,7 +1076,7 @@ gtk_tree_model_filter_remove_node (GtkTreeModelFilter *filter,
|
|||||||
{
|
{
|
||||||
GtkTreePath *path;
|
GtkTreePath *path;
|
||||||
|
|
||||||
/* blow level away */
|
/* Blow level away, including any child levels */
|
||||||
|
|
||||||
path = gtk_tree_model_get_path (GTK_TREE_MODEL (filter), iter);
|
path = gtk_tree_model_get_path (GTK_TREE_MODEL (filter), iter);
|
||||||
elt->visible = FALSE;
|
elt->visible = FALSE;
|
||||||
|
Loading…
Reference in New Issue
Block a user