1247: def ask_for_location
1248: dialog = Dialog.new(
1249: "Load data from location...",
1250: nil, nil,
1251: [ Stock::OK, Dialog::RESPONSE_ACCEPT ],
1252: [ Stock::CANCEL, Dialog::RESPONSE_REJECT ]
1253: )
1254: hbox = HBox.new(false, 5)
1255:
1256: hbox.add(Label.new("Location:"))
1257: hbox.pack_start(location_input = Entry.new)
1258: location_input.width_chars = 60
1259: location_input.text = @location || ''
1260:
1261: dialog.vbox.add(hbox)
1262:
1263: dialog.signal_connect('key-press-event''key-press-event', &DEFAULT_DIALOG_KEY_PRESS_HANDLER)
1264: dialog.show_all
1265: dialog.run do |response|
1266: if response == Dialog::RESPONSE_ACCEPT
1267: return @location = location_input.text
1268: end
1269: end
1270: return
1271: ensure
1272: dialog.destroy if dialog
1273: end