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

use gio;
use gio_sys;
use glib;
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use glib::GString;
use glib_sys;
use gobject_sys;
use libc;
use light_dm_sys;
use std::boxed::Box as Box_;
use std::fmt;
use std::mem::transmute;
use std::pin::Pin;
use std::ptr;
use MessageType;
use PromptType;

glib_wrapper! {
    pub struct Greeter(Object<light_dm_sys::LightDMGreeter, light_dm_sys::LightDMGreeterClass, GreeterClass>);

    match fn {
        get_type => || light_dm_sys::lightdm_greeter_get_type(),
    }
}

impl Greeter {
    pub fn new() -> Greeter {
        unsafe { from_glib_full(light_dm_sys::lightdm_greeter_new()) }
    }
}

impl Default for Greeter {
    fn default() -> Self {
        Self::new()
    }
}

pub const NONE_GREETER: Option<&Greeter> = None;

pub trait GreeterExt: 'static {
    fn authenticate(&self, username: Option<&str>) -> Result<(), glib::Error>;

    fn authenticate_as_guest(&self) -> Result<(), glib::Error>;

    fn authenticate_autologin(&self) -> Result<(), glib::Error>;

    fn authenticate_remote(&self, session: &str, username: Option<&str>)
        -> Result<(), glib::Error>;

    fn cancel_authentication(&self) -> Result<(), glib::Error>;

    fn cancel_autologin(&self);

    fn connect_to_daemon<
        P: IsA<gio::Cancellable>,
        Q: FnOnce(Result<(), glib::Error>) + Send + 'static,
    >(
        &self,
        cancellable: Option<&P>,
        callback: Q,
    );

    fn connect_to_daemon_future(
        &self,
    ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>>;

    fn connect_to_daemon_sync(&self) -> Result<(), glib::Error>;

    fn ensure_shared_data_dir<
        P: IsA<gio::Cancellable>,
        Q: FnOnce(Result<GString, glib::Error>) + Send + 'static,
    >(
        &self,
        username: &str,
        cancellable: Option<&P>,
        callback: Q,
    );

    fn ensure_shared_data_dir_future(
        &self,
        username: &str,
    ) -> Pin<Box_<dyn std::future::Future<Output = Result<GString, glib::Error>> + 'static>>;

    fn ensure_shared_data_dir_sync(&self, username: &str) -> Result<GString, glib::Error>;

    fn get_authentication_user(&self) -> Option<GString>;

    fn get_autologin_guest_hint(&self) -> bool;

    fn get_autologin_session_hint(&self) -> Option<GString>;

    fn get_autologin_timeout_hint(&self) -> i32;

    fn get_autologin_user_hint(&self) -> Option<GString>;

    fn get_default_session_hint(&self) -> Option<GString>;

    fn get_has_guest_account_hint(&self) -> bool;

    fn get_hide_users_hint(&self) -> bool;

    fn get_hint(&self, name: &str) -> Option<GString>;

    fn get_in_authentication(&self) -> bool;

    fn get_is_authenticated(&self) -> bool;

    fn get_lock_hint(&self) -> bool;

    fn get_select_guest_hint(&self) -> bool;

    fn get_select_user_hint(&self) -> Option<GString>;

    fn get_show_manual_login_hint(&self) -> bool;

    fn get_show_remote_login_hint(&self) -> bool;

    fn respond(&self, response: &str) -> Result<(), glib::Error>;

    fn set_language(&self, language: &str) -> Result<(), glib::Error>;

    fn set_resettable(&self, resettable: bool);

    fn start_session<
        P: IsA<gio::Cancellable>,
        Q: FnOnce(Result<(), glib::Error>) + Send + 'static,
    >(
        &self,
        session: Option<&str>,
        cancellable: Option<&P>,
        callback: Q,
    );

    fn start_session_future(
        &self,
        session: Option<&str>,
    ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>>;

    fn start_session_sync(&self, session: Option<&str>) -> Result<(), glib::Error>;

    fn connect_authentication_complete<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;

    fn connect_autologin_timer_expired<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;

    fn connect_idle<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;

    fn connect_reset<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;

    fn connect_show_message<F: Fn(&Self, &str, MessageType) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_show_prompt<F: Fn(&Self, &str, PromptType) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_authentication_user_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_autologin_guest_hint_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_autologin_session_hint_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_autologin_timeout_hint_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_autologin_user_hint_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_default_session_hint_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_has_guest_account_hint_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_hide_users_hint_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_in_authentication_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_is_authenticated_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_lock_hint_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;

    fn connect_property_select_guest_hint_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_select_user_hint_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_show_manual_login_hint_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_show_remote_login_hint_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;
}

impl<O: IsA<Greeter>> GreeterExt for O {
    fn authenticate(&self, username: Option<&str>) -> Result<(), glib::Error> {
        unsafe {
            let mut error = ptr::null_mut();
            let _ = light_dm_sys::lightdm_greeter_authenticate(
                self.as_ref().to_glib_none().0,
                username.to_glib_none().0,
                &mut error,
            );
            if error.is_null() {
                Ok(())
            } else {
                Err(from_glib_full(error))
            }
        }
    }

    fn authenticate_as_guest(&self) -> Result<(), glib::Error> {
        unsafe {
            let mut error = ptr::null_mut();
            let _ = light_dm_sys::lightdm_greeter_authenticate_as_guest(
                self.as_ref().to_glib_none().0,
                &mut error,
            );
            if error.is_null() {
                Ok(())
            } else {
                Err(from_glib_full(error))
            }
        }
    }

    fn authenticate_autologin(&self) -> Result<(), glib::Error> {
        unsafe {
            let mut error = ptr::null_mut();
            let _ = light_dm_sys::lightdm_greeter_authenticate_autologin(
                self.as_ref().to_glib_none().0,
                &mut error,
            );
            if error.is_null() {
                Ok(())
            } else {
                Err(from_glib_full(error))
            }
        }
    }

    fn authenticate_remote(
        &self,
        session: &str,
        username: Option<&str>,
    ) -> Result<(), glib::Error> {
        unsafe {
            let mut error = ptr::null_mut();
            let _ = light_dm_sys::lightdm_greeter_authenticate_remote(
                self.as_ref().to_glib_none().0,
                session.to_glib_none().0,
                username.to_glib_none().0,
                &mut error,
            );
            if error.is_null() {
                Ok(())
            } else {
                Err(from_glib_full(error))
            }
        }
    }

    fn cancel_authentication(&self) -> Result<(), glib::Error> {
        unsafe {
            let mut error = ptr::null_mut();
            let _ = light_dm_sys::lightdm_greeter_cancel_authentication(
                self.as_ref().to_glib_none().0,
                &mut error,
            );
            if error.is_null() {
                Ok(())
            } else {
                Err(from_glib_full(error))
            }
        }
    }

    fn cancel_autologin(&self) {
        unsafe {
            light_dm_sys::lightdm_greeter_cancel_autologin(self.as_ref().to_glib_none().0);
        }
    }

    fn connect_to_daemon<
        P: IsA<gio::Cancellable>,
        Q: FnOnce(Result<(), glib::Error>) + Send + 'static,
    >(
        &self,
        cancellable: Option<&P>,
        callback: Q,
    ) {
        let user_data: Box_<Q> = Box_::new(callback);
        unsafe extern "C" fn connect_to_daemon_trampoline<
            Q: FnOnce(Result<(), glib::Error>) + Send + 'static,
        >(
            _source_object: *mut gobject_sys::GObject,
            res: *mut gio_sys::GAsyncResult,
            user_data: glib_sys::gpointer,
        ) {
            let mut error = ptr::null_mut();
            let _ = light_dm_sys::lightdm_greeter_connect_to_daemon_finish(
                _source_object as *mut _,
                res,
                &mut error,
            );
            let result = if error.is_null() {
                Ok(())
            } else {
                Err(from_glib_full(error))
            };
            let callback: Box_<Q> = Box_::from_raw(user_data as *mut _);
            callback(result);
        }
        let callback = connect_to_daemon_trampoline::<Q>;
        unsafe {
            light_dm_sys::lightdm_greeter_connect_to_daemon(
                self.as_ref().to_glib_none().0,
                cancellable.map(|p| p.as_ref()).to_glib_none().0,
                Some(callback),
                Box_::into_raw(user_data) as *mut _,
            );
        }
    }

    fn connect_to_daemon_future(
        &self,
    ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
        Box_::pin(gio::GioFuture::new(self, move |obj, send| {
            let cancellable = gio::Cancellable::new();
            obj.connect_to_daemon(Some(&cancellable), move |res| {
                send.resolve(res);
            });

            cancellable
        }))
    }

    fn connect_to_daemon_sync(&self) -> Result<(), glib::Error> {
        unsafe {
            let mut error = ptr::null_mut();
            let _ = light_dm_sys::lightdm_greeter_connect_to_daemon_sync(
                self.as_ref().to_glib_none().0,
                &mut error,
            );
            if error.is_null() {
                Ok(())
            } else {
                Err(from_glib_full(error))
            }
        }
    }

    fn ensure_shared_data_dir<
        P: IsA<gio::Cancellable>,
        Q: FnOnce(Result<GString, glib::Error>) + Send + 'static,
    >(
        &self,
        username: &str,
        cancellable: Option<&P>,
        callback: Q,
    ) {
        let user_data: Box_<Q> = Box_::new(callback);
        unsafe extern "C" fn ensure_shared_data_dir_trampoline<
            Q: FnOnce(Result<GString, glib::Error>) + Send + 'static,
        >(
            _source_object: *mut gobject_sys::GObject,
            res: *mut gio_sys::GAsyncResult,
            user_data: glib_sys::gpointer,
        ) {
            let mut error = ptr::null_mut();
            let ret = light_dm_sys::lightdm_greeter_ensure_shared_data_dir_finish(
                _source_object as *mut _,
                res,
                &mut error,
            );
            let result = if error.is_null() {
                Ok(from_glib_full(ret))
            } else {
                Err(from_glib_full(error))
            };
            let callback: Box_<Q> = Box_::from_raw(user_data as *mut _);
            callback(result);
        }
        let callback = ensure_shared_data_dir_trampoline::<Q>;
        unsafe {
            light_dm_sys::lightdm_greeter_ensure_shared_data_dir(
                self.as_ref().to_glib_none().0,
                username.to_glib_none().0,
                cancellable.map(|p| p.as_ref()).to_glib_none().0,
                Some(callback),
                Box_::into_raw(user_data) as *mut _,
            );
        }
    }

    fn ensure_shared_data_dir_future(
        &self,
        username: &str,
    ) -> Pin<Box_<dyn std::future::Future<Output = Result<GString, glib::Error>> + 'static>> {
        let username = String::from(username);
        Box_::pin(gio::GioFuture::new(self, move |obj, send| {
            let cancellable = gio::Cancellable::new();
            obj.ensure_shared_data_dir(&username, Some(&cancellable), move |res| {
                send.resolve(res);
            });

            cancellable
        }))
    }

    fn ensure_shared_data_dir_sync(&self, username: &str) -> Result<GString, glib::Error> {
        unsafe {
            let mut error = ptr::null_mut();
            let ret = light_dm_sys::lightdm_greeter_ensure_shared_data_dir_sync(
                self.as_ref().to_glib_none().0,
                username.to_glib_none().0,
                &mut error,
            );
            if error.is_null() {
                Ok(from_glib_full(ret))
            } else {
                Err(from_glib_full(error))
            }
        }
    }

    fn get_authentication_user(&self) -> Option<GString> {
        unsafe {
            from_glib_none(light_dm_sys::lightdm_greeter_get_authentication_user(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_autologin_guest_hint(&self) -> bool {
        unsafe {
            from_glib(light_dm_sys::lightdm_greeter_get_autologin_guest_hint(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_autologin_session_hint(&self) -> Option<GString> {
        unsafe {
            from_glib_none(light_dm_sys::lightdm_greeter_get_autologin_session_hint(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_autologin_timeout_hint(&self) -> i32 {
        unsafe {
            light_dm_sys::lightdm_greeter_get_autologin_timeout_hint(self.as_ref().to_glib_none().0)
        }
    }

    fn get_autologin_user_hint(&self) -> Option<GString> {
        unsafe {
            from_glib_none(light_dm_sys::lightdm_greeter_get_autologin_user_hint(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_default_session_hint(&self) -> Option<GString> {
        unsafe {
            from_glib_none(light_dm_sys::lightdm_greeter_get_default_session_hint(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_has_guest_account_hint(&self) -> bool {
        unsafe {
            from_glib(light_dm_sys::lightdm_greeter_get_has_guest_account_hint(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_hide_users_hint(&self) -> bool {
        unsafe {
            from_glib(light_dm_sys::lightdm_greeter_get_hide_users_hint(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_hint(&self, name: &str) -> Option<GString> {
        unsafe {
            from_glib_none(light_dm_sys::lightdm_greeter_get_hint(
                self.as_ref().to_glib_none().0,
                name.to_glib_none().0,
            ))
        }
    }

    fn get_in_authentication(&self) -> bool {
        unsafe {
            from_glib(light_dm_sys::lightdm_greeter_get_in_authentication(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_is_authenticated(&self) -> bool {
        unsafe {
            from_glib(light_dm_sys::lightdm_greeter_get_is_authenticated(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_lock_hint(&self) -> bool {
        unsafe {
            from_glib(light_dm_sys::lightdm_greeter_get_lock_hint(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_select_guest_hint(&self) -> bool {
        unsafe {
            from_glib(light_dm_sys::lightdm_greeter_get_select_guest_hint(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_select_user_hint(&self) -> Option<GString> {
        unsafe {
            from_glib_none(light_dm_sys::lightdm_greeter_get_select_user_hint(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_show_manual_login_hint(&self) -> bool {
        unsafe {
            from_glib(light_dm_sys::lightdm_greeter_get_show_manual_login_hint(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_show_remote_login_hint(&self) -> bool {
        unsafe {
            from_glib(light_dm_sys::lightdm_greeter_get_show_remote_login_hint(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn respond(&self, response: &str) -> Result<(), glib::Error> {
        unsafe {
            let mut error = ptr::null_mut();
            let _ = light_dm_sys::lightdm_greeter_respond(
                self.as_ref().to_glib_none().0,
                response.to_glib_none().0,
                &mut error,
            );
            if error.is_null() {
                Ok(())
            } else {
                Err(from_glib_full(error))
            }
        }
    }

    fn set_language(&self, language: &str) -> Result<(), glib::Error> {
        unsafe {
            let mut error = ptr::null_mut();
            let _ = light_dm_sys::lightdm_greeter_set_language(
                self.as_ref().to_glib_none().0,
                language.to_glib_none().0,
                &mut error,
            );
            if error.is_null() {
                Ok(())
            } else {
                Err(from_glib_full(error))
            }
        }
    }

    fn set_resettable(&self, resettable: bool) {
        unsafe {
            light_dm_sys::lightdm_greeter_set_resettable(
                self.as_ref().to_glib_none().0,
                resettable.to_glib(),
            );
        }
    }

    fn start_session<
        P: IsA<gio::Cancellable>,
        Q: FnOnce(Result<(), glib::Error>) + Send + 'static,
    >(
        &self,
        session: Option<&str>,
        cancellable: Option<&P>,
        callback: Q,
    ) {
        let user_data: Box_<Q> = Box_::new(callback);
        unsafe extern "C" fn start_session_trampoline<
            Q: FnOnce(Result<(), glib::Error>) + Send + 'static,
        >(
            _source_object: *mut gobject_sys::GObject,
            res: *mut gio_sys::GAsyncResult,
            user_data: glib_sys::gpointer,
        ) {
            let mut error = ptr::null_mut();
            let _ = light_dm_sys::lightdm_greeter_start_session_finish(
                _source_object as *mut _,
                res,
                &mut error,
            );
            let result = if error.is_null() {
                Ok(())
            } else {
                Err(from_glib_full(error))
            };
            let callback: Box_<Q> = Box_::from_raw(user_data as *mut _);
            callback(result);
        }
        let callback = start_session_trampoline::<Q>;
        unsafe {
            light_dm_sys::lightdm_greeter_start_session(
                self.as_ref().to_glib_none().0,
                session.to_glib_none().0,
                cancellable.map(|p| p.as_ref()).to_glib_none().0,
                Some(callback),
                Box_::into_raw(user_data) as *mut _,
            );
        }
    }

    fn start_session_future(
        &self,
        session: Option<&str>,
    ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
        let session = session.map(ToOwned::to_owned);
        Box_::pin(gio::GioFuture::new(self, move |obj, send| {
            let cancellable = gio::Cancellable::new();
            obj.start_session(
                session.as_ref().map(::std::borrow::Borrow::borrow),
                Some(&cancellable),
                move |res| {
                    send.resolve(res);
                },
            );

            cancellable
        }))
    }

    fn start_session_sync(&self, session: Option<&str>) -> Result<(), glib::Error> {
        unsafe {
            let mut error = ptr::null_mut();
            let _ = light_dm_sys::lightdm_greeter_start_session_sync(
                self.as_ref().to_glib_none().0,
                session.to_glib_none().0,
                &mut error,
            );
            if error.is_null() {
                Ok(())
            } else {
                Err(from_glib_full(error))
            }
        }
    }

    fn connect_authentication_complete<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn authentication_complete_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut light_dm_sys::LightDMGreeter,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Greeter>,
        {
            let f: &F = &*(f as *const F);
            f(&Greeter::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"authentication-complete\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    authentication_complete_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_autologin_timer_expired<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn autologin_timer_expired_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut light_dm_sys::LightDMGreeter,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Greeter>,
        {
            let f: &F = &*(f as *const F);
            f(&Greeter::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"autologin-timer-expired\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    autologin_timer_expired_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_idle<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn idle_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut light_dm_sys::LightDMGreeter,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Greeter>,
        {
            let f: &F = &*(f as *const F);
            f(&Greeter::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"idle\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    idle_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_reset<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn reset_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut light_dm_sys::LightDMGreeter,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Greeter>,
        {
            let f: &F = &*(f as *const F);
            f(&Greeter::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"reset\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    reset_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_show_message<F: Fn(&Self, &str, MessageType) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn show_message_trampoline<P, F: Fn(&P, &str, MessageType) + 'static>(
            this: *mut light_dm_sys::LightDMGreeter,
            text: *mut libc::c_char,
            type_: light_dm_sys::LightDMMessageType,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Greeter>,
        {
            let f: &F = &*(f as *const F);
            f(
                &Greeter::from_glib_borrow(this).unsafe_cast_ref(),
                &GString::from_glib_borrow(text),
                from_glib(type_),
            )
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"show-message\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    show_message_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_show_prompt<F: Fn(&Self, &str, PromptType) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn show_prompt_trampoline<P, F: Fn(&P, &str, PromptType) + 'static>(
            this: *mut light_dm_sys::LightDMGreeter,
            text: *mut libc::c_char,
            type_: light_dm_sys::LightDMPromptType,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Greeter>,
        {
            let f: &F = &*(f as *const F);
            f(
                &Greeter::from_glib_borrow(this).unsafe_cast_ref(),
                &GString::from_glib_borrow(text),
                from_glib(type_),
            )
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"show-prompt\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    show_prompt_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_authentication_user_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_authentication_user_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut light_dm_sys::LightDMGreeter,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Greeter>,
        {
            let f: &F = &*(f as *const F);
            f(&Greeter::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::authentication-user\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_authentication_user_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_autologin_guest_hint_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_autologin_guest_hint_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut light_dm_sys::LightDMGreeter,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Greeter>,
        {
            let f: &F = &*(f as *const F);
            f(&Greeter::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::autologin-guest-hint\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_autologin_guest_hint_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_autologin_session_hint_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_autologin_session_hint_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut light_dm_sys::LightDMGreeter,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Greeter>,
        {
            let f: &F = &*(f as *const F);
            f(&Greeter::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::autologin-session-hint\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_autologin_session_hint_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_autologin_timeout_hint_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_autologin_timeout_hint_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut light_dm_sys::LightDMGreeter,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Greeter>,
        {
            let f: &F = &*(f as *const F);
            f(&Greeter::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::autologin-timeout-hint\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_autologin_timeout_hint_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_autologin_user_hint_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_autologin_user_hint_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut light_dm_sys::LightDMGreeter,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Greeter>,
        {
            let f: &F = &*(f as *const F);
            f(&Greeter::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::autologin-user-hint\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_autologin_user_hint_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_default_session_hint_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_default_session_hint_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut light_dm_sys::LightDMGreeter,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Greeter>,
        {
            let f: &F = &*(f as *const F);
            f(&Greeter::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::default-session-hint\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_default_session_hint_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_has_guest_account_hint_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_has_guest_account_hint_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut light_dm_sys::LightDMGreeter,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Greeter>,
        {
            let f: &F = &*(f as *const F);
            f(&Greeter::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::has-guest-account-hint\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_has_guest_account_hint_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_hide_users_hint_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_hide_users_hint_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut light_dm_sys::LightDMGreeter,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Greeter>,
        {
            let f: &F = &*(f as *const F);
            f(&Greeter::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::hide-users-hint\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_hide_users_hint_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_in_authentication_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_in_authentication_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut light_dm_sys::LightDMGreeter,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Greeter>,
        {
            let f: &F = &*(f as *const F);
            f(&Greeter::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::in-authentication\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_in_authentication_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_is_authenticated_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_is_authenticated_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut light_dm_sys::LightDMGreeter,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Greeter>,
        {
            let f: &F = &*(f as *const F);
            f(&Greeter::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::is-authenticated\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_is_authenticated_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_lock_hint_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_lock_hint_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut light_dm_sys::LightDMGreeter,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Greeter>,
        {
            let f: &F = &*(f as *const F);
            f(&Greeter::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::lock-hint\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_lock_hint_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_select_guest_hint_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_select_guest_hint_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut light_dm_sys::LightDMGreeter,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Greeter>,
        {
            let f: &F = &*(f as *const F);
            f(&Greeter::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::select-guest-hint\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_select_guest_hint_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_select_user_hint_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_select_user_hint_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut light_dm_sys::LightDMGreeter,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Greeter>,
        {
            let f: &F = &*(f as *const F);
            f(&Greeter::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::select-user-hint\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_select_user_hint_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_show_manual_login_hint_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_show_manual_login_hint_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut light_dm_sys::LightDMGreeter,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Greeter>,
        {
            let f: &F = &*(f as *const F);
            f(&Greeter::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::show-manual-login-hint\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_show_manual_login_hint_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_show_remote_login_hint_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_show_remote_login_hint_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut light_dm_sys::LightDMGreeter,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Greeter>,
        {
            let f: &F = &*(f as *const F);
            f(&Greeter::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::show-remote-login-hint\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_show_remote_login_hint_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }
}

impl fmt::Display for Greeter {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "Greeter")
    }
}
