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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use gdk_pixbuf_sys;
use glib::translate::*;
use glib::GString;

glib_wrapper! {
    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct PixbufFormat(Boxed<gdk_pixbuf_sys::GdkPixbufFormat>);

    match fn {
        copy => |ptr| gdk_pixbuf_sys::gdk_pixbuf_format_copy(mut_override(ptr)),
        free => |ptr| gdk_pixbuf_sys::gdk_pixbuf_format_free(ptr),
        get_type => || gdk_pixbuf_sys::gdk_pixbuf_format_get_type(),
    }
}

impl PixbufFormat {
    pub fn get_description(&self) -> Option<GString> {
        unsafe {
            from_glib_full(gdk_pixbuf_sys::gdk_pixbuf_format_get_description(
                mut_override(self.to_glib_none().0),
            ))
        }
    }

    pub fn get_extensions(&self) -> Vec<GString> {
        unsafe {
            FromGlibPtrContainer::from_glib_full(gdk_pixbuf_sys::gdk_pixbuf_format_get_extensions(
                mut_override(self.to_glib_none().0),
            ))
        }
    }

    pub fn get_license(&self) -> Option<GString> {
        unsafe {
            from_glib_full(gdk_pixbuf_sys::gdk_pixbuf_format_get_license(mut_override(
                self.to_glib_none().0,
            )))
        }
    }

    pub fn get_mime_types(&self) -> Vec<GString> {
        unsafe {
            FromGlibPtrContainer::from_glib_full(gdk_pixbuf_sys::gdk_pixbuf_format_get_mime_types(
                mut_override(self.to_glib_none().0),
            ))
        }
    }

    pub fn get_name(&self) -> Option<GString> {
        unsafe {
            from_glib_full(gdk_pixbuf_sys::gdk_pixbuf_format_get_name(mut_override(
                self.to_glib_none().0,
            )))
        }
    }

    pub fn is_disabled(&self) -> bool {
        unsafe {
            from_glib(gdk_pixbuf_sys::gdk_pixbuf_format_is_disabled(mut_override(
                self.to_glib_none().0,
            )))
        }
    }

    #[cfg(any(feature = "v2_36", feature = "dox"))]
    pub fn is_save_option_supported(&self, option_key: &str) -> bool {
        unsafe {
            from_glib(gdk_pixbuf_sys::gdk_pixbuf_format_is_save_option_supported(
                mut_override(self.to_glib_none().0),
                option_key.to_glib_none().0,
            ))
        }
    }

    pub fn is_scalable(&self) -> bool {
        unsafe {
            from_glib(gdk_pixbuf_sys::gdk_pixbuf_format_is_scalable(mut_override(
                self.to_glib_none().0,
            )))
        }
    }

    pub fn is_writable(&self) -> bool {
        unsafe {
            from_glib(gdk_pixbuf_sys::gdk_pixbuf_format_is_writable(mut_override(
                self.to_glib_none().0,
            )))
        }
    }

    pub fn set_disabled(&mut self, disabled: bool) {
        unsafe {
            gdk_pixbuf_sys::gdk_pixbuf_format_set_disabled(
                self.to_glib_none_mut().0,
                disabled.to_glib(),
            );
        }
    }
}