Heyho, I am once again working on contributing to a nim library that wraps gtk and provides the widgets etc. in a more declarative fashion.
I am currently seeing some unexpected behaviour in our bindings for ExpanderRow and am trying to figure out whether the problem lies somewhere in our code or not.
Explicitly:
We noticed that if you call the add_row proc of ExpanderRow and the Widget you add is not something inheriting from PreferencesRow (e.g. Box ), then we get bugs when we try to remove said widgets later with adw_expander_row_remove.
Specifically, this Warning pops up: (process:1254433): Gtk-WARNING **: 09:19:59.162: Tried to remove non-child 0x5614565049e0
This shows up even though I can (via copious amounts of debugging and printings pointers to the terminal) see that this exact pointer gets added to ExpanderRow at one point via the add_row proc.
I’m not seeing anything obvious in our code as to why that is, so I’ve started wondering the following:
Is it maybe assumed that you shouldn’t add GtkWidgets such as Box with add_row and therefore it is not intended to function when using a Widget such as Box there?
Alrighty in that case I’ll do some more investigating on our end as well and see if I can make more minimalistic examples to make sure it’s exactly that.
I’d chalk it up as far more likely that we made an error somewhere.
I was able to make one that cuts through most of our binding’s custom stuff.
The following is nim syntax (that’s the language the bindings are for), but for the most part should look readable… I hope.
This code-snippet gets executed when initially starting the application and instantiating all the various widgets and associating them with one another.
For elaboration:
Echo is nim’s equivalent to python’s print
“0.cint” is just an int literal in nim’s int type being converted to C’s int type (called cint)
State.internalWidget is just a field where we store the pointer to the GTKWidget in, just read it like a variable