1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::Toast;
use glib::translate::*;
use glib::variant::ToVariant;

impl Toast {
    /// Sets the parameter for action invocations.
    ///
    /// This is a convenience function that calls `GLib::Variant::new()` for
    /// @format_string and uses the result to call
    /// [`set_action_target_value()`][Self::set_action_target_value()].
    ///
    /// If you are setting a string-valued target and want to set
    /// the action name at the same time, you can use
    /// [`set_detailed_action_name()`][Self::set_detailed_action_name()].
    /// ## `format_string`
    /// a variant format string
    #[doc(alias = "adw_toast_set_action_target")]
    #[doc(alias = "adw_toast_set_action_target_value")]
    pub fn set_action_target(&self, target: Option<&impl ToVariant>) {
        unsafe {
            ffi::adw_toast_set_action_target_value(
                self.to_glib_none().0,
                target.map(|v| v.to_variant()).to_glib_none().0,
            );
        }
    }
}