[Glade-users] Signal Handler cannot connect
- From: rajesh.padalia at gmail.com (Rajesh Padalia)
- Subject: [Glade-users] Signal Handler cannot connect
- Date: Wed, 8 Jun 2011 19:03:38 +0300
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;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/glade-users/attachments/20110608/4178bb5c/attachment.html
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]