summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2012-10-01 08:18:11 +0200
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2012-11-14 13:52:52 +0100
commitf9694d884409021e1b8995392b64acdd01658733 (patch)
tree5a81c25c442c535e8feeb5f44a711c1eae73b4b9
parent3a324cd0d8b00b7b6c28225dbba9d88d3f8ded71 (diff)
remove UpdateNativeMenu2 and clear remove submenus on updates
-rw-r--r--vcl/inc/unx/gtk/gtksalmenu.hxx3
-rw-r--r--vcl/unx/gtk/window/gtksalmenu.cxx19
2 files changed, 9 insertions, 13 deletions
diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx
index abcbcae62c73..c798d418ed72 100644
--- a/vcl/inc/unx/gtk/gtksalmenu.hxx
+++ b/vcl/inc/unx/gtk/gtksalmenu.hxx
@@ -104,8 +104,7 @@ public:
void Deactivate( const gchar* aMenuCommand );
void DisconnectFrame();
void UpdateNativeMenu();
- void UpdateNativeMenu2();
- bool CanUpdate();
+ bool PrepUpdate();
};
class GtkSalMenuItem : public SalMenuItem
diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx
index 19706989bb48..6a5238c5e248 100644
--- a/vcl/unx/gtk/window/gtksalmenu.cxx
+++ b/vcl/unx/gtk/window/gtksalmenu.cxx
@@ -75,7 +75,7 @@ rtl::OUString GetGtkKeyName( rtl::OUString keyName )
return aGtkKeyName;
}
-bool GtkSalMenu::CanUpdate()
+bool GtkSalMenu::PrepUpdate()
{
const GtkSalFrame* pFrame = GetFrame();
if (!pFrame)
@@ -101,14 +101,9 @@ bool GtkSalMenu::CanUpdate()
return true;
}
-void GtkSalMenu::UpdateNativeMenu2()
-{
- UpdateNativeMenu();
-}
-
void GtkSalMenu::UpdateNativeMenu( )
{
- if(!CanUpdate())
+ if(!PrepUpdate())
return;
Menu* pVCLMenu = GetMenu();
GLOMenu* pLOMenu = G_LO_MENU( GetMenuModel() );
@@ -182,13 +177,11 @@ void GtkSalMenu::UpdateNativeMenu( )
}
GtkSalMenu* pSubmenu = pSalMenuItem->mpSubMenu;
+ GLOMenu* pSubMenuModel = g_lo_menu_get_submenu_from_item_in_section( pLOMenu, nSection, nItemPos );
if ( pSubmenu && pSubmenu->GetMenu() )
{
NativeSetItemCommand( nSection, nItemPos, nId, aNativeCommand, itemBits, FALSE, TRUE );
-
- GLOMenu* pSubMenuModel = g_lo_menu_get_submenu_from_item_in_section( pLOMenu, nSection, nItemPos );
-
if ( pSubMenuModel == NULL )
{
pSubMenuModel = g_lo_menu_new();
@@ -204,6 +197,10 @@ void GtkSalMenu::UpdateNativeMenu( )
pSubmenu->SetActionGroup( pActionGroup );
pSubmenu->UpdateNativeMenu();
}
+ else if (pSubMenuModel)
+ {
+ g_lo_menu_set_submenu_to_item_in_section( pLOMenu, nSection, nItemPos, NULL );
+ };
g_free( aNativeCommand );
@@ -520,7 +517,7 @@ void GtkSalMenu::Activate( const gchar* aMenuCommand )
if ( pSalSubMenu != NULL ) {
pSalSubMenu->mpVCLMenu->Activate();
- pSalSubMenu->UpdateNativeMenu2();
+ pSalSubMenu->UpdateNativeMenu();
}
}