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 /// format == 8))
714 /// {
715 /// GdkDragAction action;
716 ///
717 /// // handle data here
718 ///
719 /// action = gdk_drag_context_get_selected_action (context);
720 /// if (action == GDK_ACTION_ASK)
721 /// {
722 /// GtkWidget *dialog;
723 /// gint response;
724 ///
725 /// dialog = gtk_message_dialog_new (NULL,
726 /// GTK_DIALOG_MODAL |
727 /// GTK_DIALOG_DESTROY_WITH_PARENT,
728 /// GTK_MESSAGE_INFO,
729 /// GTK_BUTTONS_YES_NO,
730 /// "Move the data ?\n");
731 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
732 /// gtk_widget_destroy (dialog);
733 ///
734 /// if (response == GTK_RESPONSE_YES)
735 /// action = GDK_ACTION_MOVE;
736 /// else
737 /// action = GDK_ACTION_COPY;
738 /// }
739 ///
740 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
741 /// }
742 /// else
743 /// gtk_drag_finish (context, FALSE, FALSE, time);
744 /// }
745 /// ]|
746 ///
747 ///
748 ///
749 ///
750 /// #### `drag-drop`
751 /// The ::drag-drop signal is emitted on the drop site when the user drops
752 /// the data onto the widget. The signal handler must determine whether
753 /// the cursor position is in a drop zone or not. If it is not in a drop
754 /// zone, it returns [`false`] and no further processing is necessary.
755 /// Otherwise, the handler returns [`true`]. In this case, the handler must
756 /// ensure that `gtk_drag_finish()` is called to let the source know that
757 /// the drop is done. The call to `gtk_drag_finish()` can be done either
758 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
759 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
760 /// or more of the supported targets.
761 ///
762 ///
763 ///
764 ///
765 /// #### `drag-end`
766 /// The ::drag-end signal is emitted on the drag source when a drag is
767 /// finished. A typical reason to connect to this signal is to undo
768 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
769 ///
770 ///
771 ///
772 ///
773 /// #### `drag-failed`
774 /// The ::drag-failed signal is emitted on the drag source when a drag has
775 /// failed. The signal handler may hook custom code to handle a failed DnD
776 /// operation based on the type of error, it returns [`true`] is the failure has
777 /// been already handled (not showing the default "drag operation failed"
778 /// animation), otherwise it returns [`false`].
779 ///
780 ///
781 ///
782 ///
783 /// #### `drag-leave`
784 /// The ::drag-leave signal is emitted on the drop site when the cursor
785 /// leaves the widget. A typical reason to connect to this signal is to
786 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
787 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
788 ///
789 ///
790 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
791 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
792 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
793 ///
794 ///
795 ///
796 ///
797 /// #### `drag-motion`
798 /// suggested_action,
799 /// time);
800 /// }
801 /// else
802 /// {
803 /// // accept the drop
804 /// }
805 /// }
806 /// ]|
807 ///
808 ///
809 ///
810 ///
811 /// #### `draw`
812 /// This signal is emitted when a widget is supposed to render itself.
813 /// The `widget`'s top left corner must be painted at the origin of
814 /// the passed in context and be sized to the values returned by
815 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
816 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
817 ///
818 /// Signal handlers connected to this signal can modify the cairo
819 /// context passed as `cr` in any way they like and don't need to
820 /// restore it. The signal emission takes care of calling `cairo_save()`
821 /// before and `cairo_restore()` after invoking the handler.
822 ///
823 /// The signal handler will get a `cr` with a clip region already set to the
824 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
825 /// widgets that want to avoid redrawing themselves completely can get the full
826 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
827 /// get a finer-grained representation of the dirty region with
828 /// `cairo_copy_clip_rectangle_list()`.
829 ///
830 ///
831 ///
832 ///
833 /// #### `enter-notify-event`
834 /// The ::enter-notify-event will be emitted when the pointer enters
835 /// the `widget`'s window.
836 ///
837 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
838 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
839 ///
840 /// This signal will be sent to the grab widget if there is one.
841 ///
842 ///
843 ///
844 ///
845 /// #### `event`
846 /// The GTK+ main loop will emit three signals for each GDK event delivered
847 /// to a widget: one generic ::event signal, another, more specific,
848 /// signal that matches the type of event delivered (e.g.
849 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
850 /// [`event-after`][struct@crate::Widget#event-after] signal.
851 ///
852 ///
853 ///
854 ///
855 /// #### `event-after`
856 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
857 /// the second more specific signal, ::event-after will be emitted
858 /// regardless of the previous two signals handlers return values.
859 ///
860 ///
861 ///
862 ///
863 /// #### `focus`
864 ///
865 ///
866 ///
867 /// #### `focus-in-event`
868 /// The ::focus-in-event signal will be emitted when the keyboard focus
869 /// enters the `widget`'s window.
870 ///
871 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
872 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
873 ///
874 ///
875 ///
876 ///
877 /// #### `focus-out-event`
878 /// The ::focus-out-event signal will be emitted when the keyboard focus
879 /// leaves the `widget`'s window.
880 ///
881 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
882 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
883 ///
884 ///
885 ///
886 ///
887 /// #### `grab-broken-event`
888 /// Emitted when a pointer or keyboard grab on a window belonging
889 /// to `widget` gets broken.
890 ///
891 /// On X11, this happens when the grab window becomes unviewable
892 /// (i.e. it or one of its ancestors is unmapped), or if the same
893 /// application grabs the pointer or keyboard again.
894 ///
895 ///
896 ///
897 ///
898 /// #### `grab-focus`
899 /// Action
900 ///
901 ///
902 /// #### `grab-notify`
903 /// The ::grab-notify signal is emitted when a widget becomes
904 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
905 /// another widget, or when it becomes unshadowed due to a grab
906 /// being removed.
907 ///
908 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
909 /// grab widget in the grab stack of its window group is not
910 /// its ancestor.
911 ///
912 ///
913 ///
914 ///
915 /// #### `hide`
916 /// The ::hide signal is emitted when `widget` is hidden, for example with
917 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
918 ///
919 ///
920 ///
921 ///
922 /// #### `hierarchy-changed`
923 /// The ::hierarchy-changed signal is emitted when the
924 /// anchored state of a widget changes. A widget is
925 /// “anchored” when its toplevel
926 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
927 /// a widget changes from un-anchored to anchored or vice-versa.
928 ///
929 ///
930 ///
931 ///
932 /// #### `key-press-event`
933 /// The ::key-press-event signal is emitted when a key is pressed. The signal
934 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
935 ///
936 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
937 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
938 ///
939 /// This signal will be sent to the grab widget if there is one.
940 ///
941 ///
942 ///
943 ///
944 /// #### `key-release-event`
945 /// The ::key-release-event signal is emitted when a key is released.
946 ///
947 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
948 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
949 ///
950 /// This signal will be sent to the grab widget if there is one.
951 ///
952 ///
953 ///
954 ///
955 /// #### `keynav-failed`
956 /// Gets emitted if keyboard navigation fails.
957 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
958 ///
959 ///
960 ///
961 ///
962 /// #### `leave-notify-event`
963 /// The ::leave-notify-event will be emitted when the pointer leaves
964 /// the `widget`'s window.
965 ///
966 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
967 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
968 ///
969 /// This signal will be sent to the grab widget if there is one.
970 ///
971 ///
972 ///
973 ///
974 /// #### `map`
975 /// The ::map signal is emitted when `widget` is going to be mapped, that is
976 /// when the widget is visible (which is controlled with
977 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
978 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
979 /// be emitted.
980 ///
981 /// The ::map signal can be used to determine whether a widget will be drawn,
982 /// for instance it can resume an animation that was stopped during the
983 /// emission of [`unmap`][struct@crate::Widget#unmap].
984 ///
985 ///
986 ///
987 ///
988 /// #### `map-event`
989 /// The ::map-event signal will be emitted when the `widget`'s window is
990 /// mapped. A window is mapped when it becomes visible on the screen.
991 ///
992 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
993 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
994 /// automatically for all new windows.
995 ///
996 ///
997 ///
998 ///
999 /// #### `mnemonic-activate`
1000 /// The default handler for this signal activates `widget` if `group_cycling`
1001 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
1002 ///
1003 ///
1004 ///
1005 ///
1006 /// #### `motion-notify-event`
1007 /// The ::motion-notify-event signal is emitted when the pointer moves
1008 /// over the widget's [`gdk::Window`][crate::gdk::Window].
1009 ///
1010 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
1011 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
1012 ///
1013 /// This signal will be sent to the grab widget if there is one.
1014 ///
1015 ///
1016 ///
1017 ///
1018 /// #### `move-focus`
1019 /// Action
1020 ///
1021 ///
1022 /// #### `parent-set`
1023 /// The ::parent-set signal is emitted when a new parent
1024 /// has been set on a widget.
1025 ///
1026 ///
1027 ///
1028 ///
1029 /// #### `popup-menu`
1030 /// This signal gets emitted whenever a widget should pop up a context
1031 /// menu. This usually happens through the standard key binding mechanism;
1032 /// by pressing a certain key while a widget is focused, the user can cause
1033 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
1034 /// a menu with clipboard commands. See the
1035 /// [Popup Menu Migration Checklist][checklist-popup-menu]
1036 /// for an example of how to use this signal.
1037 ///
1038 /// Action
1039 ///
1040 ///
1041 /// #### `property-notify-event`
1042 /// The ::property-notify-event signal will be emitted when a property on
1043 /// the `widget`'s window has been changed or deleted.
1044 ///
1045 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1046 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1047 ///
1048 ///
1049 ///
1050 ///
1051 /// #### `proximity-in-event`
1052 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1053 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1054 ///
1055 /// This signal will be sent to the grab widget if there is one.
1056 ///
1057 ///
1058 ///
1059 ///
1060 /// #### `proximity-out-event`
1061 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1062 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1063 ///
1064 /// This signal will be sent to the grab widget if there is one.
1065 ///
1066 ///
1067 ///
1068 ///
1069 /// #### `query-tooltip`
1070 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1071 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1072 /// focus in keyboard mode.
1073 ///
1074 /// Using the given coordinates, the signal handler should determine
1075 /// whether a tooltip should be shown for `widget`. If this is the case
1076 /// [`true`] should be returned, [`false`] otherwise. Note that if
1077 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1078 /// should not be used.
1079 ///
1080 /// The signal handler is free to manipulate `tooltip` with the therefore
1081 /// destined function calls.
1082 ///
1083 ///
1084 ///
1085 ///
1086 /// #### `realize`
1087 /// The ::realize signal is emitted when `widget` is associated with a
1088 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1089 /// widget has been mapped (that is, it is going to be drawn).
1090 ///
1091 ///
1092 ///
1093 ///
1094 /// #### `screen-changed`
1095 /// The ::screen-changed signal gets emitted when the
1096 /// screen of a widget has changed.
1097 ///
1098 ///
1099 ///
1100 ///
1101 /// #### `scroll-event`
1102 /// The ::scroll-event signal is emitted when a button in the 4 to 7
1103 /// range is pressed. Wheel mice are usually configured to generate
1104 /// button press events for buttons 4 and 5 when the wheel is turned.
1105 ///
1106 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1107 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1108 ///
1109 /// This signal will be sent to the grab widget if there is one.
1110 ///
1111 ///
1112 ///
1113 ///
1114 /// #### `selection-clear-event`
1115 /// The ::selection-clear-event signal will be emitted when the
1116 /// the `widget`'s window has lost ownership of a selection.
1117 ///
1118 ///
1119 ///
1120 ///
1121 /// #### `selection-get`
1122 ///
1123 ///
1124 ///
1125 /// #### `selection-notify-event`
1126 ///
1127 ///
1128 ///
1129 /// #### `selection-received`
1130 ///
1131 ///
1132 ///
1133 /// #### `selection-request-event`
1134 /// The ::selection-request-event signal will be emitted when
1135 /// another client requests ownership of the selection owned by
1136 /// the `widget`'s window.
1137 ///
1138 ///
1139 ///
1140 ///
1141 /// #### `show`
1142 /// The ::show signal is emitted when `widget` is shown, for example with
1143 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1144 ///
1145 ///
1146 ///
1147 ///
1148 /// #### `show-help`
1149 /// Action
1150 ///
1151 ///
1152 /// #### `size-allocate`
1153 ///
1154 ///
1155 ///
1156 /// #### `state-changed`
1157 /// The ::state-changed signal is emitted when the widget state changes.
1158 /// See `gtk_widget_get_state()`.
1159 ///
1160 ///
1161 ///
1162 ///
1163 /// #### `state-flags-changed`
1164 /// The ::state-flags-changed signal is emitted when the widget state
1165 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1166 ///
1167 ///
1168 ///
1169 ///
1170 /// #### `style-set`
1171 /// The ::style-set signal is emitted when a new style has been set
1172 /// on a widget. Note that style-modifying functions like
1173 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1174 ///
1175 /// Note that this signal is emitted for changes to the deprecated
1176 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1177 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1178 ///
1179 ///
1180 ///
1181 ///
1182 /// #### `style-updated`
1183 /// The ::style-updated signal is a convenience signal that is emitted when the
1184 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1185 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1186 ///
1187 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1188 /// cause this signal to be emitted.
1189 ///
1190 ///
1191 ///
1192 ///
1193 /// #### `touch-event`
1194 ///
1195 ///
1196 ///
1197 /// #### `unmap`
1198 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1199 /// means that either it or any of its parents up to the toplevel widget have
1200 /// been set as hidden.
1201 ///
1202 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1203 /// used to, for example, stop an animation on the widget.
1204 ///
1205 ///
1206 ///
1207 ///
1208 /// #### `unmap-event`
1209 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1210 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1211 ///
1212 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1213 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1214 /// automatically for all new windows.
1215 ///
1216 ///
1217 ///
1218 ///
1219 /// #### `unrealize`
1220 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1221 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1222 /// called or the widget has been unmapped (that is, it is going to be
1223 /// hidden).
1224 ///
1225 ///
1226 ///
1227 ///
1228 /// #### `visibility-notify-event`
1229 /// The ::visibility-notify-event will be emitted when the `widget`'s
1230 /// window is obscured or unobscured.
1231 ///
1232 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1233 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1234 ///
1235 ///
1236 ///
1237 ///
1238 /// #### `window-state-event`
1239 /// The ::window-state-event will be emitted when the state of the
1240 /// toplevel window associated to the `widget` changes.
1241 ///
1242 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1243 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1244 /// this mask automatically for all new windows.
1245 ///
1246 ///
1247 /// </details>
1248 /// <details><summary><h4>FileChooser</h4></summary>
1249 ///
1250 ///
1251 /// #### `confirm-overwrite`
1252 ///
1253 /// static GtkFileChooserConfirmation
1254 /// confirm_overwrite_callback (GtkFileChooser *chooser, gpointer data)
1255 /// {
1256 /// char *uri;
1257 ///
1258 /// uri = gtk_file_chooser_get_uri (chooser);
1259 ///
1260 /// if (is_uri_read_only (uri))
1261 /// {
1262 /// if (user_wants_to_replace_read_only_file (uri))
1263 /// return GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME;
1264 /// else
1265 /// return GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN;
1266 /// } else
1267 /// return GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM; // fall back to the default dialog
1268 /// }
1269 ///
1270 /// ...
1271 ///
1272 /// chooser = gtk_file_chooser_dialog_new (...);
1273 ///
1274 /// gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
1275 /// g_signal_connect (chooser, "confirm-overwrite",
1276 /// G_CALLBACK (confirm_overwrite_callback), NULL);
1277 ///
1278 /// if (gtk_dialog_run (chooser) == GTK_RESPONSE_ACCEPT)
1279 /// save_to_file (gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser));
1280 ///
1281 /// gtk_widget_destroy (chooser);
1282 /// ]|
1283 ///
1284 ///
1285 ///
1286 ///
1287 /// #### `current-folder-changed`
1288 /// This signal is emitted when the current folder in a [`FileChooser`][crate::FileChooser]
1289 /// changes. This can happen due to the user performing some action that
1290 /// changes folders, such as selecting a bookmark or visiting a folder on the
1291 /// file list. It can also happen as a result of calling a function to
1292 /// explicitly change the current folder in a file chooser.
1293 ///
1294 /// Normally you do not need to connect to this signal, unless you need to keep
1295 /// track of which folder a file chooser is showing.
1296 ///
1297 /// See also: [`FileChooserExt::set_current_folder()`][crate::prelude::FileChooserExt::set_current_folder()],
1298 /// [`FileChooserExt::current_folder()`][crate::prelude::FileChooserExt::current_folder()],
1299 /// [`FileChooserExt::set_current_folder_uri()`][crate::prelude::FileChooserExt::set_current_folder_uri()],
1300 /// [`FileChooserExt::current_folder_uri()`][crate::prelude::FileChooserExt::current_folder_uri()].
1301 ///
1302 ///
1303 ///
1304 ///
1305 /// #### `file-activated`
1306 /// This signal is emitted when the user "activates" a file in the file
1307 /// chooser. This can happen by double-clicking on a file in the file list, or
1308 /// by pressing `Enter`.
1309 ///
1310 /// Normally you do not need to connect to this signal. It is used internally
1311 /// by [`FileChooserDialog`][crate::FileChooserDialog] to know when to activate the default button in the
1312 /// dialog.
1313 ///
1314 /// See also: [`FileChooserExt::filename()`][crate::prelude::FileChooserExt::filename()],
1315 /// [`FileChooserExt::filenames()`][crate::prelude::FileChooserExt::filenames()], [`FileChooserExt::uri()`][crate::prelude::FileChooserExt::uri()],
1316 /// [`FileChooserExt::uris()`][crate::prelude::FileChooserExt::uris()].
1317 ///
1318 ///
1319 ///
1320 ///
1321 /// #### `selection-changed`
1322 /// This signal is emitted when there is a change in the set of selected files
1323 /// in a [`FileChooser`][crate::FileChooser]. This can happen when the user modifies the selection
1324 /// with the mouse or the keyboard, or when explicitly calling functions to
1325 /// change the selection.
1326 ///
1327 /// Normally you do not need to connect to this signal, as it is easier to wait
1328 /// for the file chooser to finish running, and then to get the list of
1329 /// selected files using the functions mentioned below.
1330 ///
1331 /// See also: [`FileChooserExt::select_filename()`][crate::prelude::FileChooserExt::select_filename()],
1332 /// [`FileChooserExt::unselect_filename()`][crate::prelude::FileChooserExt::unselect_filename()], [`FileChooserExt::filename()`][crate::prelude::FileChooserExt::filename()],
1333 /// [`FileChooserExt::filenames()`][crate::prelude::FileChooserExt::filenames()], [`FileChooserExt::select_uri()`][crate::prelude::FileChooserExt::select_uri()],
1334 /// [`FileChooserExt::unselect_uri()`][crate::prelude::FileChooserExt::unselect_uri()], [`FileChooserExt::uri()`][crate::prelude::FileChooserExt::uri()],
1335 /// [`FileChooserExt::uris()`][crate::prelude::FileChooserExt::uris()].
1336 ///
1337 ///
1338 ///
1339 ///
1340 /// #### `update-preview`
1341 /// This signal is emitted when the preview in a file chooser should be
1342 /// regenerated. For example, this can happen when the currently selected file
1343 /// changes. You should use this signal if you want your file chooser to have
1344 /// a preview widget.
1345 ///
1346 /// Once you have installed a preview widget with
1347 /// [`FileChooserExt::set_preview_widget()`][crate::prelude::FileChooserExt::set_preview_widget()], you should update it when this
1348 /// signal is emitted. You can use the functions
1349 /// [`FileChooserExt::preview_filename()`][crate::prelude::FileChooserExt::preview_filename()] or
1350 /// [`FileChooserExt::preview_uri()`][crate::prelude::FileChooserExt::preview_uri()] to get the name of the file to preview.
1351 /// Your widget may not be able to preview all kinds of files; your callback
1352 /// must call [`FileChooserExt::set_preview_widget_active()`][crate::prelude::FileChooserExt::set_preview_widget_active()] to inform the file
1353 /// chooser about whether the preview was generated successfully or not.
1354 ///
1355 /// Please see the example code in
1356 /// [Using a Preview Widget][gtkfilechooser-preview].
1357 ///
1358 /// See also: [`FileChooserExt::set_preview_widget()`][crate::prelude::FileChooserExt::set_preview_widget()],
1359 /// [`FileChooserExt::set_preview_widget_active()`][crate::prelude::FileChooserExt::set_preview_widget_active()],
1360 /// [`FileChooserExt::set_use_preview_label()`][crate::prelude::FileChooserExt::set_use_preview_label()],
1361 /// [`FileChooserExt::preview_filename()`][crate::prelude::FileChooserExt::preview_filename()],
1362 /// [`FileChooserExt::preview_uri()`][crate::prelude::FileChooserExt::preview_uri()].
1363 ///
1364 ///
1365 /// </details>
1366 ///
1367 /// # Implements
1368 ///
1369 /// [`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]
1370 #[doc(alias = "GtkFileChooserWidget")]
1371 pub struct FileChooserWidget(Object<ffi::GtkFileChooserWidget, ffi::GtkFileChooserWidgetClass>) @extends Box, Container, Widget, @implements Buildable, Orientable, FileChooser;
1372
1373 match fn {
1374 type_ => || ffi::gtk_file_chooser_widget_get_type(),
1375 }
1376}
1377
1378impl FileChooserWidget {
1379 pub const NONE: Option<&'static FileChooserWidget> = None;
1380
1381 /// Creates a new [`FileChooserWidget`][crate::FileChooserWidget]. This is a file chooser widget that can
1382 /// be embedded in custom windows, and it is the same widget that is used by
1383 /// [`FileChooserDialog`][crate::FileChooserDialog].
1384 /// ## `action`
1385 /// Open or save mode for the widget
1386 ///
1387 /// # Returns
1388 ///
1389 /// a new [`FileChooserWidget`][crate::FileChooserWidget]
1390 #[doc(alias = "gtk_file_chooser_widget_new")]
1391 pub fn new(action: FileChooserAction) -> FileChooserWidget {
1392 assert_initialized_main_thread!();
1393 unsafe {
1394 Widget::from_glib_none(ffi::gtk_file_chooser_widget_new(action.into_glib()))
1395 .unsafe_cast()
1396 }
1397 }
1398
1399 // rustdoc-stripper-ignore-next
1400 /// Creates a new builder-pattern struct instance to construct [`FileChooserWidget`] objects.
1401 ///
1402 /// This method returns an instance of [`FileChooserWidgetBuilder`](crate::builders::FileChooserWidgetBuilder) which can be used to create [`FileChooserWidget`] objects.
1403 pub fn builder() -> FileChooserWidgetBuilder {
1404 FileChooserWidgetBuilder::new()
1405 }
1406}
1407
1408impl Default for FileChooserWidget {
1409 fn default() -> Self {
1410 glib::object::Object::new::<Self>()
1411 }
1412}
1413
1414// rustdoc-stripper-ignore-next
1415/// A [builder-pattern] type to construct [`FileChooserWidget`] objects.
1416///
1417/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1418#[must_use = "The builder must be built to be used"]
1419pub struct FileChooserWidgetBuilder {
1420 builder: glib::object::ObjectBuilder<'static, FileChooserWidget>,
1421}
1422
1423impl FileChooserWidgetBuilder {
1424 fn new() -> Self {
1425 Self {
1426 builder: glib::object::Object::builder(),
1427 }
1428 }
1429
1430 pub fn search_mode(self, search_mode: bool) -> Self {
1431 Self {
1432 builder: self.builder.property("search-mode", search_mode),
1433 }
1434 }
1435
1436 pub fn baseline_position(self, baseline_position: BaselinePosition) -> Self {
1437 Self {
1438 builder: self
1439 .builder
1440 .property("baseline-position", baseline_position),
1441 }
1442 }
1443
1444 pub fn homogeneous(self, homogeneous: bool) -> Self {
1445 Self {
1446 builder: self.builder.property("homogeneous", homogeneous),
1447 }
1448 }
1449
1450 pub fn spacing(self, spacing: i32) -> Self {
1451 Self {
1452 builder: self.builder.property("spacing", spacing),
1453 }
1454 }
1455
1456 pub fn border_width(self, border_width: u32) -> Self {
1457 Self {
1458 builder: self.builder.property("border-width", border_width),
1459 }
1460 }
1461
1462 pub fn child(self, child: &impl IsA<Widget>) -> Self {
1463 Self {
1464 builder: self.builder.property("child", child.clone().upcast()),
1465 }
1466 }
1467
1468 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1469 Self {
1470 builder: self.builder.property("resize-mode", resize_mode),
1471 }
1472 }
1473
1474 pub fn app_paintable(self, app_paintable: bool) -> Self {
1475 Self {
1476 builder: self.builder.property("app-paintable", app_paintable),
1477 }
1478 }
1479
1480 pub fn can_default(self, can_default: bool) -> Self {
1481 Self {
1482 builder: self.builder.property("can-default", can_default),
1483 }
1484 }
1485
1486 pub fn can_focus(self, can_focus: bool) -> Self {
1487 Self {
1488 builder: self.builder.property("can-focus", can_focus),
1489 }
1490 }
1491
1492 pub fn events(self, events: gdk::EventMask) -> Self {
1493 Self {
1494 builder: self.builder.property("events", events),
1495 }
1496 }
1497
1498 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1499 pub fn expand(self, expand: bool) -> Self {
1500 Self {
1501 builder: self.builder.property("expand", expand),
1502 }
1503 }
1504
1505 /// Whether the widget should grab focus when it is clicked with the mouse.
1506 ///
1507 /// This property is only relevant for widgets that can take focus.
1508 ///
1509 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1510 /// GtkComboBox) implemented this property individually.
1511 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1512 Self {
1513 builder: self.builder.property("focus-on-click", focus_on_click),
1514 }
1515 }
1516
1517 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1518 pub fn halign(self, halign: Align) -> Self {
1519 Self {
1520 builder: self.builder.property("halign", halign),
1521 }
1522 }
1523
1524 pub fn has_default(self, has_default: bool) -> Self {
1525 Self {
1526 builder: self.builder.property("has-default", has_default),
1527 }
1528 }
1529
1530 pub fn has_focus(self, has_focus: bool) -> Self {
1531 Self {
1532 builder: self.builder.property("has-focus", has_focus),
1533 }
1534 }
1535
1536 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1537 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1538 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1539 /// whether it will provide a tooltip or not.
1540 ///
1541 /// Note that setting this property to [`true`] for the first time will change
1542 /// the event masks of the GdkWindows of this widget to include leave-notify
1543 /// and motion-notify events. This cannot and will not be undone when the
1544 /// property is set to [`false`] again.
1545 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1546 Self {
1547 builder: self.builder.property("has-tooltip", has_tooltip),
1548 }
1549 }
1550
1551 pub fn height_request(self, height_request: i32) -> Self {
1552 Self {
1553 builder: self.builder.property("height-request", height_request),
1554 }
1555 }
1556
1557 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1558 pub fn hexpand(self, hexpand: bool) -> Self {
1559 Self {
1560 builder: self.builder.property("hexpand", hexpand),
1561 }
1562 }
1563
1564 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1565 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1566 Self {
1567 builder: self.builder.property("hexpand-set", hexpand_set),
1568 }
1569 }
1570
1571 pub fn is_focus(self, is_focus: bool) -> Self {
1572 Self {
1573 builder: self.builder.property("is-focus", is_focus),
1574 }
1575 }
1576
1577 /// Sets all four sides' margin at once. If read, returns max
1578 /// margin on any side.
1579 pub fn margin(self, margin: i32) -> Self {
1580 Self {
1581 builder: self.builder.property("margin", margin),
1582 }
1583 }
1584
1585 /// Margin on bottom side of widget.
1586 ///
1587 /// This property adds margin outside of the widget's normal size
1588 /// request, the margin will be added in addition to the size from
1589 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1590 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1591 Self {
1592 builder: self.builder.property("margin-bottom", margin_bottom),
1593 }
1594 }
1595
1596 /// Margin on end of widget, horizontally. This property supports
1597 /// left-to-right and right-to-left text directions.
1598 ///
1599 /// This property adds margin outside of the widget's normal size
1600 /// request, the margin will be added in addition to the size from
1601 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1602 pub fn margin_end(self, margin_end: i32) -> Self {
1603 Self {
1604 builder: self.builder.property("margin-end", margin_end),
1605 }
1606 }
1607
1608 /// Margin on start of widget, horizontally. This property supports
1609 /// left-to-right and right-to-left text directions.
1610 ///
1611 /// This property adds margin outside of the widget's normal size
1612 /// request, the margin will be added in addition to the size from
1613 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1614 pub fn margin_start(self, margin_start: i32) -> Self {
1615 Self {
1616 builder: self.builder.property("margin-start", margin_start),
1617 }
1618 }
1619
1620 /// Margin on top side of widget.
1621 ///
1622 /// This property adds margin outside of the widget's normal size
1623 /// request, the margin will be added in addition to the size from
1624 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1625 pub fn margin_top(self, margin_top: i32) -> Self {
1626 Self {
1627 builder: self.builder.property("margin-top", margin_top),
1628 }
1629 }
1630
1631 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1632 Self {
1633 builder: self.builder.property("name", name.into()),
1634 }
1635 }
1636
1637 pub fn no_show_all(self, no_show_all: bool) -> Self {
1638 Self {
1639 builder: self.builder.property("no-show-all", no_show_all),
1640 }
1641 }
1642
1643 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1644 /// more details about window opacity.
1645 ///
1646 /// Before 3.8 this was only available in GtkWindow
1647 pub fn opacity(self, opacity: f64) -> Self {
1648 Self {
1649 builder: self.builder.property("opacity", opacity),
1650 }
1651 }
1652
1653 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1654 Self {
1655 builder: self.builder.property("parent", parent.clone().upcast()),
1656 }
1657 }
1658
1659 pub fn receives_default(self, receives_default: bool) -> Self {
1660 Self {
1661 builder: self.builder.property("receives-default", receives_default),
1662 }
1663 }
1664
1665 pub fn sensitive(self, sensitive: bool) -> Self {
1666 Self {
1667 builder: self.builder.property("sensitive", sensitive),
1668 }
1669 }
1670
1671 /// Sets the text of tooltip to be the given string, which is marked up
1672 /// with the [Pango text markup language][PangoMarkupFormat].
1673 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1674 ///
1675 /// This is a convenience property which will take care of getting the
1676 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1677 /// will automatically be set to [`true`] and there will be taken care of
1678 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1679 ///
1680 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1681 /// are set, the last one wins.
1682 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1683 Self {
1684 builder: self
1685 .builder
1686 .property("tooltip-markup", tooltip_markup.into()),
1687 }
1688 }
1689
1690 /// Sets the text of tooltip to be the given string.
1691 ///
1692 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1693 ///
1694 /// This is a convenience property which will take care of getting the
1695 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1696 /// will automatically be set to [`true`] and there will be taken care of
1697 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1698 ///
1699 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1700 /// are set, the last one wins.
1701 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1702 Self {
1703 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1704 }
1705 }
1706
1707 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1708 pub fn valign(self, valign: Align) -> Self {
1709 Self {
1710 builder: self.builder.property("valign", valign),
1711 }
1712 }
1713
1714 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1715 pub fn vexpand(self, vexpand: bool) -> Self {
1716 Self {
1717 builder: self.builder.property("vexpand", vexpand),
1718 }
1719 }
1720
1721 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1722 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1723 Self {
1724 builder: self.builder.property("vexpand-set", vexpand_set),
1725 }
1726 }
1727
1728 pub fn visible(self, visible: bool) -> Self {
1729 Self {
1730 builder: self.builder.property("visible", visible),
1731 }
1732 }
1733
1734 pub fn width_request(self, width_request: i32) -> Self {
1735 Self {
1736 builder: self.builder.property("width-request", width_request),
1737 }
1738 }
1739
1740 /// The orientation of the orientable.
1741 pub fn orientation(self, orientation: Orientation) -> Self {
1742 Self {
1743 builder: self.builder.property("orientation", orientation),
1744 }
1745 }
1746
1747 pub fn action(self, action: FileChooserAction) -> Self {
1748 Self {
1749 builder: self.builder.property("action", action),
1750 }
1751 }
1752
1753 /// Whether a file chooser not in [`FileChooserAction::Open`][crate::FileChooserAction::Open] mode
1754 /// will offer the user to create new folders.
1755 pub fn create_folders(self, create_folders: bool) -> Self {
1756 Self {
1757 builder: self.builder.property("create-folders", create_folders),
1758 }
1759 }
1760
1761 /// Whether a file chooser in [`FileChooserAction::Save`][crate::FileChooserAction::Save] mode
1762 /// will present an overwrite confirmation dialog if the user
1763 /// selects a file name that already exists.
1764 pub fn do_overwrite_confirmation(self, do_overwrite_confirmation: bool) -> Self {
1765 Self {
1766 builder: self
1767 .builder
1768 .property("do-overwrite-confirmation", do_overwrite_confirmation),
1769 }
1770 }
1771
1772 pub fn extra_widget(self, extra_widget: &impl IsA<Widget>) -> Self {
1773 Self {
1774 builder: self
1775 .builder
1776 .property("extra-widget", extra_widget.clone().upcast()),
1777 }
1778 }
1779
1780 pub fn filter(self, filter: &FileFilter) -> Self {
1781 Self {
1782 builder: self.builder.property("filter", filter.clone()),
1783 }
1784 }
1785
1786 pub fn local_only(self, local_only: bool) -> Self {
1787 Self {
1788 builder: self.builder.property("local-only", local_only),
1789 }
1790 }
1791
1792 pub fn preview_widget(self, preview_widget: &impl IsA<Widget>) -> Self {
1793 Self {
1794 builder: self
1795 .builder
1796 .property("preview-widget", preview_widget.clone().upcast()),
1797 }
1798 }
1799
1800 pub fn preview_widget_active(self, preview_widget_active: bool) -> Self {
1801 Self {
1802 builder: self
1803 .builder
1804 .property("preview-widget-active", preview_widget_active),
1805 }
1806 }
1807
1808 pub fn select_multiple(self, select_multiple: bool) -> Self {
1809 Self {
1810 builder: self.builder.property("select-multiple", select_multiple),
1811 }
1812 }
1813
1814 pub fn show_hidden(self, show_hidden: bool) -> Self {
1815 Self {
1816 builder: self.builder.property("show-hidden", show_hidden),
1817 }
1818 }
1819
1820 pub fn use_preview_label(self, use_preview_label: bool) -> Self {
1821 Self {
1822 builder: self
1823 .builder
1824 .property("use-preview-label", use_preview_label),
1825 }
1826 }
1827
1828 // rustdoc-stripper-ignore-next
1829 /// Build the [`FileChooserWidget`].
1830 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1831 pub fn build(self) -> FileChooserWidget {
1832 assert_initialized_main_thread!();
1833 self.builder.build()
1834 }
1835}
1836
1837/// Trait containing all [`struct@FileChooserWidget`] methods.
1838///
1839/// # Implementors
1840///
1841/// [`FileChooserWidget`][struct@crate::FileChooserWidget]
1842pub trait FileChooserWidgetExt: IsA<FileChooserWidget> + 'static {
1843 #[doc(alias = "search-mode")]
1844 fn is_search_mode(&self) -> bool {
1845 ObjectExt::property(self.as_ref(), "search-mode")
1846 }
1847
1848 #[doc(alias = "search-mode")]
1849 fn set_search_mode(&self, search_mode: bool) {
1850 ObjectExt::set_property(self.as_ref(), "search-mode", search_mode)
1851 }
1852
1853 fn subtitle(&self) -> Option<glib::GString> {
1854 ObjectExt::property(self.as_ref(), "subtitle")
1855 }
1856
1857 /// The ::desktop-folder signal is a [keybinding signal][GtkBindingSignal]
1858 /// which gets emitted when the user asks for it.
1859 ///
1860 /// This is used to make the file chooser show the user's Desktop
1861 /// folder in the file list.
1862 ///
1863 /// The default binding for this signal is `Alt + D`.
1864 #[doc(alias = "desktop-folder")]
1865 fn connect_desktop_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1866 unsafe extern "C" fn desktop_folder_trampoline<
1867 P: IsA<FileChooserWidget>,
1868 F: Fn(&P) + 'static,
1869 >(
1870 this: *mut ffi::GtkFileChooserWidget,
1871 f: glib::ffi::gpointer,
1872 ) {
1873 unsafe {
1874 let f: &F = &*(f as *const F);
1875 f(FileChooserWidget::from_glib_borrow(this).unsafe_cast_ref())
1876 }
1877 }
1878 unsafe {
1879 let f: Box_<F> = Box_::new(f);
1880 connect_raw(
1881 self.as_ptr() as *mut _,
1882 c"desktop-folder".as_ptr(),
1883 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1884 desktop_folder_trampoline::<Self, F> as *const (),
1885 )),
1886 Box_::into_raw(f),
1887 )
1888 }
1889 }
1890
1891 fn emit_desktop_folder(&self) {
1892 self.emit_by_name::<()>("desktop-folder", &[]);
1893 }
1894
1895 /// The ::down-folder signal is a [keybinding signal][GtkBindingSignal]
1896 /// which gets emitted when the user asks for it.
1897 ///
1898 /// This is used to make the file chooser go to a child of the current folder
1899 /// in the file hierarchy. The subfolder that will be used is displayed in the
1900 /// path bar widget of the file chooser. For example, if the path bar is showing
1901 /// "/foo/bar/baz", with bar currently displayed, then this will cause the file
1902 /// chooser to switch to the "baz" subfolder.
1903 ///
1904 /// The default binding for this signal is `Alt + Down`.
1905 #[doc(alias = "down-folder")]
1906 fn connect_down_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1907 unsafe extern "C" fn down_folder_trampoline<
1908 P: IsA<FileChooserWidget>,
1909 F: Fn(&P) + 'static,
1910 >(
1911 this: *mut ffi::GtkFileChooserWidget,
1912 f: glib::ffi::gpointer,
1913 ) {
1914 unsafe {
1915 let f: &F = &*(f as *const F);
1916 f(FileChooserWidget::from_glib_borrow(this).unsafe_cast_ref())
1917 }
1918 }
1919 unsafe {
1920 let f: Box_<F> = Box_::new(f);
1921 connect_raw(
1922 self.as_ptr() as *mut _,
1923 c"down-folder".as_ptr(),
1924 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1925 down_folder_trampoline::<Self, F> as *const (),
1926 )),
1927 Box_::into_raw(f),
1928 )
1929 }
1930 }
1931
1932 fn emit_down_folder(&self) {
1933 self.emit_by_name::<()>("down-folder", &[]);
1934 }
1935
1936 /// The ::home-folder signal is a [keybinding signal][GtkBindingSignal]
1937 /// which gets emitted when the user asks for it.
1938 ///
1939 /// This is used to make the file chooser show the user's home
1940 /// folder in the file list.
1941 ///
1942 /// The default binding for this signal is `Alt + Home`.
1943 #[doc(alias = "home-folder")]
1944 fn connect_home_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1945 unsafe extern "C" fn home_folder_trampoline<
1946 P: IsA<FileChooserWidget>,
1947 F: Fn(&P) + 'static,
1948 >(
1949 this: *mut ffi::GtkFileChooserWidget,
1950 f: glib::ffi::gpointer,
1951 ) {
1952 unsafe {
1953 let f: &F = &*(f as *const F);
1954 f(FileChooserWidget::from_glib_borrow(this).unsafe_cast_ref())
1955 }
1956 }
1957 unsafe {
1958 let f: Box_<F> = Box_::new(f);
1959 connect_raw(
1960 self.as_ptr() as *mut _,
1961 c"home-folder".as_ptr(),
1962 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1963 home_folder_trampoline::<Self, F> as *const (),
1964 )),
1965 Box_::into_raw(f),
1966 )
1967 }
1968 }
1969
1970 fn emit_home_folder(&self) {
1971 self.emit_by_name::<()>("home-folder", &[]);
1972 }
1973
1974 /// The ::location-popup signal is a [keybinding signal][GtkBindingSignal]
1975 /// which gets emitted when the user asks for it.
1976 ///
1977 /// This is used to make the file chooser show a "Location" prompt which
1978 /// the user can use to manually type the name of the file he wishes to select.
1979 ///
1980 /// The default bindings for this signal are `Control + L` with a `path` string
1981 /// of "" (the empty string). It is also bound to `/` with a `path` string of
1982 /// "`/`" (a slash): this lets you type `/` and immediately type a path name.
1983 /// On Unix systems, this is bound to `~` (tilde) with a `path` string of "~"
1984 /// itself for access to home directories.
1985 /// ## `path`
1986 /// a string that gets put in the text entry for the file name
1987 #[doc(alias = "location-popup")]
1988 fn connect_location_popup<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId {
1989 unsafe extern "C" fn location_popup_trampoline<
1990 P: IsA<FileChooserWidget>,
1991 F: Fn(&P, &str) + 'static,
1992 >(
1993 this: *mut ffi::GtkFileChooserWidget,
1994 path: *mut std::ffi::c_char,
1995 f: glib::ffi::gpointer,
1996 ) {
1997 unsafe {
1998 let f: &F = &*(f as *const F);
1999 f(
2000 FileChooserWidget::from_glib_borrow(this).unsafe_cast_ref(),
2001 &glib::GString::from_glib_borrow(path),
2002 )
2003 }
2004 }
2005 unsafe {
2006 let f: Box_<F> = Box_::new(f);
2007 connect_raw(
2008 self.as_ptr() as *mut _,
2009 c"location-popup".as_ptr(),
2010 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2011 location_popup_trampoline::<Self, F> as *const (),
2012 )),
2013 Box_::into_raw(f),
2014 )
2015 }
2016 }
2017
2018 fn emit_location_popup(&self, path: &str) {
2019 self.emit_by_name::<()>("location-popup", &[&path]);
2020 }
2021
2022 /// The ::location-popup-on-paste signal is a [keybinding signal][GtkBindingSignal]
2023 /// which gets emitted when the user asks for it.
2024 ///
2025 /// This is used to make the file chooser show a "Location" prompt when the user
2026 /// pastes into a [`FileChooserWidget`][crate::FileChooserWidget].
2027 ///
2028 /// The default binding for this signal is `Control + V`.
2029 #[doc(alias = "location-popup-on-paste")]
2030 fn connect_location_popup_on_paste<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2031 unsafe extern "C" fn location_popup_on_paste_trampoline<
2032 P: IsA<FileChooserWidget>,
2033 F: Fn(&P) + 'static,
2034 >(
2035 this: *mut ffi::GtkFileChooserWidget,
2036 f: glib::ffi::gpointer,
2037 ) {
2038 unsafe {
2039 let f: &F = &*(f as *const F);
2040 f(FileChooserWidget::from_glib_borrow(this).unsafe_cast_ref())
2041 }
2042 }
2043 unsafe {
2044 let f: Box_<F> = Box_::new(f);
2045 connect_raw(
2046 self.as_ptr() as *mut _,
2047 c"location-popup-on-paste".as_ptr(),
2048 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2049 location_popup_on_paste_trampoline::<Self, F> as *const (),
2050 )),
2051 Box_::into_raw(f),
2052 )
2053 }
2054 }
2055
2056 fn emit_location_popup_on_paste(&self) {
2057 self.emit_by_name::<()>("location-popup-on-paste", &[]);
2058 }
2059
2060 /// The ::location-toggle-popup signal is a [keybinding signal][GtkBindingSignal]
2061 /// which gets emitted when the user asks for it.
2062 ///
2063 /// This is used to toggle the visibility of a "Location" prompt which the user
2064 /// can use to manually type the name of the file he wishes to select.
2065 ///
2066 /// The default binding for this signal is `Control + L`.
2067 #[doc(alias = "location-toggle-popup")]
2068 fn connect_location_toggle_popup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2069 unsafe extern "C" fn location_toggle_popup_trampoline<
2070 P: IsA<FileChooserWidget>,
2071 F: Fn(&P) + 'static,
2072 >(
2073 this: *mut ffi::GtkFileChooserWidget,
2074 f: glib::ffi::gpointer,
2075 ) {
2076 unsafe {
2077 let f: &F = &*(f as *const F);
2078 f(FileChooserWidget::from_glib_borrow(this).unsafe_cast_ref())
2079 }
2080 }
2081 unsafe {
2082 let f: Box_<F> = Box_::new(f);
2083 connect_raw(
2084 self.as_ptr() as *mut _,
2085 c"location-toggle-popup".as_ptr(),
2086 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2087 location_toggle_popup_trampoline::<Self, F> as *const (),
2088 )),
2089 Box_::into_raw(f),
2090 )
2091 }
2092 }
2093
2094 fn emit_location_toggle_popup(&self) {
2095 self.emit_by_name::<()>("location-toggle-popup", &[]);
2096 }
2097
2098 /// The ::places-shortcut signal is a [keybinding signal][GtkBindingSignal]
2099 /// which gets emitted when the user asks for it.
2100 ///
2101 /// This is used to move the focus to the places sidebar.
2102 ///
2103 /// The default binding for this signal is `Alt + P`.
2104 #[doc(alias = "places-shortcut")]
2105 fn connect_places_shortcut<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2106 unsafe extern "C" fn places_shortcut_trampoline<
2107 P: IsA<FileChooserWidget>,
2108 F: Fn(&P) + 'static,
2109 >(
2110 this: *mut ffi::GtkFileChooserWidget,
2111 f: glib::ffi::gpointer,
2112 ) {
2113 unsafe {
2114 let f: &F = &*(f as *const F);
2115 f(FileChooserWidget::from_glib_borrow(this).unsafe_cast_ref())
2116 }
2117 }
2118 unsafe {
2119 let f: Box_<F> = Box_::new(f);
2120 connect_raw(
2121 self.as_ptr() as *mut _,
2122 c"places-shortcut".as_ptr(),
2123 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2124 places_shortcut_trampoline::<Self, F> as *const (),
2125 )),
2126 Box_::into_raw(f),
2127 )
2128 }
2129 }
2130
2131 fn emit_places_shortcut(&self) {
2132 self.emit_by_name::<()>("places-shortcut", &[]);
2133 }
2134
2135 /// The ::quick-bookmark signal is a [keybinding signal][GtkBindingSignal]
2136 /// which gets emitted when the user asks for it.
2137 ///
2138 /// This is used to make the file chooser switch to the bookmark specified
2139 /// in the `bookmark_index` parameter. For example, if you have three bookmarks,
2140 /// you can pass 0, 1, 2 to this signal to switch to each of them, respectively.
2141 ///
2142 /// The default binding for this signal is `Alt + 1`, `Alt + 2`,
2143 /// etc. until `Alt + 0`. Note that in the default binding, that
2144 /// `Alt + 1` is actually defined to switch to the bookmark at index
2145 /// 0, and so on successively; `Alt + 0` is defined to switch to the
2146 /// bookmark at index 10.
2147 /// ## `bookmark_index`
2148 /// the number of the bookmark to switch to
2149 #[doc(alias = "quick-bookmark")]
2150 fn connect_quick_bookmark<F: Fn(&Self, i32) + 'static>(&self, f: F) -> SignalHandlerId {
2151 unsafe extern "C" fn quick_bookmark_trampoline<
2152 P: IsA<FileChooserWidget>,
2153 F: Fn(&P, i32) + 'static,
2154 >(
2155 this: *mut ffi::GtkFileChooserWidget,
2156 bookmark_index: std::ffi::c_int,
2157 f: glib::ffi::gpointer,
2158 ) {
2159 unsafe {
2160 let f: &F = &*(f as *const F);
2161 f(
2162 FileChooserWidget::from_glib_borrow(this).unsafe_cast_ref(),
2163 bookmark_index,
2164 )
2165 }
2166 }
2167 unsafe {
2168 let f: Box_<F> = Box_::new(f);
2169 connect_raw(
2170 self.as_ptr() as *mut _,
2171 c"quick-bookmark".as_ptr(),
2172 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2173 quick_bookmark_trampoline::<Self, F> as *const (),
2174 )),
2175 Box_::into_raw(f),
2176 )
2177 }
2178 }
2179
2180 fn emit_quick_bookmark(&self, bookmark_index: i32) {
2181 self.emit_by_name::<()>("quick-bookmark", &[&bookmark_index]);
2182 }
2183
2184 /// The ::recent-shortcut signal is a [keybinding signal][GtkBindingSignal]
2185 /// which gets emitted when the user asks for it.
2186 ///
2187 /// This is used to make the file chooser show the Recent location.
2188 ///
2189 /// The default binding for this signal is `Alt + R`.
2190 #[doc(alias = "recent-shortcut")]
2191 fn connect_recent_shortcut<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2192 unsafe extern "C" fn recent_shortcut_trampoline<
2193 P: IsA<FileChooserWidget>,
2194 F: Fn(&P) + 'static,
2195 >(
2196 this: *mut ffi::GtkFileChooserWidget,
2197 f: glib::ffi::gpointer,
2198 ) {
2199 unsafe {
2200 let f: &F = &*(f as *const F);
2201 f(FileChooserWidget::from_glib_borrow(this).unsafe_cast_ref())
2202 }
2203 }
2204 unsafe {
2205 let f: Box_<F> = Box_::new(f);
2206 connect_raw(
2207 self.as_ptr() as *mut _,
2208 c"recent-shortcut".as_ptr(),
2209 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2210 recent_shortcut_trampoline::<Self, F> as *const (),
2211 )),
2212 Box_::into_raw(f),
2213 )
2214 }
2215 }
2216
2217 fn emit_recent_shortcut(&self) {
2218 self.emit_by_name::<()>("recent-shortcut", &[]);
2219 }
2220
2221 /// The ::search-shortcut signal is a [keybinding signal][GtkBindingSignal]
2222 /// which gets emitted when the user asks for it.
2223 ///
2224 /// This is used to make the file chooser show the search entry.
2225 ///
2226 /// The default binding for this signal is `Alt + S`.
2227 #[doc(alias = "search-shortcut")]
2228 fn connect_search_shortcut<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2229 unsafe extern "C" fn search_shortcut_trampoline<
2230 P: IsA<FileChooserWidget>,
2231 F: Fn(&P) + 'static,
2232 >(
2233 this: *mut ffi::GtkFileChooserWidget,
2234 f: glib::ffi::gpointer,
2235 ) {
2236 unsafe {
2237 let f: &F = &*(f as *const F);
2238 f(FileChooserWidget::from_glib_borrow(this).unsafe_cast_ref())
2239 }
2240 }
2241 unsafe {
2242 let f: Box_<F> = Box_::new(f);
2243 connect_raw(
2244 self.as_ptr() as *mut _,
2245 c"search-shortcut".as_ptr(),
2246 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2247 search_shortcut_trampoline::<Self, F> as *const (),
2248 )),
2249 Box_::into_raw(f),
2250 )
2251 }
2252 }
2253
2254 fn emit_search_shortcut(&self) {
2255 self.emit_by_name::<()>("search-shortcut", &[]);
2256 }
2257
2258 /// The ::show-hidden signal is a [keybinding signal][GtkBindingSignal]
2259 /// which gets emitted when the user asks for it.
2260 ///
2261 /// This is used to make the file chooser display hidden files.
2262 ///
2263 /// The default binding for this signal is `Control + H`.
2264 #[doc(alias = "show-hidden")]
2265 fn connect_show_hidden<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2266 unsafe extern "C" fn show_hidden_trampoline<
2267 P: IsA<FileChooserWidget>,
2268 F: Fn(&P) + 'static,
2269 >(
2270 this: *mut ffi::GtkFileChooserWidget,
2271 f: glib::ffi::gpointer,
2272 ) {
2273 unsafe {
2274 let f: &F = &*(f as *const F);
2275 f(FileChooserWidget::from_glib_borrow(this).unsafe_cast_ref())
2276 }
2277 }
2278 unsafe {
2279 let f: Box_<F> = Box_::new(f);
2280 connect_raw(
2281 self.as_ptr() as *mut _,
2282 c"show-hidden".as_ptr(),
2283 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2284 show_hidden_trampoline::<Self, F> as *const (),
2285 )),
2286 Box_::into_raw(f),
2287 )
2288 }
2289 }
2290
2291 fn emit_show_hidden(&self) {
2292 self.emit_by_name::<()>("show-hidden", &[]);
2293 }
2294
2295 /// The ::up-folder signal is a [keybinding signal][GtkBindingSignal]
2296 /// which gets emitted when the user asks for it.
2297 ///
2298 /// This is used to make the file chooser go to the parent of the current folder
2299 /// in the file hierarchy.
2300 ///
2301 /// The default binding for this signal is `Alt + Up`.
2302 #[doc(alias = "up-folder")]
2303 fn connect_up_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2304 unsafe extern "C" fn up_folder_trampoline<
2305 P: IsA<FileChooserWidget>,
2306 F: Fn(&P) + 'static,
2307 >(
2308 this: *mut ffi::GtkFileChooserWidget,
2309 f: glib::ffi::gpointer,
2310 ) {
2311 unsafe {
2312 let f: &F = &*(f as *const F);
2313 f(FileChooserWidget::from_glib_borrow(this).unsafe_cast_ref())
2314 }
2315 }
2316 unsafe {
2317 let f: Box_<F> = Box_::new(f);
2318 connect_raw(
2319 self.as_ptr() as *mut _,
2320 c"up-folder".as_ptr(),
2321 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2322 up_folder_trampoline::<Self, F> as *const (),
2323 )),
2324 Box_::into_raw(f),
2325 )
2326 }
2327 }
2328
2329 fn emit_up_folder(&self) {
2330 self.emit_by_name::<()>("up-folder", &[]);
2331 }
2332
2333 #[doc(alias = "search-mode")]
2334 fn connect_search_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2335 unsafe extern "C" fn notify_search_mode_trampoline<
2336 P: IsA<FileChooserWidget>,
2337 F: Fn(&P) + 'static,
2338 >(
2339 this: *mut ffi::GtkFileChooserWidget,
2340 _param_spec: glib::ffi::gpointer,
2341 f: glib::ffi::gpointer,
2342 ) {
2343 unsafe {
2344 let f: &F = &*(f as *const F);
2345 f(FileChooserWidget::from_glib_borrow(this).unsafe_cast_ref())
2346 }
2347 }
2348 unsafe {
2349 let f: Box_<F> = Box_::new(f);
2350 connect_raw(
2351 self.as_ptr() as *mut _,
2352 c"notify::search-mode".as_ptr(),
2353 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2354 notify_search_mode_trampoline::<Self, F> as *const (),
2355 )),
2356 Box_::into_raw(f),
2357 )
2358 }
2359 }
2360
2361 #[doc(alias = "subtitle")]
2362 fn connect_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2363 unsafe extern "C" fn notify_subtitle_trampoline<
2364 P: IsA<FileChooserWidget>,
2365 F: Fn(&P) + 'static,
2366 >(
2367 this: *mut ffi::GtkFileChooserWidget,
2368 _param_spec: glib::ffi::gpointer,
2369 f: glib::ffi::gpointer,
2370 ) {
2371 unsafe {
2372 let f: &F = &*(f as *const F);
2373 f(FileChooserWidget::from_glib_borrow(this).unsafe_cast_ref())
2374 }
2375 }
2376 unsafe {
2377 let f: Box_<F> = Box_::new(f);
2378 connect_raw(
2379 self.as_ptr() as *mut _,
2380 c"notify::subtitle".as_ptr(),
2381 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2382 notify_subtitle_trampoline::<Self, F> as *const (),
2383 )),
2384 Box_::into_raw(f),
2385 )
2386 }
2387 }
2388}
2389
2390impl<O: IsA<FileChooserWidget>> FileChooserWidgetExt for O {}