forked from jshiffer/go-xmpp
fix gui.
This commit is contained in:
parent
d92790f748
commit
df2ef04578
@ -11,14 +11,14 @@ import (
|
||||
func main() {
|
||||
gtk.Init(&os.Args)
|
||||
|
||||
window := gtk.Window(gtk.GTK_WINDOW_TOPLEVEL)
|
||||
window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL)
|
||||
window.SetTitle("GoTalk")
|
||||
window.Connect("destroy", func() {
|
||||
gtk.MainQuit()
|
||||
})
|
||||
vbox := gtk.VBox(false, 1)
|
||||
scrolledwin := gtk.ScrolledWindow(nil, nil)
|
||||
textview := gtk.TextView()
|
||||
vbox := gtk.NewVBox(false, 1)
|
||||
scrolledwin := gtk.NewScrolledWindow(nil, nil)
|
||||
textview := gtk.NewTextView()
|
||||
textview.SetEditable(false)
|
||||
textview.SetCursorVisible(false)
|
||||
scrolledwin.Add(textview)
|
||||
@ -26,44 +26,44 @@ func main() {
|
||||
|
||||
buffer := textview.GetBuffer()
|
||||
|
||||
entry := gtk.Entry()
|
||||
entry := gtk.NewEntry()
|
||||
vbox.PackEnd(entry, false, false, 0)
|
||||
|
||||
window.Add(vbox)
|
||||
window.SetSizeRequest(300, 400)
|
||||
window.ShowAll()
|
||||
|
||||
dialog := gtk.Dialog()
|
||||
dialog := gtk.NewDialog()
|
||||
dialog.SetTitle(window.GetTitle())
|
||||
sgroup := gtk.SizeGroup(gtk.GTK_SIZE_GROUP_HORIZONTAL)
|
||||
sgroup := gtk.NewSizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
|
||||
|
||||
hbox := gtk.HBox(false, 1)
|
||||
hbox := gtk.NewHBox(false, 1)
|
||||
dialog.GetVBox().Add(hbox)
|
||||
label := gtk.Label("username:")
|
||||
label := gtk.NewLabel("username:")
|
||||
sgroup.AddWidget(label)
|
||||
hbox.Add(label)
|
||||
username := gtk.Entry()
|
||||
username := gtk.NewEntry()
|
||||
hbox.Add(username)
|
||||
|
||||
hbox = gtk.HBox(false, 1)
|
||||
hbox = gtk.NewHBox(false, 1)
|
||||
dialog.GetVBox().Add(hbox)
|
||||
label = gtk.Label("password:")
|
||||
label = gtk.NewLabel("password:")
|
||||
sgroup.AddWidget(label)
|
||||
hbox.Add(label)
|
||||
password := gtk.Entry()
|
||||
password := gtk.NewEntry()
|
||||
password.SetVisibility(false)
|
||||
hbox.Add(password)
|
||||
|
||||
dialog.AddButton(gtk.GTK_STOCK_OK, int(gtk.GTK_RESPONSE_OK))
|
||||
dialog.AddButton(gtk.GTK_STOCK_CANCEL, int(gtk.GTK_RESPONSE_CANCEL))
|
||||
dialog.SetDefaultResponse(int(gtk.GTK_RESPONSE_OK))
|
||||
dialog.AddButton(gtk.STOCK_OK, int(gtk.RESPONSE_OK))
|
||||
dialog.AddButton(gtk.STOCK_CANCEL, int(gtk.RESPONSE_CANCEL))
|
||||
dialog.SetDefaultResponse(int(gtk.RESPONSE_OK))
|
||||
dialog.SetTransientFor(window)
|
||||
dialog.ShowAll()
|
||||
res := dialog.Run()
|
||||
username_ := username.GetText()
|
||||
password_ := password.GetText()
|
||||
dialog.Destroy()
|
||||
if res != int(gtk.GTK_RESPONSE_OK) {
|
||||
if res != gtk.RESPONSE_OK {
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ func main() {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
var iter gtk.GtkTextIter
|
||||
var iter gtk.TextIter
|
||||
buffer.GetStartIter(&iter)
|
||||
buffer.Insert(&iter, chat.Remote+": "+chat.Text+"\n")
|
||||
}()
|
||||
|
Loading…
Reference in New Issue
Block a user