Don’t understand why do I see this warning,
when action defined as the stateful and without arguments:
Trying to invoke action without arguments, but action expects parameter with type 's'
SimpleAction::new_stateful(
"some-name",
None, // <-
&DEFAULT_STATE.to_variant(),
)
It happened when activate action with accels / hotkey only, there is nothing special:
simple_action.connect_activate(move |this, _| {
let state = this
.state()
.expect("State value required")
.get::<i32>()
.expect("Parameter type does not match `i32`");
// it's just return current state formatted
callback(if state == DEFAULT_STATE {
None
} else {
Some(state)
})
});