alexandria-book-collection-manager 0.6.9 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +34 -30
  4. data/.rubocop_todo.yml +139 -54
  5. data/CHANGELOG.md +10 -0
  6. data/Gemfile +1 -0
  7. data/Rakefile +10 -11
  8. data/alexandria-book-collection-manager.gemspec +3 -2
  9. data/bin/alexandria +1 -1
  10. data/lib/alexandria.rb +3 -6
  11. data/lib/alexandria/about.rb +9 -9
  12. data/lib/alexandria/book_providers.rb +12 -12
  13. data/lib/alexandria/book_providers/adlibris.rb +14 -18
  14. data/lib/alexandria/book_providers/amazon_aws.rb +17 -31
  15. data/lib/alexandria/book_providers/amazon_ecs_util.rb +5 -6
  16. data/lib/alexandria/book_providers/barnes_and_noble.rb +51 -76
  17. data/lib/alexandria/book_providers/bol_it.rb +12 -12
  18. data/lib/alexandria/book_providers/deastore.rb +27 -31
  19. data/lib/alexandria/book_providers/douban.rb +9 -13
  20. data/lib/alexandria/book_providers/ibs_it.rb +10 -10
  21. data/lib/alexandria/book_providers/mcu.rb +12 -18
  22. data/lib/alexandria/book_providers/proxis.rb +14 -22
  23. data/lib/alexandria/book_providers/pseudomarc.rb +8 -18
  24. data/lib/alexandria/book_providers/renaud.rb +16 -16
  25. data/lib/alexandria/book_providers/siciliano.rb +25 -38
  26. data/lib/alexandria/book_providers/thalia.rb +13 -16
  27. data/lib/alexandria/book_providers/webster_it.rb +14 -18
  28. data/lib/alexandria/book_providers/worldcat.rb +21 -25
  29. data/lib/alexandria/book_providers/z3950.rb +19 -23
  30. data/lib/alexandria/config.rb +2 -2
  31. data/lib/alexandria/execution_queue.rb +3 -1
  32. data/lib/alexandria/export_library.rb +19 -22
  33. data/lib/alexandria/import_library.rb +14 -18
  34. data/lib/alexandria/import_library_csv.rb +12 -30
  35. data/lib/alexandria/models/book.rb +7 -9
  36. data/lib/alexandria/models/library.rb +44 -44
  37. data/lib/alexandria/net.rb +1 -1
  38. data/lib/alexandria/preferences.rb +12 -57
  39. data/lib/alexandria/scanners.rb +10 -6
  40. data/lib/alexandria/scanners/cuecat.rb +2 -2
  41. data/lib/alexandria/smart_library.rb +12 -12
  42. data/lib/alexandria/ui.rb +5 -2
  43. data/lib/alexandria/ui/callbacks.rb +106 -65
  44. data/lib/alexandria/ui/completion_models.rb +55 -51
  45. data/lib/alexandria/ui/dialogs/about_dialog.rb +1 -1
  46. data/lib/alexandria/ui/dialogs/acquire_dialog.rb +25 -51
  47. data/lib/alexandria/ui/dialogs/alert_dialog.rb +13 -11
  48. data/lib/alexandria/ui/dialogs/bad_isbns_dialog.rb +2 -2
  49. data/lib/alexandria/ui/dialogs/barcode_animation.rb +39 -23
  50. data/lib/alexandria/ui/dialogs/book_properties_dialog.rb +16 -21
  51. data/lib/alexandria/ui/dialogs/book_properties_dialog_base.rb +23 -24
  52. data/lib/alexandria/ui/dialogs/export_dialog.rb +46 -45
  53. data/lib/alexandria/ui/dialogs/import_dialog.rb +26 -35
  54. data/lib/alexandria/ui/dialogs/misc_dialogs.rb +11 -11
  55. data/lib/alexandria/ui/dialogs/new_book_dialog.rb +47 -59
  56. data/lib/alexandria/ui/dialogs/new_book_dialog_manual.rb +14 -13
  57. data/lib/alexandria/ui/dialogs/new_smart_library_dialog.rb +12 -11
  58. data/lib/alexandria/ui/dialogs/preferences_dialog.rb +37 -43
  59. data/lib/alexandria/ui/dialogs/smart_library_properties_dialog.rb +9 -8
  60. data/lib/alexandria/ui/dialogs/smart_library_properties_dialog_base.rb +47 -53
  61. data/lib/alexandria/ui/dndable.rb +5 -4
  62. data/lib/alexandria/ui/icons.rb +19 -19
  63. data/lib/alexandria/ui/iconview.rb +7 -12
  64. data/lib/alexandria/ui/iconview_tooltips.rb +22 -109
  65. data/lib/alexandria/ui/init.rb +7 -15
  66. data/lib/alexandria/ui/libraries_combo.rb +54 -48
  67. data/lib/alexandria/ui/listview.rb +30 -85
  68. data/lib/alexandria/ui/multi_drag_treeview.rb +110 -107
  69. data/lib/alexandria/ui/sidepane.rb +23 -25
  70. data/lib/alexandria/ui/sound.rb +18 -27
  71. data/lib/alexandria/ui/ui_manager.rb +126 -204
  72. data/lib/alexandria/undo_manager.rb +2 -2
  73. data/lib/alexandria/version.rb +4 -4
  74. data/spec/alexandria/book_providers_spec.rb +7 -4
  75. data/spec/alexandria/library_spec.rb +13 -16
  76. data/spec/alexandria/scanners/cuecat_spec.rb +1 -2
  77. data/spec/alexandria/ui/dialogs_spec.rb +5 -1
  78. data/spec/alexandria/ui/main_app_spec.rb +3 -3
  79. data/{lib/alexandria/utils.rb → spec/alexandria/ui/sound_spec.rb} +6 -11
  80. data/spec/alexandria/ui/ui_utilities_spec.rb +3 -3
  81. data/spec/spec_helper.rb +2 -2
  82. data/util/rake/fileinstall.rb +17 -33
  83. data/util/rake/gettextgenerate.rb +2 -4
  84. data/util/rake/omfgenerate.rb +1 -3
  85. metadata +23 -11
  86. data/lib/alexandria/ui/gtk_thread_help.rb +0 -89
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2004-2006 Laurent Sansonetti
2
- # Copyright (C) 2011 Matijs van Zuijlen
2
+ # Copyright (C) 2011, 2016 Matijs van Zuijlen
3
3
  #
4
4
  # Alexandria is free software; you can redistribute it and/or
5
5
  # modify it under the terms of the GNU General Public License as
@@ -32,9 +32,8 @@ module Alexandria
32
32
  def initialize(*args)
33
33
  super(*args)
34
34
 
35
- self.has_separator = false
36
35
  self.resizable = false
37
- vbox.border_width = 12
36
+ child.border_width = 12
38
37
 
39
38
  @controls = []
40
39
  end
@@ -73,7 +72,7 @@ module Alexandria
73
72
  entry.text = variable.value.to_s
74
73
  entry.mandatory = variable.mandatory?
75
74
  else
76
- entry = Gtk::ComboBox.new
75
+ entry = Gtk::ComboBoxText.new
77
76
  variable.possible_values.each do |value|
78
77
  entry.append_text(value.to_s)
79
78
  end
@@ -107,17 +106,14 @@ module Alexandria
107
106
  GetText.bindtextdomain(Alexandria::TEXTDOMAIN, charset: 'UTF-8')
108
107
 
109
108
  def initialize(parent, provider)
110
- super(_('Preferences for %s') % provider.fullname,
111
- parent,
112
- Gtk::Dialog::MODAL,
113
- [Gtk::Stock::CLOSE, Gtk::Dialog::RESPONSE_CLOSE])
114
- self.has_separator = false
115
- self.resizable = false
116
- vbox.border_width = 12
109
+ super(title: _('Preferences for %s') % provider.fullname,
110
+ parent: parent,
111
+ flags: :modal,
112
+ buttons: [[Gtk::Stock::CLOSE, :close]])
117
113
 
118
114
  table = Gtk::Table.new(0, 0)
119
115
  fill_table(table, provider)
120
- vbox.pack_start(table)
116
+ child.pack_start(table)
121
117
 
122
118
  signal_connect('destroy') { sync_variables }
123
119
 
