show a file chooser dialog

This commit is contained in:
Josh Holtrop 2015-12-22 15:52:06 -05:00
parent 8d6729841e
commit dfcd03901e

View File

@ -12,7 +12,17 @@ int main(string[] args)
var button = new Button.with_label("Select a file"); var button = new Button.with_label("Select a file");
button.clicked.connect(() => { button.clicked.connect(() => {
button.label = "clicked"; var file_chooser = new FileChooserDialog(
"Open File",
null,
FileChooserAction.OPEN,
Stock.CANCEL, ResponseType.CANCEL,
Stock.OPEN, ResponseType.ACCEPT);
if (file_chooser.run() == ResponseType.ACCEPT)
{
stdout.printf("File selected: %s\n", file_chooser.get_filename());
}
file_chooser.destroy();
}); });
window.add(button); window.add(button);