I am trying to implement application.addOnOpen and I am getting stuck trying to work with the "void* files".
Here is the main function for my test app:
int main(string[] args)
{
auto application = new Application(null, GApplicationFlags.HANDLES_OPEN);
application.addOnActivate(delegate void(GioApplication app) { new HelloWorld(application); });
application.addOnOpen(delegate void(void* files, int cnt, string hint, GioApplication app) { new HelloWorld(files, cnt, hint, application); });
return application.run(args);
}
The constructor for the HelloWorld class looks like this:
this(void* files, int cnt, string hint, Application application)
{
writeln(cnt);
GFile* p = cast(GFile*)files;
gio.File.File f = new gio.File.File(p);
this(application);
}
When I run it and pass in one file name on the command line, I can see that cnt is one. So far I have tried casting the void pointer to a GFile pointer and then passing that into a File constructor (as shown above) but that didn't work and received the following errors:
GLib-GObject-CRITICAL **: gobjectsetdatafull: assertion 'GISOBJECT (object)' failed
GLib-GObject-CRITICAL **: gobjectaddtoggleref: assertion 'GISOBJECT (object)' failed
GLib-GObject-CRITICAL **: gobjectisfloating: assertion 'GIS_OBJECT (object)' failed
I am assuming that I am doing something fundamentally wrong here, does anybody see my mistake?