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 // DO NOT EDIT
4 
5 #[cfg(any(feature = "v3_24", feature = "dox"))]
6 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))]
7 use crate::FontChooserLevel;
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 std::boxed::Box as Box_;
14 use std::fmt;
15 use std::mem::transmute;
16 
17 glib::wrapper! {
18     #[doc(alias = "GtkFontChooser")]
19     pub struct FontChooser(Interface<ffi::GtkFontChooser, ffi::GtkFontChooserIface>);
20 
21     match fn {
22         type_ => || ffi::gtk_font_chooser_get_type(),
23     }
24 }
25 
26 pub const NONE_FONT_CHOOSER: Option<&FontChooser> = None;
27 
28 pub trait FontChooserExt: 'static {
29     #[doc(alias = "gtk_font_chooser_get_font")]
30     #[doc(alias = "get_font")]
font(&self) -> Option<glib::GString>31     fn font(&self) -> Option<glib::GString>;
32 
33     #[doc(alias = "gtk_font_chooser_get_font_desc")]
34     #[doc(alias = "get_font_desc")]
font_desc(&self) -> Option<pango::FontDescription>35     fn font_desc(&self) -> Option<pango::FontDescription>;
36 
37     #[doc(alias = "gtk_font_chooser_get_font_face")]
38     #[doc(alias = "get_font_face")]
font_face(&self) -> Option<pango::FontFace>39     fn font_face(&self) -> Option<pango::FontFace>;
40 
41     #[doc(alias = "gtk_font_chooser_get_font_family")]
42     #[doc(alias = "get_font_family")]
font_family(&self) -> Option<pango::FontFamily>43     fn font_family(&self) -> Option<pango::FontFamily>;
44 
45     #[cfg(any(feature = "v3_24", feature = "dox"))]
46     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))]
47     #[doc(alias = "gtk_font_chooser_get_font_features")]
48     #[doc(alias = "get_font_features")]
font_features(&self) -> Option<glib::GString>49     fn font_features(&self) -> Option<glib::GString>;
50 
51     #[doc(alias = "gtk_font_chooser_get_font_map")]
52     #[doc(alias = "get_font_map")]
font_map(&self) -> Option<pango::FontMap>53     fn font_map(&self) -> Option<pango::FontMap>;
54 
55     #[doc(alias = "gtk_font_chooser_get_font_size")]
56     #[doc(alias = "get_font_size")]
font_size(&self) -> i3257     fn font_size(&self) -> i32;
58 
59     #[cfg(any(feature = "v3_24", feature = "dox"))]
60     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))]
61     #[doc(alias = "gtk_font_chooser_get_language")]
62     #[doc(alias = "get_language")]
language(&self) -> Option<glib::GString>63     fn language(&self) -> Option<glib::GString>;
64 
65     #[cfg(any(feature = "v3_24", feature = "dox"))]
66     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))]
67     #[doc(alias = "gtk_font_chooser_get_level")]
68     #[doc(alias = "get_level")]
level(&self) -> FontChooserLevel69     fn level(&self) -> FontChooserLevel;
70 
71     #[doc(alias = "gtk_font_chooser_get_preview_text")]
72     #[doc(alias = "get_preview_text")]
preview_text(&self) -> Option<glib::GString>73     fn preview_text(&self) -> Option<glib::GString>;
74 
75     #[doc(alias = "gtk_font_chooser_get_show_preview_entry")]
76     #[doc(alias = "get_show_preview_entry")]
shows_preview_entry(&self) -> bool77     fn shows_preview_entry(&self) -> bool;
78 
79     #[doc(alias = "gtk_font_chooser_set_filter_func")]
set_filter_func( &self, filter: Option<Box_<dyn Fn(&pango::FontFamily, &pango::FontFace) -> bool + 'static>>, )80     fn set_filter_func(
81         &self,
82         filter: Option<Box_<dyn Fn(&pango::FontFamily, &pango::FontFace) -> bool + 'static>>,
83     );
84 
85     #[doc(alias = "gtk_font_chooser_set_font")]
set_font(&self, fontname: &str)86     fn set_font(&self, fontname: &str);
87 
88     #[doc(alias = "gtk_font_chooser_set_font_desc")]
set_font_desc(&self, font_desc: &pango::FontDescription)89     fn set_font_desc(&self, font_desc: &pango::FontDescription);
90 
91     #[doc(alias = "gtk_font_chooser_set_font_map")]
set_font_map<P: IsA<pango::FontMap>>(&self, fontmap: Option<&P>)92     fn set_font_map<P: IsA<pango::FontMap>>(&self, fontmap: Option<&P>);
93 
94     #[cfg(any(feature = "v3_24", feature = "dox"))]
95     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))]
96     #[doc(alias = "gtk_font_chooser_set_language")]
set_language(&self, language: &str)97     fn set_language(&self, language: &str);
98 
99     #[cfg(any(feature = "v3_24", feature = "dox"))]
100     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))]
101     #[doc(alias = "gtk_font_chooser_set_level")]
set_level(&self, level: FontChooserLevel)102     fn set_level(&self, level: FontChooserLevel);
103 
104     #[doc(alias = "gtk_font_chooser_set_preview_text")]
set_preview_text(&self, text: &str)105     fn set_preview_text(&self, text: &str);
106 
107     #[doc(alias = "gtk_font_chooser_set_show_preview_entry")]
set_show_preview_entry(&self, show_preview_entry: bool)108     fn set_show_preview_entry(&self, show_preview_entry: bool);
109 
110     #[doc(alias = "font-activated")]
connect_font_activated<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId111     fn connect_font_activated<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId;
112 
113     #[doc(alias = "font")]
connect_font_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId114     fn connect_font_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
115 
116     #[doc(alias = "font-desc")]
connect_font_desc_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId117     fn connect_font_desc_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
118 
119     #[cfg(any(feature = "v3_24", feature = "dox"))]
120     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))]
121     #[doc(alias = "font-features")]
connect_font_features_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId122     fn connect_font_features_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
123 
124     #[cfg(any(feature = "v3_24", feature = "dox"))]
125     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))]
126     #[doc(alias = "language")]
connect_language_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId127     fn connect_language_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
128 
129     #[cfg(any(feature = "v3_24", feature = "dox"))]
130     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))]
131     #[doc(alias = "level")]
connect_level_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId132     fn connect_level_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
133 
134     #[doc(alias = "preview-text")]
connect_preview_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId135     fn connect_preview_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
136 
137     #[doc(alias = "show-preview-entry")]
connect_show_preview_entry_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId138     fn connect_show_preview_entry_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
139 }
140 
141 impl<O: IsA<FontChooser>> FontChooserExt for O {
font(&self) -> Option<glib::GString>142     fn font(&self) -> Option<glib::GString> {
143         unsafe {
144             from_glib_full(ffi::gtk_font_chooser_get_font(
145                 self.as_ref().to_glib_none().0,
146             ))
147         }
148     }
149 
font_desc(&self) -> Option<pango::FontDescription>150     fn font_desc(&self) -> Option<pango::FontDescription> {
151         unsafe {
152             from_glib_full(ffi::gtk_font_chooser_get_font_desc(
153                 self.as_ref().to_glib_none().0,
154             ))
155         }
156     }
157 
font_face(&self) -> Option<pango::FontFace>158     fn font_face(&self) -> Option<pango::FontFace> {
159         unsafe {
160             from_glib_none(ffi::gtk_font_chooser_get_font_face(
161                 self.as_ref().to_glib_none().0,
162             ))
163         }
164     }
165 
font_family(&self) -> Option<pango::FontFamily>166     fn font_family(&self) -> Option<pango::FontFamily> {
167         unsafe {
168             from_glib_none(ffi::gtk_font_chooser_get_font_family(
169                 self.as_ref().to_glib_none().0,
170             ))
171         }
172     }
173 
174     #[cfg(any(feature = "v3_24", feature = "dox"))]
175     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))]
font_features(&self) -> Option<glib::GString>176     fn font_features(&self) -> Option<glib::GString> {
177         unsafe {
178             from_glib_full(ffi::gtk_font_chooser_get_font_features(
179                 self.as_ref().to_glib_none().0,
180             ))
181         }
182     }
183 
font_map(&self) -> Option<pango::FontMap>184     fn font_map(&self) -> Option<pango::FontMap> {
185         unsafe {
186             from_glib_full(ffi::gtk_font_chooser_get_font_map(
187                 self.as_ref().to_glib_none().0,
188             ))
189         }
190     }
191 
font_size(&self) -> i32192     fn font_size(&self) -> i32 {
193         unsafe { ffi::gtk_font_chooser_get_font_size(self.as_ref().to_glib_none().0) }
194     }
195 
196     #[cfg(any(feature = "v3_24", feature = "dox"))]
197     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))]
language(&self) -> Option<glib::GString>198     fn language(&self) -> Option<glib::GString> {
199         unsafe {
200             from_glib_full(ffi::gtk_font_chooser_get_language(
201                 self.as_ref().to_glib_none().0,
202             ))
203         }
204     }
205 
206     #[cfg(any(feature = "v3_24", feature = "dox"))]
207     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))]
level(&self) -> FontChooserLevel208     fn level(&self) -> FontChooserLevel {
209         unsafe {
210             from_glib(ffi::gtk_font_chooser_get_level(
211                 self.as_ref().to_glib_none().0,
212             ))
213         }
214     }
215 
preview_text(&self) -> Option<glib::GString>216     fn preview_text(&self) -> Option<glib::GString> {
217         unsafe {
218             from_glib_full(ffi::gtk_font_chooser_get_preview_text(
219                 self.as_ref().to_glib_none().0,
220             ))
221         }
222     }
223 
shows_preview_entry(&self) -> bool224     fn shows_preview_entry(&self) -> bool {
225         unsafe {
226             from_glib(ffi::gtk_font_chooser_get_show_preview_entry(
227                 self.as_ref().to_glib_none().0,
228             ))
229         }
230     }
231 
set_filter_func( &self, filter: Option<Box_<dyn Fn(&pango::FontFamily, &pango::FontFace) -> bool + 'static>>, )232     fn set_filter_func(
233         &self,
234         filter: Option<Box_<dyn Fn(&pango::FontFamily, &pango::FontFace) -> bool + 'static>>,
235     ) {
236         let filter_data: Box_<
237             Option<Box_<dyn Fn(&pango::FontFamily, &pango::FontFace) -> bool + 'static>>,
238         > = Box_::new(filter);
239         unsafe extern "C" fn filter_func(
240             family: *const pango::ffi::PangoFontFamily,
241             face: *const pango::ffi::PangoFontFace,
242             data: glib::ffi::gpointer,
243         ) -> glib::ffi::gboolean {
244             let family = from_glib_borrow(family);
245             let face = from_glib_borrow(face);
246             let callback: &Option<
247                 Box_<dyn Fn(&pango::FontFamily, &pango::FontFace) -> bool + 'static>,
248             > = &*(data as *mut _);
249             let res = if let Some(ref callback) = *callback {
250                 callback(&family, &face)
251             } else {
252                 panic!("cannot get closure...")
253             };
254             res.into_glib()
255         }
256         let filter = if filter_data.is_some() {
257             Some(filter_func as _)
258         } else {
259             None
260         };
261         unsafe extern "C" fn destroy_func(data: glib::ffi::gpointer) {
262             let _callback: Box_<
263                 Option<Box_<dyn Fn(&pango::FontFamily, &pango::FontFace) -> bool + 'static>>,
264             > = Box_::from_raw(data as *mut _);
265         }
266         let destroy_call3 = Some(destroy_func as _);
267         let super_callback0: Box_<
268             Option<Box_<dyn Fn(&pango::FontFamily, &pango::FontFace) -> bool + 'static>>,
269         > = filter_data;
270         unsafe {
271             ffi::gtk_font_chooser_set_filter_func(
272                 self.as_ref().to_glib_none().0,
273                 filter,
274                 Box_::into_raw(super_callback0) as *mut _,
275                 destroy_call3,
276             );
277         }
278     }
279 
set_font(&self, fontname: &str)280     fn set_font(&self, fontname: &str) {
281         unsafe {
282             ffi::gtk_font_chooser_set_font(
283                 self.as_ref().to_glib_none().0,
284                 fontname.to_glib_none().0,
285             );
286         }
287     }
288 
set_font_desc(&self, font_desc: &pango::FontDescription)289     fn set_font_desc(&self, font_desc: &pango::FontDescription) {
290         unsafe {
291             ffi::gtk_font_chooser_set_font_desc(
292                 self.as_ref().to_glib_none().0,
293                 font_desc.to_glib_none().0,
294             );
295         }
296     }
297 
set_font_map<P: IsA<pango::FontMap>>(&self, fontmap: Option<&P>)298     fn set_font_map<P: IsA<pango::FontMap>>(&self, fontmap: Option<&P>) {
299         unsafe {
300             ffi::gtk_font_chooser_set_font_map(
301                 self.as_ref().to_glib_none().0,
302                 fontmap.map(|p| p.as_ref()).to_glib_none().0,
303             );
304         }
305     }
306 
307     #[cfg(any(feature = "v3_24", feature = "dox"))]
308     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))]
set_language(&self, language: &str)309     fn set_language(&self, language: &str) {
310         unsafe {
311             ffi::gtk_font_chooser_set_language(
312                 self.as_ref().to_glib_none().0,
313                 language.to_glib_none().0,
314             );
315         }
316     }
317 
318     #[cfg(any(feature = "v3_24", feature = "dox"))]
319     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))]
set_level(&self, level: FontChooserLevel)320     fn set_level(&self, level: FontChooserLevel) {
321         unsafe {
322             ffi::gtk_font_chooser_set_level(self.as_ref().to_glib_none().0, level.into_glib());
323         }
324     }
325 
set_preview_text(&self, text: &str)326     fn set_preview_text(&self, text: &str) {
327         unsafe {
328             ffi::gtk_font_chooser_set_preview_text(
329                 self.as_ref().to_glib_none().0,
330                 text.to_glib_none().0,
331             );
332         }
333     }
334 
set_show_preview_entry(&self, show_preview_entry: bool)335     fn set_show_preview_entry(&self, show_preview_entry: bool) {
336         unsafe {
337             ffi::gtk_font_chooser_set_show_preview_entry(
338                 self.as_ref().to_glib_none().0,
339                 show_preview_entry.into_glib(),
340             );
341         }
342     }
343 
connect_font_activated<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId344     fn connect_font_activated<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId {
345         unsafe extern "C" fn font_activated_trampoline<
346             P: IsA<FontChooser>,
347             F: Fn(&P, &str) + 'static,
348         >(
349             this: *mut ffi::GtkFontChooser,
350             fontname: *mut libc::c_char,
351             f: glib::ffi::gpointer,
352         ) {
353             let f: &F = &*(f as *const F);
354             f(
355                 FontChooser::from_glib_borrow(this).unsafe_cast_ref(),
356                 &glib::GString::from_glib_borrow(fontname),
357             )
358         }
359         unsafe {
360             let f: Box_<F> = Box_::new(f);
361             connect_raw(
362                 self.as_ptr() as *mut _,
363                 b"font-activated\0".as_ptr() as *const _,
364                 Some(transmute::<_, unsafe extern "C" fn()>(
365                     font_activated_trampoline::<Self, F> as *const (),
366                 )),
367                 Box_::into_raw(f),
368             )
369         }
370     }
371 
connect_font_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId372     fn connect_font_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
373         unsafe extern "C" fn notify_font_trampoline<P: IsA<FontChooser>, F: Fn(&P) + 'static>(
374             this: *mut ffi::GtkFontChooser,
375             _param_spec: glib::ffi::gpointer,
376             f: glib::ffi::gpointer,
377         ) {
378             let f: &F = &*(f as *const F);
379             f(FontChooser::from_glib_borrow(this).unsafe_cast_ref())
380         }
381         unsafe {
382             let f: Box_<F> = Box_::new(f);
383             connect_raw(
384                 self.as_ptr() as *mut _,
385                 b"notify::font\0".as_ptr() as *const _,
386                 Some(transmute::<_, unsafe extern "C" fn()>(
387                     notify_font_trampoline::<Self, F> as *const (),
388                 )),
389                 Box_::into_raw(f),
390             )
391         }
392     }
393 
connect_font_desc_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId394     fn connect_font_desc_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
395         unsafe extern "C" fn notify_font_desc_trampoline<
396             P: IsA<FontChooser>,
397             F: Fn(&P) + 'static,
398         >(
399             this: *mut ffi::GtkFontChooser,
400             _param_spec: glib::ffi::gpointer,
401             f: glib::ffi::gpointer,
402         ) {
403             let f: &F = &*(f as *const F);
404             f(FontChooser::from_glib_borrow(this).unsafe_cast_ref())
405         }
406         unsafe {
407             let f: Box_<F> = Box_::new(f);
408             connect_raw(
409                 self.as_ptr() as *mut _,
410                 b"notify::font-desc\0".as_ptr() as *const _,
411                 Some(transmute::<_, unsafe extern "C" fn()>(
412                     notify_font_desc_trampoline::<Self, F> as *const (),
413                 )),
414                 Box_::into_raw(f),
415             )
416         }
417     }
418 
419     #[cfg(any(feature = "v3_24", feature = "dox"))]
420     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))]
connect_font_features_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId421     fn connect_font_features_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
422         unsafe extern "C" fn notify_font_features_trampoline<
423             P: IsA<FontChooser>,
424             F: Fn(&P) + 'static,
425         >(
426             this: *mut ffi::GtkFontChooser,
427             _param_spec: glib::ffi::gpointer,
428             f: glib::ffi::gpointer,
429         ) {
430             let f: &F = &*(f as *const F);
431             f(FontChooser::from_glib_borrow(this).unsafe_cast_ref())
432         }
433         unsafe {
434             let f: Box_<F> = Box_::new(f);
435             connect_raw(
436                 self.as_ptr() as *mut _,
437                 b"notify::font-features\0".as_ptr() as *const _,
438                 Some(transmute::<_, unsafe extern "C" fn()>(
439                     notify_font_features_trampoline::<Self, F> as *const (),
440                 )),
441                 Box_::into_raw(f),
442             )
443         }
444     }
445 
446     #[cfg(any(feature = "v3_24", feature = "dox"))]
447     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))]
connect_language_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId448     fn connect_language_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
449         unsafe extern "C" fn notify_language_trampoline<
450             P: IsA<FontChooser>,
451             F: Fn(&P) + 'static,
452         >(
453             this: *mut ffi::GtkFontChooser,
454             _param_spec: glib::ffi::gpointer,
455             f: glib::ffi::gpointer,
456         ) {
457             let f: &F = &*(f as *const F);
458             f(FontChooser::from_glib_borrow(this).unsafe_cast_ref())
459         }
460         unsafe {
461             let f: Box_<F> = Box_::new(f);
462             connect_raw(
463                 self.as_ptr() as *mut _,
464                 b"notify::language\0".as_ptr() as *const _,
465                 Some(transmute::<_, unsafe extern "C" fn()>(
466                     notify_language_trampoline::<Self, F> as *const (),
467                 )),
468                 Box_::into_raw(f),
469             )
470         }
471     }
472 
473     #[cfg(any(feature = "v3_24", feature = "dox"))]
474     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))]
connect_level_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId475     fn connect_level_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
476         unsafe extern "C" fn notify_level_trampoline<P: IsA<FontChooser>, F: Fn(&P) + 'static>(
477             this: *mut ffi::GtkFontChooser,
478             _param_spec: glib::ffi::gpointer,
479             f: glib::ffi::gpointer,
480         ) {
481             let f: &F = &*(f as *const F);
482             f(FontChooser::from_glib_borrow(this).unsafe_cast_ref())
483         }
484         unsafe {
485             let f: Box_<F> = Box_::new(f);
486             connect_raw(
487                 self.as_ptr() as *mut _,
488                 b"notify::level\0".as_ptr() as *const _,
489                 Some(transmute::<_, unsafe extern "C" fn()>(
490                     notify_level_trampoline::<Self, F> as *const (),
491                 )),
492                 Box_::into_raw(f),
493             )
494         }
495     }
496 
connect_preview_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId497     fn connect_preview_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
498         unsafe extern "C" fn notify_preview_text_trampoline<
499             P: IsA<FontChooser>,
500             F: Fn(&P) + 'static,
501         >(
502             this: *mut ffi::GtkFontChooser,
503             _param_spec: glib::ffi::gpointer,
504             f: glib::ffi::gpointer,
505         ) {
506             let f: &F = &*(f as *const F);
507             f(FontChooser::from_glib_borrow(this).unsafe_cast_ref())
508         }
509         unsafe {
510             let f: Box_<F> = Box_::new(f);
511             connect_raw(
512                 self.as_ptr() as *mut _,
513                 b"notify::preview-text\0".as_ptr() as *const _,
514                 Some(transmute::<_, unsafe extern "C" fn()>(
515                     notify_preview_text_trampoline::<Self, F> as *const (),
516                 )),
517                 Box_::into_raw(f),
518             )
519         }
520     }
521 
connect_show_preview_entry_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId522     fn connect_show_preview_entry_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
523         unsafe extern "C" fn notify_show_preview_entry_trampoline<
524             P: IsA<FontChooser>,
525             F: Fn(&P) + 'static,
526         >(
527             this: *mut ffi::GtkFontChooser,
528             _param_spec: glib::ffi::gpointer,
529             f: glib::ffi::gpointer,
530         ) {
531             let f: &F = &*(f as *const F);
532             f(FontChooser::from_glib_borrow(this).unsafe_cast_ref())
533         }
534         unsafe {
535             let f: Box_<F> = Box_::new(f);
536             connect_raw(
537                 self.as_ptr() as *mut _,
538                 b"notify::show-preview-entry\0".as_ptr() as *const _,
539                 Some(transmute::<_, unsafe extern "C" fn()>(
540                     notify_show_preview_entry_trampoline::<Self, F> as *const (),
541                 )),
542                 Box_::into_raw(f),
543             )
544         }
545     }
546 }
547 
548 impl fmt::Display for FontChooser {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result549     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
550         f.write_str("FontChooser")
551     }
552 }
553