@@ -135,9 +131,9 @@ module Alexandria
135
131
  super(_('New Provider'),
136
132
  parent,
137
133
  Gtk::Dialog::MODAL,
138
- [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL])
134
+ [Gtk::Stock::CANCEL, :cancel])
139
135
  @add_button = add_button(Gtk::Stock::ADD,
140
- Gtk::Dialog::RESPONSE_ACCEPT)
136
+ :accept)
141
137
 
142
138
  instances = BookProviders.abstract_classes.map(&:new)
143
139
  @selected_instance = nil
@@ -172,7 +168,7 @@ module Alexandria
172
168
  @selected_instance = instances[cb.active]
173
169
  fill_table(@table, @selected_instance)
174
170
  sensitize
175
- # FIXME this should be re-written once we have multiple
171
+ # FIXME: this should be re-written once we have multiple
176
172
  # abstract providers.
177
173
  end
178
174
  combo_type.active = 0
@@ -180,7 +176,7 @@ module Alexandria
180
176
  @table.attach_defaults(combo_type, 1, 2, 1, 2)
181
177
 
182
178
  show_all
183
- if run == Gtk::Dialog::RESPONSE_ACCEPT
179
+ if run == :accept
184
180
  @selected_instance.reinitialize(entry_name.text)
185
181
  sync_variables
186
182
  else
@@ -291,8 +287,7 @@ module Alexandria
291
287
  { sensitize_providers }
292
288
 
293
289
  @button_prov_setup.sensitive = false
294
- @button_prov_up.sensitive = @button_prov_down.sensitive =
295
- BookProviders.length > 1
290
+ @button_prov_up.sensitive = @button_prov_down.sensitive = BookProviders.length > 1
296
291
 
297
292
  @buttonbox_prov.set_child_secondary(@button_prov_add, true)
298
293
  @buttonbox_prov.set_child_secondary(@button_prov_remove, true)
@@ -337,7 +332,7 @@ module Alexandria
337
332
  iter = @scanner_device_model.append
338
333
  iter[0] = scanner.display_name
339
334
  iter[1] = scanner.name
340
- if (chosen_scanner_name == scanner.name)
335
+ if chosen_scanner_name == scanner.name
341
336
  @scanner_device_type.active = index
342
337
  end
343
338
  index += 1
@@ -350,7 +345,7 @@ module Alexandria
350
345
  def setup_enable_disable_popup
351
346
  # New Enable/Disable pop-up menu...
352
347
  @enable_disable_providers_menu = Gtk::Menu.new
353
- @enable_item = Gtk::MenuItem.new(_('Disable Provider'))
348
+ @enable_item = Gtk::MenuItem.new(label: _('Disable Provider'))
354
349
  @enable_item.signal_connect('activate') {
355
350
  prov = selected_provider
356
351
  prov.toggle_enabled
@@ -363,7 +358,8 @@ module Alexandria
363
358
  if event_is_right_click(event)
364
359
  if (path = widget.get_path_at_pos(event.x, event.y))
365
360
  widget.grab_focus
366
- obj, path = widget.selection, path.first
361
+ obj = widget.selection
362
+ path = path.first
367
363
  unless obj.path_is_selected?(path)
368
364
  widget.unselect_all
369
365
  obj.select_path(path)
@@ -373,7 +369,7 @@ module Alexandria
373
369
  already_enabled = sel[2]
374
370
  message = already_enabled ? _('Disable Provider') : _('Enable Provider')
375
371
  @enable_item.label = message
376
- Gtk.idle_add do
372
+ GLib::Idle.add do
377
373
  @enable_disable_providers_menu.popup(nil, nil, event.button, event.time)
378
374
  false
379
375
  end
@@ -389,12 +385,12 @@ module Alexandria
389
385
  selected_prov = @treeview_providers.selection.selected
390
386
  puts selected_prov.inspect
391
387
  if selected_prov
392
- Gtk.idle_add do
388
+ GLib::Idle.add do
393
389
  already_enabled = selected_prov[2]
394
390
  message = already_enabled ? _('Disable Provider') : _('Enable Provider')
395
391
  @enable_item.label = message
396
392
 
397
- @enable_disable_providers_menu.popup(nil, nil, 0, Gdk::Event::CURRENT_TIME)
393
+ @enable_disable_providers_menu.popup(nil, nil, 0, :current_time)
398
394
  false
399
395
  end
400
396
  else
@@ -404,11 +400,11 @@ module Alexandria
404
400
  end
405
401
 
406
402
  def event_is_right_click(event)
407
- event.event_type == Gdk::Event::BUTTON_PRESS and event.button == 3
403
+ (event.event_type == :button_press) && (event.button == 3)
408
404
  end
409
405
 
410
406
  def prefs_empty(prefs)
411
- prefs.empty? or (prefs.size == 1 and prefs.first.name == 'enabled')
407
+ prefs.empty? || ((prefs.size == 1) && (prefs.first.name == 'enabled'))
412
408
  end
413
409
 
414
410
  def on_provider_setup
@@ -474,15 +470,15 @@ module Alexandria
474
470
  "'%s'?") % provider.fullname,
