alexandria-book-collection-manager 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.hound.yml +2 -0
- data/.rubocop.yml +4 -4
- data/.rubocop_todo.yml +55 -82
- data/CHANGELOG.md +17 -0
- data/INSTALL.md +3 -3
- data/README.md +1 -2
- data/Rakefile +14 -33
- data/TODO.md +9 -1
- data/alexandria-book-collection-manager.gemspec +4 -3
- data/bin/alexandria +21 -34
- data/doc/FAQ +2 -5
- data/lib/alexandria.rb +4 -16
- data/lib/alexandria/book_providers.rb +5 -7
- data/lib/alexandria/book_providers/adlibris.rb +5 -3
- data/lib/alexandria/book_providers/amazon_aws.rb +3 -1
- data/lib/alexandria/book_providers/amazon_ecs_util.rb +8 -0
- data/lib/alexandria/book_providers/barnes_and_noble.rb +7 -4
- data/lib/alexandria/book_providers/douban.rb +1 -1
- data/lib/alexandria/book_providers/proxis.rb +11 -27
- data/lib/alexandria/book_providers/renaud.rb +9 -3
- data/lib/alexandria/book_providers/siciliano.rb +7 -4
- data/lib/alexandria/book_providers/thalia.rb +5 -3
- data/lib/alexandria/book_providers/web.rb +11 -29
- data/lib/alexandria/book_providers/worldcat.rb +7 -5
- data/lib/alexandria/book_providers/z3950.rb +10 -7
- data/lib/alexandria/console.rb +5 -18
- data/lib/alexandria/execution_queue.rb +2 -1
- data/lib/alexandria/export_format.rb +47 -0
- data/lib/alexandria/export_library.rb +72 -180
- data/lib/alexandria/import_library.rb +14 -23
- data/lib/alexandria/import_library_csv.rb +3 -6
- data/lib/alexandria/library_collection.rb +78 -0
- data/lib/alexandria/library_sort_order.rb +43 -0
- data/lib/alexandria/library_store.rb +222 -0
- data/lib/alexandria/logging.rb +2 -0
- data/lib/alexandria/models/book.rb +8 -16
- data/lib/alexandria/models/library.rb +26 -308
- data/lib/alexandria/preferences.rb +7 -24
- data/lib/alexandria/scanners/cuecat.rb +3 -1
- data/lib/alexandria/smart_library.rb +32 -67
- data/lib/alexandria/ui/builder_base.rb +6 -26
- data/lib/alexandria/ui/callbacks.rb +8 -34
- data/lib/alexandria/ui/completion_models.rb +2 -1
- data/lib/alexandria/ui/dialogs/about_dialog.rb +35 -47
- data/lib/alexandria/ui/dialogs/acquire_dialog.rb +14 -30
- data/lib/alexandria/ui/dialogs/alert_dialog.rb +8 -17
- data/lib/alexandria/ui/dialogs/bad_isbns_dialog.rb +10 -24
- data/lib/alexandria/ui/dialogs/book_properties_dialog.rb +17 -18
- data/lib/alexandria/ui/dialogs/book_properties_dialog_base.rb +25 -41
- data/lib/alexandria/ui/dialogs/export_dialog.rb +48 -56
- data/lib/alexandria/ui/dialogs/import_dialog.rb +31 -51
- data/lib/alexandria/ui/dialogs/keep_bad_isbn_dialog.rb +33 -0
- data/lib/alexandria/ui/dialogs/misc_dialogs.rb +12 -25
- data/lib/alexandria/ui/dialogs/new_book_dialog.rb +57 -94
- data/lib/alexandria/ui/dialogs/new_book_dialog_manual.rb +24 -42
- data/lib/alexandria/ui/dialogs/new_smart_library_dialog.rb +9 -21
- data/lib/alexandria/ui/dialogs/preferences_dialog.rb +27 -32
- data/lib/alexandria/ui/dialogs/smart_library_properties_dialog.rb +5 -3
- data/lib/alexandria/ui/dialogs/smart_library_properties_dialog_base.rb +15 -12
- data/lib/alexandria/ui/icons.rb +11 -22
- data/lib/alexandria/ui/init.rb +3 -3
- data/lib/alexandria/ui/libraries_combo.rb +1 -0
- data/lib/alexandria/ui/listview.rb +5 -21
- data/lib/alexandria/ui/multi_drag_treeview.rb +20 -32
- data/lib/alexandria/ui/sidepane.rb +9 -24
- data/lib/alexandria/ui/ui_manager.rb +36 -60
- data/lib/alexandria/undo_manager.rb +1 -0
- data/lib/alexandria/version.rb +2 -2
- data/lib/alexandria/web_themes.rb +1 -0
- data/po/cs.po +0 -4
- data/po/cy.po +0 -4
- data/po/de.po +0 -4
- data/po/el.po +0 -4
- data/po/es.po +0 -4
- data/po/fr.po +0 -4
- data/po/ga.po +0 -4
- data/po/gl.po +0 -4
- data/po/it.po +0 -4
- data/po/ja.po +0 -4
- data/po/mk.po +0 -4
- data/po/nb.po +0 -4
- data/po/nl.po +0 -4
- data/po/pl.po +0 -4
- data/po/pt.po +0 -4
- data/po/pt_BR.po +0 -4
- data/po/ru.po +0 -4
- data/po/sk.po +0 -4
- data/po/sv.po +0 -4
- data/po/uk.po +0 -4
- data/po/zh_TW.po +0 -4
- data/schemas/alexandria.schemas +1 -1
- data/share/alexandria/glade/acquire_dialog__builder.glade +14 -11
- data/share/alexandria/glade/book_properties_dialog__builder.glade +170 -298
- data/share/alexandria/glade/main_app__builder.glade +22 -16
- data/share/alexandria/glade/new_book_dialog__builder.glade +26 -58
- data/share/alexandria/glade/preferences_dialog__builder.glade +249 -289
- data/share/gnome/help/alexandria/C/introduction.xml +0 -4
- data/share/gnome/help/alexandria/ja/introduction.xml +0 -4
- data/spec/alexandria/book_providers_spec.rb +1 -20
- data/spec/alexandria/console_spec.rb +32 -0
- data/spec/alexandria/export_library_spec.rb +141 -0
- data/spec/alexandria/library_spec.rb +24 -80
- data/spec/alexandria/library_store_spec.rb +37 -0
- data/spec/alexandria/smart_library_spec.rb +27 -22
- data/spec/alexandria/ui/dialogs/new_book_dialog_spec.rb +22 -0
- data/spec/alexandria/ui/dialogs_spec.rb +104 -38
- data/spec/end_to_end/basic_run_spec.rb +69 -0
- data/spec/spec_helper.rb +13 -25
- data/tasks/spec.rake +15 -2
- data/util/rake/fileinstall.rb +1 -0
- metadata +38 -16
- data/lib/alexandria/book_providers/deastore.rb +0 -265
- data/lib/alexandria/book_providers/mcu.rb +0 -182
@@ -1,23 +1,10 @@
|
|
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
|
|
7
|
+
require 'alexandria/ui/builder_base'
|
21
8
|
require 'alexandria/scanners/cuecat'
|
22
9
|
require 'alexandria/scanners/keyboard'
|
23
10
|
|
@@ -30,9 +17,10 @@ end
|
|
30
17
|
|
31
18
|
module Alexandria
|
32
19
|
module UI
|
33
|
-
class ProviderPreferencesBaseDialog <
|
34
|
-
def initialize(
|
35
|
-
|
20
|
+
class ProviderPreferencesBaseDialog < SimpleDelegator
|
21
|
+
def initialize(title:, parent:, flags:, buttons:)
|
22
|
+
dialog = Gtk::Dialog.new(title: title, parent: parent, flags: flags, buttons: buttons)
|
23
|
+
super(dialog)
|
36
24
|
|
37
25
|
self.resizable = false
|
38
26
|
child.border_width = 12
|
@@ -118,7 +106,9 @@ module Alexandria
|
|
118
106
|
child.pack_start(table)
|
119
107
|
|
120
108
|
signal_connect('destroy') { sync_variables }
|
109
|
+
end
|
121
110
|
|
111
|
+
def acquire
|
122
112
|
show_all
|
123
113
|
run
|
124
114
|
destroy
|
@@ -130,18 +120,18 @@ module Alexandria
|
|
130
120
|
GetText.bindtextdomain(Alexandria::TEXTDOMAIN, charset: 'UTF-8')
|
131
121
|
|
132
122
|
def initialize(parent)
|
133
|
-
super(_('New Provider'),
|
134
|
-
parent,
|
135
|
-
|
136
|
-
[Gtk::Stock::CANCEL,
|
123
|
+
super(title: _('New Provider'),
|
124
|
+
parent: parent,
|
125
|
+
flags: :modal,
|
126
|
+
buttons: [[Gtk::Stock::CANCEL, Gtk::ResponseType::CANCEL]])
|
137
127
|
@add_button = add_button(Gtk::Stock::ADD,
|
138
|
-
|
128
|
+
Gtk::ResponseType::ACCEPT)
|
139
129
|
|
140
130
|
instances = BookProviders.abstract_classes.map(&:new)
|
141
131
|
@selected_instance = nil
|
142
132
|
|
143
133
|
@table = Gtk::Table.new(2, 2)
|
144
|
-
|
134
|
+
child.pack_start(@table)
|
145
135
|
|
146
136
|
# Name.
|
147
137
|
|
@@ -162,7 +152,7 @@ module Alexandria
|
|
162
152
|
label_type.xalign = 0
|
163
153
|
@table.attach_defaults(label_type, 0, 1, 1, 2)
|
164
154
|
|
165
|
-
combo_type = Gtk::
|
155
|
+
combo_type = Gtk::ComboBoxText.new
|
166
156
|
instances.each do |instance|
|
167
157
|
combo_type.append_text(instance.name)
|
168
158
|
end
|
@@ -176,9 +166,11 @@ module Alexandria
|
|
176
166
|
combo_type.active = 0
|
177
167
|
label_type.mnemonic_widget = combo_type
|
178
168
|
@table.attach_defaults(combo_type, 1, 2, 1, 2)
|
169
|
+
end
|
179
170
|
|
171
|
+
def acquire
|
180
172
|
show_all
|
181
|
-
if run ==
|
173
|
+
if run == Gtk::ResponseType::ACCEPT
|
182
174
|
@selected_instance.reinitialize(entry_name.text)
|
183
175
|
sync_variables
|
184
176
|
else
|
@@ -407,7 +399,9 @@ module Alexandria
|
|
407
399
|
|
408
400
|
def on_provider_setup
|
409
401
|
provider = selected_provider
|
410
|
-
|
402
|
+
unless prefs_empty(provider.prefs)
|
403
|
+
ProviderPreferencesDialog.new(@preferences_dialog, provider).acquire
|
404
|
+
end
|
411
405
|
end
|
412
406
|
|
413
407
|
def on_provider_up
|
@@ -436,7 +430,7 @@ module Alexandria
|
|
436
430
|
end
|
437
431
|
|
438
432
|
def on_provider_add
|
439
|
-
dialog = NewProviderDialog.new(@preferences_dialog)
|
433
|
+
dialog = NewProviderDialog.new(@preferences_dialog).acquire
|
440
434
|
if dialog.instance
|
441
435
|
BookProviders.update_priority
|
442
436
|
reload_providers
|
@@ -464,15 +458,15 @@ module Alexandria
|
|
464
458
|
"'%s'?") % provider.fullname,
|
465
459
|
Gtk::Stock::DIALOG_QUESTION,
|
466
460
|
[[Gtk::Stock::CANCEL,
|
467
|
-
|
461
|
+
Gtk::ResponseType::CANCEL],
|
468
462
|
[Gtk::Stock::DELETE,
|
469
|
-
|
463
|
+
Gtk::ResponseType::OK]],
|
470
464
|
_('If you continue, the provider and ' \
|
471
465
|
'all of its preferences will be ' \
|
472
466
|
'permanently deleted.'))
|
473
467
|
dialog.default_response = Gtk::ResponseType::CANCEL
|
474
468
|
dialog.show_all
|
475
|
-
if dialog.run ==
|
469
|
+
if dialog.run == Gtk::ResponseType::OK
|
476
470
|
provider.remove
|
477
471
|
BookProviders.update_priority
|
478
472
|
reload_providers
|
@@ -482,6 +476,7 @@ module Alexandria
|
|
482
476
|
|
483
477
|
def on_column_toggled(checkbutton)
|
484
478
|
raise if @cols[checkbutton].nil?
|
479
|
+
|
485
480
|
Preferences.instance.send("#{@cols[checkbutton]}=",
|
486
481
|
checkbutton.active?)
|
487
482
|
|
@@ -32,15 +32,17 @@ module Alexandria
|
|
32
32
|
self.title = _("Properties for '%s'") % smart_library.name
|
33
33
|
# FIXME: Should accept just :cancel
|
34
34
|
self.default_response = Gtk::ResponseType::CANCEL
|
35
|
+
end
|
35
36
|
|
37
|
+
def acquire
|
36
38
|
show_all
|
37
39
|
smart_library.rules.each { |x| insert_new_rule(x) }
|
38
40
|
update_rules_header_box(smart_library.predicate_operator_rule)
|
39
41
|
|
40
|
-
while (response = run) !=
|
41
|
-
if response ==
|
42
|
+
while (response = run) != Gtk::ResponseType::CANCEL
|
43
|
+
if response == Gtk::ResponseType::HELP
|
42
44
|
Alexandria::UI.display_help(self, 'edit-smart-library')
|
43
|
-
elsif response ==
|
45
|
+
elsif response == Gtk::ResponseType::OK
|
44
46
|
if user_confirms_possible_weirdnesses_before_saving?
|
45
47
|
smart_library.rules = smart_library_rules
|
46
48
|
smart_library.predicate_operator_rule =
|
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
module Alexandria
|
22
22
|
module UI
|
23
|
-
class SmartLibraryPropertiesDialogBase <
|
23
|
+
class SmartLibraryPropertiesDialogBase < SimpleDelegator
|
24
24
|
include Logging
|
25
25
|
include GetText
|
26
26
|
GetText.bindtextdomain(Alexandria::TEXTDOMAIN, charset: 'UTF-8')
|
@@ -28,10 +28,11 @@ module Alexandria
|
|
28
28
|
attr_reader :predicate_operator_rule
|
29
29
|
|
30
30
|
def initialize(parent)
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
@dialog = Gtk::Dialog.new(title: '',
|
32
|
+
parent: parent,
|
33
|
+
flags: :modal,
|
34
|
+
buttons: [[Gtk::Stock::HELP, :help]])
|
35
|
+
super(@dialog)
|
35
36
|
|
36
37
|
self.window_position = :center
|
37
38
|
self.resizable = true
|
@@ -81,19 +82,20 @@ module Alexandria
|
|
81
82
|
|
82
83
|
def user_confirms_possible_weirdnesses_before_saving?
|
83
84
|
return true unless has_weirdnesses?
|
85
|
+
|
84
86
|
dialog = AlertDialog.new(
|
85
|
-
|
87
|
+
@dialog,
|
86
88
|
_('Empty or conflictive condition'),
|
87
89
|
Gtk::Stock::DIALOG_QUESTION,
|
88
|
-
[[Gtk::Stock::CANCEL,
|
89
|
-
[_('_Save However'),
|
90
|
+
[[Gtk::Stock::CANCEL, Gtk::ResponseType::CANCEL],
|
91
|
+
[_('_Save However'), Gtk::ResponseType::YES]],
|
90
92
|
_('This smart library contains one or more conditions ' \
|
91
93
|
'which are empty or conflict with each other. This is ' \
|
92
94
|
'likely to result in never matching a book. Are you ' \
|
93
95
|
'sure you want to save this library?'))
|
94
96
|
dialog.default_response = Gtk::ResponseType::CANCEL
|
95
97
|
dialog.show_all
|
96
|
-
confirmed = dialog.run ==
|
98
|
+
confirmed = dialog.run == Gtk::ResponseType::YES
|
97
99
|
dialog.destroy
|
98
100
|
confirmed
|
99
101
|
end
|
@@ -169,6 +171,7 @@ module Alexandria
|
|
169
171
|
remove_button.signal_connect('clicked') do |_button|
|
170
172
|
idx = @rules_box.children.index(rule_box)
|
171
173
|
raise if idx.nil?
|
174
|
+
|
172
175
|
@smart_library_rules.delete_at(idx)
|
173
176
|
@rules_box.remove(rule_box)
|
174
177
|
sensitize_remove_rule_buttons
|
@@ -283,7 +286,7 @@ module Alexandria
|
|
283
286
|
elsif date.visible?
|
284
287
|
begin
|
285
288
|
value = parse_date(date.text)
|
286
|
-
rescue => ex
|
289
|
+
rescue StandardError => ex
|
287
290
|
trace = ex.backtrace.join("\n > ")
|
288
291
|
log.warn { "Possibly invalid date entered #{ex.message}" }
|
289
292
|
log.warn { "Date widget returned #{date.text} / #{trace}" }
|
@@ -307,7 +310,7 @@ module Alexandria
|
|
307
310
|
@calendar_popup.skip_pager_hint = true
|
308
311
|
@calendar_popup.events = [:focus_change_mask]
|
309
312
|
|
310
|
-
@calendar_popup.set_transient_for(
|
313
|
+
@calendar_popup.set_transient_for(@dialog)
|
311
314
|
@calendar_popup.set_type_hint(:dialog)
|
312
315
|
@calendar_popup.name = 'calendar-popup'
|
313
316
|
@calendar_popup.resizable = false
|
@@ -407,7 +410,7 @@ module Alexandria
|
|
407
410
|
begin
|
408
411
|
d = Date.strptime(datestring, date_format)
|
409
412
|
Time.gm(d.year, d.month, d.day)
|
410
|
-
rescue
|
413
|
+
rescue StandardError
|
411
414
|
nil
|
412
415
|
end
|
413
416
|
end
|
data/lib/alexandria/ui/icons.rb
CHANGED
@@ -1,22 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
#
|
4
|
-
# Copyright (C) 2014-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
|
class GdkPixbuf::Pixbuf
|
22
8
|
def tag(tag_pixbuf)
|
@@ -56,6 +42,8 @@ end
|
|
56
42
|
module Alexandria
|
57
43
|
module UI
|
58
44
|
module Icons
|
45
|
+
include Logging
|
46
|
+
|
59
47
|
ICONS_DIR = File.join(Alexandria::Config::DATA_DIR, 'icons')
|
60
48
|
def self.init
|
61
49
|
load_icon_images
|
@@ -66,6 +54,7 @@ module Alexandria
|
|
66
54
|
def self.load_icon_images
|
67
55
|
Dir.entries(ICONS_DIR).each do |file|
|
68
56
|
next unless file =~ /\.png$/ # skip non '.png' files
|
57
|
+
|
69
58
|
# Don't use upcase and use tr instead
|
70
59
|
# For example in Turkish the upper case of 'i' is still 'i'.
|
71
60
|
name = File.basename(file, '.png').tr('a-z', 'A-Z')
|
@@ -76,13 +65,13 @@ module Alexandria
|
|
76
65
|
def self.cover(library, book)
|
77
66
|
begin
|
78
67
|
return BOOK_ICON if library.nil?
|
68
|
+
|
79
69
|
filename = library.cover(book)
|
80
70
|
return GdkPixbuf::Pixbuf.new(file: filename) if File.exist?(filename)
|
81
|
-
rescue
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
puts "Failed to load GdkPixbuf::Pixbuf, please ensure that from #{filename} is a valid image file"
|
71
|
+
rescue GdkPixbuf::PixbufError
|
72
|
+
log.error do
|
73
|
+
"Failed to load GdkPixbuf::Pixbuf, please ensure that #{filename} is a valid image file"
|
74
|
+
end
|
86
75
|
end
|
87
76
|
BOOK_ICON
|
88
77
|
end
|
@@ -90,7 +79,7 @@ module Alexandria
|
|
90
79
|
def self.blank?(filename)
|
91
80
|
pixbuf = GdkPixbuf::Pixbuf.new(file: filename)
|
92
81
|
(pixbuf.width == 1) && (pixbuf.height == 1)
|
93
|
-
rescue => err
|
82
|
+
rescue StandardError => err
|
94
83
|
puts err.message
|
95
84
|
puts err.backtrace.join("\n> ")
|
96
85
|
true
|
data/lib/alexandria/ui/init.rb
CHANGED
@@ -72,16 +72,16 @@ end
|
|
72
72
|
|
73
73
|
module Alexandria
|
74
74
|
module UI
|
75
|
-
def self.display_help(parent
|
75
|
+
def self.display_help(parent, section = nil)
|
76
76
|
section_index = ''
|
77
77
|
section_index = "##{section}" if section
|
78
78
|
exec("gnome-help ghelp:alexandria#{section_index}") if fork.nil?
|
79
|
-
rescue
|
79
|
+
rescue StandardError
|
80
80
|
log.error(self) { 'Unable to load help browser' }
|
81
81
|
ErrorDialog.new(parent, _('Unable to launch the help browser'),
|
82
82
|
_('Could not display help for Alexandria. ' \
|
83
83
|
'There was an error launching the system ' \
|
84
|
-
'help browser.'))
|
84
|
+
'help browser.')).display
|
85
85
|
end
|
86
86
|
end
|
87
87
|
end
|
@@ -1,24 +1,8 @@
|
|
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
7
|
require 'alexandria/ui/columns'
|
24
8
|
|
@@ -132,8 +116,7 @@ module Alexandria
|
|
132
116
|
column.pack_start(renderer, false)
|
133
117
|
column.set_cell_data_func(renderer) do |_tree_column, cell, _tree_model, iter|
|
134
118
|
rating = (iter[Columns::RATING] - Book::MAX_RATING_STARS).abs
|
135
|
-
cell.pixbuf = rating >= i.succ ?
|
136
|
-
Icons::STAR_SET : Icons::STAR_UNSET
|
119
|
+
cell.pixbuf = rating >= i.succ ? Icons::STAR_SET : Icons::STAR_UNSET
|
137
120
|
end
|
138
121
|
end
|
139
122
|
column.sort_column_id = Columns::RATING
|
@@ -176,7 +159,7 @@ module Alexandria
|
|
176
159
|
end
|
177
160
|
|
178
161
|
end
|
179
|
-
rescue => e
|
162
|
+
rescue StandardError => e
|
180
163
|
log.error { "toggle failed for path #{path} #{e}\n" + e.backtrace.join("\n") }
|
181
164
|
end
|
182
165
|
end
|
@@ -238,6 +221,7 @@ module Alexandria
|
|
238
221
|
log.debug { "#{c.title} : #{cols_width[c.title]}" }
|
239
222
|
width = cols_width[c.title]
|
240
223
|
next if width.zero?
|
224
|
+
|
241
225
|
c.sizing = :fixed
|
242
226
|
c.fixed_width = width
|
243
227
|
end
|
@@ -1,22 +1,8 @@
|
|
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
|
@@ -28,22 +14,23 @@ module Alexandria
|
|
28
14
|
module TreeViewOverrides
|
29
15
|
# include Alexandria::Logging
|
30
16
|
|
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 ||= []
|
@@ -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)
|