> I wasn't sugesting that you link with glade (which wouldn't work > anyway), just sugesting that you look at the code I wrote to get the > feel of how to do it yourself.
it's true. I'll investigate this path ... ;) > Hmm, > then your probably better off writing some menu specific code; > rather than writing GObject based generic code. > > Heres an idea thats kindof a shot in the dark: > > - Build your first menu and make it the "master" menu (i.e. always > base your replicas on the "master menu"), use GtkUIManager for it. > > - When building your replica menu(s), use > `gtk_ui_manager_get_ui (master_menu)'. > > Seems like it should work, but it might be a naive guess :-/ I was afraid somebody would suggest something like this to me. *Explaination*: I'm developing an embedded linux app that uses customized GTK as graphical toolkit (see www.maemo.org to more informations). No problems until this point. So somebody sent the following e-mail to the respective mail list: >In my app , I would like to share some specific >> menuItems between all the registered pageviews. So >> I've created a global menuItem variable, aiming to >> append it to the menu of each pageview. >> >> So, after the creation of each pageview, I've tried >> to get its menu and than append my global menuItem. The >> following quoted code ilustrates my intentions: >> >> <quoted> >> >> GtkMenu *mainMenu = NULL; >> >> // get main menu pointer >> mainMenu = GTK_MENU(hildon_appview_get_menu(current_page_view)); >> >> // appeding the global Window menu >> gtk_menu_shell_append(GTK_MENU_SHELL(mainMenu), >> gMenuWindowMenuItem); >> >> </quoted> >> >> When I append the global menuItem to the first >> apgeview (at the fisrt time, of course), every thing >> works properly. But when I try a second time, I get: >> >> (app_test:19338): Gtk-WARNING **: Can't set a parent >> on widget which has a parent at runtime. >>So, it is complaining that my menuItem already has a parent (in this case, the >>parent is the former page_view's menu). Is there a way to juggle this situation >>?! How can I share menuItem between different page_views ?! ANSWER from the list : Make an item with the same name to all the menus, and connect the same callback to both/all of them. This is the only way to do this currently, in the future you can do it with *GtkUIManager* magic, but that's in the future... :( so , there is no 'gtk_ui_manager_get_ui' available. I have try found out another way ... ps2: Thanks again Tristan. -- Antonio Gomes _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list