|
10 | 10 |
|
11 | 11 | namespace SourceGit.ViewModels
|
12 | 12 | {
|
| 13 | + public class CommitDetailSharedData |
| 14 | + { |
| 15 | + public int ActiveTabIndex |
| 16 | + { |
| 17 | + get; |
| 18 | + set; |
| 19 | + } |
| 20 | + |
| 21 | + public CommitDetailSharedData() |
| 22 | + { |
| 23 | + ActiveTabIndex = Preferences.Instance.ShowChangesInCommitDetailByDefault ? 1 : 0; |
| 24 | + } |
| 25 | + } |
| 26 | + |
13 | 27 | public partial class CommitDetail : ObservableObject, IDisposable
|
14 | 28 | {
|
15 | 29 | public Repository Repository
|
16 | 30 | {
|
17 | 31 | get => _repo;
|
18 | 32 | }
|
19 | 33 |
|
20 |
| - public int ActivePageIndex |
| 34 | + public int ActiveTabIndex |
21 | 35 | {
|
22 |
| - get => _rememberActivePageIndex ? _repo.CommitDetailActivePageIndex : _activePageIndex; |
| 36 | + get => _sharedData.ActiveTabIndex; |
23 | 37 | set
|
24 | 38 | {
|
25 |
| - if (_rememberActivePageIndex) |
26 |
| - _repo.CommitDetailActivePageIndex = value; |
27 |
| - else |
28 |
| - _activePageIndex = value; |
29 |
| - |
30 |
| - OnPropertyChanged(); |
| 39 | + if (value != _sharedData.ActiveTabIndex) |
| 40 | + _sharedData.ActiveTabIndex = value; |
31 | 41 | }
|
32 | 42 | }
|
33 | 43 |
|
@@ -142,10 +152,10 @@ public bool CanOpenRevisionFileWithDefaultEditor
|
142 | 152 | private set => SetProperty(ref _canOpenRevisionFileWithDefaultEditor, value);
|
143 | 153 | }
|
144 | 154 |
|
145 |
| - public CommitDetail(Repository repo, bool rememberActivePageIndex) |
| 155 | + public CommitDetail(Repository repo, CommitDetailSharedData sharedData) |
146 | 156 | {
|
147 | 157 | _repo = repo;
|
148 |
| - _rememberActivePageIndex = rememberActivePageIndex; |
| 158 | + _sharedData = sharedData ?? new CommitDetailSharedData(); |
149 | 159 | WebLinks = Models.CommitLink.Get(repo.Remotes);
|
150 | 160 | }
|
151 | 161 |
|
@@ -569,8 +579,7 @@ private async Task SetViewingCommitAsync(Models.Object file)
|
569 | 579 | private static partial Regex REG_SHA_FORMAT();
|
570 | 580 |
|
571 | 581 | private Repository _repo = null;
|
572 |
| - private bool _rememberActivePageIndex = true; |
573 |
| - private int _activePageIndex = 0; |
| 582 | + private CommitDetailSharedData _sharedData = null; |
574 | 583 | private Models.Commit _commit = null;
|
575 | 584 | private Models.CommitFullMessage _fullMessage = null;
|
576 | 585 | private Models.CommitSignInfo _signInfo = null;
|
|
0 commit comments