From 3917753d2e4fcf9b0b06dda33c4ba404b5a18222 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 7 Oct 2025 16:02:26 -0600 Subject: [PATCH] Use I_FOLDER_PINNED --- UI/MainScreen.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index f999a9ab74..a213026513 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -447,10 +447,15 @@ public: return absolute_; } + void SetPinned(bool pin) { + pinned_ = pin; + } + private: Path path_; bool gridStyle_; bool absolute_; + bool pinned_ = false; }; void DirButton::Draw(UIContext &dc) { @@ -465,7 +470,7 @@ void DirButton::Draw(UIContext &dc) { std::string_view text(GetText()); - ImageID image = ImageID("I_FOLDER"); + ImageID image = ImageID(pinned_ ? "I_FOLDER_PINNED" : "I_FOLDER"); if (text == "..") { image = ImageID("I_UP_DIRECTORY"); } @@ -481,7 +486,7 @@ void DirButton::Draw(UIContext &dc) { if (compact) { // No icon, except "up" dc.PushScissor(bounds_); - if (image == ImageID("I_FOLDER")) { + if (image == ImageID("I_FOLDER") || image == ImageID("I_FOLDER_PINNED")) { dc.DrawText(text, bounds_.x + 5, bounds_.centerY(), style.fgColor, ALIGN_VCENTER); } else { dc.Draw()->DrawImage(image, bounds_.centerX(), bounds_.centerY(), gridStyle_ ? g_Config.fGameGridScale : 1.0, style.fgColor, ALIGN_CENTER); @@ -912,9 +917,12 @@ void GameBrowser::Refresh() { // Add any pinned paths before other directories. auto pinnedPaths = GetPinnedPaths(); for (auto it = pinnedPaths.begin(), end = pinnedPaths.end(); it != end; ++it) { - gameList_->Add(new DirButton(*it, GetBaseName((*it).ToString()), *gridStyle_, new UI::LinearLayoutParams(UI::FILL_PARENT, UI::FILL_PARENT)))-> - OnClick.Handle(this, &GameBrowser::NavigateClick); + DirButton *pinnedDir = gameList_->Add(new DirButton(*it, GetBaseName((*it).ToString()), *gridStyle_, new UI::LinearLayoutParams(UI::FILL_PARENT, UI::FILL_PARENT))); + pinnedDir->OnClick.Handle(this, &GameBrowser::NavigateClick); + pinnedDir->SetPinned(true); } + + // Add a separator? } if (listingPending_) {