Class: Alexandria::UI::NewBookDialogManual
- Inherits:
-
BookPropertiesDialogBase
- Object
- BuilderBase
- BookPropertiesDialogBase
- Alexandria::UI::NewBookDialogManual
- Extended by:
- GetText
- Includes:
- GetText
- Defined in:
- lib/alexandria/ui/dialogs/new_book_dialog_manual.rb
Defined Under Namespace
Classes: AddError
Constant Summary collapse
- TMP_COVER_FILE =
File.join(Dir.tmpdir, 'tmp_cover')
Constants inherited from BookPropertiesDialogBase
BookPropertiesDialogBase::COVER_ABSOLUTE_MAXHEIGHT, BookPropertiesDialogBase::COVER_MAXWIDTH
Instance Method Summary collapse
-
#initialize(parent, library, &on_add_cb) ⇒ NewBookDialogManual
constructor
A new instance of NewBookDialogManual.
- #on_title_changed ⇒ Object
Methods inherited from BookPropertiesDialogBase
#clear_date_entry, #display_calendar_popup, #get_entry_popup_coords, #hide_calendar_popup, #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_calendar_widgets, #want_toggled, #widget_names
Constructor Details
#initialize(parent, library, &on_add_cb) ⇒ NewBookDialogManual
Returns a new instance of NewBookDialogManual.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/alexandria/ui/dialogs/new_book_dialog_manual.rb', line 29 def initialize(parent, library, &on_add_cb) super(parent, TMP_COVER_FILE) @library = library @on_add_cb = on_add_cb FileUtils.rm_f(TMP_COVER_FILE) = Gtk::Button.new(Gtk::Stock::CANCEL) .signal_connect('clicked') { on_cancel } .show @button_box << = Gtk::Button.new(Gtk::Stock::ADD) .signal_connect('clicked') { on_add } .show @button_box << = Gtk::Button.new(Gtk::Stock::HELP) .signal_connect('clicked') { on_help } .show @button_box << @button_box.set_child_secondary(, true) self. = Book::DEFAULT_RATING self.cover = Icons::BOOK_ICON on_title_changed end |
Instance Method Details
#on_title_changed ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/alexandria/ui/dialogs/new_book_dialog_manual.rb', line 58 def on_title_changed title = @entry_title.text.strip begin @book_properties_dialog.title = if title.empty? _('Adding a Book') else _("Adding '%s'") % title end rescue raise "There's a problem with a book somewhere" end end |