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