Re: [Vala] Adding a GIOChannel to GMainLoop
- From: "Travis Watkins" <amaranth ubuntu com>
- To: "Xavier Bestel" <xavier bestel free fr>
- Cc: vala paldo org
- Subject: Re: [Vala] Adding a GIOChannel to GMainLoop
- Date: Wed, 24 Oct 2007 10:17:39 -0500
On 10/24/07, Xavier Bestel <xavier bestel free fr> wrote:
but when called, it looks like "src" contains "cond", "cond" contains
"data" and "data" contains garbage.
Looking at the C code, the problem is that my callback is a method from
another object, so a "self" argument is inserted in the proto:
gboolean ml_connect_data_received (MLConnect* self, GIOChannel* src, GIOCondition cond, gpointer data) {
g_return_val_if_fail (IS_ML_CONNECT (self), FALSE);
fprintf (stdout, "data received");
}
Can I pass an object's method as a callback ? Looking at GIOFunc's
proto, the caller's "self" should probably be stored in "data" ...
Try adding [InstanceLast] to the method like this:
[InstanceLast] public bool data_recieved (IOChannel src, IOCondition cond)
Notice the data argument is missing, that'll be filled in with the
self argument.
--
Travis Watkins
http://www.realistanew.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]