Skip to content

Commit

Permalink
Update XNALinkButton to support alternative URL on *nix
Browse files Browse the repository at this point in the history
  • Loading branch information
Belonit committed Aug 23, 2023
1 parent 77ea900 commit fc35b66
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
19 changes: 18 additions & 1 deletion ClientGUI/XNALinkButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class XNALinkButton : XNAClientButton
public XNALinkButton(WindowManager windowManager) : base(windowManager) { }

public string URL { get; set; }
public string UnixURL { get; set; }

protected override void ParseControlINIAttribute(IniFile iniFile, string key, string value)
{
Expand All @@ -19,12 +20,28 @@ protected override void ParseControlINIAttribute(IniFile iniFile, string key, st
return;
}

if (key == "UnixURL")
{
UnixURL = value;
return;
}

base.ParseControlINIAttribute(iniFile, key, value);
}

public override void OnLeftClick()
{
ProcessLauncher.StartShellProcess(URL);
OSVersion osVersion = ClientConfiguration.Instance.GetOperatingSystemVersion();
string url = URL;

if (UnixURL.Length != 0 && osVersion == OSVersion.UNIX)
{
ProcessLauncher.StartShellProcess(UnixURL);
}
else if (URL.Length != 0)
{
ProcessLauncher.StartShellProcess(URL);
}

base.OnLeftClick();
}
Expand Down
1 change: 1 addition & 0 deletions Docs/INISystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ _(inherits XNAButton)_
_(inherits XNAClientButton)_

`URL`
`UnixURL`
`ToolTip` = `{multi-line string}` tooltip for checkbox

#### XNACheckbox
Expand Down

0 comments on commit fc35b66

Please sign in to comment.