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