mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-26 04:44:59 +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
|
@ -94,11 +94,6 @@ namespace SourceGit.ViewModels
|
|||
get => _selectedView;
|
||||
set => SetProperty(ref _selectedView, value);
|
||||
}
|
||||
|
||||
public AvaloniaList<MenuItem> ExternalTerminals
|
||||
{
|
||||
get;
|
||||
} = [];
|
||||
|
||||
public AvaloniaList<MenuItem> ExternalEditors
|
||||
{
|
||||
|
@ -260,7 +255,6 @@ namespace SourceGit.ViewModels
|
|||
Task.Run(RefreshStashes);
|
||||
Task.Run(RefreshGitFlow);
|
||||
|
||||
RefreshExternalTerminals();
|
||||
RefreshExternalEditors();
|
||||
}
|
||||
|
||||
|
@ -310,16 +304,6 @@ namespace SourceGit.ViewModels
|
|||
Native.OS.OpenWithDefaultEditor(_fullpath);
|
||||
}
|
||||
|
||||
private void RefreshExternalTerminals()
|
||||
{
|
||||
ExternalTerminals.Clear();
|
||||
var terminals = CreateContextMenuForExternalTerminals();
|
||||
foreach (var terminal in terminals)
|
||||
{
|
||||
ExternalTerminals.Add(terminal);
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshExternalEditors()
|
||||
{
|
||||
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()
|
||||
{
|
||||
var editors = Native.OS.ExternalEditors;
|
||||
|
@ -390,6 +341,7 @@ namespace SourceGit.ViewModels
|
|||
},
|
||||
Command = new RelayCommand(() => dupEditor.Open(_fullpath)),
|
||||
};
|
||||
RenderOptions.SetBitmapInterpolationMode(item, BitmapInterpolationMode.HighQuality);
|
||||
items.Add(item);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,13 +10,6 @@
|
|||
x:Class="SourceGit.Views.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}">
|
||||
<!-- 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"/>
|
||||
</Button>
|
||||
|
||||
<SplitButton Classes="icon_button" Command="{Binding OpenInTerminal}"
|
||||
Flyout="{StaticResource TerminalShellsMenuFlyout}"
|
||||
ToolTip.Tip="{DynamicResource Text.Repository.Terminal}">
|
||||
<Button Classes="icon_button" Width="32" Command="{Binding OpenInTerminal}" ToolTip.Tip="{DynamicResource Text.Repository.Terminal}">
|
||||
<Path Width="13" Height="13" Data="{StaticResource Icons.Terminal}"/>
|
||||
</SplitButton>
|
||||
</Button>
|
||||
|
||||
<SplitButton Classes="icon_button" Command="{Binding OpenWithExternalTool}"
|
||||
Flyout="{StaticResource ExternalToolsMenuFlyout}"
|
||||
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>
|
||||
|
||||
<ToggleButton Width="32"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue