use ges_sys;
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use glib::StaticType;
use glib::Value;
use glib_sys;
use gobject_sys;
use std::boxed::Box as Box_;
use std::mem::transmute;
use Container;
use Extractable;
use TimelineElement;
glib_wrapper! {
pub struct Group(Object<ges_sys::GESGroup, ges_sys::GESGroupClass, GroupClass>) @extends Container, TimelineElement, @implements Extractable;
match fn {
get_type => || ges_sys::ges_group_get_type(),
}
}
impl Group {
pub fn new() -> Group {
assert_initialized_main_thread!();
unsafe { from_glib_none(ges_sys::ges_group_new()) }
}
}
impl Default for Group {
fn default() -> Self {
Self::new()
}
}
pub const NONE_GROUP: Option<&Group> = None;
pub trait GroupExt: 'static {
fn get_property_duration(&self) -> u64;
fn set_property_duration(&self, duration: u64);
fn get_property_in_point(&self) -> u64;
fn set_property_in_point(&self, in_point: u64);
fn get_property_max_duration(&self) -> u64;
fn set_property_max_duration(&self, max_duration: u64);
fn get_property_priority(&self) -> u32;
fn set_property_priority(&self, priority: u32);
fn get_property_start(&self) -> u64;
fn set_property_start(&self, start: u64);
fn connect_property_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_in_point_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_max_duration_notify<F: Fn(&Self) + 'static>(&self, f: F)
-> SignalHandlerId;
fn connect_property_priority_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_start_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<Group>> GroupExt for O {
fn get_property_duration(&self) -> u64 {
unsafe {
let mut value = Value::from_type(<u64 as StaticType>::static_type());
gobject_sys::g_object_get_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"duration\0".as_ptr() as *const _,
value.to_glib_none_mut().0,
);
value
.get()
.expect("Return Value for property `duration` getter")
.unwrap()
}
}
fn set_property_duration(&self, duration: u64) {
unsafe {
gobject_sys::g_object_set_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"duration\0".as_ptr() as *const _,
Value::from(&duration).to_glib_none().0,
);
}
}
fn get_property_in_point(&self) -> u64 {
unsafe {
let mut value = Value::from_type(<u64 as StaticType>::static_type());
gobject_sys::g_object_get_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"in-point\0".as_ptr() as *const _,
value.to_glib_none_mut().0,
);
value
.get()
.expect("Return Value for property `in-point` getter")
.unwrap()
}
}
fn set_property_in_point(&self, in_point: u64) {
unsafe {
gobject_sys::g_object_set_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"in-point\0".as_ptr() as *const _,
Value::from(&in_point).to_glib_none().0,
);
}
}
fn get_property_max_duration(&self) -> u64 {
unsafe {
let mut value = Value::from_type(<u64 as StaticType>::static_type());
gobject_sys::g_object_get_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"max-duration\0".as_ptr() as *const _,
value.to_glib_none_mut().0,
);
value
.get()
.expect("Return Value for property `max-duration` getter")
.unwrap()
}
}
fn set_property_max_duration(&self, max_duration: u64) {
unsafe {
gobject_sys::g_object_set_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"max-duration\0".as_ptr() as *const _,
Value::from(&max_duration).to_glib_none().0,
);
}
}
fn get_property_priority(&self) -> u32 {
unsafe {
let mut value = Value::from_type(<u32 as StaticType>::static_type());
gobject_sys::g_object_get_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"priority\0".as_ptr() as *const _,
value.to_glib_none_mut().0,
);
value
.get()
.expect("Return Value for property `priority` getter")
.unwrap()
}
}
fn set_property_priority(&self, priority: u32) {
unsafe {
gobject_sys::g_object_set_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"priority\0".as_ptr() as *const _,
Value::from(&priority).to_glib_none().0,
);
}
}
fn get_property_start(&self) -> u64 {
unsafe {
let mut value = Value::from_type(<u64 as StaticType>::static_type());
gobject_sys::g_object_get_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"start\0".as_ptr() as *const _,
value.to_glib_none_mut().0,
);
value
.get()
.expect("Return Value for property `start` getter")
.unwrap()
}
}
fn set_property_start(&self, start: u64) {
unsafe {
gobject_sys::g_object_set_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
b"start\0".as_ptr() as *const _,
Value::from(&start).to_glib_none().0,
);
}
}
fn connect_property_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_duration_trampoline<P, F: Fn(&P) + 'static>(
this: *mut ges_sys::GESGroup,
_param_spec: glib_sys::gpointer,
f: glib_sys::gpointer,
) where
P: IsA<Group>,
{
let f: &F = &*(f as *const F);
f(&Group::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::duration\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_duration_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
fn connect_property_in_point_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_in_point_trampoline<P, F: Fn(&P) + 'static>(
this: *mut ges_sys::GESGroup,
_param_spec: glib_sys::gpointer,
f: glib_sys::gpointer,
) where
P: IsA<Group>,
{
let f: &F = &*(f as *const F);
f(&Group::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::in-point\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_in_point_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
fn connect_property_max_duration_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_max_duration_trampoline<P, F: Fn(&P) + 'static>(
this: *mut ges_sys::GESGroup,
_param_spec: glib_sys::gpointer,
f: glib_sys::gpointer,
) where
P: IsA<Group>,
{
let f: &F = &*(f as *const F);
f(&Group::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::max-duration\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_max_duration_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
fn connect_property_priority_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_priority_trampoline<P, F: Fn(&P) + 'static>(
this: *mut ges_sys::GESGroup,
_param_spec: glib_sys::gpointer,
f: glib_sys::gpointer,
) where
P: IsA<Group>,
{
let f: &F = &*(f as *const F);
f(&Group::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::priority\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_priority_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
fn connect_property_start_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_start_trampoline<P, F: Fn(&P) + 'static>(
this: *mut ges_sys::GESGroup,
_param_spec: glib_sys::gpointer,
f: glib_sys::gpointer,
) where
P: IsA<Group>,
{
let f: &F = &*(f as *const F);
f(&Group::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::start\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_start_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}