On 08/28/2014 06:50 PM, Russel Winder wrote:> On Tue, 26 Aug 2014 23:21:06 +0200, Mike Wey wrote:
[…]
I'll have to do some research on this one.
Hopefully you have enough data to move on this. If not, let me know what experimentation I need to do to be able to provide data as needed.
It appears an ApplicationWindow can only be added to an Application after the activate signal has been emitted.
Otherwise it will crash because the Application hasn't been registered yet.
The following code works:
import gtk.Application: Application;
import gio.Application: GioApplication = Application;
import gtk.ApplicationWindow: ApplicationWindow;
import gtk.Label: Label;
import gtkc.giotypes: GApplicationFlags;
class HelloWorld: ApplicationWindow {
this(Application application) {
super(application);
setTitle("Hello World.");
add(new Label("Hello World"));
showAll();
}
}
int main(string[] args) {
auto application = new Application("uk.org.winder.gtkd.helloworld", GApplicationFlags.NONE);
application.addOnActivate(delegate void(GioApplication app){ new HelloWorld(application); });
return application.run(args);
}
We could use the same overload of run the gtkmm provides, so this whould be taken care of for you.