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
use crate::{PadActionEntry, PadController};
use glib::translate::*;
impl PadController {
#[doc(alias = "gtk_pad_controller_set_action_entries")]
pub fn set_action_entries(&self, entries: &[PadActionEntry]) {
let n_entries = entries.len() as i32;
let entry_strings = entries
.iter()
.map(|e| (e.label().to_glib_none(), e.action_name().to_glib_none()))
.collect::<Vec<_>>();
let entries = entries
.iter()
.zip(entry_strings.iter())
.map(|(e, (label, action_name))| ffi::GtkPadActionEntry {
type_: e.type_().into_glib(),
index: e.index(),
mode: e.mode(),
label: label.0,
action_name: action_name.0,
})
.collect::<Vec<_>>();
unsafe {
ffi::gtk_pad_controller_set_action_entries(
self.to_glib_none().0,
entries.as_ptr(),
n_entries,
);
}
}
}