libglade question for page 1
- From: y g <odysseus lost gmail com>
- To: gtk-app-devel-list gnome org
- Subject: libglade question for page 1
- Date: Sun, 5 Jun 2005 11:13:20 +0100
hi,
i have a simple window with a button which when clicked prints to
stdout a message. using libglade to interpret the xml file. compiles
fine but when i running it i get a warning that signal handler for the
button cannot be found. sorry for this trivial question but i think i
followed exactly the documentation and cannot find the answer to that.
find below the xml and c sources.
<?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="windowWorld">
<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>
<child>
<widget class="GtkButton" id="buttonSurprise">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Click me for a
surprise</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_buttonSurprise_clicked"
last_modification_time="Fri, 03 Jun 2005 14:05:08 GMT"/>
</widget>
</child>
</widget>
</glade-interface>
#include <gtk/gtk.h>
#include <glade/glade.h>
void
on_buttonSurprise_clicked(GtkWidget *widget, gpointer user_data)
{
g_print("Mysterious world\n");
}
int main(int argc, char *argv[]) {
GladeXML *xml;
gtk_init(&argc, &argv);
/* load the interface */
xml = glade_xml_new("test3.glade", NULL, NULL);
/* connect the signals in the interface */
glade_xml_signal_autoconnect(xml);
/* start the event loop */
gtk_main();
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]