Skip to main content

gtk/auto/
file_chooser_button.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{
6    Align, BaselinePosition, Box, Buildable, Container, Dialog, FileChooser, FileChooserAction,
7    FileFilter, Orientable, Orientation, ResizeMode, Widget, ffi,
8};
9use glib::{
10    object::ObjectType as _,
11    prelude::*,
12    signal::{SignalHandlerId, connect_raw},
13    translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18    /// The [`FileChooserButton`][crate::FileChooserButton] is a widget that lets the user select a
19    /// file. It implements the [`FileChooser`][crate::FileChooser] interface. Visually, it is a
20    /// file name with a button to bring up a [`FileChooserDialog`][crate::FileChooserDialog].
21    /// The user can then use that dialog to change the file associated with
22    /// that button. This widget does not support setting the
23    /// [`select-multiple`][struct@crate::FileChooser#select-multiple] property to [`true`].
24    ///
25    /// ## Create a button to let the user select a file in /etc
26    ///
27    ///
28    ///
29    /// **⚠️ The following code is in C ⚠️**
30    ///
31    /// ```C
32    /// {
33    ///   GtkWidget *button;
34    ///
35    ///   button = gtk_file_chooser_button_new (_("Select a file"),
36    ///                                         GTK_FILE_CHOOSER_ACTION_OPEN);
37    ///   gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (button),
38    ///                                        "/etc");
39    /// }
40    /// ```
41    ///
42    /// The [`FileChooserButton`][crate::FileChooserButton] supports the `GtkFileChooserActions`
43    /// [`FileChooserAction::Open`][crate::FileChooserAction::Open] and [`FileChooserAction::SelectFolder`][crate::FileChooserAction::SelectFolder].
44    ///
45    /// > The [`FileChooserButton`][crate::FileChooserButton] will ellipsize the label, and will thus
46    /// > request little horizontal space. To give the button more space,
47    /// > you should call [`WidgetExt::preferred_size()`][crate::prelude::WidgetExt::preferred_size()],
48    /// > [`FileChooserButtonExt::set_width_chars()`][crate::prelude::FileChooserButtonExt::set_width_chars()], or pack the button in
49    /// > such a way that other interface elements give space to the
50    /// > widget.
51    ///
52    /// # CSS nodes
53    ///
54    /// GtkFileChooserButton has a CSS node with name “filechooserbutton”, containing
55    /// a subnode for the internal button with name “button” and style class “.file”.
56    ///
57    /// ## Properties
58    ///
59    ///
60    /// #### `dialog`
61    ///  Instance of the [`FileChooserDialog`][crate::FileChooserDialog] associated with the button.
62    ///
63    /// Writable | Construct Only
64    ///
65    ///
66    /// #### `title`
67    ///  Title to put on the [`FileChooserDialog`][crate::FileChooserDialog] associated with the button.
68    ///
69    /// Readable | Writable
70    ///
71    ///
72    /// #### `width-chars`
73    ///  The width of the entry and label inside the button, in characters.
74    ///
75    /// Readable | Writable
76    /// <details><summary><h4>Box</h4></summary>
77    ///
78    ///
79    /// #### `baseline-position`
80    ///  Readable | Writable
81    ///
82    ///
83    /// #### `homogeneous`
84    ///  Readable | Writable
85    ///
86    ///
87    /// #### `spacing`
88    ///  Readable | Writable
89    /// </details>
90    /// <details><summary><h4>Container</h4></summary>
91    ///
92    ///
93    /// #### `border-width`
94    ///  Readable | Writable
95    ///
96    ///
97    /// #### `child`
98    ///  Writable
99    ///
100    ///
101    /// #### `resize-mode`
102    ///  Readable | Writable
103    /// </details>
104    /// <details><summary><h4>Widget</h4></summary>
105    ///
106    ///
107    /// #### `app-paintable`
108    ///  Readable | Writable
109    ///
110    ///
111    /// #### `can-default`
112    ///  Readable | Writable
113    ///
114    ///
115    /// #### `can-focus`
116    ///  Readable | Writable
117    ///
118    ///
119    /// #### `composite-child`
120    ///  Readable
121    ///
122    ///
123    /// #### `double-buffered`
124    ///  Whether the widget is double buffered.
125    ///
126    /// Readable | Writable
127    ///
128    ///
129    /// #### `events`
130    ///  Readable | Writable
131    ///
132    ///
133    /// #### `expand`
134    ///  Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
135    ///
136    /// Readable | Writable
137    ///
138    ///
139    /// #### `focus-on-click`
140    ///  Whether the widget should grab focus when it is clicked with the mouse.
141    ///
142    /// This property is only relevant for widgets that can take focus.
143    ///
144    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
145    /// GtkComboBox) implemented this property individually.
146    ///
147    /// Readable | Writable
148    ///
149    ///
150    /// #### `halign`
151    ///  How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
152    ///
153    /// Readable | Writable
154    ///
155    ///
156    /// #### `has-default`
157    ///  Readable | Writable
158    ///
159    ///
160    /// #### `has-focus`
161    ///  Readable | Writable
162    ///
163    ///
164    /// #### `has-tooltip`
165    ///  Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
166    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
167    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
168    /// whether it will provide a tooltip or not.
169    ///
170    /// Note that setting this property to [`true`] for the first time will change
171    /// the event masks of the GdkWindows of this widget to include leave-notify
172    /// and motion-notify events. This cannot and will not be undone when the
173    /// property is set to [`false`] again.
174    ///
175    /// Readable | Writable
176    ///
177    ///
178    /// #### `height-request`
179    ///  Readable | Writable
180    ///
181    ///
182    /// #### `hexpand`
183    ///  Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
184    ///
185    /// Readable | Writable
186    ///
187    ///
188    /// #### `hexpand-set`
189    ///  Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
190    ///
191    /// Readable | Writable
192    ///
193    ///
194    /// #### `is-focus`
195    ///  Readable | Writable
196    ///
197    ///
198    /// #### `margin`
199    ///  Sets all four sides' margin at once. If read, returns max
200    /// margin on any side.
201    ///
202    /// Readable | Writable
203    ///
204    ///
205    /// #### `margin-bottom`
206    ///  Margin on bottom side of widget.
207    ///
208    /// This property adds margin outside of the widget's normal size
209    /// request, the margin will be added in addition to the size from
210    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
211    ///
212    /// Readable | Writable
213    ///
214    ///
215    /// #### `margin-end`
216    ///  Margin on end of widget, horizontally. This property supports
217    /// left-to-right and right-to-left text directions.
218    ///
219    /// This property adds margin outside of the widget's normal size
220    /// request, the margin will be added in addition to the size from
221    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
222    ///
223    /// Readable | Writable
224    ///
225    ///
226    /// #### `margin-left`
227    ///  Margin on left side of widget.
228    ///
229    /// This property adds margin outside of the widget's normal size
230    /// request, the margin will be added in addition to the size from
231    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
232    ///
233    /// Readable | Writable
234    ///
235    ///
236    /// #### `margin-right`
237    ///  Margin on right side of widget.
238    ///
239    /// This property adds margin outside of the widget's normal size
240    /// request, the margin will be added in addition to the size from
241    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
242    ///
243    /// Readable | Writable
244    ///
245    ///
246    /// #### `margin-start`
247    ///  Margin on start of widget, horizontally. This property supports
248    /// left-to-right and right-to-left text directions.
249    ///
250    /// This property adds margin outside of the widget's normal size
251    /// request, the margin will be added in addition to the size from
252    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
253    ///
254    /// Readable | Writable
255    ///
256    ///
257    /// #### `margin-top`
258    ///  Margin on top side of widget.
259    ///
260    /// This property adds margin outside of the widget's normal size
261    /// request, the margin will be added in addition to the size from
262    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
263    ///
264    /// Readable | Writable
265    ///
266    ///
267    /// #### `name`
268    ///  Readable | Writable
269    ///
270    ///
271    /// #### `no-show-all`
272    ///  Readable | Writable
273    ///
274    ///
275    /// #### `opacity`
276    ///  The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
277    /// more details about window opacity.
278    ///
279    /// Before 3.8 this was only available in GtkWindow
280    ///
281    /// Readable | Writable
282    ///
283    ///
284    /// #### `parent`
285    ///  Readable | Writable
286    ///
287    ///
288    /// #### `receives-default`
289    ///  Readable | Writable
290    ///
291    ///
292    /// #### `scale-factor`
293    ///  The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
294    /// more details about widget scaling.
295    ///
296    /// Readable
297    ///
298    ///
299    /// #### `sensitive`
300    ///  Readable | Writable
301    ///
302    ///
303    /// #### `style`
304    ///  The style of the widget, which contains information about how it will look (colors, etc).
305    ///
306    /// Readable | Writable
307    ///
308    ///
309    /// #### `tooltip-markup`
310    ///  Sets the text of tooltip to be the given string, which is marked up
311    /// with the [Pango text markup language][PangoMarkupFormat].
312    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
313    ///
314    /// This is a convenience property which will take care of getting the
315    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
316    /// will automatically be set to [`true`] and there will be taken care of
317    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
318    ///
319    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
320    /// are set, the last one wins.
321    ///
322    /// Readable | Writable
323    ///
324    ///
325    /// #### `tooltip-text`
326    ///  Sets the text of tooltip to be the given string.
327    ///
328    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
329    ///
330    /// This is a convenience property which will take care of getting the
331    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
332    /// will automatically be set to [`true`] and there will be taken care of
333    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
334    ///
335    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
336    /// are set, the last one wins.
337    ///
338    /// Readable | Writable
339    ///
340    ///
341    /// #### `valign`
342    ///  How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
343    ///
344    /// Readable | Writable
345    ///
346    ///
347    /// #### `vexpand`
348    ///  Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
349    ///
350    /// Readable | Writable
351    ///
352    ///
353    /// #### `vexpand-set`
354    ///  Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
355    ///
356    /// Readable | Writable
357    ///
358    ///
359    /// #### `visible`
360    ///  Readable | Writable
361    ///
362    ///
363    /// #### `width-request`
364    ///  Readable | Writable
365    ///
366    ///
367    /// #### `window`
368    ///  The widget's window if it is realized, [`None`] otherwise.
369    ///
370    /// Readable
371    /// </details>
372    /// <details><summary><h4>Orientable</h4></summary>
373    ///
374    ///
375    /// #### `orientation`
376    ///  The orientation of the orientable.
377    ///
378    /// Readable | Writable
379    /// </details>
380    /// <details><summary><h4>FileChooser</h4></summary>
381    ///
382    ///
383    /// #### `action`
384    ///  Readable | Writable
385    ///
386    ///
387    /// #### `create-folders`
388    ///  Whether a file chooser not in [`FileChooserAction::Open`][crate::FileChooserAction::Open] mode
389    /// will offer the user to create new folders.
390    ///
391    /// Readable | Writable
392    ///
393    ///
394    /// #### `do-overwrite-confirmation`
395    ///  Whether a file chooser in [`FileChooserAction::Save`][crate::FileChooserAction::Save] mode
396    /// will present an overwrite confirmation dialog if the user
397    /// selects a file name that already exists.
398    ///
399    /// Readable | Writable
400    ///
401    ///
402    /// #### `extra-widget`
403    ///  Readable | Writable
404    ///
405    ///
406    /// #### `filter`
407    ///  Readable | Writable
408    ///
409    ///
410    /// #### `local-only`
411    ///  Readable | Writable
412    ///
413    ///
414    /// #### `preview-widget`
415    ///  Readable | Writable
416    ///
417    ///
418    /// #### `preview-widget-active`
419    ///  Readable | Writable
420    ///
421    ///
422    /// #### `select-multiple`
423    ///  Readable | Writable
424    ///
425    ///
426    /// #### `show-hidden`
427    ///  Readable | Writable
428    ///
429    ///
430    /// #### `use-preview-label`
431    ///  Readable | Writable
432    /// </details>
433    ///
434    /// ## Signals
435    ///
436    ///
437    /// #### `file-set`
438    ///  The ::file-set signal is emitted when the user selects a file.
439    ///
440    /// Note that this signal is only emitted when the user
441    /// changes the file.
442    ///
443    ///
444    /// <details><summary><h4>Container</h4></summary>
445    ///
446    ///
447    /// #### `add`
448    ///
449    ///
450    ///
451    /// #### `check-resize`
452    ///
453    ///
454    ///
455    /// #### `remove`
456    ///
457    ///
458    ///
459    /// #### `set-focus-child`
460    ///
461    /// </details>
462    /// <details><summary><h4>Widget</h4></summary>
463    ///
464    ///
465    /// #### `accel-closures-changed`
466    ///
467    ///
468    ///
469    /// #### `button-press-event`
470    ///  The ::button-press-event signal will be emitted when a button
471    /// (typically from a mouse) is pressed.
472    ///
473    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
474    /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
475    ///
476    /// This signal will be sent to the grab widget if there is one.
477    ///
478    ///
479    ///
480    ///
481    /// #### `button-release-event`
482    ///  The ::button-release-event signal will be emitted when a button
483    /// (typically from a mouse) is released.
484    ///
485    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
486    /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
487    ///
488    /// This signal will be sent to the grab widget if there is one.
489    ///
490    ///
491    ///
492    ///
493    /// #### `can-activate-accel`
494    ///  Determines whether an accelerator that activates the signal
495    /// identified by `signal_id` can currently be activated.
496    /// This signal is present to allow applications and derived
497    /// widgets to override the default [`Widget`][crate::Widget] handling
498    /// for determining whether an accelerator can be activated.
499    ///
500    ///
501    ///
502    ///
503    /// #### `child-notify`
504    ///  The ::child-notify signal is emitted for each
505    /// [child property][child-properties] that has
506    /// changed on an object. The signal's detail holds the property name.
507    ///
508    /// Detailed
509    ///
510    ///
511    /// #### `composited-changed`
512    ///  The ::composited-changed signal is emitted when the composited
513    /// status of `widgets` screen changes.
514    /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
515    ///
516    /// Action
517    ///
518    ///
519    /// #### `configure-event`
520    ///  The ::configure-event signal will be emitted when the size, position or
521    /// stacking of the `widget`'s window has changed.
522    ///
523    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
524    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
525    /// automatically for all new windows.
526    ///
527    ///
528    ///
529    ///
530    /// #### `damage-event`
531    ///  Emitted when a redirected window belonging to `widget` gets drawn into.
532    /// The region/area members of the event shows what area of the redirected
533    /// drawable was drawn into.
534    ///
535    ///
536    ///
537    ///
538    /// #### `delete-event`
539    ///  The ::delete-event signal is emitted if a user requests that
540    /// a toplevel window is closed. The default handler for this signal
541    /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
542    /// this signal will cause the window to be hidden instead, so that
543    /// it can later be shown again without reconstructing it.
544    ///
545    ///
546    ///
547    ///
548    /// #### `destroy`
549    ///  Signals that all holders of a reference to the widget should release
550    /// the reference that they hold. May result in finalization of the widget
551    /// if all references are released.
552    ///
553    /// This signal is not suitable for saving widget state.
554    ///
555    ///
556    ///
557    ///
558    /// #### `destroy-event`
559    ///  The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
560    /// You rarely get this signal, because most widgets disconnect themselves
561    /// from their window before they destroy it, so no widget owns the
562    /// window at destroy time.
563    ///
564    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
565    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
566    /// automatically for all new windows.
567    ///
568    ///
569    ///
570    ///
571    /// #### `direction-changed`
572    ///  The ::direction-changed signal is emitted when the text direction
573    /// of a widget changes.
574    ///
575    ///
576    ///
577    ///
578    /// #### `drag-begin`
579    ///  The ::drag-begin signal is emitted on the drag source when a drag is
580    /// started. A typical reason to connect to this signal is to set up a
581    /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
582    ///
583    /// Note that some widgets set up a drag icon in the default handler of
584    /// this signal, so you may have to use `g_signal_connect_after()` to
585    /// override what the default handler did.
586    ///
587    ///
588    ///
589    ///
590    /// #### `drag-data-delete`
591    ///  The ::drag-data-delete signal is emitted on the drag source when a drag
592    /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
593    /// handler is responsible for deleting the data that has been dropped. What
594    /// "delete" means depends on the context of the drag operation.
595    ///
596    ///
597    ///
598    ///
599    /// #### `drag-data-get`
600    ///  The ::drag-data-get signal is emitted on the drag source when the drop
601    /// site requests the data which is dragged. It is the responsibility of
602    /// the signal handler to fill `data` with the data in the format which
603    /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
604    /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
605    ///
606    ///
607    ///
608    ///
609    /// #### `drag-data-received`
610    ///  The ::drag-data-received signal is emitted on the drop site when the
611    /// dragged data has been received. If the data was received in order to
612    /// determine whether the drop will be accepted, the handler is expected
613    /// to call `gdk_drag_status()` and not finish the drag.
614    /// If the data was received in response to a [`drag-drop`][struct@crate::Widget#drag-drop] signal
615    /// (and this is the last target to be received), the handler for this
616    /// signal is expected to process the received data and then call
617    /// `gtk_drag_finish()`, setting the `success` parameter depending on
618    /// whether the data was processed successfully.
619    ///
620    /// Applications must create some means to determine why the signal was emitted
621    /// and therefore whether to call `gdk_drag_status()` or `gtk_drag_finish()`.
622    ///
623    /// The handler may inspect the selected action with
624    /// [`DragContext::selected_action()`][crate::gdk::DragContext::selected_action()] before calling
625    /// `gtk_drag_finish()`, e.g. to implement [`gdk::DragAction::ASK`][crate::gdk::DragAction::ASK] as
626    /// shown in the following example:
627    ///
628    ///
629    /// **⚠️ The following code is in C ⚠️**
630    ///
631    /// ```C
632    /// void
633    /// drag_data_received (GtkWidget          *widget,
634    ///                     GdkDragContext     *context,
635    ///                     gint                x,
636    ///                     gint                y,
637    ///                     GtkSelectionData   *data,
638    ///                     guint               info,
639    ///                     guint               time)
640    /// {
641    ///   if ((data->length >= 0) && (data->format == 8))
642    ///     {
643    ///       GdkDragAction action;
644    ///
645    ///       // handle data here
646    ///
647    ///       action = gdk_drag_context_get_selected_action (context);
648    ///       if (action == GDK_ACTION_ASK)
649    ///         {
650    ///           GtkWidget *dialog;
651    ///           gint response;
652    ///
653    ///           dialog = gtk_message_dialog_new (NULL,
654    ///                                            GTK_DIALOG_MODAL |
655    ///                                            GTK_DIALOG_DESTROY_WITH_PARENT,
656    ///                                            GTK_MESSAGE_INFO,
657    ///                                            GTK_BUTTONS_YES_NO,
658    ///                                            "Move the data ?\n");
659    ///           response = gtk_dialog_run (GTK_DIALOG (dialog));
660    ///           gtk_widget_destroy (dialog);
661    ///
662    ///           if (response == GTK_RESPONSE_YES)
663    ///             action = GDK_ACTION_MOVE;
664    ///           else
665    ///             action = GDK_ACTION_COPY;
666    ///          }
667    ///
668    ///       gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
669    ///     }
670    ///   else
671    ///     gtk_drag_finish (context, FALSE, FALSE, time);
672    ///  }
673    /// ```
674    ///
675    ///
676    ///
677    ///
678    /// #### `drag-drop`
679    ///  The ::drag-drop signal is emitted on the drop site when the user drops
680    /// the data onto the widget. The signal handler must determine whether
681    /// the cursor position is in a drop zone or not. If it is not in a drop
682    /// zone, it returns [`false`] and no further processing is necessary.
683    /// Otherwise, the handler returns [`true`]. In this case, the handler must
684    /// ensure that `gtk_drag_finish()` is called to let the source know that
685    /// the drop is done. The call to `gtk_drag_finish()` can be done either
686    /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
687    /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
688    /// or more of the supported targets.
689    ///
690    ///
691    ///
692    ///
693    /// #### `drag-end`
694    ///  The ::drag-end signal is emitted on the drag source when a drag is
695    /// finished. A typical reason to connect to this signal is to undo
696    /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
697    ///
698    ///
699    ///
700    ///
701    /// #### `drag-failed`
702    ///  The ::drag-failed signal is emitted on the drag source when a drag has
703    /// failed. The signal handler may hook custom code to handle a failed DnD
704    /// operation based on the type of error, it returns [`true`] is the failure has
705    /// been already handled (not showing the default "drag operation failed"
706    /// animation), otherwise it returns [`false`].
707    ///
708    ///
709    ///
710    ///
711    /// #### `drag-leave`
712    ///  The ::drag-leave signal is emitted on the drop site when the cursor
713    /// leaves the widget. A typical reason to connect to this signal is to
714    /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
715    /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
716    ///
717    ///
718    /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
719    /// ::drag-drop signal, for instance to allow cleaning up of a preview item
720    /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
721    ///
722    ///
723    ///
724    ///
725    /// #### `drag-motion`
726    ///  The ::drag-motion signal is emitted on the drop site when the user
727    /// moves the cursor over the widget during a drag. The signal handler
728    /// must determine whether the cursor position is in a drop zone or not.
729    /// If it is not in a drop zone, it returns [`false`] and no further processing
730    /// is necessary. Otherwise, the handler returns [`true`]. In this case, the
731    /// handler is responsible for providing the necessary information for
732    /// displaying feedback to the user, by calling `gdk_drag_status()`.
733    ///
734    /// If the decision whether the drop will be accepted or rejected can't be
735    /// made based solely on the cursor position and the type of the data, the
736    /// handler may inspect the dragged data by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] and
737    /// defer the `gdk_drag_status()` call to the [`drag-data-received`][struct@crate::Widget#drag-data-received]
738    /// handler. Note that you must pass [`DestDefaults::DROP`][crate::DestDefaults::DROP],
739    /// [`DestDefaults::MOTION`][crate::DestDefaults::MOTION] or [`DestDefaults::ALL`][crate::DestDefaults::ALL] to [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()]
740    /// when using the drag-motion signal that way.
741    ///
742    /// Also note that there is no drag-enter signal. The drag receiver has to
743    /// keep track of whether he has received any drag-motion signals since the
744    /// last [`drag-leave`][struct@crate::Widget#drag-leave] and if not, treat the drag-motion signal as
745    /// an "enter" signal. Upon an "enter", the handler will typically highlight
746    /// the drop site with [`WidgetExt::drag_highlight()`][crate::prelude::WidgetExt::drag_highlight()].
747    ///
748    ///
749    /// **⚠️ The following code is in C ⚠️**
750    ///
751    /// ```C
752    /// static void
753    /// drag_motion (GtkWidget      *widget,
754    ///              GdkDragContext *context,
755    ///              gint            x,
756    ///              gint            y,
757    ///              guint           time)
758    /// {
759    ///   GdkAtom target;
760    ///
761    ///   PrivateData *private_data = GET_PRIVATE_DATA (widget);
762    ///
763    ///   if (!private_data->drag_highlight)
764    ///    {
765    ///      private_data->drag_highlight = 1;
766    ///      gtk_drag_highlight (widget);
767    ///    }
768    ///
769    ///   target = gtk_drag_dest_find_target (widget, context, NULL);
770    ///   if (target == GDK_NONE)
771    ///     gdk_drag_status (context, 0, time);
772    ///   else
773    ///    {
774    ///      private_data->pending_status
775    ///         = gdk_drag_context_get_suggested_action (context);
776    ///      gtk_drag_get_data (widget, context, target, time);
777    ///    }
778    ///
779    ///   return TRUE;
780    /// }
781    ///
782    /// static void
783    /// drag_data_received (GtkWidget        *widget,
784    ///                     GdkDragContext   *context,
785    ///                     gint              x,
786    ///                     gint              y,
787    ///                     GtkSelectionData *selection_data,
788    ///                     guint             info,
789    ///                     guint             time)
790    /// {
791    ///   PrivateData *private_data = GET_PRIVATE_DATA (widget);
792    ///
793    ///   if (private_data->suggested_action)
794    ///    {
795    ///      private_data->suggested_action = 0;
796    ///
797    ///      // We are getting this data due to a request in drag_motion,
798    ///      // rather than due to a request in drag_drop, so we are just
799    ///      // supposed to call gdk_drag_status(), not actually paste in
800    ///      // the data.
801    ///
802    ///      str = gtk_selection_data_get_text (selection_data);
803    ///      if (!data_is_acceptable (str))
804    ///        gdk_drag_status (context, 0, time);
805    ///      else
806    ///        gdk_drag_status (context,
807    ///                         private_data->suggested_action,
808    ///                         time);
809    ///    }
810    ///   else
811    ///    {
812    ///      // accept the drop
813    ///    }
814    /// }
815    /// ```
816    ///
817    ///
818    ///
819    ///
820    /// #### `draw`
821    ///  This signal is emitted when a widget is supposed to render itself.
822    /// The `widget`'s top left corner must be painted at the origin of
823    /// the passed in context and be sized to the values returned by
824    /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
825    /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
826    ///
827    /// Signal handlers connected to this signal can modify the cairo
828    /// context passed as `cr` in any way they like and don't need to
829    /// restore it. The signal emission takes care of calling `cairo_save()`
830    /// before and `cairo_restore()` after invoking the handler.
831    ///
832    /// The signal handler will get a `cr` with a clip region already set to the
833    /// widget's dirty region, i.e. to the area that needs repainting. Complicated
834    /// widgets that want to avoid redrawing themselves completely can get the full
835    /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
836    /// get a finer-grained representation of the dirty region with
837    /// `cairo_copy_clip_rectangle_list()`.
838    ///
839    ///
840    ///
841    ///
842    /// #### `enter-notify-event`
843    ///  The ::enter-notify-event will be emitted when the pointer enters
844    /// the `widget`'s window.
845    ///
846    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
847    /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
848    ///
849    /// This signal will be sent to the grab widget if there is one.
850    ///
851    ///
852    ///
853    ///
854    /// #### `event`
855    ///  The GTK+ main loop will emit three signals for each GDK event delivered
856    /// to a widget: one generic ::event signal, another, more specific,
857    /// signal that matches the type of event delivered (e.g.
858    /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
859    /// [`event-after`][struct@crate::Widget#event-after] signal.
860    ///
861    ///
862    ///
863    ///
864    /// #### `event-after`
865    ///  After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
866    /// the second more specific signal, ::event-after will be emitted
867    /// regardless of the previous two signals handlers return values.
868    ///
869    ///
870    ///
871    ///
872    /// #### `focus`
873    ///
874    ///
875    ///
876    /// #### `focus-in-event`
877    ///  The ::focus-in-event signal will be emitted when the keyboard focus
878    /// enters the `widget`'s window.
879    ///
880    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
881    /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
882    ///
883    ///
884    ///
885    ///
886    /// #### `focus-out-event`
887    ///  The ::focus-out-event signal will be emitted when the keyboard focus
888    /// leaves the `widget`'s window.
889    ///
890    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
891    /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
892    ///
893    ///
894    ///
895    ///
896    /// #### `grab-broken-event`
897    ///  Emitted when a pointer or keyboard grab on a window belonging
898    /// to `widget` gets broken.
899    ///
900    /// On X11, this happens when the grab window becomes unviewable
901    /// (i.e. it or one of its ancestors is unmapped), or if the same
902    /// application grabs the pointer or keyboard again.
903    ///
904    ///
905    ///
906    ///
907    /// #### `grab-focus`
908    ///  Action
909    ///
910    ///
911    /// #### `grab-notify`
912    ///  The ::grab-notify signal is emitted when a widget becomes
913    /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
914    /// another widget, or when it becomes unshadowed due to a grab
915    /// being removed.
916    ///
917    /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
918    /// grab widget in the grab stack of its window group is not
919    /// its ancestor.
920    ///
921    ///
922    ///
923    ///
924    /// #### `hide`
925    ///  The ::hide signal is emitted when `widget` is hidden, for example with
926    /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
927    ///
928    ///
929    ///
930    ///
931    /// #### `hierarchy-changed`
932    ///  The ::hierarchy-changed signal is emitted when the
933    /// anchored state of a widget changes. A widget is
934    /// “anchored” when its toplevel
935    /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
936    /// a widget changes from un-anchored to anchored or vice-versa.
937    ///
938    ///
939    ///
940    ///
941    /// #### `key-press-event`
942    ///  The ::key-press-event signal is emitted when a key is pressed. The signal
943    /// emission will reoccur at the key-repeat rate when the key is kept pressed.
944    ///
945    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
946    /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
947    ///
948    /// This signal will be sent to the grab widget if there is one.
949    ///
950    ///
951    ///
952    ///
953    /// #### `key-release-event`
954    ///  The ::key-release-event signal is emitted when a key is released.
955    ///
956    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
957    /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
958    ///
959    /// This signal will be sent to the grab widget if there is one.
960    ///
961    ///
962    ///
963    ///
964    /// #### `keynav-failed`
965    ///  Gets emitted if keyboard navigation fails.
966    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
967    ///
968    ///
969    ///
970    ///
971    /// #### `leave-notify-event`
972    ///  The ::leave-notify-event will be emitted when the pointer leaves
973    /// the `widget`'s window.
974    ///
975    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
976    /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
977    ///
978    /// This signal will be sent to the grab widget if there is one.
979    ///
980    ///
981    ///
982    ///
983    /// #### `map`
984    ///  The ::map signal is emitted when `widget` is going to be mapped, that is
985    /// when the widget is visible (which is controlled with
986    /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
987    /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
988    /// be emitted.
989    ///
990    /// The ::map signal can be used to determine whether a widget will be drawn,
991    /// for instance it can resume an animation that was stopped during the
992    /// emission of [`unmap`][struct@crate::Widget#unmap].
993    ///
994    ///
995    ///
996    ///
997    /// #### `map-event`
998    ///  The ::map-event signal will be emitted when the `widget`'s window is
999    /// mapped. A window is mapped when it becomes visible on the screen.
1000    ///
1001    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1002    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1003    /// automatically for all new windows.
1004    ///
1005    ///
1006    ///
1007    ///
1008    /// #### `mnemonic-activate`
1009    ///  The default handler for this signal activates `widget` if `group_cycling`
1010    /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
1011    ///
1012    ///
1013    ///
1014    ///
1015    /// #### `motion-notify-event`
1016    ///  The ::motion-notify-event signal is emitted when the pointer moves
1017    /// over the widget's [`gdk::Window`][crate::gdk::Window].
1018    ///
1019    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
1020    /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
1021    ///
1022    /// This signal will be sent to the grab widget if there is one.
1023    ///
1024    ///
1025    ///
1026    ///
1027    /// #### `move-focus`
1028    ///  Action
1029    ///
1030    ///
1031    /// #### `parent-set`
1032    ///  The ::parent-set signal is emitted when a new parent
1033    /// has been set on a widget.
1034    ///
1035    ///
1036    ///
1037    ///
1038    /// #### `popup-menu`
1039    ///  This signal gets emitted whenever a widget should pop up a context
1040    /// menu. This usually happens through the standard key binding mechanism;
1041    /// by pressing a certain key while a widget is focused, the user can cause
1042    /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
1043    /// a menu with clipboard commands. See the
1044    /// [Popup Menu Migration Checklist][checklist-popup-menu]
1045    /// for an example of how to use this signal.
1046    ///
1047    /// Action
1048    ///
1049    ///
1050    /// #### `property-notify-event`
1051    ///  The ::property-notify-event signal will be emitted when a property on
1052    /// the `widget`'s window has been changed or deleted.
1053    ///
1054    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1055    /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1056    ///
1057    ///
1058    ///
1059    ///
1060    /// #### `proximity-in-event`
1061    ///  To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1062    /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1063    ///
1064    /// This signal will be sent to the grab widget if there is one.
1065    ///
1066    ///
1067    ///
1068    ///
1069    /// #### `proximity-out-event`
1070    ///  To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1071    /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1072    ///
1073    /// This signal will be sent to the grab widget if there is one.
1074    ///
1075    ///
1076    ///
1077    ///
1078    /// #### `query-tooltip`
1079    ///  Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1080    /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1081    /// focus in keyboard mode.
1082    ///
1083    /// Using the given coordinates, the signal handler should determine
1084    /// whether a tooltip should be shown for `widget`. If this is the case
1085    /// [`true`] should be returned, [`false`] otherwise. Note that if
1086    /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1087    /// should not be used.
1088    ///
1089    /// The signal handler is free to manipulate `tooltip` with the therefore
1090    /// destined function calls.
1091    ///
1092    ///
1093    ///
1094    ///
1095    /// #### `realize`
1096    ///  The ::realize signal is emitted when `widget` is associated with a
1097    /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1098    /// widget has been mapped (that is, it is going to be drawn).
1099    ///
1100    ///
1101    ///
1102    ///
1103    /// #### `screen-changed`
1104    ///  The ::screen-changed signal gets emitted when the
1105    /// screen of a widget has changed.
1106    ///
1107    ///
1108    ///
1109    ///
1110    /// #### `scroll-event`
1111    ///  The ::scroll-event signal is emitted when a button in the 4 to 7
1112    /// range is pressed. Wheel mice are usually configured to generate
1113    /// button press events for buttons 4 and 5 when the wheel is turned.
1114    ///
1115    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1116    /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1117    ///
1118    /// This signal will be sent to the grab widget if there is one.
1119    ///
1120    ///
1121    ///
1122    ///
1123    /// #### `selection-clear-event`
1124    ///  The ::selection-clear-event signal will be emitted when the
1125    /// the `widget`'s window has lost ownership of a selection.
1126    ///
1127    ///
1128    ///
1129    ///
1130    /// #### `selection-get`
1131    ///
1132    ///
1133    ///
1134    /// #### `selection-notify-event`
1135    ///
1136    ///
1137    ///
1138    /// #### `selection-received`
1139    ///
1140    ///
1141    ///
1142    /// #### `selection-request-event`
1143    ///  The ::selection-request-event signal will be emitted when
1144    /// another client requests ownership of the selection owned by
1145    /// the `widget`'s window.
1146    ///
1147    ///
1148    ///
1149    ///
1150    /// #### `show`
1151    ///  The ::show signal is emitted when `widget` is shown, for example with
1152    /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1153    ///
1154    ///
1155    ///
1156    ///
1157    /// #### `show-help`
1158    ///  Action
1159    ///
1160    ///
1161    /// #### `size-allocate`
1162    ///
1163    ///
1164    ///
1165    /// #### `state-changed`
1166    ///  The ::state-changed signal is emitted when the widget state changes.
1167    /// See `gtk_widget_get_state()`.
1168    ///
1169    ///
1170    ///
1171    ///
1172    /// #### `state-flags-changed`
1173    ///  The ::state-flags-changed signal is emitted when the widget state
1174    /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1175    ///
1176    ///
1177    ///
1178    ///
1179    /// #### `style-set`
1180    ///  The ::style-set signal is emitted when a new style has been set
1181    /// on a widget. Note that style-modifying functions like
1182    /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1183    ///
1184    /// Note that this signal is emitted for changes to the deprecated
1185    /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1186    /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1187    ///
1188    ///
1189    ///
1190    ///
1191    /// #### `style-updated`
1192    ///  The ::style-updated signal is a convenience signal that is emitted when the
1193    /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1194    /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1195    ///
1196    /// Note that style-modifying functions like `gtk_widget_override_color()` also
1197    /// cause this signal to be emitted.
1198    ///
1199    ///
1200    ///
1201    ///
1202    /// #### `touch-event`
1203    ///
1204    ///
1205    ///
1206    /// #### `unmap`
1207    ///  The ::unmap signal is emitted when `widget` is going to be unmapped, which
1208    /// means that either it or any of its parents up to the toplevel widget have
1209    /// been set as hidden.
1210    ///
1211    /// As ::unmap indicates that a widget will not be shown any longer, it can be
1212    /// used to, for example, stop an animation on the widget.
1213    ///
1214    ///
1215    ///
1216    ///
1217    /// #### `unmap-event`
1218    ///  The ::unmap-event signal will be emitted when the `widget`'s window is
1219    /// unmapped. A window is unmapped when it becomes invisible on the screen.
1220    ///
1221    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1222    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1223    /// automatically for all new windows.
1224    ///
1225    ///
1226    ///
1227    ///
1228    /// #### `unrealize`
1229    ///  The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1230    /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1231    /// called or the widget has been unmapped (that is, it is going to be
1232    /// hidden).
1233    ///
1234    ///
1235    ///
1236    ///
1237    /// #### `visibility-notify-event`
1238    ///  The ::visibility-notify-event will be emitted when the `widget`'s
1239    /// window is obscured or unobscured.
1240    ///
1241    /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1242    /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1243    ///
1244    ///
1245    ///
1246    ///
1247    /// #### `window-state-event`
1248    ///  The ::window-state-event will be emitted when the state of the
1249    /// toplevel window associated to the `widget` changes.
1250    ///
1251    /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1252    /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1253    /// this mask automatically for all new windows.
1254    ///
1255    ///
1256    /// </details>
1257    /// <details><summary><h4>FileChooser</h4></summary>
1258    ///
1259    ///
1260    /// #### `confirm-overwrite`
1261    ///  This signal gets emitted whenever it is appropriate to present a
1262    /// confirmation dialog when the user has selected a file name that
1263    /// already exists. The signal only gets emitted when the file
1264    /// chooser is in [`FileChooserAction::Save`][crate::FileChooserAction::Save] mode.
1265    ///
1266    /// Most applications just need to turn on the
1267    /// [`do-overwrite-confirmation`][struct@crate::FileChooser#do-overwrite-confirmation] property (or call the
1268    /// [`FileChooserExt::set_do_overwrite_confirmation()`][crate::prelude::FileChooserExt::set_do_overwrite_confirmation()] function), and
1269    /// they will automatically get a stock confirmation dialog.
1270    /// Applications which need to customize this behavior should do
1271    /// that, and also connect to the [`confirm-overwrite`][struct@crate::FileChooser#confirm-overwrite]
1272    /// signal.
1273    ///
1274    /// A signal handler for this signal must return a
1275    /// [`FileChooserConfirmation`][crate::FileChooserConfirmation] value, which indicates the action to
1276    /// take. If the handler determines that the user wants to select a
1277    /// different filename, it should return
1278    /// [`FileChooserConfirmation::SelectAgain`][crate::FileChooserConfirmation::SelectAgain]. If it determines
1279    /// that the user is satisfied with his choice of file name, it
1280    /// should return [`FileChooserConfirmation::AcceptFilename`][crate::FileChooserConfirmation::AcceptFilename].
1281    /// On the other hand, if it determines that the stock confirmation
1282    /// dialog should be used, it should return
1283    /// [`FileChooserConfirmation::Confirm`][crate::FileChooserConfirmation::Confirm]. The following example
1284    /// illustrates this.
1285    ///
1286    /// ## Custom confirmation ## {`gtkfilechooser`-confirmation}
1287    ///
1288    ///
1289    ///
1290    /// **⚠️ The following code is in C ⚠️**
1291    ///
1292    /// ```C
1293    /// static GtkFileChooserConfirmation
1294    /// confirm_overwrite_callback (GtkFileChooser *chooser, gpointer data)
1295    /// {
1296    ///   char *uri;
1297    ///
1298    ///   uri = gtk_file_chooser_get_uri (chooser);
1299    ///
1300    ///   if (is_uri_read_only (uri))
1301    ///     {
1302    ///       if (user_wants_to_replace_read_only_file (uri))
1303    ///         return GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME;
1304    ///       else
1305    ///         return GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN;
1306    ///     } else
1307    ///       return GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM; // fall back to the default dialog
1308    /// }
1309    ///
1310    /// ...
1311    ///
1312    /// chooser = gtk_file_chooser_dialog_new (...);
1313    ///
1314    /// gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
1315    /// g_signal_connect (chooser, "confirm-overwrite",
1316    ///                   G_CALLBACK (confirm_overwrite_callback), NULL);
1317    ///
1318    /// if (gtk_dialog_run (chooser) == GTK_RESPONSE_ACCEPT)
1319    ///         save_to_file (gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser));
1320    ///
1321    /// gtk_widget_destroy (chooser);
1322    /// ```
1323    ///
1324    ///
1325    ///
1326    ///
1327    /// #### `current-folder-changed`
1328    ///  This signal is emitted when the current folder in a [`FileChooser`][crate::FileChooser]
1329    /// changes. This can happen due to the user performing some action that
1330    /// changes folders, such as selecting a bookmark or visiting a folder on the
1331    /// file list. It can also happen as a result of calling a function to
1332    /// explicitly change the current folder in a file chooser.
1333    ///
1334    /// Normally you do not need to connect to this signal, unless you need to keep
1335    /// track of which folder a file chooser is showing.
1336    ///
1337    /// See also: [`FileChooserExt::set_current_folder()`][crate::prelude::FileChooserExt::set_current_folder()],
1338    /// [`FileChooserExt::current_folder()`][crate::prelude::FileChooserExt::current_folder()],
1339    /// [`FileChooserExt::set_current_folder_uri()`][crate::prelude::FileChooserExt::set_current_folder_uri()],
1340    /// [`FileChooserExt::current_folder_uri()`][crate::prelude::FileChooserExt::current_folder_uri()].
1341    ///
1342    ///
1343    ///
1344    ///
1345    /// #### `file-activated`
1346    ///  This signal is emitted when the user "activates" a file in the file
1347    /// chooser. This can happen by double-clicking on a file in the file list, or
1348    /// by pressing `Enter`.
1349    ///
1350    /// Normally you do not need to connect to this signal. It is used internally
1351    /// by [`FileChooserDialog`][crate::FileChooserDialog] to know when to activate the default button in the
1352    /// dialog.
1353    ///
1354    /// See also: [`FileChooserExt::filename()`][crate::prelude::FileChooserExt::filename()],
1355    /// [`FileChooserExt::filenames()`][crate::prelude::FileChooserExt::filenames()], [`FileChooserExt::uri()`][crate::prelude::FileChooserExt::uri()],
1356    /// [`FileChooserExt::uris()`][crate::prelude::FileChooserExt::uris()].
1357    ///
1358    ///
1359    ///
1360    ///
1361    /// #### `selection-changed`
1362    ///  This signal is emitted when there is a change in the set of selected files
1363    /// in a [`FileChooser`][crate::FileChooser]. This can happen when the user modifies the selection
1364    /// with the mouse or the keyboard, or when explicitly calling functions to
1365    /// change the selection.
1366    ///
1367    /// Normally you do not need to connect to this signal, as it is easier to wait
1368    /// for the file chooser to finish running, and then to get the list of
1369    /// selected files using the functions mentioned below.
1370    ///
1371    /// See also: [`FileChooserExt::select_filename()`][crate::prelude::FileChooserExt::select_filename()],
1372    /// [`FileChooserExt::unselect_filename()`][crate::prelude::FileChooserExt::unselect_filename()], [`FileChooserExt::filename()`][crate::prelude::FileChooserExt::filename()],
1373    /// [`FileChooserExt::filenames()`][crate::prelude::FileChooserExt::filenames()], [`FileChooserExt::select_uri()`][crate::prelude::FileChooserExt::select_uri()],
1374    /// [`FileChooserExt::unselect_uri()`][crate::prelude::FileChooserExt::unselect_uri()], [`FileChooserExt::uri()`][crate::prelude::FileChooserExt::uri()],
1375    /// [`FileChooserExt::uris()`][crate::prelude::FileChooserExt::uris()].
1376    ///
1377    ///
1378    ///
1379    ///
1380    /// #### `update-preview`
1381    ///  This signal is emitted when the preview in a file chooser should be
1382    /// regenerated. For example, this can happen when the currently selected file
1383    /// changes. You should use this signal if you want your file chooser to have
1384    /// a preview widget.
1385    ///
1386    /// Once you have installed a preview widget with
1387    /// [`FileChooserExt::set_preview_widget()`][crate::prelude::FileChooserExt::set_preview_widget()], you should update it when this
1388    /// signal is emitted. You can use the functions
1389    /// [`FileChooserExt::preview_filename()`][crate::prelude::FileChooserExt::preview_filename()] or
1390    /// [`FileChooserExt::preview_uri()`][crate::prelude::FileChooserExt::preview_uri()] to get the name of the file to preview.
1391    /// Your widget may not be able to preview all kinds of files; your callback
1392    /// must call [`FileChooserExt::set_preview_widget_active()`][crate::prelude::FileChooserExt::set_preview_widget_active()] to inform the file
1393    /// chooser about whether the preview was generated successfully or not.
1394    ///
1395    /// Please see the example code in
1396    /// [Using a Preview Widget][gtkfilechooser-preview].
1397    ///
1398    /// See also: [`FileChooserExt::set_preview_widget()`][crate::prelude::FileChooserExt::set_preview_widget()],
1399    /// [`FileChooserExt::set_preview_widget_active()`][crate::prelude::FileChooserExt::set_preview_widget_active()],
1400    /// [`FileChooserExt::set_use_preview_label()`][crate::prelude::FileChooserExt::set_use_preview_label()],
1401    /// [`FileChooserExt::preview_filename()`][crate::prelude::FileChooserExt::preview_filename()],
1402    /// [`FileChooserExt::preview_uri()`][crate::prelude::FileChooserExt::preview_uri()].
1403    ///
1404    ///
1405    /// </details>
1406    ///
1407    /// # Implements
1408    ///
1409    /// [`FileChooserButtonExt`][trait@crate::prelude::FileChooserButtonExt], [`BoxExt`][trait@crate::prelude::BoxExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`OrientableExt`][trait@crate::prelude::OrientableExt], [`FileChooserExt`][trait@crate::prelude::FileChooserExt], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual], [`FileChooserExtManual`][trait@crate::prelude::FileChooserExtManual]
1410    #[doc(alias = "GtkFileChooserButton")]
1411    pub struct FileChooserButton(Object<ffi::GtkFileChooserButton, ffi::GtkFileChooserButtonClass>) @extends Box, Container, Widget, @implements Buildable, Orientable, FileChooser;
1412
1413    match fn {
1414        type_ => || ffi::gtk_file_chooser_button_get_type(),
1415    }
1416}
1417
1418impl FileChooserButton {
1419    pub const NONE: Option<&'static FileChooserButton> = None;
1420
1421    /// Creates a new file-selecting button widget.
1422    /// ## `title`
1423    /// the title of the browse dialog.
1424    /// ## `action`
1425    /// the open mode for the widget.
1426    ///
1427    /// # Returns
1428    ///
1429    /// a new button widget.
1430    #[doc(alias = "gtk_file_chooser_button_new")]
1431    pub fn new(title: &str, action: FileChooserAction) -> FileChooserButton {
1432        assert_initialized_main_thread!();
1433        unsafe {
1434            Widget::from_glib_none(ffi::gtk_file_chooser_button_new(
1435                title.to_glib_none().0,
1436                action.into_glib(),
1437            ))
1438            .unsafe_cast()
1439        }
1440    }
1441
1442    /// Creates a [`FileChooserButton`][crate::FileChooserButton] widget which uses `dialog` as its
1443    /// file-picking window.
1444    ///
1445    /// Note that `dialog` must be a [`Dialog`][crate::Dialog] (or subclass) which
1446    /// implements the [`FileChooser`][crate::FileChooser] interface and must not have
1447    /// [`DialogFlags::DESTROY_WITH_PARENT`][crate::DialogFlags::DESTROY_WITH_PARENT] set.
1448    ///
1449    /// Also note that the dialog needs to have its confirmative button
1450    /// added with response [`ResponseType::Accept`][crate::ResponseType::Accept] or [`ResponseType::Ok`][crate::ResponseType::Ok] in
1451    /// order for the button to take over the file selected in the dialog.
1452    /// ## `dialog`
1453    /// the widget to use as dialog
1454    ///
1455    /// # Returns
1456    ///
1457    /// a new button widget.
1458    #[doc(alias = "gtk_file_chooser_button_new_with_dialog")]
1459    #[doc(alias = "new_with_dialog")]
1460    pub fn with_dialog(dialog: &impl IsA<Dialog>) -> FileChooserButton {
1461        skip_assert_initialized!();
1462        unsafe {
1463            Widget::from_glib_none(ffi::gtk_file_chooser_button_new_with_dialog(
1464                dialog.as_ref().to_glib_none().0,
1465            ))
1466            .unsafe_cast()
1467        }
1468    }
1469
1470    // rustdoc-stripper-ignore-next
1471    /// Creates a new builder-pattern struct instance to construct [`FileChooserButton`] objects.
1472    ///
1473    /// This method returns an instance of [`FileChooserButtonBuilder`](crate::builders::FileChooserButtonBuilder) which can be used to create [`FileChooserButton`] objects.
1474    pub fn builder() -> FileChooserButtonBuilder {
1475        FileChooserButtonBuilder::new()
1476    }
1477}
1478
1479impl Default for FileChooserButton {
1480    fn default() -> Self {
1481        glib::object::Object::new::<Self>()
1482    }
1483}
1484
1485// rustdoc-stripper-ignore-next
1486/// A [builder-pattern] type to construct [`FileChooserButton`] objects.
1487///
1488/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1489#[must_use = "The builder must be built to be used"]
1490pub struct FileChooserButtonBuilder {
1491    builder: glib::object::ObjectBuilder<'static, FileChooserButton>,
1492}
1493
1494impl FileChooserButtonBuilder {
1495    fn new() -> Self {
1496        Self {
1497            builder: glib::object::Object::builder(),
1498        }
1499    }
1500
1501    /// Instance of the [`FileChooserDialog`][crate::FileChooserDialog] associated with the button.
1502    pub fn dialog(self, dialog: &impl IsA<FileChooser>) -> Self {
1503        Self {
1504            builder: self.builder.property("dialog", dialog.clone().upcast()),
1505        }
1506    }
1507
1508    /// Title to put on the [`FileChooserDialog`][crate::FileChooserDialog] associated with the button.
1509    pub fn title(self, title: impl Into<glib::GString>) -> Self {
1510        Self {
1511            builder: self.builder.property("title", title.into()),
1512        }
1513    }
1514
1515    /// The width of the entry and label inside the button, in characters.
1516    pub fn width_chars(self, width_chars: i32) -> Self {
1517        Self {
1518            builder: self.builder.property("width-chars", width_chars),
1519        }
1520    }
1521
1522    pub fn baseline_position(self, baseline_position: BaselinePosition) -> Self {
1523        Self {
1524            builder: self
1525                .builder
1526                .property("baseline-position", baseline_position),
1527        }
1528    }
1529
1530    pub fn homogeneous(self, homogeneous: bool) -> Self {
1531        Self {
1532            builder: self.builder.property("homogeneous", homogeneous),
1533        }
1534    }
1535
1536    pub fn spacing(self, spacing: i32) -> Self {
1537        Self {
1538            builder: self.builder.property("spacing", spacing),
1539        }
1540    }
1541
1542    pub fn border_width(self, border_width: u32) -> Self {
1543        Self {
1544            builder: self.builder.property("border-width", border_width),
1545        }
1546    }
1547
1548    pub fn child(self, child: &impl IsA<Widget>) -> Self {
1549        Self {
1550            builder: self.builder.property("child", child.clone().upcast()),
1551        }
1552    }
1553
1554    pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1555        Self {
1556            builder: self.builder.property("resize-mode", resize_mode),
1557        }
1558    }
1559
1560    pub fn app_paintable(self, app_paintable: bool) -> Self {
1561        Self {
1562            builder: self.builder.property("app-paintable", app_paintable),
1563        }
1564    }
1565
1566    pub fn can_default(self, can_default: bool) -> Self {
1567        Self {
1568            builder: self.builder.property("can-default", can_default),
1569        }
1570    }
1571
1572    pub fn can_focus(self, can_focus: bool) -> Self {
1573        Self {
1574            builder: self.builder.property("can-focus", can_focus),
1575        }
1576    }
1577
1578    pub fn events(self, events: gdk::EventMask) -> Self {
1579        Self {
1580            builder: self.builder.property("events", events),
1581        }
1582    }
1583
1584    /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1585    pub fn expand(self, expand: bool) -> Self {
1586        Self {
1587            builder: self.builder.property("expand", expand),
1588        }
1589    }
1590
1591    /// Whether the widget should grab focus when it is clicked with the mouse.
1592    ///
1593    /// This property is only relevant for widgets that can take focus.
1594    ///
1595    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1596    /// GtkComboBox) implemented this property individually.
1597    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1598        Self {
1599            builder: self.builder.property("focus-on-click", focus_on_click),
1600        }
1601    }
1602
1603    /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1604    pub fn halign(self, halign: Align) -> Self {
1605        Self {
1606            builder: self.builder.property("halign", halign),
1607        }
1608    }
1609
1610    pub fn has_default(self, has_default: bool) -> Self {
1611        Self {
1612            builder: self.builder.property("has-default", has_default),
1613        }
1614    }
1615
1616    pub fn has_focus(self, has_focus: bool) -> Self {
1617        Self {
1618            builder: self.builder.property("has-focus", has_focus),
1619        }
1620    }
1621
1622    /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1623    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1624    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1625    /// whether it will provide a tooltip or not.
1626    ///
1627    /// Note that setting this property to [`true`] for the first time will change
1628    /// the event masks of the GdkWindows of this widget to include leave-notify
1629    /// and motion-notify events. This cannot and will not be undone when the
1630    /// property is set to [`false`] again.
1631    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1632        Self {
1633            builder: self.builder.property("has-tooltip", has_tooltip),
1634        }
1635    }
1636
1637    pub fn height_request(self, height_request: i32) -> Self {
1638        Self {
1639            builder: self.builder.property("height-request", height_request),
1640        }
1641    }
1642
1643    /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1644    pub fn hexpand(self, hexpand: bool) -> Self {
1645        Self {
1646            builder: self.builder.property("hexpand", hexpand),
1647        }
1648    }
1649
1650    /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1651    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1652        Self {
1653            builder: self.builder.property("hexpand-set", hexpand_set),
1654        }
1655    }
1656
1657    pub fn is_focus(self, is_focus: bool) -> Self {
1658        Self {
1659            builder: self.builder.property("is-focus", is_focus),
1660        }
1661    }
1662
1663    /// Sets all four sides' margin at once. If read, returns max
1664    /// margin on any side.
1665    pub fn margin(self, margin: i32) -> Self {
1666        Self {
1667            builder: self.builder.property("margin", margin),
1668        }
1669    }
1670
1671    /// Margin on bottom side of widget.
1672    ///
1673    /// This property adds margin outside of the widget's normal size
1674    /// request, the margin will be added in addition to the size from
1675    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1676    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1677        Self {
1678            builder: self.builder.property("margin-bottom", margin_bottom),
1679        }
1680    }
1681
1682    /// Margin on end of widget, horizontally. This property supports
1683    /// left-to-right and right-to-left text directions.
1684    ///
1685    /// This property adds margin outside of the widget's normal size
1686    /// request, the margin will be added in addition to the size from
1687    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1688    pub fn margin_end(self, margin_end: i32) -> Self {
1689        Self {
1690            builder: self.builder.property("margin-end", margin_end),
1691        }
1692    }
1693
1694    /// Margin on start of widget, horizontally. This property supports
1695    /// left-to-right and right-to-left text directions.
1696    ///
1697    /// This property adds margin outside of the widget's normal size
1698    /// request, the margin will be added in addition to the size from
1699    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1700    pub fn margin_start(self, margin_start: i32) -> Self {
1701        Self {
1702            builder: self.builder.property("margin-start", margin_start),
1703        }
1704    }
1705
1706    /// Margin on top side of widget.
1707    ///
1708    /// This property adds margin outside of the widget's normal size
1709    /// request, the margin will be added in addition to the size from
1710    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1711    pub fn margin_top(self, margin_top: i32) -> Self {
1712        Self {
1713            builder: self.builder.property("margin-top", margin_top),
1714        }
1715    }
1716
1717    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1718        Self {
1719            builder: self.builder.property("name", name.into()),
1720        }
1721    }
1722
1723    pub fn no_show_all(self, no_show_all: bool) -> Self {
1724        Self {
1725            builder: self.builder.property("no-show-all", no_show_all),
1726        }
1727    }
1728
1729    /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1730    /// more details about window opacity.
1731    ///
1732    /// Before 3.8 this was only available in GtkWindow
1733    pub fn opacity(self, opacity: f64) -> Self {
1734        Self {
1735            builder: self.builder.property("opacity", opacity),
1736        }
1737    }
1738
1739    pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1740        Self {
1741            builder: self.builder.property("parent", parent.clone().upcast()),
1742        }
1743    }
1744
1745    pub fn receives_default(self, receives_default: bool) -> Self {
1746        Self {
1747            builder: self.builder.property("receives-default", receives_default),
1748        }
1749    }
1750
1751    pub fn sensitive(self, sensitive: bool) -> Self {
1752        Self {
1753            builder: self.builder.property("sensitive", sensitive),
1754        }
1755    }
1756
1757    /// Sets the text of tooltip to be the given string, which is marked up
1758    /// with the [Pango text markup language][PangoMarkupFormat].
1759    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1760    ///
1761    /// This is a convenience property which will take care of getting the
1762    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1763    /// will automatically be set to [`true`] and there will be taken care of
1764    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1765    ///
1766    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1767    /// are set, the last one wins.
1768    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1769        Self {
1770            builder: self
1771                .builder
1772                .property("tooltip-markup", tooltip_markup.into()),
1773        }
1774    }
1775
1776    /// Sets the text of tooltip to be the given string.
1777    ///
1778    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1779    ///
1780    /// This is a convenience property which will take care of getting the
1781    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1782    /// will automatically be set to [`true`] and there will be taken care of
1783    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1784    ///
1785    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1786    /// are set, the last one wins.
1787    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1788        Self {
1789            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1790        }
1791    }
1792
1793    /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1794    pub fn valign(self, valign: Align) -> Self {
1795        Self {
1796            builder: self.builder.property("valign", valign),
1797        }
1798    }
1799
1800    /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1801    pub fn vexpand(self, vexpand: bool) -> Self {
1802        Self {
1803            builder: self.builder.property("vexpand", vexpand),
1804        }
1805    }
1806
1807    /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1808    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1809        Self {
1810            builder: self.builder.property("vexpand-set", vexpand_set),
1811        }
1812    }
1813
1814    pub fn visible(self, visible: bool) -> Self {
1815        Self {
1816            builder: self.builder.property("visible", visible),
1817        }
1818    }
1819
1820    pub fn width_request(self, width_request: i32) -> Self {
1821        Self {
1822            builder: self.builder.property("width-request", width_request),
1823        }
1824    }
1825
1826    /// The orientation of the orientable.
1827    pub fn orientation(self, orientation: Orientation) -> Self {
1828        Self {
1829            builder: self.builder.property("orientation", orientation),
1830        }
1831    }
1832
1833    pub fn action(self, action: FileChooserAction) -> Self {
1834        Self {
1835            builder: self.builder.property("action", action),
1836        }
1837    }
1838
1839    /// Whether a file chooser not in [`FileChooserAction::Open`][crate::FileChooserAction::Open] mode
1840    /// will offer the user to create new folders.
1841    pub fn create_folders(self, create_folders: bool) -> Self {
1842        Self {
1843            builder: self.builder.property("create-folders", create_folders),
1844        }
1845    }
1846
1847    /// Whether a file chooser in [`FileChooserAction::Save`][crate::FileChooserAction::Save] mode
1848    /// will present an overwrite confirmation dialog if the user
1849    /// selects a file name that already exists.
1850    pub fn do_overwrite_confirmation(self, do_overwrite_confirmation: bool) -> Self {
1851        Self {
1852            builder: self
1853                .builder
1854                .property("do-overwrite-confirmation", do_overwrite_confirmation),
1855        }
1856    }
1857
1858    pub fn extra_widget(self, extra_widget: &impl IsA<Widget>) -> Self {
1859        Self {
1860            builder: self
1861                .builder
1862                .property("extra-widget", extra_widget.clone().upcast()),
1863        }
1864    }
1865
1866    pub fn filter(self, filter: &FileFilter) -> Self {
1867        Self {
1868            builder: self.builder.property("filter", filter.clone()),
1869        }
1870    }
1871
1872    pub fn local_only(self, local_only: bool) -> Self {
1873        Self {
1874            builder: self.builder.property("local-only", local_only),
1875        }
1876    }
1877
1878    pub fn preview_widget(self, preview_widget: &impl IsA<Widget>) -> Self {
1879        Self {
1880            builder: self
1881                .builder
1882                .property("preview-widget", preview_widget.clone().upcast()),
1883        }
1884    }
1885
1886    pub fn preview_widget_active(self, preview_widget_active: bool) -> Self {
1887        Self {
1888            builder: self
1889                .builder
1890                .property("preview-widget-active", preview_widget_active),
1891        }
1892    }
1893
1894    pub fn select_multiple(self, select_multiple: bool) -> Self {
1895        Self {
1896            builder: self.builder.property("select-multiple", select_multiple),
1897        }
1898    }
1899
1900    pub fn show_hidden(self, show_hidden: bool) -> Self {
1901        Self {
1902            builder: self.builder.property("show-hidden", show_hidden),
1903        }
1904    }
1905
1906    pub fn use_preview_label(self, use_preview_label: bool) -> Self {
1907        Self {
1908            builder: self
1909                .builder
1910                .property("use-preview-label", use_preview_label),
1911        }
1912    }
1913
1914    // rustdoc-stripper-ignore-next
1915    /// Build the [`FileChooserButton`].
1916    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1917    pub fn build(self) -> FileChooserButton {
1918        assert_initialized_main_thread!();
1919        self.builder.build()
1920    }
1921}
1922
1923/// Trait containing all [`struct@FileChooserButton`] methods.
1924///
1925/// # Implementors
1926///
1927/// [`FileChooserButton`][struct@crate::FileChooserButton]
1928pub trait FileChooserButtonExt: IsA<FileChooserButton> + 'static {
1929    /// Retrieves the title of the browse dialog used by `self`. The returned value
1930    /// should not be modified or freed.
1931    ///
1932    /// # Returns
1933    ///
1934    /// a pointer to the browse dialog’s title.
1935    #[doc(alias = "gtk_file_chooser_button_get_title")]
1936    #[doc(alias = "get_title")]
1937    fn title(&self) -> Option<glib::GString> {
1938        unsafe {
1939            from_glib_none(ffi::gtk_file_chooser_button_get_title(
1940                self.as_ref().to_glib_none().0,
1941            ))
1942        }
1943    }
1944
1945    /// Retrieves the width in characters of the `self` widget’s entry and/or label.
1946    ///
1947    /// # Returns
1948    ///
1949    /// an integer width (in characters) that the button will use to size itself.
1950    #[doc(alias = "gtk_file_chooser_button_get_width_chars")]
1951    #[doc(alias = "get_width_chars")]
1952    #[doc(alias = "width-chars")]
1953    fn width_chars(&self) -> i32 {
1954        unsafe { ffi::gtk_file_chooser_button_get_width_chars(self.as_ref().to_glib_none().0) }
1955    }
1956
1957    /// Modifies the `title` of the browse dialog used by `self`.
1958    /// ## `title`
1959    /// the new browse dialog title.
1960    #[doc(alias = "gtk_file_chooser_button_set_title")]
1961    #[doc(alias = "title")]
1962    fn set_title(&self, title: &str) {
1963        unsafe {
1964            ffi::gtk_file_chooser_button_set_title(
1965                self.as_ref().to_glib_none().0,
1966                title.to_glib_none().0,
1967            );
1968        }
1969    }
1970
1971    /// Sets the width (in characters) that `self` will use to `n_chars`.
1972    /// ## `n_chars`
1973    /// the new width, in characters.
1974    #[doc(alias = "gtk_file_chooser_button_set_width_chars")]
1975    #[doc(alias = "width-chars")]
1976    fn set_width_chars(&self, n_chars: i32) {
1977        unsafe {
1978            ffi::gtk_file_chooser_button_set_width_chars(self.as_ref().to_glib_none().0, n_chars);
1979        }
1980    }
1981
1982    /// The ::file-set signal is emitted when the user selects a file.
1983    ///
1984    /// Note that this signal is only emitted when the user
1985    /// changes the file.
1986    #[doc(alias = "file-set")]
1987    fn connect_file_set<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1988        unsafe extern "C" fn file_set_trampoline<P: IsA<FileChooserButton>, F: Fn(&P) + 'static>(
1989            this: *mut ffi::GtkFileChooserButton,
1990            f: glib::ffi::gpointer,
1991        ) {
1992            unsafe {
1993                let f: &F = &*(f as *const F);
1994                f(FileChooserButton::from_glib_borrow(this).unsafe_cast_ref())
1995            }
1996        }
1997        unsafe {
1998            let f: Box_<F> = Box_::new(f);
1999            connect_raw(
2000                self.as_ptr() as *mut _,
2001                c"file-set".as_ptr(),
2002                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2003                    file_set_trampoline::<Self, F> as *const (),
2004                )),
2005                Box_::into_raw(f),
2006            )
2007        }
2008    }
2009
2010    #[doc(alias = "title")]
2011    fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2012        unsafe extern "C" fn notify_title_trampoline<
2013            P: IsA<FileChooserButton>,
2014            F: Fn(&P) + 'static,
2015        >(
2016            this: *mut ffi::GtkFileChooserButton,
2017            _param_spec: glib::ffi::gpointer,
2018            f: glib::ffi::gpointer,
2019        ) {
2020            unsafe {
2021                let f: &F = &*(f as *const F);
2022                f(FileChooserButton::from_glib_borrow(this).unsafe_cast_ref())
2023            }
2024        }
2025        unsafe {
2026            let f: Box_<F> = Box_::new(f);
2027            connect_raw(
2028                self.as_ptr() as *mut _,
2029                c"notify::title".as_ptr(),
2030                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2031                    notify_title_trampoline::<Self, F> as *const (),
2032                )),
2033                Box_::into_raw(f),
2034            )
2035        }
2036    }
2037
2038    #[doc(alias = "width-chars")]
2039    fn connect_width_chars_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2040        unsafe extern "C" fn notify_width_chars_trampoline<
2041            P: IsA<FileChooserButton>,
2042            F: Fn(&P) + 'static,
2043        >(
2044            this: *mut ffi::GtkFileChooserButton,
2045            _param_spec: glib::ffi::gpointer,
2046            f: glib::ffi::gpointer,
2047        ) {
2048            unsafe {
2049                let f: &F = &*(f as *const F);
2050                f(FileChooserButton::from_glib_borrow(this).unsafe_cast_ref())
2051            }
2052        }
2053        unsafe {
2054            let f: Box_<F> = Box_::new(f);
2055            connect_raw(
2056                self.as_ptr() as *mut _,
2057                c"notify::width-chars".as_ptr(),
2058                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2059                    notify_width_chars_trampoline::<Self, F> as *const (),
2060                )),
2061                Box_::into_raw(f),
2062            )
2063        }
2064    }
2065}
2066
2067impl<O: IsA<FileChooserButton>> FileChooserButtonExt for O {}