Class

GtkMessageDialog

[]

Description [src]

class Gtk.MessageDialog : Gtk.Dialog
  implements Atk.ImplementorIface, Gtk.Buildable {
  /* No available fields */
}

GtkMessageDialog presents a dialog with 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.

One difference from GtkDialog is that GtkMessageDialog sets the GtkWindow:skip-taskbar-hint property to TRUE, so that the dialog is hidden from the taskbar by default.

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.

An example for using a modal dialog:

 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));
 gtk_dialog_run (GTK_DIALOG (dialog));
 gtk_widget_destroy (dialog);

You might do a non-modal GtkMessageDialog as follows:

An example for a non-modal dialog:

 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_swapped (dialog, "response",
                           G_CALLBACK (gtk_widget_destroy),
                           dialog);

GtkMessageDialog as GtkBuildable

The GtkMessageDialog implementation of the GtkBuildable interface exposes the message area as an internal child with the name “message_area”.

[]

Hierarchy

hierarchy this GtkMessageDialog implements_0 AtkImplementorIface this--implements_0 implements_1 GtkBuildable this--implements_1 ancestor_0 GtkDialog ancestor_0--this ancestor_1 GtkWindow ancestor_1--ancestor_0 ancestor_2 GtkBin ancestor_2--ancestor_1 ancestor_3 GtkContainer ancestor_3--ancestor_2 ancestor_4 GtkWidget ancestor_4--ancestor_3 ancestor_5 GInitiallyUnowned ancestor_5--ancestor_4 ancestor_6 GObject ancestor_6--ancestor_5
[]

Constructors

gtk_message_dialog_new

Creates a new message dialog, which is a simple dialog with some text the user may want to see. When the user clicks a button a “response” signal is emitted with response IDs from GtkResponseType. See GtkDialog for more details.

gtk_message_dialog_new_with_markup

Creates a new message dialog, which is a simple dialog with some text that is marked up with the [Pango text markup language][PangoMarkupFormat]. When the user clicks a button a “response” signal is emitted with response IDs from GtkResponseType. See GtkDialog for more details.

since: 2.4

[]

Instance methods

gtk_message_dialog_format_secondary_markup

Sets the secondary text of the message dialog to be message_format (with printf()-style), which is marked up with the [Pango text markup language][PangoMarkupFormat].

since: 2.6

gtk_message_dialog_format_secondary_text

Sets the secondary text of the message dialog to be message_format (with printf()-style).

since: 2.6

gtk_message_dialog_get_image

Gets the dialog’s image.

deprecated: 3.12 since: 2.14

gtk_message_dialog_get_message_area

Returns the message area of the dialog. This is the box where the dialog’s primary and secondary labels are packed. You can add your own extra content to that box and it will appear below those labels. See gtk_dialog_get_content_area() for the corresponding function in the parent GtkDialog.

since: 2.22

gtk_message_dialog_set_image

Sets the dialog’s image to image.

deprecated: 3.12 since: 2.10

gtk_message_dialog_set_markup

Sets the text of the message dialog to be str, which is marked up with the [Pango text markup language][PangoMarkupFormat].

since: 2.4

Methods inherited from GtkDialog (14)
Methods inherited from GtkWindow (109)
Methods inherited from GtkBin (1)
Methods inherited from GtkContainer (33)
Methods inherited from GtkWidget (263)
Methods inherited from GObject (43)
Methods inherited from GtkBuildable (10)
[]

Properties

Gtk.MessageDialog:buttons
No description available.

Gtk.MessageDialog:image

The image for this dialog.

deprecated: 3.12 since: 2.10

Gtk.MessageDialog:message-area

The GtkBox that corresponds to the message area of this dialog. See gtk_message_dialog_get_message_area() for a detailed description of this area.

since: 2.22

Gtk.MessageDialog:message-type

The type of the message.

Gtk.MessageDialog:secondary-text

The secondary text of the message dialog.

since: 2.10

Gtk.MessageDialog:secondary-use-markup

TRUE if the secondary text of the dialog includes Pango markup. See pango_parse_markup().

since: 2.10

Gtk.MessageDialog:text

The primary text of the message dialog. If the dialog has a secondary text, this will appear as the title.

since: 2.10

Gtk.MessageDialog:use-markup

TRUE if the primary text of the dialog includes Pango markup. See pango_parse_markup().

since: 2.10

Properties inherited from GtkDialog (1)
Properties inherited from GtkWindow (33)
Properties inherited from GtkContainer (3)
Properties inherited from GtkWidget (39)
[]

Signals

Signals inherited from GtkDialog (2)
Signals inherited from GtkWindow (5)
Signals inherited from GtkContainer (4)
Signals inherited from GtkWidget (69)
Signals inherited from GObject (1)

Class structure