diff options
| author | Pietro Gagliardi <[email protected]> | 2014-02-16 17:09:58 -0500 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-02-16 17:09:58 -0500 |
| commit | 1bcbce414287a9eecfd291522f4a8e2dd0c28102 (patch) | |
| tree | 865fe3950f4c37545748f1f6429bea5f951689bc /gtkcalls_unix.go | |
| parent | f5652737ebbd44310a7a19815c88f7f83d67a3a9 (diff) | |
Cleaned up the idle callback code.
Diffstat (limited to 'gtkcalls_unix.go')
| -rw-r--r-- | gtkcalls_unix.go | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/gtkcalls_unix.go b/gtkcalls_unix.go index 84e027f..0f4f818 100644 --- a/gtkcalls_unix.go +++ b/gtkcalls_unix.go @@ -12,9 +12,7 @@ import ( // #include <stdlib.h> // #include <gtk/gtk.h> // /* because cgo is flaky with macros */ -// static inline void gSignalConnect(GtkWidget *widget, char *signal, GCallback callback, void *data) { g_signal_connect(widget, signal, callback, data); } -// /* so we can call uistep */ -// extern gboolean our_thread_callback(gpointer); +// void gSignalConnect(GtkWidget *widget, char *signal, GCallback callback, void *data) { g_signal_connect(widget, signal, callback, data); } import "C" type ( @@ -32,21 +30,13 @@ func togbool(b bool) C.gboolean { return C.FALSE } -//export our_thread_callback -func our_thread_callback(C.gpointer) C.gboolean { - uistep() - return C.TRUE -} - func gtk_init() bool { // TODO allow GTK+ standard command-line argument processing - b := fromgbool(C.gtk_init_check((*C.int)(nil), (***C.char)(nil))) - if !b { - return false - } - // thanks to tristan in irc.gimp.net/#gtk - C.gdk_threads_add_idle(C.GSourceFunc(C.our_thread_callback), C.gpointer(unsafe.Pointer(nil))) - return true + return fromgbool(C.gtk_init_check((*C.int)(nil), (***C.char)(nil))) +} + +func gdk_threads_add_idle(what func() bool) { + C.gdk_threads_add_idle(callbacks["idle"], C.gpointer(unsafe.Pointer(&what))) } func gtk_main() { |
