Games list settings: Ask before clearing the Recent list

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-11-06 23:07:13 +01:00
1 parent b83d2ffe8f
commit 361ea4c824
2 files changed
+22 -3

No files matched your search

+19 -3
View File
@@ -1064,9 +1064,25 @@ void GridSettingsPopupScreen::CreatePopupContents(UI::ViewGroup *parent) {
if (g_Config.iMaxRecent > 0) {
ChoiceGroup *recentGroup = groupList->Add(new ChoiceGroup(sy->T("Clear Recent")));
recentGroup->Add(new Choice(sy->T("Clear Recent Games List")))->OnClick.Add([this](UI::EventParams &e) {
g_recentFiles.Clear();
OnRecentChanged.Trigger(e);
TriggerFinish(DR_OK);
auto di = GetI18NCategory(I18NCat::DIALOG);
auto sy = GetI18NCategory(I18NCat::SYSTEM);
// dialogFinished closes this popup once the prompt is gone.
screenManager()->push(new MessagePopupScreen(sy->T("Clear Recent"), sy->T("ClearRecentConfirm", "Clear the \"Recent\" list? Your games won't be deleted."), di->T("Clear"), di->T("Cancel"), [this](bool yes) {
if (yes) {
g_recentFiles.Clear();
recentCleared_ = true;
}
}));
});
}
}
void GridSettingsPopupScreen::dialogFinished(const Screen *dialog, DialogResult result) {
if (!recentCleared_) {
return;
}
recentCleared_ = false;
UI::EventParams e{};
OnRecentChanged.Trigger(e);
TriggerFinish(DR_OK);
}
+3
View File
@@ -129,8 +129,11 @@ public:
const char *tag() const override { return "GridSettings"; }
void dialogFinished(const Screen *dialog, DialogResult result) override;
private:
GameBrowserViewMode viewMode_;
bool recentCleared_ = false;
};
void LaunchBuyGold(ScreenManager *screenManager);