gtkbuilder and signals

View: New views
3 Messages — Rating Filter:   Alert me  

gtkbuilder and signals

by Patrick Welche-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In the move from libglade to gtkbuilder, if you pop the following in your
shiny new .ui file:

<object class "GtkAction" id=...
<signal name="activate" handler="my_signal_handler">

and in your code:

gtk_builder_connect_signals(builder_pointer, my_data_pointer);

What does my_signal_handler actually get called as? Allegedly it is
void my_signal_handler(void*), but I get the feeling it's more like

gboolean my_signal_handler(GtkWidget *obj, void *my_data_pointer)

?

How can I find out?
(GtkWidget not GtkAction right? so gtk_action_get_name(obj) isn't going to
get me far?)


Cheers,

Patrick
_______________________________________________
gnome-love mailing list
gnome-love@...
http://mail.gnome.org/mailman/listinfo/gnome-love

Re: gtkbuilder and signals

by Luis Menina-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Patrick Welche a écrit :

> In the move from libglade to gtkbuilder, if you pop the following in your
> shiny new .ui file:
>
> <object class "GtkAction" id=...
> <signal name="activate" handler="my_signal_handler">
>
> and in your code:
>
> gtk_builder_connect_signals(builder_pointer, my_data_pointer);
>
> What does my_signal_handler actually get called as? Allegedly it is
> void my_signal_handler(void*), but I get the feeling it's more like
>
> gboolean my_signal_handler(GtkWidget *obj, void *my_data_pointer)
>
> ?
>
> How can I find out?
> (GtkWidget not GtkAction right? so gtk_action_get_name(obj) isn't going to
> get me far?)

Hi Patrick,

Just look at the XML code: the handler my_signal_handler is called for
the "activate" signal on a GtkAction object.
To know the prototype of the callback, you just need to give a look to
the GTK+ documentation, by launching the devhelp application (install it
if you didn't), or looking on the online help at
http://library.gnome.org/devel/gtk/stable/

Then, you just search in the help the GtkAction class. Once you're
there, you search the "activate" signal. And next to the signal, you
have the appropriate callback prototype. Is this case:
http://library.gnome.org/devel/gtk/stable/GtkAction.html#GtkAction-activate

If that was another signal, and you couldnt't find it in the class, you
just would have to search this signal upper in the inheritance tree,
since it must be inherited from a parent class.

Cheers,
--
Luis

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

Re: gtkbuilder and signals

by Patrick Welche-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Jul 21, 2009 at 01:26:18AM +0200, Luis Menina wrote:
> Then, you just search in the help the GtkAction class. Once you're
> there, you search the "activate" signal. And next to the signal, you
> have the appropriate callback prototype. Is this case:
> http://library.gnome.org/devel/gtk/stable/GtkAction.html#GtkAction-activate

Thank you! I went hunting in to g_objects...

Patrick
_______________________________________________
gnome-love mailing list
gnome-love@...
http://mail.gnome.org/mailman/listinfo/gnome-love