// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::{boxed::Box as Box_, mem::transmute}; glib::wrapper! { #[doc(alias = "GstDirectControlBinding")] pub struct DirectControlBinding(Object) @extends gst::ControlBinding, gst::Object; match fn { type_ => || ffi::gst_direct_control_binding_get_type(), } } impl DirectControlBinding { pub const NONE: Option<&'static DirectControlBinding> = None; #[doc(alias = "gst_direct_control_binding_new")] pub fn new( object: &impl IsA, property_name: &str, cs: &impl IsA, ) -> DirectControlBinding { assert_initialized_main_thread!(); unsafe { gst::ControlBinding::from_glib_none(ffi::gst_direct_control_binding_new( object.as_ref().to_glib_none().0, property_name.to_glib_none().0, cs.as_ref().to_glib_none().0, )) .unsafe_cast() } } #[doc(alias = "gst_direct_control_binding_new_absolute")] pub fn new_absolute( object: &impl IsA, property_name: &str, cs: &impl IsA, ) -> DirectControlBinding { assert_initialized_main_thread!(); unsafe { gst::ControlBinding::from_glib_none(ffi::gst_direct_control_binding_new_absolute( object.as_ref().to_glib_none().0, property_name.to_glib_none().0, cs.as_ref().to_glib_none().0, )) .unsafe_cast() } } } unsafe impl Send for DirectControlBinding {} unsafe impl Sync for DirectControlBinding {} mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait DirectControlBindingExt: IsA + sealed::Sealed + 'static { fn is_absolute(&self) -> bool { glib::ObjectExt::property(self.as_ref(), "absolute") } #[doc(alias = "control-source")] fn control_source(&self) -> Option { glib::ObjectExt::property(self.as_ref(), "control-source") } #[doc(alias = "control-source")] fn set_control_source>(&self, control_source: Option<&P>) { glib::ObjectExt::set_property(self.as_ref(), "control-source", control_source) } #[doc(alias = "control-source")] fn connect_control_source_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_control_source_trampoline< P: IsA, F: Fn(&P) + Send + Sync + 'static, >( this: *mut ffi::GstDirectControlBinding, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(DirectControlBinding::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::control-source\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_control_source_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> DirectControlBindingExt for O {}