Class: Alexandria::UI::ReallyDeleteDialog
- Inherits:
-
AlertDialog
- Object
- AlertDialog
- Alexandria::UI::ReallyDeleteDialog
- Includes:
- GetText
- Defined in:
- lib/alexandria/ui/really_delete_dialog.rb
Instance Attribute Summary
Attributes inherited from AlertDialog
Instance Method Summary collapse
-
#initialize(parent, library, books = nil) ⇒ ReallyDeleteDialog
constructor
A new instance of ReallyDeleteDialog.
- #ok? ⇒ Boolean
Methods inherited from AlertDialog
#default_response=, #destroy, #run, #show_all
Constructor Details
#initialize(parent, library, books = nil) ⇒ ReallyDeleteDialog
Returns a new instance of ReallyDeleteDialog.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/alexandria/ui/really_delete_dialog.rb', line 16 def initialize(parent, library, books = nil) # Deleting a library. if books.nil? = _("Are you sure you want to delete '%s'?") % library.name description = if library.is_a?(SmartLibrary) || library.empty? nil else n_("If you continue, %d book will be deleted.", "If you continue, %d books will be deleted.", library.size) % library.size end # Deleting books. else = if books.length == 1 format(_("Are you sure you want to delete '%s' " \ "from '%s'?"), books.first.title, library.name) else _("Are you sure you want to delete the " \ "selected books from '%s'?") % library.name end description = nil end super(parent, , Gtk::Stock::DIALOG_QUESTION, [[Gtk::Stock::CANCEL, Gtk::ResponseType::CANCEL], [Gtk::Stock::DELETE, Gtk::ResponseType::OK]], description) dialog.default_response = Gtk::ResponseType::CANCEL end |
Instance Method Details
#ok? ⇒ Boolean
47 48 49 50 51 |
# File 'lib/alexandria/ui/really_delete_dialog.rb', line 47 def ok? show_all && (@response = run) destroy @response == Gtk::ResponseType::OK end |