alexandria-book-collection-manager 0.7.1 → 0.7.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/dependabot.yml +9 -0
- data/.gitignore +5 -2
- data/.hound.yml +2 -0
- data/.rubocop.yml +113 -45
- data/.rubocop_todo.yml +82 -170
- data/.simplecov +5 -1
- data/.travis.yml +45 -0
- data/.yardopts +1 -1
- data/CHANGELOG.md +60 -0
- data/ChangeLog.0 +33 -35
- data/Gemfile +6 -5
- data/INSTALL.md +164 -0
- data/README.md +52 -42
- data/Rakefile +95 -109
- data/TODO.md +9 -1
- data/alexandria-book-collection-manager.gemspec +52 -45
- data/bin/alexandria +31 -53
- data/doc/AUTHORS +61 -0
- data/doc/BUGS +31 -0
- data/doc/FAQ +365 -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 +80 -0
- data/lib/alexandria.rb +29 -37
- data/lib/alexandria/about.rb +52 -51
- data/lib/alexandria/book_providers.rb +94 -101
- data/lib/alexandria/book_providers/adlibris.rb +45 -85
- data/lib/alexandria/book_providers/amazon_aws.rb +105 -113
- data/lib/alexandria/book_providers/amazon_ecs_util.rb +293 -324
- data/lib/alexandria/book_providers/barnes_and_noble.rb +54 -53
- data/lib/alexandria/book_providers/douban.rb +29 -51
- data/lib/alexandria/book_providers/proxis.rb +42 -59
- data/lib/alexandria/book_providers/pseudomarc.rb +79 -99
- data/lib/alexandria/book_providers/siciliano.rb +68 -70
- data/lib/alexandria/book_providers/thalia.rb +46 -45
- data/lib/alexandria/book_providers/web.rb +17 -33
- data/lib/alexandria/book_providers/worldcat.rb +74 -102
- data/lib/alexandria/book_providers/z3950.rb +170 -174
- data/lib/alexandria/config.rb +5 -3
- data/lib/alexandria/console.rb +10 -21
- data/lib/alexandria/default_preferences.rb +37 -0
- data/lib/alexandria/execution_queue.rb +17 -15
- data/lib/alexandria/export_format.rb +47 -0
- data/lib/alexandria/export_library.rb +188 -302
- data/lib/alexandria/import_library.rb +114 -155
- data/lib/alexandria/import_library_csv.rb +46 -96
- data/lib/alexandria/library_collection.rb +79 -0
- data/lib/alexandria/library_sort_order.rb +45 -0
- data/lib/alexandria/library_store.rb +233 -0
- data/lib/alexandria/logging.rb +15 -19
- data/lib/alexandria/models/book.rb +15 -20
- data/lib/alexandria/models/library.rb +81 -363
- data/lib/alexandria/net.rb +7 -6
- data/lib/alexandria/preferences.rb +73 -91
- data/lib/alexandria/scanners.rb +4 -2
- data/lib/alexandria/scanners/{cuecat.rb → cue_cat.rb} +24 -20
- data/lib/alexandria/scanners/keyboard.rb +10 -8
- data/lib/alexandria/smart_library.rb +135 -171
- data/lib/alexandria/ui.rb +17 -15
- data/lib/alexandria/ui/about_dialog.rb +49 -0
- data/lib/alexandria/ui/{dialogs/acquire_dialog.rb → acquire_dialog.rb} +129 -152
- data/lib/alexandria/ui/alert_dialog.rb +64 -0
- data/lib/alexandria/ui/bad_isbns_dialog.rb +41 -0
- data/lib/alexandria/ui/{dialogs/barcode_animation.rb → barcode_animation.rb} +18 -15
- data/lib/alexandria/ui/{dialogs/book_properties_dialog.rb → book_properties_dialog.rb} +44 -61
- data/lib/alexandria/ui/{dialogs/book_properties_dialog_base.rb → book_properties_dialog_base.rb} +84 -89
- data/lib/alexandria/ui/builder_base.rb +9 -27
- data/lib/alexandria/ui/callbacks.rb +188 -186
- data/lib/alexandria/ui/columns.rb +2 -0
- data/lib/alexandria/ui/completion_models.rb +12 -23
- data/lib/alexandria/ui/confirm_erase_dialog.rb +33 -0
- data/lib/alexandria/ui/conflict_while_copying_dialog.rb +34 -0
- data/lib/alexandria/ui/dndable.rb +10 -8
- data/lib/alexandria/ui/error_dialog.rb +25 -0
- data/lib/alexandria/ui/export_dialog.rb +139 -0
- data/lib/alexandria/ui/icons.rb +49 -65
- data/lib/alexandria/ui/iconview.rb +15 -13
- data/lib/alexandria/ui/iconview_tooltips.rb +43 -58
- data/lib/alexandria/ui/import_dialog.rb +157 -0
- data/lib/alexandria/ui/init.rb +23 -33
- data/lib/alexandria/ui/keep_bad_isbn_dialog.rb +36 -0
- data/lib/alexandria/ui/libraries_combo.rb +18 -14
- data/lib/alexandria/ui/listview.rb +77 -88
- data/lib/alexandria/ui/main_app.rb +26 -26
- data/lib/alexandria/ui/misc_dialogs.rb +10 -0
- data/lib/alexandria/ui/multi_drag_treeview.rb +30 -41
- data/lib/alexandria/ui/{dialogs/new_book_dialog.rb → new_book_dialog.rb} +168 -215
- data/lib/alexandria/ui/new_book_dialog_manual.rb +139 -0
- data/lib/alexandria/ui/new_provider_dialog.rb +100 -0
- data/lib/alexandria/ui/new_smart_library_dialog.rb +74 -0
- data/lib/alexandria/ui/preferences_dialog.rb +313 -0
- data/lib/alexandria/ui/provider_preferences_base_dialog.rb +95 -0
- data/lib/alexandria/ui/provider_preferences_dialog.rb +35 -0
- data/lib/alexandria/ui/really_delete_dialog.rb +53 -0
- data/lib/alexandria/ui/{sidepane.rb → sidepane_manager.rb} +62 -72
- data/lib/alexandria/ui/skip_entry_dialog.rb +33 -0
- data/lib/alexandria/ui/smart_library_properties_dialog.rb +60 -0
- data/lib/alexandria/ui/{dialogs/smart_library_properties_dialog_base.rb → smart_library_properties_dialog_base.rb} +96 -172
- data/lib/alexandria/ui/smart_library_rule_box.rb +119 -0
- data/lib/alexandria/ui/sound.rb +13 -13
- data/lib/alexandria/ui/ui_manager.rb +262 -283
- data/lib/alexandria/undo_manager.rb +3 -0
- data/lib/alexandria/version.rb +6 -19
- data/lib/alexandria/web_themes.rb +24 -21
- data/po/Makefile +2 -2
- data/po/cs.po +993 -880
- data/po/cy.po +957 -874
- data/po/de.po +990 -869
- data/po/el.po +989 -869
- data/po/es.po +985 -865
- data/po/fr.po +986 -870
- data/po/ga.po +907 -823
- data/po/gl.po +981 -865
- data/po/it.po +986 -868
- data/po/ja.po +969 -853
- data/po/mk.po +983 -863
- data/po/nb.po +979 -863
- data/po/nl.po +983 -864
- data/po/pl.po +1020 -969
- data/po/pt.po +988 -861
- data/po/pt_BR.po +984 -868
- data/po/ru.po +992 -873
- data/po/sk.po +987 -869
- data/po/sv.po +977 -861
- data/po/uk.po +975 -865
- data/po/zh_TW.po +976 -860
- data/schemas/alexandria.schemas +25 -3
- data/share/alexandria/glade/acquire_dialog__builder.glade +15 -12
- data/share/alexandria/glade/book_properties_dialog__builder.glade +171 -299
- data/share/alexandria/glade/main_app__builder.glade +24 -33
- data/share/alexandria/glade/new_book_dialog__builder.glade +27 -59
- data/share/alexandria/glade/preferences_dialog__builder.glade +250 -290
- data/share/gnome/help/alexandria/C/introduction.xml +0 -8
- data/share/gnome/help/alexandria/C/searching.xml +1 -1
- data/share/gnome/help/alexandria/C/smart-libraries.xml +2 -2
- data/share/gnome/help/alexandria/C/working-with-libraries.xml +1 -1
- data/share/gnome/help/alexandria/fr/alexandria.xml +1 -1
- data/share/gnome/help/alexandria/ja/introduction.xml +0 -8
- data/share/gnome/help/alexandria/ja/smart-libraries.xml +1 -1
- data/spec/alexandria/book_providers/world_cat_provider_spec.rb +160 -0
- data/spec/alexandria/book_providers_spec.rb +77 -210
- data/spec/alexandria/book_spec.rb +16 -12
- data/spec/alexandria/console_spec.rb +27 -0
- data/spec/alexandria/export_library_spec.rb +130 -0
- data/spec/alexandria/library_spec.rb +130 -172
- data/spec/alexandria/library_store_spec.rb +37 -0
- data/spec/alexandria/preferences_spec.rb +46 -17
- data/spec/alexandria/scanners/cue_cat_spec.rb +52 -0
- data/spec/alexandria/smart_library_spec.rb +32 -25
- data/spec/alexandria/ui/about_dialog_spec.rb +14 -0
- data/spec/alexandria/ui/acquire_dialog_spec.rb +14 -0
- data/spec/alexandria/ui/alert_dialog_spec.rb +16 -0
- data/spec/alexandria/ui/bad_isbns_dialog_spec.rb +14 -0
- data/spec/alexandria/ui/book_properties_dialog_spec.rb +17 -0
- data/spec/alexandria/ui/confirm_erase_dialog_spec.rb +14 -0
- data/spec/alexandria/ui/conflict_while_copying_dialog_spec.rb +16 -0
- data/spec/alexandria/ui/error_dialog_spec.rb +14 -0
- data/spec/alexandria/ui/export_dialog_spec.rb +15 -0
- data/spec/alexandria/ui/icons_spec.rb +26 -0
- data/spec/alexandria/ui/iconview_spec.rb +9 -21
- data/spec/alexandria/ui/import_dialog_spec.rb +41 -0
- data/spec/alexandria/ui/keep_bad_isbn_dialog_spec.rb +17 -0
- data/spec/alexandria/ui/main_app_spec.rb +8 -33
- data/spec/alexandria/ui/new_book_dialog_manual_spec.rb +15 -0
- data/spec/alexandria/ui/new_book_dialog_spec.rb +22 -0
- data/spec/alexandria/ui/new_provider_dialog_spec.rb +30 -0
- data/spec/alexandria/ui/new_smart_library_dialog_spec.rb +39 -0
- data/spec/alexandria/ui/preferences_dialog_spec.rb +14 -0
- data/spec/alexandria/ui/provider_preferences_dialog_spec.rb +34 -0
- data/spec/alexandria/ui/really_delete_dialog_spec.rb +16 -0
- data/spec/alexandria/ui/sidepane_manager_spec.rb +15 -0
- data/spec/alexandria/ui/skip_entry_dialog_spec.rb +14 -0
- data/spec/alexandria/ui/smart_library_properties_dialog_spec.rb +32 -0
- data/spec/alexandria/ui/sound_spec.rb +4 -2
- data/spec/alexandria/ui/ui_manager_spec.rb +45 -20
- data/spec/end_to_end/basic_run_spec.rb +57 -0
- data/spec/spec_helper.rb +66 -33
- data/tasks/setup.rb +5 -3
- data/tasks/spec.rake +18 -3
- data/util/rake/fileinstall.rb +38 -40
- data/util/rake/gettextgenerate.rb +15 -70
- data/util/rake/omfgenerate.rb +10 -10
- metadata +176 -60
- data/INSTALL.rdoc +0 -148
- data/dogtail/basic_run_test.py +0 -9
- data/lib/alexandria/book_providers/bol_it.rb +0 -160
- data/lib/alexandria/book_providers/deastore.rb +0 -273
- data/lib/alexandria/book_providers/ibs_it.rb +0 -147
- data/lib/alexandria/book_providers/mcu.rb +0 -169
- data/lib/alexandria/book_providers/renaud.rb +0 -140
- data/lib/alexandria/book_providers/webster_it.rb +0 -167
- data/lib/alexandria/ui/dialogs/about_dialog.rb +0 -59
- data/lib/alexandria/ui/dialogs/alert_dialog.rb +0 -70
- data/lib/alexandria/ui/dialogs/bad_isbns_dialog.rb +0 -43
- data/lib/alexandria/ui/dialogs/export_dialog.rb +0 -171
- data/lib/alexandria/ui/dialogs/import_dialog.rb +0 -196
- data/lib/alexandria/ui/dialogs/misc_dialogs.rb +0 -85
- data/lib/alexandria/ui/dialogs/new_book_dialog_manual.rb +0 -154
- data/lib/alexandria/ui/dialogs/new_smart_library_dialog.rb +0 -74
- data/lib/alexandria/ui/dialogs/preferences_dialog.rb +0 -578
- data/lib/alexandria/ui/dialogs/smart_library_properties_dialog.rb +0 -57
- data/spec/alexandria/scanners/cuecat_spec.rb +0 -65
- data/spec/alexandria/ui/dialogs_spec.rb +0 -94
- data/spec/alexandria/ui/sidepane_spec.rb +0 -27
- data/spec/alexandria/ui/ui_utilities_spec.rb +0 -60
- data/spec/alexandria/utilities_spec.rb +0 -50
- data/tasks/dogtail.rake +0 -4
@@ -1,41 +1,23 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
# modify it under the terms of the GNU General Public License as
|
5
|
-
# published by the Free Software Foundation; either version 2 of the
|
6
|
-
# License, or (at your option) any later version.
|
7
|
-
#
|
8
|
-
# Alexandria is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
-
# General Public License for more details.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file is part of Alexandria.
|
12
4
|
#
|
13
|
-
#
|
14
|
-
# License along with Alexandria; see the file COPYING. If not,
|
15
|
-
# write to the Free Software Foundation, Inc., 51 Franklin Street,
|
16
|
-
# Fifth Floor, Boston, MA 02110-1301 USA.
|
5
|
+
# See the file README.md for authorship and licensing information.
|
17
6
|
|
18
7
|
module Alexandria
|
19
8
|
module UI
|
20
9
|
class BuilderBase
|
21
10
|
def initialize(filename, widget_names)
|
22
|
-
file = File.join(Alexandria::Config::DATA_DIR,
|
11
|
+
file = File.join(Alexandria::Config::DATA_DIR, "glade", filename)
|
23
12
|
builder = Gtk::Builder.new
|
13
|
+
# TODO: This emits the warning 'GtkDialog mapped without a transient
|
14
|
+
# parent. This is discouraged.'
|
24
15
|
builder.add_from_file(file)
|
25
16
|
builder.connect_signals do |handler|
|
26
|
-
|
27
|
-
method(handler)
|
28
|
-
rescue => ex
|
29
|
-
puts "Error: #{ex}" if $DEBUG
|
30
|
-
nil
|
31
|
-
end
|
17
|
+
method(handler)
|
32
18
|
end
|
33
19
|
widget_names.each do |name|
|
34
|
-
|
35
|
-
instance_variable_set("@#{name}".intern, builder[name.to_s])
|
36
|
-
rescue => err
|
37
|
-
puts "Error: #{err}" if $DEBUG
|
38
|
-
end
|
20
|
+
instance_variable_set("@#{name}".intern, builder[name.to_s])
|
39
21
|
end
|
40
22
|
end
|
41
23
|
end
|
@@ -1,21 +1,10 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# Alexandria is free software; you can redistribute it and/or
|
6
|
-
# modify it under the terms of the GNU General Public License as
|
7
|
-
# published by the Free Software Foundation; either version 2 of the
|
8
|
-
# License, or (at your option) any later version.
|
9
|
-
#
|
10
|
-
# Alexandria is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
-
# General Public License for more details.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file is part of Alexandria.
|
14
4
|
#
|
15
|
-
#
|
16
|
-
|
17
|
-
|
18
|
-
# Fifth Floor, Boston, MA 02110-1301 USA.
|
5
|
+
# See the file README.md for authorship and licensing information.
|
6
|
+
|
7
|
+
require "alexandria/ui/really_delete_dialog"
|
19
8
|
|
20
9
|
module Alexandria
|
21
10
|
module UI
|
@@ -24,7 +13,7 @@ module Alexandria
|
|
24
13
|
|
25
14
|
def on_new(*)
|
26
15
|
name = Library.generate_new_name(@libraries.all_libraries)
|
27
|
-
library =
|
16
|
+
library = @libraries.library_store.load_library(name)
|
28
17
|
@libraries.add_library(library)
|
29
18
|
append_library(library, true)
|
30
19
|
setup_move_actions
|
@@ -32,17 +21,17 @@ module Alexandria
|
|
32
21
|
end
|
33
22
|
|
34
23
|
def on_new_smart(*)
|
35
|
-
NewSmartLibraryDialog.new(@main_app)
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
24
|
+
smart_library = NewSmartLibraryDialog.new(@main_app).acquire or return
|
25
|
+
|
26
|
+
smart_library.refilter
|
27
|
+
@libraries.add_library(smart_library)
|
28
|
+
append_library(smart_library, true)
|
29
|
+
smart_library.save
|
41
30
|
end
|
42
31
|
|
43
32
|
def on_add_book(*)
|
44
|
-
log.info {
|
45
|
-
NewBookDialog.new(@main_app, selected_library) do |_books, library, is_new|
|
33
|
+
log.info { "on_add_book" }
|
34
|
+
dialog = NewBookDialog.new(@main_app, selected_library) do |_books, library, is_new|
|
46
35
|
if is_new
|
47
36
|
append_library(library, true)
|
48
37
|
setup_move_actions
|
@@ -50,28 +39,28 @@ module Alexandria
|
|
50
39
|
select_library(library)
|
51
40
|
end
|
52
41
|
end
|
42
|
+
dialog.show
|
53
43
|
end
|
54
44
|
|
55
45
|
def on_add_book_manual(*)
|
56
46
|
library = selected_library
|
57
|
-
NewBookDialogManual.new(@main_app, library)
|
47
|
+
dialog = NewBookDialogManual.new(@main_app, library) do |_book|
|
58
48
|
refresh_books
|
59
|
-
|
49
|
+
end
|
50
|
+
dialog.show
|
60
51
|
end
|
61
52
|
|
62
53
|
def on_import(*)
|
63
|
-
ImportDialog.new(@main_app) do |library, bad_isbns, failed_isbns|
|
54
|
+
ImportDialog.new(@main_app).acquire do |library, bad_isbns, failed_isbns|
|
64
55
|
unless bad_isbns.empty?
|
65
|
-
log.debug {
|
66
|
-
message = _(
|
67
|
-
|
68
|
-
bad_isbn_warn.signal_connect('response') { bad_isbn_warn.destroy }
|
56
|
+
log.debug { "bad_isbn" }
|
57
|
+
message = _("The following lines are not valid ISBNs and were not imported:")
|
58
|
+
BadIsbnsDialog.new(@main_app, message, bad_isbns).show
|
69
59
|
end
|
70
60
|
unless failed_isbns.nil? || failed_isbns.empty?
|
71
61
|
log.debug { "failed lookup of #{failed_isbns.size} ISBNs" }
|
72
|
-
message = _(
|
73
|
-
|
74
|
-
failed_lookup.signal_connect('response') { failed_lookup.destroy }
|
62
|
+
message = _("Books could not be found for the following ISBNs:")
|
63
|
+
BadIsbnsDialog.new(@main_app, message, failed_isbns).show
|
75
64
|
end
|
76
65
|
@libraries.add_library(library)
|
77
66
|
append_library(library, true)
|
@@ -80,40 +69,40 @@ module Alexandria
|
|
80
69
|
end
|
81
70
|
|
82
71
|
def on_window_state_event(_window, event)
|
83
|
-
log.debug {
|
72
|
+
log.debug { "window-state-event" }
|
84
73
|
if event.is_a?(Gdk::EventWindowState)
|
85
74
|
@maximized = event.new_window_state == :maximized
|
86
75
|
end
|
87
|
-
log.debug {
|
76
|
+
log.debug { "end window-state-event" }
|
88
77
|
end
|
89
78
|
|
90
|
-
def on_toolbar_view_as_changed(
|
91
|
-
log.debug {
|
92
|
-
action = case
|
79
|
+
def on_toolbar_view_as_changed(widget)
|
80
|
+
log.debug { "changed" }
|
81
|
+
action = case widget.active
|
93
82
|
when 0
|
94
|
-
@actiongroup[
|
83
|
+
@actiongroup["AsIcons"]
|
95
84
|
when 1
|
96
|
-
@actiongroup[
|
85
|
+
@actiongroup["AsList"]
|
97
86
|
end
|
98
87
|
action.active = true
|
99
88
|
end
|
100
89
|
|
101
90
|
def on_window_destroy(_window)
|
102
|
-
log.debug {
|
103
|
-
@actiongroup[
|
91
|
+
log.debug { "destroy" }
|
92
|
+
@actiongroup["Quit"].activate
|
104
93
|
end
|
105
94
|
|
106
95
|
def on_toolbar_filter_entry_changed(_entry)
|
107
|
-
log.debug {
|
96
|
+
log.debug { "changed" }
|
108
97
|
@filter_entry.text.strip!
|
109
98
|
@iconview.freeze
|
110
99
|
@filtered_model.refilter
|
111
100
|
@iconview.unfreeze
|
112
101
|
end
|
113
102
|
|
114
|
-
def on_criterion_combobox_changed(
|
115
|
-
log.debug {
|
116
|
-
@filter_books_mode =
|
103
|
+
def on_criterion_combobox_changed(widget)
|
104
|
+
log.debug { "changed" }
|
105
|
+
@filter_books_mode = widget.active
|
117
106
|
@filter_entry.text.strip!
|
118
107
|
@iconview.freeze
|
119
108
|
@filtered_model.refilter
|
@@ -121,32 +110,29 @@ module Alexandria
|
|
121
110
|
end
|
122
111
|
|
123
112
|
def on_export(*)
|
124
|
-
ExportDialog.new(@main_app, selected_library, library_sort_order)
|
125
|
-
# FIXME: Remove this hack and fix the underlying problem.
|
126
|
-
rescue => ex
|
127
|
-
log.error { "problem with immediate export #{ex} try again" }
|
128
|
-
ErrorDialog.new(@main_app, _('Export failed'),
|
129
|
-
_('Try letting this library load ' \
|
130
|
-
'completely before exporting.'))
|
113
|
+
ExportDialog.new(@main_app, selected_library, library_sort_order).perform
|
131
114
|
end
|
132
115
|
|
133
116
|
def on_acquire(*)
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
117
|
+
dialog =
|
118
|
+
AcquireDialog.new(@main_app, selected_library) do |_books, library, is_new|
|
119
|
+
if is_new
|
120
|
+
append_library(library, true)
|
121
|
+
setup_move_actions
|
122
|
+
elsif selected_library != library
|
123
|
+
select_library(library)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
dialog.show
|
143
127
|
end
|
144
128
|
|
145
129
|
def on_properties(*)
|
146
130
|
if @library_listview.focus? || selected_books.empty?
|
147
131
|
library = selected_library
|
148
132
|
if library.is_a?(SmartLibrary)
|
149
|
-
SmartLibraryPropertiesDialog.new(@main_app, library)
|
133
|
+
success = SmartLibraryPropertiesDialog.new(@main_app, library).acquire
|
134
|
+
|
135
|
+
if success
|
150
136
|
library.refilter
|
151
137
|
refresh_books
|
152
138
|
end
|
@@ -155,9 +141,10 @@ module Alexandria
|
|
155
141
|
books = selected_books
|
156
142
|
if books.length == 1
|
157
143
|
book = books.first
|
158
|
-
BookPropertiesDialog.new(@main_app,
|
159
|
-
|
160
|
-
|
144
|
+
dialog = BookPropertiesDialog.new(@main_app,
|
145
|
+
selected_library,
|
146
|
+
book)
|
147
|
+
dialog.show
|
161
148
|
end
|
162
149
|
end
|
163
150
|
end
|
@@ -179,7 +166,7 @@ module Alexandria
|
|
179
166
|
end
|
180
167
|
|
181
168
|
def on_select_all(*)
|
182
|
-
log.debug {
|
169
|
+
log.debug { "on_select_all" }
|
183
170
|
case @notebook.page
|
184
171
|
when 0
|
185
172
|
@iconview.select_all
|
@@ -189,7 +176,7 @@ module Alexandria
|
|
189
176
|
end
|
190
177
|
|
191
178
|
def on_deselect_all(*)
|
192
|
-
log.debug {
|
179
|
+
log.debug { "on_deselect_all" }
|
193
180
|
case @notebook.page
|
194
181
|
when 0
|
195
182
|
@iconview.unselect_all
|
@@ -231,7 +218,7 @@ module Alexandria
|
|
231
218
|
is_smart = library.is_a?(SmartLibrary)
|
232
219
|
last_library = (@libraries.all_regular_libraries.length == 1)
|
233
220
|
if books.nil? && !is_smart && last_library
|
234
|
-
log.warn {
|
221
|
+
log.warn { "Attempted to delete last library, fix GUI" }
|
235
222
|
return
|
236
223
|
end
|
237
224
|
if library.empty? || ReallyDeleteDialog.new(@main_app,
|
@@ -242,7 +229,7 @@ module Alexandria
|
|
242
229
|
end
|
243
230
|
|
244
231
|
def on_clear_search_results(*)
|
245
|
-
@filter_entry.text =
|
232
|
+
@filter_entry.text = ""
|
246
233
|
@iconview.freeze
|
247
234
|
@filtered_model.refilter
|
248
235
|
@iconview.unfreeze
|
@@ -253,9 +240,10 @@ module Alexandria
|
|
253
240
|
end
|
254
241
|
|
255
242
|
def on_preferences(*)
|
256
|
-
PreferencesDialog.new(@main_app) do
|
243
|
+
dialog = PreferencesDialog.new(@main_app) do
|
257
244
|
@listview_manager.setup_listview_columns_visibility
|
258
245
|
end
|
246
|
+
dialog.show
|
259
247
|
end
|
260
248
|
|
261
249
|
def on_submit_bug_report(*)
|
@@ -267,164 +255,178 @@ module Alexandria
|
|
267
255
|
end
|
268
256
|
|
269
257
|
def on_about(*)
|
270
|
-
|
271
|
-
ad.signal_connect('response') do
|
272
|
-
log.debug { 'destroy about' }
|
273
|
-
ad.destroy
|
274
|
-
end
|
275
|
-
ad.show
|
258
|
+
AboutDialog.new(@main_app).show
|
276
259
|
end
|
277
260
|
|
278
261
|
def on_view_sidepane(action)
|
279
|
-
log.debug {
|
262
|
+
log.debug { "on_view_sidepane" }
|
280
263
|
@paned.child1.visible = action.active?
|
281
264
|
end
|
282
265
|
|
283
266
|
def on_view_toolbar(action)
|
284
|
-
log.debug {
|
267
|
+
log.debug { "on_view_toolbar" }
|
285
268
|
@toolbar.visible = action.active?
|
286
269
|
end
|
287
270
|
|
288
271
|
def on_view_statusbar(action)
|
289
|
-
log.debug {
|
272
|
+
log.debug { "on_view_statusbar" }
|
290
273
|
@appbar.visible = action.active?
|
291
274
|
end
|
292
275
|
|
293
276
|
def on_reverse_order(action)
|
294
|
-
log.debug {
|
277
|
+
log.debug { "on_reverse_order" }
|
295
278
|
Preferences.instance.reverse_icons = action.active?
|
296
279
|
Preferences.instance.save!
|
297
280
|
setup_books_iconview_sorting
|
298
281
|
end
|
299
282
|
|
300
283
|
def connect_signals
|
301
|
-
|
302
|
-
['LibraryMenu', nil, _('_Library')],
|
303
|
-
['New', Gtk::Stock::NEW, _('_New Library'), '<control>L', _('Create a new library'), method(:on_new)],
|
304
|
-
['NewSmart', nil, _('New _Smart Library...'), '<control><shift>L', _('Create a new smart library'), method(:on_new_smart)],
|
305
|
-
['AddBook', Gtk::Stock::ADD, _('_Add Book...'), '<control>N', _('Add a new book from the Internet'), method(:on_add_book)],
|
306
|
-
['AddBookManual', nil, _('Add Book _Manually...'), '<control><shift>N', _('Add a new book manually'), method(:on_add_book_manual)],
|
307
|
-
['Import', nil, _('_Import...'), '<control>I', _('Import a library'), method(:on_import)],
|
308
|
-
['Export', nil, _('_Export...'), '<control><shift>E', _('Export the selected library'), method(:on_export)],
|
309
|
-
['Acquire', nil, _('A_cquire from Scanner...'), '<control><shift>S', _('Acquire books from a scanner'), method(:on_acquire)],
|
310
|
-
['Properties', Gtk::Stock::PROPERTIES, _('_Properties'), nil, _('Edit the properties of the selected book'), method(:on_properties)],
|
311
|
-
['Quit', Gtk::Stock::QUIT, _('_Quit'), '<control>Q', _('Quit the program'), method(:on_quit)],
|
312
|
-
['EditMenu', nil, _('_Edit')],
|
313
|
-
['Undo', Gtk::Stock::UNDO, _('_Undo'), '<control>Z', _('Undo the last action'), method(:on_undo)],
|
314
|
-
['Redo', Gtk::Stock::REDO, _('_Redo'), '<control><shift>Z', _('Redo the undone action'), method(:on_redo)],
|
315
|
-
['SelectAll', nil, _('_Select All'), '<control>A', _('Select all visible books'), method(:on_select_all)],
|
316
|
-
['DeselectAll', nil, _('Dese_lect All'), '<control><shift>A', _('Deselect everything'), method(:on_deselect_all)],
|
317
|
-
['SetRating', nil, _('My _Rating')],
|
318
|
-
['SetRating0', nil, _('None'), nil, nil, proc { on_set_rating[0].call }],
|
319
|
-
['SetRating1', nil, _('One Star'), nil, nil, proc { on_set_rating[1].call }],
|
320
|
-
['SetRating2', nil, _('Two Stars'), nil, nil, proc { on_set_rating[2].call }],
|
321
|
-
['SetRating3', nil, _('Three Stars'), nil, nil, proc { on_set_rating[3].call }],
|
322
|
-
['SetRating4', nil, _('Four Stars'), nil, nil, proc { on_set_rating[4].call }],
|
323
|
-
['SetRating5', nil, _('Five Stars'), nil, nil, proc { on_set_rating[5].call }],
|
324
|
-
['Move', nil, _('_Move')],
|
325
|
-
['Rename', nil, _('_Rename'), nil, nil, method(:on_rename)],
|
326
|
-
['Delete', Gtk::Stock::DELETE, _('_Delete'), 'Delete', _('Delete the selected books or library'), method(:on_delete)],
|
327
|
-
['Search', Gtk::Stock::FIND, _('_Search'), '<control>F', _('Filter books'), method(:on_search)],
|
328
|
-
['ClearSearchResult', Gtk::Stock::CLEAR, _('_Clear Results'), '<control><alt>B', _('Clear the search results'), method(:on_clear_search_results)],
|
329
|
-
['Preferences', Gtk::Stock::PREFERENCES, _('_Preferences'), '<control>O', _("Change Alexandria's settings"), method(:on_preferences)],
|
330
|
-
['ViewMenu', nil, _('_View')],
|
331
|
-
['ArrangeIcons', nil, _('Arran_ge Icons')],
|
332
|
-
['OnlineInformation', nil, _('Display Online _Information')],
|
333
|
-
|
334
|
-
['HelpMenu', nil, _('_Help')],
|
335
|
-
['SubmitBugReport', Gtk::Stock::EDIT, _('Submit _Bug Report'), nil, _('Submit a bug report to the developers'), method(:on_submit_bug_report)],
|
336
|
-
['Help', Gtk::Stock::HELP, _('Contents'), 'F1', _("View Alexandria's manual"), method(:on_help)],
|
337
|
-
['About', Gtk::Stock::ABOUT, _('_About'), nil, _('Show information about Alexandria'), method(:on_about)],
|
338
|
-
]
|
339
|
-
|
340
|
-
toggle_actions = [
|
341
|
-
['Sidepane', nil, _('Side _Pane'), 'F9', nil, method(:on_view_sidepane), true],
|
342
|
-
['Toolbar', nil, _('_Toolbar'), nil, nil, method(:on_view_toolbar), true],
|
343
|
-
['Statusbar', nil, _('_Statusbar'), nil, nil, method(:on_view_statusbar), true],
|
344
|
-
['ReversedOrder', nil, _('Re_versed Order'), nil, nil, method(:on_reverse_order)],
|
345
|
-
]
|
346
|
-
|
347
|
-
view_as_actions = [
|
348
|
-
['AsIcons', nil, _('View as _Icons'), nil, nil, 0],
|
349
|
-
['AsList', nil, _('View as _List'), nil, nil, 1]
|
350
|
-
]
|
351
|
-
|
352
|
-
arrange_icons_actions = [
|
353
|
-
['ByTitle', nil, _('By _Title'), nil, nil, 0],
|
354
|
-
['ByAuthors', nil, _('By _Authors'), nil, nil, 1],
|
355
|
-
['ByISBN', nil, _('By _ISBN'), nil, nil, 2],
|
356
|
-
['ByPublisher', nil, _('By _Publisher'), nil, nil, 3],
|
357
|
-
['ByEdition', nil, _('By _Binding'), nil, nil, 4],
|
358
|
-
['ByRating', nil, _('By _Rating'), nil, nil, 5]
|
359
|
-
]
|
360
|
-
providers_actions = BookProviders.map do |provider|
|
361
|
-
[provider.action_name, Gtk::Stock::JUMP_TO,
|
362
|
-
_('At _%s') % provider.fullname, nil, nil,
|
363
|
-
proc { open_web_browser(provider.url(selected_books.first)) }]
|
364
|
-
end
|
284
|
+
log.debug { "Adding actions to @actiongroup" }
|
365
285
|
|
366
|
-
|
286
|
+
@actiongroup = Gtk::ActionGroup.new("actions")
|
367
287
|
|
368
|
-
|
288
|
+
connect_standard_actions
|
289
|
+
connect_providers_actions
|
290
|
+
connect_toggle_actions
|
291
|
+
connect_view_actions
|
292
|
+
connect_arrange_icons_actions
|
293
|
+
end
|
369
294
|
|
370
|
-
|
371
|
-
action = Gtk::Action.new(name, label: label, tooltip: tooltip, stock_id: stock_id)
|
372
|
-
@actiongroup.add_action_with_accel(action, accelerator)
|
373
|
-
if callback
|
374
|
-
action.signal_connect('activate', &callback)
|
375
|
-
end
|
376
|
-
end
|
295
|
+
private
|
377
296
|
|
378
|
-
|
297
|
+
def connect_standard_actions
|
298
|
+
connect_actions standard_actions
|
299
|
+
end
|
300
|
+
|
301
|
+
def connect_providers_actions
|
302
|
+
connect_actions providers_actions
|
303
|
+
end
|
304
|
+
|
305
|
+
def connect_actions(actions)
|
306
|
+
actions.each do |name, stock_id, label, accelerator, tooltip, callback|
|
379
307
|
action = Gtk::Action.new(name, label: label, tooltip: tooltip, stock_id: stock_id)
|
380
308
|
@actiongroup.add_action_with_accel(action, accelerator)
|
381
|
-
if callback
|
382
|
-
action.signal_connect('activate', &callback)
|
383
|
-
end
|
309
|
+
action.signal_connect("activate", &callback) if callback
|
384
310
|
end
|
311
|
+
end
|
385
312
|
|
386
|
-
|
387
|
-
|
313
|
+
def connect_toggle_actions
|
314
|
+
toggle_actions
|
315
|
+
.each do |name, stock_id, label, accelerator, tooltip, callback, is_active|
|
316
|
+
action = Gtk::ToggleAction.new(name, label: label, tooltip: tooltip,
|
317
|
+
stock_id: stock_id)
|
388
318
|
action.set_active is_active
|
389
319
|
@actiongroup.add_action_with_accel(action, accelerator)
|
390
|
-
if callback
|
391
|
-
action.signal_connect('toggled', &callback)
|
392
|
-
end
|
320
|
+
action.signal_connect("toggled", &callback) if callback
|
393
321
|
end
|
322
|
+
end
|
394
323
|
|
395
|
-
|
396
|
-
first_action =
|
397
|
-
view_as_actions.each do |name, stock_id, label, accelerator, tooltip, value|
|
398
|
-
action = Gtk::RadioAction.new(name, value, label: label, tooltip: tooltip, stock_id: stock_id)
|
399
|
-
first_action = action unless group
|
400
|
-
action.set_group group
|
401
|
-
group = action.group
|
402
|
-
@actiongroup.add_action_with_accel(action, accelerator)
|
403
|
-
end
|
324
|
+
def connect_view_actions
|
325
|
+
first_action = connect_radio_actions view_as_actions
|
404
326
|
|
405
|
-
first_action.signal_connect
|
327
|
+
first_action.signal_connect "changed" do |_action, current, _user_data|
|
406
328
|
@notebook.page = current.current_value
|
407
329
|
hid = @toolbar_view_as_signal_hid
|
408
330
|
@toolbar_view_as.signal_handler_block(hid) do
|
409
331
|
@toolbar_view_as.active = current.current_value
|
410
332
|
end
|
411
333
|
end
|
334
|
+
end
|
412
335
|
|
413
|
-
|
414
|
-
first_action =
|
415
|
-
arrange_icons_actions.each do |name, stock_id, label, accelerator, tooltip, value|
|
416
|
-
action = Gtk::RadioAction.new(name, value, label: label, tooltip: tooltip, stock_id: stock_id)
|
417
|
-
first_action = action unless group
|
418
|
-
action.set_group group
|
419
|
-
group = action.group
|
420
|
-
@actiongroup.add_action_with_accel(action, accelerator)
|
421
|
-
end
|
336
|
+
def connect_arrange_icons_actions
|
337
|
+
first_action = connect_radio_actions arrange_icons_actions
|
422
338
|
|
423
|
-
first_action.signal_connect
|
339
|
+
first_action.signal_connect "changed" do |_action, current, _user_data|
|
424
340
|
@prefs.arrange_icons_mode = current.current_value
|
425
341
|
setup_books_iconview_sorting
|
426
342
|
end
|
427
343
|
end
|
344
|
+
|
345
|
+
def connect_radio_actions(actions)
|
346
|
+
first_action = nil
|
347
|
+
actions.each do |name, stock_id, label, accelerator, tooltip, value|
|
348
|
+
action = Gtk::RadioAction.new(name, value, label: label, tooltip: tooltip,
|
349
|
+
stock_id: stock_id)
|
350
|
+
if first_action
|
351
|
+
action.join_group first_action
|
352
|
+
else
|
353
|
+
first_action = action
|
354
|
+
end
|
355
|
+
@actiongroup.add_action_with_accel(action, accelerator)
|
356
|
+
end
|
357
|
+
first_action
|
358
|
+
end
|
359
|
+
|
360
|
+
def standard_actions
|
361
|
+
# rubocop:disable Layout/LineLength
|
362
|
+
[["LibraryMenu", nil, _("_Library")],
|
363
|
+
["New", Gtk::Stock::NEW, _("_New Library"), "<control>L", _("Create a new library"), method(:on_new)],
|
364
|
+
["NewSmart", nil, _("New _Smart Library..."), "<control><shift>L", _("Create a new smart library"), method(:on_new_smart)],
|
365
|
+
["AddBook", Gtk::Stock::ADD, _("_Add Book..."), "<control>N", _("Add a new book from the Internet"), method(:on_add_book)],
|
366
|
+
["AddBookManual", nil, _("Add Book _Manually..."), "<control><shift>N", _("Add a new book manually"), method(:on_add_book_manual)],
|
367
|
+
["Import", nil, _("_Import..."), "<control>I", _("Import a library"), method(:on_import)],
|
368
|
+
["Export", nil, _("_Export..."), "<control><shift>E", _("Export the selected library"), method(:on_export)],
|
369
|
+
["Acquire", nil, _("A_cquire from Scanner..."), "<control><shift>S", _("Acquire books from a scanner"), method(:on_acquire)],
|
370
|
+
["Properties", Gtk::Stock::PROPERTIES, _("_Properties"), nil, _("Edit the properties of the selected book"), method(:on_properties)],
|
371
|
+
["Quit", Gtk::Stock::QUIT, _("_Quit"), "<control>Q", _("Quit the program"), method(:on_quit)],
|
372
|
+
["EditMenu", nil, _("_Edit")],
|
373
|
+
["Undo", Gtk::Stock::UNDO, _("_Undo"), "<control>Z", _("Undo the last action"), method(:on_undo)],
|
374
|
+
["Redo", Gtk::Stock::REDO, _("_Redo"), "<control><shift>Z", _("Redo the undone action"), method(:on_redo)],
|
375
|
+
["SelectAll", nil, _("_Select All"), "<control>A", _("Select all visible books"), method(:on_select_all)],
|
376
|
+
["DeselectAll", nil, _("Dese_lect All"), "<control><shift>A", _("Deselect everything"), method(:on_deselect_all)],
|
377
|
+
["SetRating", nil, _("My _Rating")],
|
378
|
+
["SetRating0", nil, _("None"), nil, nil, proc { on_set_rating[0].call }],
|
379
|
+
["SetRating1", nil, _("One Star"), nil, nil, proc { on_set_rating[1].call }],
|
380
|
+
["SetRating2", nil, _("Two Stars"), nil, nil, proc { on_set_rating[2].call }],
|
381
|
+
["SetRating3", nil, _("Three Stars"), nil, nil, proc { on_set_rating[3].call }],
|
382
|
+
["SetRating4", nil, _("Four Stars"), nil, nil, proc { on_set_rating[4].call }],
|
383
|
+
["SetRating5", nil, _("Five Stars"), nil, nil, proc { on_set_rating[5].call }],
|
384
|
+
["Move", nil, _("_Move")],
|
385
|
+
["Rename", nil, _("_Rename"), nil, nil, method(:on_rename)],
|
386
|
+
["Delete", Gtk::Stock::DELETE, _("_Delete"), "Delete", _("Delete the selected books or library"), method(:on_delete)],
|
387
|
+
["Search", Gtk::Stock::FIND, _("_Search"), "<control>F", _("Filter books"), method(:on_search)],
|
388
|
+
["ClearSearchResult", Gtk::Stock::CLEAR, _("_Clear Results"), "<control><alt>B", _("Clear the search results"), method(:on_clear_search_results)],
|
389
|
+
["Preferences", Gtk::Stock::PREFERENCES, _("_Preferences"), "<control>O", _("Change Alexandria's settings"), method(:on_preferences)],
|
390
|
+
["ViewMenu", nil, _("_View")],
|
391
|
+
["ArrangeIcons", nil, _("Arran_ge Icons")],
|
392
|
+
["OnlineInformation", nil, _("Display Online _Information")],
|
393
|
+
|
394
|
+
["HelpMenu", nil, _("_Help")],
|
395
|
+
["SubmitBugReport", Gtk::Stock::EDIT, _("Submit _Bug Report"), nil, _("Submit a bug report to the developers"), method(:on_submit_bug_report)],
|
396
|
+
["Help", Gtk::Stock::HELP, _("Contents"), "F1", _("View Alexandria's manual"), method(:on_help)],
|
397
|
+
["About", Gtk::Stock::ABOUT, _("_About"), nil, _("Show information about Alexandria"), method(:on_about)]]
|
398
|
+
# rubocop:enable Layout/LineLength
|
399
|
+
end
|
400
|
+
|
401
|
+
def providers_actions
|
402
|
+
BookProviders.list.map do |provider|
|
403
|
+
[provider.action_name, Gtk::Stock::JUMP_TO,
|
404
|
+
_("At _%s") % provider.fullname, nil, nil,
|
405
|
+
proc { open_web_browser(provider.url(selected_books.first)) }]
|
406
|
+
end
|
407
|
+
end
|
408
|
+
|
409
|
+
def toggle_actions
|
410
|
+
[["Sidepane", nil, _("Side_pane"), "F9", nil, method(:on_view_sidepane), true],
|
411
|
+
["Toolbar", nil, _("_Toolbar"), nil, nil, method(:on_view_toolbar), true],
|
412
|
+
["Statusbar", nil, _("_Statusbar"), nil, nil, method(:on_view_statusbar), true],
|
413
|
+
["ReversedOrder", nil, _("Re_versed Order"), nil, nil,
|
414
|
+
method(:on_reverse_order), false]]
|
415
|
+
end
|
416
|
+
|
417
|
+
def view_as_actions
|
418
|
+
[["AsIcons", nil, _("View as _Icons"), nil, nil, 0],
|
419
|
+
["AsList", nil, _("View as _List"), nil, nil, 1]]
|
420
|
+
end
|
421
|
+
|
422
|
+
def arrange_icons_actions
|
423
|
+
[["ByTitle", nil, _("By _Title"), nil, nil, 0],
|
424
|
+
["ByAuthors", nil, _("By _Authors"), nil, nil, 1],
|
425
|
+
["ByISBN", nil, _("By _ISBN"), nil, nil, 2],
|
426
|
+
["ByPublisher", nil, _("By _Publisher"), nil, nil, 3],
|
427
|
+
["ByEdition", nil, _("By _Binding"), nil, nil, 4],
|
428
|
+
["ByRating", nil, _("By _Rating"), nil, nil, 5]]
|
429
|
+
end
|
428
430
|
end
|
429
431
|
end
|
430
432
|
end
|