Skip to content

Commit c9e648d

Browse files
Fix: Fixed issue where the Recycle Bin was sometimes unpinned (#16880)
1 parent 4dca184 commit c9e648d

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/Files.App/Services/Windows/WindowsQuickAccessService.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ public async Task<IEnumerable<ShellFileItem>> GetPinnedFoldersAsync()
2626
private async Task PinToSidebarAsync(string[] folderPaths, bool doUpdateQuickAccessWidget)
2727
{
2828
foreach (string folderPath in folderPaths)
29-
await ContextMenu.InvokeVerb("pintohome", [folderPath]);
29+
{
30+
// make sure that the item has not yet been pinned
31+
// the verb 'pintohome' is for both adding and removing
32+
if (!IsItemPinned(folderPath))
33+
await ContextMenu.InvokeVerb("pintohome", folderPath);
34+
}
3035

3136
await App.QuickAccessManager.Model.LoadAsync();
3237
if (doUpdateQuickAccessWidget)

src/Files.App/Utils/Global/QuickAccessManager.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,10 @@ private void PinnedItemsWatcher_Changed(object sender, FileSystemEventArgs e)
4242
public async Task InitializeAsync()
4343
{
4444
PinnedItemsModified += Model.LoadAsync;
45+
await Model.LoadAsync();
4546

4647
if (!Model.PinnedFolders.Contains(Constants.UserEnvironmentPaths.RecycleBinPath) && AppLifecycleHelper.IsFirstRun)
4748
await QuickAccessService.PinToSidebarAsync(Constants.UserEnvironmentPaths.RecycleBinPath);
48-
49-
await Model.LoadAsync();
5049
}
5150
}
5251
}

0 commit comments

Comments
 (0)