feature(Launcher): show repository path as tooltip on tabs

This commit is contained in:
leo 2020-08-05 16:35:01 +08:00
parent 073c189f18
commit 692442aff1
2 changed files with 12 additions and 2 deletions

View file

@ -143,8 +143,15 @@
<DataTemplate> <DataTemplate>
<StackPanel Orientation="Horizontal" Margin="6,0"> <StackPanel Orientation="Horizontal" Margin="6,0">
<Path Grid.Column="0" Width="14" Height="14" x:Name="Icon" Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.Git}"/> <Path Grid.Column="0" Width="14" Height="14" x:Name="Icon" Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.Git}"/>
<TextBlock Grid.Column="1" Text="{Binding Title}" Foreground="{StaticResource Brush.FG}" Margin="8,0,0,0"/> <TextBlock Grid.Column="1" Text="{Binding Title}" Foreground="{StaticResource Brush.FG}" Margin="8,0,0,0" FontWeight="Bold">
<Button x:Name="Closer" Margin="8,0,0,0" Grid.Column="2" Click="CloseRepo" ToolTip="CLOSE"> <TextBlock.ToolTip>
<ToolTip Content="{Binding Tooltip}" FontWeight="Normal"/>
</TextBlock.ToolTip>
</TextBlock>
<Button x:Name="Closer" Margin="8,0,0,0" Grid.Column="2" Click="CloseRepo">
<Button.ToolTip>
<ToolTip Content="CLOSE" FontWeight="Normal"/>
</Button.ToolTip>
<Path Width="8" Height="8" Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.Close}"/> <Path Width="8" Height="8" Style="{StaticResource Style.Icon}" Data="{StaticResource Icon.Close}"/>
</Button> </Button>
</StackPanel> </StackPanel>

View file

@ -15,6 +15,7 @@ namespace SourceGit.UI {
/// </summary> /// </summary>
public class Tab { public class Tab {
public string Title { get; set; } public string Title { get; set; }
public string Tooltip { get; set; }
public bool IsActive { get; set; } public bool IsActive { get; set; }
public Git.Repository Repo { get; set; } public Git.Repository Repo { get; set; }
public object Page { get; set; } public object Page { get; set; }
@ -50,6 +51,7 @@ namespace SourceGit.UI {
Dispatcher.Invoke(() => { Dispatcher.Invoke(() => {
var tab = new Tab() { var tab = new Tab() {
Title = repo.Parent == null ? repo.Name : $"{repo.Parent.Name} : {repo.Name}", Title = repo.Parent == null ? repo.Name : $"{repo.Parent.Name} : {repo.Name}",
Tooltip = repo.Path,
Repo = repo, Repo = repo,
Page = new Dashboard(repo), Page = new Dashboard(repo),
}; };
@ -61,6 +63,7 @@ namespace SourceGit.UI {
Tabs.Add(new Tab() { Tabs.Add(new Tab() {
Title = "SOURCE GIT", Title = "SOURCE GIT",
Tooltip = "Welcome Page",
Page = new Manager(), Page = new Manager(),
}); });