diff options
| author | Pietro Gagliardi <[email protected]> | 2014-04-27 12:43:15 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-04-27 12:43:15 -0400 |
| commit | 6a2fb35d609ec5805dda89de9dc46cadb4466eea (patch) | |
| tree | 9f2a0734be10df91d10cd6c63253aff280769899 /gtkcalls_unix.go | |
| parent | 6978961661c825388fa7c28f456ba71dd85fa908 (diff) | |
ui.Go() on GTK+ now reports the reason gtk_init() failed in its error return.
Diffstat (limited to 'gtkcalls_unix.go')
| -rw-r--r-- | gtkcalls_unix.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gtkcalls_unix.go b/gtkcalls_unix.go index d5dc319..f622739 100644 --- a/gtkcalls_unix.go +++ b/gtkcalls_unix.go @@ -14,9 +14,16 @@ import ( // #include "gtk_unix.h" import "C" -func gtk_init() bool { +func gtk_init() error { + 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+) // TODO allow GTK+ standard command-line argument processing - return fromgbool(C.gtk_init_check((*C.int)(nil), (***C.char)(nil))) + result := C.gtk_init_with_args(nil, nil, nil, nil, nil, &err) + if result == C.FALSE { + return fmt.Errorf("%s", fromgstr(err.message)) + } + return nil } func gtk_main() { @@ -71,7 +78,7 @@ var gtkLayoutCSS = []byte(`GtkLayout { `) func makeTransparent(layout *C.GtkWidget) { - var err *C.GError = nil // redundant in Go, but let's explicitly assign it anyway + var err *C.GError = nil provider := C.gtk_css_provider_new() added := C.gtk_css_provider_load_from_data(provider, |