475
471
  Gtk::Stock::DIALOG_QUESTION,
476
472
  [[Gtk::Stock::CANCEL,
477
- Gtk::Dialog::RESPONSE_CANCEL],
473
+ :cancel],
478
474
  [Gtk::Stock::DELETE,
479
- Gtk::Dialog::RESPONSE_OK]],
475
+ :ok]],
480
476
  _('If you continue, the provider and ' \
481
477
  'all of its preferences will be ' \
482
478
  'permanently deleted.'))
483
- dialog.default_response = Gtk::Dialog::RESPONSE_CANCEL
479
+ dialog.default_response = Gtk::ResponseType::CANCEL
484
480
  dialog.show_all
485
- if dialog.run == Gtk::Dialog::RESPONSE_OK
481
+ if dialog.run == :ok
486
482
  provider.remove
487
483
  BookProviders.update_priority
488
484
  reload_providers
@@ -500,9 +496,7 @@ module Alexandria
500
496
 
501
497
  def on_providers_button_press_event(_widget, event)
502
498
  # double left click
503
- if event.event_type == Gdk::Event::BUTTON2_PRESS and
504
- event.button == 1
505
-
499
+ if (event.event_type == :'2button_press') && (event.button == 1)
506
500
  on_provider_setup
507
501
  end
508
502
  end
@@ -524,11 +518,11 @@ module Alexandria
524
518
  model.clear
525
519
  BookProviders.each_with_index do |x, index|
526
520
  iter = model.append
527
- if x.enabled
528
- iter[0] = x.fullname
529
- else
530
- iter[0] = "<i>#{x.fullname}</i>"
531
- end
521
+ iter[0] = if x.enabled
522
+ x.fullname
523
+ else
524
+ "<i>#{x.fullname}</i>"
525
+ end
532
526
  iter[1] = x.name
533
527
  iter[2] = x.enabled
534
528
  iter[3] = index
@@ -544,11 +538,11 @@ module Alexandria
544
538
 
545
539
  def adjust_selected_provider(prov)
546
540
  iter = @treeview_providers.selection.selected
547
- if prov.enabled
548
- iter[0] = prov.fullname
549
- else
550
- iter[0] = "<i>#{prov.fullname}</i>"
551
- end
541
+ iter[0] = if prov.enabled
542
+ prov.fullname
543
+ else
544
+ "<i>#{prov.fullname}</i>"
545
+ end
552
546
  iter[2] = prov.enabled
553
547
  end
554
548
 
@@ -21,29 +21,30 @@ module Alexandria
21
21
  include GetText
22
22
  GetText.bindtextdomain(Alexandria::TEXTDOMAIN, charset: 'UTF-8')
23
23
 
24
- def initialize(parent, smart_library, &block)
24
+ def initialize(parent, smart_library)
25
25
  super(parent)
26
26
 
27
- add_buttons([Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL],
28
- [Gtk::Stock::SAVE, Gtk::Dialog::RESPONSE_OK])
27
+ add_buttons([Gtk::Stock::CANCEL, :cancel],
28
+ [Gtk::Stock::SAVE, :ok])
29
29
 
30
30
  self.title = _("Properties for '%s'") % smart_library.name
31
- self.default_response = Gtk::Dialog::RESPONSE_CANCEL
31
+ # FIXME: Should accept just :cancel
32
+ self.default_response = Gtk::ResponseType::CANCEL
32
33
 
33
34
  show_all
34
35
  smart_library.rules.each { |x| insert_new_rule(x) }
