libbismuth 0.5.0

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

use crate::{ffi};
use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
use std::{boxed::Box as Box_};

glib::wrapper! {
    #[doc(alias = "BisAlbumPage")]
    pub struct AlbumPage(Object<ffi::BisAlbumPage, ffi::BisAlbumPageClass>);

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

impl AlbumPage {
            // rustdoc-stripper-ignore-next
            /// Creates a new builder-pattern struct instance to construct [`AlbumPage`] objects.
            ///
            /// This method returns an instance of [`AlbumPageBuilder`](crate::builders::AlbumPageBuilder) which can be used to create [`AlbumPage`] objects.
            pub fn builder() -> AlbumPageBuilder {
                AlbumPageBuilder::new()
            }
        

    #[doc(alias = "bis_album_page_get_child")]
    #[doc(alias = "get_child")]
    pub fn child(&self) -> gtk::Widget {
        unsafe {
            from_glib_none(ffi::bis_album_page_get_child(self.to_glib_none().0))
        }
    }

    #[doc(alias = "bis_album_page_get_name")]
    #[doc(alias = "get_name")]
    pub fn name(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_none(ffi::bis_album_page_get_name(self.to_glib_none().0))
        }
    }

    #[doc(alias = "bis_album_page_get_navigatable")]
    #[doc(alias = "get_navigatable")]
    #[doc(alias = "navigatable")]
    pub fn is_navigatable(&self) -> bool {
        unsafe {
            from_glib(ffi::bis_album_page_get_navigatable(self.to_glib_none().0))
        }
    }

    #[doc(alias = "bis_album_page_set_name")]
    #[doc(alias = "name")]
    pub fn set_name(&self, name: Option<&str>) {
        unsafe {
            ffi::bis_album_page_set_name(self.to_glib_none().0, name.to_glib_none().0);
        }
    }

    #[doc(alias = "bis_album_page_set_navigatable")]
    #[doc(alias = "navigatable")]
    pub fn set_navigatable(&self, navigatable: bool) {
        unsafe {
            ffi::bis_album_page_set_navigatable(self.to_glib_none().0, navigatable.into_glib());
        }
    }

    #[doc(alias = "name")]
    pub fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_name_trampoline<F: Fn(&AlbumPage) + 'static>(this: *mut ffi::BisAlbumPage, _param_spec: glib::ffi::gpointer, 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"notify::name\0".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_name_trampoline::<F> as *const ())), Box_::into_raw(f))
        }
    }

    #[doc(alias = "navigatable")]
    pub fn connect_navigatable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_navigatable_trampoline<F: Fn(&AlbumPage) + 'static>(this: *mut ffi::BisAlbumPage, _param_spec: glib::ffi::gpointer, 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"notify::navigatable\0".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_navigatable_trampoline::<F> as *const ())), Box_::into_raw(f))
        }
    }
}

// rustdoc-stripper-ignore-next
        /// A [builder-pattern] type to construct [`AlbumPage`] objects.
        ///
        /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
#[must_use = "The builder must be built to be used"]
pub struct AlbumPageBuilder {
            builder: glib::object::ObjectBuilder<'static, AlbumPage>,
        }

        impl AlbumPageBuilder {
        fn new() -> Self {
            Self { builder: glib::object::Object::builder() }
        }

                            pub fn child(self, child: &impl IsA<gtk::Widget>) -> Self {
                            Self { builder: self.builder.property("child", child.clone().upcast()), }
                        }

                            pub fn name(self, name: impl Into<glib::GString>) -> Self {
                            Self { builder: self.builder.property("name", name.into()), }
                        }

                            pub fn navigatable(self, navigatable: bool) -> Self {
                            Self { builder: self.builder.property("navigatable", navigatable), }
                        }

    // rustdoc-stripper-ignore-next
    /// Build the [`AlbumPage`].
    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
    pub fn build(self) -> AlbumPage {
    self.builder.build() }
}