Class: Alexandria::UI::NewBookDialogManual

Inherits:
BookPropertiesDialogBase show all
Extended by:
GetText
Includes:
GetText
Defined in:
lib/alexandria/ui/new_book_dialog_manual.rb

Defined Under Namespace

Classes: AddError

Constant Summary

Constants inherited from BookPropertiesDialogBase

BookPropertiesDialogBase::COVER_ABSOLUTE_MAXHEIGHT, BookPropertiesDialogBase::COVER_MAXWIDTH

Instance Method Summary collapse

Methods inherited from BookPropertiesDialogBase

#on_add_author, #on_change_cover, #on_destroy, #on_image_no_rating_press, #on_image_rating1_press, #on_image_rating2_press, #on_image_rating3_press, #on_image_rating4_press, #on_image_rating5_press, #on_loaned, #on_loaned_date_changed, #on_remove_author, #own_toggled, #redd_toggled, #setup_date_widgets, #show, #want_toggled, #widget_names

Methods included from Logging

included, #log

Methods included from CalendarPopup

#assign_selected_date, #clear_date_entry, #display_calendar_popup, #setup_calendar_widgets

Constructor Details

#initialize(parent, library, &on_add_cb) ⇒ NewBookDialogManual

Returns a new instance of NewBookDialogManual.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/alexandria/ui/new_book_dialog_manual.rb', line 18

def initialize(parent, library, &on_add_cb)
  tmp_cover_file = File.join(Dir.mktmpdir("cover"), "tmp_cover")
  super(parent, tmp_cover_file)

  @library = library
  @on_add_cb = on_add_cb
  FileUtils.rm_f(@cover_file)

  cancel_button = Gtk::Button.new(stock_id: Gtk::Stock::CANCEL)
  cancel_button.signal_connect("clicked") { on_cancel }
  cancel_button.show
  @button_box << cancel_button

  add_button = Gtk::Button.new(stock_id: Gtk::Stock::ADD)
  add_button.signal_connect("clicked") { on_add }
  add_button.show
  @button_box << add_button

  help_button = Gtk::Button.new(stock_id: Gtk::Stock::HELP)
  help_button.signal_connect("clicked") { on_help }
  help_button.show
  @button_box << help_button
  @button_box.set_child_secondary(help_button, true)

  self.rating = Book::DEFAULT_RATING
  self.cover = Icons::BOOK_ICON

  on_title_changed
end

Instance Method Details

#on_title_changedObject



48
49
50
51
52
53
54
55
# File 'lib/alexandria/ui/new_book_dialog_manual.rb', line 48

def on_title_changed
  title = @entry_title.text.strip
  @book_properties_dialog.title = if title.empty?
                                    _("Adding a Book")
                                  else
                                    _("Adding '%s'") % title
                                  end
end