Skip to main content

gtk4/auto/
file_chooser_widget.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4#![allow(deprecated)]
5
6#[cfg(feature = "v4_10")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
8use crate::Accessible;
9use crate::{
10    AccessibleRole, Align, Buildable, ConstraintTarget, FileChooser, FileChooserAction, FileFilter,
11    LayoutManager, Overflow, Widget, ffi,
12};
13use glib::{
14    object::ObjectType as _,
15    prelude::*,
16    signal::{SignalHandlerId, connect_raw},
17    translate::*,
18};
19use std::boxed::Box as Box_;
20
21#[cfg(feature = "v4_10")]
22#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
23glib::wrapper! {
24    /// Direct use of [`FileChooserWidget`][crate::FileChooserWidget] is deprecated
25    ///  opens the context menu.
26    ///
27    /// The following signals have default keybindings:
28    ///
29    /// - [`desktop-folder`][struct@crate::FileChooserWidget#desktop-folder]
30    /// - [`down-folder`][struct@crate::FileChooserWidget#down-folder]
31    /// - [`home-folder`][struct@crate::FileChooserWidget#home-folder]
32    /// - [`location-popup`][struct@crate::FileChooserWidget#location-popup]
33    /// - [`location-popup-on-paste`][struct@crate::FileChooserWidget#location-popup-on-paste]
34    /// - [`location-toggle-popup`][struct@crate::FileChooserWidget#location-toggle-popup]
35    /// - [`places-shortcut`][struct@crate::FileChooserWidget#places-shortcut]
36    /// - [`quick-bookmark`][struct@crate::FileChooserWidget#quick-bookmark]
37    /// - [`recent-shortcut`][struct@crate::FileChooserWidget#recent-shortcut]
38    /// - [`search-shortcut`][struct@crate::FileChooserWidget#search-shortcut]
39    /// - [`show-hidden`][struct@crate::FileChooserWidget#show-hidden]
40    /// - [`up-folder`][struct@crate::FileChooserWidget#up-folder]
41    ///
42    /// # CSS nodes
43    ///
44    /// [`FileChooserWidget`][crate::FileChooserWidget] has a single CSS node with name filechooser.
45    ///
46    /// ## Properties
47    ///
48    ///
49    /// #### `search-mode`
50    ///  Whether search mode is enabled.
51    ///
52    /// Readable | Writable
53    ///
54    ///
55    /// #### `show-time`
56    ///  Whether to show the time.
57    ///
58    /// Readable
59    ///
60    ///
61    /// #### `subtitle`
62    ///  The subtitle of the file chooser widget.
63    ///
64    /// Readable
65    /// <details><summary><h4>Widget</h4></summary>
66    ///
67    ///
68    /// #### `can-focus`
69    ///  Whether the widget or any of its descendents can accept
70    /// the input focus.
71    ///
72    /// This property is meant to be set by widget implementations,
73    /// typically in their instance init function.
74    ///
75    /// Readable | Writable
76    ///
77    ///
78    /// #### `can-target`
79    ///  Whether the widget can receive pointer events.
80    ///
81    /// Readable | Writable
82    ///
83    ///
84    /// #### `css-classes`
85    ///  A list of css classes applied to this widget.
86    ///
87    /// Readable | Writable
88    ///
89    ///
90    /// #### `css-name`
91    ///  The name of this widget in the CSS tree.
92    ///
93    /// This property is meant to be set by widget implementations,
94    /// typically in their instance init function.
95    ///
96    /// Readable | Writable | Construct Only
97    ///
98    ///
99    /// #### `cursor`
100    ///  The cursor used by @widget.
101    ///
102    /// Readable | Writable
103    ///
104    ///
105    /// #### `focus-on-click`
106    ///  Whether the widget should grab focus when it is clicked with the mouse.
107    ///
108    /// This property is only relevant for widgets that can take focus.
109    ///
110    /// Readable | Writable
111    ///
112    ///
113    /// #### `focusable`
114    ///  Whether this widget itself will accept the input focus.
115    ///
116    /// Readable | Writable
117    ///
118    ///
119    /// #### `halign`
120    ///  How to distribute horizontal space if widget gets extra space.
121    ///
122    /// Readable | Writable
123    ///
124    ///
125    /// #### `has-default`
126    ///  Whether the widget is the default widget.
127    ///
128    /// Readable
129    ///
130    ///
131    /// #### `has-focus`
132    ///  Whether the widget has the input focus.
133    ///
134    /// Readable
135    ///
136    ///
137    /// #### `has-tooltip`
138    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
139    /// signal on @widget.
140    ///
141    /// A true value indicates that @widget can have a tooltip, in this case
142    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
143    /// determine whether it will provide a tooltip or not.
144    ///
145    /// Readable | Writable
146    ///
147    ///
148    /// #### `height-request`
149    ///  Overrides for height request of the widget.
150    ///
151    /// If this is -1, the natural request will be used.
152    ///
153    /// Readable | Writable
154    ///
155    ///
156    /// #### `hexpand`
157    ///  Whether to expand horizontally.
158    ///
159    /// Readable | Writable
160    ///
161    ///
162    /// #### `hexpand-set`
163    ///  Whether to use the `hexpand` property.
164    ///
165    /// Readable | Writable
166    ///
167    ///
168    /// #### `layout-manager`
169    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
170    /// the preferred size of the widget, and allocate its children.
171    ///
172    /// This property is meant to be set by widget implementations,
173    /// typically in their instance init function.
174    ///
175    /// Readable | Writable
176    ///
177    ///
178    /// #### `limit-events`
179    ///  Makes this widget act like a modal dialog, with respect to
180    /// event delivery.
181    ///
182    /// Global event controllers will not handle events with targets
183    /// inside the widget, unless they are set up to ignore propagation
184    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
185    ///
186    /// Readable | Writable
187    ///
188    ///
189    /// #### `margin-bottom`
190    ///  Margin on bottom side of widget.
191    ///
192    /// This property adds margin outside of the widget's normal size
193    /// request, the margin will be added in addition to the size from
194    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
195    ///
196    /// Readable | Writable
197    ///
198    ///
199    /// #### `margin-end`
200    ///  Margin on end of widget, horizontally.
201    ///
202    /// This property supports left-to-right and right-to-left text
203    /// directions.
204    ///
205    /// This property adds margin outside of the widget's normal size
206    /// request, the margin will be added in addition to the size from
207    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
208    ///
209    /// Readable | Writable
210    ///
211    ///
212    /// #### `margin-start`
213    ///  Margin on start of widget, horizontally.
214    ///
215    /// This property supports left-to-right and right-to-left text
216    /// directions.
217    ///
218    /// This property adds margin outside of the widget's normal size
219    /// request, the margin will be added in addition to the size from
220    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
221    ///
222    /// Readable | Writable
223    ///
224    ///
225    /// #### `margin-top`
226    ///  Margin on top side of widget.
227    ///
228    /// This property adds margin outside of the widget's normal size
229    /// request, the margin will be added in addition to the size from
230    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
231    ///
232    /// Readable | Writable
233    ///
234    ///
235    /// #### `name`
236    ///  The name of the widget.
237    ///
238    /// Readable | Writable
239    ///
240    ///
241    /// #### `opacity`
242    ///  The requested opacity of the widget.
243    ///
244    /// Readable | Writable
245    ///
246    ///
247    /// #### `overflow`
248    ///  How content outside the widget's content area is treated.
249    ///
250    /// This property is meant to be set by widget implementations,
251    /// typically in their instance init function.
252    ///
253    /// Readable | Writable
254    ///
255    ///
256    /// #### `parent`
257    ///  The parent widget of this widget.
258    ///
259    /// Readable
260    ///
261    ///
262    /// #### `receives-default`
263    ///  Whether the widget will receive the default action when it is focused.
264    ///
265    /// Readable | Writable
266    ///
267    ///
268    /// #### `root`
269    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
270    ///
271    /// This will be `NULL` if the widget is not contained in a root widget.
272    ///
273    /// Readable
274    ///
275    ///
276    /// #### `scale-factor`
277    ///  The scale factor of the widget.
278    ///
279    /// Readable
280    ///
281    ///
282    /// #### `sensitive`
283    ///  Whether the widget responds to input.
284    ///
285    /// Readable | Writable
286    ///
287    ///
288    /// #### `tooltip-markup`
289    ///  Sets the text of tooltip to be the given string, which is marked up
290    /// with Pango markup.
291    ///
292    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
293    ///
294    /// This is a convenience property which will take care of getting the
295    /// tooltip shown if the given string is not `NULL`:
296    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
297    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
298    /// the default signal handler.
299    ///
300    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
301    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
302    ///
303    /// Readable | Writable
304    ///
305    ///
306    /// #### `tooltip-text`
307    ///  Sets the text of tooltip to be the given string.
308    ///
309    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
310    ///
311    /// This is a convenience property which will take care of getting the
312    /// tooltip shown if the given string is not `NULL`:
313    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
314    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
315    /// the default signal handler.
316    ///
317    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
318    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
319    ///
320    /// Readable | Writable
321    ///
322    ///
323    /// #### `valign`
324    ///  How to distribute vertical space if widget gets extra space.
325    ///
326    /// Readable | Writable
327    ///
328    ///
329    /// #### `vexpand`
330    ///  Whether to expand vertically.
331    ///
332    /// Readable | Writable
333    ///
334    ///
335    /// #### `vexpand-set`
336    ///  Whether to use the `vexpand` property.
337    ///
338    /// Readable | Writable
339    ///
340    ///
341    /// #### `visible`
342    ///  Whether the widget is visible.
343    ///
344    /// Readable | Writable
345    ///
346    ///
347    /// #### `width-request`
348    ///  Overrides for width request of the widget.
349    ///
350    /// If this is -1, the natural request will be used.
351    ///
352    /// Readable | Writable
353    /// </details>
354    /// <details><summary><h4>Accessible</h4></summary>
355    ///
356    ///
357    /// #### `accessible-role`
358    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
359    ///
360    /// The accessible role cannot be changed once set.
361    ///
362    /// Readable | Writable
363    /// </details>
364    /// <details><summary><h4>FileChooser</h4></summary>
365    ///
366    ///
367    /// #### `action`
368    ///  The type of operation that the file chooser is performing.
369    ///
370    /// Readable | Writable
371    ///
372    ///
373    /// #### `create-folders`
374    ///  Whether a file chooser not in [`FileChooserAction::Open`][crate::FileChooserAction::Open] mode
375    /// will offer the user to create new folders.
376    ///
377    /// Readable | Writable
378    ///
379    ///
380    /// #### `filter`
381    ///  The current filter for selecting files that are displayed.
382    ///
383    /// Readable | Writable
384    ///
385    ///
386    /// #### `filters`
387    ///  A `GListModel` containing the filters that have been
388    /// added with gtk_file_chooser_add_filter().
389    ///
390    /// The returned object should not be modified. It may
391    /// or may not be updated for later changes.
392    ///
393    /// Readable
394    ///
395    ///
396    /// #### `select-multiple`
397    ///  Whether to allow multiple files to be selected.
398    ///
399    /// Readable | Writable
400    ///
401    ///
402    /// #### `shortcut-folders`
403    ///  A `GListModel` containing the shortcut folders that have been
404    /// added with gtk_file_chooser_add_shortcut_folder().
405    ///
406    /// The returned object should not be modified. It may
407    /// or may not be updated for later changes.
408    ///
409    /// Readable
410    /// </details>
411    ///
412    /// ## Signals
413    ///
414    ///
415    /// #### `desktop-folder`
416    ///  .
417    ///
418    /// Action
419    ///
420    ///
421    /// #### `down-folder`
422    ///  .
423    ///
424    /// Action
425    ///
426    ///
427    /// #### `home-folder`
428    ///  .
429    ///
430    /// Action
431    ///
432    ///
433    /// #### `location-popup`
434    ///   (tilde) with a @path string of "~" itself for
435    /// access to home directories.
436    ///
437    /// Action
438    ///
439    ///
440    /// #### `location-popup-on-paste`
441    ///  .
442    ///
443    /// Action
444    ///
445    ///
446    /// #### `location-toggle-popup`
447    ///  .
448    ///
449    /// Action
450    ///
451    ///
452    /// #### `places-shortcut`
453    ///  .
454    ///
455    /// Action
456    ///
457    ///
458    /// #### `quick-bookmark`
459    ///   is
460    /// actually defined to switch to the bookmark at index 0, and so on
461    /// successively.
462    ///
463    /// Action
464    ///
465    ///
466    /// #### `recent-shortcut`
467    ///  .
468    ///
469    /// Action
470    ///
471    ///
472    /// #### `search-shortcut`
473    ///  .
474    ///
475    /// Action
476    ///
477    ///
478    /// #### `show-hidden`
479    ///  .
480    ///
481    /// Action
482    ///
483    ///
484    /// #### `up-folder`
485    ///  .
486    ///
487    /// Action
488    /// <details><summary><h4>Widget</h4></summary>
489    ///
490    ///
491    /// #### `destroy`
492    ///  Signals that all holders of a reference to the widget should release
493    /// the reference that they hold.
494    ///
495    /// May result in finalization of the widget if all references are released.
496    ///
497    /// This signal is not suitable for saving widget state.
498    ///
499    ///
500    ///
501    ///
502    /// #### `direction-changed`
503    ///  Emitted when the text direction of a widget changes.
504    ///
505    ///
506    ///
507    ///
508    /// #### `hide`
509    ///  Emitted when @widget is hidden.
510    ///
511    ///
512    ///
513    ///
514    /// #### `keynav-failed`
515    ///  Emitted if keyboard navigation fails.
516    ///
517    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
518    ///
519    ///
520    ///
521    ///
522    /// #### `map`
523    ///  Emitted when @widget is going to be mapped.
524    ///
525    /// A widget is mapped when the widget is visible (which is controlled with
526    /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
527    /// are also visible.
528    ///
529    /// The `::map` signal can be used to determine whether a widget will be drawn,
530    /// for instance it can resume an animation that was stopped during the
531    /// emission of [`unmap`][struct@crate::Widget#unmap].
532    ///
533    ///
534    ///
535    ///
536    /// #### `mnemonic-activate`
537    ///  Emitted when a widget is activated via a mnemonic.
538    ///
539    /// The default handler for this signal activates @widget if @group_cycling
540    /// is false, or just makes @widget grab focus if @group_cycling is true.
541    ///
542    ///
543    ///
544    ///
545    /// #### `move-focus`
546    ///   to move backward.
547    ///
548    /// Action
549    ///
550    ///
551    /// #### `query-tooltip`
552    ///  s tooltip is about to be shown.
553    ///
554    /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
555    /// is true and the hover timeout has expired with the cursor hovering
556    /// above @widget; or emitted when @widget got focus in keyboard mode.
557    ///
558    /// Using the given coordinates, the signal handler should determine
559    /// whether a tooltip should be shown for @widget. If this is the case
560    /// true should be returned, false otherwise. Note that if @keyboard_mode
561    /// is true, the values of @x and @y are undefined and should not be used.
562    ///
563    /// The signal handler is free to manipulate @tooltip with the therefore
564    /// destined function calls.
565    ///
566    ///
567    ///
568    ///
569    /// #### `realize`
570    ///  Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
571    ///
572    /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
573    /// or the widget has been mapped (that is, it is going to be drawn).
574    ///
575    ///
576    ///
577    ///
578    /// #### `show`
579    ///  Emitted when @widget is shown.
580    ///
581    ///
582    ///
583    ///
584    /// #### `state-flags-changed`
585    ///  Emitted when the widget state changes.
586    ///
587    /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
588    ///
589    ///
590    ///
591    ///
592    /// #### `unmap`
593    ///  Emitted when @widget is going to be unmapped.
594    ///
595    /// A widget is unmapped when either it or any of its parents up to the
596    /// toplevel widget have been set as hidden.
597    ///
598    /// As `::unmap` indicates that a widget will not be shown any longer,
599    /// it can be used to, for example, stop an animation on the widget.
600    ///
601    ///
602    ///
603    ///
604    /// #### `unrealize`
605    ///  Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
606    ///
607    /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
608    /// or the widget has been unmapped (that is, it is going to be hidden).
609    ///
610    ///
611    /// </details>
612    ///
613    /// # Implements
614    ///
615    /// [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`FileChooserExt`][trait@crate::prelude::FileChooserExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual], [`FileChooserExtManual`][trait@crate::prelude::FileChooserExtManual]
616    #[doc(alias = "GtkFileChooserWidget")]
617    pub struct FileChooserWidget(Object<ffi::GtkFileChooserWidget>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, FileChooser;
618
619    match fn {
620        type_ => || ffi::gtk_file_chooser_widget_get_type(),
621    }
622}
623
624#[cfg(not(feature = "v4_10"))]
625glib::wrapper! {
626    #[doc(alias = "GtkFileChooserWidget")]
627    pub struct FileChooserWidget(Object<ffi::GtkFileChooserWidget>) @extends Widget, @implements Buildable, ConstraintTarget, FileChooser;
628
629    match fn {
630        type_ => || ffi::gtk_file_chooser_widget_get_type(),
631    }
632}
633
634impl FileChooserWidget {
635    /// Creates a new [`FileChooserWidget`][crate::FileChooserWidget].
636    ///
637    /// This is a file chooser widget that can be embedded in custom
638    /// windows, and it is the same widget that is used by
639    /// [`FileChooserDialog`][crate::FileChooserDialog].
640    ///
641    /// # Deprecated since 4.10
642    ///
643    /// Direct use of [`FileChooserWidget`][crate::FileChooserWidget] is deprecated
644    /// ## `action`
645    /// Open or save mode for the widget
646    ///
647    /// # Returns
648    ///
649    /// a new [`FileChooserWidget`][crate::FileChooserWidget]
650    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
651    #[allow(deprecated)]
652    #[doc(alias = "gtk_file_chooser_widget_new")]
653    pub fn new(action: FileChooserAction) -> FileChooserWidget {
654        assert_initialized_main_thread!();
655        unsafe {
656            Widget::from_glib_none(ffi::gtk_file_chooser_widget_new(action.into_glib()))
657                .unsafe_cast()
658        }
659    }
660
661    // rustdoc-stripper-ignore-next
662    /// Creates a new builder-pattern struct instance to construct [`FileChooserWidget`] objects.
663    ///
664    /// This method returns an instance of [`FileChooserWidgetBuilder`](crate::builders::FileChooserWidgetBuilder) which can be used to create [`FileChooserWidget`] objects.
665    pub fn builder() -> FileChooserWidgetBuilder {
666        FileChooserWidgetBuilder::new()
667    }
668
669    /// Whether search mode is enabled.
670    #[doc(alias = "search-mode")]
671    pub fn is_search_mode(&self) -> bool {
672        ObjectExt::property(self, "search-mode")
673    }
674
675    /// Whether search mode is enabled.
676    #[doc(alias = "search-mode")]
677    pub fn set_search_mode(&self, search_mode: bool) {
678        ObjectExt::set_property(self, "search-mode", search_mode)
679    }
680
681    /// Whether to show the time.
682    #[cfg(feature = "v4_10")]
683    #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
684    #[doc(alias = "show-time")]
685    pub fn shows_time(&self) -> bool {
686        ObjectExt::property(self, "show-time")
687    }
688
689    /// The subtitle of the file chooser widget.
690    pub fn subtitle(&self) -> Option<glib::GString> {
691        ObjectExt::property(self, "subtitle")
692    }
693
694    /// .
695    #[doc(alias = "desktop-folder")]
696    pub fn connect_desktop_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
697        unsafe extern "C" fn desktop_folder_trampoline<F: Fn(&FileChooserWidget) + 'static>(
698            this: *mut ffi::GtkFileChooserWidget,
699            f: glib::ffi::gpointer,
700        ) {
701            unsafe {
702                let f: &F = &*(f as *const F);
703                f(&from_glib_borrow(this))
704            }
705        }
706        unsafe {
707            let f: Box_<F> = Box_::new(f);
708            connect_raw(
709                self.as_ptr() as *mut _,
710                c"desktop-folder".as_ptr(),
711                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
712                    desktop_folder_trampoline::<F> as *const (),
713                )),
714                Box_::into_raw(f),
715            )
716        }
717    }
718
719    pub fn emit_desktop_folder(&self) {
720        self.emit_by_name::<()>("desktop-folder", &[]);
721    }
722
723    /// .
724    #[doc(alias = "down-folder")]
725    pub fn connect_down_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
726        unsafe extern "C" fn down_folder_trampoline<F: Fn(&FileChooserWidget) + 'static>(
727            this: *mut ffi::GtkFileChooserWidget,
728            f: glib::ffi::gpointer,
729        ) {
730            unsafe {
731                let f: &F = &*(f as *const F);
732                f(&from_glib_borrow(this))
733            }
734        }
735        unsafe {
736            let f: Box_<F> = Box_::new(f);
737            connect_raw(
738                self.as_ptr() as *mut _,
739                c"down-folder".as_ptr(),
740                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
741                    down_folder_trampoline::<F> as *const (),
742                )),
743                Box_::into_raw(f),
744            )
745        }
746    }
747
748    pub fn emit_down_folder(&self) {
749        self.emit_by_name::<()>("down-folder", &[]);
750    }
751
752    /// .
753    #[doc(alias = "home-folder")]
754    pub fn connect_home_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
755        unsafe extern "C" fn home_folder_trampoline<F: Fn(&FileChooserWidget) + 'static>(
756            this: *mut ffi::GtkFileChooserWidget,
757            f: glib::ffi::gpointer,
758        ) {
759            unsafe {
760                let f: &F = &*(f as *const F);
761                f(&from_glib_borrow(this))
762            }
763        }
764        unsafe {
765            let f: Box_<F> = Box_::new(f);
766            connect_raw(
767                self.as_ptr() as *mut _,
768                c"home-folder".as_ptr(),
769                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
770                    home_folder_trampoline::<F> as *const (),
771                )),
772                Box_::into_raw(f),
773            )
774        }
775    }
776
777    pub fn emit_home_folder(&self) {
778        self.emit_by_name::<()>("home-folder", &[]);
779    }
780
781    ///  (tilde) with a @path string of "~" itself for
782    /// access to home directories.
783    /// ## `path`
784    /// a string that gets put in the text entry for the file name
785    #[doc(alias = "location-popup")]
786    pub fn connect_location_popup<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId {
787        unsafe extern "C" fn location_popup_trampoline<
788            F: Fn(&FileChooserWidget, &str) + 'static,
789        >(
790            this: *mut ffi::GtkFileChooserWidget,
791            path: *mut std::ffi::c_char,
792            f: glib::ffi::gpointer,
793        ) {
794            unsafe {
795                let f: &F = &*(f as *const F);
796                f(
797                    &from_glib_borrow(this),
798                    &glib::GString::from_glib_borrow(path),
799                )
800            }
801        }
802        unsafe {
803            let f: Box_<F> = Box_::new(f);
804            connect_raw(
805                self.as_ptr() as *mut _,
806                c"location-popup".as_ptr(),
807                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
808                    location_popup_trampoline::<F> as *const (),
809                )),
810                Box_::into_raw(f),
811            )
812        }
813    }
814
815    pub fn emit_location_popup(&self, path: &str) {
816        self.emit_by_name::<()>("location-popup", &[&path]);
817    }
818
819    /// .
820    #[doc(alias = "location-popup-on-paste")]
821    pub fn connect_location_popup_on_paste<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
822        unsafe extern "C" fn location_popup_on_paste_trampoline<
823            F: Fn(&FileChooserWidget) + 'static,
824        >(
825            this: *mut ffi::GtkFileChooserWidget,
826            f: glib::ffi::gpointer,
827        ) {
828            unsafe {
829                let f: &F = &*(f as *const F);
830                f(&from_glib_borrow(this))
831            }
832        }
833        unsafe {
834            let f: Box_<F> = Box_::new(f);
835            connect_raw(
836                self.as_ptr() as *mut _,
837                c"location-popup-on-paste".as_ptr(),
838                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
839                    location_popup_on_paste_trampoline::<F> as *const (),
840                )),
841                Box_::into_raw(f),
842            )
843        }
844    }
845
846    pub fn emit_location_popup_on_paste(&self) {
847        self.emit_by_name::<()>("location-popup-on-paste", &[]);
848    }
849
850    /// .
851    #[doc(alias = "location-toggle-popup")]
852    pub fn connect_location_toggle_popup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
853        unsafe extern "C" fn location_toggle_popup_trampoline<
854            F: Fn(&FileChooserWidget) + 'static,
855        >(
856            this: *mut ffi::GtkFileChooserWidget,
857            f: glib::ffi::gpointer,
858        ) {
859            unsafe {
860                let f: &F = &*(f as *const F);
861                f(&from_glib_borrow(this))
862            }
863        }
864        unsafe {
865            let f: Box_<F> = Box_::new(f);
866            connect_raw(
867                self.as_ptr() as *mut _,
868                c"location-toggle-popup".as_ptr(),
869                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
870                    location_toggle_popup_trampoline::<F> as *const (),
871                )),
872                Box_::into_raw(f),
873            )
874        }
875    }
876
877    pub fn emit_location_toggle_popup(&self) {
878        self.emit_by_name::<()>("location-toggle-popup", &[]);
879    }
880
881    /// .
882    #[doc(alias = "places-shortcut")]
883    pub fn connect_places_shortcut<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
884        unsafe extern "C" fn places_shortcut_trampoline<F: Fn(&FileChooserWidget) + 'static>(
885            this: *mut ffi::GtkFileChooserWidget,
886            f: glib::ffi::gpointer,
887        ) {
888            unsafe {
889                let f: &F = &*(f as *const F);
890                f(&from_glib_borrow(this))
891            }
892        }
893        unsafe {
894            let f: Box_<F> = Box_::new(f);
895            connect_raw(
896                self.as_ptr() as *mut _,
897                c"places-shortcut".as_ptr(),
898                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
899                    places_shortcut_trampoline::<F> as *const (),
900                )),
901                Box_::into_raw(f),
902            )
903        }
904    }
905
906    pub fn emit_places_shortcut(&self) {
907        self.emit_by_name::<()>("places-shortcut", &[]);
908    }
909
910    ///  is
911    /// actually defined to switch to the bookmark at index 0, and so on
912    /// successively.
913    /// ## `bookmark_index`
914    /// the number of the bookmark to switch to
915    #[doc(alias = "quick-bookmark")]
916    pub fn connect_quick_bookmark<F: Fn(&Self, i32) + 'static>(&self, f: F) -> SignalHandlerId {
917        unsafe extern "C" fn quick_bookmark_trampoline<F: Fn(&FileChooserWidget, i32) + 'static>(
918            this: *mut ffi::GtkFileChooserWidget,
919            bookmark_index: std::ffi::c_int,
920            f: glib::ffi::gpointer,
921        ) {
922            unsafe {
923                let f: &F = &*(f as *const F);
924                f(&from_glib_borrow(this), bookmark_index)
925            }
926        }
927        unsafe {
928            let f: Box_<F> = Box_::new(f);
929            connect_raw(
930                self.as_ptr() as *mut _,
931                c"quick-bookmark".as_ptr(),
932                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
933                    quick_bookmark_trampoline::<F> as *const (),
934                )),
935                Box_::into_raw(f),
936            )
937        }
938    }
939
940    pub fn emit_quick_bookmark(&self, bookmark_index: i32) {
941        self.emit_by_name::<()>("quick-bookmark", &[&bookmark_index]);
942    }
943
944    /// .
945    #[doc(alias = "recent-shortcut")]
946    pub fn connect_recent_shortcut<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
947        unsafe extern "C" fn recent_shortcut_trampoline<F: Fn(&FileChooserWidget) + 'static>(
948            this: *mut ffi::GtkFileChooserWidget,
949            f: glib::ffi::gpointer,
950        ) {
951            unsafe {
952                let f: &F = &*(f as *const F);
953                f(&from_glib_borrow(this))
954            }
955        }
956        unsafe {
957            let f: Box_<F> = Box_::new(f);
958            connect_raw(
959                self.as_ptr() as *mut _,
960                c"recent-shortcut".as_ptr(),
961                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
962                    recent_shortcut_trampoline::<F> as *const (),
963                )),
964                Box_::into_raw(f),
965            )
966        }
967    }
968
969    pub fn emit_recent_shortcut(&self) {
970        self.emit_by_name::<()>("recent-shortcut", &[]);
971    }
972
973    /// .
974    #[doc(alias = "search-shortcut")]
975    pub fn connect_search_shortcut<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
976        unsafe extern "C" fn search_shortcut_trampoline<F: Fn(&FileChooserWidget) + 'static>(
977            this: *mut ffi::GtkFileChooserWidget,
978            f: glib::ffi::gpointer,
979        ) {
980            unsafe {
981                let f: &F = &*(f as *const F);
982                f(&from_glib_borrow(this))
983            }
984        }
985        unsafe {
986            let f: Box_<F> = Box_::new(f);
987            connect_raw(
988                self.as_ptr() as *mut _,
989                c"search-shortcut".as_ptr(),
990                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
991                    search_shortcut_trampoline::<F> as *const (),
992                )),
993                Box_::into_raw(f),
994            )
995        }
996    }
997
998    pub fn emit_search_shortcut(&self) {
999        self.emit_by_name::<()>("search-shortcut", &[]);
1000    }
1001
1002    /// .
1003    #[doc(alias = "show-hidden")]
1004    pub fn connect_show_hidden<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1005        unsafe extern "C" fn show_hidden_trampoline<F: Fn(&FileChooserWidget) + 'static>(
1006            this: *mut ffi::GtkFileChooserWidget,
1007            f: glib::ffi::gpointer,
1008        ) {
1009            unsafe {
1010                let f: &F = &*(f as *const F);
1011                f(&from_glib_borrow(this))
1012            }
1013        }
1014        unsafe {
1015            let f: Box_<F> = Box_::new(f);
1016            connect_raw(
1017                self.as_ptr() as *mut _,
1018                c"show-hidden".as_ptr(),
1019                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1020                    show_hidden_trampoline::<F> as *const (),
1021                )),
1022                Box_::into_raw(f),
1023            )
1024        }
1025    }
1026
1027    pub fn emit_show_hidden(&self) {
1028        self.emit_by_name::<()>("show-hidden", &[]);
1029    }
1030
1031    /// .
1032    #[doc(alias = "up-folder")]
1033    pub fn connect_up_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1034        unsafe extern "C" fn up_folder_trampoline<F: Fn(&FileChooserWidget) + 'static>(
1035            this: *mut ffi::GtkFileChooserWidget,
1036            f: glib::ffi::gpointer,
1037        ) {
1038            unsafe {
1039                let f: &F = &*(f as *const F);
1040                f(&from_glib_borrow(this))
1041            }
1042        }
1043        unsafe {
1044            let f: Box_<F> = Box_::new(f);
1045            connect_raw(
1046                self.as_ptr() as *mut _,
1047                c"up-folder".as_ptr(),
1048                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1049                    up_folder_trampoline::<F> as *const (),
1050                )),
1051                Box_::into_raw(f),
1052            )
1053        }
1054    }
1055
1056    pub fn emit_up_folder(&self) {
1057        self.emit_by_name::<()>("up-folder", &[]);
1058    }
1059
1060    #[doc(alias = "search-mode")]
1061    pub fn connect_search_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1062        unsafe extern "C" fn notify_search_mode_trampoline<F: Fn(&FileChooserWidget) + 'static>(
1063            this: *mut ffi::GtkFileChooserWidget,
1064            _param_spec: glib::ffi::gpointer,
1065            f: glib::ffi::gpointer,
1066        ) {
1067            unsafe {
1068                let f: &F = &*(f as *const F);
1069                f(&from_glib_borrow(this))
1070            }
1071        }
1072        unsafe {
1073            let f: Box_<F> = Box_::new(f);
1074            connect_raw(
1075                self.as_ptr() as *mut _,
1076                c"notify::search-mode".as_ptr(),
1077                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1078                    notify_search_mode_trampoline::<F> as *const (),
1079                )),
1080                Box_::into_raw(f),
1081            )
1082        }
1083    }
1084
1085    #[cfg(feature = "v4_10")]
1086    #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
1087    #[doc(alias = "show-time")]
1088    pub fn connect_show_time_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1089        unsafe extern "C" fn notify_show_time_trampoline<F: Fn(&FileChooserWidget) + 'static>(
1090            this: *mut ffi::GtkFileChooserWidget,
1091            _param_spec: glib::ffi::gpointer,
1092            f: glib::ffi::gpointer,
1093        ) {
1094            unsafe {
1095                let f: &F = &*(f as *const F);
1096                f(&from_glib_borrow(this))
1097            }
1098        }
1099        unsafe {
1100            let f: Box_<F> = Box_::new(f);
1101            connect_raw(
1102                self.as_ptr() as *mut _,
1103                c"notify::show-time".as_ptr(),
1104                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1105                    notify_show_time_trampoline::<F> as *const (),
1106                )),
1107                Box_::into_raw(f),
1108            )
1109        }
1110    }
1111
1112    #[doc(alias = "subtitle")]
1113    pub fn connect_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1114        unsafe extern "C" fn notify_subtitle_trampoline<F: Fn(&FileChooserWidget) + 'static>(
1115            this: *mut ffi::GtkFileChooserWidget,
1116            _param_spec: glib::ffi::gpointer,
1117            f: glib::ffi::gpointer,
1118        ) {
1119            unsafe {
1120                let f: &F = &*(f as *const F);
1121                f(&from_glib_borrow(this))
1122            }
1123        }
1124        unsafe {
1125            let f: Box_<F> = Box_::new(f);
1126            connect_raw(
1127                self.as_ptr() as *mut _,
1128                c"notify::subtitle".as_ptr(),
1129                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1130                    notify_subtitle_trampoline::<F> as *const (),
1131                )),
1132                Box_::into_raw(f),
1133            )
1134        }
1135    }
1136}
1137
1138impl Default for FileChooserWidget {
1139    fn default() -> Self {
1140        glib::object::Object::new::<Self>()
1141    }
1142}
1143
1144// rustdoc-stripper-ignore-next
1145/// A [builder-pattern] type to construct [`FileChooserWidget`] objects.
1146///
1147/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1148#[must_use = "The builder must be built to be used"]
1149pub struct FileChooserWidgetBuilder {
1150    builder: glib::object::ObjectBuilder<'static, FileChooserWidget>,
1151}
1152
1153impl FileChooserWidgetBuilder {
1154    fn new() -> Self {
1155        Self {
1156            builder: glib::object::Object::builder(),
1157        }
1158    }
1159
1160    /// Whether search mode is enabled.
1161    pub fn search_mode(self, search_mode: bool) -> Self {
1162        Self {
1163            builder: self.builder.property("search-mode", search_mode),
1164        }
1165    }
1166
1167    /// Whether the widget or any of its descendents can accept
1168    /// the input focus.
1169    ///
1170    /// This property is meant to be set by widget implementations,
1171    /// typically in their instance init function.
1172    pub fn can_focus(self, can_focus: bool) -> Self {
1173        Self {
1174            builder: self.builder.property("can-focus", can_focus),
1175        }
1176    }
1177
1178    /// Whether the widget can receive pointer events.
1179    pub fn can_target(self, can_target: bool) -> Self {
1180        Self {
1181            builder: self.builder.property("can-target", can_target),
1182        }
1183    }
1184
1185    /// A list of css classes applied to this widget.
1186    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1187        Self {
1188            builder: self.builder.property("css-classes", css_classes.into()),
1189        }
1190    }
1191
1192    /// The name of this widget in the CSS tree.
1193    ///
1194    /// This property is meant to be set by widget implementations,
1195    /// typically in their instance init function.
1196    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1197        Self {
1198            builder: self.builder.property("css-name", css_name.into()),
1199        }
1200    }
1201
1202    /// The cursor used by @widget.
1203    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1204        Self {
1205            builder: self.builder.property("cursor", cursor.clone()),
1206        }
1207    }
1208
1209    /// Whether the widget should grab focus when it is clicked with the mouse.
1210    ///
1211    /// This property is only relevant for widgets that can take focus.
1212    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1213        Self {
1214            builder: self.builder.property("focus-on-click", focus_on_click),
1215        }
1216    }
1217
1218    /// Whether this widget itself will accept the input focus.
1219    pub fn focusable(self, focusable: bool) -> Self {
1220        Self {
1221            builder: self.builder.property("focusable", focusable),
1222        }
1223    }
1224
1225    /// How to distribute horizontal space if widget gets extra space.
1226    pub fn halign(self, halign: Align) -> Self {
1227        Self {
1228            builder: self.builder.property("halign", halign),
1229        }
1230    }
1231
1232    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1233    /// signal on @widget.
1234    ///
1235    /// A true value indicates that @widget can have a tooltip, in this case
1236    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1237    /// determine whether it will provide a tooltip or not.
1238    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1239        Self {
1240            builder: self.builder.property("has-tooltip", has_tooltip),
1241        }
1242    }
1243
1244    /// Overrides for height request of the widget.
1245    ///
1246    /// If this is -1, the natural request will be used.
1247    pub fn height_request(self, height_request: i32) -> Self {
1248        Self {
1249            builder: self.builder.property("height-request", height_request),
1250        }
1251    }
1252
1253    /// Whether to expand horizontally.
1254    pub fn hexpand(self, hexpand: bool) -> Self {
1255        Self {
1256            builder: self.builder.property("hexpand", hexpand),
1257        }
1258    }
1259
1260    /// Whether to use the `hexpand` property.
1261    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1262        Self {
1263            builder: self.builder.property("hexpand-set", hexpand_set),
1264        }
1265    }
1266
1267    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1268    /// the preferred size of the widget, and allocate its children.
1269    ///
1270    /// This property is meant to be set by widget implementations,
1271    /// typically in their instance init function.
1272    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1273        Self {
1274            builder: self
1275                .builder
1276                .property("layout-manager", layout_manager.clone().upcast()),
1277        }
1278    }
1279
1280    /// Makes this widget act like a modal dialog, with respect to
1281    /// event delivery.
1282    ///
1283    /// Global event controllers will not handle events with targets
1284    /// inside the widget, unless they are set up to ignore propagation
1285    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1286    #[cfg(feature = "v4_18")]
1287    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1288    pub fn limit_events(self, limit_events: bool) -> Self {
1289        Self {
1290            builder: self.builder.property("limit-events", limit_events),
1291        }
1292    }
1293
1294    /// Margin on bottom side of widget.
1295    ///
1296    /// This property adds margin outside of the widget's normal size
1297    /// request, the margin will be added in addition to the size from
1298    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1299    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1300        Self {
1301            builder: self.builder.property("margin-bottom", margin_bottom),
1302        }
1303    }
1304
1305    /// Margin on end of widget, horizontally.
1306    ///
1307    /// This property supports left-to-right and right-to-left text
1308    /// directions.
1309    ///
1310    /// This property adds margin outside of the widget's normal size
1311    /// request, the margin will be added in addition to the size from
1312    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1313    pub fn margin_end(self, margin_end: i32) -> Self {
1314        Self {
1315            builder: self.builder.property("margin-end", margin_end),
1316        }
1317    }
1318
1319    /// Margin on start of widget, horizontally.
1320    ///
1321    /// This property supports left-to-right and right-to-left text
1322    /// directions.
1323    ///
1324    /// This property adds margin outside of the widget's normal size
1325    /// request, the margin will be added in addition to the size from
1326    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1327    pub fn margin_start(self, margin_start: i32) -> Self {
1328        Self {
1329            builder: self.builder.property("margin-start", margin_start),
1330        }
1331    }
1332
1333    /// Margin on top side of widget.
1334    ///
1335    /// This property adds margin outside of the widget's normal size
1336    /// request, the margin will be added in addition to the size from
1337    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1338    pub fn margin_top(self, margin_top: i32) -> Self {
1339        Self {
1340            builder: self.builder.property("margin-top", margin_top),
1341        }
1342    }
1343
1344    /// The name of the widget.
1345    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1346        Self {
1347            builder: self.builder.property("name", name.into()),
1348        }
1349    }
1350
1351    /// The requested opacity of the widget.
1352    pub fn opacity(self, opacity: f64) -> Self {
1353        Self {
1354            builder: self.builder.property("opacity", opacity),
1355        }
1356    }
1357
1358    /// How content outside the widget's content area is treated.
1359    ///
1360    /// This property is meant to be set by widget implementations,
1361    /// typically in their instance init function.
1362    pub fn overflow(self, overflow: Overflow) -> Self {
1363        Self {
1364            builder: self.builder.property("overflow", overflow),
1365        }
1366    }
1367
1368    /// Whether the widget will receive the default action when it is focused.
1369    pub fn receives_default(self, receives_default: bool) -> Self {
1370        Self {
1371            builder: self.builder.property("receives-default", receives_default),
1372        }
1373    }
1374
1375    /// Whether the widget responds to input.
1376    pub fn sensitive(self, sensitive: bool) -> Self {
1377        Self {
1378            builder: self.builder.property("sensitive", sensitive),
1379        }
1380    }
1381
1382    /// Sets the text of tooltip to be the given string, which is marked up
1383    /// with Pango markup.
1384    ///
1385    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1386    ///
1387    /// This is a convenience property which will take care of getting the
1388    /// tooltip shown if the given string is not `NULL`:
1389    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1390    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1391    /// the default signal handler.
1392    ///
1393    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1394    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1395    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1396        Self {
1397            builder: self
1398                .builder
1399                .property("tooltip-markup", tooltip_markup.into()),
1400        }
1401    }
1402
1403    /// Sets the text of tooltip to be the given string.
1404    ///
1405    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1406    ///
1407    /// This is a convenience property which will take care of getting the
1408    /// tooltip shown if the given string is not `NULL`:
1409    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1410    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1411    /// the default signal handler.
1412    ///
1413    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1414    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1415    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1416        Self {
1417            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1418        }
1419    }
1420
1421    /// How to distribute vertical space if widget gets extra space.
1422    pub fn valign(self, valign: Align) -> Self {
1423        Self {
1424            builder: self.builder.property("valign", valign),
1425        }
1426    }
1427
1428    /// Whether to expand vertically.
1429    pub fn vexpand(self, vexpand: bool) -> Self {
1430        Self {
1431            builder: self.builder.property("vexpand", vexpand),
1432        }
1433    }
1434
1435    /// Whether to use the `vexpand` property.
1436    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1437        Self {
1438            builder: self.builder.property("vexpand-set", vexpand_set),
1439        }
1440    }
1441
1442    /// Whether the widget is visible.
1443    pub fn visible(self, visible: bool) -> Self {
1444        Self {
1445            builder: self.builder.property("visible", visible),
1446        }
1447    }
1448
1449    /// Overrides for width request of the widget.
1450    ///
1451    /// If this is -1, the natural request will be used.
1452    pub fn width_request(self, width_request: i32) -> Self {
1453        Self {
1454            builder: self.builder.property("width-request", width_request),
1455        }
1456    }
1457
1458    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1459    ///
1460    /// The accessible role cannot be changed once set.
1461    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1462        Self {
1463            builder: self.builder.property("accessible-role", accessible_role),
1464        }
1465    }
1466
1467    /// The type of operation that the file chooser is performing.
1468    /// Use [`FileDialog`][crate::FileDialog] instead
1469    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1470    pub fn action(self, action: FileChooserAction) -> Self {
1471        Self {
1472            builder: self.builder.property("action", action),
1473        }
1474    }
1475
1476    /// Whether a file chooser not in [`FileChooserAction::Open`][crate::FileChooserAction::Open] mode
1477    /// will offer the user to create new folders.
1478    /// Use [`FileDialog`][crate::FileDialog] instead
1479    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1480    pub fn create_folders(self, create_folders: bool) -> Self {
1481        Self {
1482            builder: self.builder.property("create-folders", create_folders),
1483        }
1484    }
1485
1486    /// The current filter for selecting files that are displayed.
1487    /// Use [`FileDialog`][crate::FileDialog] instead
1488    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1489    pub fn filter(self, filter: &FileFilter) -> Self {
1490        Self {
1491            builder: self.builder.property("filter", filter.clone()),
1492        }
1493    }
1494
1495    /// Whether to allow multiple files to be selected.
1496    /// Use [`FileDialog`][crate::FileDialog] instead
1497    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1498    pub fn select_multiple(self, select_multiple: bool) -> Self {
1499        Self {
1500            builder: self.builder.property("select-multiple", select_multiple),
1501        }
1502    }
1503
1504    // rustdoc-stripper-ignore-next
1505    /// Build the [`FileChooserWidget`].
1506    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1507    pub fn build(self) -> FileChooserWidget {
1508        assert_initialized_main_thread!();
1509        self.builder.build()
1510    }
1511}