2011/12/23 David Nečas <yeti@xxxxxxxxxxxxxxx>: > On Fri, Dec 23, 2011 at 03:44:56PM +0900, Tristan Van Berkom wrote: >> There is a way to access the name of the widget key in the builder file, >> however I've always been a little ticked about that. >> >> Can you name me one use case of how that would be useful ? > > To avoid widget identification using g_object_set_data() etc. since you > already have identified them. And yes, you can avoid identification by > explicitly storing things in various structures and carrying these > structures around but why if it makes the code more complicated? Thanks for helping me prove my point. o In adobe flash environment: You create your composite object class, it's object hierarchy is compiled into the object and you refer to your delagates/children directly with object members o In NextStep objective C environment, you create your .nib file using interface builder, it gets compiled into your composite 'view' object and again, you elegently refer to your composite children via an IBConnect'ed object member o In GTK+, we haven't landed the defining point of doing this properly, so... in your ->constructor method, you build your object classes contents using a temporary GtkBuilder object, assign the only relevant objects to the object members you have defined on your object and again you have an elegantly written object with direct access to your objects, by name If you don't declare a proper object member for direct access to your composite child object members which you intend to access, then what do you do instead ? o Keep a GtkBuilder lying around ? (needless overhead) o Always call gtk_builder_get_object() every time you need to access the member ? (another needless hash table lookup overhead ?) Or worse, you go ahead and structure your project with one mega GtkBuilder file ? Have a callbacks.c file with all the callbacks ? Do we really want to encourage this messy programming technique ? I think that exposing apis such as gtk_buildable_get_name() is only encouraging sloppy programming. Is it "more complex" to write proper composite objects ? I think it's definitely more complex to maintain in the long run if you create one mega builder file and tippie-toe around it with callbacks etc. Cheers, -Tristan _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list