1 // This file was generated by gir (https://github.com/gtk-rs/gir)
2 // from gir-files (https://github.com/gtk-rs/gir-files)
3 // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4 // DO NOT EDIT
5 
6 use crate::ClockTime;
7 use crate::Object;
8 use glib::object::Cast;
9 use glib::object::IsA;
10 use glib::signal::connect_raw;
11 use glib::signal::SignalHandlerId;
12 use glib::translate::*;
13 use glib::StaticType;
14 use glib::ToValue;
15 use std::boxed::Box as Box_;
16 use std::mem;
17 use std::mem::transmute;
18 
19 glib::wrapper! {
20     #[doc(alias = "GstClock")]
21     pub struct Clock(Object<ffi::GstClock, ffi::GstClockClass>) @extends Object;
22 
23     match fn {
24         type_ => || ffi::gst_clock_get_type(),
25     }
26 }
27 
28 impl Clock {
29     //#[doc(alias = "gst_clock_id_compare_func")]
30     //pub fn id_compare_func(id1: /*Unimplemented*/Option<Fundamental: Pointer>, id2: /*Unimplemented*/Option<Fundamental: Pointer>) -> i32 {
31     //    unsafe { TODO: call ffi:gst_clock_id_compare_func() }
32     //}
33 
34     //#[cfg(any(feature = "v1_16", feature = "dox"))]
35     //#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
36     //#[doc(alias = "gst_clock_id_get_clock")]
37     //pub fn id_get_clock(id: /*Unimplemented*/ClockID) -> Option<Clock> {
38     //    unsafe { TODO: call ffi:gst_clock_id_get_clock() }
39     //}
40 
41     //#[doc(alias = "gst_clock_id_get_time")]
42     //pub fn id_get_time(id: /*Unimplemented*/ClockID) -> Option<ClockTime> {
43     //    unsafe { TODO: call ffi:gst_clock_id_get_time() }
44     //}
45 
46     //#[doc(alias = "gst_clock_id_ref")]
47     //pub fn id_ref(id: /*Unimplemented*/ClockID) -> /*Unimplemented*/ClockID {
48     //    unsafe { TODO: call ffi:gst_clock_id_ref() }
49     //}
50 
51     //#[doc(alias = "gst_clock_id_unref")]
52     //pub fn id_unref(id: /*Unimplemented*/ClockID) {
53     //    unsafe { TODO: call ffi:gst_clock_id_unref() }
54     //}
55 
56     //#[doc(alias = "gst_clock_id_unschedule")]
57     //pub fn id_unschedule(id: /*Unimplemented*/ClockID) {
58     //    unsafe { TODO: call ffi:gst_clock_id_unschedule() }
59     //}
60 
61     //#[cfg(any(feature = "v1_16", feature = "dox"))]
62     //#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
63     //#[doc(alias = "gst_clock_id_uses_clock")]
64     //pub fn id_uses_clock<P: IsA<Clock>>(id: /*Unimplemented*/ClockID, clock: &P) -> bool {
65     //    unsafe { TODO: call ffi:gst_clock_id_uses_clock() }
66     //}
67 
68     //#[doc(alias = "gst_clock_id_wait")]
69     //pub fn id_wait(id: /*Unimplemented*/ClockID) -> (Result<ClockSuccess, ClockError>, ClockTimeDiff) {
70     //    unsafe { TODO: call ffi:gst_clock_id_wait() }
71     //}
72 
73     //#[doc(alias = "gst_clock_id_wait_async")]
74     //pub fn id_wait_async(id: /*Unimplemented*/ClockID, func: /*Unimplemented*/Fn(&Clock, impl Into<Option<ClockTime>>, /*Unimplemented*/ClockID) -> bool, user_data: /*Unimplemented*/Option<Fundamental: Pointer>) -> Result<ClockSuccess, ClockError> {
75     //    unsafe { TODO: call ffi:gst_clock_id_wait_async() }
76     //}
77 }
78 
79 unsafe impl Send for Clock {}
80 unsafe impl Sync for Clock {}
81 
82 pub const NONE_CLOCK: Option<&Clock> = None;
83 
84 pub trait ClockExt: 'static {
85     #[doc(alias = "gst_clock_add_observation")]
add_observation(&self, slave: ClockTime, master: ClockTime) -> Option<f64>86     fn add_observation(&self, slave: ClockTime, master: ClockTime) -> Option<f64>;
87 
88     #[doc(alias = "gst_clock_add_observation_unapplied")]
add_observation_unapplied( &self, slave: ClockTime, master: ClockTime, ) -> Option<(f64, ClockTime, ClockTime, ClockTime, ClockTime)>89     fn add_observation_unapplied(
90         &self,
91         slave: ClockTime,
92         master: ClockTime,
93     ) -> Option<(f64, ClockTime, ClockTime, ClockTime, ClockTime)>;
94 
95     #[doc(alias = "gst_clock_adjust_unlocked")]
adjust_unlocked(&self, internal: ClockTime) -> Option<ClockTime>96     fn adjust_unlocked(&self, internal: ClockTime) -> Option<ClockTime>;
97 
98     #[doc(alias = "gst_clock_get_calibration")]
99     #[doc(alias = "get_calibration")]
calibration(&self) -> (ClockTime, ClockTime, ClockTime, ClockTime)100     fn calibration(&self) -> (ClockTime, ClockTime, ClockTime, ClockTime);
101 
102     #[doc(alias = "gst_clock_get_internal_time")]
103     #[doc(alias = "get_internal_time")]
internal_time(&self) -> ClockTime104     fn internal_time(&self) -> ClockTime;
105 
106     #[doc(alias = "gst_clock_get_master")]
107     #[doc(alias = "get_master")]
master(&self) -> Option<Clock>108     fn master(&self) -> Option<Clock>;
109 
110     #[doc(alias = "gst_clock_get_resolution")]
111     #[doc(alias = "get_resolution")]
resolution(&self) -> ClockTime112     fn resolution(&self) -> ClockTime;
113 
114     #[doc(alias = "gst_clock_get_time")]
115     #[doc(alias = "get_time")]
time(&self) -> Option<ClockTime>116     fn time(&self) -> Option<ClockTime>;
117 
118     #[doc(alias = "gst_clock_get_timeout")]
119     #[doc(alias = "get_timeout")]
timeout(&self) -> Option<ClockTime>120     fn timeout(&self) -> Option<ClockTime>;
121 
122     #[doc(alias = "gst_clock_is_synced")]
is_synced(&self) -> bool123     fn is_synced(&self) -> bool;
124 
125     #[doc(alias = "gst_clock_set_calibration")]
set_calibration( &self, internal: ClockTime, external: ClockTime, rate_num: ClockTime, rate_denom: ClockTime, )126     fn set_calibration(
127         &self,
128         internal: ClockTime,
129         external: ClockTime,
130         rate_num: ClockTime,
131         rate_denom: ClockTime,
132     );
133 
134     #[doc(alias = "gst_clock_set_master")]
set_master<P: IsA<Clock>>(&self, master: Option<&P>) -> Result<(), glib::error::BoolError>135     fn set_master<P: IsA<Clock>>(&self, master: Option<&P>) -> Result<(), glib::error::BoolError>;
136 
137     #[doc(alias = "gst_clock_set_resolution")]
set_resolution(&self, resolution: ClockTime) -> ClockTime138     fn set_resolution(&self, resolution: ClockTime) -> ClockTime;
139 
140     #[doc(alias = "gst_clock_set_synced")]
set_synced(&self, synced: bool)141     fn set_synced(&self, synced: bool);
142 
143     #[doc(alias = "gst_clock_set_timeout")]
set_timeout(&self, timeout: impl Into<Option<ClockTime>>)144     fn set_timeout(&self, timeout: impl Into<Option<ClockTime>>);
145 
146     #[doc(alias = "gst_clock_unadjust_unlocked")]
unadjust_unlocked(&self, external: ClockTime) -> Option<ClockTime>147     fn unadjust_unlocked(&self, external: ClockTime) -> Option<ClockTime>;
148 
149     #[doc(alias = "gst_clock_wait_for_sync")]
wait_for_sync( &self, timeout: impl Into<Option<ClockTime>>, ) -> Result<(), glib::error::BoolError>150     fn wait_for_sync(
151         &self,
152         timeout: impl Into<Option<ClockTime>>,
153     ) -> Result<(), glib::error::BoolError>;
154 
155     #[doc(alias = "window-size")]
window_size(&self) -> i32156     fn window_size(&self) -> i32;
157 
158     #[doc(alias = "window-size")]
set_window_size(&self, window_size: i32)159     fn set_window_size(&self, window_size: i32);
160 
161     #[doc(alias = "window-threshold")]
window_threshold(&self) -> i32162     fn window_threshold(&self) -> i32;
163 
164     #[doc(alias = "window-threshold")]
set_window_threshold(&self, window_threshold: i32)165     fn set_window_threshold(&self, window_threshold: i32);
166 
167     #[doc(alias = "synced")]
connect_synced<F: Fn(&Self, bool) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId168     fn connect_synced<F: Fn(&Self, bool) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
169 
170     #[doc(alias = "timeout")]
connect_timeout_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId171     fn connect_timeout_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F)
172         -> SignalHandlerId;
173 
174     #[doc(alias = "window-size")]
connect_window_size_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId175     fn connect_window_size_notify<F: Fn(&Self) + Send + Sync + 'static>(
176         &self,
177         f: F,
178     ) -> SignalHandlerId;
179 
180     #[doc(alias = "window-threshold")]
connect_window_threshold_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId181     fn connect_window_threshold_notify<F: Fn(&Self) + Send + Sync + 'static>(
182         &self,
183         f: F,
184     ) -> SignalHandlerId;
185 }
186 
187 impl<O: IsA<Clock>> ClockExt for O {
add_observation(&self, slave: ClockTime, master: ClockTime) -> Option<f64>188     fn add_observation(&self, slave: ClockTime, master: ClockTime) -> Option<f64> {
189         unsafe {
190             let mut r_squared = mem::MaybeUninit::uninit();
191             let ret = from_glib(ffi::gst_clock_add_observation(
192                 self.as_ref().to_glib_none().0,
193                 slave.into_glib(),
194                 master.into_glib(),
195                 r_squared.as_mut_ptr(),
196             ));
197             let r_squared = r_squared.assume_init();
198             if ret {
199                 Some(r_squared)
200             } else {
201                 None
202             }
203         }
204     }
205 
add_observation_unapplied( &self, slave: ClockTime, master: ClockTime, ) -> Option<(f64, ClockTime, ClockTime, ClockTime, ClockTime)>206     fn add_observation_unapplied(
207         &self,
208         slave: ClockTime,
209         master: ClockTime,
210     ) -> Option<(f64, ClockTime, ClockTime, ClockTime, ClockTime)> {
211         unsafe {
212             let mut r_squared = mem::MaybeUninit::uninit();
213             let mut internal = mem::MaybeUninit::uninit();
214             let mut external = mem::MaybeUninit::uninit();
215             let mut rate_num = mem::MaybeUninit::uninit();
216             let mut rate_denom = mem::MaybeUninit::uninit();
217             let ret = from_glib(ffi::gst_clock_add_observation_unapplied(
218                 self.as_ref().to_glib_none().0,
219                 slave.into_glib(),
220                 master.into_glib(),
221                 r_squared.as_mut_ptr(),
222                 internal.as_mut_ptr(),
223                 external.as_mut_ptr(),
224                 rate_num.as_mut_ptr(),
225                 rate_denom.as_mut_ptr(),
226             ));
227             let r_squared = r_squared.assume_init();
228             let internal = internal.assume_init();
229             let external = external.assume_init();
230             let rate_num = rate_num.assume_init();
231             let rate_denom = rate_denom.assume_init();
232             if ret {
233                 Some((
234                     r_squared,
235                     try_from_glib(internal).expect("mandatory glib value is None"),
236                     try_from_glib(external).expect("mandatory glib value is None"),
237                     try_from_glib(rate_num).expect("mandatory glib value is None"),
238                     try_from_glib(rate_denom).expect("mandatory glib value is None"),
239                 ))
240             } else {
241                 None
242             }
243         }
244     }
245 
adjust_unlocked(&self, internal: ClockTime) -> Option<ClockTime>246     fn adjust_unlocked(&self, internal: ClockTime) -> Option<ClockTime> {
247         unsafe {
248             from_glib(ffi::gst_clock_adjust_unlocked(
249                 self.as_ref().to_glib_none().0,
250                 internal.into_glib(),
251             ))
252         }
253     }
254 
calibration(&self) -> (ClockTime, ClockTime, ClockTime, ClockTime)255     fn calibration(&self) -> (ClockTime, ClockTime, ClockTime, ClockTime) {
256         unsafe {
257             let mut internal = mem::MaybeUninit::uninit();
258             let mut external = mem::MaybeUninit::uninit();
259             let mut rate_num = mem::MaybeUninit::uninit();
260             let mut rate_denom = mem::MaybeUninit::uninit();
261             ffi::gst_clock_get_calibration(
262                 self.as_ref().to_glib_none().0,
263                 internal.as_mut_ptr(),
264                 external.as_mut_ptr(),
265                 rate_num.as_mut_ptr(),
266                 rate_denom.as_mut_ptr(),
267             );
268             let internal = internal.assume_init();
269             let external = external.assume_init();
270             let rate_num = rate_num.assume_init();
271             let rate_denom = rate_denom.assume_init();
272             (
273                 try_from_glib(internal).expect("mandatory glib value is None"),
274                 try_from_glib(external).expect("mandatory glib value is None"),
275                 try_from_glib(rate_num).expect("mandatory glib value is None"),
276                 try_from_glib(rate_denom).expect("mandatory glib value is None"),
277             )
278         }
279     }
280 
internal_time(&self) -> ClockTime281     fn internal_time(&self) -> ClockTime {
282         unsafe {
283             try_from_glib(ffi::gst_clock_get_internal_time(
284                 self.as_ref().to_glib_none().0,
285             ))
286             .expect("mandatory glib value is None")
287         }
288     }
289 
master(&self) -> Option<Clock>290     fn master(&self) -> Option<Clock> {
291         unsafe { from_glib_full(ffi::gst_clock_get_master(self.as_ref().to_glib_none().0)) }
292     }
293 
resolution(&self) -> ClockTime294     fn resolution(&self) -> ClockTime {
295         unsafe {
296             try_from_glib(ffi::gst_clock_get_resolution(
297                 self.as_ref().to_glib_none().0,
298             ))
299             .expect("mandatory glib value is None")
300         }
301     }
302 
time(&self) -> Option<ClockTime>303     fn time(&self) -> Option<ClockTime> {
304         unsafe { from_glib(ffi::gst_clock_get_time(self.as_ref().to_glib_none().0)) }
305     }
306 
timeout(&self) -> Option<ClockTime>307     fn timeout(&self) -> Option<ClockTime> {
308         unsafe { from_glib(ffi::gst_clock_get_timeout(self.as_ref().to_glib_none().0)) }
309     }
310 
is_synced(&self) -> bool311     fn is_synced(&self) -> bool {
312         unsafe { from_glib(ffi::gst_clock_is_synced(self.as_ref().to_glib_none().0)) }
313     }
314 
set_calibration( &self, internal: ClockTime, external: ClockTime, rate_num: ClockTime, rate_denom: ClockTime, )315     fn set_calibration(
316         &self,
317         internal: ClockTime,
318         external: ClockTime,
319         rate_num: ClockTime,
320         rate_denom: ClockTime,
321     ) {
322         unsafe {
323             ffi::gst_clock_set_calibration(
324                 self.as_ref().to_glib_none().0,
325                 internal.into_glib(),
326                 external.into_glib(),
327                 rate_num.into_glib(),
328                 rate_denom.into_glib(),
329             );
330         }
331     }
332 
set_master<P: IsA<Clock>>(&self, master: Option<&P>) -> Result<(), glib::error::BoolError>333     fn set_master<P: IsA<Clock>>(&self, master: Option<&P>) -> Result<(), glib::error::BoolError> {
334         unsafe {
335             glib::result_from_gboolean!(
336                 ffi::gst_clock_set_master(
337                     self.as_ref().to_glib_none().0,
338                     master.map(|p| p.as_ref()).to_glib_none().0
339                 ),
340                 "Failed to set master clock"
341             )
342         }
343     }
344 
set_resolution(&self, resolution: ClockTime) -> ClockTime345     fn set_resolution(&self, resolution: ClockTime) -> ClockTime {
346         unsafe {
347             try_from_glib(ffi::gst_clock_set_resolution(
348                 self.as_ref().to_glib_none().0,
349                 resolution.into_glib(),
350             ))
351             .expect("mandatory glib value is None")
352         }
353     }
354 
set_synced(&self, synced: bool)355     fn set_synced(&self, synced: bool) {
356         unsafe {
357             ffi::gst_clock_set_synced(self.as_ref().to_glib_none().0, synced.into_glib());
358         }
359     }
360 
set_timeout(&self, timeout: impl Into<Option<ClockTime>>)361     fn set_timeout(&self, timeout: impl Into<Option<ClockTime>>) {
362         unsafe {
363             ffi::gst_clock_set_timeout(self.as_ref().to_glib_none().0, timeout.into().into_glib());
364         }
365     }
366 
unadjust_unlocked(&self, external: ClockTime) -> Option<ClockTime>367     fn unadjust_unlocked(&self, external: ClockTime) -> Option<ClockTime> {
368         unsafe {
369             from_glib(ffi::gst_clock_unadjust_unlocked(
370                 self.as_ref().to_glib_none().0,
371                 external.into_glib(),
372             ))
373         }
374     }
375 
wait_for_sync( &self, timeout: impl Into<Option<ClockTime>>, ) -> Result<(), glib::error::BoolError>376     fn wait_for_sync(
377         &self,
378         timeout: impl Into<Option<ClockTime>>,
379     ) -> Result<(), glib::error::BoolError> {
380         unsafe {
381             glib::result_from_gboolean!(
382                 ffi::gst_clock_wait_for_sync(
383                     self.as_ref().to_glib_none().0,
384                     timeout.into().into_glib()
385                 ),
386                 "Timed out waiting for sync"
387             )
388         }
389     }
390 
window_size(&self) -> i32391     fn window_size(&self) -> i32 {
392         unsafe {
393             let mut value = glib::Value::from_type(<i32 as StaticType>::static_type());
394             glib::gobject_ffi::g_object_get_property(
395                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
396                 b"window-size\0".as_ptr() as *const _,
397                 value.to_glib_none_mut().0,
398             );
399             value
400                 .get()
401                 .expect("Return Value for property `window-size` getter")
402         }
403     }
404 
set_window_size(&self, window_size: i32)405     fn set_window_size(&self, window_size: i32) {
406         unsafe {
407             glib::gobject_ffi::g_object_set_property(
408                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
409                 b"window-size\0".as_ptr() as *const _,
410                 window_size.to_value().to_glib_none().0,
411             );
412         }
413     }
414 
window_threshold(&self) -> i32415     fn window_threshold(&self) -> i32 {
416         unsafe {
417             let mut value = glib::Value::from_type(<i32 as StaticType>::static_type());
418             glib::gobject_ffi::g_object_get_property(
419                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
420                 b"window-threshold\0".as_ptr() as *const _,
421                 value.to_glib_none_mut().0,
422             );
423             value
424                 .get()
425                 .expect("Return Value for property `window-threshold` getter")
426         }
427     }
428 
set_window_threshold(&self, window_threshold: i32)429     fn set_window_threshold(&self, window_threshold: i32) {
430         unsafe {
431             glib::gobject_ffi::g_object_set_property(
432                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
433                 b"window-threshold\0".as_ptr() as *const _,
434                 window_threshold.to_value().to_glib_none().0,
435             );
436         }
437     }
438 
connect_synced<F: Fn(&Self, bool) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId439     fn connect_synced<F: Fn(&Self, bool) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
440         unsafe extern "C" fn synced_trampoline<
441             P: IsA<Clock>,
442             F: Fn(&P, bool) + Send + Sync + 'static,
443         >(
444             this: *mut ffi::GstClock,
445             synced: glib::ffi::gboolean,
446             f: glib::ffi::gpointer,
447         ) {
448             let f: &F = &*(f as *const F);
449             f(
450                 Clock::from_glib_borrow(this).unsafe_cast_ref(),
451                 from_glib(synced),
452             )
453         }
454         unsafe {
455             let f: Box_<F> = Box_::new(f);
456             connect_raw(
457                 self.as_ptr() as *mut _,
458                 b"synced\0".as_ptr() as *const _,
459                 Some(transmute::<_, unsafe extern "C" fn()>(
460                     synced_trampoline::<Self, F> as *const (),
461                 )),
462                 Box_::into_raw(f),
463             )
464         }
465     }
466 
connect_timeout_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId467     fn connect_timeout_notify<F: Fn(&Self) + Send + Sync + 'static>(
468         &self,
469         f: F,
470     ) -> SignalHandlerId {
471         unsafe extern "C" fn notify_timeout_trampoline<
472             P: IsA<Clock>,
473             F: Fn(&P) + Send + Sync + 'static,
474         >(
475             this: *mut ffi::GstClock,
476             _param_spec: glib::ffi::gpointer,
477             f: glib::ffi::gpointer,
478         ) {
479             let f: &F = &*(f as *const F);
480             f(Clock::from_glib_borrow(this).unsafe_cast_ref())
481         }
482         unsafe {
483             let f: Box_<F> = Box_::new(f);
484             connect_raw(
485                 self.as_ptr() as *mut _,
486                 b"notify::timeout\0".as_ptr() as *const _,
487                 Some(transmute::<_, unsafe extern "C" fn()>(
488                     notify_timeout_trampoline::<Self, F> as *const (),
489                 )),
490                 Box_::into_raw(f),
491             )
492         }
493     }
494 
connect_window_size_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId495     fn connect_window_size_notify<F: Fn(&Self) + Send + Sync + 'static>(
496         &self,
497         f: F,
498     ) -> SignalHandlerId {
499         unsafe extern "C" fn notify_window_size_trampoline<
500             P: IsA<Clock>,
501             F: Fn(&P) + Send + Sync + 'static,
502         >(
503             this: *mut ffi::GstClock,
504             _param_spec: glib::ffi::gpointer,
505             f: glib::ffi::gpointer,
506         ) {
507             let f: &F = &*(f as *const F);
508             f(Clock::from_glib_borrow(this).unsafe_cast_ref())
509         }
510         unsafe {
511             let f: Box_<F> = Box_::new(f);
512             connect_raw(
513                 self.as_ptr() as *mut _,
514                 b"notify::window-size\0".as_ptr() as *const _,
515                 Some(transmute::<_, unsafe extern "C" fn()>(
516                     notify_window_size_trampoline::<Self, F> as *const (),
517                 )),
518                 Box_::into_raw(f),
519             )
520         }
521     }
522 
connect_window_threshold_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId523     fn connect_window_threshold_notify<F: Fn(&Self) + Send + Sync + 'static>(
524         &self,
525         f: F,
526     ) -> SignalHandlerId {
527         unsafe extern "C" fn notify_window_threshold_trampoline<
528             P: IsA<Clock>,
529             F: Fn(&P) + Send + Sync + 'static,
530         >(
531             this: *mut ffi::GstClock,
532             _param_spec: glib::ffi::gpointer,
533             f: glib::ffi::gpointer,
534         ) {
535             let f: &F = &*(f as *const F);
536             f(Clock::from_glib_borrow(this).unsafe_cast_ref())
537         }
538         unsafe {
539             let f: Box_<F> = Box_::new(f);
540             connect_raw(
541                 self.as_ptr() as *mut _,
542                 b"notify::window-threshold\0".as_ptr() as *const _,
543                 Some(transmute::<_, unsafe extern "C" fn()>(
544                     notify_window_threshold_trampoline::<Self, F> as *const (),
545                 )),
546                 Box_::into_raw(f),
547             )
548         }
549     }
550 }
551