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

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

glib::wrapper! {
    #[doc(alias = "WpTransition")]
    pub struct Transition(Object<ffi::WpTransition, ffi::WpTransitionClass>) @implements gio::AsyncResult;

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

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

    #[doc(alias = "wp_transition_new_closure")]
    pub fn new_closure(type_: glib::types::Type, source_object: Option<&impl IsA<glib::Object>>, cancellable: Option<&impl IsA<gio::Cancellable>>, closure: Option<&glib::Closure>) -> Transition {
        unsafe {
            from_glib_none(ffi::wp_transition_new_closure(type_.into_glib(), source_object.map(|p| p.as_ref()).to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, closure.to_glib_none().0))
        }
    }

    #[doc(alias = "wp_transition_finish")]
    pub fn finish(res: &impl IsA<gio::AsyncResult>) -> Result<(), glib::Error> {
        unsafe {
            let mut error = std::ptr::null_mut();
            let is_ok = ffi::wp_transition_finish(res.as_ref().to_glib_none().0, &mut error);
            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
            if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
        }
    }
}

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

pub trait TransitionExt: IsA<Transition> + sealed::Sealed + 'static {
    #[doc(alias = "wp_transition_advance")]
    fn advance(&self) {
        unsafe {
            ffi::wp_transition_advance(self.as_ref().to_glib_none().0);
        }
    }

    #[doc(alias = "wp_transition_get_completed")]
    #[doc(alias = "get_completed")]
    fn is_completed(&self) -> bool {
        unsafe {
            from_glib(ffi::wp_transition_get_completed(self.as_ref().to_glib_none().0))
        }
    }

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

    #[doc(alias = "wp_transition_get_source_object")]
    #[doc(alias = "get_source_object")]
    fn source_object(&self) -> Option<glib::Object> {
        unsafe {
            from_glib_none(ffi::wp_transition_get_source_object(self.as_ref().to_glib_none().0))
        }
    }

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

    #[doc(alias = "wp_transition_had_error")]
    fn had_error(&self) -> bool {
        unsafe {
            from_glib(ffi::wp_transition_had_error(self.as_ref().to_glib_none().0))
        }
    }

    //#[doc(alias = "wp_transition_is_tagged")]
    //fn is_tagged(&self, tag: /*Unimplemented*/Option<Basic: Pointer>) -> bool {
    //    unsafe { TODO: call ffi:wp_transition_is_tagged() }
    //}

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

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

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

impl<O: IsA<Transition>> TransitionExt for O {}