Skip to main content

gtk/auto/
recent_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
5use crate::{RecentFilter, RecentInfo, RecentSortType, ffi};
6use glib::{
7    object::ObjectType as _,
8    prelude::*,
9    signal::{SignalHandlerId, connect_raw},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    /// [`RecentChooser`][crate::RecentChooser] is an interface that can be implemented by widgets
16    /// displaying the list of recently used files. In GTK+, the main objects
17    /// that implement this interface are [`RecentChooserWidget`][crate::RecentChooserWidget],
18    /// [`RecentChooserDialog`][crate::RecentChooserDialog] and [`RecentChooserMenu`][crate::RecentChooserMenu].
19    ///
20    /// Recently used files are supported since GTK+ 2.10.
21    ///
22    /// ## Properties
23    ///
24    ///
25    /// #### `filter`
26    ///  The [`RecentFilter`][crate::RecentFilter] object to be used when displaying
27    /// the recently used resources.
28    ///
29    /// Readable | Writable
30    ///
31    ///
32    /// #### `limit`
33    ///  The maximum number of recently used resources to be displayed,
34    /// or -1 to display all items.
35    ///
36    /// Readable | Writable
37    ///
38    ///
39    /// #### `local-only`
40    ///  Whether this [`RecentChooser`][crate::RecentChooser] should display only local (file:)
41    /// resources.
42    ///
43    /// Readable | Writable
44    ///
45    ///
46    /// #### `recent-manager`
47    ///  The [`RecentManager`][crate::RecentManager] instance used by the [`RecentChooser`][crate::RecentChooser] to
48    /// display the list of recently used resources.
49    ///
50    /// Writable | Construct Only
51    ///
52    ///
53    /// #### `select-multiple`
54    ///  Allow the user to select multiple resources.
55    ///
56    /// Readable | Writable
57    ///
58    ///
59    /// #### `show-icons`
60    ///  Whether this [`RecentChooser`][crate::RecentChooser] should display an icon near the item.
61    ///
62    /// Readable | Writable
63    ///
64    ///
65    /// #### `show-not-found`
66    ///  Whether this [`RecentChooser`][crate::RecentChooser] should display the recently used resources
67    /// even if not present anymore. Setting this to [`false`] will perform a
68    /// potentially expensive check on every local resource (every remote
69    /// resource will always be displayed).
70    ///
71    /// Readable | Writable
72    ///
73    ///
74    /// #### `show-private`
75    ///  Readable | Writable
76    ///
77    ///
78    /// #### `show-tips`
79    ///  Whether this [`RecentChooser`][crate::RecentChooser] should display a tooltip containing the
80    /// full path of the recently used resources.
81    ///
82    /// Readable | Writable
83    ///
84    ///
85    /// #### `sort-type`
86    ///  Sorting order to be used when displaying the recently used resources.
87    ///
88    /// Readable | Writable
89    ///
90    /// ## Signals
91    ///
92    ///
93    /// #### `item-activated`
94    ///  This signal is emitted when the user "activates" a recent item
95    /// in the recent chooser. This can happen by double-clicking on an item
96    /// in the recently used resources list, or by pressing
97    /// `Enter`.
98    ///
99    ///
100    ///
101    ///
102    /// #### `selection-changed`
103    ///  This signal is emitted when there is a change in the set of
104    /// selected recently used resources. This can happen when a user
105    /// modifies the selection with the mouse or the keyboard, or when
106    /// explicitly calling functions to change the selection.
107    ///
108    ///
109    ///
110    /// # Implements
111    ///
112    /// [`RecentChooserExt`][trait@crate::prelude::RecentChooserExt]
113    #[doc(alias = "GtkRecentChooser")]
114    pub struct RecentChooser(Interface<ffi::GtkRecentChooser, ffi::GtkRecentChooserIface>);
115
116    match fn {
117        type_ => || ffi::gtk_recent_chooser_get_type(),
118    }
119}
120
121impl RecentChooser {
122    pub const NONE: Option<&'static RecentChooser> = None;
123}
124
125/// Trait containing all [`struct@RecentChooser`] methods.
126///
127/// # Implementors
128///
129/// [`RecentChooserDialog`][struct@crate::RecentChooserDialog], [`RecentChooserMenu`][struct@crate::RecentChooserMenu], [`RecentChooserWidget`][struct@crate::RecentChooserWidget], [`RecentChooser`][struct@crate::RecentChooser]
130pub trait RecentChooserExt: IsA<RecentChooser> + 'static {
131    /// Adds `filter` to the list of [`RecentFilter`][crate::RecentFilter] objects held by `self`.
132    ///
133    /// If no previous filter objects were defined, this function will call
134    /// [`set_filter()`][Self::set_filter()].
135    /// ## `filter`
136    /// a [`RecentFilter`][crate::RecentFilter]
137    #[doc(alias = "gtk_recent_chooser_add_filter")]
138    fn add_filter(&self, filter: &RecentFilter) {
139        unsafe {
140            ffi::gtk_recent_chooser_add_filter(
141                self.as_ref().to_glib_none().0,
142                filter.to_glib_none().0,
143            );
144        }
145    }
146
147    /// Gets the [`RecentInfo`][crate::RecentInfo] currently selected by `self`.
148    ///
149    /// # Returns
150    ///
151    /// a [`RecentInfo`][crate::RecentInfo]. Use `gtk_recent_info_unref()` when
152    ///  when you have finished using it.
153    #[doc(alias = "gtk_recent_chooser_get_current_item")]
154    #[doc(alias = "get_current_item")]
155    fn current_item(&self) -> Option<RecentInfo> {
156        unsafe {
157            from_glib_full(ffi::gtk_recent_chooser_get_current_item(
158                self.as_ref().to_glib_none().0,
159            ))
160        }
161    }
162
163    /// Gets the URI currently selected by `self`.
164    ///
165    /// # Returns
166    ///
167    /// a newly allocated string holding a URI.
168    #[doc(alias = "gtk_recent_chooser_get_current_uri")]
169    #[doc(alias = "get_current_uri")]
170    fn current_uri(&self) -> Option<glib::GString> {
171        unsafe {
172            from_glib_full(ffi::gtk_recent_chooser_get_current_uri(
173                self.as_ref().to_glib_none().0,
174            ))
175        }
176    }
177
178    /// Gets the [`RecentFilter`][crate::RecentFilter] object currently used by `self` to affect
179    /// the display of the recently used resources.
180    ///
181    /// # Returns
182    ///
183    /// a [`RecentFilter`][crate::RecentFilter] object.
184    #[doc(alias = "gtk_recent_chooser_get_filter")]
185    #[doc(alias = "get_filter")]
186    fn filter(&self) -> Option<RecentFilter> {
187        unsafe {
188            from_glib_none(ffi::gtk_recent_chooser_get_filter(
189                self.as_ref().to_glib_none().0,
190            ))
191        }
192    }
193
194    /// Gets the list of recently used resources in form of [`RecentInfo`][crate::RecentInfo] objects.
195    ///
196    /// The return value of this function is affected by the “sort-type” and
197    /// “limit” properties of `self`.
198    ///
199    /// # Returns
200    ///
201    /// A newly allocated
202    ///  list of [`RecentInfo`][crate::RecentInfo] objects. You should
203    ///  use `gtk_recent_info_unref()` on every item of the list, and then free
204    ///  the list itself using `g_list_free()`.
205    #[doc(alias = "gtk_recent_chooser_get_items")]
206    #[doc(alias = "get_items")]
207    fn items(&self) -> Vec<RecentInfo> {
208        unsafe {
209            FromGlibPtrContainer::from_glib_full(ffi::gtk_recent_chooser_get_items(
210                self.as_ref().to_glib_none().0,
211            ))
212        }
213    }
214
215    /// Gets the number of items returned by [`items()`][Self::items()]
216    /// and [`uris()`][Self::uris()].
217    ///
218    /// # Returns
219    ///
220    /// A positive integer, or -1 meaning that all items are
221    ///  returned.
222    #[doc(alias = "gtk_recent_chooser_get_limit")]
223    #[doc(alias = "get_limit")]
224    fn limit(&self) -> i32 {
225        unsafe { ffi::gtk_recent_chooser_get_limit(self.as_ref().to_glib_none().0) }
226    }
227
228    /// Gets whether only local resources should be shown in the recently used
229    /// resources selector. See [`set_local_only()`][Self::set_local_only()]
230    ///
231    /// # Returns
232    ///
233    /// [`true`] if only local resources should be shown.
234    #[doc(alias = "gtk_recent_chooser_get_local_only")]
235    #[doc(alias = "get_local_only")]
236    #[doc(alias = "local-only")]
237    fn is_local_only(&self) -> bool {
238        unsafe {
239            from_glib(ffi::gtk_recent_chooser_get_local_only(
240                self.as_ref().to_glib_none().0,
241            ))
242        }
243    }
244
245    /// Gets whether `self` can select multiple items.
246    ///
247    /// # Returns
248    ///
249    /// [`true`] if `self` can select more than one item.
250    #[doc(alias = "gtk_recent_chooser_get_select_multiple")]
251    #[doc(alias = "get_select_multiple")]
252    #[doc(alias = "select-multiple")]
253    fn selects_multiple(&self) -> bool {
254        unsafe {
255            from_glib(ffi::gtk_recent_chooser_get_select_multiple(
256                self.as_ref().to_glib_none().0,
257            ))
258        }
259    }
260
261    /// Retrieves whether `self` should show an icon near the resource.
262    ///
263    /// # Returns
264    ///
265    /// [`true`] if the icons should be displayed, [`false`] otherwise.
266    #[doc(alias = "gtk_recent_chooser_get_show_icons")]
267    #[doc(alias = "get_show_icons")]
268    #[doc(alias = "show-icons")]
269    fn shows_icons(&self) -> bool {
270        unsafe {
271            from_glib(ffi::gtk_recent_chooser_get_show_icons(
272                self.as_ref().to_glib_none().0,
273            ))
274        }
275    }
276
277    /// Retrieves whether `self` should show the recently used resources that
278    /// were not found.
279    ///
280    /// # Returns
281    ///
282    /// [`true`] if the resources not found should be displayed, and
283    ///  [`false`] otheriwse.
284    #[doc(alias = "gtk_recent_chooser_get_show_not_found")]
285    #[doc(alias = "get_show_not_found")]
286    #[doc(alias = "show-not-found")]
287    fn shows_not_found(&self) -> bool {
288        unsafe {
289            from_glib(ffi::gtk_recent_chooser_get_show_not_found(
290                self.as_ref().to_glib_none().0,
291            ))
292        }
293    }
294
295    /// Returns whether `self` should display recently used resources
296    /// registered as private.
297    ///
298    /// # Returns
299    ///
300    /// [`true`] if the recent chooser should show private items,
301    ///  [`false`] otherwise.
302    #[doc(alias = "gtk_recent_chooser_get_show_private")]
303    #[doc(alias = "get_show_private")]
304    #[doc(alias = "show-private")]
305    fn shows_private(&self) -> bool {
306        unsafe {
307            from_glib(ffi::gtk_recent_chooser_get_show_private(
308                self.as_ref().to_glib_none().0,
309            ))
310        }
311    }
312
313    /// Gets whether `self` should display tooltips containing the full path
314    /// of a recently user resource.
315    ///
316    /// # Returns
317    ///
318    /// [`true`] if the recent chooser should show tooltips,
319    ///  [`false`] otherwise.
320    #[doc(alias = "gtk_recent_chooser_get_show_tips")]
321    #[doc(alias = "get_show_tips")]
322    #[doc(alias = "show-tips")]
323    fn shows_tips(&self) -> bool {
324        unsafe {
325            from_glib(ffi::gtk_recent_chooser_get_show_tips(
326                self.as_ref().to_glib_none().0,
327            ))
328        }
329    }
330
331    /// Gets the value set by [`set_sort_type()`][Self::set_sort_type()].
332    ///
333    /// # Returns
334    ///
335    /// the sorting order of the `self`.
336    #[doc(alias = "gtk_recent_chooser_get_sort_type")]
337    #[doc(alias = "get_sort_type")]
338    #[doc(alias = "sort-type")]
339    fn sort_type(&self) -> RecentSortType {
340        unsafe {
341            from_glib(ffi::gtk_recent_chooser_get_sort_type(
342                self.as_ref().to_glib_none().0,
343            ))
344        }
345    }
346
347    /// Gets the URI of the recently used resources.
348    ///
349    /// The return value of this function is affected by the “sort-type” and “limit”
350    /// properties of `self`.
351    ///
352    /// Since the returned array is [`None`] terminated, `length` may be [`None`].
353    ///
354    /// # Returns
355    ///
356    ///
357    ///  A newly allocated, [`None`]-terminated array of strings. Use
358    ///  `g_strfreev()` to free it.
359    #[doc(alias = "gtk_recent_chooser_get_uris")]
360    #[doc(alias = "get_uris")]
361    fn uris(&self) -> Vec<glib::GString> {
362        unsafe {
363            let mut length = std::mem::MaybeUninit::uninit();
364            let ret = FromGlibContainer::from_glib_full_num(
365                ffi::gtk_recent_chooser_get_uris(
366                    self.as_ref().to_glib_none().0,
367                    length.as_mut_ptr(),
368                ),
369                length.assume_init() as _,
370            );
371            ret
372        }
373    }
374
375    /// Gets the [`RecentFilter`][crate::RecentFilter] objects held by `self`.
376    ///
377    /// # Returns
378    ///
379    /// A singly linked list
380    ///  of [`RecentFilter`][crate::RecentFilter] objects. You
381    ///  should just free the returned list using `g_slist_free()`.
382    #[doc(alias = "gtk_recent_chooser_list_filters")]
383    fn list_filters(&self) -> Vec<RecentFilter> {
384        unsafe {
385            FromGlibPtrContainer::from_glib_container(ffi::gtk_recent_chooser_list_filters(
386                self.as_ref().to_glib_none().0,
387            ))
388        }
389    }
390
391    /// Removes `filter` from the list of [`RecentFilter`][crate::RecentFilter] objects held by `self`.
392    /// ## `filter`
393    /// a [`RecentFilter`][crate::RecentFilter]
394    #[doc(alias = "gtk_recent_chooser_remove_filter")]
395    fn remove_filter(&self, filter: &RecentFilter) {
396        unsafe {
397            ffi::gtk_recent_chooser_remove_filter(
398                self.as_ref().to_glib_none().0,
399                filter.to_glib_none().0,
400            );
401        }
402    }
403
404    /// Selects all the items inside `self`, if the `self` supports
405    /// multiple selection.
406    #[doc(alias = "gtk_recent_chooser_select_all")]
407    fn select_all(&self) {
408        unsafe {
409            ffi::gtk_recent_chooser_select_all(self.as_ref().to_glib_none().0);
410        }
411    }
412
413    /// Selects `uri` inside `self`.
414    /// ## `uri`
415    /// a URI
416    ///
417    /// # Returns
418    ///
419    /// [`true`] if `uri` was found.
420    #[doc(alias = "gtk_recent_chooser_select_uri")]
421    fn select_uri(&self, uri: &str) -> Result<(), glib::Error> {
422        unsafe {
423            let mut error = std::ptr::null_mut();
424            let is_ok = ffi::gtk_recent_chooser_select_uri(
425                self.as_ref().to_glib_none().0,
426                uri.to_glib_none().0,
427                &mut error,
428            );
429            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
430            if error.is_null() {
431                Ok(())
432            } else {
433                Err(from_glib_full(error))
434            }
435        }
436    }
437
438    /// Sets `uri` as the current URI for `self`.
439    /// ## `uri`
440    /// a URI
441    ///
442    /// # Returns
443    ///
444    /// [`true`] if the URI was found.
445    #[doc(alias = "gtk_recent_chooser_set_current_uri")]
446    fn set_current_uri(&self, uri: &str) -> Result<(), glib::Error> {
447        unsafe {
448            let mut error = std::ptr::null_mut();
449            let is_ok = ffi::gtk_recent_chooser_set_current_uri(
450                self.as_ref().to_glib_none().0,
451                uri.to_glib_none().0,
452                &mut error,
453            );
454            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
455            if error.is_null() {
456                Ok(())
457            } else {
458                Err(from_glib_full(error))
459            }
460        }
461    }
462
463    /// Sets `filter` as the current [`RecentFilter`][crate::RecentFilter] object used by `self`
464    /// to affect the displayed recently used resources.
465    /// ## `filter`
466    /// a [`RecentFilter`][crate::RecentFilter]
467    #[doc(alias = "gtk_recent_chooser_set_filter")]
468    #[doc(alias = "filter")]
469    fn set_filter(&self, filter: Option<&RecentFilter>) {
470        unsafe {
471            ffi::gtk_recent_chooser_set_filter(
472                self.as_ref().to_glib_none().0,
473                filter.to_glib_none().0,
474            );
475        }
476    }
477
478    /// Sets the number of items that should be returned by
479    /// [`items()`][Self::items()] and [`uris()`][Self::uris()].
480    /// ## `limit`
481    /// a positive integer, or -1 for all items
482    #[doc(alias = "gtk_recent_chooser_set_limit")]
483    #[doc(alias = "limit")]
484    fn set_limit(&self, limit: i32) {
485        unsafe {
486            ffi::gtk_recent_chooser_set_limit(self.as_ref().to_glib_none().0, limit);
487        }
488    }
489
490    /// Sets whether only local resources, that is resources using the file:// URI
491    /// scheme, should be shown in the recently used resources selector. If
492    /// `local_only` is [`true`] (the default) then the shown resources are guaranteed
493    /// to be accessible through the operating system native file system.
494    /// ## `local_only`
495    /// [`true`] if only local files can be shown
496    #[doc(alias = "gtk_recent_chooser_set_local_only")]
497    #[doc(alias = "local-only")]
498    fn set_local_only(&self, local_only: bool) {
499        unsafe {
500            ffi::gtk_recent_chooser_set_local_only(
501                self.as_ref().to_glib_none().0,
502                local_only.into_glib(),
503            );
504        }
505    }
506
507    /// Sets whether `self` can select multiple items.
508    /// ## `select_multiple`
509    /// [`true`] if `self` can select more than one item
510    #[doc(alias = "gtk_recent_chooser_set_select_multiple")]
511    #[doc(alias = "select-multiple")]
512    fn set_select_multiple(&self, select_multiple: bool) {
513        unsafe {
514            ffi::gtk_recent_chooser_set_select_multiple(
515                self.as_ref().to_glib_none().0,
516                select_multiple.into_glib(),
517            );
518        }
519    }
520
521    /// Sets whether `self` should show an icon near the resource when
522    /// displaying it.
523    /// ## `show_icons`
524    /// whether to show an icon near the resource
525    #[doc(alias = "gtk_recent_chooser_set_show_icons")]
526    #[doc(alias = "show-icons")]
527    fn set_show_icons(&self, show_icons: bool) {
528        unsafe {
529            ffi::gtk_recent_chooser_set_show_icons(
530                self.as_ref().to_glib_none().0,
531                show_icons.into_glib(),
532            );
533        }
534    }
535
536    /// Sets whether `self` should display the recently used resources that
537    /// it didn’t find. This only applies to local resources.
538    /// ## `show_not_found`
539    /// whether to show the local items we didn’t find
540    #[doc(alias = "gtk_recent_chooser_set_show_not_found")]
541    #[doc(alias = "show-not-found")]
542    fn set_show_not_found(&self, show_not_found: bool) {
543        unsafe {
544            ffi::gtk_recent_chooser_set_show_not_found(
545                self.as_ref().to_glib_none().0,
546                show_not_found.into_glib(),
547            );
548        }
549    }
550
551    /// Whether to show recently used resources marked registered as private.
552    /// ## `show_private`
553    /// [`true`] to show private items, [`false`] otherwise
554    #[doc(alias = "gtk_recent_chooser_set_show_private")]
555    #[doc(alias = "show-private")]
556    fn set_show_private(&self, show_private: bool) {
557        unsafe {
558            ffi::gtk_recent_chooser_set_show_private(
559                self.as_ref().to_glib_none().0,
560                show_private.into_glib(),
561            );
562        }
563    }
564
565    /// Sets whether to show a tooltips containing the full path of each
566    /// recently used resource in a [`RecentChooser`][crate::RecentChooser] widget.
567    /// ## `show_tips`
568    /// [`true`] if tooltips should be shown
569    #[doc(alias = "gtk_recent_chooser_set_show_tips")]
570    #[doc(alias = "show-tips")]
571    fn set_show_tips(&self, show_tips: bool) {
572        unsafe {
573            ffi::gtk_recent_chooser_set_show_tips(
574                self.as_ref().to_glib_none().0,
575                show_tips.into_glib(),
576            );
577        }
578    }
579
580    /// Sets the comparison function used when sorting to be `sort_func`. If
581    /// the `self` has the sort type set to [`RecentSortType::Custom`][crate::RecentSortType::Custom] then
582    /// the chooser will sort using this function.
583    ///
584    /// To the comparison function will be passed two [`RecentInfo`][crate::RecentInfo] structs and
585    /// `sort_data`; `sort_func` should return a positive integer if the first
586    /// item comes before the second, zero if the two items are equal and
587    /// a negative integer if the first item comes after the second.
588    /// ## `sort_func`
589    /// the comparison function
590    /// ## `sort_data`
591    /// user data to pass to `sort_func`, or [`None`]
592    /// ## `data_destroy`
593    /// destroy notifier for `sort_data`, or [`None`]
594    #[doc(alias = "gtk_recent_chooser_set_sort_func")]
595    fn set_sort_func<P: Fn(&RecentInfo, &RecentInfo) -> i32 + 'static>(&self, sort_func: P) {
596        let sort_func_data: Box_<P> = Box_::new(sort_func);
597        unsafe extern "C" fn sort_func_func<P: Fn(&RecentInfo, &RecentInfo) -> i32 + 'static>(
598            a: *mut ffi::GtkRecentInfo,
599            b: *mut ffi::GtkRecentInfo,
600            user_data: glib::ffi::gpointer,
601        ) -> std::ffi::c_int {
602            unsafe {
603                let a = from_glib_borrow(a);
604                let b = from_glib_borrow(b);
605                let callback = &*(user_data as *mut P);
606                (*callback)(&a, &b)
607            }
608        }
609        let sort_func = Some(sort_func_func::<P> as _);
610        unsafe extern "C" fn data_destroy_func<P: Fn(&RecentInfo, &RecentInfo) -> i32 + 'static>(
611            data: glib::ffi::gpointer,
612        ) {
613            unsafe {
614                let _callback = Box_::from_raw(data as *mut P);
615            }
616        }
617        let destroy_call3 = Some(data_destroy_func::<P> as _);
618        let super_callback0: Box_<P> = sort_func_data;
619        unsafe {
620            ffi::gtk_recent_chooser_set_sort_func(
621                self.as_ref().to_glib_none().0,
622                sort_func,
623                Box_::into_raw(super_callback0) as *mut _,
624                destroy_call3,
625            );
626        }
627    }
628
629    /// Changes the sorting order of the recently used resources list displayed by
630    /// `self`.
631    /// ## `sort_type`
632    /// sort order that the chooser should use
633    #[doc(alias = "gtk_recent_chooser_set_sort_type")]
634    #[doc(alias = "sort-type")]
635    fn set_sort_type(&self, sort_type: RecentSortType) {
636        unsafe {
637            ffi::gtk_recent_chooser_set_sort_type(
638                self.as_ref().to_glib_none().0,
639                sort_type.into_glib(),
640            );
641        }
642    }
643
644    /// Unselects all the items inside `self`.
645    #[doc(alias = "gtk_recent_chooser_unselect_all")]
646    fn unselect_all(&self) {
647        unsafe {
648            ffi::gtk_recent_chooser_unselect_all(self.as_ref().to_glib_none().0);
649        }
650    }
651
652    /// Unselects `uri` inside `self`.
653    /// ## `uri`
654    /// a URI
655    #[doc(alias = "gtk_recent_chooser_unselect_uri")]
656    fn unselect_uri(&self, uri: &str) {
657        unsafe {
658            ffi::gtk_recent_chooser_unselect_uri(
659                self.as_ref().to_glib_none().0,
660                uri.to_glib_none().0,
661            );
662        }
663    }
664
665    /// This signal is emitted when the user "activates" a recent item
666    /// in the recent chooser. This can happen by double-clicking on an item
667    /// in the recently used resources list, or by pressing
668    /// `Enter`.
669    #[doc(alias = "item-activated")]
670    fn connect_item_activated<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
671        unsafe extern "C" fn item_activated_trampoline<
672            P: IsA<RecentChooser>,
673            F: Fn(&P) + 'static,
674        >(
675            this: *mut ffi::GtkRecentChooser,
676            f: glib::ffi::gpointer,
677        ) {
678            unsafe {
679                let f: &F = &*(f as *const F);
680                f(RecentChooser::from_glib_borrow(this).unsafe_cast_ref())
681            }
682        }
683        unsafe {
684            let f: Box_<F> = Box_::new(f);
685            connect_raw(
686                self.as_ptr() as *mut _,
687                c"item-activated".as_ptr(),
688                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
689                    item_activated_trampoline::<Self, F> as *const (),
690                )),
691                Box_::into_raw(f),
692            )
693        }
694    }
695
696    /// This signal is emitted when there is a change in the set of
697    /// selected recently used resources. This can happen when a user
698    /// modifies the selection with the mouse or the keyboard, or when
699    /// explicitly calling functions to change the selection.
700    #[doc(alias = "selection-changed")]
701    fn connect_selection_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
702        unsafe extern "C" fn selection_changed_trampoline<
703            P: IsA<RecentChooser>,
704            F: Fn(&P) + 'static,
705        >(
706            this: *mut ffi::GtkRecentChooser,
707            f: glib::ffi::gpointer,
708        ) {
709            unsafe {
710                let f: &F = &*(f as *const F);
711                f(RecentChooser::from_glib_borrow(this).unsafe_cast_ref())
712            }
713        }
714        unsafe {
715            let f: Box_<F> = Box_::new(f);
716            connect_raw(
717                self.as_ptr() as *mut _,
718                c"selection-changed".as_ptr(),
719                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
720                    selection_changed_trampoline::<Self, F> as *const (),
721                )),
722                Box_::into_raw(f),
723            )
724        }
725    }
726
727    #[doc(alias = "filter")]
728    fn connect_filter_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
729        unsafe extern "C" fn notify_filter_trampoline<
730            P: IsA<RecentChooser>,
731            F: Fn(&P) + 'static,
732        >(
733            this: *mut ffi::GtkRecentChooser,
734            _param_spec: glib::ffi::gpointer,
735            f: glib::ffi::gpointer,
736        ) {
737            unsafe {
738                let f: &F = &*(f as *const F);
739                f(RecentChooser::from_glib_borrow(this).unsafe_cast_ref())
740            }
741        }
742        unsafe {
743            let f: Box_<F> = Box_::new(f);
744            connect_raw(
745                self.as_ptr() as *mut _,
746                c"notify::filter".as_ptr(),
747                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
748                    notify_filter_trampoline::<Self, F> as *const (),
749                )),
750                Box_::into_raw(f),
751            )
752        }
753    }
754
755    #[doc(alias = "limit")]
756    fn connect_limit_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
757        unsafe extern "C" fn notify_limit_trampoline<P: IsA<RecentChooser>, F: Fn(&P) + 'static>(
758            this: *mut ffi::GtkRecentChooser,
759            _param_spec: glib::ffi::gpointer,
760            f: glib::ffi::gpointer,
761        ) {
762            unsafe {
763                let f: &F = &*(f as *const F);
764                f(RecentChooser::from_glib_borrow(this).unsafe_cast_ref())
765            }
766        }
767        unsafe {
768            let f: Box_<F> = Box_::new(f);
769            connect_raw(
770                self.as_ptr() as *mut _,
771                c"notify::limit".as_ptr(),
772                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
773                    notify_limit_trampoline::<Self, F> as *const (),
774                )),
775                Box_::into_raw(f),
776            )
777        }
778    }
779
780    #[doc(alias = "local-only")]
781    fn connect_local_only_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
782        unsafe extern "C" fn notify_local_only_trampoline<
783            P: IsA<RecentChooser>,
784            F: Fn(&P) + 'static,
785        >(
786            this: *mut ffi::GtkRecentChooser,
787            _param_spec: glib::ffi::gpointer,
788            f: glib::ffi::gpointer,
789        ) {
790            unsafe {
791                let f: &F = &*(f as *const F);
792                f(RecentChooser::from_glib_borrow(this).unsafe_cast_ref())
793            }
794        }
795        unsafe {
796            let f: Box_<F> = Box_::new(f);
797            connect_raw(
798                self.as_ptr() as *mut _,
799                c"notify::local-only".as_ptr(),
800                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
801                    notify_local_only_trampoline::<Self, F> as *const (),
802                )),
803                Box_::into_raw(f),
804            )
805        }
806    }
807
808    #[doc(alias = "select-multiple")]
809    fn connect_select_multiple_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
810        unsafe extern "C" fn notify_select_multiple_trampoline<
811            P: IsA<RecentChooser>,
812            F: Fn(&P) + 'static,
813        >(
814            this: *mut ffi::GtkRecentChooser,
815            _param_spec: glib::ffi::gpointer,
816            f: glib::ffi::gpointer,
817        ) {
818            unsafe {
819                let f: &F = &*(f as *const F);
820                f(RecentChooser::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::select-multiple".as_ptr(),
828                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
829                    notify_select_multiple_trampoline::<Self, F> as *const (),
830                )),
831                Box_::into_raw(f),
832            )
833        }
834    }
835
836    #[doc(alias = "show-icons")]
837    fn connect_show_icons_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
838        unsafe extern "C" fn notify_show_icons_trampoline<
839            P: IsA<RecentChooser>,
840            F: Fn(&P) + 'static,
841        >(
842            this: *mut ffi::GtkRecentChooser,
843            _param_spec: glib::ffi::gpointer,
844            f: glib::ffi::gpointer,
845        ) {
846            unsafe {
847                let f: &F = &*(f as *const F);
848                f(RecentChooser::from_glib_borrow(this).unsafe_cast_ref())
849            }
850        }
851        unsafe {
852            let f: Box_<F> = Box_::new(f);
853            connect_raw(
854                self.as_ptr() as *mut _,
855                c"notify::show-icons".as_ptr(),
856                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
857                    notify_show_icons_trampoline::<Self, F> as *const (),
858                )),
859                Box_::into_raw(f),
860            )
861        }
862    }
863
864    #[doc(alias = "show-not-found")]
865    fn connect_show_not_found_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
866        unsafe extern "C" fn notify_show_not_found_trampoline<
867            P: IsA<RecentChooser>,
868            F: Fn(&P) + 'static,
869        >(
870            this: *mut ffi::GtkRecentChooser,
871            _param_spec: glib::ffi::gpointer,
872            f: glib::ffi::gpointer,
873        ) {
874            unsafe {
875                let f: &F = &*(f as *const F);
876                f(RecentChooser::from_glib_borrow(this).unsafe_cast_ref())
877            }
878        }
879        unsafe {
880            let f: Box_<F> = Box_::new(f);
881            connect_raw(
882                self.as_ptr() as *mut _,
883                c"notify::show-not-found".as_ptr(),
884                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
885                    notify_show_not_found_trampoline::<Self, F> as *const (),
886                )),
887                Box_::into_raw(f),
888            )
889        }
890    }
891
892    #[doc(alias = "show-private")]
893    fn connect_show_private_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
894        unsafe extern "C" fn notify_show_private_trampoline<
895            P: IsA<RecentChooser>,
896            F: Fn(&P) + 'static,
897        >(
898            this: *mut ffi::GtkRecentChooser,
899            _param_spec: glib::ffi::gpointer,
900            f: glib::ffi::gpointer,
901        ) {
902            unsafe {
903                let f: &F = &*(f as *const F);
904                f(RecentChooser::from_glib_borrow(this).unsafe_cast_ref())
905            }
906        }
907        unsafe {
908            let f: Box_<F> = Box_::new(f);
909            connect_raw(
910                self.as_ptr() as *mut _,
911                c"notify::show-private".as_ptr(),
912                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
913                    notify_show_private_trampoline::<Self, F> as *const (),
914                )),
915                Box_::into_raw(f),
916            )
917        }
918    }
919
920    #[doc(alias = "show-tips")]
921    fn connect_show_tips_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
922        unsafe extern "C" fn notify_show_tips_trampoline<
923            P: IsA<RecentChooser>,
924            F: Fn(&P) + 'static,
925        >(
926            this: *mut ffi::GtkRecentChooser,
927            _param_spec: glib::ffi::gpointer,
928            f: glib::ffi::gpointer,
929        ) {
930            unsafe {
931                let f: &F = &*(f as *const F);
932                f(RecentChooser::from_glib_borrow(this).unsafe_cast_ref())
933            }
934        }
935        unsafe {
936            let f: Box_<F> = Box_::new(f);
937            connect_raw(
938                self.as_ptr() as *mut _,
939                c"notify::show-tips".as_ptr(),
940                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
941                    notify_show_tips_trampoline::<Self, F> as *const (),
942                )),
943                Box_::into_raw(f),
944            )
945        }
946    }
947
948    #[doc(alias = "sort-type")]
949    fn connect_sort_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
950        unsafe extern "C" fn notify_sort_type_trampoline<
951            P: IsA<RecentChooser>,
952            F: Fn(&P) + 'static,
953        >(
954            this: *mut ffi::GtkRecentChooser,
955            _param_spec: glib::ffi::gpointer,
956            f: glib::ffi::gpointer,
957        ) {
958            unsafe {
959                let f: &F = &*(f as *const F);
960                f(RecentChooser::from_glib_borrow(this).unsafe_cast_ref())
961            }
962        }
963        unsafe {
964            let f: Box_<F> = Box_::new(f);
965            connect_raw(
966                self.as_ptr() as *mut _,
967                c"notify::sort-type".as_ptr(),
968                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
969                    notify_sort_type_trampoline::<Self, F> as *const (),
970                )),
971                Box_::into_raw(f),
972            )
973        }
974    }
975}
976
977impl<O: IsA<RecentChooser>> RecentChooserExt for O {}