alexandria-book-collection-manager 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +0 -1
- data/.rubocop.yml +45 -27
- data/.rubocop_todo.yml +127 -86
- data/.simplecov +1 -0
- data/.yardopts +1 -1
- data/CHANGELOG.md +5 -0
- data/ChangeLog.0 +33 -35
- data/Gemfile +2 -2
- data/INSTALL.md +152 -0
- data/Rakefile +12 -10
- data/alexandria-book-collection-manager.gemspec +5 -5
- data/bin/alexandria +2 -1
- data/doc/AUTHORS +61 -0
- data/doc/BUGS +31 -0
- data/doc/FAQ +369 -0
- data/doc/HACKING +19 -0
- data/doc/NEWS +341 -0
- data/doc/alexandria.1 +120 -0
- data/doc/cuecat_support.rdoc +67 -0
- data/doc/dependency_decisions.yml +61 -0
- data/lib/alexandria.rb +2 -0
- data/lib/alexandria/about.rb +7 -6
- data/lib/alexandria/book_providers.rb +6 -6
- data/lib/alexandria/book_providers/adlibris.rb +9 -14
- data/lib/alexandria/book_providers/amazon_aws.rb +29 -33
- data/lib/alexandria/book_providers/amazon_ecs_util.rb +10 -14
- data/lib/alexandria/book_providers/barnes_and_noble.rb +9 -11
- data/lib/alexandria/book_providers/deastore.rb +12 -20
- data/lib/alexandria/book_providers/douban.rb +9 -15
- data/lib/alexandria/book_providers/mcu.rb +26 -13
- data/lib/alexandria/book_providers/proxis.rb +9 -15
- data/lib/alexandria/book_providers/pseudomarc.rb +15 -27
- data/lib/alexandria/book_providers/renaud.rb +18 -9
- data/lib/alexandria/book_providers/siciliano.rb +8 -9
- data/lib/alexandria/book_providers/thalia.rb +6 -6
- data/lib/alexandria/book_providers/web.rb +2 -0
- data/lib/alexandria/book_providers/worldcat.rb +6 -7
- data/lib/alexandria/book_providers/z3950.rb +19 -10
- data/lib/alexandria/config.rb +4 -2
- data/lib/alexandria/console.rb +2 -0
- data/lib/alexandria/execution_queue.rb +2 -2
- data/lib/alexandria/export_library.rb +14 -18
- data/lib/alexandria/import_library.rb +8 -16
- data/lib/alexandria/import_library_csv.rb +5 -52
- data/lib/alexandria/logging.rb +4 -6
- data/lib/alexandria/models/book.rb +2 -0
- data/lib/alexandria/models/library.rb +10 -20
- data/lib/alexandria/net.rb +2 -0
- data/lib/alexandria/preferences.rb +10 -14
- data/lib/alexandria/scanners.rb +2 -0
- data/lib/alexandria/scanners/cuecat.rb +4 -2
- data/lib/alexandria/scanners/keyboard.rb +2 -0
- data/lib/alexandria/smart_library.rb +4 -3
- data/lib/alexandria/ui.rb +2 -0
- data/lib/alexandria/ui/builder_base.rb +2 -0
- data/lib/alexandria/ui/callbacks.rb +8 -12
- data/lib/alexandria/ui/columns.rb +2 -0
- data/lib/alexandria/ui/completion_models.rb +2 -0
- data/lib/alexandria/ui/dialogs/about_dialog.rb +3 -1
- data/lib/alexandria/ui/dialogs/acquire_dialog.rb +11 -17
- data/lib/alexandria/ui/dialogs/alert_dialog.rb +2 -0
- data/lib/alexandria/ui/dialogs/bad_isbns_dialog.rb +10 -2
- data/lib/alexandria/ui/dialogs/barcode_animation.rb +2 -0
- data/lib/alexandria/ui/dialogs/book_properties_dialog.rb +5 -9
- data/lib/alexandria/ui/dialogs/book_properties_dialog_base.rb +3 -3
- data/lib/alexandria/ui/dialogs/export_dialog.rb +3 -3
- data/lib/alexandria/ui/dialogs/import_dialog.rb +2 -2
- data/lib/alexandria/ui/dialogs/misc_dialogs.rb +6 -4
- data/lib/alexandria/ui/dialogs/new_book_dialog.rb +22 -31
- data/lib/alexandria/ui/dialogs/new_book_dialog_manual.rb +3 -3
- data/lib/alexandria/ui/dialogs/new_smart_library_dialog.rb +3 -3
- data/lib/alexandria/ui/dialogs/preferences_dialog.rb +8 -18
- data/lib/alexandria/ui/dialogs/smart_library_properties_dialog.rb +2 -0
- data/lib/alexandria/ui/dialogs/smart_library_properties_dialog_base.rb +4 -6
- data/lib/alexandria/ui/dndable.rb +4 -2
- data/lib/alexandria/ui/icons.rb +3 -3
- data/lib/alexandria/ui/iconview.rb +3 -3
- data/lib/alexandria/ui/iconview_tooltips.rb +4 -6
- data/lib/alexandria/ui/init.rb +2 -0
- data/lib/alexandria/ui/libraries_combo.rb +2 -0
- data/lib/alexandria/ui/listview.rb +15 -12
- data/lib/alexandria/ui/main_app.rb +2 -0
- data/lib/alexandria/ui/multi_drag_treeview.rb +2 -0
- data/lib/alexandria/ui/sidepane.rb +8 -6
- data/lib/alexandria/ui/sound.rb +2 -0
- data/lib/alexandria/ui/ui_manager.rb +37 -43
- data/lib/alexandria/undo_manager.rb +2 -0
- data/lib/alexandria/version.rb +5 -3
- data/lib/alexandria/web_themes.rb +2 -0
- data/spec/alexandria/book_providers_spec.rb +12 -49
- data/spec/alexandria/book_spec.rb +4 -2
- data/spec/alexandria/library_spec.rb +2 -0
- data/spec/alexandria/preferences_spec.rb +2 -0
- data/spec/alexandria/scanners/cuecat_spec.rb +2 -0
- data/spec/alexandria/smart_library_spec.rb +3 -1
- data/spec/alexandria/ui/dialogs_spec.rb +2 -0
- data/spec/alexandria/ui/iconview_spec.rb +2 -0
- data/spec/alexandria/ui/main_app_spec.rb +2 -0
- data/spec/alexandria/ui/sidepane_spec.rb +2 -0
- data/spec/alexandria/ui/sound_spec.rb +2 -0
- data/spec/alexandria/ui/ui_manager_spec.rb +2 -0
- data/spec/alexandria/ui/ui_utilities_spec.rb +2 -0
- data/spec/alexandria/utilities_spec.rb +2 -0
- data/spec/spec_helper.rb +2 -0
- data/tasks/dogtail.rake +2 -0
- data/tasks/setup.rb +3 -1
- data/tasks/spec.rake +2 -0
- data/util/rake/fileinstall.rb +6 -12
- data/util/rake/gettextgenerate.rb +9 -64
- data/util/rake/omfgenerate.rb +3 -3
- metadata +21 -37
- data/INSTALL.rdoc +0 -148
- data/lib/alexandria/book_providers/bol_it.rb +0 -160
- data/lib/alexandria/book_providers/ibs_it.rb +0 -147
- data/lib/alexandria/book_providers/webster_it.rb +0 -167
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (C) 2004-2006 Laurent Sansonetti
|
2
4
|
# Copyright (C) 2011, 2016 Matijs van Zuijlen
|
3
5
|
#
|
@@ -143,9 +145,7 @@ module Alexandria
|
|
143
145
|
date_entry.primary_icon_name = Gtk::Stock::EDIT
|
144
146
|
date_entry.primary_icon_activatable = true
|
145
147
|
date_entry.signal_connect('icon-press') do |entry, primary, _icon|
|
146
|
-
if primary.nick == 'primary'
|
147
|
-
display_calendar_popup(entry)
|
148
|
-
end
|
148
|
+
display_calendar_popup(entry) if primary.nick == 'primary'
|
149
149
|
end
|
150
150
|
|
151
151
|
# Really hide the time part of the date entry, as the constructor
|
@@ -270,9 +270,7 @@ module Alexandria
|
|
270
270
|
state = boxes.length > 1
|
271
271
|
boxes.each do |box|
|
272
272
|
button = box.children[-1]
|
273
|
-
if button.is_a?(Gtk::Button)
|
274
|
-
button.sensitive = state
|
275
|
-
end
|
273
|
+
button.sensitive = state if button.is_a?(Gtk::Button)
|
276
274
|
end
|
277
275
|
end
|
278
276
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (C) 2004-2006 Laurent Sansonetti
|
2
4
|
# Copyright (C) 2008 Joseph Method
|
3
5
|
# Copyright (C) 2016 Matijs van Zuijlen
|
@@ -22,11 +24,11 @@ module Alexandria
|
|
22
24
|
BOOKS_TARGET_TABLE = [Gtk::TargetEntry.new('ALEXANDRIA_BOOKS', :same_app, 0)].freeze
|
23
25
|
|
24
26
|
module DragAndDropable
|
25
|
-
BADGE_MARKUP = '<span weight="heavy" foreground="white">%d</span>'
|
27
|
+
BADGE_MARKUP = '<span weight="heavy" foreground="white">%d</span>'
|
26
28
|
|
27
29
|
def setup_view_source_dnd(view)
|
28
30
|
# better be Loggable!
|
29
|
-
log.info { 'setup_view_source_dnd for %s'
|
31
|
+
log.info { format('setup_view_source_dnd for %s', view) }
|
30
32
|
view.signal_connect_after('drag-begin') do |_widget, drag_context|
|
31
33
|
n_books = @parent.selected_books.length
|
32
34
|
if n_books > 1
|
data/lib/alexandria/ui/icons.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (C) 2004-2006 Laurent Sansonetti
|
2
4
|
# Copyright (C) 2014-2016 Matijs van Zuijlen
|
3
5
|
#
|
@@ -75,9 +77,7 @@ module Alexandria
|
|
75
77
|
begin
|
76
78
|
return BOOK_ICON if library.nil?
|
77
79
|
filename = library.cover(book)
|
78
|
-
if File.exist?(filename)
|
79
|
-
return GdkPixbuf::Pixbuf.new(file: filename)
|
80
|
-
end
|
80
|
+
return GdkPixbuf::Pixbuf.new(file: filename) if File.exist?(filename)
|
81
81
|
rescue => err
|
82
82
|
# report load error; FIX should go to a Logger...
|
83
83
|
puts err.message
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (C) 2004-2006 Laurent Sansonetti
|
2
4
|
# Copyright (C) 2008 Joseph Method
|
3
5
|
# Copyright (C) 2016 Matijs van Zuijlen
|
@@ -61,9 +63,7 @@ module Alexandria
|
|
61
63
|
end
|
62
64
|
|
63
65
|
# DND support for Gtk::IconView is shipped since GTK+ 2.8.0.
|
64
|
-
if @iconview.respond_to?(:enable_model_drag_source)
|
65
|
-
setup_view_source_dnd(@iconview)
|
66
|
-
end
|
66
|
+
setup_view_source_dnd(@iconview) if @iconview.respond_to?(:enable_model_drag_source)
|
67
67
|
end
|
68
68
|
|
69
69
|
ICONS_SORTS = [
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# -*- ruby -*-
|
2
4
|
#
|
3
5
|
# Copyright (C) 2007 kksou
|
@@ -59,15 +61,11 @@ class IconViewTooltips
|
|
59
61
|
html += "<b>#{CGI.escapeHTML(title)}</b>"
|
60
62
|
html += "\n" unless authors.empty?
|
61
63
|
end
|
62
|
-
unless authors.empty?
|
63
|
-
html += "<i>#{CGI.escapeHTML(authors)}</i>"
|
64
|
-
end
|
64
|
+
html += "<i>#{CGI.escapeHTML(authors)}</i>" unless authors.empty?
|
65
65
|
html += "\n" if !title.empty? || !authors.empty?
|
66
66
|
|
67
67
|
html += '<small>'
|
68
|
-
if publisher && !publisher.empty?
|
69
|
-
html += CGI.escapeHTML(publisher).to_s
|
70
|
-
end
|
68
|
+
html += CGI.escapeHTML(publisher).to_s if publisher && !publisher.empty?
|
71
69
|
|
72
70
|
if year && !year.empty?
|
73
71
|
html += ' ' if publisher && !publisher.empty?
|
data/lib/alexandria/ui/init.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (C) 2004-2006 Laurent Sansonetti
|
2
4
|
# Copyright (C) 2008 Joseph Method
|
3
5
|
# Copyright (C) 2010 Cathal Mc Ginley
|
@@ -44,7 +46,7 @@ module Alexandria
|
|
44
46
|
|
45
47
|
def setup_title_column
|
46
48
|
title = _('Title')
|
47
|
-
log.debug { 'Create listview column for %s'
|
49
|
+
log.debug { format('Create listview column for %s', title) }
|
48
50
|
column = Gtk::TreeViewColumn.new(title)
|
49
51
|
|
50
52
|
renderer = Gtk::CellRendererPixbuf.new
|
@@ -52,7 +54,7 @@ module Alexandria
|
|
52
54
|
column.add_attribute(renderer, 'pixbuf', Columns::COVER_LIST)
|
53
55
|
|
54
56
|
renderer = Gtk::CellRendererText.new
|
55
|
-
renderer.ellipsize =
|
57
|
+
renderer.ellipsize = :end
|
56
58
|
column.pack_start(renderer, true)
|
57
59
|
column.add_attribute(renderer, 'text', Columns::TITLE)
|
58
60
|
|
@@ -101,7 +103,7 @@ module Alexandria
|
|
101
103
|
title = _('Tags')
|
102
104
|
log.debug { 'Create listview column for tags...' }
|
103
105
|
renderer = Gtk::CellRendererText.new
|
104
|
-
renderer.ellipsize =
|
106
|
+
renderer.ellipsize = :end
|
105
107
|
column = Gtk::TreeViewColumn.new(title, renderer,
|
106
108
|
text: Columns::TAGS)
|
107
109
|
column.sort_column_id = Columns::TAGS
|
@@ -119,7 +121,7 @@ module Alexandria
|
|
119
121
|
|
120
122
|
def setup_rating_column
|
121
123
|
title = _('Rating')
|
122
|
-
log.debug { 'Create listview column for %s...'
|
124
|
+
log.debug { format('Create listview column for %s...', title) }
|
123
125
|
column = Gtk::TreeViewColumn.new(title)
|
124
126
|
column.sizing = :fixed
|
125
127
|
width = (Icons::STAR_SET.width + 1) * Book::MAX_RATING_STARS
|
@@ -181,21 +183,19 @@ module Alexandria
|
|
181
183
|
column = Gtk::TreeViewColumn.new(title, renderer, text: iterid)
|
182
184
|
column.sort_column_id = iterid
|
183
185
|
column.resizable = true
|
184
|
-
log.debug { 'Create listview column for %s...'
|
186
|
+
log.debug { format('Create listview column for %s...', title) }
|
185
187
|
|
186
188
|
column.add_attribute(renderer, 'active', iterid)
|
187
|
-
if iterid == Columns::WANT
|
188
|
-
column.add_attribute(renderer, 'inconsistent', Columns::OWN)
|
189
|
-
end
|
189
|
+
column.add_attribute(renderer, 'inconsistent', Columns::OWN) if iterid == Columns::WANT
|
190
190
|
|
191
191
|
log.debug { "append_column #{column}" }
|
192
192
|
@listview.append_column(column)
|
193
193
|
end
|
194
194
|
|
195
195
|
def setup_text_column(title, iterid)
|
196
|
-
log.debug { 'Create listview column for %s...'
|
196
|
+
log.debug { format('Create listview column for %s...', title) }
|
197
197
|
renderer = Gtk::CellRendererText.new
|
198
|
-
renderer.ellipsize =
|
198
|
+
renderer.ellipsize = :end
|
199
199
|
column = Gtk::TreeViewColumn.new(title, renderer,
|
200
200
|
text: iterid)
|
201
201
|
column.sort_column_id = iterid
|
@@ -231,7 +231,7 @@ module Alexandria
|
|
231
231
|
def setup_listview_columns_width
|
232
232
|
log.debug { "setup_listview_columns_width #{@prefs.cols_width}" }
|
233
233
|
if @prefs.cols_width
|
234
|
-
cols_width = YAML.
|
234
|
+
cols_width = YAML.safe_load(@prefs.cols_width)
|
235
235
|
log.debug { "cols_width: #{cols_width.inspect}" }
|
236
236
|
@listview.columns.each do |c|
|
237
237
|
if cols_width.key?(c.title)
|
@@ -243,7 +243,10 @@ module Alexandria
|
|
243
243
|
end
|
244
244
|
end
|
245
245
|
end
|
246
|
-
log.debug {
|
246
|
+
log.debug {
|
247
|
+
'Columns width: ' +
|
248
|
+
@listview.columns.map { |col| "#{col.title} #{col.width}" }.join(', ')
|
249
|
+
}
|
247
250
|
end
|
248
251
|
end
|
249
252
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (C) 2008 Joseph Method
|
2
4
|
# Copyright (C) 2008,2009 Cathal Mc Ginley
|
3
5
|
# Copyright (C) 2011, 2014-2016 Matijs van Zuijlen
|
@@ -48,10 +50,10 @@ module Alexandria
|
|
48
50
|
# also no initial . since that hides the Library (hidden file)
|
49
51
|
# forbidding an initial dot also disallows "." and ".."
|
50
52
|
# which are of course pre-existing directories.
|
51
|
-
|
53
|
+
match
|
52
54
|
rescue => ex
|
53
55
|
log.warn { "New library name not valid UTF-8: #{ex.message}" }
|
54
|
-
|
56
|
+
true
|
55
57
|
# /([^\w\s'"()&?!:;.\-])/.match(new_text) # anglocentric!
|
56
58
|
end
|
57
59
|
|
@@ -113,7 +115,7 @@ module Alexandria
|
|
113
115
|
cell.pixbuf = iter[0]
|
114
116
|
end
|
115
117
|
renderer = Gtk::CellRendererText.new
|
116
|
-
renderer.ellipsize =
|
118
|
+
renderer.ellipsize = :end
|
117
119
|
column.pack_start(renderer, true)
|
118
120
|
column.set_cell_data_func(renderer) do |_col, cell, _model, iter|
|
119
121
|
# log.debug { "sidepane: editable #{cell}, #{iter} #{iter[1]}: #{iter[2]}" }
|
@@ -163,7 +165,7 @@ module Alexandria
|
|
163
165
|
@library_listview.set_drag_dest_row(path, :into_or_after)
|
164
166
|
|
165
167
|
Gdk.drag_status(drag_context,
|
166
|
-
|
168
|
+
path ? drag_context.suggested_action : 0,
|
167
169
|
time)
|
168
170
|
end
|
169
171
|
|
@@ -176,13 +178,13 @@ module Alexandria
|
|
176
178
|
true
|
177
179
|
end
|
178
180
|
|
179
|
-
@library_listview.signal_connect('drag-data-received') do |
|
181
|
+
@library_listview.signal_connect('drag-data-received') do |_, drag_context, x, y, data, _, _|
|
180
182
|
log.debug { 'drag-data-received' }
|
181
183
|
|
182
184
|
success = false
|
183
185
|
# FIXME: Ruby-GNOME2 should make comparison work without needing to
|
184
186
|
# call #name.
|
185
|
-
if
|
187
|
+
if data.data_type.name == Gdk::Selection::TYPE_STRING.name
|
186
188
|
success, path =
|
187
189
|
@library_listview.get_dest_row_at_pos(x, y)
|
188
190
|
|
data/lib/alexandria/ui/sound.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (C) 2004-2006 Laurent Sansonetti
|
2
4
|
# Copyright (C) 2008 Joseph Method
|
3
5
|
# Copyright (C) 2011, 2016 Matijs van Zuijlen
|
@@ -380,8 +382,13 @@ module Alexandria
|
|
380
382
|
end
|
381
383
|
|
382
384
|
def determine_library_popup(widget, event)
|
383
|
-
|
384
|
-
|
385
|
+
if widget.get_path_at_pos(event.x, event.y).nil?
|
386
|
+
@nolibrary_popup
|
387
|
+
elsif selected_library.is_a?(SmartLibrary)
|
388
|
+
@smart_library_popup
|
389
|
+
else
|
390
|
+
@library_popup
|
391
|
+
end
|
385
392
|
end
|
386
393
|
|
387
394
|
def event_is_right_click(event)
|
@@ -418,23 +425,19 @@ module Alexandria
|
|
418
425
|
else
|
419
426
|
n_unrated = library.n_unrated
|
420
427
|
if n_unrated == library.length
|
421
|
-
n_("Library '%s' selected, %d unrated book",
|
422
|
-
|
423
|
-
|
424
|
-
library.length]
|
428
|
+
format(n_("Library '%s' selected, %d unrated book",
|
429
|
+
"Library '%s' selected, %d unrated books",
|
430
|
+
library.length), library.name, library.length)
|
425
431
|
elsif n_unrated.zero?
|
426
|
-
n_("Library '%s' selected, %d book",
|
427
|
-
|
428
|
-
|
429
|
-
library.length]
|
432
|
+
format(n_("Library '%s' selected, %d book",
|
433
|
+
"Library '%s' selected, %d books",
|
434
|
+
library.length), library.name, library.length)
|
430
435
|
else
|
431
|
-
n_("Library '%s' selected, %d book, " \
|
436
|
+
format(n_("Library '%s' selected, %d book, " \
|
432
437
|
'%d unrated',
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
library.length,
|
437
|
-
n_unrated]
|
438
|
+
"Library '%s' selected, %d books, " \
|
439
|
+
'%d unrated',
|
440
|
+
library.length), library.name, library.length, n_unrated)
|
438
441
|
end
|
439
442
|
end
|
440
443
|
end
|
@@ -459,7 +462,6 @@ module Alexandria
|
|
459
462
|
library = selected_library
|
460
463
|
books = selected_books
|
461
464
|
set_status_label(get_appbar_status(library, books))
|
462
|
-
# selection = @library_listview.selection.selected ? @library_listview.selection.selected.has_focus? : false
|
463
465
|
|
464
466
|
# Focus is the wrong idiom here.
|
465
467
|
unless @clicking_on_sidepane || (@main_app.focus == @library_listview)
|
@@ -467,7 +469,10 @@ module Alexandria
|
|
467
469
|
|
468
470
|
log.debug { "Currently focused widget: #{@main_app.focus.inspect}" }
|
469
471
|
log.debug { "#{@library_listview} : #{@library_popup} : #{@listview}" }
|
470
|
-
log.debug {
|
472
|
+
log.debug {
|
473
|
+
"@library_listview: #{@library_listview.has_focus?} " \
|
474
|
+
"or @library_popup:#{@library_popup.has_focus?}"
|
475
|
+
}
|
471
476
|
log.debug { '@library_listview does *NOT* have focus' }
|
472
477
|
log.debug { "Books are empty: #{books.empty?}" }
|
473
478
|
@actiongroup['Properties'].sensitive = \
|
@@ -503,9 +508,7 @@ module Alexandria
|
|
503
508
|
@actiongroup[provider.action_name].sensitive = !has_no_url
|
504
509
|
no_urls = false unless has_no_url
|
505
510
|
end
|
506
|
-
if no_urls
|
507
|
-
@actiongroup['OnlineInformation'].sensitive = false
|
508
|
-
end
|
511
|
+
@actiongroup['OnlineInformation'].sensitive = false if no_urls
|
509
512
|
end
|
510
513
|
end
|
511
514
|
@clicking_on_sidepane = false
|
@@ -575,9 +578,7 @@ module Alexandria
|
|
575
578
|
@actiongroup['Undo'].sensitive = caller.can_undo?
|
576
579
|
@actiongroup['Redo'].sensitive = caller.can_redo?
|
577
580
|
elsif caller.is_a?(Library)
|
578
|
-
unless caller.updating?
|
579
|
-
handle_update_caller_library ary
|
580
|
-
end
|
581
|
+
handle_update_caller_library ary unless caller.updating?
|
581
582
|
else
|
582
583
|
raise 'unrecognized update event'
|
583
584
|
end
|
@@ -643,12 +644,9 @@ module Alexandria
|
|
643
644
|
end
|
644
645
|
|
645
646
|
def handle_ruined_books
|
646
|
-
new_message = _(
|
647
|
-
|
648
|
-
|
649
|
-
# standard. We will attempt to replace them from the book
|
650
|
-
# providers. Otherwise, we will turn them into manual
|
651
|
-
# entries.\n" )
|
647
|
+
new_message = _(
|
648
|
+
'The data files for the following books are malformed or empty. Do you wish to' \
|
649
|
+
" attempt to download new information for them from the online book providers?\n")
|
652
650
|
|
653
651
|
@libraries.ruined_books.each { |bi|
|
654
652
|
new_message += "\n#{bi[1] || bi[1].inspect}"
|
@@ -692,13 +690,10 @@ module Alexandria
|
|
692
690
|
end
|
693
691
|
|
694
692
|
log.debug { "Trying to add #{book.title}, #{cover_uri} in library ''#{library.name}'" }
|
695
|
-
unless cover_uri.nil?
|
696
|
-
library.save_cover(book, cover_uri)
|
697
|
-
end
|
693
|
+
library.save_cover(book, cover_uri) unless cover_uri.nil?
|
698
694
|
library << book
|
699
695
|
library.save(book)
|
700
|
-
set_status_label(_("Added '%s' to library '%s'")
|
701
|
-
|
696
|
+
set_status_label(format(_("Added '%s' to library '%s'"), book.title, library.name))
|
702
697
|
rescue => ex
|
703
698
|
log.error { "Couldn't add book #{isbn}: #{ex}" }
|
704
699
|
log.error { ex.backtrace.join("\n") }
|
@@ -772,9 +767,7 @@ module Alexandria
|
|
772
767
|
new_height = [ICON_HEIGHT, icon.height].min
|
773
768
|
icon = cache_scaled_icon(icon, new_width, new_height)
|
774
769
|
end
|
775
|
-
if rating == Book::MAX_RATING_STARS
|
776
|
-
icon = icon.tag(Icons::FAVORITE_TAG)
|
777
|
-
end
|
770
|
+
icon = icon.tag(Icons::FAVORITE_TAG) if rating == Book::MAX_RATING_STARS
|
778
771
|
iter[Columns::COVER_ICON] = icon
|
779
772
|
log.debug { 'Full iter: ' + (0..15).map { |num| iter[num].inspect }.join(', ') }
|
780
773
|
end
|
@@ -805,9 +798,7 @@ module Alexandria
|
|
805
798
|
model = @library_listview.model
|
806
799
|
is_smart = library.is_a?(SmartLibrary)
|
807
800
|
if is_smart
|
808
|
-
if @library_separator_iter.nil?
|
809
|
-
@library_separator_iter = append_library_separator
|
810
|
-
end
|
801
|
+
@library_separator_iter = append_library_separator if @library_separator_iter.nil?
|
811
802
|
iter = model.append
|
812
803
|
else
|
813
804
|
iter = if @library_separator_iter.nil?
|
@@ -979,7 +970,7 @@ module Alexandria
|
|
979
970
|
@actiongroup['AddBookManual'].sensitive = !smart
|
980
971
|
@actiongroup['Properties'].sensitive = smart
|
981
972
|
can_delete = smart || (@libraries.all_regular_libraries.length > 1)
|
982
|
-
@actiongroup['Delete'].sensitive = can_delete
|
973
|
+
@actiongroup['Delete'].sensitive = can_delete
|
983
974
|
log.debug { "sensitize_library delete: #{@actiongroup['Delete'].sensitive?}" }
|
984
975
|
false
|
985
976
|
end
|
@@ -1105,7 +1096,10 @@ module Alexandria
|
|
1105
1096
|
# Gets the sort order of the current library, for use by export
|
1106
1097
|
def library_sort_order
|
1107
1098
|
# added by Cathal Mc Ginley, 23 Oct 2007
|
1108
|
-
log.debug {
|
1099
|
+
log.debug {
|
1100
|
+
"library_sort_order #{@notebook.page}: " \
|
1101
|
+
"#{@iconview.model.inspect} #{@listview.model.inspect}"
|
1102
|
+
}
|
1109
1103
|
result, sort_column, sort_order = current_view.model.sort_column_id
|
1110
1104
|
if result
|
1111
1105
|
column_ids_to_attributes = { 2 => :title,
|