Skip to main content

gtk/auto/
recent_chooser_dialog.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::{
6    Align, Application, Bin, Buildable, Container, Dialog, RecentChooser, RecentFilter,
7    RecentManager, RecentSortType, ResizeMode, Widget, Window, WindowPosition, WindowType,
8};
9use glib::prelude::*;
10use std::fmt;
11
12glib::wrapper! {
13    /// [`RecentChooserDialog`][crate::RecentChooserDialog] is a dialog box suitable for displaying the recently
14    /// used documents. This widgets works by putting a [`RecentChooserWidget`][crate::RecentChooserWidget] inside
15    /// a [`Dialog`][crate::Dialog]. It exposes the `GtkRecentChooserIface` interface, so you can use
16    /// all the [`RecentChooser`][crate::RecentChooser] functions on the recent chooser dialog as well as
17    /// those for [`Dialog`][crate::Dialog].
18    ///
19    /// Note that [`RecentChooserDialog`][crate::RecentChooserDialog] does not have any methods of its own.
20    /// Instead, you should use the functions that work on a [`RecentChooser`][crate::RecentChooser].
21    ///
22    /// ## Typical usage ## {`gtkrecentchooser`-typical-usage}
23    ///
24    /// In the simplest of cases, you can use the following code to use
25    /// a [`RecentChooserDialog`][crate::RecentChooserDialog] to select a recently used file:
26    ///
27    ///
28    ///
29    /// **⚠️ The following code is in C ⚠️**
30    ///
31    /// ```C
32    /// GtkWidget *dialog;
33    /// gint res;
34    ///
35    /// dialog = gtk_recent_chooser_dialog_new ("Recent Documents",
36    ///                                         parent_window,
37    ///                                         _("_Cancel"),
38    ///                                         GTK_RESPONSE_CANCEL,
39    ///                                         _("_Open"),
40    ///                                         GTK_RESPONSE_ACCEPT,
41    ///                                         NULL);
42    ///
43    /// res = gtk_dialog_run (GTK_DIALOG (dialog));
44    /// if (res == GTK_RESPONSE_ACCEPT)
45    ///   {
46    ///     GtkRecentInfo *info;
47    ///     GtkRecentChooser *chooser = GTK_RECENT_CHOOSER (dialog);
48    ///
49    ///     info = gtk_recent_chooser_get_current_item (chooser);
50    ///     open_file (gtk_recent_info_get_uri (info));
51    ///     gtk_recent_info_unref (info);
52    ///   }
53    ///
54    /// gtk_widget_destroy (dialog);
55    /// ```
56    ///
57    /// Recently used files are supported since GTK+ 2.10.
58    ///
59    /// # Implements
60    ///
61    /// [`DialogExt`][trait@crate::prelude::DialogExt], [`GtkWindowExt`][trait@crate::prelude::GtkWindowExt], [`BinExt`][trait@crate::prelude::BinExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`RecentChooserExt`][trait@crate::prelude::RecentChooserExt], [`DialogExtManual`][trait@crate::prelude::DialogExtManual], [`GtkWindowExtManual`][trait@crate::prelude::GtkWindowExtManual], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
62    #[doc(alias = "GtkRecentChooserDialog")]
63    pub struct RecentChooserDialog(Object<ffi::GtkRecentChooserDialog, ffi::GtkRecentChooserDialogClass>) @extends Dialog, Window, Bin, Container, Widget, @implements Buildable, RecentChooser;
64
65    match fn {
66        type_ => || ffi::gtk_recent_chooser_dialog_get_type(),
67    }
68}
69
70impl RecentChooserDialog {
71    pub const NONE: Option<&'static RecentChooserDialog> = None;
72
73    //#[doc(alias = "gtk_recent_chooser_dialog_new")]
74    //pub fn new(title: Option<&str>, parent: Option<&impl IsA<Window>>, first_button_text: Option<&str>, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> RecentChooserDialog {
75    //    unsafe { TODO: call ffi:gtk_recent_chooser_dialog_new() }
76    //}
77
78    //#[doc(alias = "gtk_recent_chooser_dialog_new_for_manager")]
79    //#[doc(alias = "new_for_manager")]
80    //pub fn for_manager(title: Option<&str>, parent: Option<&impl IsA<Window>>, manager: &impl IsA<RecentManager>, first_button_text: Option<&str>, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> RecentChooserDialog {
81    //    unsafe { TODO: call ffi:gtk_recent_chooser_dialog_new_for_manager() }
82    //}
83
84    // rustdoc-stripper-ignore-next
85    /// Creates a new builder-pattern struct instance to construct [`RecentChooserDialog`] objects.
86    ///
87    /// This method returns an instance of [`RecentChooserDialogBuilder`](crate::builders::RecentChooserDialogBuilder) which can be used to create [`RecentChooserDialog`] objects.
88    pub fn builder() -> RecentChooserDialogBuilder {
89        RecentChooserDialogBuilder::new()
90    }
91}
92
93impl Default for RecentChooserDialog {
94    fn default() -> Self {
95        glib::object::Object::new::<Self>()
96    }
97}
98
99// rustdoc-stripper-ignore-next
100/// A [builder-pattern] type to construct [`RecentChooserDialog`] objects.
101///
102/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
103#[must_use = "The builder must be built to be used"]
104pub struct RecentChooserDialogBuilder {
105    builder: glib::object::ObjectBuilder<'static, RecentChooserDialog>,
106}
107
108impl RecentChooserDialogBuilder {
109    fn new() -> Self {
110        Self {
111            builder: glib::object::Object::builder(),
112        }
113    }
114
115    /// [`true`] if the dialog uses a [`HeaderBar`][crate::HeaderBar] for action buttons
116    /// instead of the action-area.
117    ///
118    /// For technical reasons, this property is declared as an integer
119    /// property, but you should only set it to [`true`] or [`false`].
120    pub fn use_header_bar(self, use_header_bar: i32) -> Self {
121        Self {
122            builder: self.builder.property("use-header-bar", use_header_bar),
123        }
124    }
125
126    /// Whether the window should receive the input focus.
127    pub fn accept_focus(self, accept_focus: bool) -> Self {
128        Self {
129            builder: self.builder.property("accept-focus", accept_focus),
130        }
131    }
132
133    /// The [`Application`][crate::Application] associated with the window.
134    ///
135    /// The application will be kept alive for at least as long as it
136    /// has any windows associated with it (see [`ApplicationExtManual::hold()`][crate::gio::prelude::ApplicationExtManual::hold()]
137    /// for a way to keep it alive without windows).
138    ///
139    /// Normally, the connection between the application and the window
140    /// will remain until the window is destroyed, but you can explicitly
141    /// remove it by setting the :application property to [`None`].
142    pub fn application(self, application: &impl IsA<Application>) -> Self {
143        Self {
144            builder: self
145                .builder
146                .property("application", application.clone().upcast()),
147        }
148    }
149
150    /// The widget to which this window is attached.
151    /// See [`GtkWindowExt::set_attached_to()`][crate::prelude::GtkWindowExt::set_attached_to()].
152    ///
153    /// Examples of places where specifying this relation is useful are
154    /// for instance a [`Menu`][crate::Menu] created by a [`ComboBox`][crate::ComboBox], a completion
155    /// popup window created by [`Entry`][crate::Entry] or a typeahead search entry
156    /// created by [`TreeView`][crate::TreeView].
157    pub fn attached_to(self, attached_to: &impl IsA<Widget>) -> Self {
158        Self {
159            builder: self
160                .builder
161                .property("attached-to", attached_to.clone().upcast()),
162        }
163    }
164
165    /// Whether the window should be decorated by the window manager.
166    pub fn decorated(self, decorated: bool) -> Self {
167        Self {
168            builder: self.builder.property("decorated", decorated),
169        }
170    }
171
172    pub fn default_height(self, default_height: i32) -> Self {
173        Self {
174            builder: self.builder.property("default-height", default_height),
175        }
176    }
177
178    pub fn default_width(self, default_width: i32) -> Self {
179        Self {
180            builder: self.builder.property("default-width", default_width),
181        }
182    }
183
184    /// Whether the window frame should have a close button.
185    pub fn deletable(self, deletable: bool) -> Self {
186        Self {
187            builder: self.builder.property("deletable", deletable),
188        }
189    }
190
191    pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self {
192        Self {
193            builder: self
194                .builder
195                .property("destroy-with-parent", destroy_with_parent),
196        }
197    }
198
199    /// Whether the window should receive the input focus when mapped.
200    pub fn focus_on_map(self, focus_on_map: bool) -> Self {
201        Self {
202            builder: self.builder.property("focus-on-map", focus_on_map),
203        }
204    }
205
206    /// Whether 'focus rectangles' are currently visible in this window.
207    ///
208    /// This property is maintained by GTK+ based on user input
209    /// and should not be set by applications.
210    pub fn focus_visible(self, focus_visible: bool) -> Self {
211        Self {
212            builder: self.builder.property("focus-visible", focus_visible),
213        }
214    }
215
216    /// The window gravity of the window. See [`GtkWindowExt::move_()`][crate::prelude::GtkWindowExt::move_()] and [`gdk::Gravity`][crate::gdk::Gravity] for
217    /// more details about window gravity.
218    pub fn gravity(self, gravity: gdk::Gravity) -> Self {
219        Self {
220            builder: self.builder.property("gravity", gravity),
221        }
222    }
223
224    /// Whether the titlebar should be hidden during maximization.
225    pub fn hide_titlebar_when_maximized(self, hide_titlebar_when_maximized: bool) -> Self {
226        Self {
227            builder: self
228                .builder
229                .property("hide-titlebar-when-maximized", hide_titlebar_when_maximized),
230        }
231    }
232
233    pub fn icon(self, icon: &gdk_pixbuf::Pixbuf) -> Self {
234        Self {
235            builder: self.builder.property("icon", icon.clone()),
236        }
237    }
238
239    /// The :icon-name property specifies the name of the themed icon to
240    /// use as the window icon. See [`IconTheme`][crate::IconTheme] for more details.
241    pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
242        Self {
243            builder: self.builder.property("icon-name", icon_name.into()),
244        }
245    }
246
247    /// Whether mnemonics are currently visible in this window.
248    ///
249    /// This property is maintained by GTK+ based on user input,
250    /// and should not be set by applications.
251    pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
252        Self {
253            builder: self
254                .builder
255                .property("mnemonics-visible", mnemonics_visible),
256        }
257    }
258
259    pub fn modal(self, modal: bool) -> Self {
260        Self {
261            builder: self.builder.property("modal", modal),
262        }
263    }
264
265    pub fn resizable(self, resizable: bool) -> Self {
266        Self {
267            builder: self.builder.property("resizable", resizable),
268        }
269    }
270
271    pub fn role(self, role: impl Into<glib::GString>) -> Self {
272        Self {
273            builder: self.builder.property("role", role.into()),
274        }
275    }
276
277    pub fn screen(self, screen: &gdk::Screen) -> Self {
278        Self {
279            builder: self.builder.property("screen", screen.clone()),
280        }
281    }
282
283    pub fn skip_pager_hint(self, skip_pager_hint: bool) -> Self {
284        Self {
285            builder: self.builder.property("skip-pager-hint", skip_pager_hint),
286        }
287    }
288
289    pub fn skip_taskbar_hint(self, skip_taskbar_hint: bool) -> Self {
290        Self {
291            builder: self
292                .builder
293                .property("skip-taskbar-hint", skip_taskbar_hint),
294        }
295    }
296
297    /// The :startup-id is a write-only property for setting window's
298    /// startup notification identifier. See [`GtkWindowExt::set_startup_id()`][crate::prelude::GtkWindowExt::set_startup_id()]
299    /// for more details.
300    pub fn startup_id(self, startup_id: impl Into<glib::GString>) -> Self {
301        Self {
302            builder: self.builder.property("startup-id", startup_id.into()),
303        }
304    }
305
306    pub fn title(self, title: impl Into<glib::GString>) -> Self {
307        Self {
308            builder: self.builder.property("title", title.into()),
309        }
310    }
311
312    /// The transient parent of the window. See [`GtkWindowExt::set_transient_for()`][crate::prelude::GtkWindowExt::set_transient_for()] for
313    /// more details about transient windows.
314    pub fn transient_for(self, transient_for: &impl IsA<Window>) -> Self {
315        Self {
316            builder: self
317                .builder
318                .property("transient-for", transient_for.clone().upcast()),
319        }
320    }
321
322    pub fn type_(self, type_: WindowType) -> Self {
323        Self {
324            builder: self.builder.property("type", type_),
325        }
326    }
327
328    pub fn type_hint(self, type_hint: gdk::WindowTypeHint) -> Self {
329        Self {
330            builder: self.builder.property("type-hint", type_hint),
331        }
332    }
333
334    pub fn urgency_hint(self, urgency_hint: bool) -> Self {
335        Self {
336            builder: self.builder.property("urgency-hint", urgency_hint),
337        }
338    }
339
340    pub fn window_position(self, window_position: WindowPosition) -> Self {
341        Self {
342            builder: self.builder.property("window-position", window_position),
343        }
344    }
345
346    pub fn border_width(self, border_width: u32) -> Self {
347        Self {
348            builder: self.builder.property("border-width", border_width),
349        }
350    }
351
352    pub fn child(self, child: &impl IsA<Widget>) -> Self {
353        Self {
354            builder: self.builder.property("child", child.clone().upcast()),
355        }
356    }
357
358    pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
359        Self {
360            builder: self.builder.property("resize-mode", resize_mode),
361        }
362    }
363
364    pub fn app_paintable(self, app_paintable: bool) -> Self {
365        Self {
366            builder: self.builder.property("app-paintable", app_paintable),
367        }
368    }
369
370    pub fn can_default(self, can_default: bool) -> Self {
371        Self {
372            builder: self.builder.property("can-default", can_default),
373        }
374    }
375
376    pub fn can_focus(self, can_focus: bool) -> Self {
377        Self {
378            builder: self.builder.property("can-focus", can_focus),
379        }
380    }
381
382    pub fn events(self, events: gdk::EventMask) -> Self {
383        Self {
384            builder: self.builder.property("events", events),
385        }
386    }
387
388    /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
389    pub fn expand(self, expand: bool) -> Self {
390        Self {
391            builder: self.builder.property("expand", expand),
392        }
393    }
394
395    /// Whether the widget should grab focus when it is clicked with the mouse.
396    ///
397    /// This property is only relevant for widgets that can take focus.
398    ///
399    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
400    /// GtkComboBox) implemented this property individually.
401    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
402        Self {
403            builder: self.builder.property("focus-on-click", focus_on_click),
404        }
405    }
406
407    /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
408    pub fn halign(self, halign: Align) -> Self {
409        Self {
410            builder: self.builder.property("halign", halign),
411        }
412    }
413
414    pub fn has_default(self, has_default: bool) -> Self {
415        Self {
416            builder: self.builder.property("has-default", has_default),
417        }
418    }
419
420    pub fn has_focus(self, has_focus: bool) -> Self {
421        Self {
422            builder: self.builder.property("has-focus", has_focus),
423        }
424    }
425
426    /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
427    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
428    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
429    /// whether it will provide a tooltip or not.
430    ///
431    /// Note that setting this property to [`true`] for the first time will change
432    /// the event masks of the GdkWindows of this widget to include leave-notify
433    /// and motion-notify events. This cannot and will not be undone when the
434    /// property is set to [`false`] again.
435    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
436        Self {
437            builder: self.builder.property("has-tooltip", has_tooltip),
438        }
439    }
440
441    pub fn height_request(self, height_request: i32) -> Self {
442        Self {
443            builder: self.builder.property("height-request", height_request),
444        }
445    }
446
447    /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
448    pub fn hexpand(self, hexpand: bool) -> Self {
449        Self {
450            builder: self.builder.property("hexpand", hexpand),
451        }
452    }
453
454    /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
455    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
456        Self {
457            builder: self.builder.property("hexpand-set", hexpand_set),
458        }
459    }
460
461    pub fn is_focus(self, is_focus: bool) -> Self {
462        Self {
463            builder: self.builder.property("is-focus", is_focus),
464        }
465    }
466
467    /// Sets all four sides' margin at once. If read, returns max
468    /// margin on any side.
469    pub fn margin(self, margin: i32) -> Self {
470        Self {
471            builder: self.builder.property("margin", margin),
472        }
473    }
474
475    /// Margin on bottom side of widget.
476    ///
477    /// This property adds margin outside of the widget's normal size
478    /// request, the margin will be added in addition to the size from
479    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
480    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
481        Self {
482            builder: self.builder.property("margin-bottom", margin_bottom),
483        }
484    }
485
486    /// Margin on end of widget, horizontally. This property supports
487    /// left-to-right and right-to-left text directions.
488    ///
489    /// This property adds margin outside of the widget's normal size
490    /// request, the margin will be added in addition to the size from
491    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
492    pub fn margin_end(self, margin_end: i32) -> Self {
493        Self {
494            builder: self.builder.property("margin-end", margin_end),
495        }
496    }
497
498    /// Margin on start of widget, horizontally. This property supports
499    /// left-to-right and right-to-left text directions.
500    ///
501    /// This property adds margin outside of the widget's normal size
502    /// request, the margin will be added in addition to the size from
503    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
504    pub fn margin_start(self, margin_start: i32) -> Self {
505        Self {
506            builder: self.builder.property("margin-start", margin_start),
507        }
508    }
509
510    /// Margin on top side of widget.
511    ///
512    /// This property adds margin outside of the widget's normal size
513    /// request, the margin will be added in addition to the size from
514    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
515    pub fn margin_top(self, margin_top: i32) -> Self {
516        Self {
517            builder: self.builder.property("margin-top", margin_top),
518        }
519    }
520
521    pub fn name(self, name: impl Into<glib::GString>) -> Self {
522        Self {
523            builder: self.builder.property("name", name.into()),
524        }
525    }
526
527    pub fn no_show_all(self, no_show_all: bool) -> Self {
528        Self {
529            builder: self.builder.property("no-show-all", no_show_all),
530        }
531    }
532
533    /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
534    /// more details about window opacity.
535    ///
536    /// Before 3.8 this was only available in GtkWindow
537    pub fn opacity(self, opacity: f64) -> Self {
538        Self {
539            builder: self.builder.property("opacity", opacity),
540        }
541    }
542
543    pub fn parent(self, parent: &impl IsA<Container>) -> Self {
544        Self {
545            builder: self.builder.property("parent", parent.clone().upcast()),
546        }
547    }
548
549    pub fn receives_default(self, receives_default: bool) -> Self {
550        Self {
551            builder: self.builder.property("receives-default", receives_default),
552        }
553    }
554
555    pub fn sensitive(self, sensitive: bool) -> Self {
556        Self {
557            builder: self.builder.property("sensitive", sensitive),
558        }
559    }
560
561    /// Sets the text of tooltip to be the given string, which is marked up
562    /// with the [Pango text markup language][PangoMarkupFormat].
563    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
564    ///
565    /// This is a convenience property which will take care of getting the
566    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
567    /// will automatically be set to [`true`] and there will be taken care of
568    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
569    ///
570    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
571    /// are set, the last one wins.
572    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
573        Self {
574            builder: self
575                .builder
576                .property("tooltip-markup", tooltip_markup.into()),
577        }
578    }
579
580    /// Sets the text of tooltip to be the given string.
581    ///
582    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
583    ///
584    /// This is a convenience property which will take care of getting the
585    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
586    /// will automatically be set to [`true`] and there will be taken care of
587    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
588    ///
589    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
590    /// are set, the last one wins.
591    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
592        Self {
593            builder: self.builder.property("tooltip-text", tooltip_text.into()),
594        }
595    }
596
597    /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
598    pub fn valign(self, valign: Align) -> Self {
599        Self {
600            builder: self.builder.property("valign", valign),
601        }
602    }
603
604    /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
605    pub fn vexpand(self, vexpand: bool) -> Self {
606        Self {
607            builder: self.builder.property("vexpand", vexpand),
608        }
609    }
610
611    /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
612    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
613        Self {
614            builder: self.builder.property("vexpand-set", vexpand_set),
615        }
616    }
617
618    pub fn visible(self, visible: bool) -> Self {
619        Self {
620            builder: self.builder.property("visible", visible),
621        }
622    }
623
624    pub fn width_request(self, width_request: i32) -> Self {
625        Self {
626            builder: self.builder.property("width-request", width_request),
627        }
628    }
629
630    /// The [`RecentFilter`][crate::RecentFilter] object to be used when displaying
631    /// the recently used resources.
632    pub fn filter(self, filter: &RecentFilter) -> Self {
633        Self {
634            builder: self.builder.property("filter", filter.clone()),
635        }
636    }
637
638    /// The maximum number of recently used resources to be displayed,
639    /// or -1 to display all items.
640    pub fn limit(self, limit: i32) -> Self {
641        Self {
642            builder: self.builder.property("limit", limit),
643        }
644    }
645
646    /// Whether this [`RecentChooser`][crate::RecentChooser] should display only local (file:)
647    /// resources.
648    pub fn local_only(self, local_only: bool) -> Self {
649        Self {
650            builder: self.builder.property("local-only", local_only),
651        }
652    }
653
654    /// The [`RecentManager`][crate::RecentManager] instance used by the [`RecentChooser`][crate::RecentChooser] to
655    /// display the list of recently used resources.
656    pub fn recent_manager(self, recent_manager: &impl IsA<RecentManager>) -> Self {
657        Self {
658            builder: self
659                .builder
660                .property("recent-manager", recent_manager.clone().upcast()),
661        }
662    }
663
664    /// Allow the user to select multiple resources.
665    pub fn select_multiple(self, select_multiple: bool) -> Self {
666        Self {
667            builder: self.builder.property("select-multiple", select_multiple),
668        }
669    }
670
671    /// Whether this [`RecentChooser`][crate::RecentChooser] should display an icon near the item.
672    pub fn show_icons(self, show_icons: bool) -> Self {
673        Self {
674            builder: self.builder.property("show-icons", show_icons),
675        }
676    }
677
678    /// Whether this [`RecentChooser`][crate::RecentChooser] should display the recently used resources
679    /// even if not present anymore. Setting this to [`false`] will perform a
680    /// potentially expensive check on every local resource (every remote
681    /// resource will always be displayed).
682    pub fn show_not_found(self, show_not_found: bool) -> Self {
683        Self {
684            builder: self.builder.property("show-not-found", show_not_found),
685        }
686    }
687
688    pub fn show_private(self, show_private: bool) -> Self {
689        Self {
690            builder: self.builder.property("show-private", show_private),
691        }
692    }
693
694    /// Whether this [`RecentChooser`][crate::RecentChooser] should display a tooltip containing the
695    /// full path of the recently used resources.
696    pub fn show_tips(self, show_tips: bool) -> Self {
697        Self {
698            builder: self.builder.property("show-tips", show_tips),
699        }
700    }
701
702    /// Sorting order to be used when displaying the recently used resources.
703    pub fn sort_type(self, sort_type: RecentSortType) -> Self {
704        Self {
705            builder: self.builder.property("sort-type", sort_type),
706        }
707    }
708
709    // rustdoc-stripper-ignore-next
710    /// Build the [`RecentChooserDialog`].
711    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
712    pub fn build(self) -> RecentChooserDialog {
713        self.builder.build()
714    }
715}
716
717impl fmt::Display for RecentChooserDialog {
718    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
719        f.write_str("RecentChooserDialog")
720    }
721}