Look at this normal flow of things, in a normal day of work, in a normal programmer's life:
The problem comes when you want to roll them into a blob using GResource and link it to your binary. Glade does not understand GResources. Glade generates Gtk::Builder understandable xml files. This xml refers to your image files directly. But, GResource wants you to refer to every resource by its own 'resource:///' URI. Gtk::Builder can load an xml from a GResource URI. But the xml itself refers to other resources on the filesystem which sort of
defeats the purpose.
After that brick on my face, I started thinking about workarounds:
- Design a great UI in a UI designer
- Roll all the UI resources into a binary blob and link it to your code so that you dont have runtime dependencies (read as: you dont know where you'll be installed for example)
- Ask the UI framework to instantiate the view, wire it up to a controller and get going with your awesome business logic.
The problem comes when you want to roll them into a blob using GResource and link it to your binary. Glade does not understand GResources. Glade generates Gtk::Builder understandable xml files. This xml refers to your image files directly. But, GResource wants you to refer to every resource by its own 'resource:///' URI. Gtk::Builder can load an xml from a GResource URI. But the xml itself refers to other resources on the filesystem which sort of
defeats the purpose.
After that brick on my face, I started thinking about workarounds:
- Manually fetch the external images from the GResource bundle and link them to the UI built by the Gtk::Builder. This means I cannot see my awesome icons in Glade when I am designing the UI.
- Manually edit the xml and change the external resource references to GResource URI. I dont know whether this even works. Even if it works, I do know that the 'cannot see in Glade' problem exists.
- Moving to another 'oh so awesome' UI toolkit is not a solution for me. Coz, in the end of the day, I love Gtk+.
- Design all your UI in code is not the way forward either. I know I can do it. I HAVE done it a dozen times before. And I know that its a productivity killer. You disagree? Imagine iterating through your UI design 20 times a day, and a build taking 15+ minutes each. That is the biggest deterrent to refactoring your UI.
- Glade should generate the GResource xml definition also. Currently Glade is centered over a 'Gtk::Builder xml file'. Instead Glade should center on the 'GResource definition'. Glade should allow you to add multiple Gtk::Builder xml files into a 'GResource definition'.
- Gtk::Builder should understand GResource URI in the xml (if it does not already)