[Geany-devel] Use GtkBuilder

Matthew Brush mbrush at xxxxx
Sun Sep 25 08:53:38 UTC 2011


I just wanted to let everyone who I haven't bothered on IRC know that 
I'm working on converting the old Geany Glade 2 generated user-interface 
code to Glade 3 using GtkBuilder.

I'd like to get this committed to Geany shortly after the 0.21 release 
if possible.  It requires a minimum GTK+ version of 2.16 due to the use 
of GtkBuilder, which may or may not be a problem.

I figure if there's any chance of Geany upgrading to a minimum of GTK+ 
2.16 then it would be beneficial to do so early after the next release. 
  If there's no chance of updating to GTK+ 2.16 after the next release, 
then ignore the rest of this email.

The changes add two API functions to Geany; ui_lookup_object() and 
ui_hookup_object() which behave similarly to their widget counterparts. 
  The old ui_lookup_widget() and ui_hookup_widget() are deprecated in 
favour of the new functions, but they still work as before.  The first 
parameter to these functions, the parent widget, is no longer used.  The 
new functions are added to the plugin API.

I've also taken the liberty of porting the Terminal/VTE preferences UI 
to the new Glade 3 format rather than being hard-coded.  IIUC if the 
VTE/terminal is not enabled for whatever reason, the "Terminal" tab in 
the preferences dialog just won't be shown.

The new code adds a GHashTable which is used to "register" GObjects, 
either from the GtkBuilder file (data/geany.glade) or added elsewhere 
with the ui_hookup_object() function.  Each GObject registered is 
referenced when hooked-up and de-referenced when the new 
ui_finalize_builder() function is called.

I honestly have no idea what the implications of this change are in 
regards to i8n translations, but IIUC there is a facility for this in 
the GtkBuilder file.

One bug I've experienced, which may be unrelated to my changes, is that 
the main VBox splitter (between the sidebar/documents and the message 
window) position is not remembered.  The position is stored in the 
keyfile but it's not reloaded the next time Geany is run.  I've had a 
brief glance at the relevant code and I couldn't spot any obvious problems.

If anyone feels like giving me a code review, feedback or testing the 
changes, I have a branch on my geany repository on GitHub.  My working 
copy, which is rebased on Geany's Git repository every now and then can 
be found at:


Matthew Brush

More information about the Devel mailing list