Using glade with multiple ui files

29 Views Asked by At

I've recently split up an overgrown (c. 40k lines) GtkBuilder UI file produced by glade into multiple smaller files, one per toplevel widget, as recommended by the GTK team. These are compiled into a resource and added serially using gtk_builder_add_from_resource(). It definitely makes the UI code more readable but has introduced a new problem.

Many of the files refer to elements that are in other files. For example lots of the files use the same <property name="filter">my_filter_name</property> properties: the filters are all defined in filters.ui which is loaded first.

The problem is, if I edit one of the other files, glade doesn't know about my_filter_name because the definition is in another file, and rather than just leaving it be, it removes the property when I save the file. There are similar problems with references to menus that are defined in another file, and so on.

I can't find an obvious setting to tell glade not to do this. Is there one, or am I stuck with having to edit complex bits of UI in glade and then re-edit in a text editor to put back all the elements it has removed?

I've tried cambalache, which is better in that it does preserve elements it doesn't recognise, but unfortunately it mangles elements in other ways that cause my application to crash: perhaps it's OK if you create a UI using camabalache from start to finish but for me it's unusable, so I'm specifically looking for solutions that allow me to continue to use glade (at least for as long as I continue to use GTK3), or confirmation that there isn't a way of doing it in which case I'll just have to resort to editing the XML by hand.

0

There are 0 best solutions below