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