use glib::object::ObjectType as ObjectType_;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use std::boxed::Box as Box_;
use std::fmt;
use std::mem::transmute;
glib::wrapper! {
#[doc(alias = "OstreeAsyncProgress")]
pub struct AsyncProgress(Object<ffi::OstreeAsyncProgress, ffi::OstreeAsyncProgressClass>);
match fn {
type_ => || ffi::ostree_async_progress_get_type(),
}
}
impl AsyncProgress {
#[doc(alias = "ostree_async_progress_new")]
pub fn new() -> AsyncProgress {
unsafe {
from_glib_full(ffi::ostree_async_progress_new())
}
}
#[cfg(any(feature = "v2019_6", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2019_6")))]
#[doc(alias = "ostree_async_progress_copy_state")]
pub fn copy_state(&self, dest: &AsyncProgress) {
unsafe {
ffi::ostree_async_progress_copy_state(self.to_glib_none().0, dest.to_glib_none().0);
}
}
#[doc(alias = "ostree_async_progress_finish")]
pub fn finish(&self) {
unsafe {
ffi::ostree_async_progress_finish(self.to_glib_none().0);
}
}
#[cfg(any(feature = "v2017_6", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_6")))]
#[doc(alias = "ostree_async_progress_get_status")]
#[doc(alias = "get_status")]
pub fn status(&self) -> Option<glib::GString> {
unsafe {
from_glib_full(ffi::ostree_async_progress_get_status(self.to_glib_none().0))
}
}
#[doc(alias = "ostree_async_progress_get_uint")]
#[doc(alias = "get_uint")]
pub fn uint(&self, key: &str) -> u32 {
unsafe {
ffi::ostree_async_progress_get_uint(self.to_glib_none().0, key.to_glib_none().0)
}
}
#[doc(alias = "ostree_async_progress_get_uint64")]
#[doc(alias = "get_uint64")]
pub fn uint64(&self, key: &str) -> u64 {
unsafe {
ffi::ostree_async_progress_get_uint64(self.to_glib_none().0, key.to_glib_none().0)
}
}
#[cfg(any(feature = "v2017_6", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_6")))]
#[doc(alias = "ostree_async_progress_get_variant")]
#[doc(alias = "get_variant")]
pub fn variant(&self, key: &str) -> Option<glib::Variant> {
unsafe {
from_glib_full(ffi::ostree_async_progress_get_variant(self.to_glib_none().0, key.to_glib_none().0))
}
}
#[cfg(any(feature = "v2017_6", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_6")))]
#[doc(alias = "ostree_async_progress_set_status")]
pub fn set_status(&self, status: Option<&str>) {
unsafe {
ffi::ostree_async_progress_set_status(self.to_glib_none().0, status.to_glib_none().0);
}
}
#[doc(alias = "ostree_async_progress_set_uint")]
pub fn set_uint(&self, key: &str, value: u32) {
unsafe {
ffi::ostree_async_progress_set_uint(self.to_glib_none().0, key.to_glib_none().0, value);
}
}
#[doc(alias = "ostree_async_progress_set_uint64")]
pub fn set_uint64(&self, key: &str, value: u64) {
unsafe {
ffi::ostree_async_progress_set_uint64(self.to_glib_none().0, key.to_glib_none().0, value);
}
}
#[cfg(any(feature = "v2017_6", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_6")))]
#[doc(alias = "ostree_async_progress_set_variant")]
pub fn set_variant(&self, key: &str, value: &glib::Variant) {
unsafe {
ffi::ostree_async_progress_set_variant(self.to_glib_none().0, key.to_glib_none().0, value.to_glib_none().0);
}
}
#[doc(alias = "changed")]
pub fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn changed_trampoline<F: Fn(&AsyncProgress) + 'static>(this: *mut ffi::OstreeAsyncProgress, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"changed\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(changed_trampoline::<F> as *const ())), Box_::into_raw(f))
}
}
}
impl Default for AsyncProgress {
fn default() -> Self {
Self::new()
}
}
impl fmt::Display for AsyncProgress {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("AsyncProgress")
}
}