Re: [Vala] signal cascade blocking in Gtk+




On sab, 2008-01-05 at 15:57 +0100, Mikael Hermansson wrote:

The user_data will always be filled with "self" (the Object instance).
By this I mean Vala will always pass Object instance as last parameter
(user_data) to all C callbacks. (Atleast callbacks in Gtk/Glib)

Yesterday night I finished reading mailing list archives, and I found
the message explaining this. :)

Dont forget to add [InstanceLast] on those functions to get rid Critical
warning in runtime.

This I still don't understand.
I tried compiling both with and without [InstanceLast] in my code:

[InstanceLast]
private bool nascondi(Gtk.Widget w, Gdk.Event evt)
{
 ...
}

but the resulting C source seems identical:

static gboolean two_win_nascondi (GtkWidget* w, GdkEvent* evt, TwoWin*
self) {
        g_return_val_if_fail (IS_TWO_WIN (self), FALSE);
        g_return_val_if_fail (w == NULL || GTK_IS_WIDGET (w), FALSE);


Should it be used in .vapi files only?
I read
http://mail.gnome.org/archives/vala-list/2007-November/001170.html
but it's still quite obscure for me.

I think I should go on and code something real to understand better. :)

A tip is to take a look at the C source created by Vala to see how vala
really handles this internally :-)

Thank you for the suggestion, but I don't read or write C code since...
about 10 years ago... :)
Fortunately it seems quite easy to read.

Bye.





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