Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEditor;
using UnityEngine;

Expand Down Expand Up @@ -38,7 +34,6 @@ class GitPathView : Subview
public override void OnEnable()
{
base.OnEnable();

gitExecHasChanged = true;
}

Expand Down
38 changes: 18 additions & 20 deletions src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#pragma warning disable 649

using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
using Object = UnityEngine.Object;

namespace GitHub.Unity
{
Expand All @@ -14,20 +9,24 @@ class InitProjectView : Subview
{
private const string NoRepoTitle = "No Git repository found for this project";
private const string NoRepoDescription = "Initialize a Git repository to track changes and collaborate with others.";


[SerializeField] private UserSettingsView userSettingsView = new UserSettingsView();
[SerializeField] private GitPathView gitPathView = new GitPathView();
[SerializeField] private bool isBusy;
[SerializeField] private bool isPublished;

public override void OnDataUpdate()
public override void InitializeView(IView parent)
{
base.OnDataUpdate();
MaybeUpdateData();
base.InitializeView(parent);
userSettingsView.InitializeView(this);
gitPathView.InitializeView(this);
}

public override void OnRepositoryChanged(IRepository oldRepository)
public override void OnDataUpdate()
{
base.OnRepositoryChanged(oldRepository);
Refresh();
base.OnDataUpdate();

userSettingsView.OnDataUpdate();
gitPathView.OnDataUpdate();
}

public override void OnGUI()
Expand Down Expand Up @@ -61,6 +60,10 @@ public override void OnGUI()
}
EditorGUILayout.EndHorizontal();

gitPathView.OnGUI();

userSettingsView.OnGUI();

GUILayout.BeginVertical(Styles.GenericBoxStyle);
{
GUILayout.FlexibleSpace();
Expand All @@ -70,7 +73,7 @@ public override void OnGUI()
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();

EditorGUI.BeginDisabledGroup(isBusy);
EditorGUI.BeginDisabledGroup(IsBusy);
{
if (GUILayout.Button(Localization.InitializeRepositoryButtonText, "Button"))
{
Expand All @@ -90,14 +93,9 @@ public override void OnGUI()
GUILayout.EndVertical();
}

private void MaybeUpdateData()
{
isPublished = Repository != null && Repository.CurrentRemote.HasValue;
}

public override bool IsBusy
{
get { return isBusy; }
get { return isBusy || userSettingsView.IsBusy || gitPathView.IsBusy; }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using UnityEditor;
using UnityEngine;

Expand All @@ -21,7 +17,6 @@ class UserSettingsView : Subview

[SerializeField] private string gitName;
[SerializeField] private string gitEmail;

[SerializeField] private string newGitName;
[SerializeField] private string newGitEmail;
[SerializeField] private User cachedUser;
Expand All @@ -32,13 +27,6 @@ public override void OnDataUpdate()
MaybeUpdateData();
}

public override void OnRepositoryChanged(IRepository oldRepository)
{
base.OnRepositoryChanged(oldRepository);

Refresh();
}

public override void OnGUI()
{
GUILayout.Label(GitConfigTitle, EditorStyles.boldLabel);
Expand Down Expand Up @@ -108,11 +96,6 @@ public override void OnGUI()
EditorGUI.EndDisabledGroup();
}

public override bool IsBusy
{
get { return isBusy; }
}

private void MaybeUpdateData()
{
if (Repository == null)
Expand Down Expand Up @@ -154,5 +137,10 @@ private void MaybeUpdateData()
newGitName = gitName = Repository.User.Name;
newGitEmail = gitEmail = Repository.User.Email;
}

public override bool IsBusy
{
get { return isBusy; }
}
}
}