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.
Files changed (116) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +0 -1
  3. data/.rubocop.yml +45 -27
  4. data/.rubocop_todo.yml +127 -86
  5. data/.simplecov +1 -0
  6. data/.yardopts +1 -1
  7. data/CHANGELOG.md +5 -0
  8. data/ChangeLog.0 +33 -35
  9. data/Gemfile +2 -2
  10. data/INSTALL.md +152 -0
  11. data/Rakefile +12 -10
  12. data/alexandria-book-collection-manager.gemspec +5 -5
  13. data/bin/alexandria +2 -1
  14. data/doc/AUTHORS +61 -0
  15. data/doc/BUGS +31 -0
  16. data/doc/FAQ +369 -0
  17. data/doc/HACKING +19 -0
  18. data/doc/NEWS +341 -0
  19. data/doc/alexandria.1 +120 -0
  20. data/doc/cuecat_support.rdoc +67 -0
  21. data/doc/dependency_decisions.yml +61 -0
  22. data/lib/alexandria.rb +2 -0
  23. data/lib/alexandria/about.rb +7 -6
  24. data/lib/alexandria/book_providers.rb +6 -6
  25. data/lib/alexandria/book_providers/adlibris.rb +9 -14
  26. data/lib/alexandria/book_providers/amazon_aws.rb +29 -33
  27. data/lib/alexandria/book_providers/amazon_ecs_util.rb +10 -14
  28. data/lib/alexandria/book_providers/barnes_and_noble.rb +9 -11
  29. data/lib/alexandria/book_providers/deastore.rb +12 -20
  30. data/lib/alexandria/book_providers/douban.rb +9 -15
  31. data/lib/alexandria/book_providers/mcu.rb +26 -13
  32. data/lib/alexandria/book_providers/proxis.rb +9 -15
  33. data/lib/alexandria/book_providers/pseudomarc.rb +15 -27
  34. data/lib/alexandria/book_providers/renaud.rb +18 -9
  35. data/lib/alexandria/book_providers/siciliano.rb +8 -9
  36. data/lib/alexandria/book_providers/thalia.rb +6 -6
  37. data/lib/alexandria/book_providers/web.rb +2 -0
  38. data/lib/alexandria/book_providers/worldcat.rb +6 -7
  39. data/lib/alexandria/book_providers/z3950.rb +19 -10
  40. data/lib/alexandria/config.rb +4 -2
  41. data/lib/alexandria/console.rb +2 -0
  42. data/lib/alexandria/execution_queue.rb +2 -2
  43. data/lib/alexandria/export_library.rb +14 -18
  44. data/lib/alexandria/import_library.rb +8 -16
  45. data/lib/alexandria/import_library_csv.rb +5 -52
  46. data/lib/alexandria/logging.rb +4 -6
  47. data/lib/alexandria/models/book.rb +2 -0
  48. data/lib/alexandria/models/library.rb +10 -20
  49. data/lib/alexandria/net.rb +2 -0
  50. data/lib/alexandria/preferences.rb +10 -14
  51. data/lib/alexandria/scanners.rb +2 -0
  52. data/lib/alexandria/scanners/cuecat.rb +4 -2
  53. data/lib/alexandria/scanners/keyboard.rb +2 -0
  54. data/lib/alexandria/smart_library.rb +4 -3
  55. data/lib/alexandria/ui.rb +2 -0
  56. data/lib/alexandria/ui/builder_base.rb +2 -0
  57. data/lib/alexandria/ui/callbacks.rb +8 -12
  58. data/lib/alexandria/ui/columns.rb +2 -0
  59. data/lib/alexandria/ui/completion_models.rb +2 -0
  60. data/lib/alexandria/ui/dialogs/about_dialog.rb +3 -1
  61. data/lib/alexandria/ui/dialogs/acquire_dialog.rb +11 -17
  62. data/lib/alexandria/ui/dialogs/alert_dialog.rb +2 -0
  63. data/lib/alexandria/ui/dialogs/bad_isbns_dialog.rb +10 -2
  64. data/lib/alexandria/ui/dialogs/barcode_animation.rb +2 -0
  65. data/lib/alexandria/ui/dialogs/book_properties_dialog.rb +5 -9
  66. data/lib/alexandria/ui/dialogs/book_properties_dialog_base.rb +3 -3
  67. data/lib/alexandria/ui/dialogs/export_dialog.rb +3 -3
  68. data/lib/alexandria/ui/dialogs/import_dialog.rb +2 -2
  69. data/lib/alexandria/ui/dialogs/misc_dialogs.rb +6 -4
  70. data/lib/alexandria/ui/dialogs/new_book_dialog.rb +22 -31
  71. data/lib/alexandria/ui/dialogs/new_book_dialog_manual.rb +3 -3
  72. data/lib/alexandria/ui/dialogs/new_smart_library_dialog.rb +3 -3
  73. data/lib/alexandria/ui/dialogs/preferences_dialog.rb +8 -18
  74. data/lib/alexandria/ui/dialogs/smart_library_properties_dialog.rb +2 -0
  75. data/lib/alexandria/ui/dialogs/smart_library_properties_dialog_base.rb +4 -6
  76. data/lib/alexandria/ui/dndable.rb +4 -2
  77. data/lib/alexandria/ui/icons.rb +3 -3
  78. data/lib/alexandria/ui/iconview.rb +3 -3
  79. data/lib/alexandria/ui/iconview_tooltips.rb +4 -6
  80. data/lib/alexandria/ui/init.rb +2 -0
  81. data/lib/alexandria/ui/libraries_combo.rb +2 -0
  82. data/lib/alexandria/ui/listview.rb +15 -12
  83. data/lib/alexandria/ui/main_app.rb +2 -0
  84. data/lib/alexandria/ui/multi_drag_treeview.rb +2 -0
  85. data/lib/alexandria/ui/sidepane.rb +8 -6
  86. data/lib/alexandria/ui/sound.rb +2 -0
  87. data/lib/alexandria/ui/ui_manager.rb +37 -43
  88. data/lib/alexandria/undo_manager.rb +2 -0
  89. data/lib/alexandria/version.rb +5 -3
  90. data/lib/alexandria/web_themes.rb +2 -0
  91. data/spec/alexandria/book_providers_spec.rb +12 -49
  92. data/spec/alexandria/book_spec.rb +4 -2
  93. data/spec/alexandria/library_spec.rb +2 -0
  94. data/spec/alexandria/preferences_spec.rb +2 -0
  95. data/spec/alexandria/scanners/cuecat_spec.rb +2 -0
  96. data/spec/alexandria/smart_library_spec.rb +3 -1
  97. data/spec/alexandria/ui/dialogs_spec.rb +2 -0
  98. data/spec/alexandria/ui/iconview_spec.rb +2 -0
  99. data/spec/alexandria/ui/main_app_spec.rb +2 -0
  100. data/spec/alexandria/ui/sidepane_spec.rb +2 -0
  101. data/spec/alexandria/ui/sound_spec.rb +2 -0
  102. data/spec/alexandria/ui/ui_manager_spec.rb +2 -0
  103. data/spec/alexandria/ui/ui_utilities_spec.rb +2 -0
  104. data/spec/alexandria/utilities_spec.rb +2 -0
  105. data/spec/spec_helper.rb +2 -0
  106. data/tasks/dogtail.rake +2 -0
  107. data/tasks/setup.rb +3 -1
  108. data/tasks/spec.rake +2 -0
  109. data/util/rake/fileinstall.rb +6 -12
  110. data/util/rake/gettextgenerate.rb +9 -64
  111. data/util/rake/omfgenerate.rb +3 -3
  112. metadata +21 -37
  113. data/INSTALL.rdoc +0 -148
  114. data/lib/alexandria/book_providers/bol_it.rb +0 -160
  115. data/lib/alexandria/book_providers/ibs_it.rb +0 -147
  116. data/lib/alexandria/book_providers/webster_it.rb +0 -167
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (C) 2010 Cathal Mc Ginley
2
4
  #
