[Libreoffice-commits] core.git: vcl/unx

Caolán McNamara caolanm at redhat.com
Thu Jul 18 13:08:32 PDT 2013


 vcl/unx/gtk/window/gtksalframe.cxx |   77 +++++++++++++++++++++++--------------
 1 file changed, 48 insertions(+), 29 deletions(-)

New commits:
commit 4843d5e8865d2f63f408f464e28be9440cb1ecc2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jul 18 21:06:39 2013 +0100

    Related: fdo#48835 reuse Mac appmenu translations
    
    to-do:
    a) dig around for the setting to toggle-on/off
    b) block the normal entries in the menus and
       merge the mac build-time hackery to block
       menus into per-platform run-time lists
    
    Change-Id: I8fc3657ccc6d1881d4345c0ea73b05f6a29b6e07

diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx
index 0b66ce2..3bedd85 100644
--- a/vcl/unx/gtk/window/gtksalframe.cxx
+++ b/vcl/unx/gtk/window/gtksalframe.cxx
@@ -626,35 +626,54 @@ gboolean ensure_dbus_setup( gpointer data )
         pSalFrame->m_nHudAwarenessId = hud_awareness_register( pSessionBus, aDBusMenubarPath, hud_activated, pSalFrame, NULL, NULL );
 
         //app menu, to-do translations, block normal menus when active, honor use appmenu settings
-        GMenu *menu = g_menu_new ();
-        GMenuItem* item;
-
-        GMenu *firstsubmenu = g_menu_new ();
-        item = g_menu_item_new("_Preferences", "app.OptionsTreeDialog");
-        g_menu_append_item( firstsubmenu, item );
-        g_menu_append_section( menu, NULL, G_MENU_MODEL(firstsubmenu));
-
-        GMenu *secondsubmenu = g_menu_new ();
-        item = g_menu_item_new("_About", "app.About");
-        g_menu_append_item( secondsubmenu, item );
-
-        item = g_menu_item_new("_Help", "app.HelpIndex");
-        g_menu_append_item( secondsubmenu, item );
-        g_menu_append_section( menu, NULL, G_MENU_MODEL(secondsubmenu));
-
-        GMenu *thirdsubmenu = g_menu_new ();
-        item = g_menu_item_new("_Quit", "app.Quit");
-        g_menu_append_item( thirdsubmenu, item );
-        g_menu_append_section( menu, NULL, G_MENU_MODEL(thirdsubmenu));
-
-        GSimpleActionGroup *group = g_simple_action_group_new ();
-        g_simple_action_group_add_entries (group, app_entries, G_N_ELEMENTS (app_entries), NULL);
-        GActionGroup* pAppActionGroup = G_ACTION_GROUP(group);
-
-        pSalFrame->m_nAppActionGroupExportId = g_dbus_connection_export_action_group( pSessionBus, "/org/libreoffice", pAppActionGroup, NULL);
-        g_object_unref(pAppActionGroup);
-        pSalFrame->m_nAppMenuExportId = g_dbus_connection_export_menu_model (pSessionBus, "/org/libreoffice/menus/appmenu", G_MENU_MODEL (menu), NULL);
-        g_object_unref(menu);
+        ResMgr* pMgr = ImplGetResMgr();
+        if( pMgr )
+        {
+            GMenu *menu = g_menu_new ();
+            GMenuItem* item;
+
+            GMenu *firstsubmenu = g_menu_new ();
+
+            OString sPreferences(OUStringToOString(ResId(SV_STDTEXT_PREFERENCES, *pMgr).toString(),
+                RTL_TEXTENCODING_UTF8).replaceFirst("~", "_"));
+
+            item = g_menu_item_new(sPreferences.getStr(), "app.OptionsTreeDialog");
+            g_menu_append_item( firstsubmenu, item );
+            g_menu_append_section( menu, NULL, G_MENU_MODEL(firstsubmenu));
+
+            GMenu *secondsubmenu = g_menu_new ();
+
+            OString sAbout(OUStringToOString(ResId(SV_STDTEXT_ABOUT, *pMgr).toString(),
+                RTL_TEXTENCODING_UTF8).replaceFirst("~", "_"));
+
+            item = g_menu_item_new(sAbout.getStr(), "app.About");
+            g_menu_append_item( secondsubmenu, item );
+
+            OString sHelp(OUStringToOString(ResId(SV_BUTTONTEXT_HELP, *pMgr).toString(),
+                RTL_TEXTENCODING_UTF8).replaceFirst("~", "_"));
+
+            item = g_menu_item_new(sHelp.getStr(), "app.HelpIndex");
+            g_menu_append_item( secondsubmenu, item );
+            g_menu_append_section( menu, NULL, G_MENU_MODEL(secondsubmenu));
+
+            GMenu *thirdsubmenu = g_menu_new ();
+
+            OString sQuit(OUStringToOString(ResId(SV_MENU_MAC_QUITAPP, *pMgr).toString(),
+                RTL_TEXTENCODING_UTF8).replaceFirst("~", "_"));
+
+            item = g_menu_item_new(sQuit.getStr(), "app.Quit");
+            g_menu_append_item( thirdsubmenu, item );
+            g_menu_append_section( menu, NULL, G_MENU_MODEL(thirdsubmenu));
+
+            GSimpleActionGroup *group = g_simple_action_group_new ();
+            g_simple_action_group_add_entries (group, app_entries, G_N_ELEMENTS (app_entries), NULL);
+            GActionGroup* pAppActionGroup = G_ACTION_GROUP(group);
+
+            pSalFrame->m_nAppActionGroupExportId = g_dbus_connection_export_action_group( pSessionBus, "/org/libreoffice", pAppActionGroup, NULL);
+            g_object_unref(pAppActionGroup);
+            pSalFrame->m_nAppMenuExportId = g_dbus_connection_export_menu_model (pSessionBus, "/org/libreoffice/menus/appmenu", G_MENU_MODEL (menu), NULL);
+            g_object_unref(menu);
+        }
 
         g_free( aDBusMenubarPath );
         g_free( aDBusWindowPath );


More information about the Libreoffice-commits mailing list