disable apply button on activate to prevent double-click action

This commit is contained in:
yggverse 2024-11-30 19:04:32 +02:00
parent c4b9fdebf2
commit 065c176c4f

View File

@ -88,7 +88,13 @@ impl Widget {
pub fn on_apply(&self, callback: impl Fn(Value) + 'static) { pub fn on_apply(&self, callback: impl Fn(Value) + 'static) {
self.gobject.connect_response(Some(RESPONSE_APPLY.0), { self.gobject.connect_response(Some(RESPONSE_APPLY.0), {
let form = self.form.clone(); let form = self.form.clone();
move |_, _| callback(form.list.selected()) move |this, _| {
// Prevent double-click action
this.set_response_enabled(RESPONSE_APPLY.0, false);
// Result
callback(form.list.selected())
}
}); });
} }