I assumed that it is a GTK4 example as widget.show() is used, not widget.showAll(). Changing show() to showAll() makes it compile with GTK3.
First observation. When I click the x at top right window corner, then window will not close. Not surprising, as there is no signal connect to destroy. It that not necessary for GTK4? Next observation: While it works fine for GTK3 with showAll(), for unchanged source text compiled for GTK4 all menu items are grey and can not be activated. Button works ok. I have installed GTK4 on /opt/gtk recently, all paths seems to be OK, there are no error messages when compiling or running. So I an a bit confused. Is this example intended for GTK3 or GTK4? Do I miss something, or do menu items not work in GTK4 at all?
Well not a real problem, I just shipped the Nim version, and at least for GTK3 that modified version seems to work. But as I provide bindings for GTK4 as well, I was going to ship a GTK4 version as well, but that would have grey disabled menus too, so I did ship only the GTK3 version for now:
You can try to find GTK 3 equivalent files in gtk-3.24 branch, or tag
for specific release like 3.24.12. GitLab allows changing the git
revision using the select box on the top of the page.
When I try to do that, I see:
“tests/testgaction.c” did not exist on “3.24.13”
Looking at the commit history of the file, I can see it was added in
I can click the three dots buble next to master bubble to reveal
branches and tags this commit is included in. It looks like the first
tag it appeared in was 3.89.1.
We can try to look into the directoty to see if there is not something
similar:
We notice
but that appears to use the deprecated GtkUIManager API.
I looked into gtk-3.24 branch before, but there lives legacy stuff, no testgaction.c.
testgaction.c from gitlab master is identical to testgaction.c from github mainline – so when that is for GTK4 I still wonder why the menuitems are grey and disabled when I compile it for GTK4.
As I already said no real problem, as it works fine with GTK3. But it may be a good idea to show people at least one working example for GTK4, otherwise people may tell me: Well you provide bindings for GTK4 already, but what is the benefit? I do provide an empty app demo for GTK4 in gintro/examples/gtk4/app0.nim at master · StefanSalewski/gintro · GitHub but that is really weak, so I will try to find some other C code working with GTK4. Or maybe I can fix testgaction, maybe there is a hidden trick to enable items in GTK4.
As I already said no real problem, as it works fine with Gtk3. But it may be a good idea to show people at least one working example for GTK4
Sorry, I misread the OP and thought it was the other way round. I have not played with GTK 4 yet so I will not be able to help you there. Maybe try asking on IRC about the changes in GAction binding.
and works, so I think my /opt/gtk install is OK. Will see if I can create a Nim version on weekend. Interesting is the new destroy call for mainwindow. there is no signalconnect() any more:
Because the window has a custom GtkHeaderBar widget in place of the usual system decorations. When the “Close” button in the header bar is clicked, it will quit the main loop; control will be returned to the main() function at that point, which will proceed to destroy the window.