def ask_for_location
dialog = Dialog.new(
"Load data from location...",
nil, nil,
[ Stock::OK, Dialog::RESPONSE_ACCEPT ],
[ Stock::CANCEL, Dialog::RESPONSE_REJECT ]
)
hbox = HBox.new(false, 5)
hbox.pack_start(Label.new("Location:"), false)
hbox.pack_start(location_input = Entry.new)
location_input.width_chars = 60
location_input.text = @location || ''
dialog.vbox.pack_start(hbox, false)
dialog.signal_connect('key-press-event''key-press-event', &DEFAULT_DIALOG_KEY_PRESS_HANDLER)
dialog.show_all
dialog.run do |response|
if response == Dialog::RESPONSE_ACCEPT
return @location = location_input.text
end
end
return
ensure
dialog.destroy if dialog
end