diff options
| author | Pietro Gagliardi <[email protected]> | 2014-07-21 16:08:22 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-07-21 16:08:22 -0400 |
| commit | 54c999bc42acccc5d0ef69a6a6d9d607369debf9 (patch) | |
| tree | adbfe706e2ae79c7330e923bb54437264ced3317 | |
| parent | d60d1764723e95b89aad4571bcdd1292762a027a (diff) | |
Switched from gtk_init() to the version that lets us catch and report any errors it encounters.
| -rw-r--r-- | redo/uitask_unix.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/redo/uitask_unix.go b/redo/uitask_unix.go index b1a556e..a17c0a2 100644 --- a/redo/uitask_unix.go +++ b/redo/uitask_unix.go @@ -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 } |
