Method

GLibTreeforeach_node

since: 2.68

Declaration

void
g_tree_foreach_node (
  GTree* tree,
  GTraverseNodeFunc func,
  gpointer user_data
)

Description

Calls the given function for each of the nodes in the GTree. The function is passed the pointer to the particular node, and the given data parameter. The tree traversal happens in-order.

The tree may not be modified while iterating over it (you can’t add/remove items). To remove all items matching a predicate, you need to add each item to a list in your GTraverseFunc as you walk over the tree, then walk the list and remove each item.

Available since: 2.68

Parameters

func

Type: GTraverseNodeFunc

The function to call for each node visited. If this function returns TRUE, the traversal is stopped.

user_data

Type: gpointer

User data to pass to the function.

The argument can be NULL.
The data is owned by the caller of the function.