Update registrar

This commit is contained in:
Sasha Koshka 2024-06-12 00:27:34 -04:00
parent 03ca852475
commit 046556cce3
2 changed files with 12 additions and 6 deletions

View File

@ -105,10 +105,12 @@ func (role ApplicationRole) Icon () tomo.Icon {
// RunApplication is like tomo.Run, but runs an application. If something fails
// to initialize, an error is written to the standard logger.
func RunApplication (application Application) {
err := registrar.Init()
if err != nil { log.Fatal("nasin: could not init registry:", err) }
err := registrar.RegisterBackend()
if err != nil { log.Fatal("nasin: could not register backend:", err) }
err = tomo.Run(func () {
err := application.Init()
err := registrar.SetTheme()
if err != nil { log.Fatal("nasin: could not set theme:", err) }
err = application.Init()
if err != nil { log.Fatal("nasin: could not run application:", err) }
})
if err != nil { log.Fatal("nasin: could not run application:", err) }

View File

@ -11,7 +11,12 @@ import "git.tebibyte.media/tomo/nasin/internal/icons/fallback"
import "git.tebibyte.media/tomo/nasin/internal/style/fallback"
import "git.tebibyte.media/tomo/nasin/internal/style/aluminum"
func Init () error {
func RegisterBackend () error {
tomo.Register(1, x.New)
return nil
}
func SetTheme () error {
var styl *style.Style
// TODO eventually get rid of this when we make a file format for
// storing visual styles
@ -34,6 +39,5 @@ func Init () error {
tomo.SetStyle(styl)
tomo.SetIcons(icons)
tomo.Register(1, x.New)
return nil
return nil
}