Re: [Vala] signal cascade blocking in Gtk+



On Sat, 2008-01-05 at 12:39 +0100, Alessandro Pellizzari wrote:

[snip]
Thank you very much! :)
You are welcome

But the compiler gives no warning, and the error at runtime is quite
cryptic. :/
Vala is a young compiler :)

BTW, I cannot find the docs regarding Gtk in Vala, apart from the
examples in homepage.
For what I know there is no documentation about vala & Gtk+, 
but it's quite easy to follow the C one and apply it to vala.

C callbacks have 3 arguments: widget, event, data. But I don't know if
the data parameter can be used in vala and how it must be declared (it's
a gpointer)
When I'm in doubt on a API, usually I open the vapi file to check the function
signature. 
This is what you will find in the gtk+-2.0.vapi file for delete_event
(installed in /usr/share/vala/vapi/ in my system):

        public signal bool delete_event (Gdk.Event event)

The first argument "widget" (the sender) is implicit for every signal so
you don't find in the vapi file.

The second is event of type Gdk.Event

The data argument doesn't exist so you can't use it. This is quite
common in Vala since the compiler use this third data argument
internally to pass the instance pointer of the class that contains the
event handler.

So this is the function signature of the event handler: 

bool delete_event_handler (Gtk.Widget widget, Gdk.Event event)

To get how all of this works, you can try to explore the generated C
source files if you know the C programming language (use --save-temps
switch of the valac compiler).

Should I look Mono Gtk# docs?
I have never coded in C#, only in Python+PyGtk.
I don't know, I don't use mono

Bye.
Have a nice day. Ciao,
Andrea




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