tdf#166200 The list of open documents/windows is incorrect
Revert "speed up menu construction at app startup"
This reverts commit a18b0b4aa5
.
Change-Id: Ibfa0fe91fcfacf4a357782fedb48468b711044af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185036
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -76,8 +76,7 @@ void g_lo_menu_set_icon (GLOMenu
|
|||||||
void g_lo_menu_set_label_to_item_in_section (GLOMenu *menu,
|
void g_lo_menu_set_label_to_item_in_section (GLOMenu *menu,
|
||||||
gint section,
|
gint section,
|
||||||
gint position,
|
gint position,
|
||||||
const gchar *label,
|
const gchar *label);
|
||||||
bool fire_event = true);
|
|
||||||
|
|
||||||
void g_lo_menu_set_icon_to_item_in_section (GLOMenu *menu,
|
void g_lo_menu_set_icon_to_item_in_section (GLOMenu *menu,
|
||||||
gint section,
|
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,
|
void g_lo_menu_set_command_to_item_in_section (GLOMenu *menu,
|
||||||
gint section,
|
gint section,
|
||||||
gint position,
|
gint position,
|
||||||
const gchar *command,
|
const gchar *command);
|
||||||
bool fire_event = true);
|
|
||||||
|
|
||||||
gchar * g_lo_menu_get_command_from_item_in_section (GLOMenu *menu,
|
gchar * g_lo_menu_get_command_from_item_in_section (GLOMenu *menu,
|
||||||
gint section,
|
gint section,
|
||||||
|
@@ -89,7 +89,7 @@ public:
|
|||||||
void SetActionGroup( GActionGroup* pActionGroup ) { mpActionGroup = pActionGroup; }
|
void SetActionGroup( GActionGroup* pActionGroup ) { mpActionGroup = pActionGroup; }
|
||||||
bool IsItemVisible( unsigned nPos );
|
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 );
|
void NativeSetItemIcon( unsigned nSection, unsigned nItemPos, const Image& rImage );
|
||||||
bool NativeSetItemCommand( unsigned nSection,
|
bool NativeSetItemCommand( unsigned nSection,
|
||||||
unsigned nItemPos,
|
unsigned nItemPos,
|
||||||
|
@@ -266,8 +266,7 @@ void
|
|||||||
g_lo_menu_set_label_to_item_in_section (GLOMenu *menu,
|
g_lo_menu_set_label_to_item_in_section (GLOMenu *menu,
|
||||||
gint section,
|
gint section,
|
||||||
gint position,
|
gint position,
|
||||||
const gchar *label,
|
const gchar *label)
|
||||||
bool fire_event)
|
|
||||||
{
|
{
|
||||||
g_return_if_fail (G_IS_LO_MENU (menu));
|
g_return_if_fail (G_IS_LO_MENU (menu));
|
||||||
|
|
||||||
@@ -278,7 +277,6 @@ g_lo_menu_set_label_to_item_in_section (GLOMenu *menu,
|
|||||||
g_lo_menu_set_label (model, position, label);
|
g_lo_menu_set_label (model, position, label);
|
||||||
|
|
||||||
// Notify the update.
|
// 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);
|
g_object_unref (model);
|
||||||
@@ -428,8 +426,7 @@ void
|
|||||||
g_lo_menu_set_command_to_item_in_section (GLOMenu *menu,
|
g_lo_menu_set_command_to_item_in_section (GLOMenu *menu,
|
||||||
gint section,
|
gint section,
|
||||||
gint position,
|
gint position,
|
||||||
const gchar *command,
|
const gchar *command)
|
||||||
bool fire_event)
|
|
||||||
{
|
{
|
||||||
g_return_if_fail (G_IS_LO_MENU (menu));
|
g_return_if_fail (G_IS_LO_MENU (menu));
|
||||||
|
|
||||||
@@ -447,7 +444,6 @@ 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);
|
g_lo_menu_set_attribute_value (model, position, G_LO_MENU_ATTRIBUTE_COMMAND, value);
|
||||||
|
|
||||||
// Notify the update.
|
// 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);
|
g_object_unref (model);
|
||||||
|
@@ -300,24 +300,18 @@ void GtkSalMenu::ImplUpdate(bool bRecurse, bool bRemoveDisabledEntries)
|
|||||||
OString sNativeCommand = GetCommandForItem(pSalMenuItem);
|
OString sNativeCommand = GetCommandForItem(pSalMenuItem);
|
||||||
|
|
||||||
// Force updating of native menu labels.
|
// 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)
|
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);
|
NativeSetItemCommand(nSection, nItemPos, nId, sNativeCommand.getStr(), itemBits, bChecked, false);
|
||||||
NativeCheckItem( nSection, nItemPos, itemBits, bChecked );
|
NativeCheckItem( nSection, nItemPos, itemBits, bChecked );
|
||||||
NativeSetEnableItem(sNativeCommand, bEnabled);
|
NativeSetEnableItem(sNativeCommand, bEnabled);
|
||||||
|
|
||||||
pNewCommandList = g_list_append(pNewCommandList, g_strdup(sNativeCommand.getStr()));
|
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;
|
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);
|
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;
|
SolarMutexGuard aGuard;
|
||||||
// Escape all underscores so that they don't get interpreted as hotkeys
|
// 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 );
|
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 )
|
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 )
|
if ( aLabel )
|
||||||
g_free( aLabel );
|
g_free( aLabel );
|
||||||
@@ -1318,9 +1312,7 @@ bool GtkSalMenu::NativeSetItemCommand( unsigned nSection,
|
|||||||
g_free(pLabel);
|
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,
|
g_lo_menu_set_command_to_item_in_section( pMenu, nSection, nItemPos, aCommand );
|
||||||
// speeds up constructing menus
|
|
||||||
g_lo_menu_set_command_to_item_in_section( pMenu, nSection, nItemPos, aCommand, /*fire_event*/false );
|
|
||||||
|
|
||||||
gchar* aItemCommand = g_strconcat("win.", aCommand, nullptr );
|
gchar* aItemCommand = g_strconcat("win.", aCommand, nullptr );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user