// This file was generated by gir (https://github.com/gtk-rs/gir)
// from ../../girs
// from ../../gtk-girs
// DO NOT EDIT

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

glib::wrapper! {
    /// Base Request type.
    ///
    /// This is an Abstract Base Class, you cannot instantiate it.
    ///
    /// ## Properties
    ///
    ///
    /// #### `type-name`
    ///  Readable
    ///
    /// # Implements
    ///
    /// [`RequestExt`][trait@crate::prelude::RequestExt]
    #[doc(alias = "AstalGreetRequest")]
    pub struct Request(Object<ffi::AstalGreetRequest, ffi::AstalGreetRequestClass>);

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

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

/// Trait containing all [`struct@Request`] methods.
///
/// # Implementors
///
/// [`CancelSession`][struct@crate::CancelSession], [`CreateSession`][struct@crate::CreateSession], [`PostAuthMesssage`][struct@crate::PostAuthMesssage], [`Request`][struct@crate::Request], [`StartSession`][struct@crate::StartSession]
pub trait RequestExt: IsA<Request> + 'static {
    //#[doc(alias = "astal_greet_request_send")]
    //fn send(&self, _callback_: AsyncReadyCallback) {
    //    unsafe { TODO: call ffi:astal_greet_request_send() }
    //}

    #[doc(alias = "astal_greet_request_get_type_name")]
    #[doc(alias = "get_type_name")]
    fn type_name(&self) -> glib::GString {
        unsafe {
            from_glib_none(ffi::astal_greet_request_get_type_name(self.as_ref().to_glib_none().0))
        }
    }

    #[doc(alias = "type-name")]
    fn connect_type_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_type_name_trampoline<P: IsA<Request>, F: Fn(&P) + 'static>(this: *mut ffi::AstalGreetRequest, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
            let f: &F = &*(f as *const F);
            f(Request::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, c"notify::type-name".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_type_name_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
        }
    }
}

impl<O: IsA<Request>> RequestExt for O {}
