GtkMessageDialog
A convenient message window
#GtkMessageDialog presents a dialog with an image representing the type of
message (Error, Question, etc.) alongside some message text. It's simply a
convenience widget; you could construct the equivalent of #GtkMessageDialog
from #GtkDialog without too much effort, but #GtkMessageDialog saves typing.
The easiest way to do a modal message dialog is to use gtk_dialog_run(), though
you can also pass in the %GTK_DIALOG_MODAL flag, gtk_dialog_run() automatically
makes the dialog modal and waits for the user to respond to it. gtk_dialog_run()
returns when any dialog button is clicked.
A modal dialog.
dialog = gtk_message_dialog_new (main_application_window,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Error loading file '%s': %s",
filename, g_strerror (errno));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
You might do a non-modal #GtkMessageDialog as follows:
A non-modal dialog.
dialog = gtk_message_dialog_new (main_application_window,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Error loading file '%s': %s",
filename, g_strerror (errno));
/* Destroy the dialog when the user responds to it (e.g. clicks a button) */
g_signal_connect_swapped (dialog, "response",
G_CALLBACK (gtk_widget_destroy),
dialog);
#GtkDialog
The type of message being displayed in the dialog.
@GTK_MESSAGE_INFO: Informational message
@GTK_MESSAGE_WARNING: Nonfatal warning message
@GTK_MESSAGE_QUESTION: Question requiring a choice
@GTK_MESSAGE_ERROR: Fatal error message
@GTK_MESSAGE_OTHER:
Prebuilt sets of buttons for the dialog. If
none of these choices are appropriate, simply use %GTK_BUTTONS_NONE
then call gtk_dialog_add_buttons().
@GTK_BUTTONS_NONE: no buttons at all
@GTK_BUTTONS_OK: an OK button
@GTK_BUTTONS_CLOSE: a Close button
@GTK_BUTTONS_CANCEL: a Cancel button
@GTK_BUTTONS_YES_NO: Yes and No buttons
@GTK_BUTTONS_OK_CANCEL: OK and Cancel buttons
@parent:
@flags:
@type:
@buttons:
@message_format:
@Varargs:
@Returns:
@parent:
@flags:
@type:
@buttons:
@message_format:
@Varargs:
@Returns:
@message_dialog:
@str:
@dialog:
@image:
@message_dialog:
@message_format:
@Varargs:
@message_dialog:
@message_format:
@Varargs: