cchat-gtk/main.go

45 lines
937 B
Go
Raw Normal View History

2020-05-26 06:51:06 +00:00
package main
import (
"github.com/diamondburned/cchat-gtk/internal/gts"
"github.com/diamondburned/cchat-gtk/internal/log"
"github.com/diamondburned/cchat-gtk/internal/ui"
"github.com/diamondburned/cchat-gtk/internal/ui/config"
2020-05-26 06:51:06 +00:00
"github.com/diamondburned/cchat/services"
"github.com/pkg/errors"
2020-05-26 06:51:06 +00:00
_ "github.com/diamondburned/cchat-discord"
2020-05-26 06:51:06 +00:00
_ "github.com/diamondburned/cchat-mock"
)
2020-06-20 07:28:47 +00:00
// destructor is used for debugging and profiling.
var destructor = func() {}
2020-05-26 06:51:06 +00:00
func main() {
2020-07-16 05:41:21 +00:00
gts.Main(func() gts.Window {
2020-05-26 06:51:06 +00:00
var app = ui.NewApplication()
// Load all cchat services.
srvcs, errs := services.Get()
if len(errs) > 0 {
for _, err := range errs {
log.Error(err)
}
}
// Add the services.
for _, srvc := range srvcs {
app.AddService(srvc)
}
// Restore the configs.
if err := config.Restore(); err != nil {
log.Error(errors.Wrap(err, "Failed to restore config"))
}
2020-05-26 06:51:06 +00:00
return app
})
destructor()
2020-05-26 06:51:06 +00:00
}