Skip to content

Commit 13e1f84

Browse files
0x5bfayaira2
andcommitted
Updated the root item's UX
Co-Authored-By: Yair <[email protected]>
1 parent b9d2698 commit 13e1f84

File tree

3 files changed

+42
-12
lines changed

3 files changed

+42
-12
lines changed

src/Files.App.Storage/Storables/WindowsStorage/WindowsStorableHelpers.Icon.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Files Community
22
// Licensed under the MIT License.
33

4+
using System.Drawing;
45
using System.Collections.Concurrent;
56
using System.Runtime.InteropServices;
67
using Windows.Win32;

src/Files.App/UserControls/NavigationToolbar.xaml.cs

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -286,18 +286,49 @@ private async void BreadcrumbBar_ItemDropDownFlyoutOpening(object sender, Breadc
286286
{
287287
if (e.IsRootItem)
288288
{
289-
// TODO: Populate a different flyout for the root item
289+
IHomeFolder homeFolder = new HomeFolder();
290+
290291
e.Flyout.Items.Add(new MenuFlyoutHeaderItem() { Text = "Quick access" });
291-
e.Flyout.Items.Add(new MenuFlyoutItem() { Text = "Desktop" });
292-
e.Flyout.Items.Add(new MenuFlyoutItem() { Text = "Download" });
293-
e.Flyout.Items.Add(new MenuFlyoutItem() { Text = "Documents" });
294-
e.Flyout.Items.Add(new MenuFlyoutItem() { Text = "Pictures" });
295-
e.Flyout.Items.Add(new MenuFlyoutItem() { Text = "Music" });
296-
e.Flyout.Items.Add(new MenuFlyoutItem() { Text = "Videos" });
297-
e.Flyout.Items.Add(new MenuFlyoutItem() { Text = "Recycle bin" });
292+
293+
await foreach (var storable in homeFolder.GetQuickAccessFolderAsync())
294+
{
295+
if (storable is not IWindowsStorable windowsStorable)
296+
continue;
297+
298+
var flyoutItem = new MenuFlyoutItem()
299+
{
300+
Text = windowsStorable.GetDisplayName(Windows.Win32.UI.Shell.SIGDN.SIGDN_PARENTRELATIVEFORUI),
301+
Icon = new FontIcon { Glyph = "\uE8B7" }, // Use font icon as placeholder
302+
};
303+
304+
e.Flyout.Items.Add(flyoutItem);
305+
306+
windowsStorable.TryGetThumbnail((int)(16f * App.AppModel.AppWindowDPI), Windows.Win32.UI.Shell.SIIGBF.SIIGBF_ICONONLY, out var thumbnailData);
307+
flyoutItem.Icon = new ImageIcon() { Source = await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(() => thumbnailData.ToBitmapAsync(), Microsoft.UI.Dispatching.DispatcherQueuePriority.Normal) };
308+
309+
windowsStorable.Dispose();
310+
}
311+
298312
e.Flyout.Items.Add(new MenuFlyoutHeaderItem() { Text = "Drives" });
299-
e.Flyout.Items.Add(new MenuFlyoutItem() { Text = "Local Disk (C:)" });
300-
e.Flyout.Items.Add(new MenuFlyoutItem() { Text = "Local Disk (D:)" });
313+
314+
await foreach (var storable in homeFolder.GetLogicalDrivesAsync())
315+
{
316+
if (storable is not IWindowsStorable windowsStorable)
317+
continue;
318+
319+
var flyoutItem = new MenuFlyoutItem()
320+
{
321+
Text = windowsStorable.GetDisplayName(Windows.Win32.UI.Shell.SIGDN.SIGDN_PARENTRELATIVEFORUI),
322+
Icon = new FontIcon { Glyph = "\uE8B7" }, // Use font icon as placeholder
323+
};
324+
325+
e.Flyout.Items.Add(flyoutItem);
326+
327+
windowsStorable.TryGetThumbnail((int)(16f * App.AppModel.AppWindowDPI), Windows.Win32.UI.Shell.SIIGBF.SIIGBF_ICONONLY, out var thumbnailData);
328+
flyoutItem.Icon = new ImageIcon() { Source = await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(() => thumbnailData.ToBitmapAsync(), Microsoft.UI.Dispatching.DispatcherQueuePriority.Normal) };
329+
330+
windowsStorable.Dispose();
331+
}
301332

302333
return;
303334
}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,6 @@ public async Task SetPathBoxDropDownFlyoutAsync(MenuFlyout flyout, PathBoxItem p
839839
Icon = new FontIcon { Glyph = "\uE7BA" },
840840
Text = Strings.SubDirectoryAccessDenied.GetLocalizedResource(),
841841
//Foreground = (SolidColorBrush)Application.Current.Resources["SystemControlErrorTextForegroundBrush"],
842-
FontSize = 12
843842
};
844843

845844
flyout.Items?.Add(flyoutItem);
@@ -859,7 +858,6 @@ public async Task SetPathBoxDropDownFlyoutAsync(MenuFlyout flyout, PathBoxItem p
859858
{
860859
Icon = new FontIcon { Glyph = "\uE8B7" }, // Use font icon as placeholder
861860
Text = childFolder.Item.Name,
862-
FontSize = 12,
863861
};
864862

865863
if (workingPath != childFolder.Path)

0 commit comments

Comments
 (0)