[Geany-devel] Glade Code Generation and GtkBuilder

Matthew Brush mbrush at xxxxx
Mon Aug 29 07:53:39 UTC 2011


Hi,

I was messing around with Geany code to see what it would take to 
compile it against GTK+ 3 (just for fun).  There doesn't seem to be too 
many changes needed, with one *massive* exception: the old code 
generated by old glade versions.

At some point in the (possibly distant) future, Geany will (I think) 
either need to switch to using GtkBuilder or just hack-by-hand the 
`interface.c` file (eww), since the old Glade version generates what 
will be deprecated code, and newer Glade versions don't generate code.

Has anyone thought about what would be needed to switch from using the 
current generated C UI code to using GtkBuilder?  You can actually open 
the old Glade file in Glade3 and resave it as GtkBuilder XML (with minor 
issues), but it seems like there would need to be a whole lot of work to 
actually use it.

At a glance, it seems like most widgets are accessed through 
`ui_lookup_widget()`, so it seems like it would make sense to have that 
function somehow call `gtk_builder_get_object()` to find the widget.  If 
all the Glade widgets are lookup up through this single function, that 
will probably work to our advantage.  I'm not sure how else widgets are 
accessed, or how many are added outside of the `interface.c` file (vte?) 
or if that matters.

It seems like the callbacks should get connected when 
`gtk_builder_connect_signals()` is called since they seem to stick 
around fine in the GtkBuilder XML file.  I guess this part might not be 
too much problem.

I was hoping to start gathering some ideas on the best way to make this 
transition, even though it may be far off in the future.  It seems to me 
like it will require quite extensive changes, potentially producing tons 
of non-obvious bugs popping up in obscure corners of the code.

Maybe I'm over-estimating the scope of the change.  Is there some 
silver-bullet approach that will make this trivial?

Cheers,
Matthew Brush



More information about the Devel mailing list