Could Gtk Builder support multiple template in one file(*.ui)

Just want to put multiple templates in on glade file(.ui), the error message shows as follow:

(kangaroo.exe:3120): Gtk-CRITICAL **: 09:27:10.841: Error building template class 'KangarooGuiDiagramEntityInspector' for an instance of type 'KangarooGuiDiagramEntityInspector': .:361:86 Parsed template definition for type 'KangarooGuiDiagramRelationInspector', expected type 'KangarooGuiDiagramEntityInspector'

(kangaroo.exe:3120): Gtk-CRITICAL **: 09:27:10.845: Error building template class 'KangarooGuiDiagramLineInspector' for an instance of type 'KangarooGuiDiagramLineInspector': .:6:84 Parsed template definition for type 'KangarooGuiDiagramEntityInspector', expected type 'KangarooGuiDiagramLineInspector'

(kangaroo.exe:3120): Gtk-CRITICAL **: 09:27:10.849: Error building template class 'KangarooGuiDiagramRelationInspector' for an instance of type 'KangarooGuiDiagramRelationInspector': .:6:84 Parsed template definition for type 'KangarooGuiDiagramEntityInspector', expected type 'KangarooGuiDiagramRelationInspector'

(kangaroo.exe:3120): Gtk-CRITICAL **: 09:27:10.853: Error building template class 'KangarooGuiDiagramTextInspector' for an instance of type 'KangarooGuiDiagramTextInspector': .:6:84 Parsed template definition for type 'KangarooGuiDiagramEntityInspector', expected type 'KangarooGuiDiagramTextInspector'

(kangaroo.exe:3120): Gtk-CRITICAL **: 09:27:10.858: Error building template class 'KangarooGuiDiagramShapeInspector' for an instance of type 'KangarooGuiDiagramShapeInspector': .:6:84 Parsed template definition for type 'KangarooGuiDiagramEntityInspector', expected type 'KangarooGuiDiagramShapeInspector'

(kangaroo.exe:3120): Gtk-CRITICAL **: 09:27:10.862: Error building template class 'KangarooGuiDiagramImageInspector' for an instance of type 'KangarooGuiDiagramImageInspector': .:6:84 Parsed template definition for type 'KangarooGuiDiagramEntityInspector', expected type 'KangarooGuiDiagramImageInspector'

Can you show your UI file and code that loads the widget templates ?

Why?

Templates are generally associated to a specific type; having more than one template in the same file would not be helpful.

the most important reason is more than one page will be added to the container, each one has a class to manipulate the widgets. and they share many components, like GtkAdjustment, filters, etc…

so want to put them into on UI file.

That sounds like a pretty good reason actually.

I tried this before simply because I would have preferred having just one file rather than a whole directory.

As a workaround you can always bind properties.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.