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

use crate::{Object};
use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
use std::{boxed::Box as Box_};

glib::wrapper! {
    #[doc(alias = "WpProxy")]
    pub struct Proxy(Object<ffi::WpProxy, ffi::WpProxyClass>) @extends Object;

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

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

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

pub trait ProxyExt: IsA<Proxy> + sealed::Sealed + 'static {
    #[doc(alias = "wp_proxy_get_bound_id")]
    #[doc(alias = "get_bound_id")]
    fn bound_id(&self) -> u32 {
        unsafe {
            ffi::wp_proxy_get_bound_id(self.as_ref().to_glib_none().0)
        }
    }

    #[doc(alias = "wp_proxy_get_interface_type")]
    #[doc(alias = "get_interface_type")]
    fn interface_type(&self) -> (glib::GString, u32) {
        unsafe {
            let mut version = std::mem::MaybeUninit::uninit();
            let ret = from_glib_none(ffi::wp_proxy_get_interface_type(self.as_ref().to_glib_none().0, version.as_mut_ptr()));
            (ret, version.assume_init())
        }
    }

    //#[doc(alias = "wp_proxy_get_pw_proxy")]
    //#[doc(alias = "get_pw_proxy")]
    //fn pw_proxy(&self) -> /*Unimplemented*/Option<Basic: Pointer> {
    //    unsafe { TODO: call ffi:wp_proxy_get_pw_proxy() }
    //}

    //#[doc(alias = "wp_proxy_set_pw_proxy")]
    //fn set_pw_proxy(&self, proxy: /*Unimplemented*/Option<Basic: Pointer>) {
    //    unsafe { TODO: call ffi:wp_proxy_set_pw_proxy() }
    //}

    #[doc(alias = "bound")]
    fn connect_bound<F: Fn(&Self, u32) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn bound_trampoline<P: IsA<Proxy>, F: Fn(&P, u32) + 'static>(this: *mut ffi::WpProxy, object: libc::c_uint, f: glib::ffi::gpointer) {
            let f: &F = &*(f as *const F);
            f(Proxy::from_glib_borrow(this).unsafe_cast_ref(), object)
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, b"bound\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(bound_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
        }
    }

    #[doc(alias = "error")]
    fn connect_error<F: Fn(&Self, i32, i32, &str) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn error_trampoline<P: IsA<Proxy>, F: Fn(&P, i32, i32, &str) + 'static>(this: *mut ffi::WpProxy, object: libc::c_int, p0: libc::c_int, p1: *mut libc::c_char, f: glib::ffi::gpointer) {
            let f: &F = &*(f as *const F);
            f(Proxy::from_glib_borrow(this).unsafe_cast_ref(), object, p0, &glib::GString::from_glib_borrow(p1))
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, b"error\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(error_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
        }
    }

    //#[doc(alias = "pw-proxy-created")]
    //fn connect_pw_proxy_created<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
    //    Unimplemented object: *.Pointer
    //}

    #[doc(alias = "pw-proxy-destroyed")]
    fn connect_pw_proxy_destroyed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn pw_proxy_destroyed_trampoline<P: IsA<Proxy>, F: Fn(&P) + 'static>(this: *mut ffi::WpProxy, f: glib::ffi::gpointer) {
            let f: &F = &*(f as *const F);
            f(Proxy::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, b"pw-proxy-destroyed\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(pw_proxy_destroyed_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
        }
    }

    #[doc(alias = "bound-id")]
    fn connect_bound_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_bound_id_trampoline<P: IsA<Proxy>, F: Fn(&P) + 'static>(this: *mut ffi::WpProxy, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
            let f: &F = &*(f as *const F);
            f(Proxy::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, b"notify::bound-id\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(notify_bound_id_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
        }
    }

    #[doc(alias = "pw-proxy")]
    fn connect_pw_proxy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_pw_proxy_trampoline<P: IsA<Proxy>, F: Fn(&P) + 'static>(this: *mut ffi::WpProxy, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
            let f: &F = &*(f as *const F);
            f(Proxy::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, b"notify::pw-proxy\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(notify_pw_proxy_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
        }
    }
}

impl<O: IsA<Proxy>> ProxyExt for O {}