The vapi binding for Gtk.ClipboardGetFunc looks like this:
[CCode (cheader_filename = "gtk/gtk.h", has_target = false)]
public delegate void ClipboardGetFunc (Gtk.Clipboard clipboard,
Gtk.SelectionData selection_data, uint info, void* user_data_or_owner);
The function has a user_data parameter, but the CCode attribute sets
has_target to false. Presumably, this is because the user_data parameter
doesn't have to be user data, it can also be an owner (see
Gtk.Clipboard.set_with_data and Gtk.Clipboard.set_with_owner).
How then can I pass user data to a Gtk.ClipboardGetFunc? I can't use a
closure, because has_target is false. I also can't create a class to hold
the user data:
public class ClipboardHelper : Object {
public void get_func(Gtk.Clipboard clipboard, Gtk.SelectionData
selection_data, uint info, void* user_data_or_owner) {
}
}
If I try this, I get the following error:
error: Argument 2: Cannot convert from `ClipboardHelper.get_func' to
`Gtk.ClipboardGetFunc'
Presumably, this is because of the implicit first parameter to
ClipboardHelper.get_func.
Am I missing something here?
- Matthew
_______________________________________________
vala-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/vala-list