summaryrefslogtreecommitdiff
path: root/vcl/unx/gtk
diff options
context:
space:
mode:
authorAntonio Fernandez <antonio.fernandez@aentos.es>2012-08-08 20:05:40 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2012-11-14 13:52:40 +0100
commite61bb047cb7056329ee768f788d22e7db5602b85 (patch)
tree7d72a0e79e20e83a0cedf6bd32d4208167f8a0c0 /vcl/unx/gtk
parent36c1c2c2754dda6e8d2b2802e3881465adaafbec (diff)
Some actions are now performed from Unity menubar.
Change-Id: I854794ab11f63306a2e976d16876fc79564e44ff
Diffstat (limited to 'vcl/unx/gtk')
-rw-r--r--vcl/unx/gtk/window/gtksalmenu.cxx39
1 files changed, 33 insertions, 6 deletions
diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx
index 134d5e274140..a7a3ba604ce1 100644
--- a/vcl/unx/gtk/window/gtksalmenu.cxx
+++ b/vcl/unx/gtk/window/gtksalmenu.cxx
@@ -23,12 +23,22 @@ dispatchAction (GSimpleAction *action,
GtkSalMenuItem *pSalMenuItem = static_cast< GtkSalMenuItem* >( user_data );
if ( !pSalMenuItem->mpSubMenu ) {
- if ( !pSalMenuItem->mpVCLMenu->IsMenuBar() ) {
-// ((PopupMenu*) pSalMenuItem->mpVCLMenu)->SetSelectedEntry( pSalMenuItem->mnId );
-// pSalMenuItem->mpVCLMenu->Select();
-// pSalMenuItem->mpVCLMenu->DeSelect();
+ const GtkSalFrame *pFrame = pSalMenuItem->mpParentMenu ? pSalMenuItem->mpParentMenu->getFrame() : NULL;
+
+ if ( pFrame ) {
+ ((PopupMenu*) pSalMenuItem->mpVCLMenu)->SetSelectedEntry( pSalMenuItem->mnId );
+ SalMenuEvent aMenuEvt( pSalMenuItem->mnId, pSalMenuItem->mpVCLMenu );
+ pFrame->CallCallback( SALEVENT_MENUCOMMAND, &aMenuEvt );
}
}
+
+// if ( !pSalMenuItem->mpSubMenu ) {
+// if ( !pSalMenuItem->mpVCLMenu->IsMenuBar() ) {
+//// ((PopupMenu*) pSalMenuItem->mpVCLMenu)->SetSelectedEntry( pSalMenuItem->mnId );
+//// pSalMenuItem->mpVCLMenu->Select();
+//// pSalMenuItem->mpVCLMenu->DeSelect();
+// }
+// }
}
}
@@ -223,6 +233,7 @@ void GtkSalMenu::publishMenu( GMenuModel *pMenu, GActionGroup *pActionGroup )
GtkSalMenu::GtkSalMenu( sal_Bool bMenuBar ) :
mbMenuBar( bMenuBar ),
mpVCLMenu( NULL ),
+ mpParentSalMenu( NULL ),
aDBusMenubarPath( NULL ),
pSessionBus( NULL ),
mpActionEntry( NULL ),
@@ -313,7 +324,13 @@ void GtkSalMenu::SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsig
GtkSalMenuItem *pGtkSalMenuItem = static_cast<GtkSalMenuItem*>( pSalMenuItem );
GtkSalMenu *pGtkSubMenu = static_cast<GtkSalMenu*>( pSubMenu );
- pGtkSalMenuItem->mpSubMenu = pGtkSubMenu;
+ if ( pGtkSubMenu ) {
+ pGtkSalMenuItem->mpSubMenu = pGtkSubMenu;
+
+ if ( !pGtkSubMenu->mpParentSalMenu ) {
+ pGtkSubMenu->mpParentSalMenu = this;
+ }
+ }
}
void GtkSalMenu::SetFrame( const SalFrame* pFrame )
@@ -344,6 +361,14 @@ void GtkSalMenu::SetFrame( const SalFrame* pFrame )
}
}
+const GtkSalFrame* GtkSalMenu::getFrame() const
+{
+ const GtkSalMenu* pMenu = this;
+ while( pMenu && ! pMenu->mpFrame )
+ pMenu = pMenu->mpParentSalMenu;
+ return pMenu ? pMenu->mpFrame : NULL;
+}
+
void GtkSalMenu::CheckItem( unsigned nPos, sal_Bool bCheck )
{
cout << __FUNCTION__ << endl;
@@ -410,7 +435,9 @@ void GtkSalMenu::SetItemCommand( unsigned nPos, SalMenuItem* pSalMenuItem, const
// Disable action by default.
// g_simple_action_set_enabled( pAction, FALSE );
- g_signal_connect(pAction, "activate", G_CALLBACK( dispatchAction ), pGtkSalMenuItem);
+// if ( !pGtkSalMenuItem->mpVCLMenu->GetPopupMenu( pGtkSalMenuItem->mnId ) ) {
+ g_signal_connect(pAction, "activate", G_CALLBACK( dispatchAction ), pGtkSalMenuItem);
+// }
pGtkSalMenuItem->mpAction = G_ACTION( pAction );