Top |
|
_init () |
|
destroy () |
|
setButtons () |
|
open () |
|
close () |
|
popModal () |
|
pushModal () |
|
_fadeOutDialog () |
The ModalDialog
object is a generic popup dialog in Cinnamon. It can either be created directly and then manipulated afterwards, or used as a base class for more sophisticated modal dialog.
For simple usage such as displaying a message, or asking for confirmation, the ConfirmDialog
and NotifyDialog
classes may be used instead.
setButtons (array buttons
);
This sets the buttons in the modal dialog. The buttons is an array of JSON objects, each of which corresponds to one button.
Each JSON object must contain label
and action
, which are the text displayed on the button and the callback function to use when the button is clicked respectively.
Optional arguments include focused
, which determines whether the button is initially focused, and key
, which is a keybinding associated with the button press such that pressing the keybinding will have the same effect as clicking the button.
An example usage is
1 2 3 4 5 6 7 8 9 10 11 12 |
dialog.setButtons([ { label: _("Cancel"), action: Lang.bind(this, this.callback), key: Clutter.KEY_Escape }, { label: _("OK"), action: Lang.bind(this, this.destroy), key: Clutter.KEY_Return } ]); |
popModal (int timestamp
);
Drop modal status without closing the dialog; this makes the dialog insensitive as well, so it needs to be followed shortly by either a close()
or a pushModal()
pushModal (int timestamp
);
Pushes the modal to the modal stack so that it grabs the required inputs.
_fadeOutDialog (int timestamp
);
This method is like close()
, but fades the dialog out much slower, and leaves the lightbox in place. Once in the faded out state, the dialog can be brought back by an open call, or the lightbox can be dismissed by a close call.
The main point of this method is to give some indication to the user that the dialog response has been acknowledged but will take a few moments before being processed.
e.g., if a user clicked "Log Out" then the dialog should go away immediately, but the lightbox should remain until the logout is complete.