Skip to content

Commit a5296ad

Browse files
Noel Grandintimar
authored andcommitted
tdf#166200 The list of open documents/windows is incorrect
Revert "speed up menu construction at app startup" This reverts commit a18b0b4. Change-Id: Ibfa0fe91fcfacf4a357782fedb48468b711044af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185036 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> (cherry picked from commit 15ed00f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185064 Reviewed-by: Xisco Fauli <[email protected]>
1 parent 9d672a3 commit a5296ad

File tree

4 files changed

+13
-27
lines changed

4 files changed

+13
-27
lines changed

vcl/inc/unx/gtk/glomenu.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ void g_lo_menu_set_icon (GLOMenu
7676
void g_lo_menu_set_label_to_item_in_section (GLOMenu *menu,
7777
gint section,
7878
gint position,
79-
const gchar *label,
80-
bool fire_event = true);
79+
const gchar *label);
8180

8281
void g_lo_menu_set_icon_to_item_in_section (GLOMenu *menu,
8382
gint section,
@@ -102,8 +101,7 @@ void g_lo_menu_set_action_and_target_value_to_item_in_section (GLOMenu
102101
void g_lo_menu_set_command_to_item_in_section (GLOMenu *menu,
103102
gint section,
104103
gint position,
105-
const gchar *command,
106-
bool fire_event = true);
104+
const gchar *command);
107105

108106
gchar * g_lo_menu_get_command_from_item_in_section (GLOMenu *menu,
109107
gint section,

vcl/inc/unx/gtk/gtksalmenu.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public:
8989
void SetActionGroup( GActionGroup* pActionGroup ) { mpActionGroup = pActionGroup; }
9090
bool IsItemVisible( unsigned nPos );
9191

92-
void NativeSetItemText( unsigned nSection, unsigned nItemPos, const OUString& rText, bool bFireEvent = true );
92+
void NativeSetItemText( unsigned nSection, unsigned nItemPos, const OUString& rText );
9393
void NativeSetItemIcon( unsigned nSection, unsigned nItemPos, const Image& rImage );
9494
bool NativeSetItemCommand( unsigned nSection,
9595
unsigned nItemPos,

vcl/unx/gtk3/glomenu.cxx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,7 @@ void
266266
g_lo_menu_set_label_to_item_in_section (GLOMenu *menu,
267267
gint section,
268268
gint position,
269-
const gchar *label,
270-
bool fire_event)
269+
const gchar *label)
271270
{
272271
g_return_if_fail (G_IS_LO_MENU (menu));
273272

@@ -278,8 +277,7 @@ g_lo_menu_set_label_to_item_in_section (GLOMenu *menu,
278277
g_lo_menu_set_label (model, position, label);
279278

280279
// Notify the update.
281-
if (fire_event)
282-
g_menu_model_items_changed (G_MENU_MODEL (model), position, 1, 1);
280+
g_menu_model_items_changed (G_MENU_MODEL (model), position, 1, 1);
283281

284282
g_object_unref (model);
285283
}
@@ -428,8 +426,7 @@ void
428426
g_lo_menu_set_command_to_item_in_section (GLOMenu *menu,
429427
gint section,
430428
gint position,
431-
const gchar *command,
432-
bool fire_event)
429+
const gchar *command)
433430
{
434431
g_return_if_fail (G_IS_LO_MENU (menu));
435432

@@ -447,8 +444,7 @@ g_lo_menu_set_command_to_item_in_section (GLOMenu *menu,
447444
g_lo_menu_set_attribute_value (model, position, G_LO_MENU_ATTRIBUTE_COMMAND, value);
448445

449446
// Notify the update.
450-
if (fire_event)
451-
g_menu_model_items_changed (G_MENU_MODEL (model), position, 1, 1);
447+
g_menu_model_items_changed (G_MENU_MODEL (model), position, 1, 1);
452448

453449
g_object_unref (model);
454450
}

vcl/unx/gtk3/gtksalmenu.cxx

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -300,24 +300,18 @@ void GtkSalMenu::ImplUpdate(bool bRecurse, bool bRemoveDisabledEntries)
300300
OString sNativeCommand = GetCommandForItem(pSalMenuItem);
301301

302302
// Force updating of native menu labels.
303+
NativeSetItemText( nSection, nItemPos, aText );
304+
NativeSetItemIcon( nSection, nItemPos, aImage );
305+
NativeSetAccelerator(nSection, nItemPos, nAccelKey, nAccelKey.GetName());
303306

304307
if (!sNativeCommand.isEmpty() && pSalMenuItem->mpSubMenu == nullptr)
305308
{
306-
NativeSetItemText( nSection, nItemPos, aText, false );
307-
NativeSetItemIcon( nSection, nItemPos, aImage );
308-
NativeSetAccelerator(nSection, nItemPos, nAccelKey, nAccelKey.GetName());
309309
NativeSetItemCommand(nSection, nItemPos, nId, sNativeCommand.getStr(), itemBits, bChecked, false);
310310
NativeCheckItem( nSection, nItemPos, itemBits, bChecked );
311311
NativeSetEnableItem(sNativeCommand, bEnabled);
312312

313313
pNewCommandList = g_list_append(pNewCommandList, g_strdup(sNativeCommand.getStr()));
314314
}
315-
else
316-
{
317-
NativeSetItemText( nSection, nItemPos, aText );
318-
NativeSetItemIcon( nSection, nItemPos, aImage );
319-
NativeSetAccelerator(nSection, nItemPos, nAccelKey, nAccelKey.GetName());
320-
}
321315

322316
GtkSalMenu* pSubmenu = pSalMenuItem->mpSubMenu;
323317

@@ -1175,7 +1169,7 @@ void GtkSalMenu::NativeSetEnableItem(const OString& sCommand, gboolean bEnable)
11751169
g_lo_action_group_set_action_enabled(pActionGroup, sCommand.getStr(), bEnable);
11761170
}
11771171

1178-
void GtkSalMenu::NativeSetItemText( unsigned nSection, unsigned nItemPos, const OUString& rText, bool bFireEvent )
1172+
void GtkSalMenu::NativeSetItemText( unsigned nSection, unsigned nItemPos, const OUString& rText )
11791173
{
11801174
SolarMutexGuard aGuard;
11811175
// Escape all underscores so that they don't get interpreted as hotkeys
@@ -1188,7 +1182,7 @@ void GtkSalMenu::NativeSetItemText( unsigned nSection, unsigned nItemPos, const
11881182
gchar* aLabel = g_lo_menu_get_label_from_item_in_section( G_LO_MENU( mpMenuModel ), nSection, nItemPos );
11891183

11901184
if ( aLabel == nullptr || g_strcmp0( aLabel, aConvertedText.getStr() ) != 0 )
1191-
g_lo_menu_set_label_to_item_in_section( G_LO_MENU( mpMenuModel ), nSection, nItemPos, aConvertedText.getStr(), bFireEvent );
1185+
g_lo_menu_set_label_to_item_in_section( G_LO_MENU( mpMenuModel ), nSection, nItemPos, aConvertedText.getStr() );
11921186

11931187
if ( aLabel )
11941188
g_free( aLabel );
@@ -1318,9 +1312,7 @@ bool GtkSalMenu::NativeSetItemCommand( unsigned nSection,
13181312
g_free(pLabel);
13191313
}
13201314

1321-
// suppress event firing here, we will do so anyway in the g_lo_menu_set_action_and_target_value_to_item_in_section call,
1322-
// speeds up constructing menus
1323-
g_lo_menu_set_command_to_item_in_section( pMenu, nSection, nItemPos, aCommand, /*fire_event*/false );
1315+
g_lo_menu_set_command_to_item_in_section( pMenu, nSection, nItemPos, aCommand );
13241316

13251317
gchar* aItemCommand = g_strconcat("win.", aCommand, nullptr );
13261318

0 commit comments

Comments
 (0)