On Tue, 2007-12-04 at 15:16 +0100, Jeffrey Ratcliffe wrote: > On 23/11/2007, Emmanuele Bassi <[EMAIL PROTECTED]> wrote: > > you can ask here if it's something relevant with the glib-perl API or > > the build environment. > > I seem to be making good progress, but am stuck trying to bind the > following enum: > > typedef enum > { > GTK_IMAGE_TRANSP_COLOR = 0, > GTK_IMAGE_TRANSP_BACKGROUND, > GTK_IMAGE_TRANSP_GRID > } GtkImageTransp;
the library should provide the GType for this enumeration, not the bindings; you should ask the author to do that, because bindings will have to keep a private function and nobody will be able to use that enumeration in properties or signal marshallers even in C. > #define GTKIMAGEVIEWPERL_TYPE_IMAGE_TRANSP > gtkimageviewperl_gtk_image_transp_get_type() > GType gtkimageviewperl_gtk_image_transp_get_type (void); > > which seems to be included properly. I also defined: > > #define SvGtkImageTransp(sv) (gperl_convert_enum > (GTKIMAGEVIEWPERL_TYPE_IMAGE_TRANSP, (sv)) > #define newSVGtkImageTransp(e) (gperl_convert_back_enum > (GTKIMAGEVIEWPERL_TYPE_IMAGE_TRANSP, (e)) you have to actually write the GType function: GType gtkimageviewperl_gtk_image_transp_get_type (void) { static GType e_type = 0; if (G_UNLIKELY (e_type == 0)) { const GEnumValue values[] = { { GTK_IMAGE_TRANSP_COLOR, "GTK_IMAGE_TRANSP_COLOR", "color" }, { GTK_IMAGE_TRANSP_BACKGROUND, "GTK_IMAGE_TRANSP_BACKGROUND", "background" }, { GTK_IMAGE_TRANSP_GRID, "GTK_IMAGE_TRANSP_GRID", "grid" }, { 0, NULL, NULL }, }; e_type = g_enum_register_static (g_intern_static_string ("GtkImageTransp"), values); } return e_type; } and then use the usual bindings stuff. you can also look at Gnome2::GConf for some custom defined types. ciao, Emmanuele. -- Emmanuele Bassi, W: http://www.emmanuelebassi.net B: http://log.emmanuelebassi.net _______________________________________________ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list