use bitflags::bitflags;
use glib::translate::*;
use glib::value::FromValue;
use glib::value::ToValue;
use glib::StaticType;
use glib::Type;
use std::fmt;
bitflags! {
#[doc(alias = "SpiceInputsLock")]
pub struct InputsLock: u32 {
#[doc(alias = "SPICE_INPUTS_SCROLL_LOCK")]
const SCROLL_LOCK = ffi::SPICE_INPUTS_SCROLL_LOCK as _;
#[doc(alias = "SPICE_INPUTS_NUM_LOCK")]
const NUM_LOCK = ffi::SPICE_INPUTS_NUM_LOCK as _;
#[doc(alias = "SPICE_INPUTS_CAPS_LOCK")]
const CAPS_LOCK = ffi::SPICE_INPUTS_CAPS_LOCK as _;
}
}
impl fmt::Display for InputsLock {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
<Self as fmt::Debug>::fmt(self, f)
}
}
#[doc(hidden)]
impl IntoGlib for InputsLock {
type GlibType = ffi::SpiceInputsLock;
fn into_glib(self) -> ffi::SpiceInputsLock {
self.bits()
}
}
#[doc(hidden)]
impl FromGlib<ffi::SpiceInputsLock> for InputsLock {
unsafe fn from_glib(value: ffi::SpiceInputsLock) -> Self {
skip_assert_initialized!();
Self::from_bits_truncate(value)
}
}
impl StaticType for InputsLock {
fn static_type() -> Type {
unsafe { from_glib(ffi::spice_inputs_lock_get_type()) }
}
}
impl glib::value::ValueType for InputsLock {
type Type = Self;
}
unsafe impl<'a> FromValue<'a> for InputsLock {
type Checker = glib::value::GenericValueTypeChecker<Self>;
unsafe fn from_value(value: &'a glib::Value) -> Self {
skip_assert_initialized!();
from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
}
}
impl ToValue for InputsLock {
fn to_value(&self) -> glib::Value {
let mut value = glib::Value::for_value_type::<Self>();
unsafe {
glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
}
value
}
fn value_type(&self) -> glib::Type {
Self::static_type()
}
}
bitflags! {
#[doc(alias = "SpiceSessionVerify")]
pub struct SessionVerify: u32 {
#[doc(alias = "SPICE_SESSION_VERIFY_PUBKEY")]
const PUBKEY = ffi::SPICE_SESSION_VERIFY_PUBKEY as _;
#[doc(alias = "SPICE_SESSION_VERIFY_HOSTNAME")]
const HOSTNAME = ffi::SPICE_SESSION_VERIFY_HOSTNAME as _;
#[doc(alias = "SPICE_SESSION_VERIFY_SUBJECT")]
const SUBJECT = ffi::SPICE_SESSION_VERIFY_SUBJECT as _;
}
}
impl fmt::Display for SessionVerify {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
<Self as fmt::Debug>::fmt(self, f)
}
}
#[doc(hidden)]
impl IntoGlib for SessionVerify {
type GlibType = ffi::SpiceSessionVerify;
fn into_glib(self) -> ffi::SpiceSessionVerify {
self.bits()
}
}
#[doc(hidden)]
impl FromGlib<ffi::SpiceSessionVerify> for SessionVerify {
unsafe fn from_glib(value: ffi::SpiceSessionVerify) -> Self {
skip_assert_initialized!();
Self::from_bits_truncate(value)
}
}
impl StaticType for SessionVerify {
fn static_type() -> Type {
unsafe { from_glib(ffi::spice_session_verify_get_type()) }
}
}
impl glib::value::ValueType for SessionVerify {
type Type = Self;
}
unsafe impl<'a> FromValue<'a> for SessionVerify {
type Checker = glib::value::GenericValueTypeChecker<Self>;
unsafe fn from_value(value: &'a glib::Value) -> Self {
skip_assert_initialized!();
from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
}
}
impl ToValue for SessionVerify {
fn to_value(&self) -> glib::Value {
let mut value = glib::Value::for_value_type::<Self>();
unsafe {
glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
}
value
}
fn value_type(&self) -> glib::Type {
Self::static_type()
}
}