Again, a lot of time since my last post. If you’re interested, yes I’m still happy and I’m still contributing to tinymail. My contributions decreased a little bit these last weeks because I had other priorities but I’ll try to keep them going.

This afternoon I was trying to use the nice GtkUIManager stuff inside a Hildon application but when trying to add a new menu described in the UI XML definition file to the HildonWindow I realized that I had a problem. The reason is that hildon_window_set_menu expects a GtkMenu as second argument, but the GtkUIManager gives me a GtkMenuBar.

So I had to add an utility function to the code that converts from a GtkMenuBar to a GtkMenu. As you could see it’s really simple, but the very nice thing is that it still uses the definitions of the UI XML file.

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;
}