Skip to content

Commit 7354384

Browse files
committed
Minor UI fixes
1 parent 53cbcb0 commit 7354384

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

Editor/GitBranchesWindow.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -108,23 +108,6 @@ protected override void OnGUI()
108108

109109
base.OnGUI();
110110
}
111-
List<TreeViewItem> GenerateItems(IEnumerable<Reference[]> branchesPerRepo)
112-
{
113-
var modules = PackageShortcuts.GetSelectedGitModules();
114-
IEnumerable<Reference> references = branchesPerRepo.Count() == 1 ? branchesPerRepo.First()
115-
: showAllBranches ? branchesPerRepo.SelectMany(x => x).Distinct(referenceComparer)
116-
: branchesPerRepo.Skip(1).Aggregate(branchesPerRepo.First().AsEnumerable(), (result, nextArray) => result.Intersect(nextArray, referenceComparer));
117-
var items = new List<TreeViewItem>();
118-
items.Add(new TreeViewItem(0, 0, "Branches") { icon = EditorGUIUtility.IconContent("UnityEditor.VersionControl").image as Texture2D });
119-
BranchesToItems(modules, references, x => x is LocalBranch, 1, items);
120-
items.Add(new TreeViewItem(1, 0, "Remotes") { icon = EditorGUIUtility.IconContent("CloudConnect@2x").image as Texture2D });
121-
BranchesToItems(modules, references, x => x is RemoteBranch, 1, items);
122-
items.Add(new TreeViewItem(2, 0, "Tags") { icon = EditorGUIUtility.IconContent("FilterByLabel@2x").image as Texture2D });
123-
BranchesToItems(modules, references, x => x is Tag, 1, items);
124-
items.Add(new TreeViewItem(3, 0, "Stashes") { icon = EditorGUIUtility.IconContent("Package Manager@2x").image as Texture2D });
125-
BranchesToItems(modules, references, x => x is Stash, 1, items);
126-
return items;
127-
}
128111
static async void CreateOrRenameBranch(string oldName = null)
129112
{
130113
string newName = oldName;
@@ -219,6 +202,23 @@ void ShowContextMenu(IEnumerable<Module> modules, Reference selectedReference)
219202
menu.AddItem(new GUIContent($"New Tag"), false, () => GUIShortcuts.MakeTag());
220203
menu.ShowAsContext();
221204
}
205+
List<TreeViewItem> GenerateItems(IEnumerable<Reference[]> branchesPerRepo)
206+
{
207+
var modules = PackageShortcuts.GetSelectedGitModules();
208+
IEnumerable<Reference> references = branchesPerRepo.Count() == 1 ? branchesPerRepo.First()
209+
: showAllBranches ? branchesPerRepo.SelectMany(x => x).Distinct(referenceComparer)
210+
: branchesPerRepo.Skip(1).Aggregate(branchesPerRepo.First().AsEnumerable(), (result, nextArray) => result.Intersect(nextArray, referenceComparer));
211+
var items = new List<TreeViewItem>();
212+
items.Add(new TreeViewItem(0, 0, "Branches") { icon = EditorGUIUtility.IconContent("UnityEditor.VersionControl").image as Texture2D });
213+
BranchesToItems(modules, references, x => x is LocalBranch, 1, items);
214+
items.Add(new TreeViewItem(1, 0, "Remotes") { icon = EditorGUIUtility.IconContent("CloudConnect@2x").image as Texture2D });
215+
BranchesToItems(modules, references, x => x is RemoteBranch, 1, items);
216+
items.Add(new TreeViewItem(2, 0, "Tags") { icon = EditorGUIUtility.IconContent("FilterByLabel@2x").image as Texture2D });
217+
BranchesToItems(modules, references, x => x is Tag, 1, items);
218+
items.Add(new TreeViewItem(3, 0, "Stashes") { icon = EditorGUIUtility.IconContent("Package Manager@2x").image as Texture2D });
219+
BranchesToItems(modules, references, x => x is Stash, 1, items);
220+
return items;
221+
}
222222
List<TreeViewItem> BranchesToItems(IEnumerable<Module> modules, IEnumerable<Reference> branches, Func<Reference, bool> filter, int rootDepth, List<TreeViewItem> items)
223223
{
224224
string currentPath = "";

Editor/GitLogWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,6 @@ async void ShowCommitContextMenu(Module module, string selectedCommit, IEnumerab
358358
if (EditorUtility.DisplayDialog("Are you sure you want RESET to COMMIT", reference.QualifiedName, "Yes", "No"))
359359
_ = module.Reset(reference.QualifiedName, false);
360360
});
361-
menu.AddItem(new GUIContent($"New Tag"), false, () => GUIShortcuts.MakeTag(selectedCommit));
362361
}
363362
}
364363
if (!LogFiles.Any())
@@ -379,6 +378,7 @@ async void ShowCommitContextMenu(Module module, string selectedCommit, IEnumerab
379378
_ = GUIShortcuts.RunGitAndErrorCheck(new[] { module }, x => x.CherryPick(selectedCommits));
380379
});
381380
}
381+
menu.AddItem(new GUIContent($"New Tag"), false, () => GUIShortcuts.MakeTag(selectedCommit));
382382
menu.ShowAsContext();
383383
}
384384
static void ShowFileContextMenu(Module module, IEnumerable<FileStatus> files, string selectedCommit)

Editor/GitSettingsWindow.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ namespace Abuksigun.MRGitUI
1212
{
1313
public static class GitSettings
1414
{
15-
[MenuItem("Assets/Git/Settings", true)]
15+
[MenuItem("Assets/Git/Remote Settings", true)]
1616
public static bool Check() => PackageShortcuts.GetSelectedGitModules().Any();
17-
[MenuItem("Assets/Git/Settings", priority = 100)]
17+
[MenuItem("Assets/Git/Remote Settings", priority = 100)]
1818
public static async void Invoke()
1919
{
2020
var window = EditorWindow.CreateInstance<GitSettingsWindow>();
21-
window.titleContent = new GUIContent("Git Settings");
21+
window.titleContent = new GUIContent("Git Remote Settings");
2222
await GUIShortcuts.ShowModalWindow(window, new Vector2Int(500, 300));
2323
}
2424
}

0 commit comments

Comments
 (0)