libappstream 0.4.0

Rust bindings for appstream
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, Context};
use glib::{prelude::*, translate::*};

glib::wrapper! {
    #[doc(alias = "AsAgreementSection")]
    pub struct AgreementSection(Object<ffi::AsAgreementSection, ffi::AsAgreementSectionClass>);

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

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

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

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

pub trait AgreementSectionExt: IsA<AgreementSection> + 'static {
    #[doc(alias = "as_agreement_section_get_context")]
    #[doc(alias = "get_context")]
    fn context(&self) -> Option<Context> {
        unsafe {
            from_glib_none(ffi::as_agreement_section_get_context(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "as_agreement_section_get_description")]
    #[doc(alias = "get_description")]
    fn description(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_none(ffi::as_agreement_section_get_description(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "as_agreement_section_get_kind")]
    #[doc(alias = "get_kind")]
    fn kind(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_none(ffi::as_agreement_section_get_kind(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

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

    #[doc(alias = "as_agreement_section_set_context")]
    fn set_context(&self, context: &impl IsA<Context>) {
        unsafe {
            ffi::as_agreement_section_set_context(
                self.as_ref().to_glib_none().0,
                context.as_ref().to_glib_none().0,
            );
        }
    }

    #[doc(alias = "as_agreement_section_set_description")]
    fn set_description(&self, desc: &str, locale: Option<&str>) {
        unsafe {
            ffi::as_agreement_section_set_description(
                self.as_ref().to_glib_none().0,
                desc.to_glib_none().0,
                locale.to_glib_none().0,
            );
        }
    }

    #[doc(alias = "as_agreement_section_set_kind")]
    fn set_kind(&self, kind: &str) {
        unsafe {
            ffi::as_agreement_section_set_kind(
                self.as_ref().to_glib_none().0,
                kind.to_glib_none().0,
            );
        }
    }

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

impl<O: IsA<AgreementSection>> AgreementSectionExt for O {}