2010/7/31 Evan Nemerson <[email protected]> > On Sat, 2010-07-31 at 17:59 +0200, Sébastien Wilmet wrote: > > Hello! > > > > What I want to do is to implement a GtkAction derived class which sets > > GtkActionClass:toolbar_item_type to GTK_TYPE_MENU_TOOL_BUTTON in its > > class_init function. > > Vala doesn't currently expose *Class structs in the bindings, so AFAIK > what you're talking about can't be done easily. I'm not exactly an > expert on GObject, but I think you should be able to hack something > together by going creating bindings for GtkActionClass then getting > access to it with GLib.Object.get_class. This is untested, but you > should get the idea: > > > /* In a vapi */ > [Compact, CCode (cname = "GtkActionClass")] > public class GtkActionClass { > public GLib.Type menu_item_type; > public GLib.Type toolbar_item_type; > } > > /* Your code */ > unowned GtkActionClass ac = (GtkActionClass) this.get_class (); > ac.toolbar_item_type = typeof (MenuToolButton); > > I have this error: error: Access to instance member `GLib.Object.get_class' denied
Also, in C the cast can be made because the first field in a Class struct is the parent class. Sébastien
_______________________________________________ vala-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/vala-list
