gtk.message_dialog
Module for [MessageDialog] class
Types 3
gtk.message_dialog.MessageDialog presents a dialog with some message text.
It’s simply a convenience widget; you could construct the equivalent of gtk.message_dialog.MessageDialog from gtk.dialog.Dialog without too much effort, but gtk.message_dialog.MessageDialog saves typing.
The easiest way to do a modal message dialog is to use the gtk.types.DialogFlags.Modal flag, which will call gtk.window.Window.setModal internally. The dialog will prevent interaction with the parent window until it's hidden or destroyed. You can use the gtk.dialog.Dialog.response signal to know when the user dismissed the dialog.
An example for using a modal dialog:
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL;
dialog = gtk_message_dialog_new (parent_window,
flags,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Error reading “%s”: %s",
filename,
g_strerror (errno));
// Destroy the dialog when the user responds to it
// (e.g. clicks a button)
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy),
NULL);You might do a non-modal gtk.message_dialog.MessageDialog simply by omitting the gtk.types.DialogFlags.Modal flag:
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
dialog = gtk_message_dialog_new (parent_window,
flags,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Error reading “%s”: %s",
filename,
g_strerror (errno));
// Destroy the dialog when the user responds to it
// (e.g. clicks a button)
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy),
NULL);GtkMessageDialog as GtkBuildable
The gtk.message_dialog.MessageDialog implementation of the gtk.buildable.Buildable interface exposes the message area as an internal child with the name “message_area”.
Deprecated
MessageDialogGidBuilder builder() static nothrowGet builder for [gtk.message_dialog.MessageDialog] Returns: New builder objectgtk.widget.Widget messageArea() @property nothrowGet `messageArea` property. Returns: The [gtk.box.Box] that corresponds to the message area of this dialog.gtk.types.MessageType messageType() @property nothrowGet `messageType` property. Returns: The type of the message.void messageType(gtk.types.MessageType propval) @property nothrowSet `messageType` property. Params: propval = The type of the message.string secondaryText() @property nothrowGet `secondaryText` property. Returns: The secondary text of the message dialog.void secondaryText(string propval) @property nothrowSet `secondaryText` property. Params: propval = The secondary text of the message dialog.bool secondaryUseMarkup() @property nothrowGet `secondaryUseMarkup` property. Returns: true if the secondary text of the dialog includes Pango markup.void secondaryUseMarkup(bool propval) @property nothrowSet `secondaryUseMarkup` property. Params: propval = true if the secondary text of the dialog includes Pango markup.string text() @property nothrowGet `text` property. Returns: The primary text of the message dialog.void text(string propval) @property nothrowSet `text` property. Params: propval = The primary text of the message dialog.bool useMarkup() @property nothrowGet `useMarkup` property. Returns: true if the primary text of the dialog includes Pango markup.void useMarkup(bool propval) @property nothrowSet `useMarkup` property. Params: propval = true if the primary text of the dialog includes Pango markup.Fluent builder implementation template for gtk.message_dialog.MessageDialog
T buttons(gtk.types.ButtonsType propval) nothrowT messageType(gtk.types.MessageType propval) nothrowSet `messageType` property. Params: propval = The type of the message. Returns: Builder instance for fluent chainingT secondaryText(string propval) nothrowSet `secondaryText` property. Params: propval = The secondary text of the message dialog. Returns: Builder instance for fluent chainingT secondaryUseMarkup(bool propval) nothrowSet `secondaryUseMarkup` property. Params: propval = true if the secondary text of the dialog includes Pango markup.T text(string propval) nothrowSet `text` property. Params: propval = The primary text of the message dialog.T useMarkup(bool propval) nothrowSet `useMarkup` property. Params: propval = true if the primary text of the dialog includes Pango markup.Fluent builder for gtk.message_dialog.MessageDialog