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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
use gdk_pixbuf_ffi as ffi;
use glib::translate::*;
use libc::c_char;
pub struct PixbufFormat(*mut ffi::GdkPixbufFormat);
impl PixbufFormat {
pub fn get_name(&self) -> Option<String> {
unsafe {
from_glib_full(ffi::gdk_pixbuf_format_get_name(self.to_glib_none().0))
}
}
pub fn get_description(&self) -> Option<String> {
unsafe {
from_glib_full(ffi::gdk_pixbuf_format_get_description(self.to_glib_none().0))
}
}
pub fn get_mime_types(&self) -> Vec<String> {
unsafe {
Vec::from_glib_full(
ffi::gdk_pixbuf_format_get_mime_types(self.to_glib_none().0)
as *const *const c_char)
}
}
pub fn get_extensions(&self) -> Vec<String> {
unsafe {
Vec::from_glib_full(
ffi::gdk_pixbuf_format_get_extensions(self.to_glib_none().0)
as *const *const c_char)
}
}
pub fn is_writable(&self) -> bool {
unsafe { from_glib(ffi::gdk_pixbuf_format_is_writable(self.to_glib_none().0)) }
}
pub fn is_scalable(&self) -> bool {
unsafe { from_glib(ffi::gdk_pixbuf_format_is_scalable(self.to_glib_none().0)) }
}
pub fn is_disabled(&self) -> bool {
unsafe { from_glib(ffi::gdk_pixbuf_format_is_disabled(self.to_glib_none().0)) }
}
pub fn set_disabled(&self, disabled: bool) {
unsafe { ffi::gdk_pixbuf_format_set_disabled(self.to_glib_none().0, disabled.to_glib()) }
}
pub fn get_license(&self) -> Option<String> {
unsafe {
from_glib_full(ffi::gdk_pixbuf_format_get_license(self.to_glib_none().0))
}
}
}
impl<'a> ToGlibPtr<'a, *mut ffi::GdkPixbufFormat> for PixbufFormat {
type Storage = ();
#[inline]
fn to_glib_none(&self) -> Stash<'a, *mut ffi::GdkPixbufFormat, PixbufFormat> {
Stash(self.0, ())
}
}
impl FromGlibPtrNone<*mut ffi::GdkPixbufFormat> for PixbufFormat {
#[inline]
unsafe fn from_glib_none(ptr: *mut ffi::GdkPixbufFormat) -> PixbufFormat {
PixbufFormat(ptr)
}
}