[Vala] glade - Assignment: Invalid callback assignment attempt



Using mailing list posts and bug fixes as hints, I've been freaking about the glade example from http://live.gnome.org/Vala/GladeSample

I'm still having trouble calling GLib.Signal.connect.

If I pass argument 3 as an actual GLib.Callback variable then that line is fine, but the original typecast:
, (GLib.Callback) sym,
failed with:  Invalid type for argument 3

If I merely remove the typecast I get:
error: Argument 3: Cannot convert from `void*' to `GLib.Callback'

So we know what the type should be.

I try my own casting (see below) but get:
Assignment: Invalid callback assignment attempt

       [InstanceLast]
public void connect_signals(string handler_name, GLib.Object object, string signal_name, string signal_data, GLib.Object connect_object, bool after) {
               Module module = Module.open(null, ModuleFlags.BIND_LAZY);
               void* sym;
               GLib.Callback? cb;
if(!module.symbol(handler_name, out sym)) {
                       stdout.printf("Symbol not found!\n");
               } else {
                       cb=(GLib.Callback) sym;
                       GLib.Signal.connect(object, signal_name, cb, this);
               }
       }

I'm interested in what is stopping what would be a boring C typecast from working.

Sam



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