bluedalmatian
December 12th, 2009, 04:23 PM
Ive got a gnome app called mainwindow which is declared like this:
GtkWidget* mainwindow = gnome_app_new("Name","Name");
This window loads up fine and has been part of a working application for a few weeks. Im now trying to add a menubar accross the top which will contain one menu (Help) with one item (About). The code Im using is as follows:
GtkWidget* menubar;
GtkWidget* helpitem;
GtkWidget* helpmenu;
GtkWidget* aboutitem;
menubar=gtk_menu_bar_new();
helpitem=gtk_menu_item_new_with_label("Help");
aboutitem=gtk_menu_item_new_with_label("About");
helpmenu=gtk_menu_new();
gtk_menu_item_set_submenu(GTK_MENU_ITEM(helpitem), helpmenu);
gtk_menu_shell_append(GTK_MENU_SHELL(helpmenu),abo utitem);
gtk_menu_shell_append(GTK_MENU_SHELL(menubar),help item);
gnome_app_set_menus(GNOME_APP(mainwindow),GTK_MENU _BAR(menubar));
gtk_widget_show_all(menubar);
This compiles fine and the app runs but the menu bar doesnt show up.
Can anybody see what Ive done wrong as as far as I can see it matches the examples Ive looked at?
Thanks
GtkWidget* mainwindow = gnome_app_new("Name","Name");
This window loads up fine and has been part of a working application for a few weeks. Im now trying to add a menubar accross the top which will contain one menu (Help) with one item (About). The code Im using is as follows:
GtkWidget* menubar;
GtkWidget* helpitem;
GtkWidget* helpmenu;
GtkWidget* aboutitem;
menubar=gtk_menu_bar_new();
helpitem=gtk_menu_item_new_with_label("Help");
aboutitem=gtk_menu_item_new_with_label("About");
helpmenu=gtk_menu_new();
gtk_menu_item_set_submenu(GTK_MENU_ITEM(helpitem), helpmenu);
gtk_menu_shell_append(GTK_MENU_SHELL(helpmenu),abo utitem);
gtk_menu_shell_append(GTK_MENU_SHELL(menubar),help item);
gnome_app_set_menus(GNOME_APP(mainwindow),GTK_MENU _BAR(menubar));
gtk_widget_show_all(menubar);
This compiles fine and the app runs but the menu bar doesnt show up.
Can anybody see what Ive done wrong as as far as I can see it matches the examples Ive looked at?
Thanks