Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions dlgs_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,21 @@ package dialog
// return gtk_file_chooser_dialog_new(title, parent, action, "Cancel", GTK_RESPONSE_CANCEL, acceptText, GTK_RESPONSE_ACCEPT, NULL);
// }
import "C"
import "unsafe"
import (
"sync"
"unsafe"
)

var initSuccess bool

func init() {
C.XInitThreads()
initSuccess = (C.gtk_init_check(nil, nil) == C.TRUE)
}
var (
initSuccess bool
once sync.Once
)

func checkStatus() {
once.Do(func() {
C.XInitThreads()
initSuccess = (C.gtk_init_check(nil, nil) == C.TRUE)
})
if !initSuccess {
panic("gtk initialisation failed; presumably no X server is available")
}
Expand Down