Skip to content

Commit e102e49

Browse files
committed
code_style: remove unnecessary properties
Signed-off-by: leo <[email protected]>
1 parent dcdc525 commit e102e49

File tree

4 files changed

+6
-21
lines changed

4 files changed

+6
-21
lines changed

src/ViewModels/Histories.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ namespace SourceGit.ViewModels
1414
{
1515
public class Histories : ObservableObject, IDisposable
1616
{
17-
public Repository Repo
18-
{
19-
get => _repo;
20-
}
21-
2217
public bool IsLoading
2318
{
2419
get => _isLoading;

src/Views/Histories.axaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<Grid.ColumnDefinitions>
3535
<ColumnDefinition Width="*"/>
3636
<ColumnDefinition Width="3"/>
37-
<ColumnDefinition Width="{Binding #ThisControl.AuthorNameColumnWidth, Mode=TwoWay}" MinWidth="80"/>
37+
<ColumnDefinition SharedSizeGroup="AuthorName" Width="{Binding Source={x:Static vm:Preferences.Instance}, Path=Layout.HistoriesAuthorColumnWidth, Mode=TwoWay}" MinWidth="80"/>
3838
<ColumnDefinition SharedSizeGroup="SHA" MinWidth="100"/>
3939
<ColumnDefinition SharedSizeGroup="Time" MinWidth="160"/>
4040
</Grid.ColumnDefinitions>
@@ -120,7 +120,7 @@
120120
<Grid Height="26">
121121
<Grid.ColumnDefinitions>
122122
<ColumnDefinition Width="*"/>
123-
<ColumnDefinition Width="{Binding #ThisControl.AuthorNameColumnWidth, Mode=OneWay}"/>
123+
<ColumnDefinition SharedSizeGroup="AuthorName" Width="Auto"/>
124124
<ColumnDefinition SharedSizeGroup="SHA" Width="Auto"/>
125125
<ColumnDefinition SharedSizeGroup="Time" Width="Auto"/>
126126
</Grid.ColumnDefinitions>

src/Views/Histories.axaml.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,6 @@ private void RefreshLayout()
7373

7474
public partial class Histories : UserControl
7575
{
76-
public static readonly StyledProperty<GridLength> AuthorNameColumnWidthProperty =
77-
AvaloniaProperty.Register<Histories, GridLength>(nameof(AuthorNameColumnWidth), new GridLength(120));
78-
79-
public GridLength AuthorNameColumnWidth
80-
{
81-
get => GetValue(AuthorNameColumnWidthProperty);
82-
set => SetValue(AuthorNameColumnWidthProperty, value);
83-
}
84-
8576
public static readonly StyledProperty<Models.Branch> CurrentBranchProperty =
8677
AvaloniaProperty.Register<Histories, Models.Branch>(nameof(CurrentBranch));
8778

@@ -150,7 +141,7 @@ protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs chang
150141
private void OnCommitListLayoutUpdated(object _1, EventArgs _2)
151142
{
152143
var y = CommitListContainer.Scroll?.Offset.Y ?? 0;
153-
var authorNameColumnWidth = AuthorNameColumnWidth.Value;
144+
var authorNameColumnWidth = ViewModels.Preferences.Instance.Layout.HistoriesAuthorColumnWidth.Value;
154145
if (y != _lastScrollY || authorNameColumnWidth != _lastAuthorNameColumnWidth)
155146
{
156147
_lastScrollY = y;

src/Views/Repository.axaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -829,11 +829,10 @@
829829
<ContentControl Grid.Row="3" Content="{Binding SelectedView}">
830830
<ContentControl.DataTemplates>
831831
<DataTemplate DataType="vm:Histories">
832-
<v:Histories CurrentBranch="{Binding Repo.CurrentBranch}"
832+
<v:Histories CurrentBranch="{Binding $parent[v:Repository].((vm:Repository)DataContext).CurrentBranch}"
833833
Bisect="{Binding Bisect}"
834-
AuthorNameColumnWidth="{Binding Source={x:Static vm:Preferences.Instance}, Path=Layout.HistoriesAuthorColumnWidth, Mode=TwoWay}"
835-
IssueTrackerRules="{Binding Repo.Settings.IssueTrackerRules}"
836-
OnlyHighlightCurrentBranch="{Binding Repo.OnlyHighlightCurrentBranchInHistories}"
834+
IssueTrackerRules="{Binding $parent[v:Repository].((vm:Repository)DataContext).Settings.IssueTrackerRules}"
835+
OnlyHighlightCurrentBranch="{Binding $parent[v:Repository].((vm:Repository)DataContext).OnlyHighlightCurrentBranchInHistories}"
837836
NavigationId="{Binding NavigationId}"/>
838837
</DataTemplate>
839838

0 commit comments

Comments
 (0)