[Vala] connecting/disconnecting a signal to a static member function?



 Dear List,

Now that += and -= are deprecated syntax for signal handlers, I am trying to update some signal code into the connect/disconnect syntax on Vala 0.11.0.

Here is the problem I couldn't get myself out from:

1. the signal connecting / disconnecting is performed in a static member function. 2. the signal handlers are also static member function with no 'instance' pointers.

If I blindly replace the '-=' syntax with disconnect I get an error message like this: gtk-widget.vala:110.29-110.45: error: Argument 1: Cannot convert from `Widget.recursive_changed' to `GLib.Object.notify'
            widget.notify.disconnect(recursive_changed);

The signature of widget.recursive_changed is:
private static void recursive_changed(Gtk.Widget widget, ParamSpec pspec); I remember there is a way of declaring the handler with has_instance = 0 in the CCode annotations, but it wont work in this case as I am calling disconnect from a static member function and can't access an instance member. How shall I achieve this? The warning messages about -= and += are getting very annoying(too many of them).

Regards,

Yu



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