edit_window: Disable "Done" if image is unchanged
This commit is contained in:
parent
84e58f28df
commit
bbc61a3215
2 changed files with 17 additions and 6 deletions
|
|
@ -41,7 +41,7 @@ mod imp {
|
|||
#[template_child]
|
||||
cancel: TemplateChild<gtk::Button>,
|
||||
#[template_child]
|
||||
done: TemplateChild<gtk::MenuButton>,
|
||||
pub(crate) done: TemplateChild<gtk::MenuButton>,
|
||||
|
||||
#[property(get, construct_only)]
|
||||
original_image: OnceCell<LpImage>,
|
||||
|
|
@ -263,6 +263,16 @@ impl LpEditWindow {
|
|||
pub fn set_operations(&self, operations: Option<Arc<glycin::Operations>>) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue