GNOME Bugzilla – Bug 758086
gtkstack: allow subclasses overriding properties on init
Last modified: 2015-11-19 19:50:53 UTC
See patch, not sure if this is the right way or why it was needed to make G_PARAM_CONSTRUCT instead of in init, but I needed for subclassing it more conveniently.
Created attachment 315438 [details] [review] gtkstack: allow subclasses overriding properties on init So if some subclass GtkStack and use a GtkBuilder definition to set some properties, they are used instead of the default ones.
Please describe the problem you were having in some more detail.
Created attachment 315675 [details] [review] gtkstack: allow templates to override all properties Currently GtkStack has some G_PARAM_CONSTRUCT properties. That means, the properties are set with its default value after the initializacion of the object. When using GtkBuilder to build objects, GtkBuilder creates them and after that sets the properties found on the xml definition. However, this is not true for templates because the template is initialized in the init() function of the actual object, and after that, the construct properties will be set. This is a problem when someone wants to use templates with GtkStack and set those properties, since they will be set on the tempalt initialization and set again to its default values afterwards. To fix this, make those properties not G_PARAM_CONSTRUCT.
Now should be clearer, however I had a discussion with Rishi about it, and this is breaking ABI, so probably we can just close it... Also, we were wondering how is decided whether or why a property should be G_PARAM_CONSTRUCT or not.
I'm not following you beyond 'templates can't set CONSTRUCT properties'. I don't think that is the case - the one limitation templates have is with CONSTRUCT_ONLY properties - those can only be set during object construction, and that happens before GtkBuilder gets to parse the <property> elements. CONSTRUCT on properties means: always pass this property when creating the object (either the explicitly specified value, or the default value). Nothing prevents you (or GtkBuilder) from setting the property again at a later time.
Attachment 315675 [details] pushed as 9f38390 - gtkstack: allow templates to override all properties