Switched from gtk_init() to the version that lets us catch and report any errors it encounters.

This commit is contained in:
Pietro Gagliardi 2014-07-21 16:08:22 -04:00
parent d60d176472
commit 54c999bc42
1 changed files with 9 additions and 2 deletions

View File

@ -5,6 +5,7 @@
package ui
import (
"fmt"
"unsafe"
)
@ -14,8 +15,14 @@ import (
import "C"
func uiinit() error {
// TODO replace with the error-checking version
C.gtk_init(nil, nil)
var err *C.GError = nil // redundant in Go, but let's explicitly assign it anyway
// gtk_init_with_args() gives us error info (thanks chpe in irc.gimp.net/#gtk+)
// don't worry about GTK+'s command-line arguments; they're also available as environment variables (thanks mclasen in irc.gimp.net/#gtk+)
result := C.gtk_init_with_args(nil, nil, nil, nil, nil, &err)
if result == C.FALSE {
return fmt.Errorf("error actually initilaizing GTK+: %s", fromgstr(err.message))
}
return nil
}