Class: Gtk::AlertDialog

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Constructor Details

#initialize(format, array) ⇒ Gtk::AlertDialog

Creates a new GtkAlertDialog object.

The message will be set to the formatted string resulting from the arguments.

Parameters:

  • format (String)

    printf()-style format string

  • array (Array)

    arguments for format

Instance Method Details

#buttonsGtk::

Labels for buttons to show in the alert.

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

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

Returns:

#buttons=(buttons) ⇒ Gtk::

Labels for buttons to show in the alert.

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

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

Parameters:

Returns:

#cancel_buttonInteger

This property determines what happens when the Escape key is pressed while the alert is shown.

If this property holds the index of a button in [propertyGtk.AlertDialog: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.

Returns:

  • (Integer)

    cancel-button

#cancel_button=(cancel_button) ⇒ Integer

This property determines what happens when the Escape key is pressed while the alert is shown.

If this property holds the index of a button in [propertyGtk.AlertDialog: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.

Parameters:

  • cancel_button (Integer)

Returns:

  • (Integer)

    cancel-button

  • (Integer)

    cancel-button

#choose(parent, cancellable, callback, user_data) ⇒ nil

This function shows the alert to the user.

The callback will be called when the alert is dismissed. It should call [methodGtk.AlertDialog.choose_finish] to obtain the result.

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 [methodGtk.AlertDialog.show].

Parameters:

  • parent (Gtk::Window)

    the parent GtkWindow

  • cancellable (Gio::Cancellable)

    a GCancellable to cancel the operation

  • callback (Gio::AsyncReadyCallback)

    a callback to call when the operation is complete

  • user_data (GObject)

    data to pass to callback

Returns:

  • (nil)

#choose_finish(result) ⇒ Integer

Finishes the [methodGtk.AlertDialog.choose] call and returns the index of the button that was clicked.

Parameters:

  • result (Gio::AsyncResult)

    a GAsyncResult

Returns:

  • (Integer)

    the index of the button that was clicked, or -1 if the dialog was cancelled and [propertyGtk.AlertDialog:cancel-button] is not set

#default_buttonInteger

This property determines what happens when the Return key is pressed while the alert is shown.

If this property holds the index of a button in [propertyGtk.AlertDialog: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.

Returns:

  • (Integer)

    default-button

#default_button=(default_button) ⇒ Integer

This property determines what happens when the Return key is pressed while the alert is shown.

If this property holds the index of a button in [propertyGtk.AlertDialog: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.

Parameters:

  • default_button (Integer)

Returns:

  • (Integer)

    default-button

  • (Integer)

    default-button

#detailString

The detail text for the alert.

Returns:

  • (String)

    detail

#detail=(detail) ⇒ String

The detail text for the alert.

Parameters:

  • detail (String)

Returns:

  • (String)

    detail

  • (String)

    detail

#messageString

The message for the alert.

Returns:

  • (String)

    message

#message=(message) ⇒ String

The message for the alert.

Parameters:

  • message (String)

Returns:

  • (String)

    message

  • (String)

    message

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

Returns:

  • (Boolean)

    TRUE if the alert is modal

#modal=(modal) ⇒ Boolean

Whether the alert is modal.

Parameters:

  • modal (Boolean)

Returns:

  • (Boolean)

    modal

  • (Boolean)

    modal

#modal?Boolean

Whether the alert is modal.

Returns:

  • (Boolean)

    modal

#show(parent) ⇒ nil

Show the alert to the user.

This function is a simple version of [methodGtk.AlertDialog.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 or callback respectively.

Parameters:

Returns:

  • (nil)