Skip to content

Commit

Permalink
Fix: Fixed issue where opening folders from external source didn't ho…
Browse files Browse the repository at this point in the history
…nor the dual pane settings (#13014)
  • Loading branch information
hishitetsu authored Jul 21, 2023
1 parent f6a7445 commit a1cf0db
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/Files.App/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,12 @@ async Task PerformNavigation(string payload, string selectItem = null)
payload = folder.Path; // Convert short name to long name (#6190)
}

var generalSettingsService = Ioc.Default.GetService<IGeneralSettingsService>();
var paneNavigationArgs = new PaneNavigationArguments
{
LeftPaneNavPathParam = payload,
LeftPaneSelectItemParam = selectItem,
RightPaneNavPathParam = Bounds.Width > PaneHolderPage.DualPaneWidthThreshold && (generalSettingsService?.AlwaysOpenDualPaneInNewTab ?? false) ? "Home" : null,
};

if (rootFrame.Content is MainPage)
Expand Down
8 changes: 5 additions & 3 deletions src/Files.App/Views/PaneHolderPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ namespace Files.App.Views
{
public sealed partial class PaneHolderPage : Page, IPaneHolder, ITabItemContent
{
public static readonly int DualPaneWidthThreshold = 750;

public static event EventHandler<PaneHolderPage>? CurrentInstanceChanged;

private IUserSettingsService UserSettingsService { get; }
Expand Down Expand Up @@ -46,7 +48,7 @@ public TabItemArguments TabItemArguments
}
}

private bool _WindowIsCompact = MainWindow.Instance.Bounds.Width <= 750;
private bool _WindowIsCompact = MainWindow.Instance.Bounds.Width <= DualPaneWidthThreshold;
public bool WindowIsCompact
{
get => _WindowIsCompact;
Expand Down Expand Up @@ -78,7 +80,7 @@ public bool IsMultiPaneActive
=> IsRightPaneVisible;

public bool IsMultiPaneEnabled
=> !(MainWindow.Instance.Bounds.Width <= 750);
=> MainWindow.Instance.Bounds.Width > DualPaneWidthThreshold;

private NavigationParams _NavParamsLeft;
public NavigationParams NavParamsLeft
Expand Down Expand Up @@ -208,7 +210,7 @@ public PaneHolderPage()

private void Current_SizeChanged(object sender, WindowSizeChangedEventArgs e)
{
WindowIsCompact = MainWindow.Instance.Bounds.Width <= 750;
WindowIsCompact = MainWindow.Instance.Bounds.Width <= DualPaneWidthThreshold;
}

protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
Expand Down

0 comments on commit a1cf0db

Please sign in to comment.