mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 04:34:59 +00:00
code_review: PR #1185
- make `SourceGit` running in singleton mode - `TrySendArgsToExistingInstance` should not be called before `BuildAvaloniaApp().StartWithClassicDesktopLifetime(args)` since we may want to launch `SourceGit` as a core editor. - avoid `preference.json` to be saved by multiple instances. - move IPC code to models. Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
09c0edef8e
commit
7d20f97f4e
5 changed files with 133 additions and 153 deletions
|
@ -90,12 +90,6 @@ namespace SourceGit.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
public bool OpenReposInNewTab
|
||||
{
|
||||
get => _openReposInNewTab;
|
||||
set => SetProperty(ref _openReposInNewTab, value);
|
||||
}
|
||||
|
||||
public bool UseSystemWindowFrame
|
||||
{
|
||||
get => _useSystemWindowFrame;
|
||||
|
@ -369,6 +363,11 @@ namespace SourceGit.ViewModels
|
|||
set => SetProperty(ref _lastCheckUpdateTime, value);
|
||||
}
|
||||
|
||||
public void SetCanModify()
|
||||
{
|
||||
_isReadonly = false;
|
||||
}
|
||||
|
||||
public bool IsGitConfigured()
|
||||
{
|
||||
var path = GitInstallPath;
|
||||
|
@ -496,7 +495,7 @@ namespace SourceGit.ViewModels
|
|||
|
||||
public void Save()
|
||||
{
|
||||
if (_isLoading)
|
||||
if (_isLoading || _isReadonly)
|
||||
return;
|
||||
|
||||
var file = Path.Combine(Native.OS.DataDir, "preference.json");
|
||||
|
@ -632,13 +631,13 @@ namespace SourceGit.ViewModels
|
|||
private static Preferences _instance = null;
|
||||
private static bool _isLoading = false;
|
||||
|
||||
private bool _isReadonly = true;
|
||||
private string _locale = "en_US";
|
||||
private string _theme = "Default";
|
||||
private string _themeOverrides = string.Empty;
|
||||
private string _defaultFontFamily = string.Empty;
|
||||
private string _monospaceFontFamily = string.Empty;
|
||||
private bool _onlyUseMonoFontInEditor = false;
|
||||
private bool _openReposInNewTab = false;
|
||||
private bool _useSystemWindowFrame = false;
|
||||
private double _defaultFontSize = 13;
|
||||
private double _editorFontSize = 13;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue