Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Dec. 2, 2010 06:55:17

Dov G.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

g_signal_new


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 <gont***@*mail.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
>
>
>_______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#2 Dec. 2, 2010 07:48:10

Emmanuel G.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

g_signal_new


Thank you,

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

2010/12/2 Dov Grobgeld <dov.grobg***@*mail.com>

> 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 <gont***@*mail.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
>>
>>
>>
>


--
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.orgRejoignez maintenant plus de 2 500 personnes, associations, entreprises et
collectivités qui soutiennent notre action_______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

Board footer

Moderator control

Enjoy the 13th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support