Implemented the setLineText helper function master
authorHarishankar <v.harishankar@gmail.com>
Thu, 1 Nov 2018 16:32:28 +0000 (22:02 +0530)
committerHarishankar <v.harishankar@gmail.com>
Thu, 1 Nov 2018 16:32:28 +0000 (22:02 +0530)
Implemented the setLineText helper function for Gtk.Entry fields.

resumebuilder.go

index 3895f79..79d821f 100644 (file)
@@ -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()
 }