guile-gtk-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: accessing enums in guile-gnome


From: John Steele Scott
Subject: Re: accessing enums in guile-gnome
Date: Sun, 14 Jan 2007 10:54:21 +1000
User-agent: Pan/0.14.2.91 (As She Crawled Across the Table (Debian GNU/Linux))

On Sat, 13 Jan 2007 22:09:01 +0000, Neil Jerram wrote:
>> Anyway, today's question. I was surprised that Gtk has no equivalent of
>> the Windows MessageBox function. So I wrote this one, which returns the
>> result of gtk-dialog-run.
> 
> Nice.  Can I steal this for my own library of guile-gnome utility stuff?

Sure.

> Surely it would be easier and clearer to use define* here, instead of
> define and then let-optional?

Surely. My education with guile is quite limited; I didn't know about
define*. Thanks for pointing that out.

I've made the change you suggested,
and also added a mandatory parent argument. It now looks like:

(define* (modal-messagebox parent
                           msg
                           #:optional
                           (msgtype 'info)
                           (buttontype 'close)
                           (default-response #f))
  "Pops up a modal dialog with message @var{msg}.
Optionally the message type, button type and default button response may
be specified as third, fourth and fifth arguments, respectively.

By default the dialog will be informational, with a single close button.

Returns the result of calling gtk-dialog-run on the dialog."
  (let ((dialog (%gtk-message-dialog-new parent
                                         'destroy-with-parent
                                         msgtype
                                         buttontype
                                         msg)))
    (if default-response
        (gtk-dialog-set-default-response dialog
                                         default-response))
    (let ((result (gtk-dialog-run dialog)))
      (gtk-widget-destroy dialog)
      result)))

cheers,

John





reply via email to

[Prev in Thread] Current Thread [Next in Thread]