gtk4/shortcut.rs
// Take a look at the license at the top of the repository in the LICENSE file.
use crate::{prelude::*, Shortcut, ShortcutAction, ShortcutTrigger};
impl Shortcut {
/// Creates a new [`Shortcut`][crate::Shortcut] that is triggered by @trigger and then activates
/// @action with arguments given by @format_string.
/// ## `trigger`
/// The trigger that will trigger the shortcut
/// ## `action`
/// The action that will be activated upon
/// triggering
/// ## `format_string`
/// GVariant format string for arguments or [`None`] for
/// no arguments
///
/// # Returns
///
/// a new [`Shortcut`][crate::Shortcut]
#[doc(alias = "gtk_shortcut_new_with_arguments")]
#[doc(alias = "new_with_arguments")]
pub fn with_arguments(
trigger: Option<impl IsA<ShortcutTrigger>>,
action: Option<impl IsA<ShortcutAction>>,
args: &glib::Variant,
) -> Self {
assert_initialized_main_thread!();
let shortcut = Shortcut::new(trigger, action);
shortcut.set_arguments(Some(args));
shortcut
}
}