(define (hello) (let ((window (gtk-window-new 'toplevel)) (button (gtk-button-new)) (label (gtk-label-new "Hello, World!"))) (gtk-container-add button label) (gtk-container-add window button) (gtk-window-set-title window "Hello") (gtk-container-set-border-width button 10) (let ((counter 0)) (g-signal-connect window (C-callback "delete_event") (lambda (w e) (outf-console ";Delete me "(- 2 counter)" times.\n") (set! counter (1+ counter)) ;; Three or more is the charm. (if (> counter 2) 0 1))) (g-signal-connect button (C-callback "clicked") (lambda (w) (if (= counter 1) (begin (outf-console "\n;Erroring in "(current-thread)"...\n") (error "Testing error handling."))) (let ((text (gtk-label-get-text label))) (gtk-label-set-text label (list->string (reverse! (string->list text))))) unspecific))) (gtk-widget-show-all window) window))