Class: Alexandria::UI::NewSmartLibraryDialog

Inherits:
SmartLibraryPropertiesDialogBase show all
Includes:
GetText
Defined in:
lib/alexandria/ui/new_smart_library_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) ⇒ NewSmartLibraryDialog

Returns a new instance of NewSmartLibraryDialog.



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

def initialize(parent)
  super(parent)

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

  dialog.title = _("New Smart Library")
  # FIXME: Should accept just :cancel
  dialog.default_response = Gtk::ResponseType::CANCEL
  insert_new_rule
end

Instance Method Details

#acquireObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/alexandria/ui/new_smart_library_dialog.rb', line 25

def acquire
  dialog.show_all

  result = nil
  while ((response = dialog.run) != Gtk::ResponseType::CANCEL) &&
      (response != Gtk::ResponseType::DELETE_EVENT)

    case response
    when Gtk::ResponseType::HELP
      handle_help_response
    when Gtk::ResponseType::OK
      result = handle_ok_response
      break if result
    end
  end

  dialog.destroy
  result
end