xfce4-util 0.1.0

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

use crate::ffi;
use glib::translate::*;

glib::wrapper! {
    ///
    ///
    /// # Implements
    ///
    /// [`trait@glib::ObjectExt`]
    #[doc(alias = "XfceKiosk")]
    pub struct Kiosk(Object<ffi::XfceKiosk, ffi::XfceKioskClass>);

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

impl Kiosk {
    /// Creates and returns a new instance of [`Kiosk`][crate::Kiosk].
    /// ## `module`
    /// The Xfce project to query about
    ///
    /// # Returns
    ///
    /// a new instance of [`Kiosk`][crate::Kiosk].
    #[doc(alias = "xfce_kiosk_new")]
    pub fn new(module: &str) -> Kiosk {
        unsafe { from_glib_full(ffi::xfce_kiosk_new(module.to_glib_none().0)) }
    }

    /// Queries the `self` object for a given capability and returns [`true`] if
    /// the current user has the `capability`, else [`false`].
    /// ## `capability`
    /// The name of the capability to check.
    ///
    /// # Returns
    ///
    /// [`true`] if the current user has the `capability`, else [`false`].
    #[doc(alias = "xfce_kiosk_query")]
    pub fn query(&self, capability: &str) -> bool {
        unsafe {
            from_glib(ffi::xfce_kiosk_query(
                self.to_glib_none().0,
                capability.to_glib_none().0,
            ))
        }
    }
}