summaryrefslogtreecommitdiff
path: root/iced_builder/src
diff options
context:
space:
mode:
Diffstat (limited to 'iced_builder/src')
-rw-r--r--iced_builder/src/dialogs.rs14
-rw-r--r--iced_builder/src/main.rs5
2 files changed, 11 insertions, 8 deletions
diff --git a/iced_builder/src/dialogs.rs b/iced_builder/src/dialogs.rs
index c9a5ba2..56d22b2 100644
--- a/iced_builder/src/dialogs.rs
+++ b/iced_builder/src/dialogs.rs
@@ -18,13 +18,17 @@ pub fn warning_dialog(description: impl Into<String>) {
.show();
}
-pub fn unsaved_changes_dialog(
- description: impl Into<String>,
-) -> MessageDialogResult {
- MessageDialog::new()
+pub fn unsaved_changes_dialog(description: impl Into<String>) -> bool {
+ let result = MessageDialog::new()
.set_level(MessageLevel::Warning)
.set_buttons(MessageButtons::OkCancel)
.set_title("Unsaved changes")
.set_description(description)
- .show()
+ .show();
+
+ if let MessageDialogResult::Ok = result {
+ true
+ } else {
+ false
+ }
}
diff --git a/iced_builder/src/main.rs b/iced_builder/src/main.rs
index 02e1ae0..86e478d 100644
--- a/iced_builder/src/main.rs
+++ b/iced_builder/src/main.rs
@@ -14,7 +14,6 @@ use iced_builder::types::{
Action, DesignerPage, ElementName, Message, Project,
};
use iced_builder::{icon, Error};
-use rfd::MessageDialogResult;
use tokio::runtime;
fn main() -> Result<(), Box<dyn std::error::Error>> {
@@ -235,7 +234,7 @@ impl App {
self.project_path = None;
self.editor_content = text_editor::Content::new();
} else {
- if let MessageDialogResult::Ok = unsaved_changes_dialog("You have unsaved changes. Do you wish to discard these and create a new project?") {
+ if unsaved_changes_dialog("You have unsaved changes. Do you wish to discard these and create a new project?") {
self.is_dirty = false;
self.project = Project::new();
self.project_path = None;
@@ -254,7 +253,7 @@ impl App {
Message::FileOpened,
);
} else {
- if let MessageDialogResult::Ok = unsaved_changes_dialog("You have unsaved changes. Do you wish to discard these and open another project?") {
+ if unsaved_changes_dialog("You have unsaved changes. Do you wish to discard these and open another project?") {
self.is_dirty = false;
self.is_loading = true;
return Task::perform(Project::from_file(), Message::FileOpened);