Sign up

GtkD, Application and ApplicationWindow

This is really just a note to note that all the example of GtkD I can find on the Web are old-style code that should not be followed for new code. The new model is to have main create an instance of an Application which is an event handler for all the application level events, and ApplicationWindows which are create and managed by the Application instance.

Does anyone know of any examples in the new style (other than my trivial Hello World which doesn't follow the standard C++ paradigm.

This is really leading up to whether GtkD code should look like Gtk+ C code or GtkMM C++ code in style?

Re: GtkD, Application and ApplicationWindow

On 03/08/2016 06:35 PM, Russel Winder wrote:

This is really just a note to note that all the example of GtkD I can find on the Web are old-style code that should not be followed for new code. The new model is to have main create an instance of an Application which is an event handler for all the application level events, and ApplicationWindows which are create and managed by the Application instance.

Does anyone know of any examples in the new style (other than my trivial Hello World which doesn't follow the standard C++ paradigm.

This is really leading up to whether GtkD code should look like Gtk+ C code or GtkMM C++ code in style?

Gerald Nunn recently contributed two examples that use
Application/ApplicationWindow:

https://github.com/gtkd-developers/GtkD/blob/master/demos/gtkD/DemoActions/DemoActions.d
https://github.com/gtkd-developers/GtkD/blob/master/demos/gtkD/DemoMultithread/DemoMultithread.d

Updating the other examples is on the todo list but haven't gotten
around to it.

Re: GtkD, Application and ApplicationWindow

On Tue, 08 Mar 2016 17:35:03 GMT, Russel Winder wrote:

Does anyone know of any examples in the new style (other than my trivial Hello World which doesn't follow the standard C++ paradigm.

In addition to the demos I wrote that Mike pointed out you can view my two applications on github, Terminix and vgrep. Terminix in particular really exercises the new paradigm including handling remote and local instances of GtkApplication.

Https://github.com/gnunn1/terminix

Https://github.com/gnunn1/vgrep

Re: GtkD, Application and ApplicationWindow

On Thu, 10 Mar 2016 00:54:35 GMT, Gerald Nunn wrote:
[…]

Https://github.com/gnunn1/terminix

Https://github.com/gnunn1/vgrep

Thanks for posting these, I have taken a look at the Terminix code and it seems to confirm much of what I had discovered, which is really great to know. I think the only actual problem I have is that with C++ there is automatic registration of a set of methods in the Application instance as callbacks bound to the lifecycle events. In D these have to be added manually. Maybe this is not a problem, just a "surprise" that needs to be made explicit. (Or maybe it already is and I just missed it.)

Re: GtkD, Application and ApplicationWindow

On Thu, 10 Mar 2016 07:05:41 GMT, Russel Winder wrote:

Thanks for posting these, I have taken a look at the Terminix code and it seems to confirm much of what I had discovered, which is really great to know. I think the only actual problem I have is that with C++ there is automatic registration of a set of methods in the Application instance as callbacks bound to the lifecycle events. In D these have to be added manually. Maybe this is not a problem, just a "surprise" that needs to be made explicit. (Or maybe it already is and I just missed it.)

Well I'm coming from Java Swing as my last GUI experience so it pretty much feels like what I'd normally do in that framework. I don't think it's in different in the pure C GTK API, I assume wiring those callbacks are something extra gtkmm provides?