From a881d31f81d2195ae475d8c26ecff295d29c54de Mon Sep 17 00:00:00 2001 From: Antonio Fernandez Date: Mon, 13 Aug 2012 22:19:30 +0100 Subject: All menu labels are now displayed. There are some issues with repeated labels. Change-Id: I1b92b91f34003f20aaa56558c1c0e231d1de6f94 --- vcl/unx/gtk/window/gtksalmenu.cxx | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'vcl/unx/gtk') diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx index c0a69c108b64..163564afd0a6 100644 --- a/vcl/unx/gtk/window/gtksalmenu.cxx +++ b/vcl/unx/gtk/window/gtksalmenu.cxx @@ -451,20 +451,32 @@ bool GtkSalMenu::ShowNativePopupMenu(FloatingWindow * pWin, const Rectangle& rRe return TRUE; } +void updateNativeMenu( GtkSalMenu* pMenu ) { + if ( pMenu ) { + for (int i=0; i < pMenu->maItems.size(); i++) { + GtkSalMenuItem* pSalMenuItem = pMenu->maItems[ i ]; + String aText = pSalMenuItem->mpVCLMenu->GetItemText( pSalMenuItem->mnId ); + + // Force updating of native menu labels. + pMenu->SetItemText( i, pSalMenuItem, aText ); + + if ( pSalMenuItem->mpSubMenu && pSalMenuItem->mpSubMenu->mpVCLMenu ) { + pSalMenuItem->mpSubMenu->mpVCLMenu->Activate(); + updateNativeMenu( pSalMenuItem->mpSubMenu ); + } + } + } +} void GtkSalMenu::Freeze() { - cout << __FUNCTION__ << endl; - GLOActionGroup *mpActionGroup = g_lo_action_group_new(); + updateNativeMenu( this ); -// GMenuModel *pMenuModel = generateMenuModelAndActions( this, mpActionGroup ); + GLOActionGroup *mpActionGroup = g_lo_action_group_new(); generateActions( this, mpActionGroup ); -// this->publishMenu( mpMenuModel, G_ACTION_GROUP( mpActionGroup ) ); - // Menubar would have one section only. this->publishMenu( mpMenuModel, G_ACTION_GROUP( mpActionGroup ) ); -// g_object_unref( pMenuModel ); } // ======================================================================= -- cgit v1.2.1