Complete GtkHeaderBar with Gears Menubutton available (Nim)

This post is related to Windows system menu doesn't work

I have finally managed to create an example with GtkHeaderBar and a Gears MenuButton, it is the second listing under

Indeed it is only a modification of the example above which used the traditional textual menu. Both examples uses GActions. I am not sure if the shape of the code is fully correct, but it works, so it should be not too wrong,

As this thread is closing soon:

I am still not sure if I am creating too many stuff in the appActivate() callback with is called for each new window, or if I should try to move more code to appStartup() which is called only once.

In menubar.nim I call newSimpleActionStateful() in appActivate() so it is called for each new window. Is that correct?

In gearsmenu.nim I even call gio.newMenu() in the appActivate() callback, so for each new window a new menu structure is created. Maybe that is really needed, I am not sure.