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.

It seems that I forgot to add the code:

	TreeModelFilter generateArtistFilter(in string artistName) {
		// nested private function
		static extern (C) int fn(GtkTreeModel* m, GtkTreeIter* i, void* data) {
			TreeModel model_ = new TreeModel(m);
			TreeIter iter = new TreeIter(i);

			string name = model_.getValue(iter, COLUMNS.ARTIST).getString();
			return name == artistName;
		}

		auto filter = new TreeModelFilter(model, null);
		filter.setVisibleFunc(&fn, null, cast(GDestroyNotify) null);
		return filter;
	}