float params of a gobject



Hi, I'm trying to define a gobject class with a floating number
property. In the init class procedure I define the property the
following way:

        param_spec = g_param_spec_float
                ("width" /* name */,
                 _("Icon Width") /* nick */,
                 _("The width of the svg icon") /* blurb */,
                 G_MINFLOAT /* minimum */,
                 G_MAXFLOAT /* maximum */,
                 0.0 /* default_value */,
                 (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE));
        g_object_class_install_property (g_object_class,
                                        PROP_WIDTH,
                                        param_spec);

This compiles fine, but when running the test program it raises a glib
exception:

(test:5073): GLib-GObject-CRITICAL **: g_param_spec_float: assertion
`default_value >= minimum && default_value <= maximum' failed

(test:5073): GLib-GObject-CRITICAL **: g_object_class_install_property:
assertion `G_IS_PARAM_SPEC (pspec)' failed

But default value 0.0 is equal G_MINFLOAT and lesser than G_MAXFLOAT,
isn't it? 

Please I need a bit of help: What am I doing wrong? Or is it a glib bug?
By the way the object is being created with gob, but I believe that the
generated code is ok.

Thanks in advance.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]