gtk/auto/places_sidebar.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 Adjustment, Align, Bin, Buildable, Container, CornerType, PlacesOpenFlags, PolicyType,
7 ResizeMode, ScrolledWindow, ShadowType, 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 /// [`PlacesSidebar`][crate::PlacesSidebar] is a widget that displays a list of frequently-used places in the
19 /// file system: the user’s home directory, the user’s bookmarks, and volumes and drives.
20 /// This widget is used as a sidebar in [`FileChooser`][crate::FileChooser] and may be used by file managers
21 /// and similar programs.
22 ///
23 /// The places sidebar displays drives and volumes, and will automatically mount
24 /// or unmount them when the user selects them.
25 ///
26 /// Applications can hook to various signals in the places sidebar to customize
27 /// its behavior. For example, they can add extra commands to the context menu
28 /// of the sidebar.
29 ///
30 /// While bookmarks are completely in control of the user, the places sidebar also
31 /// allows individual applications to provide extra shortcut folders that are unique
32 /// to each application. For example, a Paint program may want to add a shortcut
33 /// for a Clipart folder. You can do this with [`add_shortcut()`][Self::add_shortcut()].
34 ///
35 /// To make use of the places sidebar, an application at least needs to connect
36 /// to the [`open-location`][struct@crate::PlacesSidebar#open-location] signal. This is emitted when the
37 /// user selects in the sidebar a location to open. The application should also
38 /// call [`set_location()`][Self::set_location()] when it changes the currently-viewed
39 /// location.
40 ///
41 /// # CSS nodes
42 ///
43 /// GtkPlacesSidebar uses a single CSS node with name placessidebar and style
44 /// class .sidebar.
45 ///
46 /// Among the children of the places sidebar, the following style classes can
47 /// be used:
48 /// - .sidebar-new-bookmark-row for the 'Add new bookmark' row
49 /// - .sidebar-placeholder-row for a row that is a placeholder
50 /// - .has-open-popup when a popup is open for a row
51 ///
52 /// ## Properties
53 ///
54 ///
55 /// #### `local-only`
56 /// Readable | Writable
57 ///
58 ///
59 /// #### `location`
60 /// Readable | Writable
61 ///
62 ///
63 /// #### `open-flags`
64 /// Readable | Writable
65 ///
66 ///
67 /// #### `populate-all`
68 /// If :populate-all is [`true`], the [`populate-popup`][struct@crate::PlacesSidebar#populate-popup] signal
69 /// is also emitted for popovers.
70 ///
71 /// Readable | Writable
72 ///
73 ///
74 /// #### `show-connect-to-server`
75 /// Readable | Writable
76 ///
77 ///
78 /// #### `show-desktop`
79 /// Readable | Writable
80 ///
81 ///
82 /// #### `show-enter-location`
83 /// Readable | Writable
84 ///
85 ///
86 /// #### `show-other-locations`
87 /// Readable | Writable
88 ///
89 ///
90 /// #### `show-recent`
91 /// Readable | Writable
92 ///
93 ///
94 /// #### `show-starred-location`
95 /// Readable | Writable
96 ///
97 ///
98 /// #### `show-trash`
99 /// Readable | Writable
100 /// <details><summary><h4>ScrolledWindow</h4></summary>
101 ///
102 ///
103 /// #### `hadjustment`
104 /// Readable | Writable | Construct
105 ///
106 ///
107 /// #### `hscrollbar-policy`
108 /// Readable | Writable
109 ///
110 ///
111 /// #### `kinetic-scrolling`
112 /// Whether kinetic scrolling is enabled or not. Kinetic scrolling
113 /// only applies to devices with source `GDK_SOURCE_TOUCHSCREEN`.
114 ///
115 /// Readable | Writable
116 ///
117 ///
118 /// #### `max-content-height`
119 /// The maximum content height of `scrolled_window`, or -1 if not set.
120 ///
121 /// Readable | Writable
122 ///
123 ///
124 /// #### `max-content-width`
125 /// The maximum content width of `scrolled_window`, or -1 if not set.
126 ///
127 /// Readable | Writable
128 ///
129 ///
130 /// #### `min-content-height`
131 /// The minimum content height of `scrolled_window`, or -1 if not set.
132 ///
133 /// Readable | Writable
134 ///
135 ///
136 /// #### `min-content-width`
137 /// The minimum content width of `scrolled_window`, or -1 if not set.
138 ///
139 /// Readable | Writable
140 ///
141 ///
142 /// #### `overlay-scrolling`
143 /// Whether overlay scrolling is enabled or not. If it is, the
144 /// scrollbars are only added as traditional widgets when a mouse
145 /// is present. Otherwise, they are overlayed on top of the content,
146 /// as narrow indicators.
147 ///
148 /// Note that overlay scrolling can also be globally disabled, with
149 /// the [`gtk-overlay-scrolling`][struct@crate::Settings#gtk-overlay-scrolling] setting.
150 ///
151 /// Readable | Writable
152 ///
153 ///
154 /// #### `propagate-natural-height`
155 /// Whether the natural height of the child should be calculated and propagated
156 /// through the scrolled window’s requested natural height.
157 ///
158 /// This is useful in cases where an attempt should be made to allocate exactly
159 /// enough space for the natural size of the child.
160 ///
161 /// Readable | Writable
162 ///
163 ///
164 /// #### `propagate-natural-width`
165 /// Whether the natural width of the child should be calculated and propagated
166 /// through the scrolled window’s requested natural width.
167 ///
168 /// This is useful in cases where an attempt should be made to allocate exactly
169 /// enough space for the natural size of the child.
170 ///
171 /// Readable | Writable
172 ///
173 ///
174 /// #### `shadow-type`
175 /// Readable | Writable
176 ///
177 ///
178 /// #### `vadjustment`
179 /// Readable | Writable | Construct
180 ///
181 ///
182 /// #### `vscrollbar-policy`
183 /// Readable | Writable
184 ///
185 ///
186 /// #### `window-placement`
187 /// Readable | Writable
188 ///
189 ///
190 /// #### `window-placement-set`
191 /// Whether "window-placement" should be used to determine the location
192 /// of the contents with respect to the scrollbars.
193 ///
194 /// Readable | Writable
195 /// </details>
196 /// <details><summary><h4>Container</h4></summary>
197 ///
198 ///
199 /// #### `border-width`
200 /// Readable | Writable
201 ///
202 ///
203 /// #### `child`
204 /// Writable
205 ///
206 ///
207 /// #### `resize-mode`
208 /// Readable | Writable
209 /// </details>
210 /// <details><summary><h4>Widget</h4></summary>
211 ///
212 ///
213 /// #### `app-paintable`
214 /// Readable | Writable
215 ///
216 ///
217 /// #### `can-default`
218 /// Readable | Writable
219 ///
220 ///
221 /// #### `can-focus`
222 /// Readable | Writable
223 ///
224 ///
225 /// #### `composite-child`
226 /// Readable
227 ///
228 ///
229 /// #### `double-buffered`
230 /// Whether the widget is double buffered.
231 ///
232 /// Readable | Writable
233 ///
234 ///
235 /// #### `events`
236 /// Readable | Writable
237 ///
238 ///
239 /// #### `expand`
240 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
241 ///
242 /// Readable | Writable
243 ///
244 ///
245 /// #### `focus-on-click`
246 /// Whether the widget should grab focus when it is clicked with the mouse.
247 ///
248 /// This property is only relevant for widgets that can take focus.
249 ///
250 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
251 /// GtkComboBox) implemented this property individually.
252 ///
253 /// Readable | Writable
254 ///
255 ///
256 /// #### `halign`
257 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
258 ///
259 /// Readable | Writable
260 ///
261 ///
262 /// #### `has-default`
263 /// Readable | Writable
264 ///
265 ///
266 /// #### `has-focus`
267 /// Readable | Writable
268 ///
269 ///
270 /// #### `has-tooltip`
271 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
272 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
273 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
274 /// whether it will provide a tooltip or not.
275 ///
276 /// Note that setting this property to [`true`] for the first time will change
277 /// the event masks of the GdkWindows of this widget to include leave-notify
278 /// and motion-notify events. This cannot and will not be undone when the
279 /// property is set to [`false`] again.
280 ///
281 /// Readable | Writable
282 ///
283 ///
284 /// #### `height-request`
285 /// Readable | Writable
286 ///
287 ///
288 /// #### `hexpand`
289 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
290 ///
291 /// Readable | Writable
292 ///
293 ///
294 /// #### `hexpand-set`
295 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
296 ///
297 /// Readable | Writable
298 ///
299 ///
300 /// #### `is-focus`
301 /// Readable | Writable
302 ///
303 ///
304 /// #### `margin`
305 /// Sets all four sides' margin at once. If read, returns max
306 /// margin on any side.
307 ///
308 /// Readable | Writable
309 ///
310 ///
311 /// #### `margin-bottom`
312 /// Margin on bottom side of widget.
313 ///
314 /// This property adds margin outside of the widget's normal size
315 /// request, the margin will be added in addition to the size from
316 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
317 ///
318 /// Readable | Writable
319 ///
320 ///
321 /// #### `margin-end`
322 /// Margin on end of widget, horizontally. This property supports
323 /// left-to-right and right-to-left text directions.
324 ///
325 /// This property adds margin outside of the widget's normal size
326 /// request, the margin will be added in addition to the size from
327 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
328 ///
329 /// Readable | Writable
330 ///
331 ///
332 /// #### `margin-left`
333 /// Margin on left side of widget.
334 ///
335 /// This property adds margin outside of the widget's normal size
336 /// request, the margin will be added in addition to the size from
337 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
338 ///
339 /// Readable | Writable
340 ///
341 ///
342 /// #### `margin-right`
343 /// Margin on right side of widget.
344 ///
345 /// This property adds margin outside of the widget's normal size
346 /// request, the margin will be added in addition to the size from
347 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
348 ///
349 /// Readable | Writable
350 ///
351 ///
352 /// #### `margin-start`
353 /// Margin on start of widget, horizontally. This property supports
354 /// left-to-right and right-to-left text directions.
355 ///
356 /// This property adds margin outside of the widget's normal size
357 /// request, the margin will be added in addition to the size from
358 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
359 ///
360 /// Readable | Writable
361 ///
362 ///
363 /// #### `margin-top`
364 /// Margin on top side of widget.
365 ///
366 /// This property adds margin outside of the widget's normal size
367 /// request, the margin will be added in addition to the size from
368 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
369 ///
370 /// Readable | Writable
371 ///
372 ///
373 /// #### `name`
374 /// Readable | Writable
375 ///
376 ///
377 /// #### `no-show-all`
378 /// Readable | Writable
379 ///
380 ///
381 /// #### `opacity`
382 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
383 /// more details about window opacity.
384 ///
385 /// Before 3.8 this was only available in GtkWindow
386 ///
387 /// Readable | Writable
388 ///
389 ///
390 /// #### `parent`
391 /// Readable | Writable
392 ///
393 ///
394 /// #### `receives-default`
395 /// Readable | Writable
396 ///
397 ///
398 /// #### `scale-factor`
399 /// The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
400 /// more details about widget scaling.
401 ///
402 /// Readable
403 ///
404 ///
405 /// #### `sensitive`
406 /// Readable | Writable
407 ///
408 ///
409 /// #### `style`
410 /// The style of the widget, which contains information about how it will look (colors, etc).
411 ///
412 /// Readable | Writable
413 ///
414 ///
415 /// #### `tooltip-markup`
416 /// Sets the text of tooltip to be the given string, which is marked up
417 /// with the [Pango text markup language][PangoMarkupFormat].
418 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
419 ///
420 /// This is a convenience property which will take care of getting the
421 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
422 /// will automatically be set to [`true`] and there will be taken care of
423 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
424 ///
425 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
426 /// are set, the last one wins.
427 ///
428 /// Readable | Writable
429 ///
430 ///
431 /// #### `tooltip-text`
432 /// Sets the text of tooltip to be the given string.
433 ///
434 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
435 ///
436 /// This is a convenience property which will take care of getting the
437 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
438 /// will automatically be set to [`true`] and there will be taken care of
439 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
440 ///
441 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
442 /// are set, the last one wins.
443 ///
444 /// Readable | Writable
445 ///
446 ///
447 /// #### `valign`
448 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
449 ///
450 /// Readable | Writable
451 ///
452 ///
453 /// #### `vexpand`
454 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
455 ///
456 /// Readable | Writable
457 ///
458 ///
459 /// #### `vexpand-set`
460 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
461 ///
462 /// Readable | Writable
463 ///
464 ///
465 /// #### `visible`
466 /// Readable | Writable
467 ///
468 ///
469 /// #### `width-request`
470 /// Readable | Writable
471 ///
472 ///
473 /// #### `window`
474 /// The widget's window if it is realized, [`None`] otherwise.
475 ///
476 /// Readable
477 /// </details>
478 ///
479 /// ## Signals
480 ///
481 ///
482 /// #### `drag-action-ask`
483 /// The places sidebar emits this signal when it needs to ask the application
484 /// to pop up a menu to ask the user for which drag action to perform.
485 ///
486 ///
487 ///
488 ///
489 /// #### `drag-action-requested`
490 /// When the user starts a drag-and-drop operation and the sidebar needs
491 /// to ask the application for which drag action to perform, then the
492 /// sidebar will emit this signal.
493 ///
494 /// The application can evaluate the `context` for customary actions, or
495 /// it can check the type of the files indicated by `source_file_list` against the
496 /// possible actions for the destination `dest_file`.
497 ///
498 /// The drag action to use must be the return value of the signal handler.
499 ///
500 ///
501 ///
502 ///
503 /// #### `drag-perform-drop`
504 /// The places sidebar emits this signal when the user completes a
505 /// drag-and-drop operation and one of the sidebar's items is the
506 /// destination. This item is in the `dest_file`, and the
507 /// `source_file_list` has the list of files that are dropped into it and
508 /// which should be copied/moved/etc. based on the specified `action`.
509 ///
510 ///
511 ///
512 ///
513 /// #### `mount`
514 /// The places sidebar emits this signal when it starts a new operation
515 /// because the user clicked on some location that needs mounting.
516 /// In this way the application using the [`PlacesSidebar`][crate::PlacesSidebar] can track the
517 /// progress of the operation and, for example, show a notification.
518 ///
519 ///
520 ///
521 ///
522 /// #### `open-location`
523 /// The places sidebar emits this signal when the user selects a location
524 /// in it. The calling application should display the contents of that
525 /// location; for example, a file manager should show a list of files in
526 /// the specified location.
527 ///
528 ///
529 ///
530 ///
531 /// #### `populate-popup`
532 /// The places sidebar emits this signal when the user invokes a contextual
533 /// popup on one of its items. In the signal handler, the application may
534 /// add extra items to the menu as appropriate. For example, a file manager
535 /// may want to add a "Properties" command to the menu.
536 ///
537 /// It is not necessary to store the `selected_item` for each menu item;
538 /// during their callbacks, the application can use [`PlacesSidebar::location()`][crate::PlacesSidebar::location()]
539 /// to get the file to which the item refers.
540 ///
541 /// The `selected_item` argument may be [`None`] in case the selection refers to
542 /// a volume. In this case, `selected_volume` will be non-[`None`]. In this case,
543 /// the calling application will have to `g_object_ref()` the `selected_volume` and
544 /// keep it around to use it in the callback.
545 ///
546 /// The `container` and all its contents are destroyed after the user
547 /// dismisses the popup. The popup is re-created (and thus, this signal is
548 /// emitted) every time the user activates the contextual menu.
549 ///
550 /// Before 3.18, the `container` always was a [`Menu`][crate::Menu], and you were expected
551 /// to add your items as `GtkMenuItems`. Since 3.18, the popup may be implemented
552 /// as a [`Popover`][crate::Popover], in which case `container` will be something else, e.g. a
553 /// [`Box`][crate::Box], to which you may add `GtkModelButtons` or other widgets, such as
554 /// `GtkEntries`, `GtkSpinButtons`, etc. If your application can deal with this
555 /// situation, you can set [`populate-all`][struct@crate::PlacesSidebar#populate-all] to [`true`] to request
556 /// that this signal is emitted for populating popovers as well.
557 ///
558 ///
559 ///
560 ///
561 /// #### `show-connect-to-server`
562 /// The places sidebar emits this signal when it needs the calling
563 /// application to present an way to connect directly to a network server.
564 /// For example, the application may bring up a dialog box asking for
565 /// a URL like "sftp://ftp.example.com". It is up to the application to create
566 /// the corresponding mount by using, for example, [`FileExtManual::mount_enclosing_volume()`][crate::gio::prelude::FileExtManual::mount_enclosing_volume()].
567 ///
568 ///
569 ///
570 ///
571 /// #### `show-enter-location`
572 /// The places sidebar emits this signal when it needs the calling
573 /// application to present an way to directly enter a location.
574 /// For example, the application may bring up a dialog box asking for
575 /// a URL like "http://http.example.com".
576 ///
577 ///
578 ///
579 ///
580 /// #### `show-error-message`
581 /// The places sidebar emits this signal when it needs the calling
582 /// application to present an error message. Most of these messages
583 /// refer to mounting or unmounting media, for example, when a drive
584 /// cannot be started for some reason.
585 ///
586 ///
587 ///
588 ///
589 /// #### `show-other-locations`
590 /// The places sidebar emits this signal when it needs the calling
591 /// application to present a way to show other locations e.g. drives
592 /// and network access points.
593 /// For example, the application may bring up a page showing persistent
594 /// volumes and discovered network addresses.
595 ///
596 ///
597 ///
598 ///
599 /// #### `show-other-locations-with-flags`
600 /// The places sidebar emits this signal when it needs the calling
601 /// application to present a way to show other locations e.g. drives
602 /// and network access points.
603 /// For example, the application may bring up a page showing persistent
604 /// volumes and discovered network addresses.
605 ///
606 ///
607 ///
608 ///
609 /// #### `show-starred-location`
610 /// The places sidebar emits this signal when it needs the calling
611 /// application to present a way to show the starred files. In GNOME,
612 /// starred files are implemented by setting the nao:predefined-tag-favorite
613 /// tag in the tracker database.
614 ///
615 ///
616 ///
617 ///
618 /// #### `unmount`
619 /// The places sidebar emits this signal when it starts a new operation
620 /// because the user for example ejected some drive or unmounted a mount.
621 /// In this way the application using the [`PlacesSidebar`][crate::PlacesSidebar] can track the
622 /// progress of the operation and, for example, show a notification.
623 ///
624 ///
625 /// <details><summary><h4>ScrolledWindow</h4></summary>
626 ///
627 ///
628 /// #### `edge-overshot`
629 /// The ::edge-overshot signal is emitted whenever user initiated scrolling
630 /// makes the scrolled window firmly surpass (i.e. with some edge resistance)
631 /// the lower or upper limits defined by the adjustment in that orientation.
632 ///
633 /// A similar behavior without edge resistance is provided by the
634 /// [`edge-reached`][struct@crate::ScrolledWindow#edge-reached] signal.
635 ///
636 /// Note: The `pos` argument is LTR/RTL aware, so callers should be aware too
637 /// if intending to provide behavior on horizontal edges.
638 ///
639 ///
640 ///
641 ///
642 /// #### `edge-reached`
643 /// The ::edge-reached signal is emitted whenever user-initiated scrolling
644 /// makes the scrolled window exactly reach the lower or upper limits
645 /// defined by the adjustment in that orientation.
646 ///
647 /// A similar behavior with edge resistance is provided by the
648 /// [`edge-overshot`][struct@crate::ScrolledWindow#edge-overshot] signal.
649 ///
650 /// Note: The `pos` argument is LTR/RTL aware, so callers should be aware too
651 /// if intending to provide behavior on horizontal edges.
652 ///
653 ///
654 ///
655 ///
656 /// #### `move-focus-out`
657 /// The ::move-focus-out signal is a
658 /// [keybinding signal][GtkBindingSignal] which gets
659 /// emitted when focus is moved away from the scrolled window by a
660 /// keybinding. The [`move-focus`][struct@crate::Widget#move-focus] signal is emitted with
661 /// `direction_type` on this scrolled window’s toplevel parent in the
662 /// container hierarchy. The default bindings for this signal are
663 /// `Ctrl + Tab` to move forward and `Ctrl + Shift + Tab` to move backward.
664 ///
665 /// Action
666 ///
667 ///
668 /// #### `scroll-child`
669 /// The ::scroll-child signal is a
670 /// [keybinding signal][GtkBindingSignal]
671 /// which gets emitted when a keybinding that scrolls is pressed.
672 /// The horizontal or vertical adjustment is updated which triggers a
673 /// signal that the scrolled window’s child may listen to and scroll itself.
674 ///
675 /// Action
676 /// </details>
677 /// <details><summary><h4>Container</h4></summary>
678 ///
679 ///
680 /// #### `add`
681 ///
682 ///
683 ///
684 /// #### `check-resize`
685 ///
686 ///
687 ///
688 /// #### `remove`
689 ///
690 ///
691 ///
692 /// #### `set-focus-child`
693 ///
694 /// </details>
695 /// <details><summary><h4>Widget</h4></summary>
696 ///
697 ///
698 /// #### `accel-closures-changed`
699 ///
700 ///
701 ///
702 /// #### `button-press-event`
703 /// The ::button-press-event signal will be emitted when a button
704 /// (typically from a mouse) is pressed.
705 ///
706 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
707 /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
708 ///
709 /// This signal will be sent to the grab widget if there is one.
710 ///
711 ///
712 ///
713 ///
714 /// #### `button-release-event`
715 /// The ::button-release-event signal will be emitted when a button
716 /// (typically from a mouse) is released.
717 ///
718 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
719 /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
720 ///
721 /// This signal will be sent to the grab widget if there is one.
722 ///
723 ///
724 ///
725 ///
726 /// #### `can-activate-accel`
727 /// Determines whether an accelerator that activates the signal
728 /// identified by `signal_id` can currently be activated.
729 /// This signal is present to allow applications and derived
730 /// widgets to override the default [`Widget`][crate::Widget] handling
731 /// for determining whether an accelerator can be activated.
732 ///
733 ///
734 ///
735 ///
736 /// #### `child-notify`
737 /// The ::child-notify signal is emitted for each
738 /// [child property][child-properties] that has
739 /// changed on an object. The signal's detail holds the property name.
740 ///
741 /// Detailed
742 ///
743 ///
744 /// #### `composited-changed`
745 /// The ::composited-changed signal is emitted when the composited
746 /// status of `widgets` screen changes.
747 /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
748 ///
749 /// Action
750 ///
751 ///
752 /// #### `configure-event`
753 /// The ::configure-event signal will be emitted when the size, position or
754 /// stacking of the `widget`'s window has changed.
755 ///
756 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
757 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
758 /// automatically for all new windows.
759 ///
760 ///
761 ///
762 ///
763 /// #### `damage-event`
764 /// Emitted when a redirected window belonging to `widget` gets drawn into.
765 /// The region/area members of the event shows what area of the redirected
766 /// drawable was drawn into.
767 ///
768 ///
769 ///
770 ///
771 /// #### `delete-event`
772 /// The ::delete-event signal is emitted if a user requests that
773 /// a toplevel window is closed. The default handler for this signal
774 /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
775 /// this signal will cause the window to be hidden instead, so that
776 /// it can later be shown again without reconstructing it.
777 ///
778 ///
779 ///
780 ///
781 /// #### `destroy`
782 /// Signals that all holders of a reference to the widget should release
783 /// the reference that they hold. May result in finalization of the widget
784 /// if all references are released.
785 ///
786 /// This signal is not suitable for saving widget state.
787 ///
788 ///
789 ///
790 ///
791 /// #### `destroy-event`
792 /// The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
793 /// You rarely get this signal, because most widgets disconnect themselves
794 /// from their window before they destroy it, so no widget owns the
795 /// window at destroy time.
796 ///
797 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
798 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
799 /// automatically for all new windows.
800 ///
801 ///
802 ///
803 ///
804 /// #### `direction-changed`
805 /// The ::direction-changed signal is emitted when the text direction
806 /// of a widget changes.
807 ///
808 ///
809 ///
810 ///
811 /// #### `drag-begin`
812 /// The ::drag-begin signal is emitted on the drag source when a drag is
813 /// started. A typical reason to connect to this signal is to set up a
814 /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
815 ///
816 /// Note that some widgets set up a drag icon in the default handler of
817 /// this signal, so you may have to use `g_signal_connect_after()` to
818 /// override what the default handler did.
819 ///
820 ///
821 ///
822 ///
823 /// #### `drag-data-delete`
824 /// The ::drag-data-delete signal is emitted on the drag source when a drag
825 /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
826 /// handler is responsible for deleting the data that has been dropped. What
827 /// "delete" means depends on the context of the drag operation.
828 ///
829 ///
830 ///
831 ///
832 /// #### `drag-data-get`
833 /// The ::drag-data-get signal is emitted on the drag source when the drop
834 /// site requests the data which is dragged. It is the responsibility of
835 /// the signal handler to fill `data` with the data in the format which
836 /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
837 /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
838 ///
839 ///
840 ///
841 ///
842 /// #### `drag-data-received`
843 /// The ::drag-data-received signal is emitted on the drop site when the
844 /// dragged data has been received. If the data was received in order to
845 /// determine whether the drop will be accepted, the handler is expected
846 /// to call `gdk_drag_status()` and not finish the drag.
847 /// If the data was received in response to a [`drag-drop`][struct@crate::Widget#drag-drop] signal
848 /// (and this is the last target to be received), the handler for this
849 /// signal is expected to process the received data and then call
850 /// `gtk_drag_finish()`, setting the `success` parameter depending on
851 /// whether the data was processed successfully.
852 ///
853 /// Applications must create some means to determine why the signal was emitted
854 /// and therefore whether to call `gdk_drag_status()` or `gtk_drag_finish()`.
855 ///
856 /// The handler may inspect the selected action with
857 /// [`DragContext::selected_action()`][crate::gdk::DragContext::selected_action()] before calling
858 /// `gtk_drag_finish()`, e.g. to implement [`gdk::DragAction::ASK`][crate::gdk::DragAction::ASK] as
859 /// shown in the following example:
860 ///
861 ///
862 /// **⚠️ The following code is in C ⚠️**
863 ///
864 /// ```C
865 /// void
866 /// drag_data_received (GtkWidget *widget,
867 /// GdkDragContext *context,
868 /// gint x,
869 /// gint y,
870 /// GtkSelectionData *data,
871 /// guint info,
872 /// guint time)
873 /// {
874 /// if ((data->length >= 0) && (data->format == 8))
875 /// {
876 /// GdkDragAction action;
877 ///
878 /// // handle data here
879 ///
880 /// action = gdk_drag_context_get_selected_action (context);
881 /// if (action == GDK_ACTION_ASK)
882 /// {
883 /// GtkWidget *dialog;
884 /// gint response;
885 ///
886 /// dialog = gtk_message_dialog_new (NULL,
887 /// GTK_DIALOG_MODAL |
888 /// GTK_DIALOG_DESTROY_WITH_PARENT,
889 /// GTK_MESSAGE_INFO,
890 /// GTK_BUTTONS_YES_NO,
891 /// "Move the data ?\n");
892 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
893 /// gtk_widget_destroy (dialog);
894 ///
895 /// if (response == GTK_RESPONSE_YES)
896 /// action = GDK_ACTION_MOVE;
897 /// else
898 /// action = GDK_ACTION_COPY;
899 /// }
900 ///
901 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
902 /// }
903 /// else
904 /// gtk_drag_finish (context, FALSE, FALSE, time);
905 /// }
906 /// ```
907 ///
908 ///
909 ///
910 ///
911 /// #### `drag-drop`
912 /// The ::drag-drop signal is emitted on the drop site when the user drops
913 /// the data onto the widget. The signal handler must determine whether
914 /// the cursor position is in a drop zone or not. If it is not in a drop
915 /// zone, it returns [`false`] and no further processing is necessary.
916 /// Otherwise, the handler returns [`true`]. In this case, the handler must
917 /// ensure that `gtk_drag_finish()` is called to let the source know that
918 /// the drop is done. The call to `gtk_drag_finish()` can be done either
919 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
920 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
921 /// or more of the supported targets.
922 ///
923 ///
924 ///
925 ///
926 /// #### `drag-end`
927 /// The ::drag-end signal is emitted on the drag source when a drag is
928 /// finished. A typical reason to connect to this signal is to undo
929 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
930 ///
931 ///
932 ///
933 ///
934 /// #### `drag-failed`
935 /// The ::drag-failed signal is emitted on the drag source when a drag has
936 /// failed. The signal handler may hook custom code to handle a failed DnD
937 /// operation based on the type of error, it returns [`true`] is the failure has
938 /// been already handled (not showing the default "drag operation failed"
939 /// animation), otherwise it returns [`false`].
940 ///
941 ///
942 ///
943 ///
944 /// #### `drag-leave`
945 /// The ::drag-leave signal is emitted on the drop site when the cursor
946 /// leaves the widget. A typical reason to connect to this signal is to
947 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
948 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
949 ///
950 ///
951 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
952 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
953 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
954 ///
955 ///
956 ///
957 ///
958 /// #### `drag-motion`
959 /// The ::drag-motion signal is emitted on the drop site when the user
960 /// moves the cursor over the widget during a drag. The signal handler
961 /// must determine whether the cursor position is in a drop zone or not.
962 /// If it is not in a drop zone, it returns [`false`] and no further processing
963 /// is necessary. Otherwise, the handler returns [`true`]. In this case, the
964 /// handler is responsible for providing the necessary information for
965 /// displaying feedback to the user, by calling `gdk_drag_status()`.
966 ///
967 /// If the decision whether the drop will be accepted or rejected can't be
968 /// made based solely on the cursor position and the type of the data, the
969 /// handler may inspect the dragged data by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] and
970 /// defer the `gdk_drag_status()` call to the [`drag-data-received`][struct@crate::Widget#drag-data-received]
971 /// handler. Note that you must pass [`DestDefaults::DROP`][crate::DestDefaults::DROP],
972 /// [`DestDefaults::MOTION`][crate::DestDefaults::MOTION] or [`DestDefaults::ALL`][crate::DestDefaults::ALL] to [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()]
973 /// when using the drag-motion signal that way.
974 ///
975 /// Also note that there is no drag-enter signal. The drag receiver has to
976 /// keep track of whether he has received any drag-motion signals since the
977 /// last [`drag-leave`][struct@crate::Widget#drag-leave] and if not, treat the drag-motion signal as
978 /// an "enter" signal. Upon an "enter", the handler will typically highlight
979 /// the drop site with [`WidgetExt::drag_highlight()`][crate::prelude::WidgetExt::drag_highlight()].
980 ///
981 ///
982 /// **⚠️ The following code is in C ⚠️**
983 ///
984 /// ```C
985 /// static void
986 /// drag_motion (GtkWidget *widget,
987 /// GdkDragContext *context,
988 /// gint x,
989 /// gint y,
990 /// guint time)
991 /// {
992 /// GdkAtom target;
993 ///
994 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
995 ///
996 /// if (!private_data->drag_highlight)
997 /// {
998 /// private_data->drag_highlight = 1;
999 /// gtk_drag_highlight (widget);
1000 /// }
1001 ///
1002 /// target = gtk_drag_dest_find_target (widget, context, NULL);
1003 /// if (target == GDK_NONE)
1004 /// gdk_drag_status (context, 0, time);
1005 /// else
1006 /// {
1007 /// private_data->pending_status
1008 /// = gdk_drag_context_get_suggested_action (context);
1009 /// gtk_drag_get_data (widget, context, target, time);
1010 /// }
1011 ///
1012 /// return TRUE;
1013 /// }
1014 ///
1015 /// static void
1016 /// drag_data_received (GtkWidget *widget,
1017 /// GdkDragContext *context,
1018 /// gint x,
1019 /// gint y,
1020 /// GtkSelectionData *selection_data,
1021 /// guint info,
1022 /// guint time)
1023 /// {
1024 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
1025 ///
1026 /// if (private_data->suggested_action)
1027 /// {
1028 /// private_data->suggested_action = 0;
1029 ///
1030 /// // We are getting this data due to a request in drag_motion,
1031 /// // rather than due to a request in drag_drop, so we are just
1032 /// // supposed to call gdk_drag_status(), not actually paste in
1033 /// // the data.
1034 ///
1035 /// str = gtk_selection_data_get_text (selection_data);
1036 /// if (!data_is_acceptable (str))
1037 /// gdk_drag_status (context, 0, time);
1038 /// else
1039 /// gdk_drag_status (context,
1040 /// private_data->suggested_action,
1041 /// time);
1042 /// }
1043 /// else
1044 /// {
1045 /// // accept the drop
1046 /// }
1047 /// }
1048 /// ```
1049 ///
1050 ///
1051 ///
1052 ///
1053 /// #### `draw`
1054 /// This signal is emitted when a widget is supposed to render itself.
1055 /// The `widget`'s top left corner must be painted at the origin of
1056 /// the passed in context and be sized to the values returned by
1057 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
1058 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
1059 ///
1060 /// Signal handlers connected to this signal can modify the cairo
1061 /// context passed as `cr` in any way they like and don't need to
1062 /// restore it. The signal emission takes care of calling `cairo_save()`
1063 /// before and `cairo_restore()` after invoking the handler.
1064 ///
1065 /// The signal handler will get a `cr` with a clip region already set to the
1066 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
1067 /// widgets that want to avoid redrawing themselves completely can get the full
1068 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
1069 /// get a finer-grained representation of the dirty region with
1070 /// `cairo_copy_clip_rectangle_list()`.
1071 ///
1072 ///
1073 ///
1074 ///
1075 /// #### `enter-notify-event`
1076 /// The ::enter-notify-event will be emitted when the pointer enters
1077 /// the `widget`'s window.
1078 ///
1079 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1080 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
1081 ///
1082 /// This signal will be sent to the grab widget if there is one.
1083 ///
1084 ///
1085 ///
1086 ///
1087 /// #### `event`
1088 /// The GTK+ main loop will emit three signals for each GDK event delivered
1089 /// to a widget: one generic ::event signal, another, more specific,
1090 /// signal that matches the type of event delivered (e.g.
1091 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
1092 /// [`event-after`][struct@crate::Widget#event-after] signal.
1093 ///
1094 ///
1095 ///
1096 ///
1097 /// #### `event-after`
1098 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
1099 /// the second more specific signal, ::event-after will be emitted
1100 /// regardless of the previous two signals handlers return values.
1101 ///
1102 ///
1103 ///
1104 ///
1105 /// #### `focus`
1106 ///
1107 ///
1108 ///
1109 /// #### `focus-in-event`
1110 /// The ::focus-in-event signal will be emitted when the keyboard focus
1111 /// enters the `widget`'s window.
1112 ///
1113 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1114 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
1115 ///
1116 ///
1117 ///
1118 ///
1119 /// #### `focus-out-event`
1120 /// The ::focus-out-event signal will be emitted when the keyboard focus
1121 /// leaves the `widget`'s window.
1122 ///
1123 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1124 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
1125 ///
1126 ///
1127 ///
1128 ///
1129 /// #### `grab-broken-event`
1130 /// Emitted when a pointer or keyboard grab on a window belonging
1131 /// to `widget` gets broken.
1132 ///
1133 /// On X11, this happens when the grab window becomes unviewable
1134 /// (i.e. it or one of its ancestors is unmapped), or if the same
1135 /// application grabs the pointer or keyboard again.
1136 ///
1137 ///
1138 ///
1139 ///
1140 /// #### `grab-focus`
1141 /// Action
1142 ///
1143 ///
1144 /// #### `grab-notify`
1145 /// The ::grab-notify signal is emitted when a widget becomes
1146 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
1147 /// another widget, or when it becomes unshadowed due to a grab
1148 /// being removed.
1149 ///
1150 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
1151 /// grab widget in the grab stack of its window group is not
1152 /// its ancestor.
1153 ///
1154 ///
1155 ///
1156 ///
1157 /// #### `hide`
1158 /// The ::hide signal is emitted when `widget` is hidden, for example with
1159 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
1160 ///
1161 ///
1162 ///
1163 ///
1164 /// #### `hierarchy-changed`
1165 /// The ::hierarchy-changed signal is emitted when the
1166 /// anchored state of a widget changes. A widget is
1167 /// “anchored” when its toplevel
1168 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
1169 /// a widget changes from un-anchored to anchored or vice-versa.
1170 ///
1171 ///
1172 ///
1173 ///
1174 /// #### `key-press-event`
1175 /// The ::key-press-event signal is emitted when a key is pressed. The signal
1176 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
1177 ///
1178 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1179 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
1180 ///
1181 /// This signal will be sent to the grab widget if there is one.
1182 ///
1183 ///
1184 ///
1185 ///
1186 /// #### `key-release-event`
1187 /// The ::key-release-event signal is emitted when a key is released.
1188 ///
1189 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1190 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
1191 ///
1192 /// This signal will be sent to the grab widget if there is one.
1193 ///
1194 ///
1195 ///
1196 ///
1197 /// #### `keynav-failed`
1198 /// Gets emitted if keyboard navigation fails.
1199 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
1200 ///
1201 ///
1202 ///
1203 ///
1204 /// #### `leave-notify-event`
1205 /// The ::leave-notify-event will be emitted when the pointer leaves
1206 /// the `widget`'s window.
1207 ///
1208 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1209 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
1210 ///
1211 /// This signal will be sent to the grab widget if there is one.
1212 ///
1213 ///
1214 ///
1215 ///
1216 /// #### `map`
1217 /// The ::map signal is emitted when `widget` is going to be mapped, that is
1218 /// when the widget is visible (which is controlled with
1219 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
1220 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
1221 /// be emitted.
1222 ///
1223 /// The ::map signal can be used to determine whether a widget will be drawn,
1224 /// for instance it can resume an animation that was stopped during the
1225 /// emission of [`unmap`][struct@crate::Widget#unmap].
1226 ///
1227 ///
1228 ///
1229 ///
1230 /// #### `map-event`
1231 /// The ::map-event signal will be emitted when the `widget`'s window is
1232 /// mapped. A window is mapped when it becomes visible on the screen.
1233 ///
1234 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1235 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1236 /// automatically for all new windows.
1237 ///
1238 ///
1239 ///
1240 ///
1241 /// #### `mnemonic-activate`
1242 /// The default handler for this signal activates `widget` if `group_cycling`
1243 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
1244 ///
1245 ///
1246 ///
1247 ///
1248 /// #### `motion-notify-event`
1249 /// The ::motion-notify-event signal is emitted when the pointer moves
1250 /// over the widget's [`gdk::Window`][crate::gdk::Window].
1251 ///
1252 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
1253 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
1254 ///
1255 /// This signal will be sent to the grab widget if there is one.
1256 ///
1257 ///
1258 ///
1259 ///
1260 /// #### `move-focus`
1261 /// Action
1262 ///
1263 ///
1264 /// #### `parent-set`
1265 /// The ::parent-set signal is emitted when a new parent
1266 /// has been set on a widget.
1267 ///
1268 ///
1269 ///
1270 ///
1271 /// #### `popup-menu`
1272 /// This signal gets emitted whenever a widget should pop up a context
1273 /// menu. This usually happens through the standard key binding mechanism;
1274 /// by pressing a certain key while a widget is focused, the user can cause
1275 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
1276 /// a menu with clipboard commands. See the
1277 /// [Popup Menu Migration Checklist][checklist-popup-menu]
1278 /// for an example of how to use this signal.
1279 ///
1280 /// Action
1281 ///
1282 ///
1283 /// #### `property-notify-event`
1284 /// The ::property-notify-event signal will be emitted when a property on
1285 /// the `widget`'s window has been changed or deleted.
1286 ///
1287 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1288 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1289 ///
1290 ///
1291 ///
1292 ///
1293 /// #### `proximity-in-event`
1294 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1295 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1296 ///
1297 /// This signal will be sent to the grab widget if there is one.
1298 ///
1299 ///
1300 ///
1301 ///
1302 /// #### `proximity-out-event`
1303 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1304 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1305 ///
1306 /// This signal will be sent to the grab widget if there is one.
1307 ///
1308 ///
1309 ///
1310 ///
1311 /// #### `query-tooltip`
1312 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1313 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1314 /// focus in keyboard mode.
1315 ///
1316 /// Using the given coordinates, the signal handler should determine
1317 /// whether a tooltip should be shown for `widget`. If this is the case
1318 /// [`true`] should be returned, [`false`] otherwise. Note that if
1319 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1320 /// should not be used.
1321 ///
1322 /// The signal handler is free to manipulate `tooltip` with the therefore
1323 /// destined function calls.
1324 ///
1325 ///
1326 ///
1327 ///
1328 /// #### `realize`
1329 /// The ::realize signal is emitted when `widget` is associated with a
1330 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1331 /// widget has been mapped (that is, it is going to be drawn).
1332 ///
1333 ///
1334 ///
1335 ///
1336 /// #### `screen-changed`
1337 /// The ::screen-changed signal gets emitted when the
1338 /// screen of a widget has changed.
1339 ///
1340 ///
1341 ///
1342 ///
1343 /// #### `scroll-event`
1344 /// The ::scroll-event signal is emitted when a button in the 4 to 7
1345 /// range is pressed. Wheel mice are usually configured to generate
1346 /// button press events for buttons 4 and 5 when the wheel is turned.
1347 ///
1348 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1349 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1350 ///
1351 /// This signal will be sent to the grab widget if there is one.
1352 ///
1353 ///
1354 ///
1355 ///
1356 /// #### `selection-clear-event`
1357 /// The ::selection-clear-event signal will be emitted when the
1358 /// the `widget`'s window has lost ownership of a selection.
1359 ///
1360 ///
1361 ///
1362 ///
1363 /// #### `selection-get`
1364 ///
1365 ///
1366 ///
1367 /// #### `selection-notify-event`
1368 ///
1369 ///
1370 ///
1371 /// #### `selection-received`
1372 ///
1373 ///
1374 ///
1375 /// #### `selection-request-event`
1376 /// The ::selection-request-event signal will be emitted when
1377 /// another client requests ownership of the selection owned by
1378 /// the `widget`'s window.
1379 ///
1380 ///
1381 ///
1382 ///
1383 /// #### `show`
1384 /// The ::show signal is emitted when `widget` is shown, for example with
1385 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1386 ///
1387 ///
1388 ///
1389 ///
1390 /// #### `show-help`
1391 /// Action
1392 ///
1393 ///
1394 /// #### `size-allocate`
1395 ///
1396 ///
1397 ///
1398 /// #### `state-changed`
1399 /// The ::state-changed signal is emitted when the widget state changes.
1400 /// See `gtk_widget_get_state()`.
1401 ///
1402 ///
1403 ///
1404 ///
1405 /// #### `state-flags-changed`
1406 /// The ::state-flags-changed signal is emitted when the widget state
1407 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1408 ///
1409 ///
1410 ///
1411 ///
1412 /// #### `style-set`
1413 /// The ::style-set signal is emitted when a new style has been set
1414 /// on a widget. Note that style-modifying functions like
1415 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1416 ///
1417 /// Note that this signal is emitted for changes to the deprecated
1418 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1419 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1420 ///
1421 ///
1422 ///
1423 ///
1424 /// #### `style-updated`
1425 /// The ::style-updated signal is a convenience signal that is emitted when the
1426 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1427 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1428 ///
1429 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1430 /// cause this signal to be emitted.
1431 ///
1432 ///
1433 ///
1434 ///
1435 /// #### `touch-event`
1436 ///
1437 ///
1438 ///
1439 /// #### `unmap`
1440 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1441 /// means that either it or any of its parents up to the toplevel widget have
1442 /// been set as hidden.
1443 ///
1444 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1445 /// used to, for example, stop an animation on the widget.
1446 ///
1447 ///
1448 ///
1449 ///
1450 /// #### `unmap-event`
1451 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1452 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1453 ///
1454 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1455 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1456 /// automatically for all new windows.
1457 ///
1458 ///
1459 ///
1460 ///
1461 /// #### `unrealize`
1462 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1463 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1464 /// called or the widget has been unmapped (that is, it is going to be
1465 /// hidden).
1466 ///
1467 ///
1468 ///
1469 ///
1470 /// #### `visibility-notify-event`
1471 /// The ::visibility-notify-event will be emitted when the `widget`'s
1472 /// window is obscured or unobscured.
1473 ///
1474 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1475 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1476 ///
1477 ///
1478 ///
1479 ///
1480 /// #### `window-state-event`
1481 /// The ::window-state-event will be emitted when the state of the
1482 /// toplevel window associated to the `widget` changes.
1483 ///
1484 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1485 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1486 /// this mask automatically for all new windows.
1487 ///
1488 ///
1489 /// </details>
1490 ///
1491 /// # Implements
1492 ///
1493 /// [`ScrolledWindowExt`][trait@crate::prelude::ScrolledWindowExt], [`BinExt`][trait@crate::prelude::BinExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
1494 #[doc(alias = "GtkPlacesSidebar")]
1495 pub struct PlacesSidebar(Object<ffi::GtkPlacesSidebar, ffi::GtkPlacesSidebarClass>) @extends ScrolledWindow, Bin, Container, Widget, @implements Buildable;
1496
1497 match fn {
1498 type_ => || ffi::gtk_places_sidebar_get_type(),
1499 }
1500}
1501
1502impl PlacesSidebar {
1503 /// Creates a new [`PlacesSidebar`][crate::PlacesSidebar] widget.
1504 ///
1505 /// The application should connect to at least the
1506 /// [`open-location`][struct@crate::PlacesSidebar#open-location] signal to be notified
1507 /// when the user makes a selection in the sidebar.
1508 ///
1509 /// # Returns
1510 ///
1511 /// a newly created [`PlacesSidebar`][crate::PlacesSidebar]
1512 #[doc(alias = "gtk_places_sidebar_new")]
1513 pub fn new() -> PlacesSidebar {
1514 assert_initialized_main_thread!();
1515 unsafe { Widget::from_glib_none(ffi::gtk_places_sidebar_new()).unsafe_cast() }
1516 }
1517
1518 // rustdoc-stripper-ignore-next
1519 /// Creates a new builder-pattern struct instance to construct [`PlacesSidebar`] objects.
1520 ///
1521 /// This method returns an instance of [`PlacesSidebarBuilder`](crate::builders::PlacesSidebarBuilder) which can be used to create [`PlacesSidebar`] objects.
1522 pub fn builder() -> PlacesSidebarBuilder {
1523 PlacesSidebarBuilder::new()
1524 }
1525
1526 /// Applications may want to present some folders in the places sidebar if
1527 /// they could be immediately useful to users. For example, a drawing
1528 /// program could add a “/usr/share/clipart” location when the sidebar is
1529 /// being used in an “Insert Clipart” dialog box.
1530 ///
1531 /// This function adds the specified `location` to a special place for immutable
1532 /// shortcuts. The shortcuts are application-specific; they are not shared
1533 /// across applications, and they are not persistent. If this function
1534 /// is called multiple times with different locations, then they are added
1535 /// to the sidebar’s list in the same order as the function is called.
1536 /// ## `location`
1537 /// location to add as an application-specific shortcut
1538 #[doc(alias = "gtk_places_sidebar_add_shortcut")]
1539 pub fn add_shortcut(&self, location: &impl IsA<gio::File>) {
1540 unsafe {
1541 ffi::gtk_places_sidebar_add_shortcut(
1542 self.to_glib_none().0,
1543 location.as_ref().to_glib_none().0,
1544 );
1545 }
1546 }
1547
1548 /// Returns the value previously set with [`set_local_only()`][Self::set_local_only()].
1549 ///
1550 /// # Returns
1551 ///
1552 /// [`true`] if the sidebar will only show local files.
1553 #[doc(alias = "gtk_places_sidebar_get_local_only")]
1554 #[doc(alias = "get_local_only")]
1555 #[doc(alias = "local-only")]
1556 pub fn is_local_only(&self) -> bool {
1557 unsafe {
1558 from_glib(ffi::gtk_places_sidebar_get_local_only(
1559 self.to_glib_none().0,
1560 ))
1561 }
1562 }
1563
1564 /// Gets the currently selected location in the `self`. This can be [`None`] when
1565 /// nothing is selected, for example, when [`set_location()`][Self::set_location()] has
1566 /// been called with a location that is not among the sidebar’s list of places to
1567 /// show.
1568 ///
1569 /// You can use this function to get the selection in the `self`. Also, if you
1570 /// connect to the [`populate-popup`][struct@crate::PlacesSidebar#populate-popup] signal, you can use this
1571 /// function to get the location that is being referred to during the callbacks
1572 /// for your menu items.
1573 ///
1574 /// # Returns
1575 ///
1576 /// a [`gio::File`][crate::gio::File] with the selected location, or
1577 /// [`None`] if nothing is visually selected.
1578 #[doc(alias = "gtk_places_sidebar_get_location")]
1579 #[doc(alias = "get_location")]
1580 pub fn location(&self) -> Option<gio::File> {
1581 unsafe { from_glib_full(ffi::gtk_places_sidebar_get_location(self.to_glib_none().0)) }
1582 }
1583
1584 /// This function queries the bookmarks added by the user to the places sidebar,
1585 /// and returns one of them. This function is used by [`FileChooser`][crate::FileChooser] to implement
1586 /// the “Alt-1”, “Alt-2”, etc. shortcuts, which activate the cooresponding bookmark.
1587 /// ## `n`
1588 /// index of the bookmark to query
1589 ///
1590 /// # Returns
1591 ///
1592 /// The bookmark specified by the index `n`, or
1593 /// [`None`] if no such index exist. Note that the indices start at 0, even though
1594 /// the file chooser starts them with the keyboard shortcut "Alt-1".
1595 #[doc(alias = "gtk_places_sidebar_get_nth_bookmark")]
1596 #[doc(alias = "get_nth_bookmark")]
1597 pub fn nth_bookmark(&self, n: i32) -> Option<gio::File> {
1598 unsafe {
1599 from_glib_full(ffi::gtk_places_sidebar_get_nth_bookmark(
1600 self.to_glib_none().0,
1601 n,
1602 ))
1603 }
1604 }
1605
1606 /// Gets the open flags.
1607 ///
1608 /// # Returns
1609 ///
1610 /// the [`PlacesOpenFlags`][crate::PlacesOpenFlags] of `self`
1611 #[doc(alias = "gtk_places_sidebar_get_open_flags")]
1612 #[doc(alias = "get_open_flags")]
1613 #[doc(alias = "open-flags")]
1614 pub fn open_flags(&self) -> PlacesOpenFlags {
1615 unsafe {
1616 from_glib(ffi::gtk_places_sidebar_get_open_flags(
1617 self.to_glib_none().0,
1618 ))
1619 }
1620 }
1621
1622 /// Returns the value previously set with [`set_show_desktop()`][Self::set_show_desktop()]
1623 ///
1624 /// # Returns
1625 ///
1626 /// [`true`] if the sidebar will display a builtin shortcut to the desktop folder.
1627 #[doc(alias = "gtk_places_sidebar_get_show_desktop")]
1628 #[doc(alias = "get_show_desktop")]
1629 #[doc(alias = "show-desktop")]
1630 pub fn shows_desktop(&self) -> bool {
1631 unsafe {
1632 from_glib(ffi::gtk_places_sidebar_get_show_desktop(
1633 self.to_glib_none().0,
1634 ))
1635 }
1636 }
1637
1638 /// Returns the value previously set with [`set_show_enter_location()`][Self::set_show_enter_location()]
1639 ///
1640 /// # Returns
1641 ///
1642 /// [`true`] if the sidebar will display an “Enter Location” item.
1643 #[doc(alias = "gtk_places_sidebar_get_show_enter_location")]
1644 #[doc(alias = "get_show_enter_location")]
1645 #[doc(alias = "show-enter-location")]
1646 pub fn shows_enter_location(&self) -> bool {
1647 unsafe {
1648 from_glib(ffi::gtk_places_sidebar_get_show_enter_location(
1649 self.to_glib_none().0,
1650 ))
1651 }
1652 }
1653
1654 /// Returns the value previously set with [`set_show_other_locations()`][Self::set_show_other_locations()]
1655 ///
1656 /// # Returns
1657 ///
1658 /// [`true`] if the sidebar will display an “Other Locations” item.
1659 #[doc(alias = "gtk_places_sidebar_get_show_other_locations")]
1660 #[doc(alias = "get_show_other_locations")]
1661 #[doc(alias = "show-other-locations")]
1662 pub fn shows_other_locations(&self) -> bool {
1663 unsafe {
1664 from_glib(ffi::gtk_places_sidebar_get_show_other_locations(
1665 self.to_glib_none().0,
1666 ))
1667 }
1668 }
1669
1670 /// Returns the value previously set with [`set_show_recent()`][Self::set_show_recent()]
1671 ///
1672 /// # Returns
1673 ///
1674 /// [`true`] if the sidebar will display a builtin shortcut for recent files
1675 #[doc(alias = "gtk_places_sidebar_get_show_recent")]
1676 #[doc(alias = "get_show_recent")]
1677 #[doc(alias = "show-recent")]
1678 pub fn shows_recent(&self) -> bool {
1679 unsafe {
1680 from_glib(ffi::gtk_places_sidebar_get_show_recent(
1681 self.to_glib_none().0,
1682 ))
1683 }
1684 }
1685
1686 /// Returns the value previously set with [`set_show_starred_location()`][Self::set_show_starred_location()]
1687 ///
1688 /// # Returns
1689 ///
1690 /// [`true`] if the sidebar will display a Starred item.
1691 #[doc(alias = "gtk_places_sidebar_get_show_starred_location")]
1692 #[doc(alias = "get_show_starred_location")]
1693 #[doc(alias = "show-starred-location")]
1694 pub fn shows_starred_location(&self) -> bool {
1695 unsafe {
1696 from_glib(ffi::gtk_places_sidebar_get_show_starred_location(
1697 self.to_glib_none().0,
1698 ))
1699 }
1700 }
1701
1702 /// Returns the value previously set with [`set_show_trash()`][Self::set_show_trash()]
1703 ///
1704 /// # Returns
1705 ///
1706 /// [`true`] if the sidebar will display a “Trash” item.
1707 #[doc(alias = "gtk_places_sidebar_get_show_trash")]
1708 #[doc(alias = "get_show_trash")]
1709 #[doc(alias = "show-trash")]
1710 pub fn shows_trash(&self) -> bool {
1711 unsafe {
1712 from_glib(ffi::gtk_places_sidebar_get_show_trash(
1713 self.to_glib_none().0,
1714 ))
1715 }
1716 }
1717
1718 /// Gets the list of shortcuts.
1719 ///
1720 /// # Returns
1721 ///
1722 ///
1723 /// A `GSList` of [`gio::File`][crate::gio::File] of the locations that have been added as
1724 /// application-specific shortcuts with [`add_shortcut()`][Self::add_shortcut()].
1725 /// To free this list, you can use
1726 ///
1727 ///
1728 /// **⚠️ The following code is in C ⚠️**
1729 ///
1730 /// ```C
1731 /// g_slist_free_full (list, (GDestroyNotify) g_object_unref);
1732 /// ```
1733 #[doc(alias = "gtk_places_sidebar_list_shortcuts")]
1734 pub fn list_shortcuts(&self) -> Vec<gio::File> {
1735 unsafe {
1736 FromGlibPtrContainer::from_glib_full(ffi::gtk_places_sidebar_list_shortcuts(
1737 self.to_glib_none().0,
1738 ))
1739 }
1740 }
1741
1742 /// Removes an application-specific shortcut that has been previously been
1743 /// inserted with [`add_shortcut()`][Self::add_shortcut()]. If the `location` is not a
1744 /// shortcut in the sidebar, then nothing is done.
1745 /// ## `location`
1746 /// location to remove
1747 #[doc(alias = "gtk_places_sidebar_remove_shortcut")]
1748 pub fn remove_shortcut(&self, location: &impl IsA<gio::File>) {
1749 unsafe {
1750 ffi::gtk_places_sidebar_remove_shortcut(
1751 self.to_glib_none().0,
1752 location.as_ref().to_glib_none().0,
1753 );
1754 }
1755 }
1756
1757 /// Make the GtkPlacesSidebar show drop targets, so it can show the available
1758 /// drop targets and a "new bookmark" row. This improves the Drag-and-Drop
1759 /// experience of the user and allows applications to show all available
1760 /// drop targets at once.
1761 ///
1762 /// This needs to be called when the application is aware of an ongoing drag
1763 /// that might target the sidebar. The drop-targets-visible state will be unset
1764 /// automatically if the drag finishes in the GtkPlacesSidebar. You only need
1765 /// to unset the state when the drag ends on some other widget on your application.
1766 /// ## `visible`
1767 /// whether to show the valid targets or not.
1768 /// ## `context`
1769 /// drag context used to ask the source about the action that wants to
1770 /// perform, so hints are more accurate.
1771 #[doc(alias = "gtk_places_sidebar_set_drop_targets_visible")]
1772 pub fn set_drop_targets_visible(&self, visible: bool, context: &gdk::DragContext) {
1773 unsafe {
1774 ffi::gtk_places_sidebar_set_drop_targets_visible(
1775 self.to_glib_none().0,
1776 visible.into_glib(),
1777 context.to_glib_none().0,
1778 );
1779 }
1780 }
1781
1782 /// Sets whether the `self` should only show local files.
1783 /// ## `local_only`
1784 /// whether to show only local files
1785 #[doc(alias = "gtk_places_sidebar_set_local_only")]
1786 #[doc(alias = "local-only")]
1787 pub fn set_local_only(&self, local_only: bool) {
1788 unsafe {
1789 ffi::gtk_places_sidebar_set_local_only(self.to_glib_none().0, local_only.into_glib());
1790 }
1791 }
1792
1793 /// Sets the location that is being shown in the widgets surrounding the
1794 /// `self`, for example, in a folder view in a file manager. In turn, the
1795 /// `self` will highlight that location if it is being shown in the list of
1796 /// places, or it will unhighlight everything if the `location` is not among the
1797 /// places in the list.
1798 /// ## `location`
1799 /// location to select, or [`None`] for no current path
1800 #[doc(alias = "gtk_places_sidebar_set_location")]
1801 #[doc(alias = "location")]
1802 pub fn set_location(&self, location: Option<&impl IsA<gio::File>>) {
1803 unsafe {
1804 ffi::gtk_places_sidebar_set_location(
1805 self.to_glib_none().0,
1806 location.map(|p| p.as_ref()).to_glib_none().0,
1807 );
1808 }
1809 }
1810
1811 /// Sets the way in which the calling application can open new locations from
1812 /// the places sidebar. For example, some applications only open locations
1813 /// “directly” into their main view, while others may support opening locations
1814 /// in a new notebook tab or a new window.
1815 ///
1816 /// This function is used to tell the places `self` about the ways in which the
1817 /// application can open new locations, so that the sidebar can display (or not)
1818 /// the “Open in new tab” and “Open in new window” menu items as appropriate.
1819 ///
1820 /// When the [`open-location`][struct@crate::PlacesSidebar#open-location] signal is emitted, its flags
1821 /// argument will be set to one of the `flags` that was passed in
1822 /// [`set_open_flags()`][Self::set_open_flags()].
1823 ///
1824 /// Passing 0 for `flags` will cause [`PlacesOpenFlags::NORMAL`][crate::PlacesOpenFlags::NORMAL] to always be sent
1825 /// to callbacks for the “open-location” signal.
1826 /// ## `flags`
1827 /// Bitmask of modes in which the calling application can open locations
1828 #[doc(alias = "gtk_places_sidebar_set_open_flags")]
1829 #[doc(alias = "open-flags")]
1830 pub fn set_open_flags(&self, flags: PlacesOpenFlags) {
1831 unsafe {
1832 ffi::gtk_places_sidebar_set_open_flags(self.to_glib_none().0, flags.into_glib());
1833 }
1834 }
1835
1836 /// Sets whether the `self` should show an item for the Desktop folder.
1837 /// The default value for this option is determined by the desktop
1838 /// environment and the user’s configuration, but this function can be
1839 /// used to override it on a per-application basis.
1840 /// ## `show_desktop`
1841 /// whether to show an item for the Desktop folder
1842 #[doc(alias = "gtk_places_sidebar_set_show_desktop")]
1843 #[doc(alias = "show-desktop")]
1844 pub fn set_show_desktop(&self, show_desktop: bool) {
1845 unsafe {
1846 ffi::gtk_places_sidebar_set_show_desktop(
1847 self.to_glib_none().0,
1848 show_desktop.into_glib(),
1849 );
1850 }
1851 }
1852
1853 /// Sets whether the `self` should show an item for entering a location;
1854 /// this is off by default. An application may want to turn this on if manually
1855 /// entering URLs is an expected user action.
1856 ///
1857 /// If you enable this, you should connect to the
1858 /// [`show-enter-location`][struct@crate::PlacesSidebar#show-enter-location] signal.
1859 /// ## `show_enter_location`
1860 /// whether to show an item to enter a location
1861 #[doc(alias = "gtk_places_sidebar_set_show_enter_location")]
1862 #[doc(alias = "show-enter-location")]
1863 pub fn set_show_enter_location(&self, show_enter_location: bool) {
1864 unsafe {
1865 ffi::gtk_places_sidebar_set_show_enter_location(
1866 self.to_glib_none().0,
1867 show_enter_location.into_glib(),
1868 );
1869 }
1870 }
1871
1872 /// Sets whether the `self` should show an item for the application to show
1873 /// an Other Locations view; this is off by default. When set to [`true`], persistent
1874 /// devices such as hard drives are hidden, otherwise they are shown in the sidebar.
1875 /// An application may want to turn this on if it implements a way for the user to
1876 /// see and interact with drives and network servers directly.
1877 ///
1878 /// If you enable this, you should connect to the
1879 /// [`show-other-locations`][struct@crate::PlacesSidebar#show-other-locations] signal.
1880 /// ## `show_other_locations`
1881 /// whether to show an item for the Other Locations view
1882 #[doc(alias = "gtk_places_sidebar_set_show_other_locations")]
1883 #[doc(alias = "show-other-locations")]
1884 pub fn set_show_other_locations(&self, show_other_locations: bool) {
1885 unsafe {
1886 ffi::gtk_places_sidebar_set_show_other_locations(
1887 self.to_glib_none().0,
1888 show_other_locations.into_glib(),
1889 );
1890 }
1891 }
1892
1893 /// Sets whether the `self` should show an item for recent files.
1894 /// The default value for this option is determined by the desktop
1895 /// environment, but this function can be used to override it on a
1896 /// per-application basis.
1897 /// ## `show_recent`
1898 /// whether to show an item for recent files
1899 #[doc(alias = "gtk_places_sidebar_set_show_recent")]
1900 #[doc(alias = "show-recent")]
1901 pub fn set_show_recent(&self, show_recent: bool) {
1902 unsafe {
1903 ffi::gtk_places_sidebar_set_show_recent(self.to_glib_none().0, show_recent.into_glib());
1904 }
1905 }
1906
1907 /// If you enable this, you should connect to the
1908 /// [`show-starred-location`][struct@crate::PlacesSidebar#show-starred-location] signal.
1909 /// ## `show_starred_location`
1910 /// whether to show an item for Starred files
1911 #[doc(alias = "gtk_places_sidebar_set_show_starred_location")]
1912 #[doc(alias = "show-starred-location")]
1913 pub fn set_show_starred_location(&self, show_starred_location: bool) {
1914 unsafe {
1915 ffi::gtk_places_sidebar_set_show_starred_location(
1916 self.to_glib_none().0,
1917 show_starred_location.into_glib(),
1918 );
1919 }
1920 }
1921
1922 /// Sets whether the `self` should show an item for the Trash location.
1923 /// ## `show_trash`
1924 /// whether to show an item for the Trash location
1925 #[doc(alias = "gtk_places_sidebar_set_show_trash")]
1926 #[doc(alias = "show-trash")]
1927 pub fn set_show_trash(&self, show_trash: bool) {
1928 unsafe {
1929 ffi::gtk_places_sidebar_set_show_trash(self.to_glib_none().0, show_trash.into_glib());
1930 }
1931 }
1932
1933 /// If :populate-all is [`true`], the [`populate-popup`][struct@crate::PlacesSidebar#populate-popup] signal
1934 /// is also emitted for popovers.
1935 #[doc(alias = "populate-all")]
1936 pub fn populates_all(&self) -> bool {
1937 ObjectExt::property(self, "populate-all")
1938 }
1939
1940 /// If :populate-all is [`true`], the [`populate-popup`][struct@crate::PlacesSidebar#populate-popup] signal
1941 /// is also emitted for popovers.
1942 #[doc(alias = "populate-all")]
1943 pub fn set_populate_all(&self, populate_all: bool) {
1944 ObjectExt::set_property(self, "populate-all", populate_all)
1945 }
1946
1947 #[doc(alias = "show-connect-to-server")]
1948 pub fn shows_connect_to_server(&self) -> bool {
1949 ObjectExt::property(self, "show-connect-to-server")
1950 }
1951
1952 #[doc(alias = "show-connect-to-server")]
1953 pub fn set_show_connect_to_server(&self, show_connect_to_server: bool) {
1954 ObjectExt::set_property(self, "show-connect-to-server", show_connect_to_server)
1955 }
1956
1957 /// The places sidebar emits this signal when it needs to ask the application
1958 /// to pop up a menu to ask the user for which drag action to perform.
1959 /// ## `actions`
1960 /// Possible drag actions that need to be asked for.
1961 ///
1962 /// # Returns
1963 ///
1964 /// the final drag action that the sidebar should pass to the drag side
1965 /// of the drag-and-drop operation.
1966 #[doc(alias = "drag-action-ask")]
1967 pub fn connect_drag_action_ask<F: Fn(&Self, i32) -> i32 + 'static>(
1968 &self,
1969 f: F,
1970 ) -> SignalHandlerId {
1971 unsafe extern "C" fn drag_action_ask_trampoline<
1972 F: Fn(&PlacesSidebar, i32) -> i32 + 'static,
1973 >(
1974 this: *mut ffi::GtkPlacesSidebar,
1975 actions: std::ffi::c_int,
1976 f: glib::ffi::gpointer,
1977 ) -> std::ffi::c_int {
1978 unsafe {
1979 let f: &F = &*(f as *const F);
1980 f(&from_glib_borrow(this), actions)
1981 }
1982 }
1983 unsafe {
1984 let f: Box_<F> = Box_::new(f);
1985 connect_raw(
1986 self.as_ptr() as *mut _,
1987 c"drag-action-ask".as_ptr(),
1988 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1989 drag_action_ask_trampoline::<F> as *const (),
1990 )),
1991 Box_::into_raw(f),
1992 )
1993 }
1994 }
1995
1996 /// The places sidebar emits this signal when it starts a new operation
1997 /// because the user clicked on some location that needs mounting.
1998 /// In this way the application using the [`PlacesSidebar`][crate::PlacesSidebar] can track the
1999 /// progress of the operation and, for example, show a notification.
2000 /// ## `mount_operation`
2001 /// the [`gio::MountOperation`][crate::gio::MountOperation] that is going to start.
2002 #[doc(alias = "mount")]
2003 pub fn connect_mount<F: Fn(&Self, &gio::MountOperation) + 'static>(
2004 &self,
2005 f: F,
2006 ) -> SignalHandlerId {
2007 unsafe extern "C" fn mount_trampoline<
2008 F: Fn(&PlacesSidebar, &gio::MountOperation) + 'static,
2009 >(
2010 this: *mut ffi::GtkPlacesSidebar,
2011 mount_operation: *mut gio::ffi::GMountOperation,
2012 f: glib::ffi::gpointer,
2013 ) {
2014 unsafe {
2015 let f: &F = &*(f as *const F);
2016 f(&from_glib_borrow(this), &from_glib_borrow(mount_operation))
2017 }
2018 }
2019 unsafe {
2020 let f: Box_<F> = Box_::new(f);
2021 connect_raw(
2022 self.as_ptr() as *mut _,
2023 c"mount".as_ptr(),
2024 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2025 mount_trampoline::<F> as *const (),
2026 )),
2027 Box_::into_raw(f),
2028 )
2029 }
2030 }
2031
2032 /// The places sidebar emits this signal when the user selects a location
2033 /// in it. The calling application should display the contents of that
2034 /// location; for example, a file manager should show a list of files in
2035 /// the specified location.
2036 /// ## `location`
2037 /// [`gio::File`][crate::gio::File] to which the caller should switch.
2038 /// ## `open_flags`
2039 /// a single value from [`PlacesOpenFlags`][crate::PlacesOpenFlags] specifying how the `location` should be opened.
2040 #[doc(alias = "open-location")]
2041 pub fn connect_open_location<F: Fn(&Self, &gio::File, PlacesOpenFlags) + 'static>(
2042 &self,
2043 f: F,
2044 ) -> SignalHandlerId {
2045 unsafe extern "C" fn open_location_trampoline<
2046 F: Fn(&PlacesSidebar, &gio::File, PlacesOpenFlags) + 'static,
2047 >(
2048 this: *mut ffi::GtkPlacesSidebar,
2049 location: *mut gio::ffi::GFile,
2050 open_flags: ffi::GtkPlacesOpenFlags,
2051 f: glib::ffi::gpointer,
2052 ) {
2053 unsafe {
2054 let f: &F = &*(f as *const F);
2055 f(
2056 &from_glib_borrow(this),
2057 &from_glib_borrow(location),
2058 from_glib(open_flags),
2059 )
2060 }
2061 }
2062 unsafe {
2063 let f: Box_<F> = Box_::new(f);
2064 connect_raw(
2065 self.as_ptr() as *mut _,
2066 c"open-location".as_ptr(),
2067 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2068 open_location_trampoline::<F> as *const (),
2069 )),
2070 Box_::into_raw(f),
2071 )
2072 }
2073 }
2074
2075 //#[doc(alias = "populate-popup")]
2076 //pub fn connect_populate_popup<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
2077 // Ignored selected_volume: Gio.Volume
2078 //}
2079
2080 /// The places sidebar emits this signal when it needs the calling
2081 /// application to present an way to directly enter a location.
2082 /// For example, the application may bring up a dialog box asking for
2083 /// a URL like "http://http.example.com".
2084 #[doc(alias = "show-enter-location")]
2085 pub fn connect_show_enter_location<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2086 unsafe extern "C" fn show_enter_location_trampoline<F: Fn(&PlacesSidebar) + 'static>(
2087 this: *mut ffi::GtkPlacesSidebar,
2088 f: glib::ffi::gpointer,
2089 ) {
2090 unsafe {
2091 let f: &F = &*(f as *const F);
2092 f(&from_glib_borrow(this))
2093 }
2094 }
2095 unsafe {
2096 let f: Box_<F> = Box_::new(f);
2097 connect_raw(
2098 self.as_ptr() as *mut _,
2099 c"show-enter-location".as_ptr(),
2100 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2101 show_enter_location_trampoline::<F> as *const (),
2102 )),
2103 Box_::into_raw(f),
2104 )
2105 }
2106 }
2107
2108 /// The places sidebar emits this signal when it needs the calling
2109 /// application to present an error message. Most of these messages
2110 /// refer to mounting or unmounting media, for example, when a drive
2111 /// cannot be started for some reason.
2112 /// ## `primary`
2113 /// primary message with a summary of the error to show.
2114 /// ## `secondary`
2115 /// secondary message with details of the error to show.
2116 #[doc(alias = "show-error-message")]
2117 pub fn connect_show_error_message<F: Fn(&Self, &str, &str) + 'static>(
2118 &self,
2119 f: F,
2120 ) -> SignalHandlerId {
2121 unsafe extern "C" fn show_error_message_trampoline<
2122 F: Fn(&PlacesSidebar, &str, &str) + 'static,
2123 >(
2124 this: *mut ffi::GtkPlacesSidebar,
2125 primary: *mut std::ffi::c_char,
2126 secondary: *mut std::ffi::c_char,
2127 f: glib::ffi::gpointer,
2128 ) {
2129 unsafe {
2130 let f: &F = &*(f as *const F);
2131 f(
2132 &from_glib_borrow(this),
2133 &glib::GString::from_glib_borrow(primary),
2134 &glib::GString::from_glib_borrow(secondary),
2135 )
2136 }
2137 }
2138 unsafe {
2139 let f: Box_<F> = Box_::new(f);
2140 connect_raw(
2141 self.as_ptr() as *mut _,
2142 c"show-error-message".as_ptr(),
2143 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2144 show_error_message_trampoline::<F> as *const (),
2145 )),
2146 Box_::into_raw(f),
2147 )
2148 }
2149 }
2150
2151 /// The places sidebar emits this signal when it needs the calling
2152 /// application to present a way to show other locations e.g. drives
2153 /// and network access points.
2154 /// For example, the application may bring up a page showing persistent
2155 /// volumes and discovered network addresses.
2156 /// ## `open_flags`
2157 /// a single value from [`PlacesOpenFlags`][crate::PlacesOpenFlags] specifying how it should be opened.
2158 #[doc(alias = "show-other-locations-with-flags")]
2159 pub fn connect_show_other_locations_with_flags<F: Fn(&Self, PlacesOpenFlags) + 'static>(
2160 &self,
2161 f: F,
2162 ) -> SignalHandlerId {
2163 unsafe extern "C" fn show_other_locations_with_flags_trampoline<
2164 F: Fn(&PlacesSidebar, PlacesOpenFlags) + 'static,
2165 >(
2166 this: *mut ffi::GtkPlacesSidebar,
2167 open_flags: ffi::GtkPlacesOpenFlags,
2168 f: glib::ffi::gpointer,
2169 ) {
2170 unsafe {
2171 let f: &F = &*(f as *const F);
2172 f(&from_glib_borrow(this), from_glib(open_flags))
2173 }
2174 }
2175 unsafe {
2176 let f: Box_<F> = Box_::new(f);
2177 connect_raw(
2178 self.as_ptr() as *mut _,
2179 c"show-other-locations-with-flags".as_ptr(),
2180 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2181 show_other_locations_with_flags_trampoline::<F> as *const (),
2182 )),
2183 Box_::into_raw(f),
2184 )
2185 }
2186 }
2187
2188 /// The places sidebar emits this signal when it needs the calling
2189 /// application to present a way to show the starred files. In GNOME,
2190 /// starred files are implemented by setting the nao:predefined-tag-favorite
2191 /// tag in the tracker database.
2192 /// ## `open_flags`
2193 /// a single value from [`PlacesOpenFlags`][crate::PlacesOpenFlags] specifying how the
2194 /// starred file should be opened.
2195 #[doc(alias = "show-starred-location")]
2196 pub fn connect_show_starred_location<F: Fn(&Self, PlacesOpenFlags) + 'static>(
2197 &self,
2198 f: F,
2199 ) -> SignalHandlerId {
2200 unsafe extern "C" fn show_starred_location_trampoline<
2201 F: Fn(&PlacesSidebar, PlacesOpenFlags) + 'static,
2202 >(
2203 this: *mut ffi::GtkPlacesSidebar,
2204 open_flags: ffi::GtkPlacesOpenFlags,
2205 f: glib::ffi::gpointer,
2206 ) {
2207 unsafe {
2208 let f: &F = &*(f as *const F);
2209 f(&from_glib_borrow(this), from_glib(open_flags))
2210 }
2211 }
2212 unsafe {
2213 let f: Box_<F> = Box_::new(f);
2214 connect_raw(
2215 self.as_ptr() as *mut _,
2216 c"show-starred-location".as_ptr(),
2217 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2218 show_starred_location_trampoline::<F> as *const (),
2219 )),
2220 Box_::into_raw(f),
2221 )
2222 }
2223 }
2224
2225 /// The places sidebar emits this signal when it starts a new operation
2226 /// because the user for example ejected some drive or unmounted a mount.
2227 /// In this way the application using the [`PlacesSidebar`][crate::PlacesSidebar] can track the
2228 /// progress of the operation and, for example, show a notification.
2229 /// ## `mount_operation`
2230 /// the [`gio::MountOperation`][crate::gio::MountOperation] that is going to start.
2231 #[doc(alias = "unmount")]
2232 pub fn connect_unmount<F: Fn(&Self, &gio::MountOperation) + 'static>(
2233 &self,
2234 f: F,
2235 ) -> SignalHandlerId {
2236 unsafe extern "C" fn unmount_trampoline<
2237 F: Fn(&PlacesSidebar, &gio::MountOperation) + 'static,
2238 >(
2239 this: *mut ffi::GtkPlacesSidebar,
2240 mount_operation: *mut gio::ffi::GMountOperation,
2241 f: glib::ffi::gpointer,
2242 ) {
2243 unsafe {
2244 let f: &F = &*(f as *const F);
2245 f(&from_glib_borrow(this), &from_glib_borrow(mount_operation))
2246 }
2247 }
2248 unsafe {
2249 let f: Box_<F> = Box_::new(f);
2250 connect_raw(
2251 self.as_ptr() as *mut _,
2252 c"unmount".as_ptr(),
2253 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2254 unmount_trampoline::<F> as *const (),
2255 )),
2256 Box_::into_raw(f),
2257 )
2258 }
2259 }
2260
2261 #[doc(alias = "local-only")]
2262 pub fn connect_local_only_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2263 unsafe extern "C" fn notify_local_only_trampoline<F: Fn(&PlacesSidebar) + 'static>(
2264 this: *mut ffi::GtkPlacesSidebar,
2265 _param_spec: glib::ffi::gpointer,
2266 f: glib::ffi::gpointer,
2267 ) {
2268 unsafe {
2269 let f: &F = &*(f as *const F);
2270 f(&from_glib_borrow(this))
2271 }
2272 }
2273 unsafe {
2274 let f: Box_<F> = Box_::new(f);
2275 connect_raw(
2276 self.as_ptr() as *mut _,
2277 c"notify::local-only".as_ptr(),
2278 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2279 notify_local_only_trampoline::<F> as *const (),
2280 )),
2281 Box_::into_raw(f),
2282 )
2283 }
2284 }
2285
2286 #[doc(alias = "location")]
2287 pub fn connect_location_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2288 unsafe extern "C" fn notify_location_trampoline<F: Fn(&PlacesSidebar) + 'static>(
2289 this: *mut ffi::GtkPlacesSidebar,
2290 _param_spec: glib::ffi::gpointer,
2291 f: glib::ffi::gpointer,
2292 ) {
2293 unsafe {
2294 let f: &F = &*(f as *const F);
2295 f(&from_glib_borrow(this))
2296 }
2297 }
2298 unsafe {
2299 let f: Box_<F> = Box_::new(f);
2300 connect_raw(
2301 self.as_ptr() as *mut _,
2302 c"notify::location".as_ptr(),
2303 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2304 notify_location_trampoline::<F> as *const (),
2305 )),
2306 Box_::into_raw(f),
2307 )
2308 }
2309 }
2310
2311 #[doc(alias = "open-flags")]
2312 pub fn connect_open_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2313 unsafe extern "C" fn notify_open_flags_trampoline<F: Fn(&PlacesSidebar) + 'static>(
2314 this: *mut ffi::GtkPlacesSidebar,
2315 _param_spec: glib::ffi::gpointer,
2316 f: glib::ffi::gpointer,
2317 ) {
2318 unsafe {
2319 let f: &F = &*(f as *const F);
2320 f(&from_glib_borrow(this))
2321 }
2322 }
2323 unsafe {
2324 let f: Box_<F> = Box_::new(f);
2325 connect_raw(
2326 self.as_ptr() as *mut _,
2327 c"notify::open-flags".as_ptr(),
2328 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2329 notify_open_flags_trampoline::<F> as *const (),
2330 )),
2331 Box_::into_raw(f),
2332 )
2333 }
2334 }
2335
2336 #[doc(alias = "populate-all")]
2337 pub fn connect_populate_all_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2338 unsafe extern "C" fn notify_populate_all_trampoline<F: Fn(&PlacesSidebar) + 'static>(
2339 this: *mut ffi::GtkPlacesSidebar,
2340 _param_spec: glib::ffi::gpointer,
2341 f: glib::ffi::gpointer,
2342 ) {
2343 unsafe {
2344 let f: &F = &*(f as *const F);
2345 f(&from_glib_borrow(this))
2346 }
2347 }
2348 unsafe {
2349 let f: Box_<F> = Box_::new(f);
2350 connect_raw(
2351 self.as_ptr() as *mut _,
2352 c"notify::populate-all".as_ptr(),
2353 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2354 notify_populate_all_trampoline::<F> as *const (),
2355 )),
2356 Box_::into_raw(f),
2357 )
2358 }
2359 }
2360
2361 #[doc(alias = "show-connect-to-server")]
2362 pub fn connect_show_connect_to_server_notify<F: Fn(&Self) + 'static>(
2363 &self,
2364 f: F,
2365 ) -> SignalHandlerId {
2366 unsafe extern "C" fn notify_show_connect_to_server_trampoline<
2367 F: Fn(&PlacesSidebar) + 'static,
2368 >(
2369 this: *mut ffi::GtkPlacesSidebar,
2370 _param_spec: glib::ffi::gpointer,
2371 f: glib::ffi::gpointer,
2372 ) {
2373 unsafe {
2374 let f: &F = &*(f as *const F);
2375 f(&from_glib_borrow(this))
2376 }
2377 }
2378 unsafe {
2379 let f: Box_<F> = Box_::new(f);
2380 connect_raw(
2381 self.as_ptr() as *mut _,
2382 c"notify::show-connect-to-server".as_ptr(),
2383 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2384 notify_show_connect_to_server_trampoline::<F> as *const (),
2385 )),
2386 Box_::into_raw(f),
2387 )
2388 }
2389 }
2390
2391 #[doc(alias = "show-desktop")]
2392 pub fn connect_show_desktop_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2393 unsafe extern "C" fn notify_show_desktop_trampoline<F: Fn(&PlacesSidebar) + 'static>(
2394 this: *mut ffi::GtkPlacesSidebar,
2395 _param_spec: glib::ffi::gpointer,
2396 f: glib::ffi::gpointer,
2397 ) {
2398 unsafe {
2399 let f: &F = &*(f as *const F);
2400 f(&from_glib_borrow(this))
2401 }
2402 }
2403 unsafe {
2404 let f: Box_<F> = Box_::new(f);
2405 connect_raw(
2406 self.as_ptr() as *mut _,
2407 c"notify::show-desktop".as_ptr(),
2408 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2409 notify_show_desktop_trampoline::<F> as *const (),
2410 )),
2411 Box_::into_raw(f),
2412 )
2413 }
2414 }
2415
2416 #[doc(alias = "show-enter-location")]
2417 pub fn connect_show_enter_location_notify<F: Fn(&Self) + 'static>(
2418 &self,
2419 f: F,
2420 ) -> SignalHandlerId {
2421 unsafe extern "C" fn notify_show_enter_location_trampoline<
2422 F: Fn(&PlacesSidebar) + 'static,
2423 >(
2424 this: *mut ffi::GtkPlacesSidebar,
2425 _param_spec: glib::ffi::gpointer,
2426 f: glib::ffi::gpointer,
2427 ) {
2428 unsafe {
2429 let f: &F = &*(f as *const F);
2430 f(&from_glib_borrow(this))
2431 }
2432 }
2433 unsafe {
2434 let f: Box_<F> = Box_::new(f);
2435 connect_raw(
2436 self.as_ptr() as *mut _,
2437 c"notify::show-enter-location".as_ptr(),
2438 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2439 notify_show_enter_location_trampoline::<F> as *const (),
2440 )),
2441 Box_::into_raw(f),
2442 )
2443 }
2444 }
2445
2446 #[doc(alias = "show-other-locations")]
2447 pub fn connect_show_other_locations_notify<F: Fn(&Self) + 'static>(
2448 &self,
2449 f: F,
2450 ) -> SignalHandlerId {
2451 unsafe extern "C" fn notify_show_other_locations_trampoline<
2452 F: Fn(&PlacesSidebar) + 'static,
2453 >(
2454 this: *mut ffi::GtkPlacesSidebar,
2455 _param_spec: glib::ffi::gpointer,
2456 f: glib::ffi::gpointer,
2457 ) {
2458 unsafe {
2459 let f: &F = &*(f as *const F);
2460 f(&from_glib_borrow(this))
2461 }
2462 }
2463 unsafe {
2464 let f: Box_<F> = Box_::new(f);
2465 connect_raw(
2466 self.as_ptr() as *mut _,
2467 c"notify::show-other-locations".as_ptr(),
2468 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2469 notify_show_other_locations_trampoline::<F> as *const (),
2470 )),
2471 Box_::into_raw(f),
2472 )
2473 }
2474 }
2475
2476 #[doc(alias = "show-recent")]
2477 pub fn connect_show_recent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2478 unsafe extern "C" fn notify_show_recent_trampoline<F: Fn(&PlacesSidebar) + 'static>(
2479 this: *mut ffi::GtkPlacesSidebar,
2480 _param_spec: glib::ffi::gpointer,
2481 f: glib::ffi::gpointer,
2482 ) {
2483 unsafe {
2484 let f: &F = &*(f as *const F);
2485 f(&from_glib_borrow(this))
2486 }
2487 }
2488 unsafe {
2489 let f: Box_<F> = Box_::new(f);
2490 connect_raw(
2491 self.as_ptr() as *mut _,
2492 c"notify::show-recent".as_ptr(),
2493 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2494 notify_show_recent_trampoline::<F> as *const (),
2495 )),
2496 Box_::into_raw(f),
2497 )
2498 }
2499 }
2500
2501 #[doc(alias = "show-starred-location")]
2502 pub fn connect_show_starred_location_notify<F: Fn(&Self) + 'static>(
2503 &self,
2504 f: F,
2505 ) -> SignalHandlerId {
2506 unsafe extern "C" fn notify_show_starred_location_trampoline<
2507 F: Fn(&PlacesSidebar) + 'static,
2508 >(
2509 this: *mut ffi::GtkPlacesSidebar,
2510 _param_spec: glib::ffi::gpointer,
2511 f: glib::ffi::gpointer,
2512 ) {
2513 unsafe {
2514 let f: &F = &*(f as *const F);
2515 f(&from_glib_borrow(this))
2516 }
2517 }
2518 unsafe {
2519 let f: Box_<F> = Box_::new(f);
2520 connect_raw(
2521 self.as_ptr() as *mut _,
2522 c"notify::show-starred-location".as_ptr(),
2523 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2524 notify_show_starred_location_trampoline::<F> as *const (),
2525 )),
2526 Box_::into_raw(f),
2527 )
2528 }
2529 }
2530
2531 #[doc(alias = "show-trash")]
2532 pub fn connect_show_trash_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2533 unsafe extern "C" fn notify_show_trash_trampoline<F: Fn(&PlacesSidebar) + 'static>(
2534 this: *mut ffi::GtkPlacesSidebar,
2535 _param_spec: glib::ffi::gpointer,
2536 f: glib::ffi::gpointer,
2537 ) {
2538 unsafe {
2539 let f: &F = &*(f as *const F);
2540 f(&from_glib_borrow(this))
2541 }
2542 }
2543 unsafe {
2544 let f: Box_<F> = Box_::new(f);
2545 connect_raw(
2546 self.as_ptr() as *mut _,
2547 c"notify::show-trash".as_ptr(),
2548 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2549 notify_show_trash_trampoline::<F> as *const (),
2550 )),
2551 Box_::into_raw(f),
2552 )
2553 }
2554 }
2555}
2556
2557impl Default for PlacesSidebar {
2558 fn default() -> Self {
2559 Self::new()
2560 }
2561}
2562
2563// rustdoc-stripper-ignore-next
2564/// A [builder-pattern] type to construct [`PlacesSidebar`] objects.
2565///
2566/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
2567#[must_use = "The builder must be built to be used"]
2568pub struct PlacesSidebarBuilder {
2569 builder: glib::object::ObjectBuilder<'static, PlacesSidebar>,
2570}
2571
2572impl PlacesSidebarBuilder {
2573 fn new() -> Self {
2574 Self {
2575 builder: glib::object::Object::builder(),
2576 }
2577 }
2578
2579 pub fn local_only(self, local_only: bool) -> Self {
2580 Self {
2581 builder: self.builder.property("local-only", local_only),
2582 }
2583 }
2584
2585 pub fn location(self, location: &impl IsA<gio::File>) -> Self {
2586 Self {
2587 builder: self.builder.property("location", location.clone().upcast()),
2588 }
2589 }
2590
2591 pub fn open_flags(self, open_flags: PlacesOpenFlags) -> Self {
2592 Self {
2593 builder: self.builder.property("open-flags", open_flags),
2594 }
2595 }
2596
2597 /// If :populate-all is [`true`], the [`populate-popup`][struct@crate::PlacesSidebar#populate-popup] signal
2598 /// is also emitted for popovers.
2599 pub fn populate_all(self, populate_all: bool) -> Self {
2600 Self {
2601 builder: self.builder.property("populate-all", populate_all),
2602 }
2603 }
2604
2605 pub fn show_connect_to_server(self, show_connect_to_server: bool) -> Self {
2606 Self {
2607 builder: self
2608 .builder
2609 .property("show-connect-to-server", show_connect_to_server),
2610 }
2611 }
2612
2613 pub fn show_desktop(self, show_desktop: bool) -> Self {
2614 Self {
2615 builder: self.builder.property("show-desktop", show_desktop),
2616 }
2617 }
2618
2619 pub fn show_enter_location(self, show_enter_location: bool) -> Self {
2620 Self {
2621 builder: self
2622 .builder
2623 .property("show-enter-location", show_enter_location),
2624 }
2625 }
2626
2627 pub fn show_other_locations(self, show_other_locations: bool) -> Self {
2628 Self {
2629 builder: self
2630 .builder
2631 .property("show-other-locations", show_other_locations),
2632 }
2633 }
2634
2635 pub fn show_recent(self, show_recent: bool) -> Self {
2636 Self {
2637 builder: self.builder.property("show-recent", show_recent),
2638 }
2639 }
2640
2641 pub fn show_starred_location(self, show_starred_location: bool) -> Self {
2642 Self {
2643 builder: self
2644 .builder
2645 .property("show-starred-location", show_starred_location),
2646 }
2647 }
2648
2649 pub fn show_trash(self, show_trash: bool) -> Self {
2650 Self {
2651 builder: self.builder.property("show-trash", show_trash),
2652 }
2653 }
2654
2655 pub fn hadjustment(self, hadjustment: &impl IsA<Adjustment>) -> Self {
2656 Self {
2657 builder: self
2658 .builder
2659 .property("hadjustment", hadjustment.clone().upcast()),
2660 }
2661 }
2662
2663 pub fn hscrollbar_policy(self, hscrollbar_policy: PolicyType) -> Self {
2664 Self {
2665 builder: self
2666 .builder
2667 .property("hscrollbar-policy", hscrollbar_policy),
2668 }
2669 }
2670
2671 /// Whether kinetic scrolling is enabled or not. Kinetic scrolling
2672 /// only applies to devices with source `GDK_SOURCE_TOUCHSCREEN`.
2673 pub fn kinetic_scrolling(self, kinetic_scrolling: bool) -> Self {
2674 Self {
2675 builder: self
2676 .builder
2677 .property("kinetic-scrolling", kinetic_scrolling),
2678 }
2679 }
2680
2681 /// The maximum content height of `scrolled_window`, or -1 if not set.
2682 pub fn max_content_height(self, max_content_height: i32) -> Self {
2683 Self {
2684 builder: self
2685 .builder
2686 .property("max-content-height", max_content_height),
2687 }
2688 }
2689
2690 /// The maximum content width of `scrolled_window`, or -1 if not set.
2691 pub fn max_content_width(self, max_content_width: i32) -> Self {
2692 Self {
2693 builder: self
2694 .builder
2695 .property("max-content-width", max_content_width),
2696 }
2697 }
2698
2699 /// The minimum content height of `scrolled_window`, or -1 if not set.
2700 pub fn min_content_height(self, min_content_height: i32) -> Self {
2701 Self {
2702 builder: self
2703 .builder
2704 .property("min-content-height", min_content_height),
2705 }
2706 }
2707
2708 /// The minimum content width of `scrolled_window`, or -1 if not set.
2709 pub fn min_content_width(self, min_content_width: i32) -> Self {
2710 Self {
2711 builder: self
2712 .builder
2713 .property("min-content-width", min_content_width),
2714 }
2715 }
2716
2717 /// Whether overlay scrolling is enabled or not. If it is, the
2718 /// scrollbars are only added as traditional widgets when a mouse
2719 /// is present. Otherwise, they are overlayed on top of the content,
2720 /// as narrow indicators.
2721 ///
2722 /// Note that overlay scrolling can also be globally disabled, with
2723 /// the [`gtk-overlay-scrolling`][struct@crate::Settings#gtk-overlay-scrolling] setting.
2724 pub fn overlay_scrolling(self, overlay_scrolling: bool) -> Self {
2725 Self {
2726 builder: self
2727 .builder
2728 .property("overlay-scrolling", overlay_scrolling),
2729 }
2730 }
2731
2732 /// Whether the natural height of the child should be calculated and propagated
2733 /// through the scrolled window’s requested natural height.
2734 ///
2735 /// This is useful in cases where an attempt should be made to allocate exactly
2736 /// enough space for the natural size of the child.
2737 pub fn propagate_natural_height(self, propagate_natural_height: bool) -> Self {
2738 Self {
2739 builder: self
2740 .builder
2741 .property("propagate-natural-height", propagate_natural_height),
2742 }
2743 }
2744
2745 /// Whether the natural width of the child should be calculated and propagated
2746 /// through the scrolled window’s requested natural width.
2747 ///
2748 /// This is useful in cases where an attempt should be made to allocate exactly
2749 /// enough space for the natural size of the child.
2750 pub fn propagate_natural_width(self, propagate_natural_width: bool) -> Self {
2751 Self {
2752 builder: self
2753 .builder
2754 .property("propagate-natural-width", propagate_natural_width),
2755 }
2756 }
2757
2758 pub fn shadow_type(self, shadow_type: ShadowType) -> Self {
2759 Self {
2760 builder: self.builder.property("shadow-type", shadow_type),
2761 }
2762 }
2763
2764 pub fn vadjustment(self, vadjustment: &impl IsA<Adjustment>) -> Self {
2765 Self {
2766 builder: self
2767 .builder
2768 .property("vadjustment", vadjustment.clone().upcast()),
2769 }
2770 }
2771
2772 pub fn vscrollbar_policy(self, vscrollbar_policy: PolicyType) -> Self {
2773 Self {
2774 builder: self
2775 .builder
2776 .property("vscrollbar-policy", vscrollbar_policy),
2777 }
2778 }
2779
2780 pub fn window_placement(self, window_placement: CornerType) -> Self {
2781 Self {
2782 builder: self.builder.property("window-placement", window_placement),
2783 }
2784 }
2785
2786 pub fn border_width(self, border_width: u32) -> Self {
2787 Self {
2788 builder: self.builder.property("border-width", border_width),
2789 }
2790 }
2791
2792 pub fn child(self, child: &impl IsA<Widget>) -> Self {
2793 Self {
2794 builder: self.builder.property("child", child.clone().upcast()),
2795 }
2796 }
2797
2798 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
2799 Self {
2800 builder: self.builder.property("resize-mode", resize_mode),
2801 }
2802 }
2803
2804 pub fn app_paintable(self, app_paintable: bool) -> Self {
2805 Self {
2806 builder: self.builder.property("app-paintable", app_paintable),
2807 }
2808 }
2809
2810 pub fn can_default(self, can_default: bool) -> Self {
2811 Self {
2812 builder: self.builder.property("can-default", can_default),
2813 }
2814 }
2815
2816 pub fn can_focus(self, can_focus: bool) -> Self {
2817 Self {
2818 builder: self.builder.property("can-focus", can_focus),
2819 }
2820 }
2821
2822 pub fn events(self, events: gdk::EventMask) -> Self {
2823 Self {
2824 builder: self.builder.property("events", events),
2825 }
2826 }
2827
2828 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
2829 pub fn expand(self, expand: bool) -> Self {
2830 Self {
2831 builder: self.builder.property("expand", expand),
2832 }
2833 }
2834
2835 /// Whether the widget should grab focus when it is clicked with the mouse.
2836 ///
2837 /// This property is only relevant for widgets that can take focus.
2838 ///
2839 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
2840 /// GtkComboBox) implemented this property individually.
2841 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
2842 Self {
2843 builder: self.builder.property("focus-on-click", focus_on_click),
2844 }
2845 }
2846
2847 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
2848 pub fn halign(self, halign: Align) -> Self {
2849 Self {
2850 builder: self.builder.property("halign", halign),
2851 }
2852 }
2853
2854 pub fn has_default(self, has_default: bool) -> Self {
2855 Self {
2856 builder: self.builder.property("has-default", has_default),
2857 }
2858 }
2859
2860 pub fn has_focus(self, has_focus: bool) -> Self {
2861 Self {
2862 builder: self.builder.property("has-focus", has_focus),
2863 }
2864 }
2865
2866 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
2867 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
2868 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
2869 /// whether it will provide a tooltip or not.
2870 ///
2871 /// Note that setting this property to [`true`] for the first time will change
2872 /// the event masks of the GdkWindows of this widget to include leave-notify
2873 /// and motion-notify events. This cannot and will not be undone when the
2874 /// property is set to [`false`] again.
2875 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
2876 Self {
2877 builder: self.builder.property("has-tooltip", has_tooltip),
2878 }
2879 }
2880
2881 pub fn height_request(self, height_request: i32) -> Self {
2882 Self {
2883 builder: self.builder.property("height-request", height_request),
2884 }
2885 }
2886
2887 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
2888 pub fn hexpand(self, hexpand: bool) -> Self {
2889 Self {
2890 builder: self.builder.property("hexpand", hexpand),
2891 }
2892 }
2893
2894 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
2895 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
2896 Self {
2897 builder: self.builder.property("hexpand-set", hexpand_set),
2898 }
2899 }
2900
2901 pub fn is_focus(self, is_focus: bool) -> Self {
2902 Self {
2903 builder: self.builder.property("is-focus", is_focus),
2904 }
2905 }
2906
2907 /// Sets all four sides' margin at once. If read, returns max
2908 /// margin on any side.
2909 pub fn margin(self, margin: i32) -> Self {
2910 Self {
2911 builder: self.builder.property("margin", margin),
2912 }
2913 }
2914
2915 /// Margin on bottom side of widget.
2916 ///
2917 /// This property adds margin outside of the widget's normal size
2918 /// request, the margin will be added in addition to the size from
2919 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2920 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
2921 Self {
2922 builder: self.builder.property("margin-bottom", margin_bottom),
2923 }
2924 }
2925
2926 /// Margin on end of widget, horizontally. This property supports
2927 /// left-to-right and right-to-left text directions.
2928 ///
2929 /// This property adds margin outside of the widget's normal size
2930 /// request, the margin will be added in addition to the size from
2931 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2932 pub fn margin_end(self, margin_end: i32) -> Self {
2933 Self {
2934 builder: self.builder.property("margin-end", margin_end),
2935 }
2936 }
2937
2938 /// Margin on start of widget, horizontally. This property supports
2939 /// left-to-right and right-to-left text directions.
2940 ///
2941 /// This property adds margin outside of the widget's normal size
2942 /// request, the margin will be added in addition to the size from
2943 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2944 pub fn margin_start(self, margin_start: i32) -> Self {
2945 Self {
2946 builder: self.builder.property("margin-start", margin_start),
2947 }
2948 }
2949
2950 /// Margin on top side of widget.
2951 ///
2952 /// This property adds margin outside of the widget's normal size
2953 /// request, the margin will be added in addition to the size from
2954 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2955 pub fn margin_top(self, margin_top: i32) -> Self {
2956 Self {
2957 builder: self.builder.property("margin-top", margin_top),
2958 }
2959 }
2960
2961 pub fn name(self, name: impl Into<glib::GString>) -> Self {
2962 Self {
2963 builder: self.builder.property("name", name.into()),
2964 }
2965 }
2966
2967 pub fn no_show_all(self, no_show_all: bool) -> Self {
2968 Self {
2969 builder: self.builder.property("no-show-all", no_show_all),
2970 }
2971 }
2972
2973 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
2974 /// more details about window opacity.
2975 ///
2976 /// Before 3.8 this was only available in GtkWindow
2977 pub fn opacity(self, opacity: f64) -> Self {
2978 Self {
2979 builder: self.builder.property("opacity", opacity),
2980 }
2981 }
2982
2983 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
2984 Self {
2985 builder: self.builder.property("parent", parent.clone().upcast()),
2986 }
2987 }
2988
2989 pub fn receives_default(self, receives_default: bool) -> Self {
2990 Self {
2991 builder: self.builder.property("receives-default", receives_default),
2992 }
2993 }
2994
2995 pub fn sensitive(self, sensitive: bool) -> Self {
2996 Self {
2997 builder: self.builder.property("sensitive", sensitive),
2998 }
2999 }
3000
3001 /// Sets the text of tooltip to be the given string, which is marked up
3002 /// with the [Pango text markup language][PangoMarkupFormat].
3003 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
3004 ///
3005 /// This is a convenience property which will take care of getting the
3006 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
3007 /// will automatically be set to [`true`] and there will be taken care of
3008 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
3009 ///
3010 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
3011 /// are set, the last one wins.
3012 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
3013 Self {
3014 builder: self
3015 .builder
3016 .property("tooltip-markup", tooltip_markup.into()),
3017 }
3018 }
3019
3020 /// Sets the text of tooltip to be the given string.
3021 ///
3022 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
3023 ///
3024 /// This is a convenience property which will take care of getting the
3025 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
3026 /// will automatically be set to [`true`] and there will be taken care of
3027 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
3028 ///
3029 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
3030 /// are set, the last one wins.
3031 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
3032 Self {
3033 builder: self.builder.property("tooltip-text", tooltip_text.into()),
3034 }
3035 }
3036
3037 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
3038 pub fn valign(self, valign: Align) -> Self {
3039 Self {
3040 builder: self.builder.property("valign", valign),
3041 }
3042 }
3043
3044 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
3045 pub fn vexpand(self, vexpand: bool) -> Self {
3046 Self {
3047 builder: self.builder.property("vexpand", vexpand),
3048 }
3049 }
3050
3051 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
3052 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
3053 Self {
3054 builder: self.builder.property("vexpand-set", vexpand_set),
3055 }
3056 }
3057
3058 pub fn visible(self, visible: bool) -> Self {
3059 Self {
3060 builder: self.builder.property("visible", visible),
3061 }
3062 }
3063
3064 pub fn width_request(self, width_request: i32) -> Self {
3065 Self {
3066 builder: self.builder.property("width-request", width_request),
3067 }
3068 }
3069
3070 // rustdoc-stripper-ignore-next
3071 /// Build the [`PlacesSidebar`].
3072 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
3073 pub fn build(self) -> PlacesSidebar {
3074 assert_initialized_main_thread!();
3075 self.builder.build()
3076 }
3077}