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 51748 - Need way of easily overriding default values for properties
Need way of easily overriding default values for properties
Status: RESOLVED WONTFIX
Product: glib
Classification: Platform
Component: gobject
1.3.x
Other All
: Normal enhancement
: ---
Assigned To: Tim Janik
gtkdev
Depends on:
Blocks:
 
 
Reported: 2001-03-06 01:26 UTC by Owen Taylor
Modified: 2011-02-18 16:14 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Owen Taylor 2001-03-06 01:26:36 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".
Comment 1 Owen Taylor 2001-06-07 22:37:48 UTC
Not going to happen for 2.0
Comment 2 Tim Janik 2001-08-12 19:28:44 UTC
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.
Comment 3 Owen Taylor 2001-08-12 19:49:41 UTC
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.


Comment 4 Matthias Clasen 2003-02-20 09:38:26 UTC
See bug 105894 for the related issue of properties on interfaces.
Comment 5 Tim Janik 2003-07-24 00:24:45 UTC
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.
Comment 6 Tim Janik 2006-08-22 11:19:40 UTC
closing, since no further input was provided on this issue.