libadwaita/
breakpoint.rs

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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::{prelude::*, Breakpoint};
use glib::translate::*;

impl Breakpoint {
    /// Adds @n_setters setters to @self.
    ///
    /// This is a convenience function for adding multiple setters at once.
    ///
    /// See [`add_setter()`][Self::add_setter()].
    ///
    /// This function is meant to be used by language bindings.
    /// ## `objects`
    /// setter target object
    /// ## `names`
    /// setter target properties
    /// ## `values`
    /// setter values
    #[doc(alias = "adw_breakpoint_add_settersv")]
    #[doc(alias = "add_settersv")]
    pub fn add_setters(&self, additions: &[(&impl IsA<glib::Object>, &str, impl ToValue)]) {
        let n_setters = additions.len() as _;
        let objects = additions
            .iter()
            .map(|(o, _n, _v)| (*o).clone().upcast::<glib::Object>())
            .collect::<Vec<_>>();
        let names = additions.iter().map(|(_o, n, _v)| *n).collect::<Vec<_>>();
        let values = additions
            .iter()
            .map(|(_o, _n, v)| v.to_value())
            .collect::<Vec<_>>();

        unsafe {
            ffi::adw_breakpoint_add_settersv(
                self.to_glib_none().0,
                n_setters,
                objects.as_slice().to_glib_none().0,
                names.as_slice().to_glib_none().0,
                values.as_slice().to_glib_none().0,
            );
        }
    }
}