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