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

Commit 9b187e5

Browse files
committed
Make the IsBusy view property track the state of the repository where relevant
1 parent de9e934 commit 9b187e5

File tree

7 files changed

+8
-36
lines changed

7 files changed

+8
-36
lines changed

src/GitHub.Api/Git/IRepository.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public interface IRepository : IEquatable<IRepository>, IDisposable
6060
List<GitLock> CurrentLocks { get; }
6161
string CurrentBranchName { get; }
6262
List<GitLogEntry> CurrentLog { get; }
63+
bool IsBusy { get; }
6364

6465
event Action<CacheUpdateEvent> LogChanged;
6566
event Action<CacheUpdateEvent> TrackingStatusChanged;

src/GitHub.Api/Git/Repository.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ public string Name
368368
public NPath LocalPath { get; private set; }
369369
public string Owner => CloneUrl?.Owner ?? null;
370370
public bool IsGitHub => HostAddress.IsGitHubDotCom(CloneUrl);
371+
public bool IsBusy => repositoryManager?.IsBusy ?? false;
371372

372373
internal string DebuggerDisplay => String.Format(CultureInfo.InvariantCulture,
373374
"{0} Owner: {1} Name: {2} CloneUrl: {3} LocalPath: {4} Branch: {5} Remote: {6}", GetHashCode(), Owner, Name,

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -501,11 +501,6 @@ private int CompareBranches(GitBranch a, GitBranch b)
501501
return a.Name.CompareTo(b.Name);
502502
}
503503

504-
public override bool IsBusy
505-
{
506-
get { return false; }
507-
}
508-
509504
private enum NodeType
510505
{
511506
Folder,

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

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,6 @@ private void SelectNone()
347347

348348
private void Commit()
349349
{
350-
// Do not allow new commits before we have received one successful update
351-
SetBusy(true);
352-
353350
var files = treeChanges.GetCheckedFiles().ToList();
354351
ITask addTask;
355352

@@ -367,19 +364,7 @@ private void Commit()
367364
{
368365
commitMessage = "";
369366
commitBody = "";
370-
SetBusy(false);
371367
}).Start();
372368
}
373-
374-
private void SetBusy(bool value)
375-
{
376-
treeChanges.IsBusy = value;
377-
isBusy = value;
378-
}
379-
380-
public override bool IsBusy
381-
{
382-
get { return isBusy; }
383-
}
384369
}
385370
}

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -744,10 +744,5 @@ private void BuildTree()
744744
treeChanges.Load(selectedEntry.changes.Select(entry => new GitStatusEntryTreeData(entry)));
745745
Redraw();
746746
}
747-
748-
public override bool IsBusy
749-
{
750-
get { return false; }
751-
}
752747
}
753748
}

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class InitProjectView : Subview
1515

1616
[SerializeField] private CacheUpdateEvent lastCheckUserChangedEvent;
1717

18-
[NonSerialized] private bool isBusy;
1918
[NonSerialized] private bool userHasChanges;
2019
[NonSerialized] private bool gitExecutableIsSet;
2120

@@ -66,10 +65,7 @@ public override void OnGUI()
6665
{
6766
if (GUILayout.Button(Localization.InitializeRepositoryButtonText, "Button"))
6867
{
69-
isBusy = true;
70-
Manager.InitializeRepository()
71-
.FinallyInUI((s, e) => isBusy = false)
72-
.Start();
68+
Manager.InitializeRepository().Start();
7369
}
7470
}
7571
EditorGUI.EndDisabledGroup();
@@ -125,10 +121,5 @@ private void MaybeUpdateData()
125121
hasCompletedInitialCheck = true;
126122
}
127123
}
128-
129-
public override bool IsBusy
130-
{
131-
get { return isBusy; }
132-
}
133124
}
134125
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ public virtual void Finish(bool result)
5959
public IUser User { get { return Parent.User; } }
6060
public bool HasUser { get { return Parent.HasUser; } }
6161
public bool HasFocus { get { return Parent != null && Parent.HasFocus; } }
62-
public abstract bool IsBusy { get; }
62+
public virtual bool IsBusy
63+
{
64+
get { return Manager.IsBusy || Repository != null ? Repository.IsBusy : false; }
65+
}
66+
6367
protected ITaskManager TaskManager { get { return Manager.TaskManager; } }
6468
protected IGitClient GitClient { get { return Manager.GitClient; } }
6569
protected IEnvironment Environment { get { return Manager.Environment; } }

0 commit comments

Comments
 (0)