33
44using Files . App . Utils . Shell ;
55using Files . App . UserControls . Widgets ;
6+ using Files . App . Helpers ;
67
78namespace Files . App . Services
89{
@@ -38,7 +39,7 @@ private async Task PinToSidebarAsync(string[] folderPaths, bool doUpdateQuickAcc
3839 App . QuickAccessManager . UpdateQuickAccessWidget ? . Invoke ( this , new ModifyQuickAccessEventArgs ( folderPaths , true ) ) ;
3940 }
4041
41- public Task UnpinFromSidebarAsync ( string folderPath ) => UnpinFromSidebarAsync ( new [ ] { folderPath } ) ;
42+ public Task UnpinFromSidebarAsync ( string folderPath ) => UnpinFromSidebarAsync ( new [ ] { folderPath } ) ;
4243
4344 public Task UnpinFromSidebarAsync ( string [ ] folderPaths ) => UnpinFromSidebarAsync ( folderPaths , true ) ;
4445
@@ -55,27 +56,30 @@ private async Task UnpinFromSidebarAsync(string[] folderPaths, bool doUpdateQuic
5556
5657 foreach ( dynamic ? fi in f2 . Items ( ) )
5758 {
58- if ( ShellStorageFolder . IsShellPath ( ( string ) fi . Path ) )
59+ string pathStr = ( string ) fi . Path ;
60+
61+ if ( ShellStorageFolder . IsShellPath ( pathStr ) )
5962 {
60- var folder = await ShellStorageFolder . FromPathAsync ( ( string ) fi . Path ) ;
63+ var folder = await ShellStorageFolder . FromPathAsync ( pathStr ) ;
6164 var path = folder ? . Path ;
6265
63- if ( path is not null &&
64- ( folderPaths . Contains ( path ) || ( path . StartsWith ( @"\\SHELL\" ) && folderPaths . Any ( x => x . StartsWith ( @"\\SHELL\" ) ) ) ) ) // Fix for the Linux header
66+ if ( path is not null &&
67+ ( folderPaths . Contains ( path ) ||
68+ ( path . StartsWith ( @"\\SHELL\\" ) && folderPaths . Any ( x => x . StartsWith ( @"\\SHELL\\" ) ) ) ) )
6569 {
66- await SafetyExtensions . IgnoreExceptions ( async ( ) =>
70+ await Win32Helper . StartSTATask ( async ( ) =>
6771 {
68- await fi . InvokeVerb ( "unpinfromhome" ) ;
72+ fi . InvokeVerb ( "unpinfromhome" ) ;
6973 } ) ;
7074 continue ;
7175 }
7276 }
7377
74- if ( folderPaths . Contains ( ( string ) fi . Path ) )
78+ if ( folderPaths . Contains ( pathStr ) )
7579 {
76- await SafetyExtensions . IgnoreExceptions ( async ( ) =>
80+ await Win32Helper . StartSTATask ( async ( ) =>
7781 {
78- await fi . InvokeVerb ( "unpinfromhome" ) ;
82+ fi . InvokeVerb ( "unpinfromhome" ) ;
7983 } ) ;
8084 }
8185 }
0 commit comments