enhance: select any terminal when none is set

This commit is contained in:
Aikawa Yataro 2024-09-17 07:20:17 +00:00
parent 736ad02991
commit 54ab625931
No known key found for this signature in database
GPG key ID: 1C5D95FB10179404

View file

@ -41,6 +41,22 @@ namespace SourceGit.ViewModels
if (!_instance.IsGitConfigured())
_instance.GitInstallPath = Native.OS.FindGitExecutable();
if (!_instance.IsTerminalConfigured())
{
for (var i = 0; i < Models.ShellOrTerminal.Supported.Count; i++)
{
_instance.ShellOrTerminal = i;
if (string.IsNullOrEmpty(_instance.ShellOrTerminalPath))
{
_instance.ShellOrTerminal = -1;
}
else
{
break;
}
}
}
if (_instance.Workspaces.Count == 0)
_instance.Workspaces.Add(new Workspace() { Name = "Default", Color = 4278221015 });
@ -380,6 +396,11 @@ namespace SourceGit.ViewModels
return !string.IsNullOrEmpty(path) && File.Exists(path);
}
public bool IsTerminalConfigured()
{
return ShellOrTerminal != -1;
}
public bool ShouldCheck4UpdateOnStartup()
{
if (!_check4UpdatesOnStartup)