[Geany-devel] Use GtkBuilder

Jiří Techet techet at xxxxx
Sun Sep 25 13:41:49 UTC 2011

Hi Matthew,

On Sun, Sep 25, 2011 at 10:53, Matthew Brush <mbrush at codebrainz.ca> wrote:
> Hi,
> 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'm really happy about this change. First we get rid of the horrible
old glade editor and second it's the most important step towards
making Geany compile under GTK 3. Thanks for your work!

> 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:
> https://github.com/codebrainz/geany/tree/gtkbuilder

I gave it a quick try and in general it appears to work really great
(i.e. I don't see any difference between this and the old version).

The only glitch I have noticed is that under Document->Indent Type,
Document->Indent Width and Document->Set Line Endings all the items
are selected with the radio selection circle. The fix is to disable
"Active" for these items in the glade editor (not attaching patch
because for some reason Glade changes also other elements in the XML
file when I save it). Not sure if they were active before or there is
some bug in the conversion from the old format.



More information about the Devel mailing list