Recently, I started moving UI code from bare C to Glade XML files, so the UI definition gets split from the UI logic.
One of the widgets I have been moving is a GtkHeaderBar. The application uses a GtkStack to move between diferent windows, and the code creates, adds and destroys the buttons on the header everytime it moves through those window states. All is done in the same class, derived from GtkHeaderBar. The first challenge here is that, as far as I know, I can only init/load one template per class. This solves only part of the problem, as I can create a template file for the most used/common window state, and create and change the buttons while they change, although I feel that I'm not taking any of the advantages from Glade. Here goes my first question: Is there any possibility of using more than one template on the same class? I have been looking at some GNOME applications code, and none of them do this, so I think that its probably not possible. I've been thinking about other approaches, but I don't know what could be the proper one, or even if I could be doing some weird things. One approach could be to define all the possible widgets/buttons of the header in the template file. They would be created but I should add and remove them continuously which doesn't look very efficient/clean. Another approach would be to create different classes for every possible header, each with their different template file, loading them on every window state and adding and removing the full header to/from the window. The idea is similar to what GtkStack does with windows, but applied to headers. Is there any reasonable answer for this or has anyone encountered a similar problem? Best regards, _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list