From 218b0579a99e9176a33b78c10721c44529dafd4b Mon Sep 17 00:00:00 2001 From: Marco Franzen Date: Fri, 28 Feb 2025 20:37:36 +0100 Subject: [PATCH 1/2] make sure that the PinToSidebarAsync method never removes pinned items --- .../Services/Windows/WindowsQuickAccessService.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Files.App/Services/Windows/WindowsQuickAccessService.cs b/src/Files.App/Services/Windows/WindowsQuickAccessService.cs index fc91d162ce06..a4db5df53276 100644 --- a/src/Files.App/Services/Windows/WindowsQuickAccessService.cs +++ b/src/Files.App/Services/Windows/WindowsQuickAccessService.cs @@ -26,7 +26,12 @@ public async Task> GetPinnedFoldersAsync() private async Task PinToSidebarAsync(string[] folderPaths, bool doUpdateQuickAccessWidget) { foreach (string folderPath in folderPaths) - await ContextMenu.InvokeVerb("pintohome", [folderPath]); + { + // make sure that the item has not yet been pinned + // the verb 'pintohome' is for both adding and removing + if (!IsItemPinned(folderPath)) + await ContextMenu.InvokeVerb("pintohome", folderPath); + } await App.QuickAccessManager.Model.LoadAsync(); if (doUpdateQuickAccessWidget) From 427c551b1a5da9dfce31dfcd1c4a96701e34b1d5 Mon Sep 17 00:00:00 2001 From: Marco Franzen Date: Fri, 28 Feb 2025 20:44:05 +0100 Subject: [PATCH 2/2] load the PinnedFoldersManager before checking the the recycle bin is already pinned --- src/Files.App/Utils/Global/QuickAccessManager.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Files.App/Utils/Global/QuickAccessManager.cs b/src/Files.App/Utils/Global/QuickAccessManager.cs index eb4471ec2a09..e91a880d43f1 100644 --- a/src/Files.App/Utils/Global/QuickAccessManager.cs +++ b/src/Files.App/Utils/Global/QuickAccessManager.cs @@ -42,11 +42,10 @@ private void PinnedItemsWatcher_Changed(object sender, FileSystemEventArgs e) public async Task InitializeAsync() { PinnedItemsModified += Model.LoadAsync; + await Model.LoadAsync(); if (!Model.PinnedFolders.Contains(Constants.UserEnvironmentPaths.RecycleBinPath) && AppLifecycleHelper.IsFirstRun) await QuickAccessService.PinToSidebarAsync(Constants.UserEnvironmentPaths.RecycleBinPath); - - await Model.LoadAsync(); } } }