From 1f0c4be6258aee0c11a9ae045c1e9362919ed3d5 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 21 Jun 2024 18:38:32 +0800 Subject: [PATCH] enhance: update GPG program path after type changed --- src/Views/Preference.axaml.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Views/Preference.axaml.cs b/src/Views/Preference.axaml.cs index 16d7b3cd..c70dad85 100644 --- a/src/Views/Preference.axaml.cs +++ b/src/Views/Preference.axaml.cs @@ -174,6 +174,20 @@ namespace SourceGit.Views GitVersion = ver; } + protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) + { + base.OnPropertyChanged(change); + + if (change.Property == GPGFormatProperty) + { + var config = new Commands.Config(null).ListAll(); + if (GPGFormat.Value == "opengpg" && config.TryGetValue("gpg.program", out var opengpg)) + GPGExecutableFile = opengpg; + else if (config.TryGetValue($"gpg.{GPGFormat.Value}.program", out var gpgProgram)) + GPGExecutableFile = gpgProgram; + } + } + private void BeginMoveWindow(object sender, PointerPressedEventArgs e) { BeginMoveDrag(e);