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

Commit 5798542

Browse files
Merge branch 'enhancements/subview-is-busy' into enhancements/git-path-view
2 parents 78c7249 + 6328b02 commit 5798542

File tree

13 files changed

+62
-10
lines changed

13 files changed

+62
-10
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ public override void OnGUI()
119119
GUILayout.EndScrollView();
120120
}
121121

122+
public override bool IsBusy
123+
{
124+
get { return isBusy; }
125+
}
126+
122127
private void HandleEnterPressed()
123128
{
124129
if (Event.current.type != EventType.KeyDown)

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,10 @@ public override void Finish(bool result)
7373
Close();
7474
base.Finish(result);
7575
}
76+
77+
public override bool IsBusy
78+
{
79+
get { return authView.IsBusy; }
80+
}
7681
}
7782
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ public virtual void OnSelectionChange()
126126

127127
public virtual Rect Position { get { return position; } }
128128
public IApplicationManager Manager { get; private set; }
129+
public abstract bool IsBusy { get; }
129130
public IRepository Repository { get { return inLayout ? cachedRepository : Environment.Repository; } }
130131
public bool HasRepository { get { return Environment.RepositoryPath != null; } }
131132

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ public override void OnGUI()
150150
}
151151
}
152152

153+
public override bool IsBusy
154+
{
155+
get { return false; }
156+
}
157+
153158
public void OnEmbeddedGUI()
154159
{
155160
scroll = GUILayout.BeginScrollView(scroll);

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ class ChangesView : Subview
1919
private const string OneChangedFileLabel = "1 changed file";
2020
private const string NoChangedFilesLabel = "No changed files";
2121

22-
[NonSerialized] private bool busy = true;
23-
[SerializeField] private string commitBody = "";
22+
[NonSerialized] private bool isBusy = true;
2423

24+
[SerializeField] private string commitBody = "";
2525
[SerializeField] private string commitMessage = "";
2626
[SerializeField] private string currentBranch = "[unknown]";
2727
[SerializeField] private Vector2 horizontalScroll;
@@ -52,6 +52,11 @@ public override void OnDisable()
5252
Repository.OnStatusUpdated -= RunStatusUpdateOnMainThread;
5353
}
5454

55+
public override bool IsBusy
56+
{
57+
get { return isBusy; }
58+
}
59+
5560
private void RunStatusUpdateOnMainThread(GitStatus status)
5661
{
5762
new ActionTask(TaskManager.Token, _ => OnStatusUpdate(status))
@@ -72,10 +77,9 @@ private void OnStatusUpdate(GitStatus update)
7277
// (Re)build tree
7378
tree.UpdateEntries(update.Entries.Where(x => x.Status != GitFileStatus.Ignored).ToList());
7479

75-
busy = false;
80+
isBusy = false;
7681
}
7782

78-
7983
public override void OnGUI()
8084
{
8185
GUILayout.BeginHorizontal();
@@ -144,7 +148,7 @@ private void OnCommitDetailsAreaGUI()
144148
GUILayout.Space(Styles.CommitAreaPadding);
145149

146150
// Disable committing when already committing or if we don't have all the data needed
147-
EditorGUI.BeginDisabledGroup(busy || string.IsNullOrEmpty(commitMessage) || !tree.CommitTargets.Any(t => t.Any));
151+
EditorGUI.BeginDisabledGroup(isBusy || string.IsNullOrEmpty(commitMessage) || !tree.CommitTargets.Any(t => t.Any));
148152
{
149153
GUILayout.BeginHorizontal();
150154
{
@@ -187,7 +191,7 @@ private void SelectNone()
187191
private void Commit()
188192
{
189193
// Do not allow new commits before we have received one successful update
190-
busy = true;
194+
isBusy = true;
191195

192196
var files = Enumerable.Range(0, tree.Entries.Count)
193197
.Where(i => tree.CommitTargets[i].All)
@@ -212,7 +216,7 @@ private void Commit()
212216
{
213217
commitMessage = "";
214218
commitBody = "";
215-
busy = false;
219+
isBusy = false;
216220
}).Start();
217221
}
218222
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ public override void OnGUI()
8686
GUILayout.EndVertical();
8787
}
8888

89+
public override bool IsBusy
90+
{
91+
get { return false; }
92+
}
93+
8994
private void OnCommitTreeChange()
9095
{
9196
Height = 0f;
@@ -276,6 +281,7 @@ private void TreeNode(FileTreeNode node)
276281
}
277282

278283
public float Height { get; protected set; }
284+
279285
public bool Readonly { get; set; }
280286

281287
public IList<GitStatusEntry> Entries

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class HistoryView : Subview
4747
[NonSerialized] private int selectionIndex;
4848
[NonSerialized] private bool updated = true;
4949
[NonSerialized] private bool useScrollTime;
50+
[NonSerialized] private bool isBusy;
5051

5152
#if ENABLE_BROADMODE
5253
[SerializeField] private bool broadMode;
@@ -60,7 +61,6 @@ class HistoryView : Subview
6061

6162
[SerializeField] private ChangesetTreeView changesetTree = new ChangesetTreeView();
6263
[SerializeField] private List<GitLogEntry> history = new List<GitLogEntry>();
63-
[SerializeField] private bool isBusy;
6464
[SerializeField] private string currentRemote;
6565
[SerializeField] private bool isPublished;
6666

@@ -146,6 +146,11 @@ public override void OnGUI()
146146
#endif
147147
}
148148

149+
public override bool IsBusy
150+
{
151+
get { return isBusy; }
152+
}
153+
149154
#if ENABLE_BROADMODE
150155
public void OnBroadGUI()
151156
{

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ interface IView
1616
IRepository Repository { get; }
1717
bool HasRepository { get; }
1818
IApplicationManager Manager { get; }
19+
bool IsBusy { get; }
1920
}
2021
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,11 @@ public override void OnGUI()
232232
EditorGUI.EndDisabledGroup();
233233
}
234234

235+
public override bool IsBusy
236+
{
237+
get { return isBusy; }
238+
}
239+
235240
private bool IsFormValid
236241
{
237242
get { return !string.IsNullOrEmpty(repoName) && !isBusy && selectedOwner != 0; }

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,10 @@ public override void Finish(bool result)
6464
Close();
6565
base.Finish(result);
6666
}
67+
68+
public override bool IsBusy
69+
{
70+
get { return publishView.IsBusy; }
71+
}
6772
}
6873
}

0 commit comments

Comments
 (0)