GNOME Bugzilla – Bug 425324
add GObjectClass->constructed()
Last modified: 2007-04-03 10:50:48 UTC
many GObject implementations with construction properties need to execute some code after all CONSTRUCT and CONSTRUCT_ONLY properties have been set but before the object is regularly utilized by the g_object_new caller. the currently possible ways to implement such behavior are: - count the CONSTRUCT properties that have been set already in set_property() and execute extra code if the last CONSTRUCT propety is set. - override the special GObjectClass->constructor function pointer for every class that needs extra post-CONSTRUCT code and chain back to the original constructor of the class. both ways are very cumbersome to implement and can hardly be recommended as good coding practice for object implementations. a much nicer way to hook up the required functionality would be the addition of a constructed() vmethod to GObjectClass which is called after the call to GObjectClass.constructor() is completed, but before g_object_new() returns.
Created attachment 85729 [details] [review] implement constructed vcall i hope this bug is as simple as it seems.....
thanks, the patch needed some slight modifications as mentioned in the ChangeLog, and i had to split up your ChangeLog entry because we have different logs for the docs, glib and gobject. Tue Apr 3 12:34:14 2007 Tim Janik <timj@gtk.org> * gobject.[hc]: invoke GObjectClass.constructed() only for newly constructed objects, and invoke it while the notify queue is still being frozen, after all CONSTRUCT* properties have been set and before random other properties are being set. * applied modified patch from Ryan Lortie to implement GObjectClass.constructed() to fix #425324.