1 | // Take a look at the license at the top of the repository in the LICENSE file. |
2 | |
3 | use crate::{gobject_ffi, prelude::*, translate::*, InterfaceInfo, TypeInfo, TypeValueTable}; |
4 | |
5 | crate::wrapper! { |
6 | #[doc (alias = "GTypePlugin" )] |
7 | pub struct TypePlugin(Interface<gobject_ffi::GTypePlugin, gobject_ffi::GTypePluginClass>); |
8 | |
9 | match fn { |
10 | type_ => || gobject_ffi::g_type_plugin_get_type(), |
11 | } |
12 | } |
13 | |
14 | impl TypePlugin { |
15 | pub const NONE: Option<&'static TypePlugin> = None; |
16 | } |
17 | |
18 | mod sealed { |
19 | pub trait Sealed {} |
20 | impl<T: super::IsA<super::TypePlugin>> Sealed for T {} |
21 | } |
22 | |
23 | pub trait TypePluginExt: IsA<TypePlugin> + sealed::Sealed + 'static { |
24 | #[doc (alias = "g_type_plugin_complete_interface_info" )] |
25 | fn complete_interface_info( |
26 | &self, |
27 | instance_type: crate::types::Type, |
28 | interface_type: crate::types::Type, |
29 | ) -> InterfaceInfo { |
30 | let info = InterfaceInfo::default(); |
31 | unsafe { |
32 | gobject_ffi::g_type_plugin_complete_interface_info( |
33 | self.as_ref().to_glib_none().0, |
34 | instance_type.into_glib(), |
35 | interface_type.into_glib(), |
36 | info.as_ptr(), |
37 | ); |
38 | } |
39 | info |
40 | } |
41 | |
42 | #[doc (alias = "g_type_plugin_complete_type_info" )] |
43 | fn complete_type_info(&self, g_type: crate::types::Type) -> (TypeInfo, TypeValueTable) { |
44 | let info = TypeInfo::default(); |
45 | let value_table = TypeValueTable::default(); |
46 | unsafe { |
47 | gobject_ffi::g_type_plugin_complete_type_info( |
48 | self.as_ref().to_glib_none().0, |
49 | g_type.into_glib(), |
50 | info.as_ptr(), |
51 | value_table.as_ptr(), |
52 | ); |
53 | } |
54 | (info, value_table) |
55 | } |
56 | |
57 | #[doc (alias = "g_type_plugin_unuse" )] |
58 | fn unuse(&self) { |
59 | unsafe { |
60 | gobject_ffi::g_type_plugin_unuse(self.as_ref().to_glib_none().0); |
61 | } |
62 | } |
63 | |
64 | #[doc (alias = "g_type_plugin_use" )] |
65 | #[doc (alias = "use" )] |
66 | fn use_(&self) { |
67 | unsafe { |
68 | gobject_ffi::g_type_plugin_use(self.as_ref().to_glib_none().0); |
69 | } |
70 | } |
71 | } |
72 | |
73 | impl<O: IsA<TypePlugin>> TypePluginExt for O {} |
74 | |