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
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::{prelude::*, translate::*, InterfaceInfo, TypeInfo, TypeValueTable};

crate::wrapper! {
    #[doc(alias = "GTypePlugin")]
    pub struct TypePlugin(Interface<gobject_ffi::GTypePlugin, gobject_ffi::GTypePluginClass>);

    match fn {
        type_ => || gobject_ffi::g_type_plugin_get_type(),
    }
}

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

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

pub trait TypePluginExt: IsA<TypePlugin> + sealed::Sealed + 'static {
    #[doc(alias = "g_type_plugin_complete_interface_info")]
    fn complete_interface_info(
        &self,
        instance_type: crate::types::Type,
        interface_type: crate::types::Type,
    ) -> InterfaceInfo {
        let info = InterfaceInfo::default();
        unsafe {
            gobject_ffi::g_type_plugin_complete_interface_info(
                self.as_ref().to_glib_none().0,
                instance_type.into_glib(),
                interface_type.into_glib(),
                info.as_ptr(),
            );
        }
        info
    }

    #[doc(alias = "g_type_plugin_complete_type_info")]
    fn complete_type_info(&self, g_type: crate::types::Type) -> (TypeInfo, TypeValueTable) {
        let info = TypeInfo::default();
        let value_table = TypeValueTable::default();
        unsafe {
            gobject_ffi::g_type_plugin_complete_type_info(
                self.as_ref().to_glib_none().0,
                g_type.into_glib(),
                info.as_ptr(),
                value_table.as_ptr(),
            );
        }
        (info, value_table)
    }

    #[doc(alias = "g_type_plugin_unuse")]
    fn unuse(&self) {
        unsafe {
            gobject_ffi::g_type_plugin_unuse(self.as_ref().to_glib_none().0);
        }
    }

    #[doc(alias = "g_type_plugin_use")]
    #[doc(alias = "use")]
    fn use_(&self) {
        unsafe {
            gobject_ffi::g_type_plugin_use(self.as_ref().to_glib_none().0);
        }
    }
}

impl<O: IsA<TypePlugin>> TypePluginExt for O {}