Class: Alexandria::UI::ConflictWhileCopyingDialog

Inherits:
AlertDialog
  • Object
show all
Includes:
GetText
Defined in:
lib/alexandria/ui/conflict_while_copying_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, library, book) ⇒ ConflictWhileCopyingDialog

Returns a new instance of ConflictWhileCopyingDialog.



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

def initialize(parent, library, book)
  super(parent,
        format(_("The book '%s' already exists in '%s'. Would you like " \
                 "to replace it?"), book.title, library.name),
        Gtk::Stock::DIALOG_QUESTION,
        [[_("_Skip"), Gtk::ResponseType::CANCEL],
         [_("_Replace"), Gtk::ResponseType::OK]],
        _("If you replace the existing book, its contents will " \
          "be overwritten."))
  dialog.default_response = Gtk::ResponseType::CANCEL
end

Instance Method Details

#replace?Boolean

Returns:

  • (Boolean)


27
28
29
30
31
# File 'lib/alexandria/ui/conflict_while_copying_dialog.rb', line 27

def replace?
  show_all && (@response = run)
  destroy
  @response == Gtk::ResponseType::OK
end