From 975e120530268dcf668dac6b243bde01732c5b07 Mon Sep 17 00:00:00 2001 From: mappu Date: Fri, 28 Jun 2024 11:53:01 +1200 Subject: [PATCH] main: move appname to constant --- db_none.go | 2 +- main.go | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/db_none.go b/db_none.go index 38421d7..50f6426 100644 --- a/db_none.go +++ b/db_none.go @@ -7,7 +7,7 @@ import ( type noLoadedDatabase struct{} func (n *noLoadedDatabase) DisplayName() string { - return "yvbolt" + return APPNAME } func (n *noLoadedDatabase) DriverName() string { diff --git a/main.go b/main.go index 6d833e3..1e123d7 100644 --- a/main.go +++ b/main.go @@ -12,6 +12,11 @@ import ( "github.com/ying32/govcl/vcl/types/colors" ) +const ( + APPNAME = "yvbolt" + HOMEPAGE_URL = "https://code.ivysaur.me/yvbolt" +) + type TMainForm struct { *vcl.TForm @@ -40,7 +45,7 @@ func main() { func (f *TMainForm) OnFormCreate(sender vcl.IObject) { f.ImageList = loadImages(f) - f.SetCaption("yvbolt") + f.SetCaption(APPNAME) f.ScreenCenter() f.ImageList.GetIcon(imgDatabaseLightning, f.Icon()) @@ -127,7 +132,7 @@ func (f *TMainForm) OnFormCreate(sender vcl.IObject) { mnuHelp.Add(mnuHelpVersion) mnuHelpHomepage := vcl.NewMenuItem(mnuHelp) - mnuHelpHomepage.SetCaption("About yvbolt") + mnuHelpHomepage.SetCaption("About " + APPNAME) mnuHelpHomepage.SetShortCutFromString("F1") mnuHelpHomepage.SetOnClick(f.OnMnuHelpHomepage) mnuHelp.Add(mnuHelpHomepage) @@ -341,7 +346,7 @@ func (f *TMainForm) OnMnuFileExitClick(sender vcl.IObject) { } func (f *TMainForm) OnMnuHelpHomepage(sender vcl.IObject) { - err := browser.OpenURL("https://code.ivysaur.me/yvbolt") + err := browser.OpenURL(HOMEPAGE_URL) if err != nil { vcl.ShowMessage("Opening browser: " + err.Error()) } @@ -354,7 +359,7 @@ func (f *TMainForm) OnMenuHelpVersion(sender vcl.IObject) { return } - info := "This version of yvbolt was compiled with:\n" + info := "This version of " + APPNAME + " was compiled with:\n" for _, dep := range bi.Deps { // Filter to only interesting things