+ return widget;
+}
+
+/**
+ * gtk_message_dialog_new_with_markup:
+ * @parent: (allow-none): transient parent, or %NULL for none
+ * @flags: flags
+ * @type: type of message
+ * @buttons: set of buttons to use
+ * @message_format: (allow-none): printf()-style format string, or %NULL
+ * @...: arguments for @message_format
+ *
+ * Creates a new message dialog, which is a simple dialog with an icon
+ * indicating the dialog type (error, warning, etc.) and some text which
+ * is marked up with the <link linkend="PangoMarkupFormat">Pango text markup language</link>.
+ * When the user clicks a button a "response" signal is emitted with
+ * response IDs from #GtkResponseType. See #GtkDialog for more details.
+ *
+ * Special XML characters in the printf() arguments passed to this
+ * function will automatically be escaped as necessary.
+ * (See g_markup_printf_escaped() for how this is implemented.)
+ * Usually this is what you want, but if you have an existing
+ * Pango markup string that you want to use literally as the
+ * label, then you need to use gtk_message_dialog_set_markup()
+ * instead, since you can't pass the markup string either
+ * as the format (it might contain '%' characters) or as a string
+ * argument.
+ * |[
+ * GtkWidget *dialog;
+ * dialog = gtk_message_dialog_new (main_application_window,
+ * GTK_DIALOG_DESTROY_WITH_PARENT,
+ * GTK_MESSAGE_ERROR,
+ * GTK_BUTTONS_CLOSE,
+ * NULL);
+ * gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog),
+ * markup);
+ * ]|
+ *
+ * Return value: a new #GtkMessageDialog
+ *
+ * Since: 2.4
+ **/
+GtkWidget*
+gtk_message_dialog_new_with_markup (GtkWindow *parent,
+ GtkDialogFlags flags,
+ GtkMessageType type,
+ GtkButtonsType buttons,
+ const gchar *message_format,
+ ...)
+{
+ GtkWidget *widget;
+ va_list args;
+ gchar *msg = NULL;
+
+ g_return_val_if_fail (parent == NULL || GTK_IS_WINDOW (parent), NULL);
+
+ widget = gtk_message_dialog_new (parent, flags, type, buttons, NULL);
+
+ if (message_format)
+ {
+ va_start (args, message_format);
+ msg = g_markup_vprintf_escaped (message_format, args);
+ va_end (args);
+
+ gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (widget), msg);
+
+ g_free (msg);
+ }
+
+ return widget;
+}
+
+/**
+ * gtk_message_dialog_set_image:
+ * @dialog: a #GtkMessageDialog
+ * @image: the image
+ *
+ * Sets the dialog's image to @image.
+ *
+ * Since: 2.10
+ **/
+void
+gtk_message_dialog_set_image (GtkMessageDialog *dialog,
+ GtkWidget *image)
+{
+ GtkMessageDialogPrivate *priv;
+ GtkWidget *parent;
+
+ g_return_if_fail (GTK_IS_MESSAGE_DIALOG (dialog));
+ g_return_if_fail (image == NULL || GTK_IS_WIDGET (image));
+
+ priv = dialog->priv;
+
+ if (image == NULL)
+ {
+ image = gtk_image_new_from_stock (NULL, GTK_ICON_SIZE_DIALOG);
+ gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
+ gtk_widget_set_valign (image, GTK_ALIGN_START);
+ }
+
+ priv->message_type = GTK_MESSAGE_OTHER;
+
+ parent = gtk_widget_get_parent (priv->image);
+ gtk_container_add (GTK_CONTAINER (parent), image);
+ gtk_container_remove (GTK_CONTAINER (parent), priv->image);
+ gtk_box_reorder_child (GTK_BOX (parent), image, 0);
+
+ priv->image = image;
+
+ g_object_notify (G_OBJECT (dialog), "image");
+}
+
+/**
+ * gtk_message_dialog_get_image:
+ * @dialog: a #GtkMessageDialog
+ *
+ * Gets the dialog's image.
+ *
+ * Return value: (transfer none): the dialog's image
+ *
+ * Since: 2.14
+ **/
+GtkWidget *
+gtk_message_dialog_get_image (GtkMessageDialog *dialog)
+{
+ g_return_val_if_fail (GTK_IS_MESSAGE_DIALOG (dialog), NULL);
+
+ return dialog->priv->image;
+}
+
+/**
+ * gtk_message_dialog_set_markup:
+ * @message_dialog: a #GtkMessageDialog
+ * @str: markup string (see <link linkend="PangoMarkupFormat">Pango markup format</link>)
+ *
+ * Sets the text of the message dialog to be @str, which is marked
+ * up with the <link linkend="PangoMarkupFormat">Pango text markup
+ * language</link>.
+ *
+ * Since: 2.4
+ **/
+void
+gtk_message_dialog_set_markup (GtkMessageDialog *message_dialog,
+ const gchar *str)
+{
+ GtkMessageDialogPrivate *priv;
+
+ g_return_if_fail (GTK_IS_MESSAGE_DIALOG (message_dialog));
+
+ priv = message_dialog->priv;
+
+ priv->has_primary_markup = TRUE;
+ gtk_label_set_markup (GTK_LABEL (priv->label), str);
+}
+
+/**
+ * gtk_message_dialog_format_secondary_text:
+ * @message_dialog: a #GtkMessageDialog
+ * @message_format: (allow-none): printf()-style format string, or %NULL
+ * @...: arguments for @message_format
+ *
+ * Sets the secondary text of the message dialog to be @message_format
+ * (with printf()-style).
+ *
+ * Since: 2.6
+ */
+void
+gtk_message_dialog_format_secondary_text (GtkMessageDialog *message_dialog,
+ const gchar *message_format,
+ ...)
+{
+ va_list args;
+ gchar *msg = NULL;
+ GtkMessageDialogPrivate *priv;
+
+ g_return_if_fail (GTK_IS_MESSAGE_DIALOG (message_dialog));
+
+ priv = message_dialog->priv;
+
+ if (message_format)
+ {
+ priv->has_secondary_text = TRUE;
+
+ va_start (args, message_format);
+ msg = g_strdup_vprintf (message_format, args);
+ va_end (args);
+
+ gtk_widget_show (priv->secondary_label);
+ gtk_label_set_text (GTK_LABEL (priv->secondary_label), msg);
+
+ g_free (msg);
+ }
+ else
+ {
+ priv->has_secondary_text = FALSE;
+ gtk_widget_hide (priv->secondary_label);
+ }
+
+ setup_primary_label_font (message_dialog);
+}
+
+/**
+ * gtk_message_dialog_format_secondary_markup:
+ * @message_dialog: a #GtkMessageDialog
+ * @message_format: printf()-style markup string (see
+ <link linkend="PangoMarkupFormat">Pango markup format</link>), or %NULL
+ * @...: arguments for @message_format
+ *
+ * Sets the secondary text of the message dialog to be @message_format (with
+ * printf()-style), which is marked up with the
+ * <link linkend="PangoMarkupFormat">Pango text markup language</link>.
+ *
+ * Due to an oversight, this function does not escape special XML characters
+ * like gtk_message_dialog_new_with_markup() does. Thus, if the arguments
+ * may contain special XML characters, you should use g_markup_printf_escaped()
+ * to escape it.
+
+ * <informalexample><programlisting>
+ * gchar *msg;
+ *
+ * msg = g_markup_printf_escaped (message_format, ...);
+ * gtk_message_dialog_format_secondary_markup (message_dialog, "%s", msg);
+ * g_free (msg);
+ * </programlisting></informalexample>
+ *
+ * Since: 2.6
+ */
+void
+gtk_message_dialog_format_secondary_markup (GtkMessageDialog *message_dialog,
+ const gchar *message_format,
+ ...)
+{
+ va_list args;
+ gchar *msg = NULL;
+ GtkMessageDialogPrivate *priv;
+
+ g_return_if_fail (GTK_IS_MESSAGE_DIALOG (message_dialog));
+
+ priv = message_dialog->priv;
+
+ if (message_format)
+ {
+ priv->has_secondary_text = TRUE;
+
+ va_start (args, message_format);
+ msg = g_strdup_vprintf (message_format, args);
+ va_end (args);
+
+ gtk_widget_show (priv->secondary_label);
+ gtk_label_set_markup (GTK_LABEL (priv->secondary_label), msg);
+
+ g_free (msg);
+ }
+ else
+ {
+ priv->has_secondary_text = FALSE;
+ gtk_widget_hide (priv->secondary_label);
+ }
+
+ setup_primary_label_font (message_dialog);
+}
+
+/**
+ * gtk_message_dialog_get_message_area:
+ * @message_dialog: a #GtkMessageDialog
+ *
+ * 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,
+ * on the right side of the dialog's image (or on the left for right-to-left
+ * languages). See gtk_dialog_get_content_area() for the corresponding
+ * function in the parent #GtkDialog.
+ *
+ * Return value: (transfer none): A #GtkVBox corresponding to the
+ * "message area" in the @message_dialog.
+ *
+ * Since: 2.22
+ **/
+GtkWidget *
+gtk_message_dialog_get_message_area (GtkMessageDialog *message_dialog)
+{
+ g_return_val_if_fail (GTK_IS_MESSAGE_DIALOG (message_dialog), NULL);
+
+ return message_dialog->priv->message_area;
+}
+
+static void
+gtk_message_dialog_add_buttons (GtkMessageDialog* message_dialog,
+ GtkButtonsType buttons)
+{
+ GtkDialog* dialog = GTK_DIALOG (message_dialog);
+