mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-22 20:37:19 -08:00
feature: enhance the behaviour of closing the last tab
* If the last tab is an opened repository, go back to the welcome page * If the last tab is welcome page, quit this app
This commit is contained in:
parent
6cd550af4d
commit
37b5f5c083
2 changed files with 17 additions and 8 deletions
|
@ -107,7 +107,22 @@ namespace SourceGit.ViewModels
|
|||
{
|
||||
if (Pages.Count == 1)
|
||||
{
|
||||
App.Quit();
|
||||
var last = Pages[0];
|
||||
if (last.Data is Repository repo)
|
||||
{
|
||||
Commands.AutoFetch.RemoveRepository(repo.FullPath);
|
||||
repo.Close();
|
||||
|
||||
last.Node = new RepositoryNode() { Id = Guid.NewGuid().ToString() };
|
||||
last.Data = new Welcome();
|
||||
|
||||
GC.Collect();
|
||||
}
|
||||
else
|
||||
{
|
||||
App.Quit();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,13 +26,7 @@ namespace SourceGit.ViewModels
|
|||
|
||||
public LauncherPage()
|
||||
{
|
||||
_node = new RepositoryNode()
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
Name = "WelcomePage",
|
||||
Bookmark = 0,
|
||||
IsRepository = false,
|
||||
};
|
||||
_node = new RepositoryNode() { Id = Guid.NewGuid().ToString() };
|
||||
_data = new Welcome();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue