After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 758086 - gtkstack: allow subclasses overriding properties on init
gtkstack: allow subclasses overriding properties on init
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2015-11-13 23:19 UTC by Carlos Soriano
Modified: 2015-11-19 19:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gtkstack: allow subclasses overriding properties on init (3.08 KB, patch)
2015-11-13 23:19 UTC, Carlos Soriano
none Details | Review
gtkstack: allow templates to override all properties (3.65 KB, patch)
2015-11-16 14:20 UTC, Carlos Soriano
committed Details | Review

Description Carlos Soriano 2015-11-13 23:19:05 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.
Comment 1 Carlos Soriano 2015-11-13 23:19:12 UTC
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.
Comment 2 Matthias Clasen 2015-11-14 02:22:46 UTC
Please describe the problem you were having in some more detail.
Comment 3 Carlos Soriano 2015-11-16 14:20:35 UTC
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.
Comment 4 Carlos Soriano 2015-11-16 14:22:29 UTC
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.
Comment 5 Matthias Clasen 2015-11-17 13:57:00 UTC
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.
Comment 6 Matthias Clasen 2015-11-19 19:50:49 UTC
Attachment 315675 [details] pushed as 9f38390 - gtkstack: allow templates to override all properties