dbusmenu-glib 0.1.0

Rust bindings to dbusmenu-glib
Documentation
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from /nix/store/39vgdpiqy94qwa8rraha7q4wcd8hdwcj-dbusmenu-gtk3-gir
// from /nix/store/ahri9v0b3c1jyls6691sjfzf2s461fzz-source
// DO NOT EDIT

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

glib::wrapper! {
    #[doc(alias = "DbusmenuMenuitemProxy")]
    pub struct MenuitemProxy(Object<ffi::DbusmenuMenuitemProxy, ffi::DbusmenuMenuitemProxyClass>) @extends Menuitem;

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

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

    /// Builds a new [`MenuitemProxy`][crate::MenuitemProxy] object that proxies
    /// all of the values for `mi`.
    /// ## `mi`
    /// The [`Menuitem`][crate::Menuitem] to proxy
    ///
    /// # Returns
    ///
    /// A new [`MenuitemProxy`][crate::MenuitemProxy] object.
    #[doc(alias = "dbusmenu_menuitem_proxy_new")]
    pub fn new(mi: &impl IsA<Menuitem>) -> MenuitemProxy {
        skip_assert_initialized!();
        unsafe {
            from_glib_full(ffi::dbusmenu_menuitem_proxy_new(mi.as_ref().to_glib_none().0))
        }
    }
}

/// Trait containing all [`struct@MenuitemProxy`] methods.
///
/// # Implementors
///
/// [`MenuitemProxy`][struct@crate::MenuitemProxy]
pub trait MenuitemProxyExt: 'static {
    /// Accesses the private variable of which [`Menuitem`][crate::Menuitem]
    /// we are doing the proxying for.
    ///
    /// # Returns
    ///
    /// A [`Menuitem`][crate::Menuitem] object or a [`None`] if we
    ///     don't have one or there is an error.
    #[doc(alias = "dbusmenu_menuitem_proxy_get_wrapped")]
    #[doc(alias = "get_wrapped")]
    fn wrapped(&self) -> Option<Menuitem>;

    #[doc(alias = "menu-item")]
    fn menu_item(&self) -> Option<Menuitem>;
}

impl<O: IsA<MenuitemProxy>> MenuitemProxyExt for O {
    fn wrapped(&self) -> Option<Menuitem> {
        unsafe {
            from_glib_none(ffi::dbusmenu_menuitem_proxy_get_wrapped(self.as_ref().to_glib_none().0))
        }
    }

    fn menu_item(&self) -> Option<Menuitem> {
        glib::ObjectExt::property(self.as_ref(), "menu-item")
    }
}

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