aboutsummaryrefslogtreecommitdiff
path: root/src/dialogs.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/dialogs.rs')
-rw-r--r--src/dialogs.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/dialogs.rs b/src/dialogs.rs
index 8f5b951..41b8c86 100644
--- a/src/dialogs.rs
+++ b/src/dialogs.rs
@@ -94,7 +94,7 @@ pub fn show_open_dialog(
/// Shows a file save dialog and handles the response.
pub fn show_save_dialog(
window: &gtk::Window,
- current_file: Option<PathBuf>,
+ current_file: Option<&PathBuf>,
close_after: bool,
sender: ComponentSender<AppModel>,
) {
@@ -110,7 +110,7 @@ pub fn show_save_dialog(
dialog.add_filter(&create_file_filter());
let default_filename = "map.wmap";
- if let Some(ref current_path) = current_file {
+ if let Some(current_path) = current_file {
if let Some(parent) = current_path.parent() {
let folder = gtk::gio::File::for_path(parent);
dialog.set_current_folder(Some(&folder)).ok();
@@ -191,7 +191,7 @@ fn create_image_filter(format: ImageFormat) -> gtk::FileFilter {
/// Shows an export image dialog and handles the response.
pub fn show_export_dialog(
window: &gtk::Window,
- current_file: Option<PathBuf>,
+ current_file: Option<&PathBuf>,
sender: ComponentSender<AppModel>,
) {
let dialog = gtk::FileChooserDialog::new(
@@ -217,13 +217,13 @@ pub fn show_export_dialog(
.unwrap_or("map")
.to_string();
- if let Some(ref current_path) = current_file
+ if let Some(current_path) = current_file
&& let Some(parent) = current_path.parent()
{
let folder = gtk::gio::File::for_path(parent);
dialog.set_current_folder(Some(&folder)).ok();
}
- dialog.set_current_name(&format!("{}.png", base_name));
+ dialog.set_current_name(&format!("{base_name}.png"));
// Update extension when filter changes
{
@@ -235,7 +235,7 @@ pub fn show_export_dialog(
} else {
"svg"
};
- dialog.set_current_name(&format!("{}.{}", base_name_clone, ext));
+ dialog.set_current_name(&format!("{base_name_clone}.{ext}"));
});
}