Re: Can't add new GTK 2.16 methods to GtkStyle
- From: Torsten Schoenfeld <kaffeetisch gmx de>
- To: gtk-perl-list gnome org
- Subject: Re: Can't add new GTK 2.16 methods to GtkStyle
- Date: Sat, 17 Jan 2009 20:44:00 +0100
Emmanuel Rodriguez wrote:
I'm trying to complete the patch set for GTK 2.16 but I can't get the
file GtkStyle.xs to compile.
I get the following errors when I try to build the module:
[ XS xs/GtkStyle.xs ]
Error: 'GType' not in typemap in GtkStyle.xs, line 582
Error: 'void' not in typemap in GtkStyle.xs, line 593
make: *** [xs/GtkStyle.c] Error 1
Looks like if I can't use GType as an argument type of an XS parameter.
Yes, we try to avoid exposing GType. Instead, we let the programmer pass in
package names and convert those to a GType with gperl_type_from_package().
void
gtk_style_get_property (style, widget_type, property_name, ...)
GtkStyle *style
GType widget_type
const gchar *property_name
PREINIT:
GValue value = {0,};
CODE:
gtk_style_get_property (style, widget_type, property_name, &value);
RETVAL = sv_2mortal (gperl_sv_from_value (&value));
g_value_unset (&value);
OUTPUT:
RETVAL
First of all, you'll want to use SV* instead of void as the return type. (I'm
not sure whether the typemap for SV* automatically calls sv_2mortal, in which
case it's not necessary in the CODE section.) Then the GValue will need to be
initialized for which you need to know the type of the property. I think this
will have to look something like this (modulo error checking):
GParamSpec *pspec = gtk_widget_class_find_style_property (
g_type_class_peek (widget_type), property_name);
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]