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