Added the new MsgBox() behavior to the GTK+ backend. It /almost/ works right; just needs some more changes...
This commit is contained in:
parent
641d11c6fe
commit
15afca6402
|
@ -22,7 +22,9 @@ import (
|
|||
// }
|
||||
import "C"
|
||||
|
||||
func _msgBox(parent *Window, primarytext string, secondarytext string, msgtype C.GtkMessageType, buttons C.GtkButtonsType) (result C.gint) {
|
||||
func _msgBox(parent *Window, primarytext string, secondarytext string, msgtype C.GtkMessageType, buttons C.GtkButtonsType) (result chan int) {
|
||||
result = make(chan int)
|
||||
go func() {
|
||||
ret := make(chan C.gint)
|
||||
defer close(ret)
|
||||
uitask <- func() {
|
||||
|
@ -68,13 +70,25 @@ func _msgBox(parent *Window, primarytext string, secondarytext string, msgtype C
|
|||
|
||||
ret <- response
|
||||
}
|
||||
return <-ret
|
||||
result <- int(<-ret)
|
||||
}()
|
||||
return result
|
||||
}
|
||||
|
||||
func msgBox(parent *Window, primarytext string, secondarytext string) {
|
||||
_msgBox(parent, primarytext, secondarytext, C.GtkMessageType(C.GTK_MESSAGE_OTHER), C.GtkButtonsType(C.GTK_BUTTONS_OK))
|
||||
func (w *Window) msgBox(primarytext string, secondarytext string) (done chan struct{}) {
|
||||
done = make(chan struct{})
|
||||
go func() {
|
||||
<-_msgBox(w, primarytext, secondarytext, C.GtkMessageType(C.GTK_MESSAGE_OTHER), C.GtkButtonsType(C.GTK_BUTTONS_OK))
|
||||
done <- struct{}{}
|
||||
}()
|
||||
return done
|
||||
}
|
||||
|
||||
func msgBoxError(parent *Window, primarytext string, secondarytext string) {
|
||||
_msgBox(parent, primarytext, secondarytext, C.GtkMessageType(C.GTK_MESSAGE_ERROR), C.GtkButtonsType(C.GTK_BUTTONS_OK))
|
||||
func (w *Window) msgBoxError(primarytext string, secondarytext string) (done chan struct{}) {
|
||||
done = make(chan struct{})
|
||||
go func() {
|
||||
<-_msgBox(w, primarytext, secondarytext, C.GtkMessageType(C.GTK_MESSAGE_ERROR), C.GtkButtonsType(C.GTK_BUTTONS_OK))
|
||||
done <- struct{}{}
|
||||
}()
|
||||
return done
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue