From: Harishankar Date: Thu, 1 Nov 2018 16:32:28 +0000 (+0530) Subject: Implemented the setLineText helper function X-Git-Url: https://harishankar.org/repos/?a=commitdiff_plain;p=resumebuilder.git Implemented the setLineText helper function Implemented the setLineText helper function for Gtk.Entry fields. --- diff --git a/resumebuilder.go b/resumebuilder.go index 3895f79..79d821f 100644 --- a/resumebuilder.go +++ b/resumebuilder.go @@ -58,6 +58,18 @@ const ( } } */ +func setLineText(fieldname string, buf string) { + obj, err := ui.GetObject(fieldname) + if err != nil { + return + } + field, ok := obj.(*gtk.Entry) + if !ok { + return + } + field.SetText(buf) +} + func getLineText(fieldname string) (string, error) { obj, err := ui.GetObject(fieldname) if err != nil { @@ -148,7 +160,7 @@ func getWindow() (*gtk.Window, error) { return wnd, nil } -func LoadMain() { +func loadMain() { gtk.Init(nil) var err error ui, err = gtk.BuilderNew() @@ -252,6 +264,11 @@ func addEducationClicked() { edustore.SetValue(iter, 1, ed.Institution) edustore.SetValue(iter, 2, ed.YearOfPassing) edustore.SetValue(iter, 3, ed.GradeOrPercentage) + + setLineText("QualificationTitle", "") + setLineText("InstitutionName", "") + setLineText("YearPassing", "") + setLineText("GradeOrPercentag", "") } func saveButtonClicked() { @@ -264,5 +281,5 @@ func saveButtonClicked() { } func main() { - LoadMain() + loadMain() }