35
36
  update_rules_header_box(smart_library.predicate_operator_rule)
36
37
 
37
- while (response = run) != Gtk::Dialog::RESPONSE_CANCEL
38
- if response == Gtk::Dialog::RESPONSE_HELP
38
+ while (response = run) != :cancel
39
+ if response == :help
39
40
  Alexandria::UI.display_help(self, 'edit-smart-library')
40
- elsif response == Gtk::Dialog::RESPONSE_OK
41
+ elsif response == :ok
41
42
  if user_confirms_possible_weirdnesses_before_saving?
42
43
  smart_library.rules = smart_library_rules
43
44
  smart_library.predicate_operator_rule =
44
45
  predicate_operator_rule
45
46
  smart_library.save
46
- block.call(smart_library)
47
+ yield(smart_library)
47
48
  break
48
49
  end
49
50
  end
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2004-2006 Laurent Sansonetti
2
- # Copyright (C) 2011 Matijs van Zuijlen
2
+ # Copyright (C) 2011, 2016 Matijs van Zuijlen
3
3
  #
4
4
  # Alexandria is free software; you can redistribute it and/or
5
5
  # modify it under the terms of the GNU General Public License as
@@ -26,37 +26,38 @@ module Alexandria
26
26
  attr_reader :predicate_operator_rule
27
27
 
28
28
  def initialize(parent)
29
- super('', parent, Gtk::Dialog::MODAL,
30
- [Gtk::Stock::HELP, Gtk::Dialog::RESPONSE_HELP])
29
+ super(title: '',
30
+ parent: parent,
31
+ flags: :modal,
32
+ buttons: [[Gtk::Stock::HELP, :help]])
31
33
 
32
- self.window_position = Gtk::Window::POS_CENTER
33
- self.has_separator = false
34
+ self.window_position = :center
34
35
  self.resizable = true
35
36
  self.border_width = 4
36
- vbox.border_width = 12
37
+ child.border_width = 12
37
38
 
38
- main_box = Gtk::VBox.new
39
+ main_box = Gtk::Box.new :vertical
39
40
  main_box.border_width = 4
40
41
  main_box.spacing = 8
41
42
 
42
- vbox << main_box
43
+ child << main_box
43
44
 
44
45
  @smart_library_rules = []
45
46
 
46
- @rules_header_box = Gtk::HBox.new
47
+ @rules_header_box = Gtk::Box.new :horizontal
47
48
  @rules_header_box.spacing = 2
48
49
 
49
- @rules_box = Gtk::VBox.new
50
+ @rules_box = Gtk::Box.new :vertical
50
51
  @rules_box.spacing = 8
51
52
  @rules_box.border_width = 8
52
53
 
53
54
  scrollview = Gtk::ScrolledWindow.new
54
- scrollview.hscrollbar_policy = Gtk::POLICY_NEVER
55
- scrollview.vscrollbar_policy = Gtk::POLICY_AUTOMATIC
55
+ scrollview.hscrollbar_policy = :never
56
+ scrollview.vscrollbar_policy = :automatic
56
57
  scrollview.set_size_request(-1, 125)
57
58
  scrollview.add_with_viewport(@rules_box)
58
59
 
59
- main_box.pack_start(@rules_header_box, false, false, 0)
60
+ main_box.pack_start(@rules_header_box, expand: false, fill: false)
60
61
  main_box << scrollview
61
62
  setup_calendar_widgets
62
63
  end
@@ -82,15 +83,15 @@ module Alexandria
82
83
  self,
83
84
  _('Empty or conflictive condition'),
84
85
  Gtk::Stock::DIALOG_QUESTION,
85
- [[Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL],
86
- [_('_Save However'), Gtk::Dialog::RESPONSE_YES]],
86
+ [[Gtk::Stock::CANCEL, :cancel],
87
+ [_('_Save However'), :yes]],
87
88
  _('This smart library contains one or more conditions ' \
88
89
  'which are empty or conflict with each other. This is ' \
89
90
  'likely to result in never matching a book. Are you ' \
90
91
  'sure you want to save this library?'))
91
- dialog.default_response = Gtk::Dialog::RESPONSE_CANCEL
92
+ dialog.default_response = Gtk::ResponseType::CANCEL
92
93
  dialog.show_all
