diff --git a/src/widgets/edit_window.rs b/src/widgets/edit_window.rs index 7a0b7af..9577a7f 100644 --- a/src/widgets/edit_window.rs +++ b/src/widgets/edit_window.rs @@ -41,7 +41,7 @@ mod imp { #[template_child] cancel: TemplateChild, #[template_child] - done: TemplateChild, + pub(crate) done: TemplateChild, #[property(get, construct_only)] original_image: OnceCell, @@ -263,6 +263,16 @@ impl LpEditWindow { pub fn set_operations(&self, operations: Option>) { let imp = self.imp(); + let done_sensitive = operations + .as_ref() + .is_some_and(|x| !x.operations().is_empty()); + if done_sensitive { + imp.done.add_css_class("suggested-action"); + } else { + imp.done.remove_css_class("suggested-action"); + } + imp.done.set_sensitive(done_sensitive); + imp.operations.replace(operations); } diff --git a/src/widgets/edit_window.ui b/src/widgets/edit_window.ui index 5991766..1559eb8 100644 --- a/src/widgets/edit_window.ui +++ b/src/widgets/edit_window.ui @@ -19,6 +19,10 @@ _Done true + false + @@ -74,7 +78,7 @@ Original image will be moved to the trash 0 @@ -87,9 +91,6 @@ -