On Tue, 6 Nov 2018 22:19:54 +0100, Mike Wey wrote:

On 06-11-18 16:18, aedt wrote:

On Tue, 06 Nov 2018 15:17:01 GMT, aedt wrote:

On Sun, 4 Nov 2018 19:04:20 +0100, Mike Wey wrote:

On 01-11-18 22:58, Mike Wey wrote:
[...]
Also, regarding the filter, the compiler complains that the nested function is unable to access the enclosing function, probably because the nested function is static. How can I send a string to fn? I still don't understand how fn itself works too. It seems that fn expects 3 arguments yet when I call filter.setVisibleFunc(&fn, null, cast(GDestroyNotify) null);, I don't see any arguments provided to it.

Gtk itself will be calling the function, with the correct parameters.
you can use the data parameter to send data to the callback.

...

Unfortunately that produces an error too:

Error: function gtk.TreeModelFilter.TreeModelFilter.setVisibleFunc(extern (C) int function(GtkTreeModel* model, GtkTreeIter* iter, void* data) func, void* data, extern (C) void function(void* data) destroy) is not callable using argument types (extern (C) int function(GtkTreeModel* m, GtkTreeIter* i, string artistName) @system, void*, extern (C) void function(void* data))
source/app.d(69,24):        cannot pass argument & fn of type extern (C) int function(GtkTreeModel* m, GtkTreeIter* i, string artistName) @system to parameter extern (C) int function(GtkTreeModel* model, GtkTreeIter* iter, void* data) func
/usr/bin/dmd failed with exit code 1.

Full code: https://pastebin.com/Ei7MDZzJ