[Glade-users] Signal Handler cannot connect

Juan Pablo Ugarte juanpablougarte at gmail.com
Wed Jun 8 12:58:15 EDT 2011


You need to export the symbols otherwise GtkBuilder wont find them.

Try gcc `pkg-config --cflags --libs gtk+-3.0 gmodule-export-2.0` -o test test.c

greets

On Wed, Jun 8, 2011 at 1:03 PM, Rajesh Padalia <rajesh.padalia at gmail.com> wrote:
> Hi List,
> I am using glade 3.10 with gtk3 in Fedora15(64 bits). I cannot make signal
> handler to work in attached simple program, ie. on button click it does not
> print "OK". Any help will be appreciated.
>
> Glade File: test.glade
>
> <?xml version="1.0" encoding="UTF-8"?>
> <interface>
>   <!-- interface-requires gtk+ 3.0 -->
>   <object class="GtkWindow" id="window1">
>     <property name="can_focus">False</property>
>     <child>
>       <object class="GtkButton" id="button1">
>         <property name="label" translatable="yes">button</property>
>         <property name="visible">True</property>
>         <property name="can_focus">True</property>
>         <property name="receives_default">True</property>
>         <property name="use_action_appearance">False</property>
>         <signal name="clicked" handler="button_clicked" swapped="no"/>
>       </object>
>     </child>
>   </object>
> </interface>
>
> c-program: test.c
>
> /*-----------------------------
> Compile: gcc `pkg-config --cflags gtk+-3.0` -o test test.c `pkg-config
> --libs gtk+-3.0`
> -------------------------------*/
> #include <gtk/gtk.h>
>
> void
> button_clicked        (GtkButton *button, gpointer user_data)
> {
>     g_print("OK");
> }
>
> int
> main (int argc, char *argv[])
> {
>         GtkBuilder *builder;
>         GtkWidget               *window1;
>
>         gtk_init (&argc, &argv);
>
>         builder = gtk_builder_new ();
>         gtk_builder_add_from_file (builder, "test.glade", NULL);
>         window1 = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
>         gtk_builder_connect_signals (builder, NULL);
>         g_object_unref (G_OBJECT (builder));
>         gtk_widget_show_all (window1);
>         gtk_main ();
>
>         return 0;
> }
>
>
> _______________________________________________
> Glade-users maillist  -  Glade-users at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/glade-users
>
>


More information about the Glade-users mailing list