diff options
| author | Robin Krahl <robin.krahl@ireas.org> | 2019-12-10 18:46:44 +0000 | 
|---|---|---|
| committer | Robin Krahl <robin.krahl@ireas.org> | 2019-12-10 19:56:32 +0100 | 
| commit | 89afcb4844dd484f0c9cdfef7e5ff8d751647c43 (patch) | |
| tree | f23e994a66ec562685ca44caa6ba939de34acdf1 /examples | |
| parent | 7d1a146003117694e9d970b0cf08c514ffad1c6e (diff) | |
| download | dialog-rs-89afcb4844dd484f0c9cdfef7e5ff8d751647c43.tar.gz dialog-rs-89afcb4844dd484f0c9cdfef7e5ff8d751647c43.tar.bz2 | |
Add Open/Save mode to the file selection dialogfile-selection
This patch adds the option to set a FileSelectionMode, either Open or
Save.  Not all backends might support this – currently, only zenity and
kdialog do.  Per default, the Open mode is used (as before).
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/file_selection.rs | 10 | 
1 files changed, 9 insertions, 1 deletions
| diff --git a/examples/file_selection.rs b/examples/file_selection.rs index 5436742..5d2d860 100644 --- a/examples/file_selection.rs +++ b/examples/file_selection.rs @@ -5,9 +5,17 @@ use dialog::DialogBox;  fn main() -> dialog::Result<()> {      let choice = dialog::FileSelection::new("Please select a file") -        .title("File Chooser Example") +        .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(())  } | 
