On 01-11-18 22:58, Mike Wey wrote:

1) GtkTreeModelFilterVisibleFunc is available in gtk.c.types, only it's
the plain C one, so it's not easy to use. I'll post an more detailed
answer when i have a bit more time.

GtkTreeModelFilterVisibleFunc is a simple C callback, so in the callback
you will need to convert these to D objects.

filter.setVisibleFunc(&FilterTree, null, cast(GDestroyNotify)null);

public static extern(C) int FilterTree(GtkTreeModel* m, GtkTreeIter* i, 
void* data)
{
	TreeModel model = new TreeModel(m);
	TreeIter  iter  = new TreeIter(i);

	string name = model.getValue(iter, 0).getString();
	if (name == "BT")
		return true;
	else
		return false;
}

2) You can convert a TreePath to an iter using the getIter function.

3) The foreach_ function allows you to iterate over all the values in
the model.

The foreach_ function has the same issue as the VisibleFunc:

model.foreach_(&ForEachFunc, null);

public static extern(c) in tForEachFunc(GtkTreeModel* m, GtkTreePath* p, 
GtkTreeIter* i, void* data)
{
	TreeModel model = new TreeModel(m);
	TreePath  path  = new TreePath(p);
	TreeIter  iter  = new TreeIter(i);

	...
}