From c0c38ac8f5ded52f0db925ca7ca4bc6efedcb648 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Mon, 7 Jul 2014 15:30:55 -0400 Subject: Added the GTK+ implementation of Window, added the Window constructors, and rewrote the GTK+ Button constructor to use Requests. --- redo/controls_unix.go | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'redo/controls_unix.go') diff --git a/redo/controls_unix.go b/redo/controls_unix.go index 1fc76c0..647e5ee 100644 --- a/redo/controls_unix.go +++ b/redo/controls_unix.go @@ -24,13 +24,19 @@ type button struct { button *C.GtkButton } -func newButton(text string) Button { - ctext := togstr(text) - defer freegstr(ctext) - widget := C.gtk_button_new_with_label(ctext) - return &button{ - widget: newWidget(widget), - button: (*C.GtkButton)(unsafe.Pointer(widget)), +func newButton(text string) *Request { + c := make(chan interface{}) + return &Request{ + op: func() { + ctext := togstr(text) + defer freegstr(ctext) + widget := C.gtk_button_new_with_label(ctext) + c <- &button{ + widget: newWidget(widget), + button: (*C.GtkButton)(unsafe.Pointer(widget)), + } + }, + resp: c, } } -- cgit v1.2.3