Re: g_signal_new
- From: Dov Grobgeld <dov grobgeld gmail com>
- To: Emmanuel Gontcho <gontcho gmail com>, Gnome List <gtk-list gnome org>
- Subject: Re: g_signal_new
- Date: Thu, 2 Dec 2010 08:55:00 +0200
Hi Emmanual,
(Please ask questions like this to the gtk-list and not only directly to me. I'm taking the freedom to CC the list for my reply. Hope it's ok with you.)
Here are five different ways that you use to pass more than one value in a signal callback.
- Use g_object_set_data() to attach additional data to the widgets. This is a hash table and you can put whatever you want in it. In the handle use g_object_get_data() to retrieve the values.
- Create a structure that contains the two values that you want to pass a long, dynamically allocate it and pass a pointer to the memory as the last parameter of g_signal_connect().
- Subclass GtkButton (I prefer to use gob2 or vala) for more compact syntax and add your new parameter to the widget.
- Subclass one of the the parent widget of GtkButton (e.g. GtkWindow as MyApp) and add your new parameter to the widget. In last parameter of g_signal_callback() pass a pointer to MyApp.
- Use global variables.
Hope this helps.
Regards,
Dov
On Thu, Dec 2, 2010 at 03:20, Emmanuel Gontcho
<gontcho gmail com> wrote:
Hello Dov,
I write to you to ask for help. I want to add to a GtkButton a signal which callback should carry two paramaters instead of the ordinary one with the "clicked" signal. You are a widget developper I saw a call to gtk_signal_new in your source code. I want you to tell me if that is (the call) all that must be done and how to trigger the signal, since I don't write a new widget but just add the signal to an existing one.
Thank you.
--
Emmanuel Mbenga Gontcho
!!!!! Gem !!!!!
gontcho.wordpress.com
N'utilisez pas Windows 7. Pour savoir pourquoi : http://windows7sins.org/
Don't use Windows 7. To know why : http://windows7sins.org/
Membre de l'April - « promouvoir et défendre le logiciel libre » - http://www.april.org
Rejoignez maintenant plus de 2 500 personnes, associations, entreprises et
collectivités qui soutiennent notre action
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]