Example #1
0
func (w *WMGUI) init() {
	icn := "img/alkasir-icon-16x16.png"
	if runtime.GOOS == "windows" {
		icn = "img/alkasir-icon-128x128.ico"
	}

	icon, err := res.Asset(icn)
	if err != nil {
		panic(err)
	}
	systray.SetIcon(icon)
	w.onReady()
}
Example #2
0
func loadTranslations(languages ...string) {

	for _, lang := range languages {
		filename := fmt.Sprintf("messages/%s/messages.json", lang)
		lg.V(6).Infoln("Loading translation", lang, filename)
		data, err := res.Asset(filename)
		if err != nil {
			panic(err)
		}
		err = i18n.AddBundle(lang, data)
		if err != nil {
			panic(err)
		}
	}
}
Example #3
0
// load all html templates from bindata.
func loadTemplates() (t *template.Template) {
	lg.V(30).Infoln("Loading templates...")
	t = template.New("_asdf")
	allAssets := res.AssetNames()

	for _, path := range allAssets {
		if strings.HasPrefix(path, "templates/") &&
			strings.HasSuffix(path, "html") {
			data, err := res.Asset(path)
			if err != nil {
				panic(err)
			}
			_, err = t.New(strings.TrimPrefix(path, "templates/")).Parse(string(data))
			if err != nil {
				panic(err)
			}
		}
	}
	return
}