Re: GParamSpec further funcs

Torsten Schoenfeld <kaffeetisch gmx de> writes:

So what you're suggesting is that we implement a generic
Glib::ParamSpec->get_default_value by using g_param_value_set_default.


It won't work like this though, I think.  The XSUB would need to be
called simply g_param_spec_get_default_value and would need to reside in
a MODULE section with "PREFIX = g_param_spec_".

Ah yes.  I was playing with the other couple that are only g_param_foo
instead of g_param_spec_foo.

Then you'd have to
remove all the get_default_value XSUBs from the various subclasses.

Though I see the gunichar one stays, to continue to return a string.

If the test suite still passes after these changes, we have a winner.

Plus a couple more tests for object, boxed, etc which now get the
generic method.  The "param" one tickles the NULL problem too, per other

Also, your patch mixes spaces and tabs for indention.

Ah, that'll be a combination of cut and paste and me having
`indent-tabs' off normally.  I've yet to find an emacs setup that works
decently for xs.  I tend to use cc-mode with some settings, and then get
annoyed when it indents wrong, and then switch to text-mode or pod-mode
for the doc bits :-(

        * GParamSpec.xs (get_default_value): Use g_param_value_set_default
        instead of explicit code, except keep Glib::Param::Unichar.
        * t/e.t: Exercise get_default_value on Object, Boxed, Param, Scalar,
        IV and UV, as they now get that func.

        Note Glib::Param::Boolean::get_default_value previously returned the
        empty string '' for false, but now ends up 0 from the generic
        gperl_sv_from_value.  This may be a good thing since 0 is what
        $obj->get() itself returns for a false bool property.

Attachment: GParamSpec.xs.default_value.diff
Description: Text Data

Attachment: e.t.get_default.diff
Description: Text Data

The sigfile one-line movie reviews series:
"Razorback" -- easily the best homicidal wild pig movie ever made.

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