@@ -78,7 +78,7 @@ bool MainScreen::showHomebrewTab = false;
7878
7979static void LaunchFile (ScreenManager *screenManager, Screen *currentScreen, const Path &path) {
8080 if (path.GetFileExtension () == " .zip" ) {
81- // If it's a zip file, we have a screen for that.
81+ // If is a zip file, we have a screen for that.
8282 screenManager->push (new InstallZipScreen (path));
8383 } else {
8484 if (currentScreen) {
@@ -447,10 +447,15 @@ class DirButton : public UI::Button {
447447 return absolute_;
448448 }
449449
450+ void SetPinned (bool pin) {
451+ pinned_ = pin;
452+ }
453+
450454private:
451455 Path path_;
452456 bool gridStyle_;
453457 bool absolute_;
458+ bool pinned_ = false ;
454459};
455460
456461void DirButton::Draw (UIContext &dc) {
@@ -465,7 +470,7 @@ void DirButton::Draw(UIContext &dc) {
465470
466471 std::string_view text (GetText ());
467472
468- ImageID image = ImageID (" I_FOLDER" );
473+ ImageID image = ImageID (pinned_ ? " I_FOLDER_PINNED " : " I_FOLDER" );
469474 if (text == " .." ) {
470475 image = ImageID (" I_UP_DIRECTORY" );
471476 }
@@ -481,7 +486,7 @@ void DirButton::Draw(UIContext &dc) {
481486 if (compact) {
482487 // No icon, except "up"
483488 dc.PushScissor (bounds_);
484- if (image == ImageID (" I_FOLDER" )) {
489+ if (image == ImageID (" I_FOLDER" ) || image == ImageID ( " I_FOLDER_PINNED " ) ) {
485490 dc.DrawText (text, bounds_.x + 5 , bounds_.centerY (), style.fgColor , ALIGN_VCENTER);
486491 } else {
487492 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() {
912917 // Add any pinned paths before other directories.
913918 auto pinnedPaths = GetPinnedPaths ();
914919 for (auto it = pinnedPaths.begin (), end = pinnedPaths.end (); it != end; ++it) {
915- gameList_->Add (new DirButton (*it, GetBaseName ((*it).ToString ()), *gridStyle_, new UI::LinearLayoutParams (UI::FILL_PARENT, UI::FILL_PARENT)))->
916- OnClick.Handle (this , &GameBrowser::NavigateClick);
920+ DirButton *pinnedDir = gameList_->Add (new DirButton (*it, GetBaseName ((*it).ToString ()), *gridStyle_, new UI::LinearLayoutParams (UI::FILL_PARENT, UI::FILL_PARENT)));
921+ pinnedDir->OnClick .Handle (this , &GameBrowser::NavigateClick);
922+ pinnedDir->SetPinned (true );
917923 }
924+
925+ // Add a separator?
918926 }
919927
920928 if (listingPending_) {
@@ -938,12 +946,13 @@ void GameBrowser::Refresh() {
938946
939947 // Show a button to toggle pinning at the very end.
940948 if ((browseFlags_ & BrowseFlags::PIN) && !path_.GetPath ().empty ()) {
941- std::string caption = IsCurrentPathPinned () ? " -" : " +" ;
949+ std::string caption = " " ; // IsCurrentPathPinned() ? "-" : "+";
942950 if (!*gridStyle_) {
943951 caption = IsCurrentPathPinned () ? mm->T (" UnpinPath" , " Unpin" ) : mm->T (" PinPath" , " Pin" );
944952 }
945- gameList_->Add (new UI::Button (caption, new UI::LinearLayoutParams (UI::FILL_PARENT, UI::FILL_PARENT)))->
946- OnClick.Handle (this , &GameBrowser::PinToggleClick);
953+ UI::Button *pinButton = gameList_->Add (new UI::Button (caption, new UI::LinearLayoutParams (UI::FILL_PARENT, UI::FILL_PARENT)));
954+ pinButton->OnClick .Handle (this , &GameBrowser::PinToggleClick);
955+ pinButton->SetImageID (ImageID (IsCurrentPathPinned () ? " I_UNPIN" : " I_PIN" ));
947956 }
948957
949958 if (path_.GetPath ().empty ()) {
0 commit comments