[Glade-users] another time: simpel example with glade_xml_signal_autoconnect , error: can't find signal handler



Hi @all,

i wrote a very simple example to show, that i can't figure out why the
glade_xml_signal_autoconnect-function doesn't will work. It's just a
simple button who shows a message on the console. 

#include <gtk/gtk.h>
#include <glade/glade.h>

void on_button1_clicked (GtkButton *button, gpointer   user_data) {
        g_print("Hallo \n");
}

int main (int argc, char * argv[]) {
        gtk_init(&argc, &argv);
        glade_init();
        GladeXML * xml = glade_xml_new ("libglade-test.glade",
"window1", NULL);
        glade_xml_signal_autoconnect (xml);
        gtk_main();
        return 0;
}

The appropriate glade-file is:

<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd";>

<glade-interface>

<widget class="GtkWindow" id="window1">
  <property name="visible">True</property>
  <property name="title" translatable="yes">window1</property>
  <property name="type">GTK_WINDOW_TOPLEVEL</property>
  <property name="window_position">GTK_WIN_POS_NONE</property>
  <property name="modal">False</property>
  <property name="resizable">True</property>
  <property name="destroy_with_parent">False</property>
  <property name="decorated">True</property>
  <property name="skip_taskbar_hint">False</property>
  <property name="skip_pager_hint">False</property>
  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
  <property name="focus_on_map">True</property>
  <property name="urgency_hint">False</property>

  <child>
    <widget class="GtkButton" id="button1">
      <property name="visible">True</property>
      <property name="can_focus">True</property>
      <property name="label" translatable="yes">button1</property>
      <property name="use_underline">True</property>
      <property name="relief">GTK_RELIEF_NORMAL</property>
      <property name="focus_on_click">True</property>
      <signal name="clicked" handler="on_button1_clicked"
last_modification_time="Tue, 22 May 2007 17:05:53 GMT"/>
    </widget>
  </child>
</widget>

</glade-interface>

I compile with:
 gcc -o libglade-test main.c `pkg-config --cflags --libs gtk+-2.0
libglade-2.0`

The result is during the execution of the program:
(libglade-test:7407): libglade-WARNING **: could not find signal handler
'on_button1_clicked'.

And their is no response of the button. Their happens nothing, when i
click on the button. :-(

What im doing wrong?
Thanks for hints,
Daniel.







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