-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathConfigWindow.go
43 lines (35 loc) · 1.2 KB
/
ConfigWindow.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
"github.com/carylorrk/goline-gotk3/res/glade"
"github.com/conformal/gotk3/gtk"
)
type ConfigWindow struct {
*LineWindow
dataDir *gtk.Entry
tempDir *gtk.Entry
autologin *gtk.CheckButton
save *gtk.Button
cancel *gtk.Button
}
func NewConfigWindow() *ConfigWindow {
window := &ConfigWindow{LineWindow: NewLineWindow(glade.ConfigWindow)}
window.setupWidgets()
window.setupDefault()
return window
}
func (self *ConfigWindow) setupWidgets() {
self.dataDir = self.getIObjectWithType("DataDirEntry", >k.Entry{}).(*gtk.Entry)
self.tempDir = self.getIObjectWithType("TempDirEntry", >k.Entry{}).(*gtk.Entry)
self.autologin = self.getIObjectWithType("Autologin", >k.CheckButton{}).(*gtk.CheckButton)
self.save = self.getIObjectWithType("Save", >k.Button{}).(*gtk.Button)
self.cancel = self.getIObjectWithType("Cancel", >k.Button{}).(*gtk.Button)
}
func (self *ConfigWindow) setupDefault() {
self.dataDir.SetText(goline.DataDirPath)
self.tempDir.SetText(goline.TempDirPath)
self.autologin.SetActive(goline.Autologin)
self.Connect(self.save, "clicked", func() {
NewPasswordWindow(self).window.ShowAll()
})
self.Connect(self.cancel, "clicked", self.window.Destroy)
}