Class: Alexandria::UI::KeepBadISBNDialog

Inherits:
AlertDialog show all
Includes:
GetText
Defined in:
lib/alexandria/ui/keep_bad_isbn_dialog.rb

Instance Attribute Summary

Attributes inherited from AlertDialog

#dialog

Instance Method Summary collapse

Methods inherited from AlertDialog

#default_response=, #destroy, #run, #show_all

Constructor Details

#initialize(parent, book) ⇒ KeepBadISBNDialog

Returns a new instance of KeepBadISBNDialog.



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/alexandria/ui/keep_bad_isbn_dialog.rb', line 15

def initialize(parent, book)
  title = _("Invalid ISBN '%s'") % book.isbn
  message =
    _("The book titled '%s' has an invalid ISBN, but still " \
      "exists in the providers libraries. Do you want to " \
      "keep the book but change the ISBN or cancel the addition?") % book.title
  super(parent, title,
        Gtk::Stock::DIALOG_QUESTION,
        [[Gtk::Stock::CANCEL, Gtk::ResponseType::CANCEL],
         [_("_Keep"), Gtk::ResponseType::OK]], message)
  dialog.default_response = Gtk::ResponseType::OK
end

Instance Method Details

#keep?Boolean

Returns:

  • (Boolean)


28
29
30
31
32
33
# File 'lib/alexandria/ui/keep_bad_isbn_dialog.rb', line 28

def keep?
  show_all
  @response = run
  destroy
  @response == Gtk::ResponseType::OK
end