gtk glade need help

Posted by shiv garg on Ask Ubuntu See other posts from Ask Ubuntu or by shiv garg
Published on 2014-05-20T17:04:58Z Indexed on 2014/06/01 9:40 UTC
Read the original article Hit count: 325

Filed under:
|
|

I am using glade to make an user interface.

i have successfully generated the glade file

Now i have to include this file in my C code.

I am using following code:

#include <stdlib.h>
#include<gtk/gtk.h>
int main (int argc, char *argv[])
{
GtkWidget *builder,*window,*button;
gtk_init (&argc, &argv);
builder=gtk_builder_new();
gtk_builder_add_from_file(builder,"shiv.glade",NULL);
window=GTK_WIDGET (gtk_builder_get_object(builder,"window1")) ;
button=GTK_WIDGET (gtk_builder_get_object(builder,"button1"));
g_object_unref(G_OBJECT(builder));
gtk_widget_show(button);
gtk_widget_show(window);
gtk_main ();
return 0;
}

My UI is a simple window having a button without any callback function.

I am getting following errors on execution

GTK-CRITICAL **: IA__gtk_widget_show assertion 'GTK_IS_WIDGET(widget)' failed

© Ask Ubuntu or respective owner

Related posts about gui

Related posts about gtk