Default values for properties
- From: Martin Baulig <martin home-of-linux org>
- To: gtk-devel-list gnome org
- Cc: timj gtk org
- Subject: Default values for properties
- Date: 04 Mar 2001 11:40:04 +0100
Hi guys,
I have some little problem with the default values of the properties.
In GnomeSelector, I have some G_PARAM_CONSTRUCT_ONLY properties:
/* Construction properties */
PROP_ENTRY_WIDGET,
PROP_SELECTOR_WIDGET,
PROP_BROWSE_DIALOG,
PROP_WANT_DEFAULT_BEHAVIOUR,
PROP_USE_DEFAULT_ENTRY_WIDGET,
PROP_USE_DEFAULT_SELECTOR_WIDGET,
PROP_USE_DEFAULT_BROWSE_DIALOG,
PROP_WANT_BROWSE_BUTTON,
PROP_WANT_CLEAR_BUTTON,
PROP_WANT_DEFAULT_BUTTON,
PROP_AUTO_SAVE_HISTORY,
PROP_AUTO_SAVE_ALL,
In the subclasses, for instance GnomeEntry or GnomeIconSelector, I want
to provide some default values for these properties to specify the default
"look&feel" of the widget.
For instance, I want to be able to use
entry = g_object_new (gnome_entry_get_type(),
"auto_save_history", TRUE,
NULL);
to create a GnomeEntry which automatically saves history.
I also want to be able to override some of these properties, for instance
iconsel = g_object_new (gnome_icon_selector_new(),
"want_default_button", FALSE,
NULL);
to get a widget which looks&feels like a GnomeIconSelector, but doesn't
have a "Default" button.
Now, my problem is that I can specify a default value for these properties
in the class where they're defined (GnomeSelector), but I cannot alter the
default value in a derived class (which is a good thing, IMO).
While doing some debugging, I realized that on object creation the
`set_property()' method is called for all properties and not only for the
ones that were given to g_object_new().
This means that my `set_property()' handler can't figure out whether the
user explicitly set a property or whether it's just the default value of it.
What do you think about adding a G_PARAM_NODEFAULT flag to request that a
property won't get its default value if it isn't explicitly set ?
--
Martin Baulig
martin gnome org (private)
baulig suse de (work)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]