aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2019-12-10 20:02:59 +0100
committerRobin Krahl <robin.krahl@ireas.org>2019-12-10 20:02:59 +0100
commite152b4f4b6aa274774d1c750c3106528ebd4f1d4 (patch)
treef23e994a66ec562685ca44caa6ba939de34acdf1 /examples
parent3b76a0a46ce38eef7fe3e5a969cec6ffee47f227 (diff)
parent89afcb4844dd484f0c9cdfef7e5ff8d751647c43 (diff)
downloaddialog-rs-e152b4f4b6aa274774d1c750c3106528ebd4f1d4.tar.gz
dialog-rs-e152b4f4b6aa274774d1c750c3106528ebd4f1d4.tar.bz2
Merge branch 'file-selection' into next
This patch series introduces a new FileSelection dialog type, see [0]. [0] https://lists.sr.ht/~ireas/dialog-rs-dev/%3C20191203122011.GA64086%40kunshan.atexit.net%3E
Diffstat (limited to 'examples')
-rw-r--r--examples/file_selection.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/examples/file_selection.rs b/examples/file_selection.rs
new file mode 100644
index 0000000..5d2d860
--- /dev/null
+++ b/examples/file_selection.rs
@@ -0,0 +1,21 @@
+// Copyright (C) 2019 Robin Krahl <robin.krahl@ireas.org>
+// SPDX-License-Identifier: MIT
+
+use dialog::DialogBox;
+
+fn main() -> dialog::Result<()> {
+ let choice = dialog::FileSelection::new("Please select a file")
+ .title("File Chooser Example (Open)")
+ .path("/etc")
+ .show()?;
+ println!("The user chose: {:?}", choice);
+
+ let choice = dialog::FileSelection::new("Please select a file")
+ .title("File Chooser Example (Save)")
+ .mode(dialog::FileSelectionMode::Save)
+ .path("/etc")
+ .show()?;
+ println!("The user chose: {:?}", choice);
+
+ Ok(())
+}