mattn/go-gtk — Issue #74: How to properly handle signal arguments?
Author: dersebi
Created: 2012-01-04 06:34:42+00:00
State: open

I hava a little sample program which uses a GtkEntry with a connected "insert-text" signal. The "insert-text" signal has 3 arguments: Arg(1) is an int which I can convert just fine, but Arg(0) is a char*.

How do I convert it to a real Go string?

mynewtext := string(ctx.Args(0)) does only produce a weird rune. I guess I would have to work with C.GoString() and C.to_charptr() as you did in GtkEntry.GetText(), but I can't seem to import "C" without converting my program to a cgo project.

Do you have a plan for handling signals more go-like? Or do you know of a way to convert the string correctly?