Constructor

GtkDialognew_with_buttons

deprecated: 4.10 

Declaration [src]

GtkWidget*
gtk_dialog_new_with_buttons (
  const char* title,
  GtkWindow* parent,
  GtkDialogFlags flags,
  const char* first_button_text,
  ...
)

Description [src]

Creates a new GtkDialog with the given title and transient parent.

The flags argument can be used to make the dialog modal, have it destroyed along with its transient parent, or make it use a headerbar.

Button text/response ID pairs should be listed in pairs, with a NULL pointer ending the list. Button text can be arbitrary text. A response ID can be any positive number, or one of the values in the GtkResponseType enumeration. If the user clicks one of these buttons, GtkDialog will emit the GtkDialog::response signal with the corresponding response ID.

If a GtkDialog receives a delete event, it will emit ::response with a response ID of GTK_RESPONSE_DELETE_EVENT.

However, destroying a dialog does not emit the ::response signal; so be careful relying on ::response when using the GTK_DIALOG_DESTROY_WITH_PARENT flag.

Here’s a simple example:

GtkWindow *main_app_window; // Window the dialog should show up on
GtkWidget *dialog;
GtkDialogFlags flags = GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT;
dialog = gtk_dialog_new_with_buttons ("My dialog",
                                      main_app_window,
                                      flags,
                                      _("_OK"),
                                      GTK_RESPONSE_ACCEPT,
                                      _("_Cancel"),
                                      GTK_RESPONSE_REJECT,
                                      NULL);

Deprecated since: 4.10

Use GtkWindow instead.

This constructor is not directly available to language bindings.

Parameters

title

Type: const char*

Title of the dialog.

The argument can be NULL.
The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.
parent

Type: GtkWindow

Transient parent of the dialog.

The argument can be NULL.
The data is owned by the caller of the function.
flags

Type: GtkDialogFlags

From GtkDialogFlags.

first_button_text

Type: const char*

Text to go in first button.

The argument can be NULL.
The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.
...

Type: 

Response ID for first button, then additional buttons, ending with NULL.

Return value

Type: GtkWidget

A new GtkDialog.

The data is owned by the called function.