gtk+ Gtkbuilder && OOP principles
I got a pretty awkward feeling after messing with GtkBuilder + *.ui-files for a few weeks now.
Either I doom the OOP principles to get a real advantage from the usage of GtkBuilder and *.ui files OR if I do not want to drop the OOP design, I get so much overhead by GtkBuilder it makes it not worth using it at all.
Just an example: IDE - The mainwindow, either make it one big UI file or make it many parts (separate files for e.g. Toolbar开发者_运维问答, Statusbar, SourceView, etc..) but with a awefull lot of more code to do around the builder.
Can anybody explain me how to get that below one hat? I was not able to find sufficient tutorials on best practice for GtkBuilder/*.ui-files.
After soe months playing with gtk+, I think I got the answer myself: Subclass functional chunks and provide for these functional classes/chunks a seperate .ui file. These part .ui files are best assembled by hand, for more fine grained control to create a seamless application.
Gnerally make the .ui files cover as few as necessary to keep the chunks a) reusable and b) functional for one purpose. Hope this helps someone else too.
精彩评论