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

use crate::RepoFinder;
use glib::object::IsA;
use glib::object::ObjectType as ObjectType_;
use glib::translate::*;
use glib::StaticType;
use std::fmt;

glib::wrapper! {
    #[doc(alias = "OstreeRepoFinderMount")]
    pub struct RepoFinderMount(Object<ffi::OstreeRepoFinderMount, ffi::OstreeRepoFinderMountClass>) @implements RepoFinder;

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

impl RepoFinderMount {
    #[doc(alias = "ostree_repo_finder_mount_new")]
    pub fn new<P: IsA<gio::VolumeMonitor>>(monitor: Option<&P>) -> RepoFinderMount {
        unsafe {
            from_glib_full(ffi::ostree_repo_finder_mount_new(monitor.map(|p| p.as_ref()).to_glib_none().0))
        }
    }

    #[cfg(any(feature = "v2018_6", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
    pub fn monitor(&self) -> Option<gio::VolumeMonitor> {
        unsafe {
            let mut value = glib::Value::from_type(<gio::VolumeMonitor as StaticType>::static_type());
            glib::gobject_ffi::g_object_get_property(self.as_ptr() as *mut glib::gobject_ffi::GObject, b"monitor\0".as_ptr() as *const _, value.to_glib_none_mut().0);
            value.get().expect("Return Value for property `monitor` getter")
        }
    }
}

impl fmt::Display for RepoFinderMount {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        f.write_str("RepoFinderMount")
    }
}
