[maemo-developers] [maemo-developers] GTK UI Manager and Maemo

From: Luca Donaggio donaggio at gmail.com
Date: Mon Dec 5 19:14:04 EET 2005
2005/12/5, Kalle Vahlman <kalle.vahlman at gmail.com>:

2005/12/5, Luca Donaggio <donaggio at gmail.com>:
> > I'm Hildonizing a GTK2 application which uses ui_manager_* functions to
> > build its menu and I'm having the following problem:
> >
> >  each menu, upon its creation, is attached to a parent GtkMenuBar and It
> > seems that I can't re-assign it to the GtkMenu built in in my
> HildonAppView.
> > That's what I do:
> >
> >        mainmenu = hildon_appview_get_menu (HILDON_APPVIEW (window));
> >        gtk_menu_append (mainmenu, GTK_MENU (gtk_ui_manager_get_widget
> (ui,
> > "/MenuBar/FileMenu")));
>
> The File menu is inside the MenuBar when you get_widget() it, which
> means it has a parent already, thus the error:
>
> >  GLIB WARNING ** Gtk - Can't set a parent on widget which has a parent
>
> You could try with gtk_widget_reparent(), but I don't know how it will
> affect the ui manager finding it's widgets (and thus working).



I'll give it a try, thanks a lot!

>  looking at the on-line tutorials on maemo.org, it seems that ui_manager
> > method to build menu is supported, but it's not explained hot to get it
> to
> > work!
>
> Where does it state that? Didn't find a reference to it in the
> development Howto at least...


http://www.maemo.org/platform/docs/tutorials/Maemo_tutorial.html#Menus

"Two different GTK+ ways to create menu are supported, making them manually
and using GtkUIManager. GtkUIManager is new action-based method to create
menus and toolbars from an XML description. This tutorial uses only manual
creation for both, you can read more about GtkUIManager from:
http://developer.gnome.org/doc/API/2.0/gtk/GtkUIManager.html"

Or maybe I've misread this ;-)

It's true that the svn repository holds a ui-manager supporting
> version of hildonapp and hildonappview but those were added recently,
> and I won't even try to guess when they'll be in the product images...
>
> >  P.S.: adding toolbars created with this very same method works pretty
> well!
>
> That's different, you're just packing the toolbar somewhere instead of
> replacing it as is the case with the menubar.
>
> Some wacky hacker has[1] noted that since the menu happens to be the
> first element in the _private_ structure of hildonappview, you can
> actually hack your own widget there and the appview won't know the
> difference, but that hack is so gruesom that I won't even try to
> reconstruct it here ;)
>
> [1] Hi, Mr. Vire :)
>
> --
> Kalle Vahlman, zuh at iki.fi
> Powered by http://movial.fi
>

Luca Donaggio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maemo.org/pipermail/maemo-developers/attachments/20051205/9d165820/attachment.htm 
More information about the maemo-developers mailing list