1.7 <GtkAlertDialog>

Class: <GtkAlertDialog>

It derives from <GObject>.

Collects the arguments that are needed to present a message to the user.

The message is shown with the alert-dialog:choose function.

If you don’t need to wait for a button to be clicked, you can use alert-dialog:show.

Properties

Property: alert-dialog:buttons self

Labels for buttons to show in the alert.

The labels should be translated and may contain a _ character to indicate the mnemonic character.

If this property is not set, then a ’Close’ button is automatically created.

Its value is a vector, each a string (or, to set it, a list), or #f.

Set it with (set! (alert-dialog:buttons self) value).

Property: alert-dialog:cancel-button self

Determines what happens when the Escape key is pressed while the alert is shown.

If this property holds the index of a button in alert-dialog:buttons, then pressing Escape is treated as if that button was pressed. If it is -1 or not a valid index for the buttons array, then an error is returned.

If buttons is NULL, then the automatically created ’Close’ button is treated as both cancel and default button, so 0 is returned.

Its value is a 32-bit integer.

Set it with (set! (alert-dialog:cancel-button self) value).

Property: alert-dialog:default-button self

Determines what happens when the Return key is pressed while the alert is shown.

If this property holds the index of a button in alert-dialog:buttons, then pressing Return is treated as if that button was pressed. If it is -1 or not a valid index for the buttons array, then nothing happens.

If buttons is NULL, then the automatically created ’Close’ button is treated as both cancel and default button, so 0 is returned.

Its value is a 32-bit integer.

Set it with (set! (alert-dialog:default-button self) value).

Property: alert-dialog:detail self

The detail text for the alert.

Its value is a string, or #f.

Set it with (set! (alert-dialog:detail self) value).

Property: alert-dialog:message self

The message for the alert.

Its value is a string, or #f.

Set it with (set! (alert-dialog:message self) value).

Property: alert-dialog:modal self

Whether the alert is modal.

Its value is a boolean.

Set it with (set! (alert-dialog:modal self) value).

Procedures

Method: alert-dialog:choose self [parent] [cancellable] [callback]
Method: choose self [parent] [cancellable] [callback]

Shows the alert to the user.

It is ok to pass NULL for the callback if the alert does not have more than one button. A simpler API for this case is alert-dialog:show.

self

Passed: a <GtkAlertDialog>.

an alert dialog

parent

Passed, or left out: a <GtkWindow>, or #f.

the parent window

cancellable

Passed, or left out: a <GCancellable>, or #f.

a cancellable to cancel the operation

callback

Passed, or left out: a procedure, or #f.

a callback to call when the operation is complete

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

data to pass to callback

Method: alert-dialog:choose-finish self result ⇒ %return
Method: choose-finish self result ⇒ %return

Finishes the alert-dialog:choose call.

self

Passed: a <GtkAlertDialog>.

an alert dialog

result

Passed: a <GAsyncResult>.

the result

%return

Returned: a 32-bit integer.

the index of the button that was clicked, or -1 if the dialog was cancelled and alert-dialog:cancel-button is not set

Method: alert-dialog:get-buttons self ⇒ %return
Method: get-buttons self ⇒ %return

Returns the button labels for the alert.

self

Passed: a <GtkAlertDialog>.

an alert dialog

%return

Returned: a vector, each a string, or #f.

the button labels

Method: alert-dialog:get-cancel-button self ⇒ %return
Method: get-cancel-button self ⇒ %return

Returns the index of the cancel button.

self

Passed: a <GtkAlertDialog>.

an alert dialog

%return

Returned: a 32-bit integer.

the index of the cancel button, or -1

Method: alert-dialog:get-default-button self ⇒ %return
Method: get-default-button self ⇒ %return

Returns the index of the default button.

self

Passed: a <GtkAlertDialog>.

an alert dialog

%return

Returned: a 32-bit integer.

the index of the default button, or -1

Method: alert-dialog:get-detail self ⇒ %return
Method: get-detail self ⇒ %return

Returns the detail text that will be shown in the alert.

self

Passed: a <GtkAlertDialog>.

an alert dialog

%return

Returned: a string.

the detail text

Method: alert-dialog:get-message self ⇒ %return
Method: get-message self ⇒ %return

Returns the message that will be shown in the alert.

self

Passed: a <GtkAlertDialog>.

an alert dialog

%return

Returned: a string.

the message

Method: alert-dialog:get-modal? self ⇒ %return
Method: get-modal? self ⇒ %return

Returns whether the alert blocks interaction with the parent window while it is presented.

self

Passed: a <GtkAlertDialog>.

an alert dialog

%return

Returned: a boolean.

true if the alert is modal

Method: alert-dialog:set-buttons self labels
Method: set-buttons self labels

Sets the button labels for the alert.

self

Passed: a <GtkAlertDialog>.

an alert dialog

labels

Passed: a list or vector, each a string.

the new button labels

Method: alert-dialog:set-cancel-button self button
Method: set-cancel-button self button

Sets the index of the cancel button.

See alert-dialog:cancel-button for details of how this value is used.

self

Passed: a <GtkAlertDialog>.

an alert dialog

button

Passed: a 32-bit integer.

the new cancel button

Method: alert-dialog:set-default-button self button
Method: set-default-button self button

Sets the index of the default button.

See alert-dialog:default-button for details of how this value is used.

self

Passed: a <GtkAlertDialog>.

an alert dialog

button

Passed: a 32-bit integer.

the new default button

Method: alert-dialog:set-detail self detail
Method: set-detail self detail

Sets the detail text that will be shown in the alert.

self

Passed: a <GtkAlertDialog>.

an alert dialog

detail

Passed: a string.

the new detail text

Method: alert-dialog:set-message self message
Method: set-message self message

Sets the message that will be shown in the alert.

self

Passed: a <GtkAlertDialog>.

an alert dialog

message

Passed: a string.

the new message

Method: alert-dialog:set-modal self modal
Method: set-modal self modal

Sets whether the alert blocks interaction with the parent window while it is presented.

self

Passed: a <GtkAlertDialog>.

an alert dialog

modal

Passed: a boolean.

the new value

Method: alert-dialog:show self [parent]
Method: show self [parent]

Shows the alert to the user.

This function is a simpler version of alert-dialog:choose intended for dialogs with a single button.

If you want to cancel the dialog or if the alert has more than one button, you should use that function instead and provide it with a <GCancellable> and callback respectively.

self

Passed: a <GtkAlertDialog>.

an alert dialog

parent

Passed, or left out: a <GtkWindow>, or #f.

the parent window