Dialog.with_buttons


Description:

[ CCode ( has_construct_function = false , type = "GtkWidget*" ) ]
public Dialog.with_buttons (string? title, Window? parent, DialogFlags flags, ...)

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 [[email protected]] enumeration. If the user clicks one of these buttons, `GtkDialog` will emit the [[email protected]: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: ```c 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); ```

Parameters:

title

Title of the dialog

parent

Transient parent of the dialog

flags

from `GtkDialogFlags`

...

response ID for first button, then additional buttons, ending with null

first_button_text

text to go in first button

Returns:

a new `GtkDialog`




2022 vala-language.org