array in g_signal_new



Hi
I'm not an experienced c/glib developer, but learning a lot of things
about it recently. I'm mantaining an application which uses a C
library (based on libvte) where I also need to make some
modifications.


The problem is the library needs to emit a signal where the argument
is an list of integers. I could use an int[] or a GArray in this
case... Want to ask you how to specify the gtype of the param. Or
please point me to any open source app that uses this kind of thing.


How to declare it?

klass->fields_destroyed_signal =
	g_signal_new(I_("fields-destroyed"),
		     G_OBJECT_CLASS_TYPE(klass),
		     G_SIGNAL_RUN_LAST,
		     G_STRUCT_OFFSET(VteTerminalClass, fields_destroyed),
		     NULL,
		     NULL,
		     g_cclosure_marshal_VOID__VOID,
		     G_TYPE_NONE, 1,
		     G_TYPE_UINT // what to put here???
		     );

And to emit it?

GArray * arr = g_array_new(TRUE,FALSE,sizeof(int)); // zero terminated!??

int x=3456;
g_array_append_val(arr, x);

g_signal_emit_by_name(terminal, "fields-destroyed",arr);



Don't know if this is important, but the program that will receive the
signals is python.

thanks!
daniel


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