Class: Alexandria::UI::SmartLibraryPropertiesDialog

Inherits:
SmartLibraryPropertiesDialogBase show all
Includes:
GetText
Defined in:
lib/alexandria/ui/smart_library_properties_dialog.rb

Instance Attribute Summary

Attributes inherited from SmartLibraryPropertiesDialogBase

#dialog, #predicate_operator_rule

Instance Method Summary collapse

Methods inherited from SmartLibraryPropertiesDialogBase

#apply_smart_rule_for_rule_box, #handle_add_rule_clicked, #handle_date_icon_press, #handle_remove_rule_clicked

Methods included from CalendarPopup

#assign_selected_date, #clear_date_entry, #display_calendar_popup, #setup_calendar_widgets

Methods included from Logging

included, #log

Constructor Details

#initialize(parent, smart_library) ⇒ SmartLibraryPropertiesDialog

Returns a new instance of SmartLibraryPropertiesDialog.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/alexandria/ui/smart_library_properties_dialog.rb', line 13

def initialize(parent, smart_library)
  super(parent)

  @smart_library = smart_library

  dialog.add_buttons([Gtk::Stock::CANCEL, :cancel],
                     [Gtk::Stock::SAVE, :ok])

  dialog.title = _("Properties for '%s'") % @smart_library.name
  # FIXME: Should accept just :cancel
  dialog.default_response = Gtk::ResponseType::CANCEL
  @smart_library.rules.each { |x| insert_new_rule(x) }
  update_rules_header_box(@smart_library.predicate_operator_rule)
end

Instance Method Details

#acquireObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/alexandria/ui/smart_library_properties_dialog.rb', line 28

def acquire
  dialog.show_all

  while (response = dialog.run) != Gtk::ResponseType::CANCEL
    case response
    when Gtk::ResponseType::HELP
      handle_help_response
    when Gtk::ResponseType::OK
      break if handle_ok_response
    end
  end

  dialog.destroy
end