Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

GTK-Critical error compiling a smart program (with menu)

clarciclarci Member Posts: 1
Hi
First time sorry for my english is not soo good, i try to compile the next source :

[code]
#include
#include

gint destroyapp (GtkWidget *widget, gpointer gdata)
{
gtk_main_quit();
return (FALSE);
}
/*------------------------------------------------------------------*/
gint ClosingAppWindow (GtkWidget *widget, gpointer gdata)
{
gtk_main_quit();
return (FALSE);
}
/*------------------------------------------------------------------*/
/*------------------------------------------------------------------*/
int main (int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *vbox;
GtkWidget *menuFile = NULL;
GtkWidget *menubar = NULL;
GtkWidget *menu = NULL;
GtkWidget *menuitem = NULL;

gtk_init (&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_signal_connect(GTK_OBJECT(window),"delete_event",GTK_SIGNAL_FUNC(destroyapp), NULL);
vbox = gtk_vbox_new(FALSE,0);

gtk_container_add(GTK_CONTAINER(window), vbox);
gtk_window_set_default_size (GTK_WINDOW(window), 640, 200);

/*FILE MENU*/
menuFile = gtk_menu_item_new_with_label("File");
gtk_menu_bar_append (GTK_MENU_BAR(menubar), menuFile);
menu= gtk_menu_new();
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuFile), menu);
/*FILE MENU*/


gtk_widget_show (vbox);
gtk_widget_show (menu);
gtk_widget_show (menuitem);
gtk_widget_show (menubar);
gtk_widget_show (window);
gtk_widget_show(menuFile);

gtk_main();
return 0;
}
[/code]
with commands:
[italic]g++ -Wall -g -c fdialog.c -export-dynamic `pkg-config --cflags --libs gtk+-2.0` `gtk-config --cflags` `gtk-config --libs`

g++ -o fdialog fdialog.o `pkg-config --cflags --libs gtk+-2.0` `gtk-config --cflags` `gtk-config --libs`[/italic][b][/b]

and it compile without errors, but when i try to run it, it can be run without menubar, and become this error message:

[b](fdialog:6369): Gtk-CRITICAL **: gtk_menu_shell_insert: assertion `GTK_IS_MENU_SHELL (menu_shell)' failed

(fdialog:6369): Gtk-CRITICAL **: gtk_widget_show: assertion `GTK_IS_WIDGET (widget)' failed

(fdialog:6369): Gtk-CRITICAL **: gtk_widget_show: assertion `GTK_IS_WIDGET (widget)' failed
[/b]

is this a bug ? or how can i resolve this problem? maybe someone had the same problem.

Thanks for your help !
Robert
Sign In or Register to comment.