Use a gtk function as a callback for a signal
- From: David Bellot <david bellot gmail com>
- To: python-hackers-list gnome org
- Subject: Use a gtk function as a callback for a signal
- Date: Sun, 8 Jan 2017 18:50:59 +0000
Hi,
I would like to know how to use a gtk function like gtk_main_quit as a callback to, say, a "delete-event" for a GtkWindow.
WAIT, WAIT, WAIT, this question is half a joke of course....
Let's say I have a GIFunctionInfo populated with the information from "g_signal_connect". Invoking (calling) a GIFunctionInfo is done with g_function_info_invoke. And the parameters are passed using an array of GIArgument.
Now my problem is the following: if I implement a language bindings, I'm not supposed to know about "gtk_main_quit", and even less its address. In standard GTK programming, I would do something like:
g_signal_connect(my_window, "delete-event", G_CALLBACK(gtk_main_quit), NULL);
But if I use GIR, I don't know about gtk_main_quit at compile-time, but only at runtime and only through the GIR data.
I can find about it with:
fct_info = (GIFunctionInfo *) g_irepository_find_by_name(NULL, "Gtk", "gtk_main_quit");
How to transform this GIFunctionInfo into a G_CALLBACK and pass it to g_signal_connect ?
Or should I always encapsulate this into a function of mine (in which I will indeed to a g_function_info_invoke to gtk_main_quit) ?
Thanks for your help...
Best,
David
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]