Working on the new GTK interface for Keryx last week, I found that I needed a simple Yes/No dialog. I had used stock dialogs in wx, but I didn’t know if the same thing existed in GTK. So after some Googling and reading through mailing list logs, I found that what I was looking for was called MessageDialog. Then I had to search for documentation on how to use it. The documentation I found what fairly verbose and I had trouble understanding it. But after forty-five minutes or so I was rocking away with MessageDialogs.
I could have kept my new hard-won knowledge to myself and continued on my merry way, but instead I decided to share it. When I discovered MessageDialog, I had, of course, looked for an Acire snippet, but there was none. So I made one.
When you run the snippet, you’re given a list of MessageDialog’s options — flags, type, buttons, and message_format. In the screenshots I chose the gtk.DIALOG_DESTROY_WITH_PARENT flag, the gtk.MESSAGE_ERROR option, the gtk.BUTTONS_OK option, and a quote from 2001: a Space Odyssey for message_format.
When I click ‘Launch my MessageDialog!,’ I am given a nice-looking dialog with an error icon, my message, and an OK button.
When I click ‘OK,’ I am informed that my response was affirmative.
That’s it, my first Acire snippet. Look for it in the next Acire release!





