From 5960a1c589fcb3235edef412ab9827f0e9cfe6bd Mon Sep 17 00:00:00 2001 From: Harishankar Date: Wed, 24 Oct 2018 21:21:12 +0530 Subject: [PATCH] Basic details page connected signals Completed signal/slot connection in the basic details page. --- bindata.go | 4 +-- resources/resumebuilder.glade | 4 +++ resumebuilder.go | 54 +++++++++++++++++++++++++++++++---- 3 files changed, 55 insertions(+), 7 deletions(-) diff --git a/bindata.go b/bindata.go index 00b9946..fcf0be7 100644 --- a/bindata.go +++ b/bindata.go @@ -68,7 +68,7 @@ func (fi bindataFileInfo) Sys() interface{} { return nil } -var _resourcesResumebuilderGlade = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x5a\xc9\x6e\xe3\x38\x10\xbd\xe7\x2b\x38\xbc\x0e\xbc\x6a\x9c\x05\x90\x15\x24\x98\x38\x97\x4c\x06\x98\x64\xd0\x47\x83\x16\xcb\x32\xdb\x0c\xa9\x26\x29\x2f\x7f\xdf\xa0\x9d\xb4\x17\x2d\x96\xe4\x25\x0a\xda\x97\x20\x91\xab\x4a\xc5\x7a\xf5\x6a\x09\xed\xde\xce\xde\x38\x9a\x80\xd2\x4c\x8a\x2e\x6e\xd5\x9b\x18\x81\xf0\x25\x65\x22\xe8\xe2\xff\x5f\x7b\xb5\x6b\x7c\xeb\x5d\xb8\x7f\xd4\x6a\xe8\x11\x04\x28\x62\x80\xa2\x29\x33\x23\x14\x70\x42\x01\x39\xf5\x76\xbb\xde\x42\xb5\x9a\x77\xe1\x32\x61\x40\x0d\x89\x0f\xde\x05\x42\xae\x82\x1f\x11\x53\xa0\x11\x67\x83\x2e\x0e\xcc\xf8\x4f\xbc\x7a\x91\x53\x6f\x37\x71\x63\x21\x27\x07\xdf\xc1\x37\xc8\xe7\x44\xeb\x2e\x7e\x34\xe3\x6f\x4c\x50\x39\xc5\x88\xd1\x2e\xfe\x87\x30\xf1\xfe\xb7\x15\x46\xc8\x0d\x95\x0c\x41\x99\x39\x12\xe4\x0d\xba\xd8\xfe\xc4\xde\x4a\xcc\x6d\x7c\x08\x24\xcb\xfb\x44\xf4\x87\xd2\x8f\x34\xf6\x7a\x84\x6b\xd8\x25\x3f\x5d\x58\xed\x87\x52\x33\xc3\xa4\xc0\x9e\x0f\xf6\x94\x35\x29\x6a\x21\x51\x20\x4c\xcc\x80\x3f\x62\x9c\x2e\x7f\xb7\xe6\x38\xf1\x61\x24\x39\x05\xd5\x78\x17\x68\xac\x49\x6c\x49\xc7\x62\xf1\x2c\x0d\x0c\xa4\x1c\xe3\x0f\x91\xb8\x87\x13\xa6\xd9\x80\x03\xf6\x5e\x55\x14\x3b\xce\x8e\x10\xa4\xaa\x6c\xb8\x95\xec\x5a\x8f\xcd\x80\xe2\x75\x99\x12\xbe\x95\x81\x28\xdd\xc9\x64\x47\x1f\x84\x51\xf3\x65\x3a\xf5\x98\xd2\xe6\x79\x91\x32\x5b\x6a\x49\xc8\x53\x33\xea\xdb\x2c\x06\x6d\xb0\xd7\x6e\x77\xd2\x1c\x29\x7d\xf2\x92\xe8\xa4\xa9\x32\x11\x46\xa6\x1f\x46\x2a\x94\x1a\xb0\x67\x1f\xa6\xab\xbb\x8d\x65\xa0\x62\xcf\x43\xe2\x8f\x99\x08\x76\xbf\x6e\x66\x83\xd2\x2a\xe2\xe0\x1c\x7b\xad\x0c\x05\xb7\x91\xf8\xee\x0d\xc2\xfc\x7a\x98\x13\xfc\x27\x32\x00\x9e\x03\xed\x43\xe0\x95\x99\xad\x49\xba\x7c\xe1\x1c\x32\x8a\x08\xcd\x89\x21\x03\x6e\x83\x04\xd6\x94\x4d\x54\x74\x02\x04\x9d\xab\xa2\x00\x5e\x9f\x01\xcc\x01\xe0\x13\xa9\x28\x7e\x9d\x0c\x85\x63\xe0\xb7\x56\x7d\x6d\x4c\xce\xc5\x17\x7d\x5e\xf1\xed\x34\xcf\xdc\xcd\xc1\xdd\x17\x98\x55\x8d\xb5\x2d\xa7\x7d\x5a\xe8\xfe\x23\x94\xc9\xfb\xc8\x18\x29\x3e\x26\x71\x9e\x87\xb8\xe9\x51\xb5\x06\x8a\x9c\x7a\xab\x04\x74\x6e\x8a\x28\x8f\x80\x05\x23\xb3\x56\x40\xfe\xaa\x7a\xfd\x50\xe0\x03\x9b\x80\xee\x53\x18\x92\x88\x9b\x12\x19\x4d\x7c\xc3\x26\x25\xbc\xa6\x8a\x4c\xfb\x4c\x50\xe6\x13\x23\xd5\x2e\xfd\x83\x10\xa0\xd5\x29\x3c\x38\x3a\x27\x9e\x1c\x63\x0c\xe8\xc1\xdb\xbe\x1c\x58\x9a\xd8\x83\x05\x57\x85\xfa\xe0\x99\x05\x47\x63\x41\x5c\x3f\x50\x32\x0a\x77\x95\xb9\x03\x35\xfe\x8c\x66\x50\x3d\xf2\xec\x43\x98\x7f\xcd\x08\xd4\x1e\x7c\xb9\xdc\x8f\x2f\x95\x9f\x3a\xcf\x7c\xd9\xf5\x1a\x3b\x6d\x35\x9d\xaa\xf3\xe5\x8b\x4e\xca\x77\x41\xe5\xf6\xdb\x9b\xcf\xdb\x6f\xef\x82\x12\xab\x6d\xd6\x4e\x56\x8d\x1a\xb3\xb5\xd9\x52\x16\x30\xa3\x8f\xde\xe2\x0a\x85\x65\x8e\xbd\xeb\x8c\xfd\xe0\x18\xb8\xaf\x4f\x86\x2f\x64\x02\x07\x68\x76\xd6\xcc\x1e\xbd\xae\xe5\x14\x8a\xd9\x76\xb3\x73\xbe\xe0\x70\x78\x82\x4d\xc5\x69\x16\xde\xd5\x2f\x0f\xf2\x2f\xd2\x24\xef\x93\x3d\xdf\xf6\xc1\x90\x41\x7f\xc8\x38\xcf\x2c\xf5\x09\x8e\xc4\x9c\x58\x72\x01\x99\x79\xb8\xb4\xba\x91\xdd\xf9\x9a\xd8\x69\x6f\x84\x72\x53\xed\x9e\x68\xe6\xa3\xbf\xc1\x10\xc6\x53\x6a\x59\x65\xe2\x9f\x1d\xf4\x4f\xbe\x86\x2b\x1f\xa5\xd5\x95\x6a\xca\xac\xf5\x7b\x67\xe8\x03\x8d\x7c\x62\xe3\x73\xf2\xb8\x9f\x36\xa1\xe3\x17\xe4\x25\x80\xce\x65\x64\x33\x64\x6b\x1f\xae\x3e\x70\x1b\x6b\xdf\x61\xf8\x19\x00\x00\xff\xff\xcc\x33\xb3\xcd\x1c\x21\x00\x00") +var _resourcesResumebuilderGlade = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x5a\x5f\x6f\xdb\x36\x10\x7f\xcf\xa7\xe0\xf8\x3a\x38\x8e\xa5\xb9\x4d\x01\x49\x45\xbb\xd5\x7d\xe9\x3a\x60\xee\xb0\x47\x83\x26\x2f\x12\x67\x86\xd4\x48\xca\x7f\xbe\xfd\x40\x3b\x69\x6c\xeb\x4f\x24\x39\x56\x54\xcc\x2f\x41\x2c\xde\x9d\x8e\xf7\xbb\xdf\x1d\x4f\x52\xf0\x7e\x7d\x2f\xd0\x12\xb4\xe1\x4a\x86\x78\x74\x7d\x83\x11\x48\xaa\x18\x97\x71\x88\xff\xfa\x36\x19\xdc\xe2\xf7\xd1\x55\xf0\xd3\x60\x80\x3e\x83\x04\x4d\x2c\x30\xb4\xe2\x36\x41\xb1\x20\x0c\x90\x7f\xed\x79\xd7\x23\x34\x18\x44\x57\x01\x97\x16\xf4\x1d\xa1\x10\x5d\x21\x14\x68\xf8\x37\xe3\x1a\x0c\x12\x7c\x1e\xe2\xd8\x2e\x7e\xc6\x4f\x37\xf2\xaf\xbd\x1b\x3c\xdc\xca\xa9\xf9\x3f\x40\x2d\xa2\x82\x18\x13\xe2\xcf\x76\xf1\x37\x97\x4c\xad\x30\xe2\x2c\xc4\xbf\x13\x2e\x1f\x7e\x3b\x61\x84\x82\x54\xab\x14\xb4\xdd\x20\x49\xee\x21\xc4\xee\x2f\x8e\x9e\xc4\x82\xe1\xa3\x40\xb1\x3c\x25\x72\x76\xa7\x68\x66\x70\x34\x21\xc2\xc0\x73\xf2\xab\xad\xd5\x59\xaa\x0c\xb7\x5c\x49\x1c\x51\x70\xbb\x1c\x28\x39\x48\x89\x06\x69\x73\x06\x68\xc2\x05\xdb\xfd\xef\xcc\x09\x42\x21\x51\x82\x81\x1e\x3e\x08\x0c\xf7\x24\x8e\xa4\x73\xb1\xf8\xaa\x2c\xcc\x95\x5a\xe0\x47\x91\xbc\x87\x4b\x6e\xf8\x5c\x00\x8e\xbe\xe9\x2c\xb7\x9d\x67\x42\x50\xaa\x72\xe0\x56\xb1\x6b\x13\xbe\x06\x86\xf7\x65\x5a\xf8\xd6\x06\xa2\x72\x27\x8b\x1d\xfd\x24\xad\xde\xec\xd2\x69\xc2\xb5\xb1\x5f\xb7\x29\x73\xa4\x56\x84\x3c\xb3\xc9\xcc\x65\x31\x18\x8b\x23\xcf\x1b\x97\x39\xd2\x7a\xe7\x2d\xd1\x29\x53\xe5\x32\xcd\xec\x2c\xcd\x74\xaa\x0c\xe0\xc8\x5d\x2c\x57\x0f\x86\xbb\x40\xe5\xae\xa7\x84\x2e\xb8\x8c\x9f\xbf\xdd\xda\x05\x65\xd4\xc4\xc1\x0d\x8e\x46\x15\x0a\xc1\xb0\xf0\xde\x07\x84\xf9\x7e\xb1\x26\xf8\x5f\xc8\x1c\x44\x0d\xb4\x5f\x02\xaf\xca\x6c\x2d\xd2\x15\x5b\xe7\x90\xd5\x44\x1a\x41\x2c\x99\x0b\x17\x24\x70\xa6\x5c\xa2\xa2\x0e\x10\xf4\xdf\x36\x05\xf0\xf6\x02\x60\x0d\x00\xbf\x90\x9e\xe2\x37\xae\x50\x38\x07\x7e\x7b\xd5\xd7\xc5\xe4\x52\x7c\xd1\xeb\x15\xdf\xf1\xcd\x85\xbb\x35\xb8\x3b\x85\x75\xdf\x58\x3b\xf2\xbd\x6e\xa1\xfb\x93\x30\xae\x3e\x66\xd6\x2a\xf9\x78\x12\x17\x75\x88\x5b\x1e\x55\x67\xa0\xc9\xae\x8f\x4a\xc0\xf8\x5d\x13\xe5\x04\x78\x9c\xd8\xbd\x02\xf2\x4b\xdf\xeb\x87\x06\x0a\x7c\x09\x66\xc6\xe0\x8e\x64\xc2\xb6\xc8\x68\x42\x2d\x5f\xb6\xf0\x9a\x69\xb2\x9a\x71\xc9\x38\x25\x56\xe9\x1a\xfa\x86\xc7\x92\x88\x07\x6d\xab\xe2\x58\x00\xc3\x28\x21\x92\x09\xd0\x21\x9e\xc2\xda\x81\x3d\x05\x01\xd4\xba\x15\xb3\x22\x69\x0a\x2c\xc4\x52\xe1\xe1\x59\x08\x35\x1a\x37\x3e\x88\xfa\x1d\x9f\x44\x73\x8c\x9a\xc0\xfd\xa9\x9c\xda\x99\x38\x81\x55\x6f\x1b\xf5\xd5\x0b\xab\xce\xc9\xaa\x23\xfd\x58\xab\x2c\xad\x51\x36\x9f\x27\xe3\x2e\x4b\xba\xa4\xa3\xe7\x55\xb4\xab\xfe\xd1\xf1\x14\x0a\xfe\x61\x13\xd0\x27\x30\xf0\xcd\x69\x0c\xec\xfd\xb9\xf8\xc2\xc0\x29\xac\xb7\x49\xd2\x25\x01\xfd\x1b\xbf\xef\x04\xfc\x41\x87\x83\x0f\x71\xef\x46\xfa\x77\xaf\x37\xd2\x7f\x88\x5b\x4c\xf3\x55\x63\x68\x3f\x8a\xd6\xd1\x30\xcf\x78\xcc\xad\x39\xfb\x38\xdf\x28\x2c\x1b\x1c\xdd\x56\x8c\x44\xe7\xc0\x7d\xff\xf0\x3a\x25\x4b\x78\x81\xee\xe9\xcc\x9c\xd0\x3c\x47\x7e\xa3\x98\x1d\x77\x4f\xff\x07\x3c\xbf\x36\x1b\xce\xa8\xe0\x74\x71\xd8\x8d\xbe\x03\xf7\xeb\xe3\x5a\x17\xed\xa8\xf1\x03\x8f\x37\x2f\xf2\x9c\xb9\xc8\xfb\x62\xcf\x8f\x7d\xb0\x64\x3e\xbb\xe3\x42\x54\x36\x8f\x02\x47\x72\x4e\xec\xd8\x85\xec\x26\xdd\x59\x3d\xe0\x4b\xbd\xb6\xd8\xed\x6b\xb5\xda\xe4\xfd\x48\x0c\xa7\xe8\x37\xb0\x84\x8b\x92\xea\xd8\x9b\xf8\x57\x07\xfd\x95\xdf\x65\xb6\x8f\xd2\xd3\x7b\xe9\x92\xd3\xdb\xff\x3b\x43\x3f\xb1\x8c\x12\x17\x9f\xce\xe3\xde\x6d\x42\xe7\xbf\x32\x68\x01\x74\x2d\x23\x87\x21\xdb\x5b\x7c\x5a\x08\x86\x7b\x1f\x82\xfc\x17\x00\x00\xff\xff\x03\x43\x0c\x05\x61\x22\x00\x00") func resourcesResumebuilderGladeBytes() ([]byte, error) { return bindataRead( @@ -83,7 +83,7 @@ func resourcesResumebuilderGlade() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "resources/resumebuilder.glade", size: 8476, mode: os.FileMode(436), modTime: time.Unix(1540310475, 0)} + info := bindataFileInfo{name: "resources/resumebuilder.glade", size: 8801, mode: os.FileMode(436), modTime: time.Unix(1540395646, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/resources/resumebuilder.glade b/resources/resumebuilder.glade index 1a6d5b6..049fb00 100644 --- a/resources/resumebuilder.glade +++ b/resources/resumebuilder.glade @@ -84,6 +84,7 @@ False True True + 151 @@ -101,6 +102,7 @@ True True Male + 222 @@ -118,6 +120,7 @@ True True Male + 303 @@ -155,6 +158,7 @@ True True True + 307 diff --git a/resumebuilder.go b/resumebuilder.go index 88fe6a6..09057c6 100644 --- a/resumebuilder.go +++ b/resumebuilder.go @@ -3,6 +3,7 @@ package main import ( "fmt" "os" + "strconv" "github.com/gotk3/gotk3/gtk" ) @@ -24,6 +25,7 @@ type Education struct { type Sex int var ui *gtk.Builder +var selectedsex Sex const ( Male Sex = 1 @@ -46,6 +48,7 @@ const ( } */ func getBasicDetails() (*Applicant, error) { + // Retrieve all the fields. obj, err := ui.GetObject("FirstName") if err != nil { return nil, err @@ -71,10 +74,34 @@ func getBasicDetails() (*Applicant, error) { return nil, err } + obj, err = ui.GetObject("Age") + if err != nil { + return nil, err + } + agectl, ok := obj.(*gtk.Entry) + if !ok { + return nil, err + } + agetxt, err := agectl.GetText() + if err != nil { + return nil, err + } + age, err := strconv.Atoi(agetxt) + if err != nil { + return nil, err + } + obj, err = ui.GetObject("Male") + if err != nil { + return nil, err + } + + // Store the contents in Applicant object var applicant = new(Applicant) applicant.FirstName = firstname applicant.LastName = lastname + applicant.Age = age + applicant.Sex = selectedsex return applicant, nil } @@ -119,19 +146,18 @@ func LoadMain() { os.Exit(1) } ui.AddFromString(string(asset)) + ui.ConnectSignals(map[string]interface{}{"SexMaleSelected": sexMaleSelected, + "SexFemaleSelected": sexFemaleSelected, "SexOtherSelected": sexOtherSelected, + "SaveButtonClicked": SaveButtonClicked}) wnd, err := getWindow() if err != nil { os.Exit(1) } - btn, err := getSaveButton() - if err != nil { - os.Exit(1) - } - btn.Connect("clicked", SaveButtonClicked) wnd.SetTitle("Resume Builder") wnd.ShowAll() + selectedsex = Male wnd.Connect("destroy", func() { gtk.MainQuit() @@ -139,6 +165,24 @@ func LoadMain() { gtk.Main() } +func sexMaleSelected(male *gtk.RadioButton) { + if male.GetActive() { + selectedsex = Male + } +} + +func sexFemaleSelected(female *gtk.RadioButton) { + if female.GetActive() { + selectedsex = Female + } +} + +func sexOtherSelected(other *gtk.RadioButton) { + if other.GetActive() { + selectedsex = Other + } +} + func SaveButtonClicked() { a, err := getBasicDetails() if err != nil { -- 2.20.1