Class: Alexandria::UI::ConfirmEraseDialog

Inherits:
AlertDialog
  • Object
show all
Includes:
GetText
Defined in:
lib/alexandria/ui/confirm_erase_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, filename) ⇒ ConfirmEraseDialog

Returns a new instance of ConfirmEraseDialog.



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

def initialize(parent, filename)
  super(parent, _("File already exists"),
        Gtk::Stock::DIALOG_QUESTION,
        [[Gtk::Stock::CANCEL, :cancel],
         [_("_Replace"), :ok]],
        _("A file named '%s' already exists.  Do you want " \
          "to replace it with the one you are generating?") % filename)
  # FIXME: Should accept just :cancel
  dialog.default_response = Gtk::ResponseType::CANCEL
end

Instance Method Details

#erase?Boolean

Returns:

  • (Boolean)


26
27
28
29
30
# File 'lib/alexandria/ui/confirm_erase_dialog.rb', line 26

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