summaryrefslogtreecommitdiff
path: root/redo/common_unix.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-07-08 12:04:51 -0400
committerPietro Gagliardi <[email protected]>2014-07-08 12:04:51 -0400
commit60d0953fe9f16726958f709007402ea4c8b89fc6 (patch)
treed3704828dad002c1144626aaec1f3e5cc5560041 /redo/common_unix.go
parentbe56707c51a411c5e8228a78d663c91df4636128 (diff)
Implemented the Window OnClosing() event on GTK+. It works!
Diffstat (limited to 'redo/common_unix.go')
-rw-r--r--redo/common_unix.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/redo/common_unix.go b/redo/common_unix.go
index e495063..e2d9261 100644
--- a/redo/common_unix.go
+++ b/redo/common_unix.go
@@ -7,6 +7,11 @@ import (
)
// #include "gtk_unix.h"
+// /* because cgo doesn't like g_signal_connect() */
+// void gSignalConnect(gpointer obj, gchar *sig, GCallback callback, gpointer data)
+// {
+// g_signal_connect(obj, sig, callback, data);
+// }
import "C"
func fromgstr(s *C.gchar) string {
@@ -20,3 +25,9 @@ func togstr(s string) *C.gchar {
func freegstr(s *C.gchar) {
C.free(unsafe.Pointer(s))
}
+
+func g_signal_connect(object C.gpointer, name string, to C.GCallback, data C.gpointer) {
+ cname := togstr(name)
+ defer freegstr(cname)
+ C.gSignalConnect(object, cname, to, data)
+}