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

Re: [Vala] Signal problem



On Thu, April 3, 2008 16:19, Andreas Sliwka wrote:
>   I'd like to create a Gtk widget that is pluggable into a
> GtkScrolledWindow. For that it has to have a handler for the
> gtk_widget_set_scroll_adjustments signal, and there lies my problem.
>
> GtkWidget (according to  gth gtk+-2.0.vapi file, vala 0.1.7 ) does not
> define such a signal, instead it has a simple function of that name.
> GtkLayout does have such a signal, its part of its class definition. So
> I went ahead and copied the signal declaration into my class.

GtkWidget doesn't really have a set_scrollable_adjustments signal, it just
has a class field that you can set to a signal if you want to support
scrolling. In C you do this by assigning the signal created with
g_signal_new to the class field in class_init. You could try to do
something like that in Vala using `static construct {...}' and manual call
to g_signal_new, if you declare the class field in the Gtk VAPI. You need
Vala SVN to have experimental support for class fields.

> Something is very wrong here, since one of the adjustments had been
> silently dropped ... Could somebody please explain to me how to handle
> this? I'm a bit lost, and every hint would be appreciated ...

Signal handlers always have the sender/emitter object as first parameter,
you're missing that in your handler. valac should of course complain about
that but signal handler checks are still missing.

Juerg



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