diff --git a/src/window.rs b/src/window.rs index a694712..f57e9f5 100644 --- a/src/window.rs +++ b/src/window.rs @@ -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(); @@ -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 { @@ -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 {