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

Commit d181016

Browse files
Updating ChangesView to update tree icons accordingly
1 parent 59b83ca commit d181016

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

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

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class ChangesView : Subview
3434
public override void OnEnable()
3535
{
3636
base.OnEnable();
37+
UpdateTreeIcons();
3738
AttachHandlers(Repository);
3839

3940
if (Repository != null)
@@ -190,18 +191,40 @@ private void BuildTree()
190191
if (treeChanges == null)
191192
{
192193
treeChanges = new Tree();
193-
treeChanges.NodeIcon = Styles.BranchIcon;
194-
treeChanges.FolderIcon = Styles.FolderIcon;
195194
treeChanges.DisplayRootNode = false;
196195
treeChanges.Selectable = true;
197196
treeChanges.PathIgnoreRoot = Environment.RepositoryPath + Environment.FileSystem.DirectorySeparatorChar;
198197
treeChanges.PathSeparator = Environment.FileSystem.DirectorySeparatorChar.ToString();
198+
199+
UpdateTreeIcons();
199200
}
200201

201202
treeChanges.Load(gitStatusEntries.Select(entry => new GitStatusEntryTreeData(entry)).Cast<ITreeData>(), "Changes");
202203
Redraw();
203204
}
204205

206+
private void UpdateTreeIcons()
207+
{
208+
var loaded = false;
209+
210+
if (treeChanges.NodeIcon == null)
211+
{
212+
loaded = true;
213+
treeChanges.NodeIcon = Styles.BranchIcon;
214+
}
215+
216+
if (treeChanges.FolderIcon == null)
217+
{
218+
loaded = true;
219+
treeChanges.FolderIcon = Styles.FolderIcon;
220+
}
221+
222+
if (loaded)
223+
{
224+
treeChanges.LoadNodeIcons();
225+
}
226+
}
227+
205228
private void OnCommitDetailsAreaGUI()
206229
{
207230
GUILayout.BeginHorizontal();

0 commit comments

Comments
 (0)