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

use glib::{prelude::*, translate::*};
use std::fmt;

glib::wrapper! {
    #[doc(alias = "GnomePnpIds")]
    pub struct PnpIds(Object<ffi::GnomePnpIds, ffi::GnomePnpIdsClass>);

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

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

    #[doc(alias = "gnome_pnp_ids_new")]
    pub fn new() -> PnpIds {
        assert_initialized_main_thread!();
        unsafe { from_glib_full(ffi::gnome_pnp_ids_new()) }
    }
}

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

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

pub trait PnpIdsExt: IsA<PnpIds> + sealed::Sealed + 'static {
    #[doc(alias = "gnome_pnp_ids_get_pnp_id")]
    #[doc(alias = "get_pnp_id")]
    fn pnp_id(&self, pnp_id: &str) -> Option<glib::GString> {
        unsafe {
            from_glib_full(ffi::gnome_pnp_ids_get_pnp_id(
                self.as_ref().to_glib_none().0,
                pnp_id.to_glib_none().0,
            ))
        }
    }
}

impl<O: IsA<PnpIds>> PnpIdsExt for O {}

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