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