summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--framework/inc/uielement/menubarmanager.hxx2
-rw-r--r--framework/inc/uielement/menubarwrapper.hxx1
-rw-r--r--framework/source/uielement/menubarmanager.cxx29
-rw-r--r--framework/source/uielement/menubarwrapper.cxx20
-rw-r--r--vcl/Library_vcl.mk1
-rw-r--r--vcl/Library_vclplug_gtk.mk9
-rw-r--r--vcl/inc/unx/gtk/gtkinst.hxx4
-rw-r--r--vcl/inc/unx/gtk/gtksalmenu.hxx85
-rw-r--r--vcl/inc/unx/salmenu.h8
-rw-r--r--vcl/source/window/menu.cxx62
-rw-r--r--vcl/unx/gtk/app/gtkinst.cxx26
-rw-r--r--vcl/unx/gtk/window/gtksalmenu.cxx219
12 files changed, 453 insertions, 13 deletions
diff --git a/framework/inc/uielement/menubarmanager.hxx b/framework/inc/uielement/menubarmanager.hxx
index 07f352bf3bad..10ca227885a6 100644
--- a/framework/inc/uielement/menubarmanager.hxx
+++ b/framework/inc/uielement/menubarmanager.hxx
@@ -170,6 +170,8 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener
void SetItemContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rItemContainer );
void GetPopupController( PopupControllerCache& rPopupController );
+ void GenerateFullMenuHierarchy( AbstractMenu* pMenu );
+
protected:
DECL_LINK(Highlight, void *);
DECL_LINK( Activate, AbstractMenu * );
diff --git a/framework/inc/uielement/menubarwrapper.hxx b/framework/inc/uielement/menubarwrapper.hxx
index 47bfcce26d02..10ef7991e651 100644
--- a/framework/inc/uielement/menubarwrapper.hxx
+++ b/framework/inc/uielement/menubarwrapper.hxx
@@ -76,6 +76,7 @@ class MenuBarWrapper : public UIConfigElementWrapperBase,
private:
virtual void impl_fillNewData();
void fillPopupControllerCache();
+// void GenerateFullMenuBar( MenuBar *pMenuBar );
sal_Bool m_bRefreshPopupControllerCache : 1;
com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xMenuBarManager;
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 66a34671fae3..33912f35862e 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -885,8 +885,9 @@ IMPL_LINK( MenuBarManager, Activate, AbstractMenu *, pMenu )
( pMenu->GetItemText( nItemId ).Len() == 0 ))
{
String aCommand = pMenu->GetItemCommand( nItemId );
- if ( aCommand.Len() > 0 )
+ if ( aCommand.Len() > 0 ) {
pMenu->SetItemText( nItemId, RetrieveLabelFromCommand( aCommand ));
+ }
}
}
@@ -1026,6 +1027,9 @@ IMPL_LINK( MenuBarManager, Activate, AbstractMenu *, pMenu )
}
}
+ // Freeze the menu
+// m_pVCLMenu->Freeze();
+
return 1;
}
@@ -2122,6 +2126,29 @@ void MenuBarManager::SetHdl()
::comphelper::getComponentContext(mxServiceFactory)) );
}
+void MenuBarManager::GenerateFullMenuHierarchy( AbstractMenu* pMenu )
+{
+ if (pMenu) {
+ for (int i=0; i < pMenu->GetItemCount(); i++)
+ {
+ sal_Int16 nId = pMenu->GetItemId( i );
+
+// this->Activate( pMenu->GetPopupMenu( nId ) );
+// this->Activate(pMenu);
+// this->Deactivate(pMenu);
+
+ String aCommandLabel = pMenu->GetItemCommand( nId );
+ ::rtl::OUString aCommand( aCommandLabel );
+
+ String label = RetrieveLabelFromCommand( aCommandLabel );
+ pMenu->SetItemText( nId, label );
+
+ AddMenu( this, aCommand, nId );
+ GenerateFullMenuHierarchy( pMenu->GetPopupMenu( nId ) );
+ }
+ }
+}
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/uielement/menubarwrapper.cxx b/framework/source/uielement/menubarwrapper.cxx
index 302ab7200412..b1f781d1fddf 100644
--- a/framework/source/uielement/menubarwrapper.cxx
+++ b/framework/source/uielement/menubarwrapper.cxx
@@ -121,6 +121,19 @@ void SAL_CALL MenuBarWrapper::dispose() throw (::com::sun::star::uno::RuntimeExc
m_bDisposed = sal_True;
}
+//void generateFullMenuBar( MenuBarManager *pMenuBarManager, MenuBar *pMenuBar )
+//{
+// for (int i=0; i < pMenuBar->GetItemCount(); i++)
+// {
+// sal_Int16 nId = pMenuBar->GetItemId( i );
+
+// String aCommandLabel = pMenuBar->GetItemCommand( nId );
+
+// String label = pMenuBarManager->RetrieveLabelFromCommand( aCommandLabel );
+// pMenuBar->SetItemText( nId, label );
+// }
+//}
+
// XInitialization
void SAL_CALL MenuBarWrapper::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException )
{
@@ -167,7 +180,6 @@ void SAL_CALL MenuBarWrapper::initialize( const Sequence< Any >& aArguments ) th
// Fill menubar with container contents
sal_uInt16 nId = 1;
MenuBarManager::FillMenuWithConfiguration( nId, pVCLMenuBar, aModuleIdentifier, m_xConfigData, xTrans );
-// pVCLMenuBar->Freeze();
}
}
catch ( const NoSuchElementException& )
@@ -203,15 +215,15 @@ void SAL_CALL MenuBarWrapper::initialize( const Sequence< Any >& aArguments ) th
sal_True );
m_xMenuBarManager = Reference< XComponent >( static_cast< OWeakObject *>( pMenuBarManager ), UNO_QUERY );
+
+// pMenuBarManager->GenerateFullMenuHierarchy( pVCLMenuBar );
+ pVCLMenuBar->Freeze();
}
// Initialize toolkit menu bar implementation to have awt::XMenuBar for data exchange.
// Don't use this toolkit menu bar or one of its functions. It is only used as a data container!
pAwtMenuBar = new VCLXMenuBar( pVCLMenuBar );
m_xMenuBar = Reference< XMenuBar >( static_cast< OWeakObject *>( pAwtMenuBar ), UNO_QUERY );
-
- // Freeze the menubar
- pVCLMenuBar->Freeze();
}
}
}
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 18592d4e146d..d62af493d4e4 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -97,6 +97,7 @@ $(eval $(call gb_Library_use_externals,vcl,\
icule \
icuuc \
lcms2 \
+ gio \
))
$(eval $(call gb_Library_add_exception_objects,vcl,\
diff --git a/vcl/Library_vclplug_gtk.mk b/vcl/Library_vclplug_gtk.mk
index 8d80962e16a7..9414326a26a1 100644
--- a/vcl/Library_vclplug_gtk.mk
+++ b/vcl/Library_vclplug_gtk.mk
@@ -89,10 +89,11 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_gtk,\
vcl/unx/gtk/gdi/salnativewidgets-gtk \
vcl/unx/gtk/window/gtkframe \
vcl/unx/gtk/window/gtkobject \
- vcl/unx/gtk/fpicker/resourceprovider \
- vcl/unx/gtk/fpicker/SalGtkPicker \
- vcl/unx/gtk/fpicker/SalGtkFilePicker \
- vcl/unx/gtk/fpicker/SalGtkFolderPicker \
+ vcl/unx/gtk/window/gtksalmenu \
+ vcl/unx/gtk/fpicker/resourceprovider \
+ vcl/unx/gtk/fpicker/SalGtkPicker \
+ vcl/unx/gtk/fpicker/SalGtkFilePicker \
+ vcl/unx/gtk/fpicker/SalGtkFolderPicker \
))
ifeq ($(ENABLE_GTK_PRINT),TRUE)
diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
index ad63d4a3b4b2..d4eb4cd6dc53 100644
--- a/vcl/inc/unx/gtk/gtkinst.hxx
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
@@ -104,6 +104,10 @@ public:
virtual SalSystem* CreateSalSystem();
virtual SalInfoPrinter* CreateInfoPrinter(SalPrinterQueueInfo* pPrinterQueueInfo, ImplJobSetup* pJobSetup);
virtual SalPrinter* CreatePrinter( SalInfoPrinter* pInfoPrinter );
+ virtual SalMenu* CreateMenu( sal_Bool, Menu* );
+ virtual void DestroyMenu( SalMenu* pMenu );
+ virtual SalMenuItem* CreateMenuItem( const SalItemParams* );
+ virtual void DestroyMenuItem( SalMenuItem* pItem );
virtual SalTimer* CreateSalTimer();
virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType);
virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics*,
diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx
new file mode 100644
index 000000000000..c925a99da960
--- /dev/null
+++ b/vcl/inc/unx/gtk/gtksalmenu.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef GTKSALMENU_HXX
+#define GTKSALMENU_HXX
+
+#include <vcl/sv.h>
+#include <vcl/bitmap.hxx>
+#include <unx/gtk/gtkframe.hxx>
+#include <unx/salmenu.h>
+#include <gio/gio.h>
+
+
+class GtkSalMenu : public SalMenu
+{
+private:
+ sal_Bool mbMenuBar;
+
+public:
+ Menu* mpVCLMenu;
+ const GtkSalFrame* mpFrame;
+ GMenuModel* mpParentMenuModel;
+ GMenuModel* mpMenuModel;
+ gchar* aDBusMenubarPath;
+ GDBusConnection* pSessionBus;
+
+ GtkSalMenu( sal_Bool bMenuBar );
+ virtual ~GtkSalMenu();
+
+ virtual sal_Bool VisibleMenuBar(); // must return TRUE to actually DISPLAY native menu bars
+ // otherwise only menu messages are processed (eg, OLE on Windows)
+
+ virtual void InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos );
+ virtual void RemoveItem( unsigned nPos );
+ virtual void SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos );
+ virtual void SetFrame( const SalFrame* pFrame );
+ virtual void CheckItem( unsigned nPos, sal_Bool bCheck );
+ virtual void EnableItem( unsigned nPos, sal_Bool bEnable );
+ virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const rtl::OUString& rText );
+ virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage);
+ virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const KeyCode& rKeyCode, const rtl::OUString& rKeyName );
+ virtual void GetSystemMenuData( SystemMenuData* pData );
+};
+
+class GtkSalMenuItem : public SalMenuItem
+{
+public:
+ GtkSalMenuItem( const SalItemParams* );
+ virtual ~GtkSalMenuItem();
+
+ sal_uInt16 mnId; // Item ID
+ Menu* mpVCLMenu; // VCL Menu into which this MenuItem is inserted
+ GtkSalMenu* mpParentMenu; // The menu in which this menu item is inserted
+ GtkSalMenu* mpSubMenu; // Sub menu of this item (if defined)
+ GMenuItem* mpMenuItem; // The GMenuItem
+};
+
+#endif // GTKSALMENU_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/salmenu.h b/vcl/inc/unx/salmenu.h
index 9fae46a9be6c..0daf6ebe591f 100644
--- a/vcl/inc/unx/salmenu.h
+++ b/vcl/inc/unx/salmenu.h
@@ -22,7 +22,7 @@
#include <tools/solar.h>
#include <vcl/bitmap.hxx>
-#include <vcl/salmenu.hxx>
+#include <salmenu.hxx>
class X11SalMenu : public SalMenu
@@ -31,15 +31,15 @@ public:
X11SalMenu() {}
virtual ~X11SalMenu();
- virtual BOOL VisibleMenuBar(); // must return TRUE to actually DISPLAY native menu bars
+ virtual sal_Bool VisibleMenuBar(); // must return TRUE to actually DISPLAY native menu bars
// otherwise only menu messages are processed (eg, OLE on Windows)
virtual void InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos );
virtual void RemoveItem( unsigned nPos );
virtual void SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos );
virtual void SetFrame( const SalFrame* pFrame );
- virtual void CheckItem( unsigned nPos, BOOL bCheck );
- virtual void EnableItem( unsigned nPos, BOOL bEnable );
+ virtual void CheckItem( unsigned nPos, sal_Bool bCheck );
+ virtual void EnableItem( unsigned nPos, sal_Bool bEnable );
virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const rtl::OUString& rText );
virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage);
virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const KeyCode& rKeyCode, const rtl::OUString& rKeyName );
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index a759dfe03727..103719a54659 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -6040,8 +6040,66 @@ ImplMenuDelData::~ImplMenuDelData()
}
#include <iostream>
+#include <gio/gio.h>
+
using namespace std;
+GMenu* generateMenuBar( AbstractMenu *pMenu )
+{
+ GMenu *menu = g_menu_new();
+
+ g_menu_append(menu, "Submenu1", NULL);
+
+ return menu;
+}
+
+#define BUS_NAME "org.libreoffice.LibreOffice"
+#define OBJ_PATH "/org/libreoffice/LibreOffice"
+
+void publishMenu( GMenuModel *menu )
+{
+ GActionGroup *group;
+ GDBusConnection *bus;
+ GError *error = NULL;
+ gchar *path;
+ guint id;
+
+ bus = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL);
+ group = G_ACTION_GROUP( g_simple_action_group_new() );
+
+ // g_print ("Exporting menus on the bus...\n");
+ // if (!g_dbus_connection_export_menu_model (bus, OBJ_PATH, menu, &error))
+ // {
+ // g_warning ("Menu export failed: %s", error->message);
+ // exit (1);
+ // }
+ // g_print ("Exporting actions on the bus...\n");
+ // if (!g_dbus_connection_export_action_group (bus, OBJ_PATH, group, &error))
+ // {
+ // g_warning ("Action export failed: %s", error->message);
+ // exit (1);
+ // }
+
+ g_bus_own_name_on_connection (bus, BUS_NAME, G_BUS_NAME_OWNER_FLAGS_NONE, NULL, NULL, NULL, NULL);
+
+
+ /* export the new menu, if there is one */
+ if (menu != NULL)
+ {
+ /* try getting the preferred name */
+ path = g_strconcat (OBJ_PATH, "/menus/", "menubar", NULL);
+ id = g_dbus_connection_export_menu_model (bus, path, menu, NULL);
+
+ /* keep trying until we get a working name... */
+ for (int i = 0; id == 0; i++)
+ {
+ g_free (path);
+ path = g_strdup_printf ("%s/menus/%s%d",OBJ_PATH, "menubar", i);
+ id = g_dbus_connection_export_menu_model (bus, path, menu, NULL);
+ }
+ }
+}
+
void printMenu( AbstractMenu* pMenu ) {
if ( pMenu ) {
sal_uInt16 itemCount = pMenu->GetItemCount();
@@ -6060,6 +6118,7 @@ void printMenu( AbstractMenu* pMenu ) {
if (itemData->pSubMenu) {
cout << ">> SUBMENU <<" << endl;
+ itemData->pSubMenu->Activate();
printMenu( itemData->pSubMenu );
}
}
@@ -6069,6 +6128,9 @@ void printMenu( AbstractMenu* pMenu ) {
void Menu::Freeze() {
printMenu( this );
+
+// GMenuModel *menu = G_MENU_MODEL( generateMenuBar(this) );
+// publishMenu( menu );
cout << "============================================================" << endl;
}
diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx
index a551d908d808..40cd21380e2a 100644
--- a/vcl/unx/gtk/app/gtkinst.cxx
+++ b/vcl/unx/gtk/app/gtkinst.cxx
@@ -29,6 +29,7 @@
#include <unx/gtk/gtkobject.hxx>
#include <unx/gtk/atkbridge.hxx>
#include <unx/gtk/gtkprn.hxx>
+#include <unx/gtk/gtksalmenu.hxx>
#include <headless/svpvd.hxx>
#include <headless/svpbmp.hxx>
#include <vcl/apptypes.hxx>
@@ -509,6 +510,31 @@ SalBitmap* GtkInstance::CreateSalBitmap()
#endif
}
+SalMenu* GtkInstance::CreateMenu( sal_Bool bMenuBar, Menu* pVCLMenu )
+{
+ GtkSalMenu *pSalMenu = new GtkSalMenu( bMenuBar );
+ pSalMenu->mpVCLMenu = pVCLMenu;
+
+ return static_cast<SalMenu*>( pSalMenu );
+}
+
+void GtkInstance::DestroyMenu( SalMenu* pMenu )
+{
+ (void)pMenu;
+ OSL_ENSURE( pMenu == 0, "DestroyMenu called with non-native menus" );
+}
+
+SalMenuItem* GtkInstance::CreateMenuItem( const SalItemParams* )
+{
+ return NULL;
+}
+
+void GtkInstance::DestroyMenuItem( SalMenuItem* pItem )
+{
+ (void)pItem;
+ OSL_ENSURE( pItem == 0, "DestroyMenu called with non-native menus" );
+}
+
SalTimer* GtkInstance::CreateSalTimer()
{
GtkSalTimer *pTimer = new GtkSalTimer();
diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx
new file mode 100644
index 000000000000..823a9c62152d
--- /dev/null
+++ b/vcl/unx/gtk/window/gtksalmenu.cxx
@@ -0,0 +1,219 @@
+
+#include "unx/gtk/gtksalmenu.hxx"
+
+#include <gtk/gtk.h>
+#include <iostream>
+
+using namespace std;
+
+
+//const GtkSalMenu * GtkSalMenu::pCurrentMenubar = NULL;
+
+#define BUS_NAME "org.gtk.LibreOffice"
+#define OBJ_PATH "/org/gtk/LibreOffice"
+
+static void
+quit (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ exit(1);
+}
+
+void publishMenu( GtkSalMenu* pMenu )
+{
+ GActionGroup *group;
+ GDBusConnection *bus;
+ GError *error = NULL;
+ gchar *path;
+ guint id;
+
+ if (pMenu->pSessionBus && pMenu->aDBusMenubarPath) {
+ GSimpleActionGroup *simpleGroup = g_simple_action_group_new();
+// GSimpleAction *action = g_simple_action_new("quit" );
+// g_simple_action_group_insert( simpleGroup, G_ACTION( action ) );
+
+ group = G_ACTION_GROUP( simpleGroup );
+
+
+ g_print ("Exporting menus on the bus...\n");
+// path = g_strconcat (OBJ_PATH, "/menus/", "menubar", NULL);
+ if (!g_dbus_connection_export_menu_model (pMenu->pSessionBus, pMenu->aDBusMenubarPath, pMenu->mpMenuModel, &error))
+ {
+ g_warning ("Menu export failed: %s", error->message);
+ // exit (1);
+ }
+ g_print ("Exporting actions on the bus...\n");
+ if (!g_dbus_connection_export_action_group (pMenu->pSessionBus, OBJ_PATH, group, &error))
+ {
+ g_warning ("Action export failed: %s", error->message);
+ // exit (1);
+ }
+
+ g_bus_own_name_on_connection (pMenu->pSessionBus, BUS_NAME, G_BUS_NAME_OWNER_FLAGS_NONE, NULL, NULL, NULL, NULL);
+ }
+}
+
+void
+gdk_x11_window_set_utf8_property (GdkWindow *window,
+ const gchar *name,
+ const gchar *value)
+{
+ GdkDisplay *display;
+
+ //if (!WINDOW_IS_TOPLEVEL (window))
+ //return;
+
+ display = gdk_window_get_display (window);
+
+ if (value != NULL)
+ {
+ XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
+ GDK_WINDOW_XID (window),
+ gdk_x11_get_xatom_by_name_for_display (display, name),
+ gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING"), 8,
+ PropModeReplace, (guchar *)value, strlen (value));
+ }
+ else
+ {
+ XDeleteProperty (GDK_DISPLAY_XDISPLAY (display),
+ GDK_WINDOW_XID (window),
+ gdk_x11_get_xatom_by_name_for_display (display, name));
+ }
+}
+
+GtkSalMenu::GtkSalMenu( sal_Bool bMenuBar ) :
+ mbMenuBar( bMenuBar ),
+ mpVCLMenu( NULL ),
+ mpParentMenuModel( NULL ),
+ aDBusMenubarPath( NULL ),
+ pSessionBus( NULL )
+{
+ mpMenuModel = G_MENU_MODEL( g_menu_new() );
+
+ if (bMenuBar) {
+// pSessionBus = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL);
+
+// aDBusMenubarPath = g_strconcat (OBJ_PATH, "/menus/", "menubar", NULL);
+
+// GMenu *menu = G_MENU( mpMenuModel );
+
+// g_menu_append( menu, "Menu1", "app.quit");
+
+// publishMenu( this );
+ }
+}
+
+GtkSalMenu::~GtkSalMenu()
+{
+ g_object_unref( mpMenuModel );
+ g_object_unref( mpParentMenuModel );
+}
+
+sal_Bool GtkSalMenu::VisibleMenuBar()
+{
+ return sal_False;
+}
+
+void GtkSalMenu::InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos )
+{
+ cout << __FUNCTION__ << endl;
+}
+
+void GtkSalMenu::RemoveItem( unsigned nPos )
+{
+ cout << __FUNCTION__ << endl;
+}
+
+void GtkSalMenu::SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos )
+{
+ cout << __FUNCTION__ << endl;
+}
+
+void GtkSalMenu::SetFrame( const SalFrame* pFrame )
+{
+ cout << __FUNCTION__ << endl;
+
+ mpFrame = static_cast<const GtkSalFrame*>( pFrame );
+
+ GtkWidget *widget = GTK_WIDGET( mpFrame->getWindow() );
+
+ GdkWindow *gdkWindow = gtk_widget_get_window( widget );
+
+ if (gdkWindow) {
+ gdk_x11_window_set_utf8_property (gdkWindow, "_GTK_APPLICATION_ID", "org.libreoffice");
+ gdk_x11_window_set_utf8_property (gdkWindow, "_GTK_UNIQUE_BUS_NAME", "org.libreoffice");
+ gdk_x11_window_set_utf8_property (gdkWindow, "_GTK_APPLICATION_OBJECT_PATH", "/org/libreoffice");
+ gdk_x11_window_set_utf8_property (gdkWindow, "_GTK_WINDOW_OBJECT_PATH", "/org/libreoffice/windows");
+// gdk_x11_window_set_utf8_property (gdkWindow, "_GTK_APP_MENU_OBJECT_PATH", "/org/libreoffice/menus/appmenu");
+ gdk_x11_window_set_utf8_property (gdkWindow, "_GTK_MENUBAR_OBJECT_PATH", "/org/libreoffice/menus/menubar");
+
+ GMenu *menu = g_menu_new ();
+ // g_menu_append (menu, "Add", "app.add");
+ // g_menu_append (menu, "Del", "app.del");
+ g_menu_append (menu, "Quit", "app.quit");
+
+ GDBusConnection *bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
+ if(!bus) puts ("Fail bus get");
+ guint bid = g_bus_own_name_on_connection (bus, "org.libreoffice", G_BUS_NAME_OWNER_FLAGS_NONE, NULL, NULL, NULL, NULL);
+ if(!bid) puts ("Fail own name");
+
+ guint appmenuID = g_dbus_connection_export_menu_model (bus, "/org/libreoffice/menus/appmenu", G_MENU_MODEL (menu), NULL);
+ if(!appmenuID) puts("Fail export appmenu");
+ guint menubarID = g_dbus_connection_export_menu_model (bus, "/org/libreoffice/menus/menubar", G_MENU_MODEL (menu), NULL);
+ if(!menubarID) puts("Fail export menubar");
+
+ g_object_unref (menu);
+ }
+}
+
+void GtkSalMenu::CheckItem( unsigned nPos, sal_Bool bCheck )
+{
+ cout << __FUNCTION__ << endl;
+}
+
+void GtkSalMenu::EnableItem( unsigned nPos, sal_Bool bEnable )
+{
+ cout << __FUNCTION__ << endl;
+}
+
+void GtkSalMenu::SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const rtl::OUString& rText )
+{
+ cout << __FUNCTION__ << endl;
+}
+
+void GtkSalMenu::SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage)
+{
+ cout << __FUNCTION__ << endl;
+}
+
+void GtkSalMenu::SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const KeyCode& rKeyCode, const rtl::OUString& rKeyName )
+{
+ cout << __FUNCTION__ << endl;
+}
+
+void GtkSalMenu::GetSystemMenuData( SystemMenuData* pData )
+{
+ cout << __FUNCTION__ << endl;
+}
+
+// =======================================================================
+
+/*
+ * GtkSalMenuItem
+ */
+
+GtkSalMenuItem::GtkSalMenuItem( const SalItemParams* pItemData ) :
+ mnId( pItemData->nId ),
+ mpVCLMenu( pItemData->pMenu ),
+ mpParentMenu( NULL ),
+ mpSubMenu( NULL ),
+ mpMenuItem( NULL )
+{
+ mpMenuItem = g_menu_item_new("", NULL);
+}
+
+GtkSalMenuItem::~GtkSalMenuItem()
+{
+ g_object_unref( mpMenuItem );
+}