diff options
Diffstat (limited to 'src/backends/zenity.rs')
-rw-r--r-- | src/backends/zenity.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/backends/zenity.rs b/src/backends/zenity.rs index 0deca0a..ac0f98f 100644 --- a/src/backends/zenity.rs +++ b/src/backends/zenity.rs @@ -3,7 +3,9 @@ use std::process; -use crate::{Choice, Error, Input, Message, Password, Question, Result}; +use crate::{ + Choice, Error, FileSelection, FileSelectionMode, Input, Message, Password, Question, Result, +}; /// The `zenity` backend. /// @@ -163,4 +165,14 @@ impl super::Backend for Zenity { self.execute(args, &question.title) .and_then(|output| get_choice(output.status)) } + + fn show_file_selection(&self, file_selection: &FileSelection) -> Result<Option<String>> { + let dir = file_selection.path_to_string().ok_or("path not valid")?; + let mut args = vec!["--file-selection", "--filename", &dir]; + if file_selection.mode == FileSelectionMode::Save { + args.push("--save"); + } + self.execute(args, &file_selection.title) + .and_then(get_stdout) + } } |