Could not find signal handler...



I know that this subject has been asked and answered many times, and I have
been googling for several days to try to find an answer that works, but to
no avail. So, sorry in advance...

Here is a snippet of the glade 3 file:

<?xml version="1.0" encoding="UTF-8"?>
<interface>
  <!-- interface-requires gtk+ 3.0 -->
  <!-- interface-naming-policy toplevel-contextual -->
...
        <child>
          <object class="GtkButton" id="digit_0">
            <property name="label" translatable="yes">0</property>
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="receives_default">False</property>
            <property name="focus_on_click">False</property>
            <signal name="clicked" handler="digit_0_clicked_cb"
swapped="no"/>
          </object>
          <packing>
            <property name="right_attach">2</property>
            <property name="top_attach">8</property>
            <property name="bottom_attach">9</property>
          </packing>
        </child>
...
</interface>


and here is my code:

#include <gtk/gtk.h>

#define UI_FILE "test.glade"

G_MODULE_EXPORT void
digit_0_clicked_cb( GtkButton    *button,
                 gpointer        data )
{
...
}

int
main( int    argc,
      char **argv )
{
    GtkBuilder *builder;
    GError     *error = NULL;

    /* Init GTK+ */
    gtk_init( &argc, &argv );

    /* Create new GtkBuilder object */
    builder = gtk_builder_new();
    if( ! gtk_builder_add_from_file( builder, UI_FILE, &error ) )
    {
        g_warning( "%s", error->message );
        g_free( error );
        return( 1 );
    }

     /* Connect signals */
    gtk_builder_connect_signals( builder, NULL );

    /* Destroy builder, since we don't need it anymore */
    g_object_unref( G_OBJECT( builder ) );

    /* Show window. All other widgets are automatically shown by GtkBuilder
*/
    gtk_widget_show(GTK_WIDGET(gtk_builder_get_object(builder,
"main_window"));)

    /* Start main loop */
    gtk_main();

    return( 0 );
}

and the compile and like commands:

gcc -I/usr/include/cairo -I/usr/include/glib-2.0
-I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1
-I/usr/include/freetype2 -I/usr/include/libpng15 -I/usr/include/libdrm
-I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/
-I/usr/include/pango-1.0 -I/usr/include/gdk-pixbuf-2.0
-I/usr/include/harfbuzz -I/usr/include/atk-1.0
-I/usr/include/at-spi2-atk/2.0 -O0 -g3 -Wall -c -fmessage-length=0
-export-dynamic -o test.o ../test.c

gcc -o test test.o -lcairo -lgdk-3 -lpangocairo-1.0 -lgdk_pixbuf-2.0
-lcairo-gobject -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lgmodule-2.0 -lgtk-3
-latk-1.0 -lgio-2.0 -lcairo -lgdk-x11-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0
-lpango-1.0 -lgobject-2.0 -lglib-2.0 -lgdk-3 -lcairo-gobject -lgmodule-2.0
-lgtk-3 -latk-1.0 -lgio-2.0

I am using eclipse with the pkg_kit plugin to generate the compiler/linker
commands above. These work, with no errors or warnings.

But when I run the debugger, I get this error:

Gtk-WARNING **: Could not find signal handler 'digit_0_clicked_cb'

and the window is displayed correctly, but the button doesn't work.

As I said, I have tried many different variations of the above code and
commands. So, please, if you see something wrong, let me know.

TIA

ken


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