Sha256: aa1d3aa5ce10a8c19e1bc7bfa815fafbb722cfd6705b7b57599c6e521be08f15

Contents?: true

Size: 958 Bytes

Versions: 5

Compression:

Stored size: 958 Bytes

Contents

# frozen_string_literal: true

# This file is part of Alexandria.
#
# See the file README.md for authorship and licensing information.

require "alexandria/ui/alert_dialog"

module Alexandria
  module UI
    class ConfirmEraseDialog < AlertDialog
      include GetText
      GetText.bindtextdomain(Alexandria::TEXTDOMAIN, charset: "UTF-8")

      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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
alexandria-book-collection-manager-0.7.10 lib/alexandria/ui/confirm_erase_dialog.rb
alexandria-book-collection-manager-0.7.9 lib/alexandria/ui/confirm_erase_dialog.rb
alexandria-book-collection-manager-0.7.8 lib/alexandria/ui/confirm_erase_dialog.rb
alexandria-book-collection-manager-0.7.7 lib/alexandria/ui/confirm_erase_dialog.rb
alexandria-book-collection-manager-0.7.6 lib/alexandria/ui/confirm_erase_dialog.rb