GNOME Bugzilla – Bug 526874
Automatically cast callback in the C code
Last modified: 2008-06-23 13:47:06 UTC
valac already does the type checking. gcc is giving warnings on the generated because the cast is not there. Code below has this for example /* GTK+ Vala Sample Code */ using GLib; using Gtk; public class Sample : Window { construct { destroy += Gtk.main_quit; } const ActionEntry[] action_entries = { {"Action", null, null, null, null, on_action} }; void on_action (Action action) { } void setup () { var ui_manager = new UIManager (); var actions = new ActionGroup ("Actions"); actions.add_actions (action_entries, actions); ui_manager.insert_action_group (actions, 0); } static int main (string[] args) { Gtk.init (ref args); var sample = new Sample (); sample.setup (); sample.show_all (); Gtk.main (); return 0; } }
Confirming.
*** Bug 539483 has been marked as a duplicate of this bug. ***
2008-06-23 Jürg Billeter <j@bitron.ch> * vala/valaattribute.vala: * vala/valafield.vala: * vala/valainterfacewriter.vala: * vala/valanamedargument.vala: * vala/valastringliteral.vala: * gobject/valaccodegenerator.vala: * vapigen/valagidlparser.vala: Support [CCode (type = "Foo")] to insert appropriate casts in generated C Code * vapi/packages/gtk+-2.0/: Fix GtkActionEntry binding, fixes bug 526874 * vapi/gtk+-2.0.vapi: regenerated Fixed in r1638.