Skip to content

Commit

Permalink
disable save action when busy
Browse files Browse the repository at this point in the history
  • Loading branch information
SeaDve committed Dec 8, 2023
1 parent b20462a commit c657032
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,12 @@ mod imp {
None
}),
);
document_signal_group.connect_notify_local(
Some("busy-progress"),
clone!(@weak obj => move |_, _| {
obj.update_save_action();
}),
);
self.document_signal_group
.set(document_signal_group)
.unwrap();
Expand Down Expand Up @@ -253,6 +259,8 @@ impl Window {

let document_signal_group = imp.document_signal_group.get().unwrap();
document_signal_group.set_target(Some(document));

self.update_save_action();
}

fn document(&self) -> Document {
Expand Down Expand Up @@ -474,6 +482,11 @@ impl Window {

Ok(Some(texture))
}

fn update_save_action(&self) {
let is_document_busy = self.document().is_busy();
self.action_set_enabled("win.save-document", !is_document_busy);
}
}

fn graphviz_file_filters() -> gio::ListStore {
Expand Down

0 comments on commit c657032

Please sign in to comment.