93
- confirmed = dialog.run == Gtk::Dialog::RESPONSE_YES
94
+ confirmed = dialog.run == :yes
94
95
  dialog.destroy
95
96
  confirmed
96
97
  end
@@ -103,10 +104,10 @@ module Alexandria
103
104
  label1.set_alignment(0.0, 0.5)
104
105
  label1.text = _('Match')
105
106
 
106
- cb = Gtk::ComboBox.new
107
+ cb = Gtk::ComboBoxText.new
107
108
  [_('all'), _('any')].each { |x| cb.append_text(x) }
108
109
  cb.signal_connect('changed') do
109
- @predicate_operator_rule = cb.active == 0 ? SmartLibrary::ALL_RULES : SmartLibrary::ANY_RULE
110
+ @predicate_operator_rule = cb.active.zero? ? SmartLibrary::ALL_RULES : SmartLibrary::ANY_RULE
110
111
  end
111
112
  cb.active =
112
113
  predicate_operator_rule == SmartLibrary::ALL_RULES ? 0 : 1
@@ -115,9 +116,9 @@ module Alexandria
115
116
  label2.set_alignment(0.0, 0.5)
116
117
  label2.text = _('of the following rules:')
117
118
 
118
- @rules_header_box.pack_start(label1, false, false, 0)
119
- @rules_header_box.pack_start(cb, false, false, 0)
120
- @rules_header_box.pack_start(label2, false, false, 0)
119
+ @rules_header_box.pack_start(label1, expand: false, fill: false)
120
+ @rules_header_box.pack_start(cb, expand: false, fill: false)
121
+ @rules_header_box.pack_start(label2, expand: false, fill: false)
121
122
  else
122
123
  label = Gtk::Label.new
123
124
  label.set_alignment(0.0, 0.5)
@@ -130,15 +131,11 @@ module Alexandria
130
131
  end
131
132
 
132
133
  def insert_new_rule(rule = nil)
133
- rule_box = Gtk::HBox.new
134
+ rule_box = Gtk::Box.new :horizontal
134
135
  rule_box.spacing = 8
135
136
 
136
- left_operand_combo = Gtk::ComboBox.new
137
- operator_combo = Gtk::ComboBox.new
138
- operator_model = Gtk::ListStore.new(String)
139
- # we can't just pass the model to the combo constructor,
140
- # it doesn't seem to work properly
141
- operator_combo.model = operator_model
137
+ left_operand_combo = Gtk::ComboBoxText.new
138
+ operator_combo = Gtk::ComboBoxText.new
142
139
 
143
140
  value_entry = Gtk::Entry.new
144
141
 
@@ -157,17 +154,17 @@ module Alexandria
157
154
  # ##date_entry.spacing = 8
158
155
  entry_label = Gtk::Label.new('')
159
156
 
160
- add_button = Gtk::Button.new('')
157
+ add_button = Gtk::Button.new(label: '')
161
158
  add_button.remove(add_button.children.first)
162
- add_button << Gtk::Image.new(Gtk::Stock::ADD,
163
- Gtk::IconSize::BUTTON)
159
+ add_button << Gtk::Image.new(stock: Gtk::Stock::ADD,
160
+ size: Gtk::IconSize::BUTTON)
164
161
 
165
162
  add_button.signal_connect('clicked') { insert_new_rule }
166
163
 
167
- remove_button = Gtk::Button.new('')
164
+ remove_button = Gtk::Button.new(label: '')
168
165
  remove_button.remove(remove_button.children.first)
169
- remove_button << Gtk::Image.new(Gtk::Stock::REMOVE,
170
- Gtk::IconSize::BUTTON)
166
+ remove_button << Gtk::Image.new(stock: Gtk::Stock::REMOVE,
167
+ size: Gtk::IconSize::BUTTON)
171
168
 
172
169
  remove_button.signal_connect('clicked') do |_button|
173
170
  idx = @rules_box.children.index(rule_box)
@@ -187,8 +184,7 @@ module Alexandria
187
184
  operations = SmartLibrary::Rule.operations_for_operand(operand)
188
185
  operation = operations[operator_combo.active]
189
186
 
