Make the param field of the action! macro optional

parent 56b4bd00
Pipeline #160348 passed with stages
in 6 minutes and 20 seconds
......@@ -28,6 +28,11 @@ macro_rules! send {
#[macro_export]
macro_rules! action {
($actions_group:expr, $name:expr, $callback:expr) => {
let simple_action = gio::SimpleAction::new($name, None);
simple_action.connect_activate($callback);
$actions_group.add_action(&simple_action);
};
($actions_group:expr, $name:expr, $param_type:expr, $callback:expr) => {
let simple_action = gio::SimpleAction::new($name, $param_type);
simple_action.connect_activate($callback);
......@@ -37,6 +42,11 @@ macro_rules! action {
#[macro_export]
macro_rules! stateful_action {
($actions_group:expr, $name:expr, $state:expr, $callback:expr) => {
let simple_action = gio::SimpleAction::new_stateful($name, None, &$state.to_variant());
simple_action.connect_activate($callback);
$actions_group.add_action(&simple_action);
};
($actions_group:expr, $name:expr, $param_type:expr, $state:expr, $callback:expr) => {
let simple_action = gio::SimpleAction::new_stateful($name, $param_type, &$state.to_variant());
simple_action.connect_activate($callback);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment