Sha256: 3e021b7519dc9e19f1fd191f4454bc352d894fac972f08cba6a59408f97ed58a

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true

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

module Alexandria
  module UI
    # Generalized Dialog for lists of bad isbns. Used for on_import. Can also
    # be used for on_load library conversions.
    class BadIsbnsDialog < SimpleDelegator
      def initialize(parent, message, list)
        dialog = Gtk::MessageDialog.new(parent: parent,
                                        flags: :modal,
                                        type: :warning,
                                        buttons: :close,
                                        message: message)
        super(dialog)

        isbn_container = Gtk::Box.new :horizontal
        the_vbox = children.first
        the_vbox.pack_start(isbn_container)
        the_vbox.reorder_child(isbn_container, 3)
        scrolley = Gtk::ScrolledWindow.new
        isbn_container.pack_start(scrolley)
        textview = Gtk::TextView.new(Gtk::TextBuffer.new)
        textview.editable = false
        textview.cursor_visible = false
        scrolley.add(textview)
        list.each do |li|
          textview.buffer.insert_at_cursor("#{li}\n")
        end
        show_all
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
alexandria-book-collection-manager-0.7.5 lib/alexandria/ui/bad_isbns_dialog.rb
alexandria-book-collection-manager-0.7.4 lib/alexandria/ui/bad_isbns_dialog.rb
alexandria-book-collection-manager-0.7.3 lib/alexandria/ui/dialogs/bad_isbns_dialog.rb