use crate::{ffi};
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
use glib::{translate::*};
glib::wrapper! {
#[derive(Debug, PartialOrd, Ord, Hash)]
pub struct TCAction(Shared<ffi::NMTCAction>);
match fn {
ref => |ptr| ffi::nm_tc_action_ref(ptr),
unref => |ptr| ffi::nm_tc_action_unref(ptr),
type_ => || ffi::nm_tc_action_get_type(),
}
}
impl TCAction {
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
#[doc(alias = "nm_tc_action_new")]
pub fn new(kind: &str) -> Result<TCAction, glib::Error> {
assert_initialized_main_thread!();
unsafe {
let mut error = std::ptr::null_mut();
let ret = ffi::nm_tc_action_new(kind.to_glib_none().0, &mut error);
if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
}
}
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
#[doc(alias = "nm_tc_action_dup")]
#[must_use]
pub fn dup(&self) -> TCAction {
unsafe {
from_glib_full(ffi::nm_tc_action_dup(self.to_glib_none().0))
}
}
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
#[doc(alias = "nm_tc_action_equal")]
fn equal(&self, other: &TCAction) -> bool {
unsafe {
from_glib(ffi::nm_tc_action_equal(self.to_glib_none().0, other.to_glib_none().0))
}
}
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
#[doc(alias = "nm_tc_action_get_attribute_names")]
#[doc(alias = "get_attribute_names")]
pub fn attribute_names(&self) -> Vec<glib::GString> {
unsafe {
FromGlibPtrContainer::from_glib_full(ffi::nm_tc_action_get_attribute_names(self.to_glib_none().0))
}
}
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
#[doc(alias = "nm_tc_action_get_kind")]
#[doc(alias = "get_kind")]
pub fn kind(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::nm_tc_action_get_kind(self.to_glib_none().0))
}
}
}
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
impl PartialEq for TCAction {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.equal(other)
}
}
#[cfg(feature = "v1_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_12")))]
impl Eq for TCAction {}