cchat-gtk/main.go

51 lines
969 B
Go
Raw Permalink Normal View History

2020-05-26 06:51:06 +00:00
package main
import (
"runtime"
"time"
2020-05-26 06:51:06 +00:00
"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/diamondburned/cchat-discord"
2020-05-26 06:51:06 +00:00
)
func init() {
go func() {
// If you GC more, you have shorter STWs. Easy.
2020-12-30 07:48:18 +00:00
for range time.Tick(time.Minute) {
runtime.GC()
}
}()
}
2020-05-26 06:51:06 +00:00
func main() {
2020-08-28 07:16:03 +00:00
gts.Main(func() gts.MainApplication {
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.
config.Restore()
// heapprofiler.Start("/tmp/cchat-gtk")
// gts.App.Window.Window.Connect("destroy", heapprofiler.Stop)
2020-05-26 06:51:06 +00:00
return app
})
}