repolist/init.go

63 lines
1.3 KiB
Go

package repolist
import (
"go.wit.com/gui"
"go.wit.com/lib/protobuf/forgepb"
)
func Init(f *forgepb.Forge, g *gui.Node) *RepoList {
me = new(RepoList)
// todo: this code sucks. fix it soon
me.mainWindow = g.NewWindow("builds and uploads all the packages")
me.mainbox = me.mainWindow.NewBox("bw hbox", true)
// make a window with a table of all the repos
me.AutotypistView(me.mainbox)
me.Enable()
me.forge = f
me.viewName = "autotypist"
repos := me.forge.Repos.SortByFullPath()
for repos.Scan() {
repo := repos.Next()
if me.forge.Config.IsReadOnly(repo.GetGoPath()) {
// log.Info("repo scan readonly directory:", repo.FullPath)
} else {
// log.Info("repo scan writable directory:", repo.FullPath)
me.AddRepo(repo)
}
}
me.Enable()
return me
}
func InitBox(f *forgepb.Forge, newbox *gui.Node) *RepoList {
me = new(RepoList)
// make a window with a table of all the repos
me.AutotypistView(newbox)
me.Enable()
me.forge = f
me.viewName = "autotypist"
repos := me.forge.Repos.SortByFullPath()
for repos.Scan() {
repo := repos.Next()
if me.forge.Config.IsReadOnly(repo.GetGoPath()) {
// log.Info("repo scan readonly directory:", repo.FullPath)
} else {
// log.Info("repo scan writable directory:", repo.FullPath)
me.AddRepo(repo)
}
}
me.Enable()
return me
}