vcl/inc/unx/gtk/gtkframe.hxx | 2 vcl/unx/gtk/gtksalframe.cxx | 157 ------------------------------------------ vcl/unx/gtk3/gtk3gtkframe.cxx | 155 ----------------------------------------- 3 files changed, 4 insertions(+), 310 deletions(-)
New commits: commit c5db5d32074efc811ea2bd9432c619d8d40792bb Author: Arkadiy Illarionov <qar...@gmail.com> AuthorDate: Sun Mar 17 14:08:01 2019 +0300 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Wed Mar 20 17:10:40 2019 +0100 Resolves: tdf#119996 remove support for GNOME Shell application menu Change-Id: If107a43f34eb13b215d2ebf285fbe3f8d1848b88 Reviewed-on: https://gerrit.libreoffice.org/69362 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx index d67046a940ae..9d4f458a75ae 100644 --- a/vcl/inc/unx/gtk/gtkframe.hxx +++ b/vcl/inc/unx/gtk/gtkframe.hxx @@ -358,9 +358,7 @@ public: GtkSalFrame( SystemParentData* pSysData ); guint m_nMenuExportId; - guint m_nAppMenuExportId; guint m_nActionGroupExportId; - guint m_nAppActionGroupExportId; guint m_nHudAwarenessId; std::vector<gulong> m_aMouseSignalIds; diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx index 7e64f9545d86..cdb07829976e 100644 --- a/vcl/unx/gtk/gtksalframe.cxx +++ b/vcl/unx/gtk/gtksalframe.cxx @@ -22,7 +22,6 @@ #include <unx/gtk/gtkinst.hxx> #include <unx/gtk/gtkgdi.hxx> #include <unx/gtk/gtksalmenu.hxx> -#include <vcl/help.hxx> #include <vcl/keycodes.hxx> #include <vcl/layout.hxx> #include <unx/wmadaptor.hxx> @@ -69,17 +68,11 @@ # include <cstdio> #endif -#include <comphelper/processfactory.hxx> -#include <comphelper/sequenceashashmap.hxx> #include <com/sun/star/accessibility/XAccessibleContext.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/XAccessibleStateSet.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/XAccessibleEditableText.hpp> -#include <com/sun/star/frame/Desktop.hpp> -#include <com/sun/star/frame/ModuleManager.hpp> -#include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/util/URLTransformer.hpp> #include <config_folders.h> @@ -518,73 +511,6 @@ static void hud_activated( gboolean hud_active, gpointer user_data ) } } -static void activate_uno(GSimpleAction *action, GVariant*, gpointer) -{ - uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - - uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( xContext ); - - uno::Reference < css::frame::XFrame > xFrame(xDesktop->getActiveFrame()); - if (!xFrame.is()) - xFrame.set(xDesktop, uno::UNO_QUERY); - - if (!xFrame.is()) - return; - - uno::Reference< css::frame::XDispatchProvider > xDispatchProvider(xFrame, uno::UNO_QUERY); - if (!xDispatchProvider.is()) - return; - - gchar *strval = nullptr; - g_object_get(action, "name", &strval, nullptr); - if (!strval) - return; - - if (strcmp(strval, "New") == 0) - { - g_free(strval); - - uno::Reference<frame::XModuleManager2> xModuleManager(frame::ModuleManager::create(xContext)); - OUString aModuleId(xModuleManager->identify(xFrame)); - if (aModuleId.isEmpty()) - return; - - comphelper::SequenceAsHashMap lModuleDescription(xModuleManager->getByName(aModuleId)); - OUString sFactoryService; - lModuleDescription[OUString("ooSetupFactoryEmptyDocumentURL")] >>= sFactoryService; - if (sFactoryService.isEmpty()) - return; - - uno::Sequence < css::beans::PropertyValue > args(0); - xDesktop->loadComponentFromURL(sFactoryService, "_blank", 0, args); - return; - } - - OUString sCommand(".uno:"); - sCommand += OUString(strval, strlen(strval), RTL_TEXTENCODING_UTF8); - g_free(strval); - - css::util::URL aCommand; - aCommand.Complete = sCommand; - uno::Reference< css::util::XURLTransformer > xParser = css::util::URLTransformer::create(xContext); - xParser->parseStrict(aCommand); - - uno::Reference< css::frame::XDispatch > xDisp = xDispatchProvider->queryDispatch(aCommand, OUString(), 0); - - if (!xDisp.is()) - return; - - xDisp->dispatch(aCommand, css::uno::Sequence< css::beans::PropertyValue >()); -} - -static const GActionEntry app_entries[] = { - { "OptionsTreeDialog", activate_uno, nullptr, nullptr, nullptr, {0} }, - { "About", activate_uno, nullptr, nullptr, nullptr, {0} }, - { "HelpIndex", activate_uno, nullptr, nullptr, nullptr, {0} }, - { "Quit", activate_uno, nullptr, nullptr, nullptr, {0} }, - { "New", activate_uno, nullptr, nullptr, nullptr, {0} } -}; - static gboolean ensure_dbus_setup( gpointer data ) { GtkSalFrame* pSalFrame = static_cast< GtkSalFrame* >( data ); @@ -626,83 +552,8 @@ static gboolean ensure_dbus_setup( gpointer data ) pSalFrame->m_nActionGroupExportId = g_dbus_connection_export_action_group( pSessionBus, aDBusWindowPath, pActionGroup, nullptr); pSalFrame->m_nHudAwarenessId = hud_awareness_register( pSessionBus, aDBusMenubarPath, hud_activated, pSalFrame, nullptr, nullptr ); - // fdo#70885 we don't want app menu under Unity - bool bDesktopIsUnity = (SalGetDesktopEnvironment() == "UNITY"); - - if (!bDesktopIsUnity) - gdk_x11_window_set_utf8_property( gdkWindow, "_GTK_APP_MENU_OBJECT_PATH", "/org/libreoffice/menus/appmenu" ); - - //app menu, to-do translations, block normal menus when active, honor use appmenu settings - if (!bDesktopIsUnity ) - { - GMenu *menu = g_menu_new (); - GMenuItem* item; - - GMenu *firstsubmenu = g_menu_new (); - - OString sNew(OUStringToOString(VclResId(SV_BUTTONTEXT_NEW), - RTL_TEXTENCODING_UTF8).replaceFirst("~", "_")); - - item = g_menu_item_new(sNew.getStr(), "app.New"); - g_menu_append_item( firstsubmenu, item ); - g_object_unref(item); - - g_menu_append_section( menu, nullptr, G_MENU_MODEL(firstsubmenu)); - g_object_unref(firstsubmenu); - - GMenu *secondsubmenu = g_menu_new (); - - OString sPreferences(OUStringToOString(VclResId(SV_STDTEXT_PREFERENCES), - RTL_TEXTENCODING_UTF8).replaceFirst("~", "_")); - - item = g_menu_item_new(sPreferences.getStr(), "app.OptionsTreeDialog"); - g_menu_append_item( secondsubmenu, item ); - g_object_unref(item); - - g_menu_append_section( menu, nullptr, G_MENU_MODEL(secondsubmenu)); - g_object_unref(secondsubmenu); - - GMenu *thirdsubmenu = g_menu_new (); - - OString sHelp(OUStringToOString(VclResId(SV_BUTTONTEXT_HELP), - RTL_TEXTENCODING_UTF8).replaceFirst("~", "_")); - - item = g_menu_item_new(sHelp.getStr(), "app.HelpIndex"); - g_menu_append_item( thirdsubmenu, item ); - g_object_unref(item); - - OString sAbout(OUStringToOString(VclResId(SV_STDTEXT_ABOUT), - RTL_TEXTENCODING_UTF8).replaceFirst("~", "_")); - - item = g_menu_item_new(sAbout.getStr(), "app.About"); - g_menu_append_item( thirdsubmenu, item ); - g_object_unref(item); - - OString sQuit(OUStringToOString(VclResId(SV_MENU_MAC_QUITAPP), - RTL_TEXTENCODING_UTF8).replaceFirst("~", "_")); - - item = g_menu_item_new(sQuit.getStr(), "app.Quit"); - g_menu_append_item( thirdsubmenu, item ); - g_object_unref(item); - g_menu_append_section( menu, nullptr, G_MENU_MODEL(thirdsubmenu)); - g_object_unref(thirdsubmenu); - - GSimpleActionGroup *group = g_simple_action_group_new (); -#if GLIB_CHECK_VERSION(2,38,0) // g_simple_action_group_add_entries is deprecated since 2.38 - g_action_map_add_action_entries (G_ACTION_MAP (group), app_entries, G_N_ELEMENTS (app_entries), nullptr); -#else - g_simple_action_group_add_entries (group, app_entries, G_N_ELEMENTS (app_entries), NULL); -#endif - GActionGroup* pAppActionGroup = G_ACTION_GROUP(group); - - pSalFrame->m_nAppActionGroupExportId = g_dbus_connection_export_action_group( pSessionBus, "/org/libreoffice", pAppActionGroup, nullptr); - g_object_unref(pAppActionGroup); - pSalFrame->m_nAppMenuExportId = g_dbus_connection_export_menu_model (pSessionBus, "/org/libreoffice/menus/appmenu", G_MENU_MODEL (menu), nullptr); - g_object_unref(menu); - } - - g_free( aDBusMenubarPath ); g_free( aDBusWindowPath ); + g_free( aDBusMenubarPath ); } return FALSE; @@ -825,12 +676,8 @@ GtkSalFrame::~GtkSalFrame() hud_awareness_unregister( pSessionBus, m_nHudAwarenessId ); if ( m_nMenuExportId ) g_dbus_connection_unexport_menu_model( pSessionBus, m_nMenuExportId ); - if ( m_nAppMenuExportId ) - g_dbus_connection_unexport_menu_model( pSessionBus, m_nAppMenuExportId ); if ( m_nActionGroupExportId ) g_dbus_connection_unexport_action_group( pSessionBus, m_nActionGroupExportId ); - if ( m_nAppActionGroupExportId ) - g_dbus_connection_unexport_action_group( pSessionBus, m_nAppActionGroupExportId ); } #endif gtk_widget_destroy( m_pWindow ); @@ -971,9 +818,7 @@ void GtkSalFrame::InitCommon() m_pSalMenu = nullptr; m_nWatcherId = 0; m_nMenuExportId = 0; - m_nAppMenuExportId = 0; m_nActionGroupExportId = 0; - m_nAppActionGroupExportId = 0; m_nHudAwarenessId = 0; gtk_widget_add_events( m_pWindow, diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx index 8de0b605b916..b1311e207386 100644 --- a/vcl/unx/gtk3/gtk3gtkframe.cxx +++ b/vcl/unx/gtk3/gtk3gtkframe.cxx @@ -23,7 +23,6 @@ #include <unx/gtk/gtkgdi.hxx> #include <unx/gtk/gtksalmenu.hxx> #include <unx/gtk/hudawareness.h> -#include <vcl/help.hxx> #include <vcl/keycodes.hxx> #include <vcl/layout.hxx> #include <unx/wmadaptor.hxx> @@ -75,8 +74,6 @@ #include <cstdlib> #include <cmath> -#include <comphelper/processfactory.hxx> -#include <comphelper/sequenceashashmap.hxx> #include <com/sun/star/accessibility/XAccessibleContext.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/XAccessibleStateSet.hpp> @@ -84,10 +81,6 @@ #include <com/sun/star/accessibility/XAccessibleEditableText.hpp> #include <com/sun/star/awt/MouseButton.hpp> #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> -#include <com/sun/star/frame/Desktop.hpp> -#include <com/sun/star/frame/ModuleManager.hpp> -#include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/util/URLTransformer.hpp> #include <config_folders.h> @@ -522,73 +515,6 @@ static void hud_activated( gboolean hud_active, gpointer user_data ) } } -static void activate_uno(GSimpleAction *action, GVariant*, gpointer) -{ - uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - - uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( xContext ); - - uno::Reference < css::frame::XFrame > xFrame(xDesktop->getActiveFrame()); - if (!xFrame.is()) - xFrame.set(xDesktop, uno::UNO_QUERY); - - if (!xFrame.is()) - return; - - uno::Reference< css::frame::XDispatchProvider > xDispatchProvider(xFrame, uno::UNO_QUERY); - if (!xDispatchProvider.is()) - return; - - gchar *strval = nullptr; - g_object_get(action, "name", &strval, nullptr); - if (!strval) - return; - - if (strcmp(strval, "New") == 0) - { - g_free(strval); - - uno::Reference<frame::XModuleManager2> xModuleManager(frame::ModuleManager::create(xContext)); - OUString aModuleId(xModuleManager->identify(xFrame)); - if (aModuleId.isEmpty()) - return; - - comphelper::SequenceAsHashMap lModuleDescription(xModuleManager->getByName(aModuleId)); - OUString sFactoryService; - lModuleDescription[OUString("ooSetupFactoryEmptyDocumentURL")] >>= sFactoryService; - if (sFactoryService.isEmpty()) - return; - - uno::Sequence < css::beans::PropertyValue > args(0); - xDesktop->loadComponentFromURL(sFactoryService, "_blank", 0, args); - return; - } - - OUString sCommand(".uno:"); - sCommand += OUString(strval, strlen(strval), RTL_TEXTENCODING_UTF8); - g_free(strval); - - css::util::URL aCommand; - aCommand.Complete = sCommand; - uno::Reference< css::util::XURLTransformer > xParser = css::util::URLTransformer::create(xContext); - xParser->parseStrict(aCommand); - - uno::Reference< css::frame::XDispatch > xDisp = xDispatchProvider->queryDispatch(aCommand, OUString(), 0); - - if (!xDisp.is()) - return; - - xDisp->dispatch(aCommand, css::uno::Sequence< css::beans::PropertyValue >()); -} - -static const GActionEntry app_entries[] = { - { "OptionsTreeDialog", activate_uno, nullptr, nullptr, nullptr, {0} }, - { "About", activate_uno, nullptr, nullptr, nullptr, {0} }, - { "HelpIndex", activate_uno, nullptr, nullptr, nullptr, {0} }, - { "Quit", activate_uno, nullptr, nullptr, nullptr, {0} }, - { "New", activate_uno, nullptr, nullptr, nullptr, {0} } -}; - static gboolean ensure_dbus_setup( gpointer data ) { GtkSalFrame* pSalFrame = static_cast< GtkSalFrame* >( data ); @@ -618,14 +544,10 @@ static gboolean ensure_dbus_setup( gpointer data ) g_object_set_data_full( G_OBJECT( gdkWindow ), "g-lo-action-group", pActionGroup, ObjectDestroyedNotify ); GdkDisplay *pDisplay = GtkSalFrame::getGdkDisplay(); - // fdo#70885 we don't want app menu under Unity - const bool bDesktopIsUnity = (SalGetDesktopEnvironment() == "UNITY"); #if defined(GDK_WINDOWING_X11) if (DLSYM_GDK_IS_X11_DISPLAY(pDisplay)) { gdk_x11_window_set_utf8_property( gdkWindow, "_GTK_APPLICATION_ID", "org.libreoffice" ); - if (!bDesktopIsUnity) - 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", aDBusMenubarPath ); gdk_x11_window_set_utf8_property( gdkWindow, "_GTK_WINDOW_OBJECT_PATH", aDBusWindowPath ); gdk_x11_window_set_utf8_property( gdkWindow, "_GTK_APPLICATION_OBJECT_PATH", "/org/libreoffice" ); @@ -636,8 +558,8 @@ static gboolean ensure_dbus_setup( gpointer data ) if (DLSYM_GDK_IS_WAYLAND_DISPLAY(pDisplay)) { gdk_wayland_window_set_dbus_properties_libgtk_only(gdkWindow, "org.libreoffice", - "/org/libreoffice/menus/appmenu", - !bDesktopIsUnity ? aDBusMenubarPath : nullptr, + nullptr, + aDBusMenubarPath, aDBusWindowPath, "/org/libreoffice", g_dbus_connection_get_unique_name( pSessionBus )); @@ -650,73 +572,8 @@ static gboolean ensure_dbus_setup( gpointer data ) pSalFrame->m_nActionGroupExportId = g_dbus_connection_export_action_group( pSessionBus, aDBusWindowPath, pActionGroup, nullptr); pSalFrame->m_nHudAwarenessId = hud_awareness_register( pSessionBus, aDBusMenubarPath, hud_activated, pSalFrame, nullptr, nullptr ); - //app menu, to-do translations, block normal menus when active, honor use appmenu settings - if (!bDesktopIsUnity) - { - GMenu *menu = g_menu_new (); - GMenuItem* item; - - GMenu *firstsubmenu = g_menu_new (); - - OString sNew(OUStringToOString(VclResId(SV_BUTTONTEXT_NEW), - RTL_TEXTENCODING_UTF8).replaceFirst("~", "_")); - - item = g_menu_item_new(sNew.getStr(), "app.New"); - g_menu_append_item( firstsubmenu, item ); - g_object_unref(item); - - g_menu_append_section( menu, nullptr, G_MENU_MODEL(firstsubmenu)); - g_object_unref(firstsubmenu); - - GMenu *secondsubmenu = g_menu_new (); - - OString sPreferences(OUStringToOString(VclResId(SV_STDTEXT_PREFERENCES), - RTL_TEXTENCODING_UTF8).replaceFirst("~", "_")); - - item = g_menu_item_new(sPreferences.getStr(), "app.OptionsTreeDialog"); - g_menu_append_item( secondsubmenu, item ); - g_object_unref(item); - - g_menu_append_section( menu, nullptr, G_MENU_MODEL(secondsubmenu)); - g_object_unref(secondsubmenu); - - GMenu *thirdsubmenu = g_menu_new (); - - OString sHelp(OUStringToOString(VclResId(SV_BUTTONTEXT_HELP), - RTL_TEXTENCODING_UTF8).replaceFirst("~", "_")); - - item = g_menu_item_new(sHelp.getStr(), "app.HelpIndex"); - g_menu_append_item( thirdsubmenu, item ); - g_object_unref(item); - - OString sAbout(OUStringToOString(VclResId(SV_STDTEXT_ABOUT), - RTL_TEXTENCODING_UTF8).replaceFirst("~", "_")); - - item = g_menu_item_new(sAbout.getStr(), "app.About"); - g_menu_append_item( thirdsubmenu, item ); - g_object_unref(item); - - OString sQuit(OUStringToOString(VclResId(SV_MENU_MAC_QUITAPP), - RTL_TEXTENCODING_UTF8).replaceFirst("~", "_")); - - item = g_menu_item_new(sQuit.getStr(), "app.Quit"); - g_menu_append_item( thirdsubmenu, item ); - g_object_unref(item); - g_menu_append_section( menu, nullptr, G_MENU_MODEL(thirdsubmenu)); - g_object_unref(thirdsubmenu); - - GSimpleActionGroup *group = g_simple_action_group_new (); - g_action_map_add_action_entries (G_ACTION_MAP (group), app_entries, G_N_ELEMENTS (app_entries), nullptr); - GActionGroup* pAppActionGroup = G_ACTION_GROUP(group); - - pSalFrame->m_nAppActionGroupExportId = g_dbus_connection_export_action_group( pSessionBus, "/org/libreoffice", pAppActionGroup, nullptr); - g_object_unref(pAppActionGroup); - pSalFrame->m_nAppMenuExportId = g_dbus_connection_export_menu_model (pSessionBus, "/org/libreoffice/menus/appmenu", G_MENU_MODEL (menu), nullptr); - g_object_unref(menu); - } - - g_free( aDBusMenubarPath ); g_free( aDBusWindowPath ); + g_free( aDBusMenubarPath ); } return FALSE; @@ -855,12 +712,8 @@ GtkSalFrame::~GtkSalFrame() hud_awareness_unregister( pSessionBus, m_nHudAwarenessId ); if ( m_nMenuExportId ) g_dbus_connection_unexport_menu_model( pSessionBus, m_nMenuExportId ); - if ( m_nAppMenuExportId ) - g_dbus_connection_unexport_menu_model( pSessionBus, m_nAppMenuExportId ); if ( m_nActionGroupExportId ) g_dbus_connection_unexport_action_group( pSessionBus, m_nActionGroupExportId ); - if ( m_nAppActionGroupExportId ) - g_dbus_connection_unexport_action_group( pSessionBus, m_nAppActionGroupExportId ); } gtk_widget_destroy( m_pWindow ); } @@ -1079,9 +932,7 @@ void GtkSalFrame::InitCommon() m_pSalMenu = nullptr; m_nWatcherId = 0; m_nMenuExportId = 0; - m_nAppMenuExportId = 0; m_nActionGroupExportId = 0; - m_nAppActionGroupExportId = 0; m_nHudAwarenessId = 0; gtk_widget_add_events( m_pWindow, _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits