Class: Alexandria::UI::BadIsbnsDialog

Inherits:
Gtk::MessageDialog
  • Object
show all
Defined in:
lib/alexandria/ui/dialogs/bad_isbns_dialog.rb

Overview

Generalized Dialog for lists of bad isbns. Used for on_import. Can also be used for on_load library conversions.

Instance Method Summary collapse

Constructor Details

#initialize(parent, message = nil, list = nil) ⇒ BadIsbnsDialog

Returns a new instance of BadIsbnsDialog.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/alexandria/ui/dialogs/bad_isbns_dialog.rb', line 25

def initialize(parent, message = nil, list = nil)
  message ||= _("There's a problem")

  super(parent,
        Gtk::Dialog::MODAL,
        Gtk::MessageDialog::WARNING,
        Gtk::MessageDialog::BUTTONS_CLOSE,
        message)

  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