mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
fix<Bookmark>: bookmark changes will not be saved when there's no welcome page
This commit is contained in:
parent
6e624797ae
commit
afe0220a46
4 changed files with 19 additions and 15 deletions
|
@ -27,11 +27,20 @@ namespace SourceGit.Models {
|
||||||
public string Name { get; set; } = "";
|
public string Name { get; set; } = "";
|
||||||
public string Path { get; set; } = "";
|
public string Path { get; set; } = "";
|
||||||
public string GitDir { get; set; } = "";
|
public string GitDir { get; set; } = "";
|
||||||
public int Bookmark { get; set; } = 0;
|
|
||||||
public long LastOpenTime { get; set; } = 0;
|
public long LastOpenTime { get; set; } = 0;
|
||||||
public List<SubTree> SubTrees { get; set; } = new List<SubTree>();
|
public List<SubTree> SubTrees { get; set; } = new List<SubTree>();
|
||||||
public List<string> Filters { get; set; } = new List<string>();
|
public List<string> Filters { get; set; } = new List<string>();
|
||||||
public List<string> CommitMessages { get; set; } = new List<string>();
|
public List<string> CommitMessages { get; set; } = new List<string>();
|
||||||
|
|
||||||
|
public int Bookmark {
|
||||||
|
get { return bookmark; }
|
||||||
|
set {
|
||||||
|
if (value != bookmark) {
|
||||||
|
bookmark = value;
|
||||||
|
Watcher.NotifyBookmarkChanged(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region PROPERTIES_RUNTIME
|
#region PROPERTIES_RUNTIME
|
||||||
|
@ -122,5 +131,6 @@ namespace SourceGit.Models {
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly object updateFilterLock = new object();
|
private readonly object updateFilterLock = new object();
|
||||||
|
private int bookmark = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,12 +103,11 @@ namespace SourceGit.Models {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置仓库标签变化
|
/// 通知仓库标签变化
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="repo"></param>
|
/// <param name="repo"></param>
|
||||||
/// <param name="bookmark"></param>
|
public static void NotifyBookmarkChanged(Repository repo) {
|
||||||
public static void SetBookmark(string repo, int bookmark) {
|
BookmarkChanged?.Invoke(repo.Path, repo.Bookmark);
|
||||||
BookmarkChanged?.Invoke(repo, bookmark);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -364,7 +364,8 @@ namespace SourceGit.Views.Widgets {
|
||||||
|
|
||||||
var refIdx = i;
|
var refIdx = i;
|
||||||
mark.Click += (o, ev) => {
|
mark.Click += (o, ev) => {
|
||||||
Models.Watcher.SetBookmark(tab.Id, refIdx);
|
var repo = Models.Preference.Instance.FindRepository(tab.Id);
|
||||||
|
if (repo != null) repo.Bookmark = refIdx;
|
||||||
ev.Handled = true;
|
ev.Handled = true;
|
||||||
};
|
};
|
||||||
bookmark.Items.Add(mark);
|
bookmark.Items.Add(mark);
|
||||||
|
|
|
@ -18,15 +18,9 @@ namespace SourceGit.Views.Widgets {
|
||||||
public Welcome() {
|
public Welcome() {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
UpdateVisibles();
|
UpdateVisibles();
|
||||||
Models.Theme.AddListener(this, UpdateVisibles);
|
|
||||||
|
|
||||||
Models.Watcher.BookmarkChanged += (repoPath, bookmark) => {
|
Models.Theme.AddListener(this, UpdateVisibles);
|
||||||
var repo = Models.Preference.Instance.FindRepository(repoPath);
|
Models.Watcher.BookmarkChanged += (_, __) => { UpdateVisibles(); };
|
||||||
if (repo != null) {
|
|
||||||
repo.Bookmark = bookmark;
|
|
||||||
UpdateVisibles();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FUNC_EVENTS
|
#region FUNC_EVENTS
|
||||||
|
@ -148,7 +142,7 @@ namespace SourceGit.Views.Widgets {
|
||||||
|
|
||||||
var refIdx = i;
|
var refIdx = i;
|
||||||
mark.Click += (o, ev) => {
|
mark.Click += (o, ev) => {
|
||||||
Models.Watcher.SetBookmark(repo.Path, refIdx);
|
repo.Bookmark = refIdx;
|
||||||
ev.Handled = true;
|
ev.Handled = true;
|
||||||
};
|
};
|
||||||
bookmark.Items.Add(mark);
|
bookmark.Items.Add(mark);
|
||||||
|
|
Loading…
Reference in a new issue