Re: Can't add new GTK 2.16 methods to GtkStyle




On Jan 17, 2009, at 2:09 PM, 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.

Indeed, no. GType is completely hidden from perl. We use package names, instead.


Here's the code:

#if GTK_CHECK_VERSION (2, 15, 0)

void
gtk_style_get_property (style, widget_type, property_name, ...)

Remove the ... and replace return type of "void" with "SV *". A "CODE" xsub must return a value, and we don't use pass-by-reference for these.


   GtkStyle    *style
   GType       widget_type

Change that one to

       const char * widget_package

That's char, not gchar.

   const gchar *property_name
   PREINIT:
            GValue value = {0,};

Add

        GType widget_type;


   CODE:

Add

        widget_type = gperl_type_from_package (widget_package);
        if (widget_type == 0)
croak ("package %s is not registered with GPerl", widget_package);
        if (! g_type_is_a (widget_type, GTK_TYPE_WIDGET))
croak ("%s is not a subclass of Gtk2::Widget", widget_package);


gtk_style_get_property (style, widget_type, property_name, &value);
       RETVAL = sv_2mortal (gperl_sv_from_value (&value));
       g_value_unset (&value);

   OUTPUT:
       RETVAL

#endif

I'm stock please help.





--
Santa ate all the cookies!
  -- Zella's first, indignant words on Christmas morning, '07.




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