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