static GtkWidget *
menubar_to_menu (GtkUIManager *ui_manager) {
GtkWidget *main_menu;
GtkWidget *menubar;
GList *iter;
/* Create new main menu */
main_menu = gtk_menu_new();
/* Get the menubar from the UI manager */
menubar = gtk_ui_manager_get_widget (ui_manager, "/MenuBar");
iter = gtk_container_get_children (GTK_CONTAINER (menubar));
while (iter) {
GtkWidget *menu;
menu = GTK_WIDGET (iter->data);
gtk_widget_reparent(menu, main_menu);
iter = g_list_next (iter);
}
return main_menu;
}
And you can use it this way:
ui = gtk_ui_manager_new ();
....
hildon_window_set_menu(HILDON_WINDOW(window), GTK_MENU(menubar_to_menu (ui)));
No comments:
Post a Comment