show a file chooser dialog
This commit is contained in:
parent
8d6729841e
commit
dfcd03901e
@ -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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user