Opening a v2.16 file in Glade 3?

I’m trying to hack on an existing bit of Python/GTK+ UI, but I don’t have their original source (other than the uncompiled python and .glade files that they distribute). I’d love to edit their .glade files, but they’re using GTK + v2.16. I’m on macOS, and brew only seems to have Glade 3.40.0.

Why I try to open one of the app’s .glade files, I get a couple of warnings:

Failed to load /<redacted>/ui.glade.
The following required catalogs are unavailable: gtksourceview

and

ui.glade targets GTK +2.16
But this version of Glade is for GTK+ 3 only.
Make sure you can run this project with Glade 3.8 with no deprecated widgets first.

Although I’m an expert developer on other platforms, I don’t know much about GTK+. I’d really appreciate some guidance here. Thanks!

As the message says: you have to use an older version of Glade that still supports GTK2. You cannot use Glade built with GTK3 to open a Glade file written for GTK2: the types are different, and so are the properties set in the XML.

If you only have access to a recent version of Glade, then you can try building Glade 3.8 from source, but before you do that I want to make clear that:

  • GTK2 has been end-of-lifed since 2020
  • Glade 3.8 is also unsupported since then
  • Glade is currently unmaintained

Working on a GTK2 project in 2022 is really not recommended. The recommendation is not even to port the code, as the jump to GTK4 would require a full redesign anyway.

Oh, I fully understand that warning, and if I owned the app or had any significant influence with the authors, I’d make them upgrade. I’m sure they’ll find themselves having to do so soon. It’s a maintained app with regular updates, but the underlying software controls machinery, and updating to the latest often destabilizes the whole thing, so they’re super reluctant.

Okay, I can do that (I hope it builds on macOS). To be sure, Glade 3.8 can open GTK+ v2 files?

Where can I find those sources? Is this it?

Yes. Just use the glade-3-8 branch. Of course, be prepared for difficulties since it’s very old code and likely not compatible with modern toolchains.

Normally my standard advice is to just not use Glade and edit the UI files by hand with a text editor instead, which is the best approach for GTK 3 or GTK 4. But I’ve actually never looked at a GTK 2 UI file before, so I don’t know what they look like. Not sure if that’s practical for GTK 2 or not.