use Switch;
use ffi;
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use std::boxed::Box as Box_;
use std::mem::transmute;
impl Switch {
pub fn connect_changed_active<F: Fn(&Switch) + 'static>(&self, f: F) -> u64 {
unsafe {
let f: Box_<Box_<Fn(&Switch) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::active",
transmute(changed_active_trampoline as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn changed_active_trampoline(this: *mut ffi::GtkSwitch, _gparamspec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
callback_guard!();
let f: &Box_<Fn(&Switch) + 'static> = transmute(f);
f(&from_glib_none(this))
}