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, ColorKind, ColorSchemeKind};
use glib::{prelude::*, translate::*};

glib::wrapper! {
    #[doc(alias = "AsBranding")]
    pub struct Branding(Object<ffi::AsBranding, ffi::AsBrandingClass>);

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

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

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

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

pub trait BrandingExt: IsA<Branding> + 'static {
    #[doc(alias = "as_branding_get_color")]
    #[doc(alias = "get_color")]
    fn color(&self, kind: ColorKind, scheme_kind: ColorSchemeKind) -> Option<glib::GString> {
        unsafe {
            from_glib_none(ffi::as_branding_get_color(
                self.as_ref().to_glib_none().0,
                kind.into_glib(),
                scheme_kind.into_glib(),
            ))
        }
    }

    #[doc(alias = "as_branding_remove_color")]
    fn remove_color(&self, kind: ColorKind, scheme_preference: ColorSchemeKind) {
        unsafe {
            ffi::as_branding_remove_color(
                self.as_ref().to_glib_none().0,
                kind.into_glib(),
                scheme_preference.into_glib(),
            );
        }
    }

    #[doc(alias = "as_branding_set_color")]
    fn set_color(&self, kind: ColorKind, scheme_preference: ColorSchemeKind, colorcode: &str) {
        unsafe {
            ffi::as_branding_set_color(
                self.as_ref().to_glib_none().0,
                kind.into_glib(),
                scheme_preference.into_glib(),
                colorcode.to_glib_none().0,
            );
        }
    }
}

impl<O: IsA<Branding>> BrandingExt for O {}