1311: def ask_for_location
1312: dialog = Dialog.new(
1313: "Load data from location...",
1314: nil, nil,
1315: [ Stock::OK, Dialog::RESPONSE_ACCEPT ],
1316: [ Stock::CANCEL, Dialog::RESPONSE_REJECT ]
1317: )
1318: hbox = HBox.new(false, 5)
1319:
1320: hbox.pack_start(Label.new("Location:"), false)
1321: hbox.pack_start(location_input = Entry.new)
1322: location_input.width_chars = 60
1323: location_input.text = @location || ''
1324:
1325: dialog.vbox.pack_start(hbox, false)
1326:
1327: dialog.signal_connect('key-press-event''key-press-event', &DEFAULT_DIALOG_KEY_PRESS_HANDLER)
1328: dialog.show_all
1329: dialog.run do |response|
1330: if response == Dialog::RESPONSE_ACCEPT
1331: return @location = location_input.text
1332: end
1333: end
1334: return
1335: ensure
1336: dialog.destroy if dialog
1337: end