-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Fix: Fixed issue where changing a folder's grouping preference wouldn't update other open tabs #16572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
yaira2
merged 21 commits into
files-community:main
from
ferrariofilippo:bug_update_layout_between_tabs
Jan 26, 2025
Merged
Fix: Fixed issue where changing a folder's grouping preference wouldn't update other open tabs #16572
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
50bc63b
Fix: Keep sort and group options consistent between tabs
ferrariofilippo 8db6cbe
Remove outdated comment
ferrariofilippo 1e07cf3
Refresh both panes
ferrariofilippo 520057b
Update src/Files.App/Views/ShellPanesPage.xaml.cs
ferrariofilippo 2c33a81
Requested changes
ferrariofilippo 5895358
Fix: Keep sort and group options consistent between tabs
ferrariofilippo 9318842
Remove outdated comment
ferrariofilippo 3b16134
Refresh both panes
ferrariofilippo 1d58ad9
Update src/Files.App/Views/ShellPanesPage.xaml.cs
ferrariofilippo ee8a6ad
Requested changes
ferrariofilippo 350001e
Merge branch 'bug_update_layout_between_tabs' of https://github.com/f…
ferrariofilippo b3ad7c5
Required changes
ferrariofilippo 46f877d
Requested Changes
ferrariofilippo a8a9e61
Missing lines
ferrariofilippo 717c17e
Move to new class
ferrariofilippo dcafc4b
Update only needed properties
ferrariofilippo 3084211
Revert "Update only needed properties"
ferrariofilippo 6193152
Update method names
ferrariofilippo 65edd08
Move method to LayoutHelpers
ferrariofilippo 534f572
Update src/Files.App/Helpers/Layout/LayoutHelpers.cs
ferrariofilippo caec4e0
Build errors
ferrariofilippo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright (c) Files Community | ||
// Licensed under the MIT License. | ||
|
||
namespace Files.App.Helpers | ||
{ | ||
static class LayoutHelpers | ||
{ | ||
public static void UpdateOpenTabsPreferences() | ||
{ | ||
// Services | ||
var multitaskingContext = Ioc.Default.GetRequiredService<IMultitaskingContext>(); | ||
var layoutSettingsService = Ioc.Default.GetRequiredService<ILayoutSettingsService>(); | ||
|
||
// Get all tab instances and active path | ||
var tabs = multitaskingContext.Control?.GetAllTabInstances(); | ||
var activePath = (multitaskingContext.CurrentTabItem?.TabItemContent as ShellPanesPage)?.ActivePane?.TabBarItemParameter?.NavigationParameter as string; | ||
|
||
// Return if required data is missing | ||
if (tabs is null || activePath is null) | ||
return; | ||
|
||
for (int i = 0; i < tabs.Count; i++) | ||
{ | ||
var isNotCurrentTab = i != multitaskingContext.CurrentTabIndex; | ||
var shPage = tabs[i] as ShellPanesPage; | ||
|
||
if (shPage is not null) | ||
{ | ||
foreach (var pane in shPage.GetPanes()) | ||
{ | ||
var path = pane.ShellViewModel?.CurrentFolder?.ItemPath; | ||
|
||
// Skip panes without a valid path | ||
if (path is null) | ||
continue; | ||
|
||
// Check if we need to update preferences for this pane | ||
if ((isNotCurrentTab || pane != shPage.ActivePane) && | ||
(layoutSettingsService.SyncFolderPreferencesAcrossDirectories || | ||
path.Equals(activePath, StringComparison.OrdinalIgnoreCase))) | ||
if (pane.SlimContentPage is BaseLayoutPage page) | ||
page.FolderSettings?.ReloadGroupAndSortPreferences(path); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.