use std::marker::PhantomData;
use glib::object::{Ref, Wrapper};
use glib::types::StaticType;
pub use glib::object::{Downcast, Upcast};
pub struct Object<T>(Ref, PhantomData<T>);
impl<T: 'static> Wrapper for Object<T>
where Object<T>: StaticType {
type GlibType = T;
#[inline]
unsafe fn wrap(r: Ref) -> Object<T> { Object(r, PhantomData) }
#[inline]
fn as_ref(&self) -> &Ref { &self.0 }
#[inline]
fn unwrap(self) -> Ref { self.0 }
}
impl<T> Clone for Object<T> {
fn clone(&self) -> Object<T> {
Object(self.0.clone(), PhantomData)
}
}
unsafe impl<T: 'static> Upcast<::glib::object::Object> for Object<T> where Object<T>: StaticType { }