open recent sln on click

This commit is contained in:
Matt Parker
2025-10-02 20:51:36 +10:00
parent 929fb206e2
commit 6f930d3ab5
2 changed files with 5 additions and 0 deletions

View File

@@ -8,8 +8,10 @@ public partial class PreviousSlnEntry : MarginContainer
private Label _slnPathLabel = null!; private Label _slnPathLabel = null!;
private Label _slnNameLabel = null!; private Label _slnNameLabel = null!;
private Panel _slnColourPanel = null!; private Panel _slnColourPanel = null!;
private Button _slnEntryButton = null!;
public RecentSln RecentSln { get; set; } = null!; public RecentSln RecentSln { get; set; } = null!;
public Action<string>? Clicked;
public override void _Ready() public override void _Ready()
{ {
@@ -17,8 +19,10 @@ public partial class PreviousSlnEntry : MarginContainer
_slnNameLabel = GetNode<Label>("%SlnNameLabel"); _slnNameLabel = GetNode<Label>("%SlnNameLabel");
_slnPathLabel = GetNode<Label>("%SlnPathLabel"); _slnPathLabel = GetNode<Label>("%SlnPathLabel");
_slnColourPanel = GetNode<Panel>("%Panel"); _slnColourPanel = GetNode<Panel>("%Panel");
_slnEntryButton = GetNode<Button>("Button");
_slnNameLabel.Text = RecentSln.Name; _slnNameLabel.Text = RecentSln.Name;
_slnPathLabel.Text = RecentSln.FilePath; _slnPathLabel.Text = RecentSln.FilePath;
_slnColourPanel.Modulate = RandomRecentSlnColours.GetColourForFilePath(RecentSln.FilePath); _slnColourPanel.Modulate = RandomRecentSlnColours.GetColourForFilePath(RecentSln.FilePath);
_slnEntryButton.Pressed += () => Clicked?.Invoke(RecentSln.FilePath);
} }
} }

View File

@@ -37,6 +37,7 @@ public partial class SlnPicker : Control
{ {
var node = _previousSlnEntryScene.Instantiate<PreviousSlnEntry>(); var node = _previousSlnEntryScene.Instantiate<PreviousSlnEntry>();
node.RecentSln = previousSln; node.RecentSln = previousSln;
node.Clicked = path => _tcs.SetResult(path);
_previousSlnsVBoxContainer.AddChild(node); _previousSlnsVBoxContainer.AddChild(node);
} }
} }