Thread overview
How to create GTK+ apps with Glade and D on windows
May 31, 2019
Obsidian Jackal
May 31, 2019
Aphex
May 31, 2019
Ron Tarrant
Jun 01, 2019
Russel Winder
Jun 03, 2019
Ferhat Kurtulmuş
Jun 03, 2019
Ferhat Kurtulmuş
May 31, 2019
I'm new to D and want to create GTK+ apps. I have Visual Studio, Glade, the Gtk+ runtime, DMD, and DUB installed. What steps, guides, or advice should I follow to be able to be able to use these tools together to make a sane app?.
May 31, 2019
On Friday, 31 May 2019 at 18:47:06 UTC, Obsidian Jackal wrote:
> I'm new to D and want to create GTK+ apps. I have Visual Studio, Glade, the Gtk+ runtime, DMD, and DUB installed. What steps, guides, or advice should I follow to be able to be able to use these tools together to make a sane app?.

I wrote some D code that parses a glade interface file and converts it in to easily accessible D code.

You use the ID field in glade to specify the D object name.

Go to github's gtkD to find a reference to it in issues. It's not perfect and might require a little work figuring it out but it works out nice once you get it set up.

It's basically used like

class App : GtkBase!("Interface.Glade")
{
...
}

and then App will have all the objects ID's as objects.

e.g., if you have a label in the glade interface with ID label, then

App.label

is the gtkD object for that label.

May 31, 2019
On Friday, 31 May 2019 at 18:47:06 UTC, Obsidian Jackal wrote:
> I'm new to D and want to create GTK+ apps. I have Visual Studio, Glade, the Gtk+ runtime, DMD, and DUB installed. What steps, guides, or advice should I follow to be able to be able to use these tools together to make a sane app?.

If you aren't opposed to reading about hand-coding techniques: http://GtkDcoding.com
June 01, 2019
On Fri, 2019-05-31 at 18:47 +0000, Obsidian Jackal via Digitalmars-d- learn wrote:
> I'm new to D and want to create GTK+ apps. I have Visual Studio, Glade, the Gtk+ runtime, DMD, and DUB installed. What steps, guides, or advice should I follow to be able to be able to use these tools together to make a sane app?.

Many people ignore Glade and hand code the widget structure of their applications. For small and simple applications this is fine. I have done this for Me TV – though I have now switched from D to Rust for this application so no public D repository, long story. I did though use XML files (hand written, embedded in the compiled executable using D's string import) for the menus.

For GFontBrowser (https://github.com/russel/GFontBrowser for now, I may well move the mainline repository to GitLab due to better integrated CI/CD) I use Glade and a gtk.Builder instance to read the Glade file – which is embedded into the compiled executable using string import rather than being a file on the filestore. This works very well, and allows all the layout to be done using a layout system rather than fiddling with lines of code. Deciding how much of the call-backs etc. to specify in the Glad file and how much to do in the code is something there seems to be no de facto standard on, so it is down to personal taste. I choose only to build the widget tree with Glade and do all the call-backs in code.

I generally start small to get the hang of things and then progress towards the final application. If the UI has any complications I use Glade for layout.

Reading Ron Tarrant's http://gtkdcoding.com/ will almost certainly be worth it, even if you disagree with some of his codes.

GtkD and GStreamerD (Mike Wey's work) rock – though gtk-rs and
gstreamer-rs are also excellent.


-- 
Russel.
===========================================
Dr Russel Winder      t: +44 20 7585 2200
41 Buckmaster Road    m: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk



June 03, 2019
On Friday, 31 May 2019 at 18:47:06 UTC, Obsidian Jackal wrote:
> I'm new to D and want to create GTK+ apps. I have Visual Studio, Glade, the Gtk+ runtime, DMD, and DUB installed. What steps, guides, or advice should I follow to be able to be able to use these tools together to make a sane app?.

I am writing on my cell phone, so cannot address the whole thing. When I started to learn d, I was playing around a boiler plate to imitate something like javafx and it's builder. Here is a meson based project, which creates a gtkd project including a hello world window, a Glade file, its controller class, and an auto calling python script to update controller class after changing the UI. The paths in src/meson.build must be set before building the project creator. I am sorry, I could not find some free time to make it a more generic project builder, but I think it may give you some idea. Again I was a very beginner when I was working on it.
June 03, 2019
On Monday, 3 June 2019 at 10:32:25 UTC, Ferhat Kurtulmuş wrote:
> On Friday, 31 May 2019 at 18:47:06 UTC, Obsidian Jackal wrote:
>> [...]
>
> I am writing on my cell phone, so cannot address the whole thing. When I started to learn d, I was playing around a boiler plate to imitate something like javafx and it's builder. Here is a meson based project, which creates a gtkd project including a hello world window, a Glade file, its controller class, and an auto calling python script to update controller class after changing the UI. The paths in src/meson.build must be set before building the project creator. I am sorry, I could not find some free time to make it a more generic project builder, but I think it may give you some idea. Again I was a very beginner when I was working on it.

https://gitlab.com/aferust/gtkdappcreator