vcl/inc/unx/gtk/glomenu.h      |    6 ++----
 vcl/inc/unx/gtk/gtksalmenu.hxx |    2 +-
 vcl/unx/gtk3/glomenu.cxx       |   12 ++++--------
 vcl/unx/gtk3/gtksalmenu.cxx    |   20 ++++++--------------
 4 files changed, 13 insertions(+), 27 deletions(-)

New commits:
commit 8086fbb3bed5da6125cc9765d613205cc612a734
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed May 7 23:32:19 2025 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu May 8 20:40:43 2025 +0200

    tdf#166200 The list of open documents/windows is incorrect
    
    Revert "speed up menu construction at app startup"
    
    This reverts commit a18b0b4aa56c47cadd0b6d6d1ad5842cf16e9835.
    
    Change-Id: Ibfa0fe91fcfacf4a357782fedb48468b711044af
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185036
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    (cherry picked from commit 15ed00fcef6bbc83b43da2e0c33d0eecba22fd55)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185064
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/vcl/inc/unx/gtk/glomenu.h b/vcl/inc/unx/gtk/glomenu.h
index 427a0a8ba79c..da41e9e4b8b1 100644
--- a/vcl/inc/unx/gtk/glomenu.h
+++ b/vcl/inc/unx/gtk/glomenu.h
@@ -76,8 +76,7 @@ void        g_lo_menu_set_icon                                
         (GLOMenu
 void        g_lo_menu_set_label_to_item_in_section                      
(GLOMenu     *menu,
                                                                          gint  
       section,
                                                                          gint  
       position,
-                                                                         const 
gchar *label,
-                                                                         bool 
fire_event = true);
+                                                                         const 
gchar *label);
 
 void        g_lo_menu_set_icon_to_item_in_section                      
