mirror of
https://github.com/reactos/reactos.git
synced 2026-05-30 23:33:24 +08:00
[RAPPS] Fix loading of default settings (#8715)
Fixes a bug that causes the duplication of items in the general settings list when clicking the "Default" button.
This commit is contained in:
@@ -120,7 +120,7 @@ HandleGeneralListItems(HWND hWndList, PSETTINGS_INFO Load, PSETTINGS_INFO Save)
|
||||
{ IDS_CFG_SMALL_ICONS, &Info->bSmallIcons },
|
||||
};
|
||||
|
||||
if (Load)
|
||||
if (ListView_GetItemCount(hWndList) == 0)
|
||||
{
|
||||
UINT ExStyle = LVS_EX_CHECKBOXES | LVS_EX_LABELTIP;
|
||||
ListView_SetExtendedListViewStyleEx(hWndList, ExStyle, ExStyle);
|
||||
@@ -141,19 +141,25 @@ HandleGeneralListItems(HWND hWndList, PSETTINGS_INFO Load, PSETTINGS_INFO Save)
|
||||
Name.LoadStringW(Map[i].Id);
|
||||
Item.pszText = const_cast<PWSTR>(Name.GetString());
|
||||
Item.iItem = ListView_InsertItem(hWndList, &Item);
|
||||
ListView_SetCheckState(hWndList, Item.iItem, *Map[i].Setting);
|
||||
}
|
||||
ListView_SetItemState(hWndList, 0, -1, LVIS_FOCUSED | LVIS_SELECTED);
|
||||
AdjustListViewHeader(hWndList);
|
||||
}
|
||||
else
|
||||
|
||||
for (SIZE_T i = 0; i < _countof(Map); ++i)
|
||||
{
|
||||
for (SIZE_T i = 0; i < _countof(Map); ++i)
|
||||
LVFINDINFOW FindInfo = { LVFI_PARAM, NULL, Map[i].Id };
|
||||
int Idx = ListView_FindItem(hWndList, -1, &FindInfo);
|
||||
if (Idx >= 0)
|
||||
{
|
||||
LVFINDINFOW FindInfo = { LVFI_PARAM, NULL, Map[i].Id };
|
||||
int Idx = ListView_FindItem(hWndList, -1, &FindInfo);
|
||||
if (Idx >= 0)
|
||||
if (Load)
|
||||
{
|
||||
ListView_SetCheckState(hWndList, Idx, *Map[i].Setting);
|
||||
}
|
||||
else
|
||||
{
|
||||
*Map[i].Setting = ListView_GetCheckState(hWndList, Idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user