mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
fix<Dashboard>: the expanded status of the repository branch list is not saved correctly
This commit is contained in:
parent
8d5f594815
commit
e99f26df90
2 changed files with 12 additions and 11 deletions
|
@ -214,14 +214,14 @@
|
||||||
<MultiDataTrigger>
|
<MultiDataTrigger>
|
||||||
<MultiDataTrigger.Conditions>
|
<MultiDataTrigger.Conditions>
|
||||||
<Condition Binding="{Binding Type}" Value="{x:Static widgets:Dashboard+BranchNodeType.Folder}"/>
|
<Condition Binding="{Binding Type}" Value="{x:Static widgets:Dashboard+BranchNodeType.Folder}"/>
|
||||||
<Condition Binding="{Binding IsExpanded, RelativeSource={RelativeSource AncestorType={x:Type controls:TreeItem}}}" Value="True"/>
|
<Condition Binding="{Binding IsExpanded, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type controls:TreeItem}}}" Value="True"/>
|
||||||
</MultiDataTrigger.Conditions>
|
</MultiDataTrigger.Conditions>
|
||||||
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Folder.Open}"/>
|
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Folder.Open}"/>
|
||||||
</MultiDataTrigger>
|
</MultiDataTrigger>
|
||||||
<MultiDataTrigger>
|
<MultiDataTrigger>
|
||||||
<MultiDataTrigger.Conditions>
|
<MultiDataTrigger.Conditions>
|
||||||
<Condition Binding="{Binding Type}" Value="{x:Static widgets:Dashboard+BranchNodeType.Folder}"/>
|
<Condition Binding="{Binding Type}" Value="{x:Static widgets:Dashboard+BranchNodeType.Folder}"/>
|
||||||
<Condition Binding="{Binding IsExpanded, RelativeSource={RelativeSource AncestorType={x:Type controls:TreeItem}}}" Value="False"/>
|
<Condition Binding="{Binding IsExpanded, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type controls:TreeItem}}}" Value="False"/>
|
||||||
</MultiDataTrigger.Conditions>
|
</MultiDataTrigger.Conditions>
|
||||||
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Folder.Fill}"/>
|
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Folder.Fill}"/>
|
||||||
</MultiDataTrigger>
|
</MultiDataTrigger>
|
||||||
|
@ -250,6 +250,7 @@
|
||||||
SelectionChanged="OnTreeSelectionChanged">
|
SelectionChanged="OnTreeSelectionChanged">
|
||||||
<controls:Tree.ItemContainerStyle>
|
<controls:Tree.ItemContainerStyle>
|
||||||
<Style TargetType="{x:Type controls:TreeItem}" BasedOn="{StaticResource Style.TreeItem}">
|
<Style TargetType="{x:Type controls:TreeItem}" BasedOn="{StaticResource Style.TreeItem}">
|
||||||
|
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}"/>
|
||||||
<EventSetter Event="ContextMenuOpening" Handler="OnTreeContextMenuOpening"/>
|
<EventSetter Event="ContextMenuOpening" Handler="OnTreeContextMenuOpening"/>
|
||||||
</Style>
|
</Style>
|
||||||
</controls:Tree.ItemContainerStyle>
|
</controls:Tree.ItemContainerStyle>
|
||||||
|
@ -290,14 +291,14 @@
|
||||||
<MultiDataTrigger>
|
<MultiDataTrigger>
|
||||||
<MultiDataTrigger.Conditions>
|
<MultiDataTrigger.Conditions>
|
||||||
<Condition Binding="{Binding Type}" Value="{x:Static widgets:Dashboard+BranchNodeType.Folder}"/>
|
<Condition Binding="{Binding Type}" Value="{x:Static widgets:Dashboard+BranchNodeType.Folder}"/>
|
||||||
<Condition Binding="{Binding IsExpanded, RelativeSource={RelativeSource AncestorType={x:Type controls:TreeItem}}}" Value="True"/>
|
<Condition Binding="{Binding IsExpanded, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type controls:TreeItem}}}" Value="True"/>
|
||||||
</MultiDataTrigger.Conditions>
|
</MultiDataTrigger.Conditions>
|
||||||
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Folder.Open}"/>
|
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Folder.Open}"/>
|
||||||
</MultiDataTrigger>
|
</MultiDataTrigger>
|
||||||
<MultiDataTrigger>
|
<MultiDataTrigger>
|
||||||
<MultiDataTrigger.Conditions>
|
<MultiDataTrigger.Conditions>
|
||||||
<Condition Binding="{Binding Type}" Value="{x:Static widgets:Dashboard+BranchNodeType.Folder}"/>
|
<Condition Binding="{Binding Type}" Value="{x:Static widgets:Dashboard+BranchNodeType.Folder}"/>
|
||||||
<Condition Binding="{Binding IsExpanded, RelativeSource={RelativeSource AncestorType={x:Type controls:TreeItem}}}" Value="False"/>
|
<Condition Binding="{Binding IsExpanded, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type controls:TreeItem}}}" Value="False"/>
|
||||||
</MultiDataTrigger.Conditions>
|
</MultiDataTrigger.Conditions>
|
||||||
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Folder.Fill}"/>
|
<Setter TargetName="Icon" Property="Data" Value="{StaticResource Icon.Folder.Fill}"/>
|
||||||
</MultiDataTrigger>
|
</MultiDataTrigger>
|
||||||
|
|
|
@ -113,9 +113,9 @@ namespace SourceGit.Views.Widgets {
|
||||||
private void BackupBranchExpandState(Dictionary<string, bool> states, List<BranchNode> nodes, string prefix) {
|
private void BackupBranchExpandState(Dictionary<string, bool> states, List<BranchNode> nodes, string prefix) {
|
||||||
foreach (var node in nodes) {
|
foreach (var node in nodes) {
|
||||||
if (node.Type != BranchNodeType.Branch) {
|
if (node.Type != BranchNodeType.Branch) {
|
||||||
var id = prefix + node.Name + "/";
|
var id = string.Concat(prefix, "/", node.Name);
|
||||||
states[id] = node.IsExpanded;
|
states[id] = node.IsExpanded;
|
||||||
BackupBranchExpandState(states, node.Children, id + "/");
|
BackupBranchExpandState(states, node.Children, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ namespace SourceGit.Views.Widgets {
|
||||||
BranchNode lastFolder = null;
|
BranchNode lastFolder = null;
|
||||||
string path = prefix;
|
string path = prefix;
|
||||||
for (int i = 0; i < subs.Length - 1; i++) {
|
for (int i = 0; i < subs.Length - 1; i++) {
|
||||||
path = path + subs[i] + "/";
|
path = string.Concat(path, "/", subs[i]);
|
||||||
if (folders.ContainsKey(path)) {
|
if (folders.ContainsKey(path)) {
|
||||||
lastFolder = folders[path];
|
lastFolder = folders[path];
|
||||||
} else if (lastFolder == null) {
|
} else if (lastFolder == null) {
|
||||||
|
@ -189,8 +189,8 @@ namespace SourceGit.Views.Widgets {
|
||||||
repo.Remotes = new Commands.Remotes(repo.Path).Result();
|
repo.Remotes = new Commands.Remotes(repo.Path).Result();
|
||||||
|
|
||||||
var states = new Dictionary<string, bool>();
|
var states = new Dictionary<string, bool>();
|
||||||
BackupBranchExpandState(states, localBranches, "locals/");
|
BackupBranchExpandState(states, localBranches, "locals");
|
||||||
BackupBranchExpandState(states, remoteBranches, "remotes/");
|
BackupBranchExpandState(states, remoteBranches, "remotes");
|
||||||
|
|
||||||
var folders = new Dictionary<string, BranchNode>();
|
var folders = new Dictionary<string, BranchNode>();
|
||||||
localBranches = new List<BranchNode>();
|
localBranches = new List<BranchNode>();
|
||||||
|
@ -210,10 +210,10 @@ namespace SourceGit.Views.Widgets {
|
||||||
|
|
||||||
foreach (var b in repo.Branches) {
|
foreach (var b in repo.Branches) {
|
||||||
if (b.IsLocal) {
|
if (b.IsLocal) {
|
||||||
MakeBranchNode(b, localBranches, folders, states, "locals/");
|
MakeBranchNode(b, localBranches, folders, states, "locals");
|
||||||
} else {
|
} else {
|
||||||
var r = remoteBranches.Find(x => x.Name == b.Remote);
|
var r = remoteBranches.Find(x => x.Name == b.Remote);
|
||||||
if (r != null) MakeBranchNode(b, r.Children, folders, states, $"remotes/{b.Remote}/");
|
if (r != null) MakeBranchNode(b, r.Children, folders, states, $"remotes/{b.Remote}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue