mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-26 12:55:00 +00:00
ux: Remove external terminals split button
This commit is contained in:
parent
fdff62e317
commit
acbf3605fd
2 changed files with 8 additions and 62 deletions
|
@ -95,11 +95,6 @@ namespace SourceGit.ViewModels
|
||||||
set => SetProperty(ref _selectedView, value);
|
set => SetProperty(ref _selectedView, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AvaloniaList<MenuItem> ExternalTerminals
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
} = [];
|
|
||||||
|
|
||||||
public AvaloniaList<MenuItem> ExternalEditors
|
public AvaloniaList<MenuItem> ExternalEditors
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
|
@ -260,7 +255,6 @@ namespace SourceGit.ViewModels
|
||||||
Task.Run(RefreshStashes);
|
Task.Run(RefreshStashes);
|
||||||
Task.Run(RefreshGitFlow);
|
Task.Run(RefreshGitFlow);
|
||||||
|
|
||||||
RefreshExternalTerminals();
|
|
||||||
RefreshExternalEditors();
|
RefreshExternalEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,16 +304,6 @@ namespace SourceGit.ViewModels
|
||||||
Native.OS.OpenWithDefaultEditor(_fullpath);
|
Native.OS.OpenWithDefaultEditor(_fullpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RefreshExternalTerminals()
|
|
||||||
{
|
|
||||||
ExternalTerminals.Clear();
|
|
||||||
var terminals = CreateContextMenuForExternalTerminals();
|
|
||||||
foreach (var terminal in terminals)
|
|
||||||
{
|
|
||||||
ExternalTerminals.Add(terminal);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RefreshExternalEditors()
|
private void RefreshExternalEditors()
|
||||||
{
|
{
|
||||||
ExternalEditors.Clear();
|
ExternalEditors.Clear();
|
||||||
|
@ -330,39 +314,6 @@ namespace SourceGit.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImmutableArray<MenuItem> CreateContextMenuForExternalTerminals()
|
|
||||||
{
|
|
||||||
var terminals = Native.OS.ExternalTerminals;
|
|
||||||
if (terminals.Count == 0)
|
|
||||||
{
|
|
||||||
App.RaiseException(_fullpath, "No available external terminals found!");
|
|
||||||
return [new MenuItem
|
|
||||||
{
|
|
||||||
Header = "No terminal found",
|
|
||||||
IsEnabled = false,
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
|
|
||||||
var items = new List<MenuItem>(terminals.Count);
|
|
||||||
foreach (var terminal in terminals)
|
|
||||||
{
|
|
||||||
var dupTerminal = terminal;
|
|
||||||
var icon = AssetLoader.Open(new Uri($"avares://SourceGit/Resources/ExternalTerminalIcons/{dupTerminal.Icon}", UriKind.RelativeOrAbsolute));
|
|
||||||
var item = new MenuItem
|
|
||||||
{
|
|
||||||
Header = App.Text("Repository.OpenIn", dupTerminal.Name),
|
|
||||||
Icon = new Image
|
|
||||||
{
|
|
||||||
Width = 16, Height = 16, Source = new Bitmap(icon),
|
|
||||||
},
|
|
||||||
Command = new RelayCommand(() => dupTerminal.Open(_fullpath)),
|
|
||||||
};
|
|
||||||
items.Add(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
return [..items];
|
|
||||||
}
|
|
||||||
|
|
||||||
public ImmutableArray<MenuItem> CreateContextMenuForExternalEditors()
|
public ImmutableArray<MenuItem> CreateContextMenuForExternalEditors()
|
||||||
{
|
{
|
||||||
var editors = Native.OS.ExternalEditors;
|
var editors = Native.OS.ExternalEditors;
|
||||||
|
@ -390,6 +341,7 @@ namespace SourceGit.ViewModels
|
||||||
},
|
},
|
||||||
Command = new RelayCommand(() => dupEditor.Open(_fullpath)),
|
Command = new RelayCommand(() => dupEditor.Open(_fullpath)),
|
||||||
};
|
};
|
||||||
|
RenderOptions.SetBitmapInterpolationMode(item, BitmapInterpolationMode.HighQuality);
|
||||||
items.Add(item);
|
items.Add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,6 @@
|
||||||
x:Class="SourceGit.Views.Repository"
|
x:Class="SourceGit.Views.Repository"
|
||||||
x:DataType="vm:Repository">
|
x:DataType="vm:Repository">
|
||||||
|
|
||||||
<UserControl.Resources>
|
|
||||||
<MenuFlyout x:Key="TerminalShellsMenuFlyout" Placement="BottomEdgeAlignedLeft"
|
|
||||||
ItemsSource="{Binding ExternalTerminals, Mode=OneTime}" />
|
|
||||||
<MenuFlyout x:Key="ExternalToolsMenuFlyout" Placement="BottomEdgeAlignedLeft"
|
|
||||||
ItemsSource="{Binding ExternalEditors, Mode=OneTime}" />
|
|
||||||
</UserControl.Resources>
|
|
||||||
|
|
||||||
<Grid RowDefinitions="36,*" Background="{DynamicResource Brush.Window}">
|
<Grid RowDefinitions="36,*" Background="{DynamicResource Brush.Window}">
|
||||||
<!-- Toolbar -->
|
<!-- Toolbar -->
|
||||||
<Border Grid.Row="0" BorderBrush="{DynamicResource Brush.Border0}" BorderThickness="0,0,0,1" Background="{DynamicResource Brush.ToolBar}">
|
<Border Grid.Row="0" BorderBrush="{DynamicResource Brush.Border0}" BorderThickness="0,0,0,1" Background="{DynamicResource Brush.ToolBar}">
|
||||||
|
@ -26,16 +19,17 @@
|
||||||
<Path Width="15" Height="13" Data="{StaticResource Icons.Folder.Open}" Margin="0,1,0,0"/>
|
<Path Width="15" Height="13" Data="{StaticResource Icons.Folder.Open}" Margin="0,1,0,0"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<SplitButton Classes="icon_button" Command="{Binding OpenInTerminal}"
|
<Button Classes="icon_button" Width="32" Command="{Binding OpenInTerminal}" ToolTip.Tip="{DynamicResource Text.Repository.Terminal}">
|
||||||
Flyout="{StaticResource TerminalShellsMenuFlyout}"
|
|
||||||
ToolTip.Tip="{DynamicResource Text.Repository.Terminal}">
|
|
||||||
<Path Width="13" Height="13" Data="{StaticResource Icons.Terminal}"/>
|
<Path Width="13" Height="13" Data="{StaticResource Icons.Terminal}"/>
|
||||||
</SplitButton>
|
</Button>
|
||||||
|
|
||||||
<SplitButton Classes="icon_button" Command="{Binding OpenWithExternalTool}"
|
<SplitButton Classes="icon_button" Command="{Binding OpenWithExternalTool}"
|
||||||
Flyout="{StaticResource ExternalToolsMenuFlyout}"
|
|
||||||
ToolTip.Tip="{DynamicResource Text.Repository.OpenWithExternalTools}">
|
ToolTip.Tip="{DynamicResource Text.Repository.OpenWithExternalTools}">
|
||||||
<Path Width="13" Height="13" Data="{StaticResource Icons.OpenWith}"/>
|
<SplitButton.Flyout>
|
||||||
|
<MenuFlyout Placement="BottomEdgeAlignedLeft"
|
||||||
|
ItemsSource="{Binding ExternalEditors, Mode=OneTime}" />
|
||||||
|
</SplitButton.Flyout>
|
||||||
|
<Path Width="13" Height="13" Margin="0 0 0 1" Data="{StaticResource Icons.OpenWith}"/>
|
||||||
</SplitButton>
|
</SplitButton>
|
||||||
|
|
||||||
<ToggleButton Width="32"
|
<ToggleButton Width="32"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue