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
use crate::PixbufAnimation;
use crate::PixbufAnimationIter;
use glib::object::IsA;
use glib::translate::*;
use std::ptr;
use std::time::SystemTime;
pub trait PixbufAnimationExtManual {
#[doc(alias = "gdk_pixbuf_animation_get_iter")]
#[doc(alias = "get_iter")]
fn iter(&self, start_time: Option<SystemTime>) -> PixbufAnimationIter;
}
impl<T: IsA<PixbufAnimation>> PixbufAnimationExtManual for T {
fn iter(&self, start_time: Option<SystemTime>) -> PixbufAnimationIter {
let start_time = start_time.map(|s| {
let diff = s
.duration_since(SystemTime::UNIX_EPOCH)
.expect("failed to convert time");
glib::ffi::GTimeVal {
tv_sec: diff.as_secs() as _,
tv_usec: diff.subsec_micros() as _,
}
});
unsafe {
from_glib_full(ffi::gdk_pixbuf_animation_get_iter(
self.as_ref().to_glib_none().0,
start_time
.as_ref()
.map(|t| t as *const glib::ffi::GTimeVal)
.unwrap_or(ptr::null()),
))
}
}
}