Skip to content

Commit 18fbdba

Browse files
committed
Update
1 parent 23ac348 commit 18fbdba

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ public class WindowsRecentItemsService : IWindowsRecentItemsService
2121

2222
private readonly SystemIO.FileSystemWatcher? _watcher;
2323

24-
private DateTime _lastRecentItemsContainerFileReadTime = DateTime.MinValue;
25-
2624
// Properties
2725

2826
private readonly List<RecentItem> _RecentFiles = [];
@@ -140,21 +138,21 @@ public bool CheckIsRecentItemsEnabled()
140138

141139
if (subkey is not null)
142140
{
143-
// quick access: show recent files option
141+
// File Explorer settings
144142
bool showRecentValue = Convert.ToBoolean(subkey.GetValue("ShowRecent", true)); // 1 by default
145143
if (!showRecentValue)
146144
return false;
147145
}
148146

149147
if (advSubkey is not null)
150148
{
151-
// settings: personalization > start > show recently opened items
149+
// Windows Settings
152150
bool startTrackDocsValue = Convert.ToBoolean(advSubkey.GetValue("Start_TrackDocs", true)); // 1 by default
153151
if (!startTrackDocsValue)
154152
return false;
155153
}
156154

157-
// for users in group policies
155+
// Group policy settings
158156
var policySubkey = userPolicySubkey ?? sysPolicySubkey;
159157
if (policySubkey is not null)
160158
{
@@ -172,21 +170,22 @@ private unsafe bool UpdateRecentFilesInternal()
172170
{
173171
HRESULT hr = default;
174172

173+
// Get IShellItem of the quick access shell folder
175174
string szFolderShellPath = "Shell:::{679f85cb-0220-4080-b29b-5540cc05aab6}";
176175
var shellItemIid = typeof(IShellItem).GUID;
177176
using ComPtr<IShellItem> pFolderShellItem = default;
178177
fixed (char* pszFolderShellPath = szFolderShellPath)
179178
hr = PInvoke.SHCreateItemFromParsingName(pszFolderShellPath, null, &shellItemIid, (void**)pFolderShellItem.GetAddressOf());
180179

180+
// Get IEnumShellItems of the quick access shell folder
181181
var enumItemsBHID = PInvoke.BHID_EnumItems;
182182
Guid enumShellItemIid = typeof(IEnumShellItems).GUID;
183183
using ComPtr<IEnumShellItems> pEnumShellItems = default;
184184
hr = pFolderShellItem.Get()->BindToHandler(null, &enumItemsBHID, &enumShellItemIid, (void**)pEnumShellItems.GetAddressOf());
185185

186-
List<RecentItem> recentItems = [];
187-
188186
// Enumerate recent items and populate the list
189187
int index = 0;
188+
List<RecentItem> recentItems = [];
190189
using ComPtr<IShellItem> pShellItem = default;
191190
while (pEnumShellItems.Get()->Next(1, pShellItem.GetAddressOf()) == HRESULT.S_OK)
192191
{

0 commit comments

Comments
 (0)