Re: [Vala] How to use GLib.Signal.connect?



On Tue, Jan 31, 2012 at 4:53 PM, Pete Fotheringham <
pete fotheringham codethink co uk> wrote:

I am working with Vala and GtkOSXApplication on Mac OS. I am using Vala
0.12 because I need to use dbus-glib and, as I understand it, this is not
supported by versions of Vala beyond 0.12.1

I need to connect to a Mac Specific mac-specific NSApplicationOpenFile
signal, which is generated by GtkOSXApplication.

If I use the line

osxApp.NSApplicationOpenFile.**connect(..)


the name of the signal is changed in the generated c code to
"ns_application_open_file", and when the code is run the following error is
generated

GLib-GObject-WARNING **: gsignal.c:2206: signal
`ns-application-open-file' is invalid for instance `0x1401d020'


So I try to connect using

Signal.connect(osxApp, "NSApplicationOpenFile", this.open_file_callback,
this);

and the Vala compiler generates an error

error: Cannot create delegate without target for instance method or
closure
Signal.connect(osxApp, "NSApplicationOpenFile", this.open_file_callback,
this);
                                               ^^^^^^^^^^^^^^^^^^^^^^^

Can anyone give me an example of how to use Signal.connect() or suggest an
alternative method?


Cast (Callback)this.open_file_callback

-- 
www.debian.org - The Universal Operating System


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