Macro gtk_macros::get_action[][src]

macro_rules! get_action {
    ($actions:expr, @$name:ident) => { ... };
    ($actions:expr, $name:ident) => { ... };
}

Retrieve an action from a gio::ActionGroup

  • Before:

    Example:

    let actions = gio::SimpleActionGroup::new();
    action!(
        actions,
        "delete",
        move |action, _| {
            // Do something
        },
    );
    let action = actions.lookup_action("delete")
                    .unwrap()
                    .downcast::<gio::SimpleAction>()
                    .unwrap();
    action.set_enabled(false);
  • After:

    Example:

    let actions = gio::SimpleActionGroup::new();
    action!(
        actions,
        "delete",
        move |action, _| {
            // Do something
        },
    );
    get_action!(actions, @delete).set_enabled(false);