Skip to content

Commit 23eafb1

Browse files
authored
Feature: Renamed "Favorites" section to "Pinned" (#14862)
1 parent a9557ed commit 23eafb1

37 files changed

+192
-200
lines changed

docs/rich-commands.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ This is the list of all commands defined in `CommandCodes` enum except `None`.
5151
| Share | ShareItem | Share | Share selected file(s) with others | |
5252
| Start | PinToStart | Pin to the Start Menu | Pin item(s) to the Start Menu | |
5353
| | UnpinFromStart | Unpin from the Start Menu | Unpin item(s) from the Start Menu | |
54-
| Favorites | PinItemToFavorites | Pin to Favorites | Pin folder(s) to Favorites | |
55-
| | UnpinItemFromFavorites | Unpin from Favorites | Unpin folder(s) from Favorites | |
54+
| Sidebar | PinFolderToSidebar | Pin to Sidebar | Pin folder(s) to Sidebar | |
55+
| | UnpinFolderFromSidebar | Unpin from Sidebar | Unpin folder(s) from Sidebar | |
5656
| Backgrounds | SetAsWallpaperBackground | Set as desktop background | Set selected picture as desktop background | |
5757
| | SetAsSlideshowBackground | Set as desktop slideshow | Set selected pictures as desktop slideshow | |
5858
| | SetAsLockscreenBackground | Set as lockscreen background | Set selected picture as lockscreen background | |

src/Files.App/Actions/Favorites/PinItemAction.cs renamed to src/Files.App/Actions/Sidebar/PinFolderToSidebarAction.cs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,28 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4-
using Files.App.Services;
5-
using Files.App.UserControls.Widgets;
64
using Windows.Storage;
75

86
namespace Files.App.Actions
97
{
10-
internal class PinItemAction : ObservableObject, IAction
8+
internal sealed class PinFolderToSidebarAction : ObservableObject, IAction
119
{
1210
private readonly IContentPageContext context;
13-
1411
private readonly IQuickAccessService service;
1512

1613
public string Label
17-
=> "PinToFavorites".GetLocalizedResource();
14+
=> "PinFolderToSidebar".GetLocalizedResource();
1815

1916
public string Description
20-
=> "PinItemToFavoritesDescription".GetLocalizedResource();
17+
=> "PinFolderToSidebarDescription".GetLocalizedResource();
2118

2219
public RichGlyph Glyph
23-
=> new(opacityStyle: "ColorIconPinToFavorites");
20+
=> new(opacityStyle: "Icons.Pin.16x16");
2421

2522
public bool IsExecutable
2623
=> GetIsExecutable();
2724

28-
public PinItemAction()
25+
public PinFolderToSidebarAction()
2926
{
3027
context = Ioc.Default.GetRequiredService<IContentPageContext>();
3128
service = Ioc.Default.GetRequiredService<IQuickAccessService>();
@@ -50,7 +47,7 @@ public async Task ExecuteAsync()
5047

5148
private bool GetIsExecutable()
5249
{
53-
string[] favorites = App.QuickAccessManager.Model.FavoriteItems.ToArray();
50+
string[] pinnedFolders = App.QuickAccessManager.Model.PinnedFolders.ToArray();
5451

5552
return context.HasSelection
5653
? context.SelectedItems.All(IsPinnable)
@@ -60,7 +57,7 @@ bool IsPinnable(ListedItem item)
6057
{
6158
return
6259
item.PrimaryItemAttribute is StorageItemTypes.Folder &&
63-
!favorites.Contains(item.ItemPath);
60+
!pinnedFolders.Contains(item.ItemPath);
6461
}
6562
}
6663

src/Files.App/Actions/Favorites/UnpinItemAction.cs renamed to src/Files.App/Actions/Sidebar/UnpinFolderToSidebarAction.cs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,26 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4-
using Files.App.Services;
5-
using Files.App.UserControls.Widgets;
6-
74
namespace Files.App.Actions
85
{
9-
internal class UnpinItemAction : ObservableObject, IAction
6+
internal sealed class UnpinFolderFromSidebarAction : ObservableObject, IAction
107
{
118
private readonly IContentPageContext context;
12-
139
private readonly IQuickAccessService service;
1410

1511
public string Label
16-
=> "UnpinFromFavorites".GetLocalizedResource();
12+
=> "UnpinFolderFromSidebar".GetLocalizedResource();
1713

1814
public string Description
19-
=> "UnpinItemFromFavoritesDescription".GetLocalizedResource();
15+
=> "UnpinFolderFromSidebarDescription".GetLocalizedResource();
2016

2117
public RichGlyph Glyph
22-
=> new(opacityStyle: "ColorIconUnpinFromFavorites");
18+
=> new(opacityStyle: "Icons.Unpin.16x16");
2319

2420
public bool IsExecutable
2521
=> GetIsExecutable();
2622

27-
public UnpinItemAction()
23+
public UnpinFolderFromSidebarAction()
2824
{
2925
context = Ioc.Default.GetRequiredService<IContentPageContext>();
3026
service = Ioc.Default.GetRequiredService<IQuickAccessService>();
@@ -48,15 +44,15 @@ public async Task ExecuteAsync()
4844

4945
private bool GetIsExecutable()
5046
{
51-
string[] favorites = App.QuickAccessManager.Model.FavoriteItems.ToArray();
47+
string[] pinnedFolders = App.QuickAccessManager.Model.PinnedFolders.ToArray();
5248

5349
return context.HasSelection
5450
? context.SelectedItems.All(IsPinned)
5551
: context.Folder is not null && IsPinned(context.Folder);
5652

5753
bool IsPinned(ListedItem item)
5854
{
59-
return favorites.Contains(item.ItemPath);
55+
return pinnedFolders.Contains(item.ItemPath);
6056
}
6157
}
6258

src/Files.App/Actions/Start/PinToStartAction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public string Description
2121
=> "PinToStartDescription".GetLocalizedResource();
2222

2323
public RichGlyph Glyph
24-
=> new(opacityStyle: "ColorIconPinToFavorites");
24+
=> new(opacityStyle: "Icons.Pin.16x16");
2525

2626
public bool IsExecutable =>
2727
context.ShellPage is not null;

src/Files.App/Actions/Start/UnpinFromStartAction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public string Description
2020
=> "UnpinFromStartDescription".GetLocalizedResource();
2121

2222
public RichGlyph Glyph
23-
=> new(opacityStyle: "ColorIconUnpinFromFavorites");
23+
=> new(opacityStyle: "Icons.Unpin.16x16");
2424

2525
public UnpinFromStartAction()
2626
{

src/Files.App/Constants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public static class Shell32
6464
public static class FluentIconsPaths
6565
{
6666
public const string CloudDriveIcon = "ms-appx:///Assets/FluentIcons/CloudDrive.png";
67-
public const string FavoritesIcon = "ms-appx:///Assets/FluentIcons/Favorites.png";
67+
public const string StarIcon = "ms-appx:///Assets/FluentIcons/Star.png";
6868
public const string FileTagsIcon = "ms-appx:///Assets/FluentIcons/FileTags.png";
6969
public const string HomeIcon = "ms-appx:///Assets/FluentIcons/Home.png";
7070
}

src/Files.App/Data/Commands/CommandCodes.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ public enum CommandCodes
6363
PinToStart,
6464
UnpinFromStart,
6565

66-
// Favorites
67-
PinItemToFavorites,
68-
UnpinItemFromFavorites,
66+
// Sidebar
67+
PinFolderToSidebar,
68+
UnpinFolderFromSidebar,
6969

7070
// Backgrounds
7171
SetAsWallpaperBackground,

src/Files.App/Data/Commands/Manager/CommandManager.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ public IRichCommand this[HotKey hotKey]
6969
public IRichCommand AddItem => commands[CommandCodes.AddItem];
7070
public IRichCommand PinToStart => commands[CommandCodes.PinToStart];
7171
public IRichCommand UnpinFromStart => commands[CommandCodes.UnpinFromStart];
72-
public IRichCommand PinItemToFavorites => commands[CommandCodes.PinItemToFavorites];
73-
public IRichCommand UnpinItemFromFavorites => commands[CommandCodes.UnpinItemFromFavorites];
72+
public IRichCommand PinFolderToSidebar => commands[CommandCodes.PinFolderToSidebar];
73+
public IRichCommand UnpinFolderFromSidebar => commands[CommandCodes.UnpinFolderFromSidebar];
7474
public IRichCommand SetAsWallpaperBackground => commands[CommandCodes.SetAsWallpaperBackground];
7575
public IRichCommand SetAsSlideshowBackground => commands[CommandCodes.SetAsSlideshowBackground];
7676
public IRichCommand SetAsLockscreenBackground => commands[CommandCodes.SetAsLockscreenBackground];
@@ -238,8 +238,8 @@ public CommandManager()
238238
[CommandCodes.AddItem] = new AddItemAction(),
239239
[CommandCodes.PinToStart] = new PinToStartAction(),
240240
[CommandCodes.UnpinFromStart] = new UnpinFromStartAction(),
241-
[CommandCodes.PinItemToFavorites] = new PinItemAction(),
242-
[CommandCodes.UnpinItemFromFavorites] = new UnpinItemAction(),
241+
[CommandCodes.PinFolderToSidebar] = new PinFolderToSidebarAction(),
242+
[CommandCodes.UnpinFolderFromSidebar] = new UnpinFolderFromSidebarAction(),
243243
[CommandCodes.SetAsWallpaperBackground] = new SetAsWallpaperBackgroundAction(),
244244
[CommandCodes.SetAsSlideshowBackground] = new SetAsSlideshowBackgroundAction(),
245245
[CommandCodes.SetAsLockscreenBackground] = new SetAsLockscreenBackgroundAction(),

src/Files.App/Data/Commands/Manager/ICommandManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ public interface ICommandManager : IEnumerable<IRichCommand>
5858

5959
IRichCommand PinToStart { get; }
6060
IRichCommand UnpinFromStart { get; }
61-
IRichCommand PinItemToFavorites { get; }
62-
IRichCommand UnpinItemFromFavorites { get; }
61+
IRichCommand PinFolderToSidebar { get; }
62+
IRichCommand UnpinFolderFromSidebar { get; }
6363

6464
IRichCommand SetAsWallpaperBackground { get; }
6565
IRichCommand SetAsSlideshowBackground { get; }

0 commit comments

Comments
 (0)