3
5
  # Alexandria is free software; you can redistribute it and/or
@@ -93,7 +95,6 @@ module Alexandria
93
95
  book.redd_when = date
94
96
  book.redd = true
95
97
  rescue
96
- #
97
98
  end
98
99
  end
99
100
  if row[@mainshelf]
@@ -140,9 +141,7 @@ module Alexandria
140
141
  authors << normalize(row[@author])
141
142
  isbn = row[@isbn]
142
143
  if isbn
143
- if isbn =~ /\[([^\]]+)\]/
144
- isbn = Regexp.last_match[1]
145
- end
144
+ isbn = Regexp.last_match[1] if isbn =~ /\[([^\]]+)\]/
146
145
  isbn = Library.canonicalise_ean(isbn)
147
146
  end
148
147
 
@@ -150,14 +149,10 @@ module Alexandria
150
149
  # sometimes "Publisher (YEAR), Edition: NUM, Binding, NUM pages"
151
150
  publisher_info = normalize(row[@publisher_info])
152
151
  publisher = publisher_info
153
- if publisher_info =~ /([^\(]+)\(/
154
- publisher = Regexp.last_match[1]
155
- end
152
+ publisher = Regexp.last_match[1] if publisher_info =~ /([^\(]+)\(/
156
153
  edition = publisher_info # binding
157
154
  edition_info = publisher_info.split(',')
158
- if edition_info.size >= 3
159
- edition = publisher_info.split(',')[-2]
160
- end
155
+ edition = publisher_info.split(',')[-2] if edition_info.size >= 3
161
156
 
162
157
  year = row[@publishing_year].to_i
163
158
 
@@ -207,46 +202,4 @@ module Alexandria
207
202
  raise 'Not Recognized' unless is_librarything || is_goodreads
208
203
  end
209
204
  end
210
-
211
- # def read_csv_file(csv_file)
212
-
213
- # reader = CSV.open(csv_file, 'r')
214
- # # goodreads & librarything now use csv header lines
215
- # header = reader.shift
216
-
217
- # #header.each {|h| puts h }
218
- # importer = identify_csv_type(header)
219
-
220
- # retries = 0
221
- # begin
222
- # reader.each do |row|
223
- # #puts row
224
- # bk = importer.row_to_book(row)
225
- # puts "\"#{bk.title}\" by #{bk.authors.join(', ')}; isbn : #{bk.isbn} #{bk.publisher} | #{bk.publishing_year.inspect} binding:#{bk.edition}"
226
- # if bk.notes.size > 0
227
- # puts " >>> #{bk.notes}"
228
- # end
229
- # end
230
- # rescue
231
- # if retries < 1
232
- # retries += 1
233
- # puts "Retrying..."
234
-
235
- # # probably Goodreads' wonky ISBN fields ,,="043432432X", and such
236
- # # hack to fix up these files
237
- # data = File.read(csv_file)
238
- # data.gsub!(/\,\=\"/, ',"')
239
- # csv_fixed = Tempfile.new("#{csv_file}_fixed")
240
- # csv_fixed.write(data)
241
- # csv_fixed.close
242
- # reader = CSV.open(csv_fixed.path, 'r')
243
- # #puts csv_fixed.path
244
- # header = reader.shift
245
-
246
- # retry
247
- # end
248
-
249
- # end
250
-
251
- # end
252
205
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (C) 2007 Cathal Mc Ginley
2
4
  # Copyright (C) 2011 Matijs van Zuijlen
3
5
  #
@@ -26,13 +28,9 @@ module Alexandria
26
28
  # or Object. A LoggerWrapper can be used to simplify this procedure.
27
29
  class Logger < ::Logger
28
30
  def add(severity, message = nil, source = nil, progname = nil, &block)
29
- if source.nil?
30
- return super(severity, message, progname, &block)
31
- end
31
+ return super(severity, message, progname, &block) if source.nil?
32
32
  category = self.class.category(source)
33
- unless block_given?
34
- return super(severity, progname, category)
35
- end
33
+ return super(severity, progname, category) unless block_given?
36
34
  category = "#{category} #{progname}" if progname
37
35
  super(severity, message, category, &block)
38
36
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (C) 2004-2006 Laurent Sansonetti
2
4
  #
3
5
  # Alexandria is free software; you can redistribute it and/or
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (C) 2004-2006 Laurent Sansonetti
2
4
  # Copyright (C) 2014 Matijs van Zuijlen
3
5
  #
@@ -130,7 +132,6 @@ module Alexandria
130
132
  # retries the Dir.each block...
131
133
  # but gives up after three tries
132
134
  redo unless test[0] > 2
133
-
134
135
  else
135
136
  test = [0, nil]
136
137
  end
@@ -193,7 +194,7 @@ module Alexandria
193
194
  end
194
195
 
195
196
  # TODO: Ensure book loading passes through Book#initialize
196
- book = YAML.load(text)
197
+ book = YAML.safe_load(text, whitelist_classes = [Book, Time])
197
198
 
198
199
  unless book.isbn.class == String
199
200
  # HACK
@@ -231,7 +232,6 @@ module Alexandria
231
232
 
232
233
  a << load(file)
233
234
  end
234
-
235
235
  rescue Errno::ENOENT
236
236
  FileUtils.mkdir_p(DIR)
237
237
  end
@@ -246,9 +246,7 @@ module Alexandria
246
246
  dest = dest_library.path
247
247
  books.each do |book|
248
248
  FileUtils.mv(source_library.yaml(book), dest)
249
- if File.exist?(source_library.cover(book))
250
- FileUtils.mv(source_library.cover(book), dest)
251
- end
249
+ FileUtils.mv(source_library.cover(book), dest) if File.exist?(source_library.cover(book))
252
250
 
253
251
  source_library.changed
254
252
  source_library.old_delete(book)
@@ -365,9 +363,7 @@ module Alexandria
365
363
 
366
364
  def self.canonicalise_isbn(isbn)
367
365
  numbers = extract_numbers(isbn)
368
- if valid_ean?(isbn) && (numbers[0..2] != [9, 7, 8])
369
- return isbn
370
- end
366
+ return isbn if valid_ean?(isbn) && (numbers[0..2] != [9, 7, 8])
371
367
  canonical = if valid_ean?(isbn)
372
368
  # Looks like an EAN number -- extract the intersting part and
373
369
  # calculate a checksum. It would be nice if we could validate
@@ -392,9 +388,7 @@ module Alexandria
392
388
  # Let's initialize the saved identifier if not already
393
389
  # (backward compatibility from 0.4.0)
394
390
  # book.saved_ident ||= book.ident
395
- if book.saved_ident.nil? || book.saved_ident.empty?
396
- book.saved_ident = book.ident
397
- end
391
+ book.saved_ident = book.ident if book.saved_ident.nil? || book.saved_ident.empty?
398
392
  if book.ident != book.saved_ident
399
393
  # log.debug { "Backwards compatibility step: #{book.saved_ident.inspect}, #{book.ident.inspect}" }
400
394
  FileUtils.rm(yaml(book.saved_ident))
@@ -421,9 +415,7 @@ module Alexandria
421
415
 
422
416
  if book.ident != book.saved_ident
423
417
  FileUtils.rm(yaml(book.saved_ident))
424
- if File.exist?(cover(book.saved_ident))
425
- FileUtils.mv(cover(book.saved_ident), cover(book.ident))
426
- end
418
+ FileUtils.mv(cover(book.saved_ident), cover(book.ident)) if File.exist?(cover(book.saved_ident))
427
419
 
428
420
  # Notify before updating the saved identifier, so the views
429
421
  # can still use the old one to update their models.
@@ -467,9 +459,7 @@ module Alexandria
467
459
  end
468
460
 
469
461
  # Remove the file if its blank.
470
- if Alexandria::UI::Icons.blank?(cover_file)
471
- File.delete(cover_file)
472
- end
462
+ File.delete(cover_file) if Alexandria::UI::Icons.blank?(cover_file)
473
463
  end
474
464
  end
475
465
 
@@ -501,7 +491,7 @@ module Alexandria
501
491
  @@deleted_libraries << self
502
492
  else
503
493
  if @deleted_books.include?(book)
504
- doubles = @deleted_books.reject { |b| !b.equal?(book) }
494
+ doubles = @deleted_books.select { |b| b.equal?(book) }
505
495
  raise ArgumentError, "Book #{book.isbn} was already deleted" unless doubles.empty?
506
496
  end
507
497
  @deleted_books << book
@@ -610,7 +600,7 @@ module Alexandria
610
600
  end
611
601
 
612
602
  def self.jpeg?(file)
613
- 'JFIF' == IO.read(file, 10)[6..9]
603
+ IO.read(file, 10)[6..9] == 'JFIF'
614
604
  end
615
605
 
616
606
  def final_cover(book)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (C) 2009 Cathal Mc Ginley
2
4
  # Copyright (C) 2014 Matijs van Zuijlen
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (C) 2004-2006 Laurent Sansonetti
2
4
  # Copyright (C) 2011 Cathal Mc Ginley
3
5
  # Copyright (C) 2011, 2016 Matijs van Zuijlen
@@ -26,12 +28,12 @@ module Alexandria
26
28
  include Singleton
27
29
  include Logging
28
30
 
29
- APP_DIR = '/apps/alexandria'.freeze
30
- HTTP_PROXY_DIR = '/system/http_proxy'.freeze
31
- HTTP_PROXY_MODE = '/system/proxy/mode'.freeze
32
- URL_HANDLERS_DIR = '/desktop/gnome/url-handlers'.freeze
31
+ APP_DIR = '/apps/alexandria'
32
+ HTTP_PROXY_DIR = '/system/http_proxy'
33
+ HTTP_PROXY_MODE = '/system/proxy/mode'
34
+ URL_HANDLERS_DIR = '/desktop/gnome/url-handlers'
33
35
 
34
- GCONFTOOL = 'gconftool-2'.freeze
36
+ GCONFTOOL = 'gconftool-2'
35
37
 
36
38
  def initialize
37
39
  @alexandria_settings = {}
@@ -116,9 +118,7 @@ module Alexandria
116
118
  end
117
119
  old_value = @alexandria_settings[variable_name]
118
120
  @alexandria_settings[variable_name] = new_value
119
- unless new_value == old_value
120
- @changed_settings << variable_name
121
- end
121
+ @changed_settings << variable_name unless new_value == old_value
122
122
  end
123
123
 
124
124
  def generic_save_setting(variable_name, new_value)
@@ -180,9 +180,7 @@ module Alexandria
180
180
  end
181
181
 
182
182
  def make_list_string(list)
183
- if get_gconf_type(list.first) == 'string'
184
- list.map! { |x| x.gsub(/\"/, '\\"') }
185
- end
183
+ list.map! { |x| x.gsub(/\"/, '\\"') } if get_gconf_type(list.first) == 'string'
186
184
  contents = list.join(',')
187
185
  '[' + contents + ']'
188
186
  end
@@ -245,9 +243,7 @@ module Alexandria
245
243
  hash = {}
246
244
  vals = all_vals.split(/$/)
247
245
  vals.each do |val|
248
- if /([a-z_]+) = (.*)/ =~ val
249
- hash[Regexp.last_match[1]] = discriminate(Regexp.last_match[2])
250
- end
246
+ hash[Regexp.last_match[1]] = discriminate(Regexp.last_match[2]) if /([a-z_]+) = (.*)/ =~ val
251
247
  end
252
248
  hash
253
249
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (C) 2005-2006 Christopher Cyll
2
4
  # Copyright (C) 2014-2016 Matijs van Zuijlen
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (C) 2005-2006 Christopher Cyll
2
4
  # Copyright (C) 2011 Matijs van Zuijlen
3
5
  #
@@ -33,7 +35,7 @@ module Alexandria
33
35
 
34
36
  # Checks if data looks like cuecat input
35
37
  def match?(data)
36
- data.chomp!
38
+ data = data.chomp
37
39
  return false if data[-1] != '.'
38
40
  fields = data.split('.')
39
41
  return false if fields.size != 4
@@ -45,7 +47,7 @@ module Alexandria
45
47
  # The following code is adapted from Skip Rosebaugh's public
46
48
  # domain perl implementation.
47
49
  def decode(data)
48
- data.chomp!
50
+ data = data.chomp
49
51
  fields = data.split('.')
50
52
  fields.shift # First part is gibberish
51
53
  fields.shift # Second part is cuecat serial number
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (C) 2005-2006 Christopher Cyll
2
4
  # Copyright (C) 2008 Cathal Mc Ginley
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (C) 2004-2006 Laurent Sansonetti
2
4
  # Copyright (C) 2011, 2014 Matijs van Zuijlen
3
5
  #
@@ -32,7 +34,7 @@ module Alexandria
32
34
  attr_accessor :rules, :predicate_operator_rule, :deleted_books
33
35
 
34
36
  DIR = File.join(ENV['HOME'], '.alexandria', '.smart_libraries')
35
- EXT = '.yaml'.freeze
37
+ EXT = '.yaml'
36
38
 
37
39
  def initialize(name, rules, predicate_operator_rule)
38
40
  super()
@@ -58,7 +60,7 @@ module Alexandria
58
60
  next unless File.stat(filename).file?
59
61
 
60
62
  text = IO.read(filename)
61
- hash = YAML.load(text)
63
+ hash = YAML.safe_load(text, whitelist_classes = [Symbol])
62
64
  begin
63
65
  smart_library = from_hash(hash)
64
66
  a << smart_library
@@ -68,7 +70,6 @@ module Alexandria
68
70
  end
69
71
  end
70
72
  end
71
-
72
73
  rescue Errno::ENOENT
73
74
  # First run and no smart libraries yet? Provide some default
74
75
  # ones.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (C) 2004-2006 Laurent Sansonetti
2
4
  #
3
5
  # Alexandria is free software; you can redistribute it and/or
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (C) 2011 Cathal Mc Ginley
2
4
  #
3
5
  # Alexandria is free software; you can redistribute it and/or
@@ -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, 2014, 2016 Matijs van Zuijlen
@@ -81,9 +83,7 @@ module Alexandria
81
83
 
82
84
  def on_window_state_event(_window, event)
83
85
  log.debug { 'window-state-event' }
84
- if event.is_a?(Gdk::EventWindowState)
85
- @maximized = event.new_window_state == :maximized
86
- end
86
+ @maximized = event.new_window_state == :maximized if event.is_a?(Gdk::EventWindowState)
87
87
  log.debug { 'end window-state-event' }
88
88
  end
89
89
 
@@ -298,6 +298,7 @@ module Alexandria
298
298
  end
299
299
 
300
300
  def connect_signals
301
+ # rubocop:disable LineLength
301
302
  standard_actions = [
302
303
  ['LibraryMenu', nil, _('_Library')],
303
304
  ['New', Gtk::Stock::NEW, _('_New Library'), '<control>L', _('Create a new library'), method(:on_new)],
@@ -336,6 +337,7 @@ module Alexandria
336
337
  ['Help', Gtk::Stock::HELP, _('Contents'), 'F1', _("View Alexandria's manual"), method(:on_help)],
337
338
  ['About', Gtk::Stock::ABOUT, _('_About'), nil, _('Show information about Alexandria'), method(:on_about)],
338
339
  ]
340
+ # rubocop:enable LineLength
339
341
 
340
342
  toggle_actions = [
341
343
  ['Sidepane', nil, _('Side _Pane'), 'F9', nil, method(:on_view_sidepane), true],
@@ -370,26 +372,20 @@ module Alexandria
370
372
  standard_actions.each do |name, stock_id, label, accelerator, tooltip, callback|
371
373
  action = Gtk::Action.new(name, label: label, tooltip: tooltip, stock_id: stock_id)
372
374
  @actiongroup.add_action_with_accel(action, accelerator)
373
- if callback
374
- action.signal_connect('activate', &callback)
375
- end
375
+ action.signal_connect('activate', &callback) if callback
376
376
  end
377
377
 
378
378
  providers_actions.each do |name, stock_id, label, accelerator, tooltip, callback|
379
379
  action = Gtk::Action.new(name, label: label, tooltip: tooltip, stock_id: stock_id)
380
380
  @actiongroup.add_action_with_accel(action, accelerator)
381
- if callback
382
- action.signal_connect('activate', &callback)
383
- end
381
+ action.signal_connect('activate', &callback) if callback
384
382
  end
385
383
 
386
384
  toggle_actions.each do |name, stock_id, label, accelerator, tooltip, callback, is_active|
387
385
  action = Gtk::ToggleAction.new(name, label: label, tooltip: tooltip, stock_id: stock_id)
388
386
  action.set_active is_active
389
387
  @actiongroup.add_action_with_accel(action, accelerator)
390
- if callback
391
- action.signal_connect('toggled', &callback)
392
- end
388
+ action.signal_connect('toggled', &callback) if callback
393
389
  end
394
390
 
395
391
  group = nil
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Alexandria
2
4
  module UI
3
5
  module Columns
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (C) 2005-2006 Laurent Sansonetti
2
4
  # Copyright (C) 2011, 2016 Matijs van Zuijlen
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (C) 2004-2006 Laurent Sansonetti
2
4
  #
3
5
  # Alexandria is free software; you can redistribute it and/or
@@ -21,7 +23,7 @@ module Alexandria
21
23
  include GetText
22
24
  GetText.bindtextdomain(Alexandria::TEXTDOMAIN, charset: 'UTF-8')
23
25
 
24
- GPL = <<EOL.freeze
26
+ GPL = <<EOL
25
27
  Alexandria is free software; you can redistribute it and/or
26
28
  modify it under the terms of the GNU General Public License as
27
29
  published by the Free Software Foundation; either version 2 of the