Skip to main content

gtk/auto/
font_chooser.rs

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(feature = "v3_24")]
6#[cfg_attr(docsrs, doc(cfg(feature = "v3_24")))]
7use crate::FontChooserLevel;
8use glib::{
9    prelude::*,
10    signal::{connect_raw, SignalHandlerId},
11    translate::*,
12};
13use std::{boxed::Box as Box_, fmt, mem::transmute};
14
15glib::wrapper! {
16    /// [`FontChooser`][crate::FontChooser] is an interface that can be implemented by widgets
17    /// displaying the list of fonts. In GTK+, the main objects
18    /// that implement this interface are [`FontChooserWidget`][crate::FontChooserWidget],
19    /// [`FontChooserDialog`][crate::FontChooserDialog] and [`FontButton`][crate::FontButton]. The GtkFontChooser interface
20    /// has been introducted in GTK+ 3.2.
21    ///
22    /// ## Properties
23    ///
24    ///
25    /// #### `font`
26    ///  The font description as a string, e.g. "Sans Italic 12".
27    ///
28    /// Readable | Writeable
29    ///
30    ///
31    /// #### `font-desc`
32    ///  The font description as a [`pango::FontDescription`][crate::pango::FontDescription].
33    ///
34    /// Readable | Writeable
35    ///
36    ///
37    /// #### `font-features`
38    ///  The selected font features, in a format that is compatible with
39    /// CSS and with Pango attributes.
40    ///
41    /// Readable
42    ///
43    ///
44    /// #### `language`
45    ///  The language for which the [`font-features`][struct@crate::FontChooser#font-features] were
46    /// selected, in a format that is compatible with CSS and with Pango
47    /// attributes.
48    ///
49    /// Readable | Writeable
50    ///
51    ///
52    /// #### `level`
53    ///  The level of granularity to offer for selecting fonts.
54    ///
55    /// Readable | Writeable
56    ///
57    ///
58    /// #### `preview-text`
59    ///  The string with which to preview the font.
60    ///
61    /// Readable | Writeable
62    ///
63    ///
64    /// #### `show-preview-entry`
65    ///  Whether to show an entry to change the preview text.
66    ///
67    /// Readable | Writeable
68    ///
69    /// ## Signals
70    ///
71    ///
72    /// #### `font-activated`
73    ///  Emitted when a font is activated.
74    /// This usually happens when the user double clicks an item,
75    /// or an item is selected and the user presses one of the keys
76    /// Space, Shift+Space, Return or Enter.
77    ///
78    ///
79    ///
80    /// # Implements
81    ///
82    /// [`FontChooserExt`][trait@crate::prelude::FontChooserExt]
83    #[doc(alias = "GtkFontChooser")]
84    pub struct FontChooser(Interface<ffi::GtkFontChooser, ffi::GtkFontChooserIface>);
85
86    match fn {
87        type_ => || ffi::gtk_font_chooser_get_type(),
88    }
89}
90
91impl FontChooser {
92    pub const NONE: Option<&'static FontChooser> = None;
93}
94
95mod sealed {
96    pub trait Sealed {}
97    impl<T: super::IsA<super::FontChooser>> Sealed for T {}
98}
99
100/// Trait containing all [`struct@FontChooser`] methods.
101///
102/// # Implementors
103///
104/// [`FontButton`][struct@crate::FontButton], [`FontChooserDialog`][struct@crate::FontChooserDialog], [`FontChooserWidget`][struct@crate::FontChooserWidget], [`FontChooser`][struct@crate::FontChooser]
105pub trait FontChooserExt: IsA<FontChooser> + sealed::Sealed + 'static {
106    /// Gets the currently-selected font name.
107    ///
108    /// Note that this can be a different string than what you set with
109    /// [`set_font()`][Self::set_font()], as the font chooser widget may
110    /// normalize font names and thus return a string with a different
111    /// structure. For example, “Helvetica Italic Bold 12” could be
112    /// normalized to “Helvetica Bold Italic 12”.
113    ///
114    /// Use `pango_font_description_equal()` if you want to compare two
115    /// font descriptions.
116    ///
117    /// # Returns
118    ///
119    /// A string with the name
120    ///  of the current font, or [`None`] if no font is selected. You must
121    ///  free this string with `g_free()`.
122    #[doc(alias = "gtk_font_chooser_get_font")]
123    #[doc(alias = "get_font")]
124    fn font(&self) -> Option<glib::GString> {
125        unsafe {
126            from_glib_full(ffi::gtk_font_chooser_get_font(
127                self.as_ref().to_glib_none().0,
128            ))
129        }
130    }
131
132    /// Gets the currently-selected font.
133    ///
134    /// Note that this can be a different string than what you set with
135    /// [`set_font()`][Self::set_font()], as the font chooser widget may
136    /// normalize font names and thus return a string with a different
137    /// structure. For example, “Helvetica Italic Bold 12” could be
138    /// normalized to “Helvetica Bold Italic 12”.
139    ///
140    /// Use `pango_font_description_equal()` if you want to compare two
141    /// font descriptions.
142    ///
143    /// # Returns
144    ///
145    /// A [`pango::FontDescription`][crate::pango::FontDescription] for the
146    ///  current font, or [`None`] if no font is selected.
147    #[doc(alias = "gtk_font_chooser_get_font_desc")]
148    #[doc(alias = "get_font_desc")]
149    fn font_desc(&self) -> Option<pango::FontDescription> {
150        unsafe {
151            from_glib_full(ffi::gtk_font_chooser_get_font_desc(
152                self.as_ref().to_glib_none().0,
153            ))
154        }
155    }
156
157    /// Gets the [`pango::FontFace`][crate::pango::FontFace] representing the selected font group
158    /// details (i.e. family, slant, weight, width, etc).
159    ///
160    /// If the selected font is not installed, returns [`None`].
161    ///
162    /// # Returns
163    ///
164    /// A [`pango::FontFace`][crate::pango::FontFace] representing the
165    ///  selected font group details, or [`None`]. The returned object is owned by
166    ///  `self` and must not be modified or freed.
167    #[doc(alias = "gtk_font_chooser_get_font_face")]
168    #[doc(alias = "get_font_face")]
169    fn font_face(&self) -> Option<pango::FontFace> {
170        unsafe {
171            from_glib_none(ffi::gtk_font_chooser_get_font_face(
172                self.as_ref().to_glib_none().0,
173            ))
174        }
175    }
176
177    /// Gets the [`pango::FontFamily`][crate::pango::FontFamily] representing the selected font family.
178    /// Font families are a collection of font faces.
179    ///
180    /// If the selected font is not installed, returns [`None`].
181    ///
182    /// # Returns
183    ///
184    /// A [`pango::FontFamily`][crate::pango::FontFamily] representing the
185    ///  selected font family, or [`None`]. The returned object is owned by `self`
186    ///  and must not be modified or freed.
187    #[doc(alias = "gtk_font_chooser_get_font_family")]
188    #[doc(alias = "get_font_family")]
189    fn font_family(&self) -> Option<pango::FontFamily> {
190        unsafe {
191            from_glib_none(ffi::gtk_font_chooser_get_font_family(
192                self.as_ref().to_glib_none().0,
193            ))
194        }
195    }
196
197    /// Gets the currently-selected font features.
198    ///
199    /// # Returns
200    ///
201    /// the currently selected font features
202    #[cfg(feature = "v3_24")]
203    #[cfg_attr(docsrs, doc(cfg(feature = "v3_24")))]
204    #[doc(alias = "gtk_font_chooser_get_font_features")]
205    #[doc(alias = "get_font_features")]
206    fn font_features(&self) -> Option<glib::GString> {
207        unsafe {
208            from_glib_full(ffi::gtk_font_chooser_get_font_features(
209                self.as_ref().to_glib_none().0,
210            ))
211        }
212    }
213
214    /// Gets the custom font map of this font chooser widget,
215    /// or [`None`] if it does not have one.
216    ///
217    /// # Returns
218    ///
219    /// a [`pango::FontMap`][crate::pango::FontMap], or [`None`]
220    #[doc(alias = "gtk_font_chooser_get_font_map")]
221    #[doc(alias = "get_font_map")]
222    fn font_map(&self) -> Option<pango::FontMap> {
223        unsafe {
224            from_glib_full(ffi::gtk_font_chooser_get_font_map(
225                self.as_ref().to_glib_none().0,
226            ))
227        }
228    }
229
230    /// The selected font size.
231    ///
232    /// # Returns
233    ///
234    /// A n integer representing the selected font size,
235    ///  or -1 if no font size is selected.
236    #[doc(alias = "gtk_font_chooser_get_font_size")]
237    #[doc(alias = "get_font_size")]
238    fn font_size(&self) -> i32 {
239        unsafe { ffi::gtk_font_chooser_get_font_size(self.as_ref().to_glib_none().0) }
240    }
241
242    /// Gets the language that is used for font features.
243    ///
244    /// # Returns
245    ///
246    /// the currently selected language
247    #[cfg(feature = "v3_24")]
248    #[cfg_attr(docsrs, doc(cfg(feature = "v3_24")))]
249    #[doc(alias = "gtk_font_chooser_get_language")]
250    #[doc(alias = "get_language")]
251    fn language(&self) -> Option<glib::GString> {
252        unsafe {
253            from_glib_full(ffi::gtk_font_chooser_get_language(
254                self.as_ref().to_glib_none().0,
255            ))
256        }
257    }
258
259    /// Returns the current level of granularity for selecting fonts.
260    ///
261    /// # Returns
262    ///
263    /// the current granularity level
264    #[cfg(feature = "v3_24")]
265    #[cfg_attr(docsrs, doc(cfg(feature = "v3_24")))]
266    #[doc(alias = "gtk_font_chooser_get_level")]
267    #[doc(alias = "get_level")]
268    fn level(&self) -> FontChooserLevel {
269        unsafe {
270            from_glib(ffi::gtk_font_chooser_get_level(
271                self.as_ref().to_glib_none().0,
272            ))
273        }
274    }
275
276    /// Gets the text displayed in the preview area.
277    ///
278    /// # Returns
279    ///
280    /// the text displayed in the
281    ///  preview area
282    #[doc(alias = "gtk_font_chooser_get_preview_text")]
283    #[doc(alias = "get_preview_text")]
284    fn preview_text(&self) -> Option<glib::GString> {
285        unsafe {
286            from_glib_full(ffi::gtk_font_chooser_get_preview_text(
287                self.as_ref().to_glib_none().0,
288            ))
289        }
290    }
291
292    /// Returns whether the preview entry is shown or not.
293    ///
294    /// # Returns
295    ///
296    /// [`true`] if the preview entry is shown
297    ///  or [`false`] if it is hidden.
298    #[doc(alias = "gtk_font_chooser_get_show_preview_entry")]
299    #[doc(alias = "get_show_preview_entry")]
300    fn shows_preview_entry(&self) -> bool {
301        unsafe {
302            from_glib(ffi::gtk_font_chooser_get_show_preview_entry(
303                self.as_ref().to_glib_none().0,
304            ))
305        }
306    }
307
308    /// Adds a filter function that decides which fonts to display
309    /// in the font chooser.
310    /// ## `filter`
311    /// a `GtkFontFilterFunc`, or [`None`]
312    #[doc(alias = "gtk_font_chooser_set_filter_func")]
313    fn set_filter_func(
314        &self,
315        filter: Option<Box_<dyn Fn(&pango::FontFamily, &pango::FontFace) -> bool + 'static>>,
316    ) {
317        let filter_data: Box_<
318            Option<Box_<dyn Fn(&pango::FontFamily, &pango::FontFace) -> bool + 'static>>,
319        > = Box_::new(filter);
320        unsafe extern "C" fn filter_func(
321            family: *const pango::ffi::PangoFontFamily,
322            face: *const pango::ffi::PangoFontFace,
323            data: glib::ffi::gpointer,
324        ) -> glib::ffi::gboolean {
325            let family = from_glib_borrow(family);
326            let face = from_glib_borrow(face);
327            let callback: &Option<
328                Box_<dyn Fn(&pango::FontFamily, &pango::FontFace) -> bool + 'static>,
329            > = &*(data as *mut _);
330            if let Some(ref callback) = *callback {
331                callback(&family, &face)
332            } else {
333                panic!("cannot get closure...")
334            }
335            .into_glib()
336        }
337        let filter = if filter_data.is_some() {
338            Some(filter_func as _)
339        } else {
340            None
341        };
342        unsafe extern "C" fn destroy_func(data: glib::ffi::gpointer) {
343            let _callback: Box_<
344                Option<Box_<dyn Fn(&pango::FontFamily, &pango::FontFace) -> bool + 'static>>,
345            > = Box_::from_raw(data as *mut _);
346        }
347        let destroy_call3 = Some(destroy_func as _);
348        let super_callback0: Box_<
349            Option<Box_<dyn Fn(&pango::FontFamily, &pango::FontFace) -> bool + 'static>>,
350        > = filter_data;
351        unsafe {
352            ffi::gtk_font_chooser_set_filter_func(
353                self.as_ref().to_glib_none().0,
354                filter,
355                Box_::into_raw(super_callback0) as *mut _,
356                destroy_call3,
357            );
358        }
359    }
360
361    /// Sets the currently-selected font.
362    /// ## `fontname`
363    /// a font name like “Helvetica 12” or “Times Bold 18”
364    #[doc(alias = "gtk_font_chooser_set_font")]
365    fn set_font(&self, fontname: &str) {
366        unsafe {
367            ffi::gtk_font_chooser_set_font(
368                self.as_ref().to_glib_none().0,
369                fontname.to_glib_none().0,
370            );
371        }
372    }
373
374    /// Sets the currently-selected font from `font_desc`.
375    /// ## `font_desc`
376    /// a [`pango::FontDescription`][crate::pango::FontDescription]
377    #[doc(alias = "gtk_font_chooser_set_font_desc")]
378    fn set_font_desc(&self, font_desc: &pango::FontDescription) {
379        unsafe {
380            ffi::gtk_font_chooser_set_font_desc(
381                self.as_ref().to_glib_none().0,
382                font_desc.to_glib_none().0,
383            );
384        }
385    }
386
387    /// Sets a custom font map to use for this font chooser widget.
388    /// A custom font map can be used to present application-specific
389    /// fonts instead of or in addition to the normal system fonts.
390    ///
391    ///
392    ///
393    /// **⚠️ The following code is in C ⚠️**
394    ///
395    /// ```C
396    /// FcConfig *config;
397    /// PangoFontMap *fontmap;
398    ///
399    /// config = FcInitLoadConfigAndFonts ();
400    /// FcConfigAppFontAddFile (config, my_app_font_file);
401    ///
402    /// fontmap = pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT);
403    /// pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (fontmap), config);
404    ///
405    /// gtk_font_chooser_set_font_map (font_chooser, fontmap);
406    /// ```
407    ///
408    /// Note that other GTK+ widgets will only be able to use the application-specific
409    /// font if it is present in the font map they use:
410    ///
411    ///
412    /// ```text
413    /// context = gtk_widget_get_pango_context (label);
414    /// pango_context_set_font_map (context, fontmap);
415    /// ```
416    /// ## `fontmap`
417    /// a [`pango::FontMap`][crate::pango::FontMap]
418    #[doc(alias = "gtk_font_chooser_set_font_map")]
419    fn set_font_map(&self, fontmap: Option<&impl IsA<pango::FontMap>>) {
420        unsafe {
421            ffi::gtk_font_chooser_set_font_map(
422                self.as_ref().to_glib_none().0,
423                fontmap.map(|p| p.as_ref()).to_glib_none().0,
424            );
425        }
426    }
427
428    /// Sets the language to use for font features.
429    /// ## `language`
430    /// a language
431    #[cfg(feature = "v3_24")]
432    #[cfg_attr(docsrs, doc(cfg(feature = "v3_24")))]
433    #[doc(alias = "gtk_font_chooser_set_language")]
434    fn set_language(&self, language: &str) {
435        unsafe {
436            ffi::gtk_font_chooser_set_language(
437                self.as_ref().to_glib_none().0,
438                language.to_glib_none().0,
439            );
440        }
441    }
442
443    /// Sets the desired level of granularity for selecting fonts.
444    /// ## `level`
445    /// the desired level of granularity
446    #[cfg(feature = "v3_24")]
447    #[cfg_attr(docsrs, doc(cfg(feature = "v3_24")))]
448    #[doc(alias = "gtk_font_chooser_set_level")]
449    fn set_level(&self, level: FontChooserLevel) {
450        unsafe {
451            ffi::gtk_font_chooser_set_level(self.as_ref().to_glib_none().0, level.into_glib());
452        }
453    }
454
455    /// Sets the text displayed in the preview area.
456    /// The `text` is used to show how the selected font looks.
457    /// ## `text`
458    /// the text to display in the preview area
459    #[doc(alias = "gtk_font_chooser_set_preview_text")]
460    fn set_preview_text(&self, text: &str) {
461        unsafe {
462            ffi::gtk_font_chooser_set_preview_text(
463                self.as_ref().to_glib_none().0,
464                text.to_glib_none().0,
465            );
466        }
467    }
468
469    /// Shows or hides the editable preview entry.
470    /// ## `show_preview_entry`
471    /// whether to show the editable preview entry or not
472    #[doc(alias = "gtk_font_chooser_set_show_preview_entry")]
473    fn set_show_preview_entry(&self, show_preview_entry: bool) {
474        unsafe {
475            ffi::gtk_font_chooser_set_show_preview_entry(
476                self.as_ref().to_glib_none().0,
477                show_preview_entry.into_glib(),
478            );
479        }
480    }
481
482    /// Emitted when a font is activated.
483    /// This usually happens when the user double clicks an item,
484    /// or an item is selected and the user presses one of the keys
485    /// Space, Shift+Space, Return or Enter.
486    /// ## `fontname`
487    /// the font name
488    #[doc(alias = "font-activated")]
489    fn connect_font_activated<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId {
490        unsafe extern "C" fn font_activated_trampoline<
491            P: IsA<FontChooser>,
492            F: Fn(&P, &str) + 'static,
493        >(
494            this: *mut ffi::GtkFontChooser,
495            fontname: *mut libc::c_char,
496            f: glib::ffi::gpointer,
497        ) {
498            let f: &F = &*(f as *const F);
499            f(
500                FontChooser::from_glib_borrow(this).unsafe_cast_ref(),
501                &glib::GString::from_glib_borrow(fontname),
502            )
503        }
504        unsafe {
505            let f: Box_<F> = Box_::new(f);
506            connect_raw(
507                self.as_ptr() as *mut _,
508                b"font-activated\0".as_ptr() as *const _,
509                Some(transmute::<_, unsafe extern "C" fn()>(
510                    font_activated_trampoline::<Self, F> as *const (),
511                )),
512                Box_::into_raw(f),
513            )
514        }
515    }
516
517    #[doc(alias = "font")]
518    fn connect_font_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
519        unsafe extern "C" fn notify_font_trampoline<P: IsA<FontChooser>, F: Fn(&P) + 'static>(
520            this: *mut ffi::GtkFontChooser,
521            _param_spec: glib::ffi::gpointer,
522            f: glib::ffi::gpointer,
523        ) {
524            let f: &F = &*(f as *const F);
525            f(FontChooser::from_glib_borrow(this).unsafe_cast_ref())
526        }
527        unsafe {
528            let f: Box_<F> = Box_::new(f);
529            connect_raw(
530                self.as_ptr() as *mut _,
531                b"notify::font\0".as_ptr() as *const _,
532                Some(transmute::<_, unsafe extern "C" fn()>(
533                    notify_font_trampoline::<Self, F> as *const (),
534                )),
535                Box_::into_raw(f),
536            )
537        }
538    }
539
540    #[doc(alias = "font-desc")]
541    fn connect_font_desc_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
542        unsafe extern "C" fn notify_font_desc_trampoline<
543            P: IsA<FontChooser>,
544            F: Fn(&P) + 'static,
545        >(
546            this: *mut ffi::GtkFontChooser,
547            _param_spec: glib::ffi::gpointer,
548            f: glib::ffi::gpointer,
549        ) {
550            let f: &F = &*(f as *const F);
551            f(FontChooser::from_glib_borrow(this).unsafe_cast_ref())
552        }
553        unsafe {
554            let f: Box_<F> = Box_::new(f);
555            connect_raw(
556                self.as_ptr() as *mut _,
557                b"notify::font-desc\0".as_ptr() as *const _,
558                Some(transmute::<_, unsafe extern "C" fn()>(
559                    notify_font_desc_trampoline::<Self, F> as *const (),
560                )),
561                Box_::into_raw(f),
562            )
563        }
564    }
565
566    #[cfg(feature = "v3_24")]
567    #[cfg_attr(docsrs, doc(cfg(feature = "v3_24")))]
568    #[doc(alias = "font-features")]
569    fn connect_font_features_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
570        unsafe extern "C" fn notify_font_features_trampoline<
571            P: IsA<FontChooser>,
572            F: Fn(&P) + 'static,
573        >(
574            this: *mut ffi::GtkFontChooser,
575            _param_spec: glib::ffi::gpointer,
576            f: glib::ffi::gpointer,
577        ) {
578            let f: &F = &*(f as *const F);
579            f(FontChooser::from_glib_borrow(this).unsafe_cast_ref())
580        }
581        unsafe {
582            let f: Box_<F> = Box_::new(f);
583            connect_raw(
584                self.as_ptr() as *mut _,
585                b"notify::font-features\0".as_ptr() as *const _,
586                Some(transmute::<_, unsafe extern "C" fn()>(
587                    notify_font_features_trampoline::<Self, F> as *const (),
588                )),
589                Box_::into_raw(f),
590            )
591        }
592    }
593
594    #[cfg(feature = "v3_24")]
595    #[cfg_attr(docsrs, doc(cfg(feature = "v3_24")))]
596    #[doc(alias = "language")]
597    fn connect_language_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
598        unsafe extern "C" fn notify_language_trampoline<
599            P: IsA<FontChooser>,
600            F: Fn(&P) + 'static,
601        >(
602            this: *mut ffi::GtkFontChooser,
603            _param_spec: glib::ffi::gpointer,
604            f: glib::ffi::gpointer,
605        ) {
606            let f: &F = &*(f as *const F);
607            f(FontChooser::from_glib_borrow(this).unsafe_cast_ref())
608        }
609        unsafe {
610            let f: Box_<F> = Box_::new(f);
611            connect_raw(
612                self.as_ptr() as *mut _,
613                b"notify::language\0".as_ptr() as *const _,
614                Some(transmute::<_, unsafe extern "C" fn()>(
615                    notify_language_trampoline::<Self, F> as *const (),
616                )),
617                Box_::into_raw(f),
618            )
619        }
620    }
621
622    #[cfg(feature = "v3_24")]
623    #[cfg_attr(docsrs, doc(cfg(feature = "v3_24")))]
624    #[doc(alias = "level")]
625    fn connect_level_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
626        unsafe extern "C" fn notify_level_trampoline<P: IsA<FontChooser>, F: Fn(&P) + 'static>(
627            this: *mut ffi::GtkFontChooser,
628            _param_spec: glib::ffi::gpointer,
629            f: glib::ffi::gpointer,
630        ) {
631            let f: &F = &*(f as *const F);
632            f(FontChooser::from_glib_borrow(this).unsafe_cast_ref())
633        }
634        unsafe {
635            let f: Box_<F> = Box_::new(f);
636            connect_raw(
637                self.as_ptr() as *mut _,
638                b"notify::level\0".as_ptr() as *const _,
639                Some(transmute::<_, unsafe extern "C" fn()>(
640                    notify_level_trampoline::<Self, F> as *const (),
641                )),
642                Box_::into_raw(f),
643            )
644        }
645    }
646
647    #[doc(alias = "preview-text")]
648    fn connect_preview_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
649        unsafe extern "C" fn notify_preview_text_trampoline<
650            P: IsA<FontChooser>,
651            F: Fn(&P) + 'static,
652        >(
653            this: *mut ffi::GtkFontChooser,
654            _param_spec: glib::ffi::gpointer,
655            f: glib::ffi::gpointer,
656        ) {
657            let f: &F = &*(f as *const F);
658            f(FontChooser::from_glib_borrow(this).unsafe_cast_ref())
659        }
660        unsafe {
661            let f: Box_<F> = Box_::new(f);
662            connect_raw(
663                self.as_ptr() as *mut _,
664                b"notify::preview-text\0".as_ptr() as *const _,
665                Some(transmute::<_, unsafe extern "C" fn()>(
666                    notify_preview_text_trampoline::<Self, F> as *const (),
667                )),
668                Box_::into_raw(f),
669            )
670        }
671    }
672
673    #[doc(alias = "show-preview-entry")]
674    fn connect_show_preview_entry_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
675        unsafe extern "C" fn notify_show_preview_entry_trampoline<
676            P: IsA<FontChooser>,
677            F: Fn(&P) + 'static,
678        >(
679            this: *mut ffi::GtkFontChooser,
680            _param_spec: glib::ffi::gpointer,
681            f: glib::ffi::gpointer,
682        ) {
683            let f: &F = &*(f as *const F);
684            f(FontChooser::from_glib_borrow(this).unsafe_cast_ref())
685        }
686        unsafe {
687            let f: Box_<F> = Box_::new(f);
688            connect_raw(
689                self.as_ptr() as *mut _,
690                b"notify::show-preview-entry\0".as_ptr() as *const _,
691                Some(transmute::<_, unsafe extern "C" fn()>(
692                    notify_show_preview_entry_trampoline::<Self, F> as *const (),
693                )),
694                Box_::into_raw(f),
695            )
696        }
697    }
698}
699
700impl<O: IsA<FontChooser>> FontChooserExt for O {}
701
702impl fmt::Display for FontChooser {
703    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
704        f.write_str("FontChooser")
705    }
706}