Skip to content

Commit ba61c81

Browse files
committed
Cleanup
1 parent 77fdb7d commit ba61c81

File tree

10 files changed

+18
-15
lines changed

10 files changed

+18
-15
lines changed

src/Files.App/Actions/Sidebar/PinFolderToSidebarAction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public async Task ExecuteAsync(object? parameter = null)
4242

4343
private bool GetIsExecutable()
4444
{
45-
string[] pinnedFolders = [.. service.QuickAccessFolders.Select(x => x.Path)];
45+
string[] pinnedFolders = [.. service.Folders.Select(x => x.Path)];
4646

4747
return context.HasSelection
4848
? context.SelectedItems.All(IsPinnable)

src/Files.App/Actions/Sidebar/UnpinFolderToSidebarAction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public async Task ExecuteAsync(object? parameter = null)
4242

4343
private bool GetIsExecutable()
4444
{
45-
string[] pinnedFolders = [.. service.QuickAccessFolders.Select(x => x.Path)];
45+
string[] pinnedFolders = [.. service.Folders.Select(x => x.Path)];
4646

4747
return context.HasSelection
4848
? context.SelectedItems.All(IsPinned)

src/Files.App/Data/Contracts/IQuickAccessService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace Files.App.Data.Contracts
77
{
88
public interface IQuickAccessService
99
{
10-
IReadOnlyList<INavigationControlItem> QuickAccessFolders { get; }
10+
IReadOnlyList<INavigationControlItem> Folders { get; }
1111

1212
event EventHandler<NotifyCollectionChangedEventArgs>? PinnedFoldersChanged;
1313

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public async Task RefreshPinnedFoldersAsync()
9696

9797
var itemsToRemove = instance.Items.Where(x => string.Equals(x.GroupName, JumpListPinnedGroupHeader, StringComparison.OrdinalIgnoreCase)).ToList();
9898
itemsToRemove.ForEach(x => instance.Items.Remove(x));
99-
WindowsQuickAccessService.QuickAccessFolders.ForEach(x => AddFolder(x.Path, JumpListPinnedGroupHeader, instance));
99+
WindowsQuickAccessService.Folders.ForEach(x => AddFolder(x.Path, JumpListPinnedGroupHeader, instance));
100100

101101
await instance.SaveAsync();
102102
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ internal sealed class QuickAccessService : IQuickAccessService
2222

2323
private readonly List<INavigationControlItem> _QuickAccessFolders = [];
2424
/// <inheritdoc/>
25-
public IReadOnlyList<INavigationControlItem> QuickAccessFolders
25+
public IReadOnlyList<INavigationControlItem> Folders
2626
{
2727
get
2828
{
@@ -67,7 +67,7 @@ public async Task<bool> UpdatePinnedFoldersAsync()
6767
if (items.Count is 0)
6868
return false;
6969

70-
var snapshot = QuickAccessFolders;
70+
var snapshot = Folders;
7171

7272
lock (_QuickAccessFolders)
7373
{

src/Files.App/ViewModels/Dialogs/ReorderSidebarItemsDialogViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public ReorderSidebarItemsDialogViewModel()
1818
{
1919
PrimaryButtonCommand = new RelayCommand(SaveChanges);
2020

21-
SidebarPinnedFolderItems = new(QuickAccessService.QuickAccessFolders
21+
SidebarPinnedFolderItems = new(QuickAccessService.Folders
2222
.Where(x => x is LocationItem loc && loc.Section is SectionType.Pinned && !loc.IsHeader)
2323
.Cast<LocationItem>());
2424
}

src/Files.App/ViewModels/UserControls/SidebarViewModel.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ await dispatcherQueue.EnqueueOrInvokeAsync(async () =>
271271
var section = await GetOrCreateSectionAsync(sectionType);
272272
Func<IReadOnlyList<INavigationControlItem>> getElements = () => sectionType switch
273273
{
274-
SectionType.Pinned => WindowsQuickAccessService.QuickAccessFolders,
274+
SectionType.Pinned => WindowsQuickAccessService.Folders,
275275
SectionType.CloudDrives => CloudDrivesManager.Drives,
276276
SectionType.Drives => drivesViewModel.Drives.Cast<DriveItem>().ToList().AsReadOnly(),
277277
SectionType.Network => NetworkService.Computers.Cast<DriveItem>().ToList().AsReadOnly(),
@@ -923,7 +923,7 @@ private List<ContextMenuFlyoutItemViewModel> GetLocationItemMenuItems(INavigatio
923923
{
924924
var options = item.MenuOptions;
925925

926-
var pinnedFolders = WindowsQuickAccessService.QuickAccessFolders.ToList();
926+
var pinnedFolders = WindowsQuickAccessService.Folders.ToList();
927927
var pinnedFolderIndex = pinnedFolders.IndexOf(item);
928928
var pinnedFolderCount = pinnedFolders.Count;
929929

@@ -1082,7 +1082,7 @@ private async Task HandleLocationItemDragOverAsync(LocationItem locationItem, It
10821082

10831083
if (isPathNull && hasStorageItems && SectionType.Pinned.Equals(locationItem.Section))
10841084
{
1085-
var haveFoldersToPin = storageItems.Any(item => item.ItemType == FilesystemItemType.Directory && WindowsQuickAccessService.QuickAccessFolders.FirstOrDefault(x => x.Path == item.Path) is null);
1085+
var haveFoldersToPin = storageItems.Any(item => item.ItemType == FilesystemItemType.Directory && WindowsQuickAccessService.Folders.FirstOrDefault(x => x.Path == item.Path) is null);
10861086

10871087
if (!haveFoldersToPin)
10881088
{
@@ -1252,7 +1252,7 @@ private async Task HandleLocationItemDroppedAsync(LocationItem locationItem, Ite
12521252
var storageItems = await Utils.Storage.FilesystemHelpers.GetDraggedStorageItems(args.DroppedItem);
12531253
foreach (var item in storageItems)
12541254
{
1255-
if (item.ItemType == FilesystemItemType.Directory && WindowsQuickAccessService.QuickAccessFolders.FirstOrDefault(x => x.Path == item.Path) is null)
1255+
if (item.ItemType == FilesystemItemType.Directory && WindowsQuickAccessService.Folders.FirstOrDefault(x => x.Path == item.Path) is null)
12561256
await WindowsQuickAccessService.PinFolderAsync([item.Path]);
12571257
}
12581258
}

src/Files.App/ViewModels/UserControls/Widgets/BaseWidgetViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ widgetCardItem.DataContext is not WidgetCardItem item ||
7676
OnRightClickedItemChanged(item, itemContextMenuFlyout);
7777

7878
// Get items for the flyout
79-
var menuItems = GetItemMenuItems(item, QuickAccessService.QuickAccessFolders.ToList().FirstOrDefault(x => x.Path == item.Path) is not null, fileTagsCardItem is not null && fileTagsCardItem.IsFolder);
79+
var menuItems = GetItemMenuItems(item, QuickAccessService.Folders.ToList().FirstOrDefault(x => x.Path == item.Path) is not null, fileTagsCardItem is not null && fileTagsCardItem.IsFolder);
8080
var (_, secondaryElements) = ContextFlyoutModelToElementHelper.GetAppBarItemsFromModel(menuItems);
8181

8282
// Set max width of the flyout

src/Files.App/ViewModels/UserControls/Widgets/QuickAccessWidgetViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ private async Task UpdateCollectionAsync(NotifyCollectionChangedEventArgs e)
176176
default:
177177
{
178178
Items.Clear();
179-
foreach (var item in QuickAccessService.QuickAccessFolders.ToList())
179+
foreach (var item in QuickAccessService.Folders.ToList())
180180
{
181181
if (item is not LocationItem locationItem)
182182
continue;

src/Files.App/Views/Layouts/ColumnsLayoutPage.xaml.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ namespace Files.App.Views.Layouts
1717
/// </summary>
1818
public sealed partial class ColumnsLayoutPage : BaseLayoutPage
1919
{
20+
// IOC
21+
22+
private readonly IQuickAccessService WindowsQuickAccessService = Ioc.Default.GetRequiredService<IQuickAccessService>();
23+
2024
// Properties
2125

2226
protected override ItemsControl ItemsControl => ColumnHost;
@@ -96,8 +100,7 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
96100

97101
if (!string.IsNullOrEmpty(pathRoot))
98102
{
99-
var service = Ioc.Default.GetRequiredService<IQuickAccessService>();
100-
var rootPathList = service.QuickAccessFolders.Select(x => NormalizePath(x.Path))
103+
var rootPathList = WindowsQuickAccessService.Folders.Select(x => NormalizePath(x.Path))
101104
.Concat(CloudDrivesManager.Drives.Select(x => NormalizePath(x.Path))).ToList()
102105
.Concat(App.LibraryManager.Libraries.Select(x => NormalizePath(x.Path))).ToList();
103106
rootPathList.Add(NormalizePath(pathRoot));

0 commit comments

Comments
 (0)