func (app *AppletUpdate) buildApplet(name string) { var e error term.Info(app.conf.BuildAppletName, app.appletType(app.conf.BuildAppletName)) switch app.appletType(app.conf.BuildAppletName) { case AppletCompiled: if logE("buildApplet Chdir: ", os.Chdir(app.FileLocation("..", name))) { return } e = execShow("make") case AppletInternal: //~ TODO default: e = errors.New("not finished") } // Finally we restart the app. if e == nil { // No errors => restart. if app.conf.BuildAppletName == app.AppletName { // Don't eat the chicken, ore you won't have any more eggs. exec.Command("./reload.sh", app.AppletName).Start() } else { app.ActivateModule(app.conf.BuildAppletName, false) app.ActivateModule(app.conf.BuildAppletName, true) } } }
// Got versions informations, Need to set a new emblem func (app *AppletUpdate) onGotVersions(new int, e error) { if new > 0 { app.ShowDialog(app.version.FormatDialog(), int32(app.conf.VersionDialogTimer)) } term.Info("img", app.FileLocation("img", app.conf.VersionEmblemNew)) app.SetEmblem(app.FileLocation("img", app.conf.VersionEmblemNew), dock.EmblemBottomLeft) }
// Try to detect applet type based on its location and content. // Could be improved. // func (app *AppletUpdate) appletType(name string) BuildType { if _, e := os.Stat(app.FileLocation("..", name)); e == nil { // Applet is in external dir. if _, e := os.Stat(app.FileLocation("..", name, "Makefile")); e == nil { // Got makefile => can build. term.Info("ok") return AppletCompiled } // Else it's a scripted (atm the only other module not scripted is in vala and is the previous version of this one). return AppletScript } return AppletInternal // // Finally it must be an internal one. }