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

use crate::{Job};
use glib::{prelude::*,translate::*};

glib::wrapper! {
    #[doc(alias = "PpsJobLoad")]
    pub struct JobLoad(Object<ffi::PpsJobLoad, ffi::PpsJobLoadClass>) @extends Job;

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

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

    #[doc(alias = "pps_job_load_new")]
    pub fn new() -> JobLoad {
        assert_initialized_main_thread!();
        unsafe {
            Job::from_glib_full(ffi::pps_job_load_new()).unsafe_cast()
        }
    }
}

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

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

pub trait JobLoadExt: IsA<JobLoad> + sealed::Sealed + 'static {
    #[cfg(feature = "v46")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v46")))]
    #[doc(alias = "pps_job_load_get_loaded_document")]
    #[doc(alias = "get_loaded_document")]
    fn loaded_document(&self) -> Option<papers_document::Document> {
        unsafe {
            from_glib_full(ffi::pps_job_load_get_loaded_document(self.as_ref().to_glib_none().0))
        }
    }

    #[cfg(feature = "v46")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v46")))]
    #[doc(alias = "pps_job_load_set_fd")]
    fn set_fd(&self, fd: i32, mime_type: &str) -> Result<(), glib::Error> {
        unsafe {
            let mut error = std::ptr::null_mut();
            let is_ok = ffi::pps_job_load_set_fd(self.as_ref().to_glib_none().0, fd, mime_type.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)) }
        }
    }

    //#[doc(alias = "pps_job_load_set_load_flags")]
    //fn set_load_flags(&self, flags: /*Ignored*/papers_document::DocumentLoadFlags) {
    //    unsafe { TODO: call ffi:pps_job_load_set_load_flags() }
    //}

    #[doc(alias = "pps_job_load_set_password")]
    fn set_password(&self, password: &str) {
        unsafe {
            ffi::pps_job_load_set_password(self.as_ref().to_glib_none().0, password.to_glib_none().0);
        }
    }

    #[doc(alias = "pps_job_load_set_uri")]
    fn set_uri(&self, uri: &str) {
        unsafe {
            ffi::pps_job_load_set_uri(self.as_ref().to_glib_none().0, uri.to_glib_none().0);
        }
    }

    #[cfg(feature = "v46")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v46")))]
    #[doc(alias = "pps_job_load_take_fd")]
    fn take_fd(&self, fd: i32, mime_type: &str) {
        unsafe {
            ffi::pps_job_load_take_fd(self.as_ref().to_glib_none().0, fd, mime_type.to_glib_none().0);
        }
    }
}

impl<O: IsA<JobLoad>> JobLoadExt for O {}