190
- value_entry.visible = date_entry.visible =
191
- entry_label.visible = false
187
+ value_entry.visible = date_entry.visible = entry_label.visible = false
192
188
  right_operand = operation.last
193
189
  unless right_operand.nil?
194
190
  entry = case right_operand.klass.name
@@ -219,30 +215,28 @@ module Alexandria
219
215
  left_operand_combo.signal_connect('changed') do
220
216
  operand = operands[left_operand_combo.active]
221
217
  operator_combo.freeze_notify do
222
- operator_combo.model.clear
218
+ operator_combo.remove_all
223
219
  operations = SmartLibrary::Rule.operations_for_operand(operand)
224
220
  operations.each do |operation|
225
221
  operator = operation.first
226
- iter = operator_combo.model.append
227
- iter[0] = operator.name
222
+ operator_combo.append_text(operator.name)
228
223
  end
229
224
  operator_combo.active = 0
230
225
  end
231
226
  end
232
227
 
233
- rule_box.pack_start(left_operand_combo, false, false, 0)
234
- rule_box.pack_start(operator_combo, false, false, 0)
228
+ rule_box.pack_start(left_operand_combo, expand: false, fill: false)
229
+ rule_box.pack_start(operator_combo, expand: false, fill: false)
235
230
  rule_box.pack_start(value_entry)
236
231
  rule_box.pack_start(date_entry)
237
- rule_box.pack_start(entry_label, false, false, 0)
238
- rule_box.pack_end(remove_button, false, false, 0)
239
- rule_box.pack_end(add_button, false, false, 0)
232
+ rule_box.pack_start(entry_label, expand: false, fill: false)
233
+ rule_box.pack_end(remove_button, expand: false, fill: false)
234
+ rule_box.pack_end(add_button, expand: false, fill: false)
240
235
 
241
236
  rule_box.show_all
242
- value_entry.visible = date_entry.visible = entry_label.visible =
243
- false
237
+ value_entry.visible = date_entry.visible = entry_label.visible = false
244
238
 
245
- @rules_box.pack_start(rule_box, false, true, 0)
239
+ @rules_box.pack_start(rule_box, expand: false, fill: true)
246
240
 
247
241
  if rule
248
242
  operand_idx = operands.index(rule.operand)
@@ -250,7 +244,7 @@ module Alexandria
250
244
  SmartLibrary::Rule.operations_for_operand(rule.operand)
251
245
  operation_idx = operations.map(&:first).index(rule.operation)
252
246
 
253
- if !operand_idx.nil? and !operation_idx.nil?
247
+ if !operand_idx.nil? && !operation_idx.nil?
254
248
  left_operand_combo.active = operand_idx
255
249
  operator_combo.active = operation_idx
256
250
  unless rule.value.nil?
@@ -266,7 +260,7 @@ module Alexandria
266
260
  left_operand_combo.active = 0
267
261
  end
268
262
 
269
- @rules_box.check_resize # force a layout
263
+ @rules_box.check_resize # force a layout
270
264
  update_rules_header_box
271
265
  sensitize_remove_rule_buttons
272
266
  end
@@ -313,10 +307,10 @@ module Alexandria
313
307
  @calendar_popup.decorated = false
314
308
  @calendar_popup.skip_taskbar_hint = true
315
309
  @calendar_popup.skip_pager_hint = true
316
- @calendar_popup.events = [Gdk::Event::FOCUS_CHANGE_MASK]
310
+ @calendar_popup.events = [:focus_change_mask]
317
311
 
318
312
  @calendar_popup.set_transient_for(self)
319
- @calendar_popup.set_type_hint(Gdk::Window::TYPE_HINT_DIALOG)
313
+ @calendar_popup.set_type_hint(:dialog)
320
314
  @calendar_popup.name = 'calendar-popup'
321
315
  @calendar_popup.resizable = false
322
316
  # @calendar_popup.border_width = 4
@@ -360,7 +354,7 @@ module Alexandria
360
354
  @calendar_popup.hide_all
361
355
  self.modal = true
362
356
 
363
- Gtk.timeout_add(150) do
357
+ GLib::Timeout.add(150) do
364
358
  # If we set @popup_displayed=false immediately, then a click
365
359
  # event on the primary icon of the Entry simultaneous with
366
360
  # the focus-out-event of the Calendar causes the Calendar to