Skip to main content

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