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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files.git)
// DO NOT EDIT

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

glib::wrapper! {
    #[doc(alias = "AsIcon")]
    pub struct Icon(Object<ffi::AsIcon, ffi::AsIconClass>);

    match fn {
        type_ => || ffi::as_icon_get_type(),
    }
}

impl Icon {
    pub const NONE: Option<&'static Icon> = None;

    #[doc(alias = "as_icon_new")]
    pub fn new() -> Icon {
        assert_initialized_main_thread!();
        unsafe { from_glib_full(ffi::as_icon_new()) }
    }
}

impl Default for Icon {
    fn default() -> Self {
        Self::new()
    }
}

mod sealed {
    pub trait Sealed {}
    impl<T: super::IsA<super::Icon>> Sealed for T {}
}

pub trait IconExt: IsA<Icon> + sealed::Sealed + 'static {
    #[doc(alias = "as_icon_get_filename")]
    #[doc(alias = "get_filename")]
    fn filename(&self) -> Option<glib::GString> {
        unsafe { from_glib_none(ffi::as_icon_get_filename(self.as_ref().to_glib_none().0)) }
    }

    #[doc(alias = "as_icon_get_height")]
    #[doc(alias = "get_height")]
    fn height(&self) -> u32 {
        unsafe { ffi::as_icon_get_height(self.as_ref().to_glib_none().0) }
    }

    #[doc(alias = "as_icon_get_kind")]
    #[doc(alias = "get_kind")]
    fn kind(&self) -> IconKind {
        unsafe { from_glib(ffi::as_icon_get_kind(self.as_ref().to_glib_none().0)) }
    }

    #[doc(alias = "as_icon_get_name")]
    #[doc(alias = "get_name")]
    fn name(&self) -> Option<glib::GString> {
        unsafe { from_glib_none(ffi::as_icon_get_name(self.as_ref().to_glib_none().0)) }
    }

    #[doc(alias = "as_icon_get_scale")]
    #[doc(alias = "get_scale")]
    fn scale(&self) -> u32 {
        unsafe { ffi::as_icon_get_scale(self.as_ref().to_glib_none().0) }
    }

    #[doc(alias = "as_icon_get_url")]
    #[doc(alias = "get_url")]
    fn url(&self) -> Option<glib::GString> {
        unsafe { from_glib_none(ffi::as_icon_get_url(self.as_ref().to_glib_none().0)) }
    }

    #[doc(alias = "as_icon_get_width")]
    #[doc(alias = "get_width")]
    fn width(&self) -> u32 {
        unsafe { ffi::as_icon_get_width(self.as_ref().to_glib_none().0) }
    }

    #[doc(alias = "as_icon_set_filename")]
    fn set_filename(&self, filename: &str) {
        unsafe {
            ffi::as_icon_set_filename(self.as_ref().to_glib_none().0, filename.to_glib_none().0);
        }
    }

    #[doc(alias = "as_icon_set_height")]
    fn set_height(&self, height: u32) {
        unsafe {
            ffi::as_icon_set_height(self.as_ref().to_glib_none().0, height);
        }
    }

    #[doc(alias = "as_icon_set_kind")]
    fn set_kind(&self, kind: IconKind) {
        unsafe {
            ffi::as_icon_set_kind(self.as_ref().to_glib_none().0, kind.into_glib());
        }
    }

    #[doc(alias = "as_icon_set_name")]
    fn set_name(&self, name: &str) {
        unsafe {
            ffi::as_icon_set_name(self.as_ref().to_glib_none().0, name.to_glib_none().0);
        }
    }

    #[doc(alias = "as_icon_set_scale")]
    fn set_scale(&self, scale: u32) {
        unsafe {
            ffi::as_icon_set_scale(self.as_ref().to_glib_none().0, scale);
        }
    }

    #[doc(alias = "as_icon_set_url")]
    fn set_url(&self, url: &str) {
        unsafe {
            ffi::as_icon_set_url(self.as_ref().to_glib_none().0, url.to_glib_none().0);
        }
    }

    #[doc(alias = "as_icon_set_width")]
    fn set_width(&self, width: u32) {
        unsafe {
            ffi::as_icon_set_width(self.as_ref().to_glib_none().0, width);
        }
    }
}

impl<O: IsA<Icon>> IconExt for O {}