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
// This file was generated by gir (https://github.com/gtk-rs/gir)
// DO NOT EDIT

use crate::{Core,SessionItem};
use glib::{prelude::*,translate::*};

glib::wrapper! {
    #[doc(alias = "WpSiFactory")]
    pub struct SiFactory(Object<ffi::WpSiFactory, ffi::WpSiFactoryClass>);

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

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

    #[doc(alias = "wp_si_factory_new_simple")]
    pub fn new_simple(factory_name: &str, si_type: glib::types::Type) -> SiFactory {
        unsafe {
            from_glib_full(ffi::wp_si_factory_new_simple(factory_name.to_glib_none().0, si_type.into_glib()))
        }
    }

    #[doc(alias = "wp_si_factory_find")]
    pub fn find(core: &Core, factory_name: &str) -> Option<SiFactory> {
        unsafe {
            from_glib_full(ffi::wp_si_factory_find(core.to_glib_none().0, factory_name.to_glib_none().0))
        }
    }

    #[doc(alias = "wp_si_factory_register")]
    pub fn register(core: &Core, factory: impl IsA<SiFactory>) {
        unsafe {
            ffi::wp_si_factory_register(core.to_glib_none().0, factory.upcast().into_glib_ptr());
        }
    }
}

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

pub trait SiFactoryExt: IsA<SiFactory> + sealed::Sealed + 'static {
    #[doc(alias = "wp_si_factory_construct")]
    fn construct(&self, core: &Core) -> Option<SessionItem> {
        unsafe {
            from_glib_full(ffi::wp_si_factory_construct(self.as_ref().to_glib_none().0, core.to_glib_none().0))
        }
    }

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

impl<O: IsA<SiFactory>> SiFactoryExt for O {}