From 602f934faeabad329d4513a1d6d9a9139881a99d Mon Sep 17 00:00:00 2001 From: Jai <814683@qq.com> Date: Thu, 19 Aug 2021 08:58:41 +0800 Subject: [PATCH] feature: add context menu to close tabs and modify bookmarks --- src/Resources/Locales/en_US.xaml | 4 ++ src/Resources/Locales/zh_CN.xaml | 4 ++ src/Views/Launcher.xaml.cs | 8 +++ src/Views/Widgets/PageTabBar.xaml | 1 + src/Views/Widgets/PageTabBar.xaml.cs | 75 +++++++++++++++++++++++++++- src/Views/Widgets/Welcome.xaml.cs | 16 ++++++ 6 files changed, 107 insertions(+), 1 deletion(-) diff --git a/src/Resources/Locales/en_US.xaml b/src/Resources/Locales/en_US.xaml index 604f96fe..b70851d3 100644 --- a/src/Resources/Locales/en_US.xaml +++ b/src/Resources/Locales/en_US.xaml @@ -284,6 +284,10 @@ NEW PAGE *Repositories WELCOME PAGE + Close Tab + Close Other Tabs + Close Tabs to the Right + Bookmark Merge Branch Source Branch : diff --git a/src/Resources/Locales/zh_CN.xaml b/src/Resources/Locales/zh_CN.xaml index 390996cb..ae84d628 100644 --- a/src/Resources/Locales/zh_CN.xaml +++ b/src/Resources/Locales/zh_CN.xaml @@ -283,6 +283,10 @@ 新建空白页 新标签页 起始页 + 关闭标签页 + 关闭其他标签页 + 关闭右侧标签页 + 设置书签 合并分支 合并分支 : diff --git a/src/Views/Launcher.xaml.cs b/src/Views/Launcher.xaml.cs index acaba972..fb11b2e9 100644 --- a/src/Views/Launcher.xaml.cs +++ b/src/Views/Launcher.xaml.cs @@ -15,6 +15,14 @@ namespace SourceGit.Views { Models.Watcher.Opened += OpenRepository; InitializeComponent(); tabs.Add(); + + tabs.OnTabEdited += (t) => { + foreach (var tab in tabs.Tabs) { + if (!tab.IsWelcomePage) continue; + var page = container.Get(tab.Id) as Widgets.Welcome; + if (page != null) page.UpdateNodes(t.Id, t.Bookmark); + } + }; } private void OnClosing(object sender, CancelEventArgs e) { diff --git a/src/Views/Widgets/PageTabBar.xaml b/src/Views/Widgets/PageTabBar.xaml index 4b64766e..11dbe644 100644 --- a/src/Views/Widgets/PageTabBar.xaml +++ b/src/Views/Widgets/PageTabBar.xaml @@ -48,6 +48,7 @@