diff --git a/src/App.axaml b/src/App.axaml
index 56d81615..3b84f7da 100644
--- a/src/App.axaml
+++ b/src/App.axaml
@@ -22,6 +22,7 @@
+
diff --git a/src/Converters/BookmarkConverters.cs b/src/Converters/BookmarkConverters.cs
deleted file mode 100644
index ea755a00..00000000
--- a/src/Converters/BookmarkConverters.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Data.Converters;
-using Avalonia.Media;
-
-namespace SourceGit.Converters
-{
- public static class BookmarkConverters
- {
- public static readonly FuncValueConverter ToBrush =
- new FuncValueConverter(bookmark =>
- {
- if (bookmark == 0)
- return Application.Current?.FindResource("Brush.FG1") as IBrush;
- else
- return Models.Bookmarks.Brushes[bookmark];
- });
- }
-}
diff --git a/src/Converters/IntConverters.cs b/src/Converters/IntConverters.cs
index 765ff6ef..500f0d1e 100644
--- a/src/Converters/IntConverters.cs
+++ b/src/Converters/IntConverters.cs
@@ -1,5 +1,10 @@
-using Avalonia;
+using System;
+using System.Globalization;
+
+using Avalonia;
+using Avalonia.Controls;
using Avalonia.Data.Converters;
+using Avalonia.Media;
namespace SourceGit.Converters
{
@@ -28,5 +33,29 @@ namespace SourceGit.Converters
public static readonly FuncValueConverter ToTreeMargin =
new FuncValueConverter(v => new Thickness(v * 16, 0, 0, 0));
+
+ public static readonly FuncValueConverter ToBookmarkBrush =
+ new FuncValueConverter(bookmark =>
+ {
+ if (bookmark == 0)
+ return Application.Current?.FindResource("Brush.FG1") as IBrush;
+ else
+ return Models.Bookmarks.Brushes[bookmark];
+ });
+
+ public class ToColorConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return Color.FromUInt32((uint)value);
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return ((Color)value).ToUInt32();
+ }
+ }
+
+ public static readonly ToColorConverter ToColor = new ToColorConverter();
}
}
diff --git a/src/Native/Linux.cs b/src/Native/Linux.cs
index ca6e7c56..1b33cc5d 100644
--- a/src/Native/Linux.cs
+++ b/src/Native/Linux.cs
@@ -35,7 +35,7 @@ namespace SourceGit.Native
}
public void SetupApp(AppBuilder builder)
- {
+ {
builder.With(new X11PlatformOptions()
{
EnableIme = true,
diff --git a/src/Resources/Icons.axaml b/src/Resources/Icons.axaml
index 7ae35731..62c46ee6 100644
--- a/src/Resources/Icons.axaml
+++ b/src/Resources/Icons.axaml
@@ -119,6 +119,7 @@
M153 154h768v768h-768v-768zm64 64v640h640v-640h-640z
M256 128l0 192L64 320l0 576 704 0 0-192 192 0L960 128 256 128zM704 832 128 832 128 384l576 0L704 832zM896 640l-128 0L768 320 320 320 320 192l576 0L896 640z
M248 221a77 77 0 00-30-21c-18-7-40-10-68-5a224 224 0 00-45 13c-5 2-10 5-15 8l-3 2v68l11-9c10-8 21-14 34-19 13-5 26-7 39-7 12 0 21 3 28 10 6 6 9 16 9 29l-62 9c-14 2-26 6-36 11a80 80 0 00-25 20c-7 8-12 17-15 27-6 21-6 44 1 65a70 70 0 0041 43c10 4 21 6 34 6a80 80 0 0063-28v22h64V298c0-16-2-31-6-44a91 91 0 00-18-33zm-41 121v15c0 8-1 15-4 22a48 48 0 01-24 29 44 44 0 01-33 2 29 29 0 01-10-6 25 25 0 01-6-9 30 30 0 01-2-12c0-5 1-9 2-14a21 21 0 015-9 28 28 0 0110-7 83 83 0 0120-5l42-6zm323-68a144 144 0 00-16-42 87 87 0 00-28-29 75 75 0 00-41-11 73 73 0 00-44 14c-6 5-12 11-17 17V64H326v398h59v-18c8 10 18 17 30 21 6 2 13 3 21 3 16 0 31-4 43-11 12-7 23-18 31-31a147 147 0 0019-46 248 248 0 006-57c0-17-2-33-5-49zm-55 49c0 15-1 28-4 39-2 11-6 20-10 27a41 41 0 01-15 15 37 37 0 01-36 1 44 44 0 01-13-12 59 59 0 01-9-18A76 76 0 01384 352v-33c0-10 1-20 4-29 2-8 6-15 10-22a43 43 0 0115-13 37 37 0 0119-5 35 35 0 0132 18c4 6 7 14 9 23 2 9 3 20 3 31zM154 634a58 58 0 0120-15c14-6 35-7 49-1 7 3 13 6 20 12l21 17V572l-6-4a124 124 0 00-58-14c-20 0-38 4-54 11-16 7-30 17-41 30-12 13-20 29-26 46-6 17-9 36-9 57 0 18 3 36 8 52 6 16 14 30 24 42 10 12 23 21 38 28 15 7 32 10 50 10 15 0 28-2 39-5 11-3 21-8 30-14l5-4v-57l-13 6a26 26 0 01-5 2c-3 1-6 2-8 3-2 1-15 6-15 6-4 2-9 3-14 4a63 63 0 01-38-4 53 53 0 01-20-14 70 70 0 01-13-24 111 111 0 01-5-34c0-13 2-26 5-36 3-10 8-19 14-26zM896 384h-256V320h288c21 1 32 12 32 32v384c0 18-12 32-32 32H504l132 133-45 45-185-185c-16-21-16-25 0-45l185-185L637 576l-128 128H896V384z
+ M128 691H6V38h838v160h-64V102H70v525H128zM973 806H154V250h819v557zm-755-64h691V314H218v429zM365 877h448v64h-448z
M512 0C229 0 0 72 0 160v128C0 376 229 448 512 448s512-72 512-160v-128C1024 72 795 0 512 0zM512 544C229 544 0 472 0 384v192c0 88 229 160 512 160s512-72 512-160V384c0 88-229 160-512 160zM512 832c-283 0-512-72-512-160v192C0 952 229 1024 512 1024s512-72 512-160v-192c0 88-229 160-512 160z
M640 725 768 725 768 597 853 597 853 725 981 725 981 811 853 811 853 939 768 939 768 811 640 811 640 725M384 128C573 128 725 204 725 299 725 393 573 469 384 469 195 469 43 393 43 299 43 204 195 128 384 128M43 384C43 478 195 555 384 555 573 555 725 478 725 384L725 512 683 512 683 595C663 612 640 627 610 640L555 640 555 660C504 675 446 683 384 683 195 683 43 606 43 512L43 384M43 597C43 692 195 768 384 768 446 768 504 760 555 745L555 873C504 888 446 896 384 896 195 896 43 820 43 725L43 597Z
diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml
index adc22a10..6bd9201e 100644
--- a/src/Resources/Locales/de_DE.axaml
+++ b/src/Resources/Locales/de_DE.axaml
@@ -392,7 +392,6 @@
Beim Starten nach Updates suchen
Sprache
Commit-Historie
- Zuletzt geöffnete Tabs beim Starten wiederherstellen
Längenvorgabe für Commit-Nachrichten
GIT
Remotes automatisch fetchen
diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml
index 68957769..ae321269 100644
--- a/src/Resources/Locales/en_US.axaml
+++ b/src/Resources/Locales/en_US.axaml
@@ -146,6 +146,9 @@
HTTP proxy used by this repository
User Name
User name for this repository
+ Workspaces
+ Name
+ Color
Copy
Copy All Text
COPY MESSAGE
@@ -394,7 +397,6 @@
Check for updates on startup
Language
History Commits
- Restore last opened tab(s) on startup
Subject Guide Length
GIT
Fetch remotes automatically
@@ -624,6 +626,7 @@
VIEW ASSUME UNCHANGED
Template: ${0}$
Right-click the selected file(s), and make your choice to resolve conflicts.
+ Configure...
WORKTREE
Copy Path
Lock
diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml
index b9639064..702b5c5a 100644
--- a/src/Resources/Locales/fr_FR.axaml
+++ b/src/Resources/Locales/fr_FR.axaml
@@ -391,7 +391,6 @@
Vérifier les mises à jour au démarrage
Language
Historique de commits
- Restaurer les onglets au démarrage
Guide de longueur du sujet
GIT
Fetch les dépôts distants automatiquement
diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml
index d7e3456f..ad3c6ed2 100644
--- a/src/Resources/Locales/pt_BR.axaml
+++ b/src/Resources/Locales/pt_BR.axaml
@@ -385,7 +385,6 @@
Verificar atualizações na inicialização
Idioma
Commits do Histórico
- Restaurar as últimas abas abertas na inicialização
Comprimento do Guia de Assunto
GIT
Buscar remotos automaticamente
diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml
index 550750a6..30037ef2 100644
--- a/src/Resources/Locales/zh_CN.axaml
+++ b/src/Resources/Locales/zh_CN.axaml
@@ -149,6 +149,9 @@
HTTP网络代理
用户名
应用于本仓库的用户名
+ 工作区
+ 名称
+ 颜色
复制
复制全部文本
复制内容
@@ -397,7 +400,6 @@
启动时检测软件更新
显示语言
最大历史提交数
- 启动时恢复上次打开的仓库
SUBJECT字数检测
GIT配置
启用定时自动拉取远程更新
@@ -626,6 +628,7 @@
查看忽略变更文件
模板:${0}$
请选中冲突文件,打开右键菜单,选择合适的解决方式
+ 配置工作区...
本地工作树
复制工作树路径
锁定工作树
diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml
index 279f63b0..a2e5e1ce 100644
--- a/src/Resources/Locales/zh_TW.axaml
+++ b/src/Resources/Locales/zh_TW.axaml
@@ -149,6 +149,9 @@
HTTP 網路代理
使用者名稱
用於本存放庫的使用者名稱
+ 工作區
+ 名稱
+ 顏色
複製
複製全部內容
複製內容
@@ -397,7 +400,6 @@
啟動時檢查軟體更新
顯示語言
最大歷史提交數
- 啟動時還原上次開啟的存放庫
提交標題字數偵測
Git 設定
啟用定時自動提取 (fetch) 遠端更新
@@ -627,6 +629,7 @@
檢視不追蹤變更的檔案
範本: ${0}$
請選擇發生衝突的檔案,開啟右鍵選單,選擇合適的解決方式
+ 配置工作區...
本機工作區
複製工作區路徑
鎖定工作區
diff --git a/src/SourceGit.csproj b/src/SourceGit.csproj
index 9154bd2a..4726a828 100644
--- a/src/SourceGit.csproj
+++ b/src/SourceGit.csproj
@@ -39,6 +39,7 @@
+
diff --git a/src/ViewModels/ConfigureWorkspace.cs b/src/ViewModels/ConfigureWorkspace.cs
new file mode 100644
index 00000000..2c6c5595
--- /dev/null
+++ b/src/ViewModels/ConfigureWorkspace.cs
@@ -0,0 +1,60 @@
+using System;
+using Avalonia.Collections;
+using CommunityToolkit.Mvvm.ComponentModel;
+
+namespace SourceGit.ViewModels
+{
+ public class ConfigureWorkspace : ObservableObject
+ {
+ public AvaloniaList Workspaces
+ {
+ get;
+ private set;
+ }
+
+ public Workspace Selected
+ {
+ get => _selected;
+ set
+ {
+ if (SetProperty(ref _selected, value))
+ CanDeleteSelected = value != null && !value.IsActive;
+ }
+ }
+
+ public bool CanDeleteSelected
+ {
+ get => _canDeleteSelected;
+ private set => SetProperty(ref _canDeleteSelected, value);
+ }
+
+ public ConfigureWorkspace()
+ {
+ Workspaces = new AvaloniaList();
+ Workspaces.AddRange(Preference.Instance.Workspaces);
+ }
+
+ public void Add()
+ {
+ var workspace = new Workspace();
+ workspace.Name = $"Unnamed {DateTime.Now:yyyy-MM-dd HH:mm:ss}";
+ workspace.Color = 4278221015;
+
+ Preference.Instance.Workspaces.Add(workspace);
+ Workspaces.Add(workspace);
+ Selected = workspace;
+ }
+
+ public void Delete()
+ {
+ if (_selected == null || _selected.IsActive)
+ return;
+
+ Preference.Instance.Workspaces.Remove(_selected);
+ Workspaces.Remove(_selected);
+ }
+
+ private Workspace _selected = null;
+ private bool _canDeleteSelected = false;
+ }
+}
diff --git a/src/ViewModels/Launcher.cs b/src/ViewModels/Launcher.cs
index 525e7ee9..254b5948 100644
--- a/src/ViewModels/Launcher.cs
+++ b/src/ViewModels/Launcher.cs
@@ -17,6 +17,12 @@ namespace SourceGit.ViewModels
private set;
}
+ public Workspace ActiveWorkspace
+ {
+ get => _activeWorkspace;
+ private set => SetProperty(ref _activeWorkspace, value);
+ }
+
public LauncherPage ActivePage
{
get => _activePage;
@@ -29,11 +35,35 @@ namespace SourceGit.ViewModels
public Launcher(string startupRepo)
{
+ var pref = Preference.Instance;
+
Pages = new AvaloniaList();
+ ActiveWorkspace = pref.GetActiveWorkspace();
AddNewTab();
- var pref = Preference.Instance;
- if (!string.IsNullOrEmpty(startupRepo))
+ var repos = _activeWorkspace.Repositories.ToArray();
+ foreach (var repo in repos)
+ {
+ var node = pref.FindNode(repo);
+ if (node == null)
+ {
+ node = new RepositoryNode()
+ {
+ Id = repo,
+ Name = Path.GetFileName(repo),
+ Bookmark = 0,
+ IsRepository = true,
+ };
+ }
+
+ OpenRepositoryInTab(node, null);
+ }
+
+ if (string.IsNullOrEmpty(startupRepo))
+ {
+ ActivePage = Pages[0];
+ }
+ else
{
var test = new Commands.QueryRepositoryRootPath(startupRepo).ReadToEnd();
if (!test.IsSuccess || string.IsNullOrEmpty(test.StdOut))
@@ -51,53 +81,6 @@ namespace SourceGit.ViewModels
Welcome.Instance.Refresh();
OpenRepositoryInTab(node, null);
}
- else if (pref.RestoreTabs)
- {
- foreach (var id in pref.OpenedTabs)
- {
- var node = pref.FindNode(id);
- if (node == null)
- {
- node = new RepositoryNode()
- {
- Id = id,
- Name = Path.GetFileName(id),
- Bookmark = 0,
- IsRepository = true,
- };
- }
-
- OpenRepositoryInTab(node, null);
- }
-
- var lastActiveIdx = pref.LastActiveTabIdx;
- if (lastActiveIdx >= 0 && lastActiveIdx < Pages.Count)
- ActivePage = Pages[lastActiveIdx];
- }
- }
-
- public void Quit()
- {
- var pref = Preference.Instance;
- pref.OpenedTabs.Clear();
-
- if (pref.RestoreTabs)
- {
- foreach (var page in Pages)
- {
- if (page.Node.IsRepository)
- pref.OpenedTabs.Add(page.Node.Id);
- }
- }
-
- pref.LastActiveTabIdx = Pages.IndexOf(ActivePage);
- pref.Save();
-
- foreach (var page in Pages)
- {
- if (page.Data is Repository repo)
- repo.Close();
- }
}
public void AddNewTab()
@@ -247,6 +230,7 @@ namespace SourceGit.ViewModels
};
repo.Open();
+ ActiveWorkspace.AddRepository(repo.FullPath);
Models.AutoFetchManager.Instance.AddRepository(repo.FullPath);
if (page == null)
@@ -294,6 +278,46 @@ namespace SourceGit.ViewModels
_activePage.Notifications.Add(notification);
}
+ public ContextMenu CreateContextForWorkspace()
+ {
+ var pref = Preference.Instance;
+ var menu = new ContextMenu();
+
+ for (var i = 0; i < pref.Workspaces.Count; i++)
+ {
+ var workspace = pref.Workspaces[i];
+
+ var icon = App.CreateMenuIcon(workspace.IsActive ? "Icons.Check" : "Icons.Workspace");
+ icon.Fill = workspace.Brush;
+
+ var item = new MenuItem();
+ item.Header = workspace.Name;
+ item.Icon = icon;
+ item.Click += (_, e) =>
+ {
+ if (!workspace.IsActive)
+ SwitchWorkspace(workspace);
+
+ e.Handled = true;
+ };
+
+ menu.Items.Add(item);
+ }
+
+ menu.Items.Add(new MenuItem() { Header = "-" });
+
+ var configure = new MenuItem();
+ configure.Header = App.Text("Workspace.Configure");
+ configure.Click += (_, e) =>
+ {
+ App.OpenDialog(new Views.ConfigureWorkspace() { DataContext = new ConfigureWorkspace() });
+ e.Handled = true;
+ };
+ menu.Items.Add(configure);
+
+ return menu;
+ }
+
public ContextMenu CreateContextForPageTab(LauncherPage page)
{
if (page == null)
@@ -369,10 +393,50 @@ namespace SourceGit.ViewModels
return menu;
}
- private void CloseRepositoryInTab(LauncherPage page)
+ private void SwitchWorkspace(Workspace to)
+ {
+ var pref = Preference.Instance;
+ foreach (var w in pref.Workspaces)
+ w.IsActive = false;
+
+ ActiveWorkspace = to;
+ to.IsActive = true;
+
+ foreach (var one in Pages)
+ CloseRepositoryInTab(one, false);
+
+ Pages.Clear();
+ ActivePage = null;
+ AddNewTab();
+
+ var repos = to.Repositories.ToArray();
+ foreach (var repo in repos)
+ {
+ var node = pref.FindNode(repo);
+ if (node == null)
+ {
+ node = new RepositoryNode()
+ {
+ Id = repo,
+ Name = Path.GetFileName(repo),
+ Bookmark = 0,
+ IsRepository = true,
+ };
+ }
+
+ OpenRepositoryInTab(node, null);
+ }
+
+ GC.Collect();
+ }
+
+ private void CloseRepositoryInTab(LauncherPage page, bool removeFromWorkspace = true)
{
if (page.Data is Repository repo)
{
+ if (removeFromWorkspace)
+ ActiveWorkspace.Repositories.Remove(repo.FullPath);
+
Models.AutoFetchManager.Instance.RemoveRepository(repo.FullPath);
repo.Close();
}
@@ -380,6 +444,7 @@ namespace SourceGit.ViewModels
page.Data = null;
}
+ private Workspace _activeWorkspace = null;
private LauncherPage _activePage = null;
}
}
diff --git a/src/ViewModels/Preference.cs b/src/ViewModels/Preference.cs
index 44ae9c1a..06262970 100644
--- a/src/ViewModels/Preference.cs
+++ b/src/ViewModels/Preference.cs
@@ -39,6 +39,9 @@ namespace SourceGit.ViewModels
if (!_instance.IsGitConfigured())
_instance.GitInstallPath = Native.OS.FindGitExecutable();
+ if (_instance.Workspaces.Count == 0)
+ _instance.Workspaces.Add(new Workspace() { Name = "Default", Color = 4278221015 });
+
return _instance;
}
}
@@ -133,12 +136,6 @@ namespace SourceGit.ViewModels
set => SetProperty(ref _subjectGuideLength, value);
}
- public bool RestoreTabs
- {
- get => _restoreTabs;
- set => SetProperty(ref _restoreTabs, value);
- }
-
public bool UseFixedTabWidth
{
get => _useFixedTabWidth;
@@ -304,18 +301,12 @@ namespace SourceGit.ViewModels
set;
} = [];
- public List OpenedTabs
+ public List Workspaces
{
get;
set;
} = [];
- public int LastActiveTabIdx
- {
- get;
- set;
- } = 0;
-
public double LastCheckUpdateTime
{
get => _lastCheckUpdateTime;
@@ -343,6 +334,19 @@ namespace SourceGit.ViewModels
return true;
}
+ public Workspace GetActiveWorkspace()
+ {
+ foreach (var w in Workspaces)
+ {
+ if (w.IsActive)
+ return w;
+ }
+
+ var first = Workspaces[0];
+ first.IsActive = true;
+ return first;
+ }
+
public void AddNode(RepositoryNode node, RepositoryNode to, bool save)
{
var collection = to == null ? RepositoryNodes : to.SubNodes;
@@ -492,7 +496,6 @@ namespace SourceGit.ViewModels
private int _maxHistoryCommits = 20000;
private int _subjectGuideLength = 50;
- private bool _restoreTabs = false;
private bool _useFixedTabWidth = true;
private bool _check4UpdatesOnStartup = true;
diff --git a/src/ViewModels/Workspace.cs b/src/ViewModels/Workspace.cs
new file mode 100644
index 00000000..8a53d577
--- /dev/null
+++ b/src/ViewModels/Workspace.cs
@@ -0,0 +1,58 @@
+using System.Collections.Generic;
+using System.Text.Json.Serialization;
+
+using Avalonia.Media;
+
+using CommunityToolkit.Mvvm.ComponentModel;
+
+namespace SourceGit.ViewModels
+{
+ public class Workspace : ObservableObject
+ {
+ public string Name
+ {
+ get => _name;
+ set => SetProperty(ref _name, value);
+ }
+
+ public uint Color
+ {
+ get => _color;
+ set
+ {
+ if (SetProperty(ref _color, value))
+ Brush = new SolidColorBrush(value);
+ }
+ }
+
+ public List Repositories
+ {
+ get;
+ set;
+ } = new List();
+
+ public bool IsActive
+ {
+ get => _isActive;
+ set => SetProperty(ref _isActive, value);
+ }
+
+ [JsonIgnore]
+ public IBrush Brush
+ {
+ get => _brush;
+ private set => SetProperty(ref _brush, value);
+ }
+
+ public void AddRepository(string repo)
+ {
+ if (!Repositories.Contains(repo))
+ Repositories.Add(repo);
+ }
+
+ private string _name = string.Empty;
+ private uint _color = 0;
+ private IBrush _brush = null;
+ private bool _isActive = false;
+ }
+}
diff --git a/src/Views/Blame.axaml.cs b/src/Views/Blame.axaml.cs
index a0b3c810..1146835c 100644
--- a/src/Views/Blame.axaml.cs
+++ b/src/Views/Blame.axaml.cs
@@ -330,7 +330,7 @@ namespace SourceGit.Views
var offset = TextArea.TextView.VerticalOffset;
if (_lastOffsetY != offset)
- InvalidateVisual();
+ InvalidateVisual();
}
private void OnTextViewContextRequested(object sender, ContextRequestedEventArgs e)
diff --git a/src/Views/ConfigureWorkspace.axaml b/src/Views/ConfigureWorkspace.axaml
new file mode 100644
index 00000000..af5c752f
--- /dev/null
+++ b/src/Views/ConfigureWorkspace.axaml
@@ -0,0 +1,122 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Views/ConfigureWorkspace.axaml.cs b/src/Views/ConfigureWorkspace.axaml.cs
new file mode 100644
index 00000000..82d8cd30
--- /dev/null
+++ b/src/Views/ConfigureWorkspace.axaml.cs
@@ -0,0 +1,24 @@
+using Avalonia.Controls;
+using Avalonia.Input;
+
+namespace SourceGit.Views
+{
+ public partial class ConfigureWorkspace : ChromelessWindow
+ {
+ public ConfigureWorkspace()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnClosing(WindowClosingEventArgs e)
+ {
+ ViewModels.Preference.Instance.Save();
+ base.OnClosing(e);
+ }
+
+ private void BeginMoveWindow(object _, PointerPressedEventArgs e)
+ {
+ BeginMoveDrag(e);
+ }
+ }
+}
diff --git a/src/Views/DeleteRepositoryNode.axaml b/src/Views/DeleteRepositoryNode.axaml
index 6a9c2891..f4e041e5 100644
--- a/src/Views/DeleteRepositoryNode.axaml
+++ b/src/Views/DeleteRepositoryNode.axaml
@@ -24,7 +24,7 @@
Text="{DynamicResource Text.DeleteRepositoryNode.Target}"/>
diff --git a/src/Views/EditRepositoryNode.axaml b/src/Views/EditRepositoryNode.axaml
index f444ad20..ac8f50f3 100644
--- a/src/Views/EditRepositoryNode.axaml
+++ b/src/Views/EditRepositoryNode.axaml
@@ -40,7 +40,7 @@
diff --git a/src/Views/Launcher.axaml b/src/Views/Launcher.axaml
index a7ee7626..e659773f 100644
--- a/src/Views/Launcher.axaml
+++ b/src/Views/Launcher.axaml
@@ -20,9 +20,9 @@
-
+
-
+
+
+
-
+
-
+
diff --git a/src/Views/Launcher.axaml.cs b/src/Views/Launcher.axaml.cs
index 49bcecf0..05ea3ca8 100644
--- a/src/Views/Launcher.axaml.cs
+++ b/src/Views/Launcher.axaml.cs
@@ -3,6 +3,7 @@ using System;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
+using Avalonia.Interactivity;
using Avalonia.VisualTree;
namespace SourceGit.Views
@@ -223,9 +224,7 @@ namespace SourceGit.Views
var pref = ViewModels.Preference.Instance;
pref.Layout.LauncherWidth = Width;
pref.Layout.LauncherHeight = Height;
-
- var vm = DataContext as ViewModels.Launcher;
- vm?.Quit();
+ pref.Save();
base.OnClosing(e);
}
@@ -248,6 +247,17 @@ namespace SourceGit.Views
e.Handled = true;
}
+ private void OnOpenWorkspaceMenu(object sender, RoutedEventArgs e)
+ {
+ if (sender is Button btn && DataContext is ViewModels.Launcher launcher)
+ {
+ var menu = launcher.CreateContextForWorkspace();
+ btn.OpenContextMenu(menu);
+ }
+
+ e.Handled = true;
+ }
+
private KeyModifiers _unhandledModifiers = KeyModifiers.None;
}
}
diff --git a/src/Views/LauncherTabBar.axaml b/src/Views/LauncherTabBar.axaml
index 45cd414a..40a2efe6 100644
--- a/src/Views/LauncherTabBar.axaml
+++ b/src/Views/LauncherTabBar.axaml
@@ -52,7 +52,7 @@
diff --git a/src/Views/Preference.axaml b/src/Views/Preference.axaml
index 67e771ff..bafd094c 100644
--- a/src/Views/Preference.axaml
+++ b/src/Views/Preference.axaml
@@ -52,7 +52,7 @@
-
+
-
-
diff --git a/src/Views/RepositoryConfigure.axaml b/src/Views/RepositoryConfigure.axaml
index 44ffe4b6..346639e2 100644
--- a/src/Views/RepositoryConfigure.axaml
+++ b/src/Views/RepositoryConfigure.axaml
@@ -225,7 +225,7 @@
-
+
diff --git a/src/Views/Welcome.axaml b/src/Views/Welcome.axaml
index 0e84b790..6bd735ea 100644
--- a/src/Views/Welcome.axaml
+++ b/src/Views/Welcome.axaml
@@ -117,7 +117,7 @@