mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 04:04:59 +00:00
enhance: supports remove single histories filter (#987)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
14f47a9007
commit
e28abf8119
3 changed files with 22 additions and 1 deletions
|
@ -826,6 +826,15 @@ namespace SourceGit.ViewModels
|
||||||
Task.Run(RefreshCommits);
|
Task.Run(RefreshCommits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RemoveHistoriesFilter(Models.Filter filter)
|
||||||
|
{
|
||||||
|
if (_settings.HistoriesFilters.Remove(filter))
|
||||||
|
{
|
||||||
|
HistoriesFilterMode = _settings.HistoriesFilters.Count > 0 ? _settings.HistoriesFilters[0].Mode : Models.FilterMode.None;
|
||||||
|
RefreshHistoriesFilters(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void UpdateBranchNodeIsExpanded(BranchTreeNode node)
|
public void UpdateBranchNodeIsExpanded(BranchTreeNode node)
|
||||||
{
|
{
|
||||||
if (_settings == null || !string.IsNullOrWhiteSpace(_filter))
|
if (_settings == null || !string.IsNullOrWhiteSpace(_filter))
|
||||||
|
|
|
@ -685,7 +685,11 @@
|
||||||
<StackPanel Orientation="Horizontal" Margin="8,0">
|
<StackPanel Orientation="Horizontal" Margin="8,0">
|
||||||
<Path Width="10" Height="10" Data="{StaticResource Icons.Branch}" IsVisible="{Binding IsBranch}"/>
|
<Path Width="10" Height="10" Data="{StaticResource Icons.Branch}" IsVisible="{Binding IsBranch}"/>
|
||||||
<Path Width="10" Height="10" Data="{StaticResource Icons.Tag}" IsVisible="{Binding !IsBranch}"/>
|
<Path Width="10" Height="10" Data="{StaticResource Icons.Tag}" IsVisible="{Binding !IsBranch}"/>
|
||||||
<TextBlock Classes="primary" Text="{Binding Pattern, Converter={x:Static c:StringConverters.TrimRefsPrefix}}" Margin="4,0,0,0"/>
|
<TextBlock Classes="primary" Text="{Binding Pattern, Converter={x:Static c:StringConverters.TrimRefsPrefix}}" Margin="4,0,8,0"/>
|
||||||
|
|
||||||
|
<Button Classes="icon_button" VerticalAlignment="Center" Margin="0" Padding="0" Click="OnRemoveSelectedHistoriesFilter">
|
||||||
|
<Path Width="8" Height="8" Data="{StaticResource Icons.Window.Close}"/>
|
||||||
|
</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
|
@ -519,5 +519,13 @@ namespace SourceGit.Views
|
||||||
|
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnRemoveSelectedHistoriesFilter(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (DataContext is ViewModels.Repository repo && sender is Button { DataContext: Models.Filter filter})
|
||||||
|
repo.RemoveHistoriesFilter(filter);
|
||||||
|
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue