Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit a76dbc0

Browse files
Moving Title to Tree
1 parent b908ac1 commit a76dbc0

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/GitHub.Api/UI/TreeLoader.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public interface ITree
99
void AddNode(string fullPath, string path, string label, int level, bool isFolder, bool isActive, bool isHidden, bool isCollapsed);
1010
void Clear();
1111
HashSet<string> GetCollapsedFolders();
12+
string Title { get; }
1213
bool DisplayRootNode { get; }
1314
bool IsCheckable { get; }
1415
string PathSeparator { get; }
@@ -17,15 +18,15 @@ public interface ITree
1718

1819
public static class TreeLoader
1920
{
20-
public static void Load(ITree tree, IEnumerable<ITreeData> data, string title)
21+
public static void Load(ITree tree, IEnumerable<ITreeData> data)
2122
{
2223
var collapsedFolders = tree.GetCollapsedFolders();
2324

2425
tree.Clear();
2526

2627
var displayRootLevel = tree.DisplayRootNode ? 1 : 0;
2728

28-
tree.AddNode(fullPath: title, path: title, label: title, level: -1 + displayRootLevel, isFolder: true, isActive: false, isHidden: false, isCollapsed: false);
29+
tree.AddNode(fullPath: tree.Title, path: tree.Title, label: tree.Title, level: -1 + displayRootLevel, isFolder: true, isActive: false, isHidden: false, isCollapsed: false);
2930

3031
var hideChildren = false;
3132
var hideChildrenBelowLevel = 0;

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,10 @@ private void BuildTree()
141141
if (treeLocals == null)
142142
{
143143
treeLocals = new BranchesTree();
144+
treeLocals.Title = LocalTitle;
144145

145146
treeRemotes = new BranchesTree();
147+
treeRemotes.Title = RemoteTitle;
146148
treeRemotes.IsRemote = true;
147149

148150
UpdateTreeIcons();
@@ -151,8 +153,8 @@ private void BuildTree()
151153
localBranches.Sort(CompareBranches);
152154
remoteBranches.Sort(CompareBranches);
153155

154-
TreeLoader.Load(treeLocals, localBranches.Select(branch => (ITreeData) new GitBranchTreeData(branch)), LocalTitle);
155-
TreeLoader.Load(treeRemotes, remoteBranches.Select(branch => (ITreeData) new GitBranchTreeData(branch)), RemoteTitle);
156+
TreeLoader.Load(treeLocals, localBranches.Select(branch => (ITreeData) new GitBranchTreeData(branch)));
157+
TreeLoader.Load(treeRemotes, remoteBranches.Select(branch => (ITreeData) new GitBranchTreeData(branch)));
156158
Redraw();
157159
}
158160

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/TreeControl.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public abstract class Tree: ITree
2121
[SerializeField] public Rect Margin = new Rect();
2222
[SerializeField] public Rect Padding = new Rect();
2323

24+
[SerializeField] public string title;
2425
[SerializeField] public string pathIgnoreRoot;
2526
[SerializeField] public string pathSeparator = "/";
2627
[SerializeField] public bool displayRootNode = true;
@@ -53,12 +54,12 @@ private set
5354
}
5455
}
5556

57+
public string Title { get { return title; } set { title = value; } }
5658
public bool DisplayRootNode { get { return displayRootNode; } }
5759
public bool IsCheckable { get { return isCheckable; } }
5860
public string PathSeparator { get { return pathSeparator; } }
5961
public string PathIgnoreRoot { get { return pathIgnoreRoot; } }
6062

61-
6263
public void AddNode(string fullPath, string path, string label, int level, bool isFolder, bool isActive, bool isHidden, bool isCollapsed)
6364
{
6465
var node = new TreeNode

0 commit comments

Comments
 (0)