Sha256: 433575df0304d9fda1c4cb6f18d83862c7a4807a957004299c78143215a1541c

Contents?: true

Size: 1.05 KB

Versions: 5

Compression:

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

      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

      def keep?
        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/keep_bad_isbn_dialog.rb
alexandria-book-collection-manager-0.7.9 lib/alexandria/ui/keep_bad_isbn_dialog.rb
alexandria-book-collection-manager-0.7.8 lib/alexandria/ui/keep_bad_isbn_dialog.rb
alexandria-book-collection-manager-0.7.7 lib/alexandria/ui/keep_bad_isbn_dialog.rb
alexandria-book-collection-manager-0.7.6 lib/alexandria/ui/keep_bad_isbn_dialog.rb