From e8c8ac55a14c73faf1bfce5dd74cf54911263124 Mon Sep 17 00:00:00 2001 From: "Dmitrij D. Czarkoff" Date: Tue, 19 Nov 2024 19:01:09 +0100 Subject: [PATCH] fix: hide children behind the preference --- src/Resources/Locales/en_US.axaml | 1 + src/ViewModels/CommitDetail.cs | 15 +++++++++------ src/ViewModels/Preference.cs | 8 ++++++++ src/Views/Preference.axaml | 9 +++++++-- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index cb0bf568..462cdf90 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -452,6 +452,7 @@ Language History Commits Show author time intead of commit time in graph + Show children in the comment details Subject Guide Length GIT Enable Auto CRLF diff --git a/src/ViewModels/CommitDetail.cs b/src/ViewModels/CommitDetail.cs index a816d48a..6d819300 100644 --- a/src/ViewModels/CommitDetail.cs +++ b/src/ViewModels/CommitDetail.cs @@ -543,13 +543,16 @@ namespace SourceGit.ViewModels _cancelToken = new Commands.Command.CancelToken(); - Task.Run(() => + if (Preference.Instance.ShowChildren) { - var cmdChildren = new Commands.QueryCommitChildren(_repo.FullPath, _commit.SHA, _repo.Settings.BuildHistoriesFilter()) { Cancel = _cancelToken }; - var children = cmdChildren.Result(); - if (!cmdChildren.Cancel.Requested) - Dispatcher.UIThread.Post(() => Children.AddRange(children)); - }); + Task.Run(() => + { + var cmdChildren = new Commands.QueryCommitChildren(_repo.FullPath, _commit.SHA, _repo.Settings.BuildHistoriesFilter()) { Cancel = _cancelToken }; + var children = cmdChildren.Result(); + if (!cmdChildren.Cancel.Requested) + Dispatcher.UIThread.Post(() => Children.AddRange(children)); + }); + } Task.Run(() => { diff --git a/src/ViewModels/Preference.cs b/src/ViewModels/Preference.cs index 68065df1..9d3de526 100644 --- a/src/ViewModels/Preference.cs +++ b/src/ViewModels/Preference.cs @@ -294,6 +294,12 @@ namespace SourceGit.ViewModels set => SetProperty(ref _statisticsSampleColor, value); } + public bool ShowChildren + { + get => _showChildren; + set => SetProperty(ref _showChildren, value); + } + public List RepositoryNodes { get; @@ -617,5 +623,7 @@ namespace SourceGit.ViewModels private string _externalMergeToolPath = string.Empty; private uint _statisticsSampleColor = 0xFF00FF00; + + private bool _showChildren = false; } } diff --git a/src/Views/Preference.axaml b/src/Views/Preference.axaml index 9b84604a..0c7986ab 100644 --- a/src/Views/Preference.axaml +++ b/src/Views/Preference.axaml @@ -45,7 +45,7 @@ - + + + @@ -188,7 +193,7 @@ - +