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

Commit 72625fe

Browse files
Adding IsBusy to Subview
1 parent c9b9bbb commit 72625fe

File tree

8 files changed

+45
-10
lines changed

8 files changed

+45
-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/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/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/SettingsView.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class SettingsView : Subview
6767
private const string DefaultRepositoryRemoteName = "origin";
6868

6969
[NonSerialized] private int newGitIgnoreRulesSelection = -1;
70+
[NonSerialized] private bool isBusy;
7071

7172
[SerializeField] private string gitName;
7273
[SerializeField] private string gitEmail;
@@ -78,7 +79,6 @@ class SettingsView : Subview
7879
[SerializeField] private string repositoryRemoteName;
7980
[SerializeField] private string repositoryRemoteUrl;
8081
[SerializeField] private Vector2 scroll;
81-
[SerializeField] private bool isBusy;
8282
[SerializeField] private int lockedFileSelection = -1;
8383
[SerializeField] private bool hasRemote;
8484
[SerializeField] private bool remoteHasChanged;
@@ -121,6 +121,11 @@ public override void OnRepositoryChanged(IRepository oldRepository)
121121
Refresh();
122122
}
123123

124+
public override bool IsBusy
125+
{
126+
get { return isBusy; }
127+
}
128+
124129
public override void Refresh()
125130
{
126131
base.Refresh();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public virtual void OnRepositoryChanged(IRepository oldRepository)
5757
public IApplicationManager Manager { get { return Parent.Manager; } }
5858
public IRepository Repository { get { return Parent.Repository; } }
5959
public bool HasRepository { get { return Parent.HasRepository; } }
60-
60+
public abstract bool IsBusy { get; }
6161
protected ITaskManager TaskManager { get { return Manager.TaskManager; } }
6262
protected IGitClient GitClient { get { return Manager.GitClient; } }
6363
protected IEnvironment Environment { get { return Manager.Environment; } }

0 commit comments

Comments
 (0)