Re: g_signal_new

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

 



Thank you,

I think I will use the first option. Thank you much.

2010/12/2 Dov Grobgeld <dov.grobgeld@xxxxxxxxx>
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.
  1. 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.
  2. 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().
  3. Subclass GtkButton (I prefer to use gob2 or vala) for more compact syntax and add your new parameter to the widget.
  4. 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.
  5. Use global variables.
Hope this helps.

Regards,
Dov


On Thu, Dec 2, 2010 at 03:20, Emmanuel Gontcho <gontcho@xxxxxxxxx> 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






--
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


_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux