Sha256: 2a1e4000b3e151a463215d73fe0d33a5c6f34372d929b6385429a8c728933b8f

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

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 ConflictWhileCopyingDialog < AlertDialog
      include GetText
      GetText.bindtextdomain(Alexandria::TEXTDOMAIN, charset: "UTF-8")

      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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
alexandria-book-collection-manager-0.7.10 lib/alexandria/ui/conflict_while_copying_dialog.rb
alexandria-book-collection-manager-0.7.9 lib/alexandria/ui/conflict_while_copying_dialog.rb