alexandria-book-collection-manager 0.7.2 → 0.7.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +9 -0
- data/.github/workflows/ruby.yml +77 -0
- data/.gitignore +5 -1
- data/.hound.yml +2 -0
- data/.rubocop.yml +87 -37
- data/.rubocop_todo.yml +62 -191
- data/.simplecov +5 -2
- data/CHANGELOG.md +63 -0
- data/Gemfile +4 -3
- data/INSTALL.md +26 -14
- data/README.md +52 -42
- data/Rakefile +93 -109
- data/TODO.md +9 -1
- data/alexandria-book-collection-manager.gemspec +50 -43
- data/bin/alexandria +30 -53
- data/doc/FAQ +2 -6
- data/doc/dependency_decisions.yml +27 -8
- data/lib/alexandria.rb +27 -37
- data/lib/alexandria/about.rb +50 -50
- data/lib/alexandria/book_providers.rb +90 -97
- data/lib/alexandria/book_providers/adlibris.rb +41 -76
- data/lib/alexandria/book_providers/amazon_aws.rb +96 -100
- data/lib/alexandria/book_providers/amazon_ecs_util.rb +295 -322
- data/lib/alexandria/book_providers/barnes_and_noble.rb +48 -45
- data/lib/alexandria/book_providers/douban.rb +26 -42
- data/lib/alexandria/book_providers/proxis.rb +44 -55
- data/lib/alexandria/book_providers/pseudomarc.rb +77 -85
- data/lib/alexandria/book_providers/siciliano.rb +64 -65
- data/lib/alexandria/book_providers/thalia.rb +42 -41
- data/lib/alexandria/book_providers/web.rb +15 -33
- data/lib/alexandria/book_providers/worldcat.rb +70 -97
- data/lib/alexandria/book_providers/z3950.rb +160 -173
- data/lib/alexandria/config.rb +1 -1
- data/lib/alexandria/console.rb +8 -21
- data/lib/alexandria/default_preferences.rb +37 -0
- data/lib/alexandria/execution_queue.rb +15 -13
- data/lib/alexandria/export_format.rb +47 -0
- data/lib/alexandria/export_library.rb +193 -300
- data/lib/alexandria/import_library.rb +108 -141
- data/lib/alexandria/import_library_csv.rb +43 -46
- 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 +11 -13
- data/lib/alexandria/models/book.rb +13 -20
- data/lib/alexandria/models/library.rb +81 -353
- data/lib/alexandria/net.rb +5 -6
- data/lib/alexandria/preferences.rb +73 -87
- data/lib/alexandria/scanners.rb +2 -2
- data/lib/alexandria/scanners/{cuecat.rb → cue_cat.rb} +20 -18
- data/lib/alexandria/scanners/keyboard.rb +8 -8
- data/lib/alexandria/smart_library.rb +133 -170
- data/lib/alexandria/ui.rb +15 -15
- data/lib/alexandria/ui/about_dialog.rb +49 -0
- data/lib/alexandria/ui/{dialogs/acquire_dialog.rb → acquire_dialog.rb} +119 -136
- 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} +16 -15
- data/lib/alexandria/ui/{dialogs/book_properties_dialog.rb → book_properties_dialog.rb} +39 -52
- data/lib/alexandria/ui/book_properties_dialog_base.rb +318 -0
- data/lib/alexandria/ui/builder_base.rb +7 -27
- data/lib/alexandria/ui/calendar_popup.rb +58 -0
- data/lib/alexandria/ui/callbacks.rb +189 -183
- data/lib/alexandria/ui/completion_models.rb +10 -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 +7 -7
- data/lib/alexandria/ui/error_dialog.rb +25 -0
- data/lib/alexandria/ui/export_dialog.rb +142 -0
- data/lib/alexandria/ui/icons.rb +47 -63
- data/lib/alexandria/ui/iconview.rb +12 -10
- data/lib/alexandria/ui/iconview_tooltips.rb +41 -54
- data/lib/alexandria/ui/import_dialog.rb +157 -0
- data/lib/alexandria/ui/init.rb +21 -33
- data/lib/alexandria/ui/keep_bad_isbn_dialog.rb +36 -0
- data/lib/alexandria/ui/libraries_combo.rb +16 -14
- data/lib/alexandria/ui/listview.rb +73 -87
- data/lib/alexandria/ui/main_app.rb +24 -26
- data/lib/alexandria/ui/misc_dialogs.rb +10 -0
- data/lib/alexandria/ui/multi_drag_treeview.rb +28 -41
- data/lib/alexandria/ui/{dialogs/new_book_dialog.rb → new_book_dialog.rb} +156 -194
- 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} +56 -68
- 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/smart_library_properties_dialog_base.rb +242 -0
- data/lib/alexandria/ui/smart_library_rule_box.rb +119 -0
- data/lib/alexandria/ui/sound.rb +11 -13
- data/lib/alexandria/ui/ui_manager.rb +236 -251
- data/lib/alexandria/undo_manager.rb +1 -0
- data/lib/alexandria/version.rb +4 -19
- data/lib/alexandria/web_themes.rb +22 -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 +1017 -974
- 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 +75 -171
- data/spec/alexandria/book_spec.rb +12 -10
- data/spec/alexandria/console_spec.rb +27 -0
- data/spec/alexandria/export_library_spec.rb +130 -0
- data/spec/alexandria/library_spec.rb +128 -172
- data/spec/alexandria/library_store_spec.rb +37 -0
- data/spec/alexandria/preferences_spec.rb +44 -17
- data/spec/alexandria/scanners/cue_cat_spec.rb +52 -0
- data/spec/alexandria/smart_library_spec.rb +30 -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 +36 -0
- data/spec/alexandria/ui/icons_spec.rb +26 -0
- data/spec/alexandria/ui/iconview_spec.rb +7 -21
- data/spec/alexandria/ui/import_dialog_spec.rb +46 -0
- data/spec/alexandria/ui/keep_bad_isbn_dialog_spec.rb +17 -0
- data/spec/alexandria/ui/main_app_spec.rb +7 -34
- 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 +49 -0
- data/spec/alexandria/ui/sound_spec.rb +2 -2
- data/spec/alexandria/ui/ui_manager_spec.rb +43 -20
- data/spec/end_to_end/basic_run_spec.rb +52 -0
- data/spec/spec_helper.rb +65 -33
- data/tasks/setup.rb +2 -2
- data/tasks/spec.rake +16 -3
- data/util/rake/fileinstall.rb +39 -35
- data/util/rake/gettextgenerate.rb +7 -7
- data/util/rake/omfgenerate.rb +7 -7
- metadata +178 -45
- data/dogtail/basic_run_test.py +0 -9
- data/lib/alexandria/book_providers/deastore.rb +0 -265
- data/lib/alexandria/book_providers/mcu.rb +0 -182
- data/lib/alexandria/book_providers/renaud.rb +0 -149
- data/lib/alexandria/ui/dialogs/about_dialog.rb +0 -61
- data/lib/alexandria/ui/dialogs/alert_dialog.rb +0 -72
- data/lib/alexandria/ui/dialogs/bad_isbns_dialog.rb +0 -51
- data/lib/alexandria/ui/dialogs/book_properties_dialog_base.rb +0 -426
- 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 -87
- 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 -568
- data/lib/alexandria/ui/dialogs/smart_library_properties_dialog.rb +0 -59
- data/lib/alexandria/ui/dialogs/smart_library_properties_dialog_base.rb +0 -420
- data/spec/alexandria/scanners/cuecat_spec.rb +0 -67
- data/spec/alexandria/ui/dialogs_spec.rb +0 -96
- data/spec/alexandria/ui/sidepane_spec.rb +0 -29
- data/spec/alexandria/ui/ui_utilities_spec.rb +0 -62
- data/spec/alexandria/utilities_spec.rb +0 -52
- data/tasks/dogtail.rake +0 -6
@@ -1,37 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
#
|
4
|
-
# Copyright (C) 2008 Joseph Method
|
5
|
-
# Copyright (C) 2010 Cathal Mc Ginley
|
6
|
-
# Copyright (C) 2011, 2016 Matijs van Zuijlen
|
3
|
+
# This file is part of Alexandria.
|
7
4
|
#
|
8
|
-
#
|
9
|
-
# modify it under the terms of the GNU General Public License aso
|
10
|
-
# published by the Free Software Foundation; either version 2 of the
|
11
|
-
# License, or (at your option) any later version.
|
12
|
-
#
|
13
|
-
# Alexandria is distributed in the hope that it will be useful,
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
16
|
-
# General Public License for more details.
|
17
|
-
#
|
18
|
-
# You should have received a copy of the GNU General Public
|
19
|
-
# License along with Alexandria; see the file COPYING. If not,
|
20
|
-
# write to the Free Software Foundation, Inc., 51 Franklin Street,
|
21
|
-
# Fifth Floor, Boston, MA 02110-1301 USA.
|
5
|
+
# See the file README.md for authorship and licensing information.
|
22
6
|
|
23
|
-
require
|
7
|
+
require "alexandria/ui/columns"
|
24
8
|
|
25
9
|
module Alexandria
|
26
10
|
module UI
|
27
11
|
include Logging
|
28
12
|
include GetText
|
29
|
-
GetText.bindtextdomain(Alexandria::TEXTDOMAIN, charset:
|
13
|
+
GetText.bindtextdomain(Alexandria::TEXTDOMAIN, charset: "UTF-8")
|
30
14
|
class ListViewManager
|
31
15
|
include Logging
|
32
16
|
include GetText
|
33
17
|
include DragAndDropable
|
34
|
-
BOOKS_TARGET_TABLE = [[
|
18
|
+
BOOKS_TARGET_TABLE = [["ALEXANDRIA_BOOKS", :same_app, 0]].freeze
|
35
19
|
|
36
20
|
def initialize(_listview, parent)
|
37
21
|
@parent = parent
|
@@ -45,18 +29,18 @@ module Alexandria
|
|
45
29
|
end
|
46
30
|
|
47
31
|
def setup_title_column
|
48
|
-
title = _(
|
49
|
-
log.debug { format(
|
32
|
+
title = _("Title")
|
33
|
+
log.debug { format("Create listview column for %s", title) }
|
50
34
|
column = Gtk::TreeViewColumn.new(title)
|
51
35
|
|
52
36
|
renderer = Gtk::CellRendererPixbuf.new
|
53
37
|
column.pack_start(renderer, false)
|
54
|
-
column.add_attribute(renderer,
|
38
|
+
column.add_attribute(renderer, "pixbuf", Columns::COVER_LIST)
|
55
39
|
|
56
40
|
renderer = Gtk::CellRendererText.new
|
57
41
|
renderer.ellipsize = :end
|
58
42
|
column.pack_start(renderer, true)
|
59
|
-
column.add_attribute(renderer,
|
43
|
+
column.add_attribute(renderer, "text", Columns::TITLE)
|
60
44
|
|
61
45
|
column.sort_column_id = Columns::TITLE
|
62
46
|
column.resizable = true
|
@@ -64,21 +48,21 @@ module Alexandria
|
|
64
48
|
end
|
65
49
|
|
66
50
|
TEXT_COLUMNS = [
|
67
|
-
[_(
|
68
|
-
[_(
|
69
|
-
[_(
|
70
|
-
[_(
|
71
|
-
[_(
|
72
|
-
[_(
|
51
|
+
[_("Authors"), Columns::AUTHORS],
|
52
|
+
[_("ISBN"), Columns::ISBN],
|
53
|
+
[_("Publisher"), Columns::PUBLISHER],
|
54
|
+
[_("Publish Year"), Columns::PUBLISH_DATE],
|
55
|
+
[_("Binding"), Columns::EDITION],
|
56
|
+
[_("Loaned To"), Columns::LOANED_TO]
|
73
57
|
].freeze
|
74
58
|
CHECK_COLUMNS = [
|
75
|
-
[_(
|
76
|
-
[_(
|
77
|
-
[_(
|
59
|
+
[_("Read"), Columns::REDD],
|
60
|
+
[_("Own"), Columns::OWN],
|
61
|
+
[_("Want"), Columns::WANT]
|
78
62
|
].freeze
|
79
63
|
|
80
64
|
def setup_books_listview
|
81
|
-
log.debug {
|
65
|
+
log.debug { "setup_books_listview" }
|
82
66
|
@listview.model = @listview_model
|
83
67
|
setup_title_column
|
84
68
|
TEXT_COLUMNS.each do |title, iterid|
|
@@ -89,8 +73,8 @@ module Alexandria
|
|
89
73
|
end
|
90
74
|
setup_rating_column
|
91
75
|
@listview.selection.mode = :multiple
|
92
|
-
@listview.selection.signal_connect(
|
93
|
-
log.debug {
|
76
|
+
@listview.selection.signal_connect("changed") do
|
77
|
+
log.debug { "changed" }
|
94
78
|
@parent.on_books_selection_changed
|
95
79
|
end
|
96
80
|
setup_tags_column
|
@@ -99,9 +83,8 @@ module Alexandria
|
|
99
83
|
end
|
100
84
|
|
101
85
|
def setup_tags_column
|
102
|
-
|
103
|
-
|
104
|
-
log.debug { 'Create listview column for tags...' }
|
86
|
+
title = _("Tags")
|
87
|
+
log.debug { "Create listview column for tags" }
|
105
88
|
renderer = Gtk::CellRendererText.new
|
106
89
|
renderer.ellipsize = :end
|
107
90
|
column = Gtk::TreeViewColumn.new(title, renderer,
|
@@ -112,16 +95,16 @@ module Alexandria
|
|
112
95
|
end
|
113
96
|
|
114
97
|
def setup_row_activation
|
115
|
-
@listview.signal_connect(
|
116
|
-
log.debug {
|
117
|
-
@actiongroup[
|
98
|
+
@listview.signal_connect("row-activated") do
|
99
|
+
log.debug { "row-activated" }
|
100
|
+
@actiongroup["Properties"].activate
|
118
101
|
false
|
119
102
|
end
|
120
103
|
end
|
121
104
|
|
122
105
|
def setup_rating_column
|
123
|
-
title = _(
|
124
|
-
log.debug { format(
|
106
|
+
title = _("Rating")
|
107
|
+
log.debug { format("Create listview column for %s", title) }
|
125
108
|
column = Gtk::TreeViewColumn.new(title)
|
126
109
|
column.sizing = :fixed
|
127
110
|
width = (Icons::STAR_SET.width + 1) * Book::MAX_RATING_STARS
|
@@ -132,8 +115,7 @@ module Alexandria
|
|
132
115
|
column.pack_start(renderer, false)
|
133
116
|
column.set_cell_data_func(renderer) do |_tree_column, cell, _tree_model, iter|
|
134
117
|
rating = (iter[Columns::RATING] - Book::MAX_RATING_STARS).abs
|
135
|
-
cell.pixbuf = rating >= i.succ ?
|
136
|
-
Icons::STAR_SET : Icons::STAR_UNSET
|
118
|
+
cell.pixbuf = rating >= i.succ ? Icons::STAR_SET : Icons::STAR_UNSET
|
137
119
|
end
|
138
120
|
end
|
139
121
|
column.sort_column_id = Columns::RATING
|
@@ -144,56 +126,56 @@ module Alexandria
|
|
144
126
|
def setup_check_column(title, iterid)
|
145
127
|
renderer = CellRendererToggle.new
|
146
128
|
renderer.activatable = true
|
147
|
-
renderer.signal_connect(
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
when Columns::WANT then book.want = toggle_state
|
170
|
-
end
|
171
|
-
iter[iterid] = toggle_state
|
172
|
-
lib = @parent.selected_library
|
173
|
-
lib.save(book)
|
129
|
+
renderer.signal_connect("toggled") do |_rndrr, path|
|
130
|
+
tree_path = Gtk::TreePath.new(path)
|
131
|
+
child_path = @listview_model.convert_path_to_child_path(tree_path)
|
132
|
+
if child_path
|
133
|
+
unfiltered_path = @filtered_model.convert_path_to_child_path(child_path)
|
134
|
+
# FIX this sometimes returns a nil path for iconview...
|
135
|
+
if unfiltered_path
|
136
|
+
iter = @model.get_iter(unfiltered_path)
|
137
|
+
if iter
|
138
|
+
book = @parent.book_from_iter(@parent.selected_library, iter)
|
139
|
+
toggle_state = case iterid
|
140
|
+
when Columns::REDD then book.redd
|
141
|
+
when Columns::OWN then book.own
|
142
|
+
when Columns::WANT then book.want
|
143
|
+
end
|
144
|
+
# invert toggle_state
|
145
|
+
unless iterid == Columns::WANT && book.own
|
146
|
+
toggle_state = !toggle_state
|
147
|
+
case iterid
|
148
|
+
when Columns::REDD then book.redd = toggle_state
|
149
|
+
when Columns::OWN then book.own = toggle_state
|
150
|
+
when Columns::WANT then book.want = toggle_state
|
174
151
|
end
|
152
|
+
iter[iterid] = toggle_state
|
153
|
+
lib = @parent.selected_library
|
154
|
+
lib.save(book)
|
175
155
|
end
|
176
156
|
end
|
177
|
-
|
178
157
|
end
|
179
|
-
|
180
|
-
log.error { "toggle failed for path #{path} #{e}\n" + e.backtrace.join("\n") }
|
158
|
+
|
181
159
|
end
|
160
|
+
rescue StandardError => ex
|
161
|
+
log.error { "toggle failed for path #{path} #{ex}\n" + e.backtrace.join("\n") }
|
182
162
|
end
|
183
163
|
column = Gtk::TreeViewColumn.new(title, renderer, text: iterid)
|
184
164
|
column.sort_column_id = iterid
|
185
165
|
column.resizable = true
|
186
|
-
log.debug { format(
|
166
|
+
log.debug { format("Create listview column for %s", title) }
|
187
167
|
|
188
|
-
column.add_attribute(renderer,
|
189
|
-
|
168
|
+
column.add_attribute(renderer, "active", iterid)
|
169
|
+
if iterid == Columns::WANT
|
170
|
+
column.add_attribute(renderer, "inconsistent", Columns::OWN)
|
171
|
+
end
|
190
172
|
|
191
173
|
log.debug { "append_column #{column}" }
|
192
174
|
@listview.append_column(column)
|
193
175
|
end
|
194
176
|
|
195
177
|
def setup_text_column(title, iterid)
|
196
|
-
log.debug { format(
|
178
|
+
log.debug { format("Create listview column for %s", title) }
|
197
179
|
renderer = Gtk::CellRendererText.new
|
198
180
|
renderer.ellipsize = :end
|
199
181
|
column = Gtk::TreeViewColumn.new(title, renderer,
|
@@ -204,7 +186,7 @@ module Alexandria
|
|
204
186
|
end
|
205
187
|
|
206
188
|
def setup_listview_columns_visibility
|
207
|
-
log.debug {
|
189
|
+
log.debug { "setup_listview_columns_visibility" }
|
208
190
|
# Show or hide list view columns according to the preferences.
|
209
191
|
cols_visibility = [
|
210
192
|
@prefs.col_authors_visible,
|
@@ -223,7 +205,10 @@ module Alexandria
|
|
223
205
|
cols.each_index do |i|
|
224
206
|
cols[i].visible = cols_visibility[i]
|
225
207
|
end
|
226
|
-
log.debug
|
208
|
+
log.debug do
|
209
|
+
"Columns visibility: " +
|
210
|
+
cols.map { |col| "#{col.title} #{col.visible?}" }.join(", ")
|
211
|
+
end
|
227
212
|
end
|
228
213
|
|
229
214
|
# Sets the width of each column based on any respective
|
@@ -238,15 +223,16 @@ module Alexandria
|
|
238
223
|
log.debug { "#{c.title} : #{cols_width[c.title]}" }
|
239
224
|
width = cols_width[c.title]
|
240
225
|
next if width.zero?
|
226
|
+
|
241
227
|
c.sizing = :fixed
|
242
228
|
c.fixed_width = width
|
243
229
|
end
|
244
230
|
end
|
245
231
|
end
|
246
|
-
log.debug
|
247
|
-
|
248
|
-
@listview.columns.map { |col| "#{col.title} #{col.width}" }.join(
|
249
|
-
|
232
|
+
log.debug do
|
233
|
+
"Columns width: " +
|
234
|
+
@listview.columns.map { |col| "#{col.title} #{col.width}" }.join(", ")
|
235
|
+
end
|
250
236
|
end
|
251
237
|
end
|
252
238
|
end
|
@@ -19,43 +19,41 @@
|
|
19
19
|
# write to the Free Software Foundation, Inc., 51 Franklin Street,
|
20
20
|
# Fifth Floor, Boston, MA 02110-1301 USA.
|
21
21
|
|
22
|
-
require
|
23
|
-
|
24
|
-
require
|
25
|
-
require
|
26
|
-
require
|
27
|
-
require
|
28
|
-
require
|
29
|
-
require
|
30
|
-
require
|
31
|
-
require
|
32
|
-
require
|
33
|
-
require
|
34
|
-
require
|
35
|
-
require
|
36
|
-
require
|
37
|
-
require
|
38
|
-
require
|
39
|
-
require
|
40
|
-
require
|
41
|
-
require
|
42
|
-
require 'alexandria/ui/iconview'
|
43
|
-
require 'alexandria/ui/sidepane'
|
22
|
+
require "alexandria/ui/alert_dialog"
|
23
|
+
require "alexandria/ui/about_dialog"
|
24
|
+
require "alexandria/ui/book_properties_dialog_base"
|
25
|
+
require "alexandria/ui/book_properties_dialog"
|
26
|
+
require "alexandria/ui/new_book_dialog_manual"
|
27
|
+
require "alexandria/ui/new_book_dialog"
|
28
|
+
require "alexandria/ui/preferences_dialog"
|
29
|
+
require "alexandria/ui/export_dialog"
|
30
|
+
require "alexandria/ui/import_dialog"
|
31
|
+
require "alexandria/ui/acquire_dialog"
|
32
|
+
require "alexandria/ui/smart_library_properties_dialog_base"
|
33
|
+
require "alexandria/ui/smart_library_properties_dialog"
|
34
|
+
require "alexandria/ui/new_smart_library_dialog"
|
35
|
+
require "alexandria/ui/bad_isbns_dialog"
|
36
|
+
require "alexandria/ui/dndable"
|
37
|
+
require "alexandria/ui/init"
|
38
|
+
require "alexandria/ui/ui_manager"
|
39
|
+
require "alexandria/ui/listview"
|
40
|
+
require "alexandria/ui/iconview"
|
41
|
+
require "alexandria/ui/sidepane_manager"
|
44
42
|
|
45
43
|
module Alexandria
|
46
44
|
module UI
|
47
45
|
include Logging
|
48
46
|
include GetText
|
49
|
-
GetText.bindtextdomain(Alexandria::TEXTDOMAIN, charset:
|
47
|
+
GetText.bindtextdomain(Alexandria::TEXTDOMAIN, charset: "UTF-8")
|
50
48
|
|
51
49
|
class MainApp
|
52
50
|
include Logging
|
53
51
|
include GetText
|
54
52
|
include Singleton
|
55
|
-
attr_accessor :main_app, :libraries, :actiongroup, :appbar, :prefs
|
56
|
-
|
53
|
+
attr_accessor :main_app, :libraries, :actiongroup, :appbar, :prefs, :ui_manager
|
54
|
+
|
57
55
|
def initialize
|
58
|
-
log.info {
|
56
|
+
log.info { "Starting MainApp" }
|
59
57
|
@ui_manager = UIManager.new self
|
60
58
|
@actiongroup = @ui_manager.actiongroup
|
61
59
|
@appbar = @ui_manager.appbar
|
@@ -1,49 +1,36 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
#
|
4
|
-
# Copyright (C) 2011, 2016 Matijs van Zuijlen
|
3
|
+
# This file is part of Alexandria.
|
5
4
|
#
|
6
|
-
#
|
7
|
-
# modify it under the terms of the GNU General Public License as
|
8
|
-
# published by the Free Software Foundation; either version 2 of the
|
9
|
-
# License, or (at your option) any later version.
|
10
|
-
#
|
11
|
-
# Alexandria is distributed in the hope that it will be useful,
|
12
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
-
# General Public License for more details.
|
15
|
-
#
|
16
|
-
# You should have received a copy of the GNU General Public
|
17
|
-
# License along with Alexandria; see the file COPYING. If not,
|
18
|
-
# write to the Free Software Foundation, Inc., 51 Franklin Street,
|
19
|
-
# Fifth Floor, Boston, MA 02110-1301 USA.
|
5
|
+
# See the file README.md for authorship and licensing information.
|
20
6
|
|
21
7
|
module Alexandria
|
22
8
|
module EventOverrides
|
23
|
-
def ==(
|
24
|
-
|
9
|
+
def ==(other)
|
10
|
+
other.is_a?(self.class) &&
|
11
|
+
(time == other.time) && (x == other.x) && (y == other.y) &&
|
12
|
+
(button == other.button)
|
25
13
|
end
|
26
14
|
end
|
27
15
|
|
28
16
|
module TreeViewOverrides
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
17
|
+
Context = Struct.new(:pressed_button,
|
18
|
+
:x,
|
19
|
+
:y,
|
20
|
+
:cell_x,
|
21
|
+
:cell_y,
|
22
|
+
:button_press_handler,
|
23
|
+
:motion_notify_handler,
|
24
|
+
:button_release_handler,
|
25
|
+
:drag_data_get_handler,
|
26
|
+
:events,
|
27
|
+
:source_start_button_mask,
|
28
|
+
:source_targets,
|
29
|
+
:source_actions,
|
30
|
+
:pending_event,
|
31
|
+
:drag_context)
|
32
|
+
|
33
|
+
class Context
|
47
34
|
def initialize(*ary)
|
48
35
|
super
|
49
36
|
self.events ||= []
|
@@ -63,7 +50,7 @@ module Alexandria
|
|
63
50
|
@context.source_actions = actions
|
64
51
|
|
65
52
|
@context.button_press_handler =
|
66
|
-
signal_connect(
|
53
|
+
signal_connect("button_press_event") do |_widget, event, _data|
|
67
54
|
button_press_event(event)
|
68
55
|
end
|
69
56
|
end
|
@@ -76,6 +63,7 @@ module Alexandria
|
|
76
63
|
|
77
64
|
def stop_drag_check
|
78
65
|
raise if @context.nil?
|
66
|
+
|
79
67
|
@context.events.clear
|
80
68
|
@context.pending_event = false
|
81
69
|
signal_handler_disconnect(@context.motion_notify_handler)
|
@@ -116,13 +104,12 @@ module Alexandria
|
|
116
104
|
path, _, cell_x, cell_y = get_path_at_pos(event.x, event.y)
|
117
105
|
return false if path.nil?
|
118
106
|
|
119
|
-
# call_parent = (event.state.control_mask? or event.state.shift_mask?) or !selected or event.button != 1
|
120
107
|
(call_parent = !selection.path_is_selected?(path)) ||
|
121
108
|
(event.button != 1)
|
122
109
|
|
123
110
|
if call_parent
|
124
111
|
signal_handler_block(@context.button_press_handler) do
|
125
|
-
signal_emit(
|
112
|
+
signal_emit("button_press_event", event)
|
126
113
|
end
|
127
114
|
end
|
128
115
|
|
@@ -134,11 +121,11 @@ module Alexandria
|
|
134
121
|
@context.cell_x = cell_x
|
135
122
|
@context.cell_y = cell_y
|
136
123
|
@context.motion_notify_handler =
|
137
|
-
signal_connect(
|
124
|
+
signal_connect("motion_notify_event") do |_widget, evnt, _data|
|
138
125
|
motion_notify_event(evnt)
|
139
126
|
end
|
140
127
|
@context.button_release_handler =
|
141
|
-
signal_connect(
|
128
|
+
signal_connect("button_release_event") do |_widget, evnt, _data|
|
142
129
|
button_release_event(evnt)
|
143
130
|
end
|
144
131
|
@context.events << event unless call_parent
|