(GLOMenu     *menu,
                                                                         gint   
      section,
@@ -102,8 +101,7 @@ void        
g_lo_menu_set_action_and_target_value_to_item_in_section    (GLOMenu
 void        g_lo_menu_set_command_to_item_in_section                    
(GLOMenu     *menu,
                                                                          gint  
       section,
                                                                          gint  
       position,
-                                                                         const 
gchar *command,
-                                                                         bool 
fire_event = true);
+                                                                         const 
gchar *command);
 
 gchar *     g_lo_menu_get_command_from_item_in_section                  
(GLOMenu     *menu,
                                                                          gint  
       section,
diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx
index 8c8f464153a4..67d578ecee5e 100644
--- a/vcl/inc/unx/gtk/gtksalmenu.hxx
+++ b/vcl/inc/unx/gtk/gtksalmenu.hxx
@@ -89,7 +89,7 @@ public:
     void                        SetActionGroup( GActionGroup* pActionGroup ) { 
mpActionGroup = pActionGroup; }
     bool                        IsItemVisible( unsigned nPos );
 
-    void                        NativeSetItemText( unsigned nSection, unsigned 
nItemPos, const OUString& rText, bool bFireEvent = true );
+    void                        NativeSetItemText( unsigned nSection, unsigned 
nItemPos, const OUString& rText );
     void                        NativeSetItemIcon( unsigned nSection, unsigned 
nItemPos, const Image& rImage );
     bool                        NativeSetItemCommand( unsigned nSection,
                                                       unsigned nItemPos,
diff --git a/vcl/unx/gtk3/glomenu.cxx b/vcl/unx/gtk3/glomenu.cxx
index 0a535002a2d9..779d20f9b879 100644
--- a/vcl/unx/gtk3/glomenu.cxx
+++ b/vcl/unx/gtk3/glomenu.cxx
@@ -266,8 +266,7 @@ void
 g_lo_menu_set_label_to_item_in_section (GLOMenu     *menu,
                                         gint         section,
                                         gint         position,
-                                        const gchar *label,
-                                        bool fire_event)
+                                        const gchar *label)
 {
     g_return_if_fail (G_IS_LO_MENU (menu));
 
@@ -278,8 +277,7 @@ g_lo_menu_set_label_to_item_in_section (GLOMenu     *menu,
     g_lo_menu_set_label (model, position, label);
 
     // Notify the update.
-    if (fire_event)
-        g_menu_model_items_changed (G_MENU_MODEL (model), position, 1, 1);
+    g_menu_model_items_changed (G_MENU_MODEL (model), position, 1, 1);
 
     g_object_unref (model);
 }
@@ -428,8 +426,7 @@ void
 g_lo_menu_set_command_to_item_in_section (GLOMenu     *menu,
                                           gint         section,
                                           gint         position,
-                                          const gchar *command,
-                                          bool fire_event)
+                                          const gchar *command)
 {
     g_return_if_fail (G_IS_LO_MENU (menu));
 
@@ -447,8 +444,7 @@ g_lo_menu_set_command_to_item_in_section (GLOMenu     *menu,
     g_lo_menu_set_attribute_value (model, position, 
G_LO_MENU_ATTRIBUTE_COMMAND, value);
 
     // Notify the update.
-    if (fire_event)
-        g_menu_model_items_changed (G_MENU_MODEL (model), position, 1, 1);
+    g_menu_model_items_changed (G_MENU_MODEL (model), position, 1, 1);
 
     g_object_unref (model);
 }
diff --git a/vcl/unx/gtk3/gtksalmenu.cxx b/vcl/unx/gtk3/gtksalmenu.cxx
index a1b20c5c26d3..0a97d5e2338f 100644
--- a/vcl/unx/gtk3/gtksalmenu.cxx
+++ b/vcl/unx/gtk3/gtksalmenu.cxx
@@ -300,24 +300,18 @@ void GtkSalMenu::ImplUpdate(bool bRecurse, bool 
bRemoveDisabledEntries)
         OString sNativeCommand = GetCommandForItem(pSalMenuItem);
 
         // Force updating of native menu labels.
+        NativeSetItemText( nSection, nItemPos, aText );
+        NativeSetItemIcon( nSection, nItemPos, aImage );
+        NativeSetAccelerator(nSection, nItemPos, nAccelKey, 
nAccelKey.GetName());
 
         if (!sNativeCommand.isEmpty() && pSalMenuItem->mpSubMenu == nullptr)
         {
-            NativeSetItemText( nSection, nItemPos, aText, false );
-            NativeSetItemIcon( nSection, nItemPos, aImage );
-            NativeSetAccelerator(nSection, nItemPos, nAccelKey, 
nAccelKey.GetName());
             NativeSetItemCommand(nSection, nItemPos, nId, 
sNativeCommand.getStr(), itemBits, bChecked, false);
             NativeCheckItem( nSection, nItemPos, itemBits, bChecked );
             NativeSetEnableItem(sNativeCommand, bEnabled);
 
             pNewCommandList = g_list_append(pNewCommandList, 
g_strdup(sNativeCommand.getStr()));
         }
-        else
-        {
-            NativeSetItemText( nSection, nItemPos, aText );
-            NativeSetItemIcon( nSection, nItemPos, aImage );
-            NativeSetAccelerator(nSection, nItemPos, nAccelKey, 
nAccelKey.GetName());
-        }
 
         GtkSalMenu* pSubmenu = pSalMenuItem->mpSubMenu;
 
@@ -1175,7 +1169,7 @@ void GtkSalMenu::NativeSetEnableItem(const OString& 
sCommand, gboolean bEnable)
         g_lo_action_group_set_action_enabled(pActionGroup, sCommand.getStr(), 
bEnable);
 }
 
-void GtkSalMenu::NativeSetItemText( unsigned nSection, unsigned nItemPos, 
const OUString& rText, bool bFireEvent )
+void GtkSalMenu::NativeSetItemText( unsigned nSection, unsigned nItemPos, 
const OUString& rText )
 {
     SolarMutexGuard aGuard;
     // Escape all underscores so that they don't get interpreted as hotkeys
@@ -1188,7 +1182,7 @@ void GtkSalMenu::NativeSetItemText( unsigned nSection, 
unsigned nItemPos, const
     gchar* aLabel = g_lo_menu_get_label_from_item_in_section( G_LO_MENU( 
mpMenuModel ), nSection, nItemPos );
 
     if ( aLabel == nullptr || g_strcmp0( aLabel, aConvertedText.getStr() ) != 
0 )
-        g_lo_menu_set_label_to_item_in_section( G_LO_MENU( mpMenuModel ), 
nSection, nItemPos, aConvertedText.getStr(), bFireEvent );
+        g_lo_menu_set_label_to_item_in_section( G_LO_MENU( mpMenuModel ), 
nSection, nItemPos, aConvertedText.getStr() );
 
     if ( aLabel )
         g_free( aLabel );
@@ -1318,9 +1312,7 @@ bool GtkSalMenu::NativeSetItemCommand( unsigned nSection,
             g_free(pLabel);
         }
 
-        // suppress event firing here, we will do so anyway in the 
g_lo_menu_set_action_and_target_value_to_item_in_section call,
-        // speeds up constructing menus
-        g_lo_menu_set_command_to_item_in_section( pMenu, nSection, nItemPos, 
aCommand, /*fire_event*/false );
+        g_lo_menu_set_command_to_item_in_section( pMenu, nSection, nItemPos, 
aCommand );
 
         gchar* aItemCommand = g_strconcat("win.", aCommand, nullptr );
 

Reply via email to