From 2f3e2b5474834e3d733edf09b831c5607d451f49 Mon Sep 17 00:00:00 2001 From: Reyk Floeter Date: Tue, 10 Dec 2019 15:24:36 +0000 Subject: Add FileSelection dialog type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds the FileSelection struct representing a file selection dialog. It can be displayed using the backend’s show_file_selection function. Currently, we only support file open dialogs (i. e. choosing an existing file). Support for save dialogs should be added in the future. --- examples/file_selection.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 examples/file_selection.rs (limited to 'examples/file_selection.rs') diff --git a/examples/file_selection.rs b/examples/file_selection.rs new file mode 100644 index 0000000..5436742 --- /dev/null +++ b/examples/file_selection.rs @@ -0,0 +1,13 @@ +// Copyright (C) 2019 Robin Krahl +// SPDX-License-Identifier: MIT + +use dialog::DialogBox; + +fn main() -> dialog::Result<()> { + let choice = dialog::FileSelection::new("Please select a file") + .title("File Chooser Example") + .path("/etc") + .show()?; + println!("The user chose: {:?}", choice); + Ok(()) +} -- cgit v1.2.1