vcl/inc/unx/gtk/gtksalmenu.hxx | 12 ++++++++---- vcl/unx/gtk/window/gtkframe.cxx | 2 +- vcl/unx/gtk/window/gtksalmenu.cxx | 29 +++++++++++++++++++++-------- 3 files changed, 30 insertions(+), 13 deletions(-)
New commits: commit 8f3152f39b3d8be2d746349c9ebc148c06db3c36 Author: Antonio Fernandez <antonio.fernan...@aentos.es> Date: Mon Oct 22 15:08:52 2012 +0100 Removed pre-definition of class GtkSalMenu. Change-Id: I56652b6074d0138128178b479503a21e0bcd0c7f diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx index b7d3bdd..2da7c88 100644 --- a/vcl/inc/unx/gtk/gtksalmenu.hxx +++ b/vcl/inc/unx/gtk/gtksalmenu.hxx @@ -35,7 +35,6 @@ class MenuItemList; -class GtkSalMenu; class GtkSalMenuItem; commit 8f7852e08114d4413881407e1c101da176a1fd0f Author: Antonio Fernandez <antonio.fernan...@aentos.es> Date: Mon Oct 22 14:44:50 2012 +0100 Added ImplUpdate method to provide recursive and non-recursive menu updating. Change-Id: Ifd4b3f0d68f4919a10f97d6681bfd0002fa48c7a diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx index 5b77a29..b7d3bdd 100644 --- a/vcl/inc/unx/gtk/gtksalmenu.hxx +++ b/vcl/inc/unx/gtk/gtksalmenu.hxx @@ -59,6 +59,7 @@ private: GActionGroup* mpActionGroup; GtkSalMenu* GetMenuForItemCommand( gchar* aCommand, gboolean bGetSubmenu ); + void ImplUpdate( gboolean bRecurse ); public: GtkSalMenu( sal_Bool bMenuBar ); diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx index 38a90db..a6295c4 100644 --- a/vcl/unx/gtk/window/gtksalmenu.cxx +++ b/vcl/unx/gtk/window/gtksalmenu.cxx @@ -241,7 +241,7 @@ void RemoveUnusedCommands( GLOActionGroup* pActionGroup, GList* pOldCommandList, } } -void GtkSalMenu::Update() +void GtkSalMenu::ImplUpdate( gboolean bRecurse ) { SolarMutexGuard aGuard; //GTK_YIELD_GRAB(); @@ -358,149 +358,17 @@ void GtkSalMenu::Update() } g_object_unref( pSubMenuModel ); - } - - g_free( aNativeCommand ); - - ++nItemPos; - ++validItems; - } - - // Delete extra items in last section. - RemoveSpareItemsFromNativeMenu( pLOMenu, &pOldCommandList, nSection, validItems ); - - // Delete extra sections. - RemoveSpareSectionsFromNativeMenu( pLOMenu, &pOldCommandList, nSection ); - - // Delete unused commands. - RemoveUnusedCommands( pActionGroup, pOldCommandList, pNewCommandList ); -} -void GtkSalMenu::UpdateFull() -{ - SolarMutexGuard aGuard; - //GTK_YIELD_GRAB(); - - if( !PrepUpdate() ) - return; - - Menu* pVCLMenu = mpVCLMenu; - GLOMenu* pLOMenu = G_LO_MENU( mpMenuModel ); - GLOActionGroup* pActionGroup = G_LO_ACTION_GROUP( mpActionGroup ); - GList *pOldCommandList = NULL; - GList *pNewCommandList = NULL; - - sal_uInt16 nLOMenuSize = g_menu_model_get_n_items( G_MENU_MODEL( pLOMenu ) ); - - if ( nLOMenuSize == 0 ) - g_lo_menu_new_section( pLOMenu, 0, NULL ); - - sal_Int32 nSection = 0; - sal_Int32 nItemPos = 0; - sal_Int32 validItems = 0; - sal_Int32 nItem; - - for ( nItem = 0; nItem < ( sal_Int32 ) GetItemCount(); nItem++ ) { - if ( IsItemVisible( nItem ) == sal_False ) - continue; - - GtkSalMenuItem *pSalMenuItem = GetItemAtPos( nItem ); - sal_uInt16 nId = pSalMenuItem->mnId; - - if ( pSalMenuItem->mnType == MENUITEM_SEPARATOR ) - { - // Delete extra items from current section. - RemoveSpareItemsFromNativeMenu( pLOMenu, &pOldCommandList, nSection, validItems ); - - nSection++; - nItemPos = 0; - validItems = 0; - - if ( nLOMenuSize <= nSection ) + if ( bRecurse ) { - g_lo_menu_new_section( pLOMenu, nSection, NULL ); - nLOMenuSize++; - } - - continue; - } - - if ( nItemPos >= g_lo_menu_get_n_items_from_section( pLOMenu, nSection ) ) - g_lo_menu_insert_in_section( pLOMenu, nSection, nItemPos, "EMPTY STRING" ); - - // Get internal menu item values. - String aText = pVCLMenu->GetItemText( nId ); - rtl::OUString aCommand( pVCLMenu->GetItemCommand( nId ) ); - sal_Bool itemEnabled = pVCLMenu->IsItemEnabled( nId ); - KeyCode nAccelKey = pVCLMenu->GetAccelKey( nId ); - sal_Bool itemChecked = pVCLMenu->IsItemChecked( nId ); - MenuItemBits itemBits = pVCLMenu->GetItemBits( nId ); - - // Convert internal values to native values. - gboolean bChecked = ( itemChecked == sal_True ) ? TRUE : FALSE; - gboolean bEnabled = ( itemEnabled == sal_True ) ? TRUE : FALSE; -// gchar* aNativeCommand = g_strdup( rtl::OUStringToOString( aCommand, RTL_TEXTENCODING_UTF8 ).getStr() ); - gchar* aNativeCommand = GetCommandForSpecialItem( pSalMenuItem ); - - // Store current item command in command list. - gchar *aCurrentCommand = g_lo_menu_get_command_from_item_in_section( pLOMenu, nSection, nItemPos ); - - if ( aCurrentCommand != NULL ) - pOldCommandList = g_list_append( pOldCommandList, aCurrentCommand ); - - // Force updating of native menu labels. - NativeSetItemText( nSection, nItemPos, aText ); - NativeSetAccelerator( nSection, nItemPos, nAccelKey, nAccelKey.GetName( GetFrame()->GetWindow() ) ); - - // Some items are special, so they have different commands. -// if ( g_strcmp0( aNativeCommand, "" ) == 0 ) - if ( !aNativeCommand ) - { -// gchar *aSpecialItemCmd = GetCommandForSpecialItem( pSalMenuItem ); - aNativeCommand = g_strdup( rtl::OUStringToOString( aCommand, RTL_TEXTENCODING_UTF8 ).getStr() ); + pSubmenu->SetMenuModel( G_MENU_MODEL( pSubMenuModel ) ); + pSubmenu->SetActionGroup( G_ACTION_GROUP( pActionGroup ) ); -// if ( aSpecialItemCmd != NULL ) -// { -// g_free( aNativeCommand ); -// aNativeCommand = aSpecialItemCmd; -// } - } + pSubmenu->GetMenu()->Activate(); + pSubmenu->GetMenu()->Deactivate(); - if ( g_strcmp0( aNativeCommand, "" ) != 0 && pSalMenuItem->mpSubMenu == NULL ) - { - NativeSetItemCommand( nSection, nItemPos, nId, aNativeCommand, itemBits, bChecked, FALSE ); - NativeCheckItem( nSection, nItemPos, itemBits, bChecked ); - NativeSetEnableItem( aNativeCommand, bEnabled ); - - pNewCommandList = g_list_append( pNewCommandList, g_strdup( aNativeCommand ) ); - } - - GtkSalMenu* pSubmenu = pSalMenuItem->mpSubMenu; - - if ( pSubmenu && pSubmenu->GetMenu() ) - { - NativeSetItemCommand( nSection, nItemPos, nId, aNativeCommand, itemBits, FALSE, TRUE ); - pNewCommandList = g_list_append( pNewCommandList, g_strdup( aNativeCommand ) ); - - GLOMenu* pSubMenuModel = g_lo_menu_get_submenu_from_item_in_section( pLOMenu, nSection, nItemPos ); - - if ( pSubMenuModel == NULL ) - { - //pSubMenuModel = g_lo_menu_new(); - //g_lo_menu_set_submenu_to_item_in_section( pLOMenu, nSection, nItemPos, G_MENU_MODEL( pSubMenuModel ) ); - g_lo_menu_new_submenu_in_item_in_section( pLOMenu, nSection, nItemPos ); - pSubMenuModel = g_lo_menu_get_submenu_from_item_in_section( pLOMenu, nSection, nItemPos ); + pSubmenu->ImplUpdate( bRecurse ); } - - g_object_unref( pSubMenuModel ); - - pSubmenu->SetMenuModel( G_MENU_MODEL( pSubMenuModel ) ); - pSubmenu->SetActionGroup( G_ACTION_GROUP( pActionGroup ) ); - - pSubmenu->GetMenu()->Activate(); - pSubmenu->GetMenu()->Deactivate(); - - pSubmenu->UpdateFull(); } g_free( aNativeCommand ); @@ -519,6 +387,16 @@ void GtkSalMenu::UpdateFull() RemoveUnusedCommands( pActionGroup, pOldCommandList, pNewCommandList ); } +void GtkSalMenu::Update() +{ + ImplUpdate( FALSE ); +} + +void GtkSalMenu::UpdateFull() +{ + ImplUpdate( TRUE ); +} + /* * GtkSalMenu commit fcec048d761abd99dd590694c05d247857470bc7 Author: Antonio Fernandez <antonio.fernan...@aentos.es> Date: Mon Oct 22 14:29:14 2012 +0100 Some code refactoring. Change-Id: I47d9be121898ca66f73488be4b46cc16cc4013a9 diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx index 81ff193..5b77a29 100644 --- a/vcl/inc/unx/gtk/gtksalmenu.hxx +++ b/vcl/inc/unx/gtk/gtksalmenu.hxx @@ -40,7 +40,7 @@ class GtkSalMenuItem; // Generate the complete structure of a menu. -static void GenerateFullMenu( GtkSalMenu* pSalMenu ); +//static void GenerateFullMenu( GtkSalMenu* pSalMenu ); class GtkSalMenu : public SalMenu @@ -110,7 +110,8 @@ public: void Deactivate( const gchar* aMenuCommand ); void Display( sal_Bool bVisible ); bool PrepUpdate(); -// void UpdateNativeMenu(); + void Update(); // Update this menu only. + void UpdateFull(); // Update full menu hierarchy from this menu. }; class GtkSalMenuItem : public SalMenuItem diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index f307a11..4b27b7d 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -581,7 +581,7 @@ void on_registrar_available( GDBusConnection * /*connection*/, { GtkSalMenu* pGtkSalMenu = static_cast<GtkSalMenu*>(pSalMenu); pGtkSalMenu->Display( sal_True ); - pGtkSalMenu->UpdateNativeMenu(); + pGtkSalMenu->UpdateFull(); } } diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx index d094a4f..38a90db 100644 --- a/vcl/unx/gtk/window/gtksalmenu.cxx +++ b/vcl/unx/gtk/window/gtksalmenu.cxx @@ -241,7 +241,7 @@ void RemoveUnusedCommands( GLOActionGroup* pActionGroup, GList* pOldCommandList, } } -void GtkSalMenu::UpdateNativeMenu() +void GtkSalMenu::Update() { SolarMutexGuard aGuard; //GTK_YIELD_GRAB(); @@ -376,17 +376,17 @@ void GtkSalMenu::UpdateNativeMenu() RemoveUnusedCommands( pActionGroup, pOldCommandList, pNewCommandList ); } -static void GenerateFullMenu( GtkSalMenu* pSalMenu ) +void GtkSalMenu::UpdateFull() { SolarMutexGuard aGuard; //GTK_YIELD_GRAB(); - if( !pSalMenu || !pSalMenu->PrepUpdate() ) + if( !PrepUpdate() ) return; - Menu* pVCLMenu = pSalMenu->GetMenu(); - GLOMenu* pLOMenu = G_LO_MENU( pSalMenu->GetMenuModel() ); - GLOActionGroup* pActionGroup = G_LO_ACTION_GROUP( pSalMenu->GetActionGroup() ); + Menu* pVCLMenu = mpVCLMenu; + GLOMenu* pLOMenu = G_LO_MENU( mpMenuModel ); + GLOActionGroup* pActionGroup = G_LO_ACTION_GROUP( mpActionGroup ); GList *pOldCommandList = NULL; GList *pNewCommandList = NULL; @@ -400,11 +400,11 @@ static void GenerateFullMenu( GtkSalMenu* pSalMenu ) sal_Int32 validItems = 0; sal_Int32 nItem; - for ( nItem = 0; nItem < ( sal_Int32 ) pSalMenu->GetItemCount(); nItem++ ) { - if ( pSalMenu->IsItemVisible( nItem ) == sal_False ) + for ( nItem = 0; nItem < ( sal_Int32 ) GetItemCount(); nItem++ ) { + if ( IsItemVisible( nItem ) == sal_False ) continue; - GtkSalMenuItem *pSalMenuItem = pSalMenu->GetItemAtPos( nItem ); + GtkSalMenuItem *pSalMenuItem = GetItemAtPos( nItem ); sal_uInt16 nId = pSalMenuItem->mnId; if ( pSalMenuItem->mnType == MENUITEM_SEPARATOR ) @@ -440,7 +440,7 @@ static void GenerateFullMenu( GtkSalMenu* pSalMenu ) gboolean bChecked = ( itemChecked == sal_True ) ? TRUE : FALSE; gboolean bEnabled = ( itemEnabled == sal_True ) ? TRUE : FALSE; // gchar* aNativeCommand = g_strdup( rtl::OUStringToOString( aCommand, RTL_TEXTENCODING_UTF8 ).getStr() ); - gchar* aNativeCommand = pSalMenu->GetCommandForSpecialItem( pSalMenuItem ); + gchar* aNativeCommand = GetCommandForSpecialItem( pSalMenuItem ); // Store current item command in command list. gchar *aCurrentCommand = g_lo_menu_get_command_from_item_in_section( pLOMenu, nSection, nItemPos ); @@ -449,8 +449,8 @@ static void GenerateFullMenu( GtkSalMenu* pSalMenu ) pOldCommandList = g_list_append( pOldCommandList, aCurrentCommand ); // Force updating of native menu labels. - pSalMenu->NativeSetItemText( nSection, nItemPos, aText ); - pSalMenu->NativeSetAccelerator( nSection, nItemPos, nAccelKey, nAccelKey.GetName( GetFrame()->GetWindow() ) ); + NativeSetItemText( nSection, nItemPos, aText ); + NativeSetAccelerator( nSection, nItemPos, nAccelKey, nAccelKey.GetName( GetFrame()->GetWindow() ) ); // Some items are special, so they have different commands. // if ( g_strcmp0( aNativeCommand, "" ) == 0 ) @@ -468,9 +468,9 @@ static void GenerateFullMenu( GtkSalMenu* pSalMenu ) if ( g_strcmp0( aNativeCommand, "" ) != 0 && pSalMenuItem->mpSubMenu == NULL ) { - pSalMenu->NativeSetItemCommand( nSection, nItemPos, nId, aNativeCommand, itemBits, bChecked, FALSE ); - pSalMenu->NativeCheckItem( nSection, nItemPos, itemBits, bChecked ); - pSalMenu->NativeSetEnableItem( aNativeCommand, bEnabled ); + NativeSetItemCommand( nSection, nItemPos, nId, aNativeCommand, itemBits, bChecked, FALSE ); + NativeCheckItem( nSection, nItemPos, itemBits, bChecked ); + NativeSetEnableItem( aNativeCommand, bEnabled ); pNewCommandList = g_list_append( pNewCommandList, g_strdup( aNativeCommand ) ); } @@ -479,7 +479,7 @@ static void GenerateFullMenu( GtkSalMenu* pSalMenu ) if ( pSubmenu && pSubmenu->GetMenu() ) { - pSalMenu->NativeSetItemCommand( nSection, nItemPos, nId, aNativeCommand, itemBits, FALSE, TRUE ); + NativeSetItemCommand( nSection, nItemPos, nId, aNativeCommand, itemBits, FALSE, TRUE ); pNewCommandList = g_list_append( pNewCommandList, g_strdup( aNativeCommand ) ); GLOMenu* pSubMenuModel = g_lo_menu_get_submenu_from_item_in_section( pLOMenu, nSection, nItemPos ); @@ -500,8 +500,7 @@ static void GenerateFullMenu( GtkSalMenu* pSalMenu ) pSubmenu->GetMenu()->Activate(); pSubmenu->GetMenu()->Deactivate(); - GenerateFullMenu( pSubmenu ); - //pSubmenu->UpdateNativeMenu(); + pSubmenu->UpdateFull(); } g_free( aNativeCommand ); @@ -630,7 +629,7 @@ void GtkSalMenu::SetFrame( const SalFrame* pFrame ) // Generate the main menu structure. if (bMenuVisibility) - UpdateNativeMenu(); + UpdateFull(); g_lo_menu_insert_section( pMenuModel, 0, NULL, mpMenuModel ); } @@ -843,7 +842,7 @@ void GtkSalMenu::Activate( const gchar* aMenuCommand ) if ( pSalSubMenu != NULL ) { MenuBar* pMenuBar = static_cast< MenuBar* >( mpVCLMenu ); pMenuBar->HandleMenuActivateEvent( pSalSubMenu->mpVCLMenu ); - pSalSubMenu->UpdateNativeMenu2(); + pSalSubMenu->Update(); } } commit f40d82656e1978b44289ca40bb7d0cdd9ba8adb7 Author: Antonio Fernandez <antonio.fernan...@aentos.es> Date: Mon Oct 22 10:52:58 2012 +0100 Only activated submenus are generated when activating them. (Broken) Change-Id: I9548a2c8dfec114de3133d55ca00362793b71a6c diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx index 46ba215..81ff193 100644 --- a/vcl/inc/unx/gtk/gtksalmenu.hxx +++ b/vcl/inc/unx/gtk/gtksalmenu.hxx @@ -35,9 +35,14 @@ class MenuItemList; +class GtkSalMenu; class GtkSalMenuItem; +// Generate the complete structure of a menu. +static void GenerateFullMenu( GtkSalMenu* pSalMenu ); + + class GtkSalMenu : public SalMenu { private: @@ -103,11 +108,9 @@ public: void DispatchCommand( gint itemId, const gchar* aCommand ); void Activate( const gchar* aMenuCommand ); void Deactivate( const gchar* aMenuCommand ); -// void DisconnectFrame(); void Display( sal_Bool bVisible ); - void UpdateNativeMenu(); -// void UpdateNativeSubMenu(); - bool PrepUpdate(); + bool PrepUpdate(); +// void UpdateNativeMenu(); }; class GtkSalMenuItem : public SalMenuItem diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx index 8c48873..d094a4f 100644 --- a/vcl/unx/gtk/window/gtksalmenu.cxx +++ b/vcl/unx/gtk/window/gtksalmenu.cxx @@ -358,6 +358,141 @@ void GtkSalMenu::UpdateNativeMenu() } g_object_unref( pSubMenuModel ); + } + + g_free( aNativeCommand ); + + ++nItemPos; + ++validItems; + } + + // Delete extra items in last section. + RemoveSpareItemsFromNativeMenu( pLOMenu, &pOldCommandList, nSection, validItems ); + + // Delete extra sections. + RemoveSpareSectionsFromNativeMenu( pLOMenu, &pOldCommandList, nSection ); + + // Delete unused commands. + RemoveUnusedCommands( pActionGroup, pOldCommandList, pNewCommandList ); +} + +static void GenerateFullMenu( GtkSalMenu* pSalMenu ) +{ + SolarMutexGuard aGuard; + //GTK_YIELD_GRAB(); + + if( !pSalMenu || !pSalMenu->PrepUpdate() ) + return; + + Menu* pVCLMenu = pSalMenu->GetMenu(); + GLOMenu* pLOMenu = G_LO_MENU( pSalMenu->GetMenuModel() ); + GLOActionGroup* pActionGroup = G_LO_ACTION_GROUP( pSalMenu->GetActionGroup() ); + GList *pOldCommandList = NULL; + GList *pNewCommandList = NULL; + + sal_uInt16 nLOMenuSize = g_menu_model_get_n_items( G_MENU_MODEL( pLOMenu ) ); + + if ( nLOMenuSize == 0 ) + g_lo_menu_new_section( pLOMenu, 0, NULL ); + + sal_Int32 nSection = 0; + sal_Int32 nItemPos = 0; + sal_Int32 validItems = 0; + sal_Int32 nItem; + + for ( nItem = 0; nItem < ( sal_Int32 ) pSalMenu->GetItemCount(); nItem++ ) { + if ( pSalMenu->IsItemVisible( nItem ) == sal_False ) + continue; + + GtkSalMenuItem *pSalMenuItem = pSalMenu->GetItemAtPos( nItem ); + sal_uInt16 nId = pSalMenuItem->mnId; + + if ( pSalMenuItem->mnType == MENUITEM_SEPARATOR ) + { + // Delete extra items from current section. + RemoveSpareItemsFromNativeMenu( pLOMenu, &pOldCommandList, nSection, validItems ); + + nSection++; + nItemPos = 0; + validItems = 0; + + if ( nLOMenuSize <= nSection ) + { + g_lo_menu_new_section( pLOMenu, nSection, NULL ); + nLOMenuSize++; + } + + continue; + } + + if ( nItemPos >= g_lo_menu_get_n_items_from_section( pLOMenu, nSection ) ) + g_lo_menu_insert_in_section( pLOMenu, nSection, nItemPos, "EMPTY STRING" ); + + // Get internal menu item values. + String aText = pVCLMenu->GetItemText( nId ); + rtl::OUString aCommand( pVCLMenu->GetItemCommand( nId ) ); + sal_Bool itemEnabled = pVCLMenu->IsItemEnabled( nId ); + KeyCode nAccelKey = pVCLMenu->GetAccelKey( nId ); + sal_Bool itemChecked = pVCLMenu->IsItemChecked( nId ); + MenuItemBits itemBits = pVCLMenu->GetItemBits( nId ); + + // Convert internal values to native values. + gboolean bChecked = ( itemChecked == sal_True ) ? TRUE : FALSE; + gboolean bEnabled = ( itemEnabled == sal_True ) ? TRUE : FALSE; +// gchar* aNativeCommand = g_strdup( rtl::OUStringToOString( aCommand, RTL_TEXTENCODING_UTF8 ).getStr() ); + gchar* aNativeCommand = pSalMenu->GetCommandForSpecialItem( pSalMenuItem ); + + // Store current item command in command list. + gchar *aCurrentCommand = g_lo_menu_get_command_from_item_in_section( pLOMenu, nSection, nItemPos ); + + if ( aCurrentCommand != NULL ) + pOldCommandList = g_list_append( pOldCommandList, aCurrentCommand ); + + // Force updating of native menu labels. + pSalMenu->NativeSetItemText( nSection, nItemPos, aText ); + pSalMenu->NativeSetAccelerator( nSection, nItemPos, nAccelKey, nAccelKey.GetName( GetFrame()->GetWindow() ) ); + + // Some items are special, so they have different commands. +// if ( g_strcmp0( aNativeCommand, "" ) == 0 ) + if ( !aNativeCommand ) + { +// gchar *aSpecialItemCmd = GetCommandForSpecialItem( pSalMenuItem ); + aNativeCommand = g_strdup( rtl::OUStringToOString( aCommand, RTL_TEXTENCODING_UTF8 ).getStr() ); + +// if ( aSpecialItemCmd != NULL ) +// { +// g_free( aNativeCommand ); +// aNativeCommand = aSpecialItemCmd; +// } + } + + if ( g_strcmp0( aNativeCommand, "" ) != 0 && pSalMenuItem->mpSubMenu == NULL ) + { + pSalMenu->NativeSetItemCommand( nSection, nItemPos, nId, aNativeCommand, itemBits, bChecked, FALSE ); + pSalMenu->NativeCheckItem( nSection, nItemPos, itemBits, bChecked ); + pSalMenu->NativeSetEnableItem( aNativeCommand, bEnabled ); + + pNewCommandList = g_list_append( pNewCommandList, g_strdup( aNativeCommand ) ); + } + + GtkSalMenu* pSubmenu = pSalMenuItem->mpSubMenu; + + if ( pSubmenu && pSubmenu->GetMenu() ) + { + pSalMenu->NativeSetItemCommand( nSection, nItemPos, nId, aNativeCommand, itemBits, FALSE, TRUE ); + pNewCommandList = g_list_append( pNewCommandList, g_strdup( aNativeCommand ) ); + + GLOMenu* pSubMenuModel = g_lo_menu_get_submenu_from_item_in_section( pLOMenu, nSection, nItemPos ); + + if ( pSubMenuModel == NULL ) + { + //pSubMenuModel = g_lo_menu_new(); + //g_lo_menu_set_submenu_to_item_in_section( pLOMenu, nSection, nItemPos, G_MENU_MODEL( pSubMenuModel ) ); + g_lo_menu_new_submenu_in_item_in_section( pLOMenu, nSection, nItemPos ); + pSubMenuModel = g_lo_menu_get_submenu_from_item_in_section( pLOMenu, nSection, nItemPos ); + } + + g_object_unref( pSubMenuModel ); pSubmenu->SetMenuModel( G_MENU_MODEL( pSubMenuModel ) ); pSubmenu->SetActionGroup( G_ACTION_GROUP( pActionGroup ) ); @@ -365,7 +500,8 @@ void GtkSalMenu::UpdateNativeMenu() pSubmenu->GetMenu()->Activate(); pSubmenu->GetMenu()->Deactivate(); - pSubmenu->UpdateNativeMenu(); + GenerateFullMenu( pSubmenu ); + //pSubmenu->UpdateNativeMenu(); } g_free( aNativeCommand ); @@ -707,7 +843,7 @@ void GtkSalMenu::Activate( const gchar* aMenuCommand ) if ( pSalSubMenu != NULL ) { MenuBar* pMenuBar = static_cast< MenuBar* >( mpVCLMenu ); pMenuBar->HandleMenuActivateEvent( pSalSubMenu->mpVCLMenu ); - pSalSubMenu->UpdateNativeMenu(); + pSalSubMenu->UpdateNativeMenu2(); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits