Results 1 to 4 of 4
I'm getting the error
debian:~/giis-4.6-seprate-files# gtk-builder-convert tab1.glade tab1.xml
Wrote tab1.xml
debian:~/giis-4.6-seprate-files# gcc -Wall -g -o tab1 tab1.c `pkg-config --cflags --libs gtk+-2.0` -export-dynamic
debian:~/giis-4.6-seprate-files# ./tab1 <============ERROR
(tab1:8594): Gtk-CRITICAL **: gtk_widget_show: assertion ...
- 06-10-2009 #1
GTK+ Error -- Need help
I'm getting the error
Below is the source code of c file and .glade file.debian:~/giis-4.6-seprate-files# gtk-builder-convert tab1.glade tab1.xml
Wrote tab1.xml
debian:~/giis-4.6-seprate-files# gcc -Wall -g -o tab1 tab1.c `pkg-config --cflags --libs gtk+-2.0` -export-dynamic
debian:~/giis-4.6-seprate-files# ./tab1 <============ERROR
(tab1:8594): Gtk-CRITICAL **: gtk_widget_show: assertion `GTK_IS_WIDGET (widget)' failed
Any know what's the issue here?
Code:#include <gtk/gtk.h> #include <math.h> #include <stdio.h> /* First run : gtk-builder-convert tab1.glade tab1.xml Then run: gcc -Wall -g -o tab1 tab1.c `pkg-config --cflags --libs gtk+-2.0` -export-dynamic Then execute it using: ./tab1 */ #define GUI "gui/tab1.xml" typedef struct{ GtkWidget *main_win; //For main window GtkWidget *btn_viewfiles; // search button GtkWidget *textview_viewfiles; //textview _search files } TAB1; GtkTextBuffer *buffer; //to store data. void on_main_win_destroy (GtkObject *object, gpointer user_data); void on_btn_viewfiles_clicked(GtkButton *button, TAB1 *from_gui); gboolean build_app (TAB1 *from_gui); int main (int argc, char *argv[]) { TAB1 *from_gui; from_gui = g_slice_new (TAB1); gtk_init (&argc, &argv); if (build_app (from_gui) == FALSE) return 1; gtk_widget_show (from_gui->main_win); g_print("Starting gui\n"); gtk_main (); g_slice_free (TAB1, from_gui); return 0; } gboolean build_app (TAB1 *from_gui){ GtkBuilder *builder; builder = gtk_builder_new (); gtk_builder_add_from_file (builder, GUI, NULL); from_gui->main_win = GTK_WIDGET (gtk_builder_get_object (builder, "main_win")); from_gui->btn_viewfiles = GTK_WIDGET (gtk_builder_get_object (builder, "btn_viewfiles")); from_gui->textview_viewfiles = GTK_WIDGET (gtk_builder_get_object (builder, "textview_viewfiles")); gtk_builder_connect_signals (builder, from_gui); g_object_unref (G_OBJECT (builder)); return TRUE; } void on_main_win_destroy (GtkObject *object, gpointer user_data){ gtk_main_quit(); } void on_btn_viewfiles_clicked(GtkButton *button, TAB1 *from_gui){ g_print("reached "); }Code:<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> <!--Generated with glade3 3.4.5 on Wed Jun 10 13:43:45 2009 --> <glade-interface> <widget class="GtkWindow" id="main_win"> <property name="width_request">300</property> <property name="height_request">229</property> <property name="title" translatable="yes">View files</property> <signal name="destroy" handler="on_main_win_destroy"/> <child> <widget class="GtkLayout" id="layout1"> <property name="visible">True</property> <child> <widget class="GtkButton" id="btn_viewfiles"> <property name="width_request">75</property> <property name="height_request">31</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="label" translatable="yes">Search</property> <property name="response_id">0</property> <signal name="clicked" handler="on_btn_viewfiles_clicked"/> </widget> <packing> <property name="x">35</property> <property name="y">4</property> </packing> </child> <child> <widget class="GtkTextView" id="textview_viewfiles"> <property name="width_request">100</property> <property name="height_request">119</property> <property name="visible">True</property> <property name="can_focus">True</property> </widget> <packing> <property name="x">194</property> <property name="y">49</property> </packing> </child> </widget> </child> </widget> </glade-interface>- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------
- 06-10-2009 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
My guess is that something failed in your build_app() function and from_gui->main_win or some sub-component is NULL. Run this in the debugger and see what component is not being initialized properly.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 06-11-2009 #3
Thanks ,Rubberman. I'll try debugging (I need to install debugger) it tonight. I have other simple addition/subtraction/even number GTK+ programs working
I Made some mistake some where with this..
- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------
- 06-11-2009 #4


Reply With Quote
