From 3411a8a23a1cda4fecaaf3dd2b3e83082b6419d0 Mon Sep 17 00:00:00 2001 From: Antonio Fernandez Date: Sun, 26 Aug 2012 20:22:48 +0100 Subject: Menu is correctly displayed in all instances, but HUD remains broken. Change-Id: Ia1089150ae9853649754a4de733ca4a7f8c3caae --- vcl/unx/gtk/window/gloactiongroup.cxx | 5 ++--- vcl/unx/gtk/window/gtksalmenu.cxx | 28 +++++++++++++--------------- 2 files changed, 15 insertions(+), 18 deletions(-) (limited to 'vcl/unx') diff --git a/vcl/unx/gtk/window/gloactiongroup.cxx b/vcl/unx/gtk/window/gloactiongroup.cxx index 39ab45eed577..443c628c8c7b 100644 --- a/vcl/unx/gtk/window/gloactiongroup.cxx +++ b/vcl/unx/gtk/window/gloactiongroup.cxx @@ -39,9 +39,9 @@ using namespace std; #define G_TYPE_LO_ACTION (g_lo_action_get_type ()) #define G_LO_ACTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ - G_TYPE_LO_ACTION, GLOAction)) + G_TYPE_LO_ACTION, GLOAction)) #define G_IS_LO_ACTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ - G_TYPE_LO_ACTION)) + G_TYPE_LO_ACTION)) struct _GLOAction { @@ -161,7 +161,6 @@ g_lo_action_group_query_action (GActionGroup *group, GVariant **state_hint, GVariant **state) { -// cout << __FUNCTION__ << " - " << action_name << " - enabled: " << enabled << " - parameter_type: " << parameter_type << " - state_type: " << state_type << " - state_hint: " << state_hint << " - state: " << state << endl; GLOActionGroup *lo_group = G_LO_ACTION_GROUP (group); GLOAction* action; diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx index 5cc65ebacc97..507849ca41aa 100644 --- a/vcl/unx/gtk/window/gtksalmenu.cxx +++ b/vcl/unx/gtk/window/gtksalmenu.cxx @@ -249,7 +249,7 @@ GtkSalMenu::GtkSalMenu( sal_Bool bMenuBar ) : mpActionGroup( NULL ) { if (bMenuBar) { - mpActionGroup = G_ACTION_GROUP( g_lo_action_group_new() ); +// mpActionGroup = G_ACTION_GROUP( g_lo_action_group_new() ); } mpMenuModel = G_MENU_MODEL( g_lo_menu_new() ); @@ -265,8 +265,11 @@ GtkSalMenu::~GtkSalMenu() if ( mbMenuBar ) { g_source_remove_by_user_data( this ); +// GLOMenu* pMainMenu = G_LO_MENU( g_object_get_data( G_OBJECT( gdkWindow ), "g-lo-menubar" ) ); + g_lo_menu_remove( G_LO_MENU( mpMenuModel ), 0 ); - mpMenuModel = NULL; +// g_lo_menu_remove( pMainMenu, 0 ); +// mpMenuModel = NULL; } else { g_object_unref( mpMenuModel ); } @@ -368,18 +371,13 @@ void GtkSalMenu::SetFrame( const SalFrame* pFrame ) GLOActionGroup* pActionGroup = G_LO_ACTION_GROUP( g_object_get_data( G_OBJECT( gdkWindow ), "g-lo-action-group" ) ); if ( pMainMenu && pActionGroup ) { - // Merge current action group with the exported one - g_lo_action_group_clear( pActionGroup ); - g_lo_action_group_merge( G_LO_ACTION_GROUP( mpActionGroup ), pActionGroup ); - g_lo_action_group_clear( G_LO_ACTION_GROUP( mpActionGroup ) ); - g_object_unref( mpActionGroup ); - - mpActionGroup = G_ACTION_GROUP( pActionGroup ); + g_lo_menu_remove( pMainMenu, 0 ); } else { pMainMenu = g_lo_menu_new(); + pActionGroup = g_lo_action_group_new(); - g_object_set_data_full( G_OBJECT( gdkWindow ), "g-lo-menubar", mpMenuModel, ObjectDestroyedNotify ); - g_object_set_data_full( G_OBJECT( gdkWindow ), "g-lo-action-group", mpActionGroup, ObjectDestroyedNotify ); + g_object_set_data_full( G_OBJECT( gdkWindow ), "g-lo-menubar", pMainMenu, ObjectDestroyedNotify ); + g_object_set_data_full( G_OBJECT( gdkWindow ), "g-lo-action-group", pActionGroup, ObjectDestroyedNotify ); XLIB_Window windowId = GDK_WINDOW_XID( gdkWindow ); @@ -398,12 +396,12 @@ void GtkSalMenu::SetFrame( const SalFrame* pFrame ) // Publish the menu. if ( aDBusMenubarPath ) { - sal_uInt16 menubarId = g_dbus_connection_export_menu_model (pSessionBus, aDBusMenubarPath, mpMenuModel, NULL); + sal_uInt16 menubarId = g_dbus_connection_export_menu_model (pSessionBus, aDBusMenubarPath, G_MENU_MODEL( pMainMenu ), NULL); if(!menubarId) puts("Failed to export menubar"); } if ( aDBusPath ) { - sal_uInt16 actionGroupId = g_dbus_connection_export_action_group( pSessionBus, aDBusPath, mpActionGroup, NULL); + sal_uInt16 actionGroupId = g_dbus_connection_export_action_group( pSessionBus, aDBusPath, G_ACTION_GROUP( pActionGroup ), NULL); if(!actionGroupId) puts("Failed to export action group"); } @@ -413,8 +411,8 @@ void GtkSalMenu::SetFrame( const SalFrame* pFrame ) } // Menubar has only one section, so we put it on the exported menu. -// GMenuModel *pSection = G_MENU_MODEL( g_lo_menu_get_section( G_LO_MENU( mpMenuModel ), 0 ) ); -// g_lo_menu_insert_section( pMainMenu, 0, NULL, pSection ); + g_lo_menu_insert_section( pMainMenu, 0, NULL, mpMenuModel ); + mpActionGroup = G_ACTION_GROUP( pActionGroup ); // UpdateNativeMenu( this ); // UpdateNativeMenu( this ); -- cgit v1.2.3