GNOME Bugzilla – Bug 51748
Need way of easily overriding default values for properties
Last modified: 2011-02-18 16:14:11 UTC
(http://mail.gnome.org/archives/gtk-devel-list/2001-March/msg00146.html) Not infrequently a derived class wants to change the default value for a property it inherits from the parent class. There is no way to do this currently. One way of doing it is: - Add a way of copying paramspecs, and a convenience function in GObject to copy the parameter spec of a property you are overriding. - Addd a way of setting default values - Allow properties to be installed with a parameter ID of 0, meaning "ignore this property when looking for the getter/setter".
Not going to happen for 2.0
This is possible already, all that is required is installing a new equally-named GParamSpec in the derived class. basically properties can be overidden just like virtual function in derived classes that way. this is btw, a fundamental requirement for G_PARAM_CONSTRUCT properties as they often need to be overidden in derived classes.
Well, you _can_ do it, but it's more than a little painful, since you have to: - Copy the documentation comment - Copy the range, etc. - "Chain up the setter" in some fashion. I think we need a nicer way of doing this in the future.
See bug 105894 for the related issue of properties on interfaces.
Re "Chain up the setter" in some fashion. That's already supported by doing in gtk_button_box_set_property(): g_object_set (self, "GtkButton::spacing", bboxspacing, NULL); while the Object:: prefixing style for setting properties is discouraged for outside use, it's preserved to allow object implementations to chain to a parent setter/getter.
closing, since no further input was provided on this issue.