gtk4/auto/app_chooser_dialog.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#![allow(deprecated)]
5
6#[cfg(feature = "v4_10")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
8use crate::Accessible;
9use crate::{
10 AppChooser, Buildable, ConstraintTarget, Dialog, DialogFlags, Native, Root, ShortcutManager,
11 Widget, Window, ffi,
12};
13use glib::{
14 prelude::*,
15 signal::{SignalHandlerId, connect_raw},
16 translate::*,
17};
18use std::boxed::Box as Box_;
19
20#[cfg(feature = "v4_10")]
21#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
22glib::wrapper! {
23 /// The application selection widgets should be
24 /// implemented according to the design of each platform and/or
25 /// application requiring them.
26 /// [`AppChooserDialog`][crate::AppChooserDialog] shows a [`AppChooserWidget`][crate::AppChooserWidget] inside a [`Dialog`][crate::Dialog].
27 ///
28 /// <picture>
29 /// <source srcset="appchooserdialog-dark.png" media="(prefers-color-scheme: dark)">
30 /// <img alt="An example GtkAppChooserDialog" src="appchooserdialog.png">
31 /// </picture>
32 ///
33 /// Note that [`AppChooserDialog`][crate::AppChooserDialog] does not have any interesting methods
34 /// of its own. Instead, you should get the embedded [`AppChooserWidget`][crate::AppChooserWidget]
35 /// using [`widget()`][Self::widget()] and call its methods if
36 /// the generic [`AppChooser`][crate::AppChooser] interface is not sufficient for
37 /// your needs.
38 ///
39 /// To set the heading that is shown above the [`AppChooserWidget`][crate::AppChooserWidget],
40 /// use [`set_heading()`][Self::set_heading()].
41 ///
42 /// ## CSS nodes
43 ///
44 /// [`AppChooserDialog`][crate::AppChooserDialog] has a single CSS node with the name `window` and style
45 /// class `.appchooser`.
46 ///
47 /// ## Properties
48 ///
49 ///
50 /// #### `gfile`
51 /// The GFile used by the [`AppChooserDialog`][crate::AppChooserDialog].
52 ///
53 /// The dialog's [`AppChooserWidget`][crate::AppChooserWidget] content type will
54 /// be guessed from the file, if present.
55 ///
56 /// Readable | Writable | Construct Only
57 ///
58 ///
59 /// #### `heading`
60 /// The text to show at the top of the dialog.
61 ///
62 /// The string may contain Pango markup.
63 ///
64 /// Readable | Writable
65 /// <details><summary><h4>Dialog</h4></summary>
66 ///
67 ///
68 /// #### `use-header-bar`
69 /// [`true`] if the dialog uses a headerbar for action buttons
70 /// instead of the action-area.
71 ///
72 /// For technical reasons, this property is declared as an integer
73 /// property, but you should only set it to [`true`] or [`false`].
74 ///
75 /// ## Creating a dialog with headerbar
76 ///
77 /// Builtin [`Dialog`][crate::Dialog] subclasses such as [`ColorChooserDialog`][crate::ColorChooserDialog]
78 /// set this property according to platform conventions (using the
79 /// [`gtk-dialogs-use-header`][struct@crate::Settings#gtk-dialogs-use-header] setting).
80 ///
81 /// Here is how you can achieve the same:
82 ///
83 /// **⚠️ The following code is in c ⚠️**
84 ///
85 /// ```c
86 /// g_object_get (settings, "gtk-dialogs-use-header", &header, NULL);
87 /// dialog = g_object_new (GTK_TYPE_DIALOG, header, TRUE, NULL);
88 /// ```
89 ///
90 /// Readable | Writable | Construct Only
91 /// </details>
92 /// <details><summary><h4>Window</h4></summary>
93 ///
94 ///
95 /// #### `application`
96 /// The [`Application`][crate::Application] associated with the window.
97 ///
98 /// The application will be kept alive for at least as long as it
99 /// has any windows associated with it (see g_application_hold()
100 /// for a way to keep it alive without windows).
101 ///
102 /// Normally, the connection between the application and the window
103 /// will remain until the window is destroyed, but you can explicitly
104 /// remove it by setting the this property to `NULL`.
105 ///
106 /// Readable | Writable
107 ///
108 ///
109 /// #### `child`
110 /// The child widget.
111 ///
112 /// Readable | Writable
113 ///
114 ///
115 /// #### `decorated`
116 /// Whether the window should have a frame (also known as *decorations*).
117 ///
118 /// Readable | Writable
119 ///
120 ///
121 /// #### `default-height`
122 /// The default height of the window.
123 ///
124 /// Readable | Writable
125 ///
126 ///
127 /// #### `default-widget`
128 /// The default widget.
129 ///
130 /// Readable | Writable
131 ///
132 ///
133 /// #### `default-width`
134 /// The default width of the window.
135 ///
136 /// Readable | Writable
137 ///
138 ///
139 /// #### `deletable`
140 /// Whether the window frame should have a close button.
141 ///
142 /// Readable | Writable
143 ///
144 ///
145 /// #### `destroy-with-parent`
146 /// If this window should be destroyed when the parent is destroyed.
147 ///
148 /// Readable | Writable
149 ///
150 ///
151 /// #### `display`
152 /// The display that will display this window.
153 ///
154 /// Readable | Writable
155 ///
156 ///
157 /// #### `focus-visible`
158 /// Whether 'focus rectangles' are currently visible in this window.
159 ///
160 /// This property is maintained by GTK based on user input
161 /// and should not be set by applications.
162 ///
163 /// Readable | Writable
164 ///
165 ///
166 /// #### `focus-widget`
167 /// The focus widget.
168 ///
169 /// Readable | Writable
170 ///
171 ///
172 /// #### `fullscreened`
173 /// Whether the window is fullscreen.
174 ///
175 /// Setting this property is the equivalent of calling
176 /// [`GtkWindowExt::fullscreen()`][crate::prelude::GtkWindowExt::fullscreen()] or [`GtkWindowExt::unfullscreen()`][crate::prelude::GtkWindowExt::unfullscreen()];
177 /// either operation is asynchronous, which means you will need to
178 /// connect to the ::notify signal in order to know whether the
179 /// operation was successful.
180 ///
181 /// Readable | Writable
182 ///
183 ///
184 /// #### `gravity`
185 /// The gravity to use when resizing the window programmatically.
186 ///
187 /// Gravity describes which point of the window we want to keep
188 /// fixed (meaning that the window will grow in the opposite direction).
189 /// For example, a gravity of `GTK_WINDOW_GRAVITY_TOP_RIGHT` means that we
190 /// want the to fix top right corner of the window.
191 ///
192 /// Readable | Writable
193 ///
194 ///
195 /// #### `handle-menubar-accel`
196 /// Whether the window frame should handle <kbd>F10</kbd> for activating
197 /// menubars.
198 ///
199 /// Readable | Writable
200 ///
201 ///
202 /// #### `hide-on-close`
203 /// If this window should be hidden instead of destroyed when the user clicks
204 /// the close button.
205 ///
206 /// Readable | Writable
207 ///
208 ///
209 /// #### `icon-name`
210 /// Specifies the name of the themed icon to use as the window icon.
211 ///
212 /// See [`IconTheme`][crate::IconTheme] for more details.
213 ///
214 /// Readable | Writable
215 ///
216 ///
217 /// #### `is-active`
218 /// Whether the toplevel is the currently active window.
219 ///
220 /// Readable
221 ///
222 ///
223 /// #### `maximized`
224 /// Whether the window is maximized.
225 ///
226 /// Setting this property is the equivalent of calling
227 /// [`GtkWindowExt::maximize()`][crate::prelude::GtkWindowExt::maximize()] or [`GtkWindowExt::unmaximize()`][crate::prelude::GtkWindowExt::unmaximize()];
228 /// either operation is asynchronous, which means you will need to
229 /// connect to the ::notify signal in order to know whether the
230 /// operation was successful.
231 ///
232 /// Readable | Writable
233 ///
234 ///
235 /// #### `mnemonics-visible`
236 /// Whether mnemonics are currently visible in this window.
237 ///
238 /// This property is maintained by GTK based on user input,
239 /// and should not be set by applications.
240 ///
241 /// Readable | Writable
242 ///
243 ///
244 /// #### `modal`
245 /// If true, the window is modal.
246 ///
247 /// Readable | Writable
248 ///
249 ///
250 /// #### `resizable`
251 /// If true, users can resize the window.
252 ///
253 /// Readable | Writable
254 ///
255 ///
256 /// #### `startup-id`
257 /// A write-only property for setting window's startup notification identifier.
258 ///
259 /// Writable
260 ///
261 ///
262 /// #### `suspended`
263 /// Whether the window is suspended.
264 ///
265 /// See [`GtkWindowExt::is_suspended()`][crate::prelude::GtkWindowExt::is_suspended()] for details about what suspended means.
266 ///
267 /// Readable
268 ///
269 ///
270 /// #### `title`
271 /// The title of the window.
272 ///
273 /// Readable | Writable
274 ///
275 ///
276 /// #### `titlebar`
277 /// The titlebar widget.
278 ///
279 /// Readable | Writable
280 ///
281 ///
282 /// #### `transient-for`
283 /// The transient parent of the window.
284 ///
285 /// Readable | Writable | Construct
286 /// </details>
287 /// <details><summary><h4>Widget</h4></summary>
288 ///
289 ///
290 /// #### `can-focus`
291 /// Whether the widget or any of its descendents can accept
292 /// the input focus.
293 ///
294 /// This property is meant to be set by widget implementations,
295 /// typically in their instance init function.
296 ///
297 /// Readable | Writable
298 ///
299 ///
300 /// #### `can-target`
301 /// Whether the widget can receive pointer events.
302 ///
303 /// Readable | Writable
304 ///
305 ///
306 /// #### `css-classes`
307 /// A list of css classes applied to this widget.
308 ///
309 /// Readable | Writable
310 ///
311 ///
312 /// #### `css-name`
313 /// The name of this widget in the CSS tree.
314 ///
315 /// This property is meant to be set by widget implementations,
316 /// typically in their instance init function.
317 ///
318 /// Readable | Writable | Construct Only
319 ///
320 ///
321 /// #### `cursor`
322 /// The cursor used by @widget.
323 ///
324 /// Readable | Writable
325 ///
326 ///
327 /// #### `focus-on-click`
328 /// Whether the widget should grab focus when it is clicked with the mouse.
329 ///
330 /// This property is only relevant for widgets that can take focus.
331 ///
332 /// Readable | Writable
333 ///
334 ///
335 /// #### `focusable`
336 /// Whether this widget itself will accept the input focus.
337 ///
338 /// Readable | Writable
339 ///
340 ///
341 /// #### `halign`
342 /// How to distribute horizontal space if widget gets extra space.
343 ///
344 /// Readable | Writable
345 ///
346 ///
347 /// #### `has-default`
348 /// Whether the widget is the default widget.
349 ///
350 /// Readable
351 ///
352 ///
353 /// #### `has-focus`
354 /// Whether the widget has the input focus.
355 ///
356 /// Readable
357 ///
358 ///
359 /// #### `has-tooltip`
360 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
361 /// signal on @widget.
362 ///
363 /// A true value indicates that @widget can have a tooltip, in this case
364 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
365 /// determine whether it will provide a tooltip or not.
366 ///
367 /// Readable | Writable
368 ///
369 ///
370 /// #### `height-request`
371 /// Overrides for height request of the widget.
372 ///
373 /// If this is -1, the natural request will be used.
374 ///
375 /// Readable | Writable
376 ///
377 ///
378 /// #### `hexpand`
379 /// Whether to expand horizontally.
380 ///
381 /// Readable | Writable
382 ///
383 ///
384 /// #### `hexpand-set`
385 /// Whether to use the `hexpand` property.
386 ///
387 /// Readable | Writable
388 ///
389 ///
390 /// #### `layout-manager`
391 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
392 /// the preferred size of the widget, and allocate its children.
393 ///
394 /// This property is meant to be set by widget implementations,
395 /// typically in their instance init function.
396 ///
397 /// Readable | Writable
398 ///
399 ///
400 /// #### `limit-events`
401 /// Makes this widget act like a modal dialog, with respect to
402 /// event delivery.
403 ///
404 /// Global event controllers will not handle events with targets
405 /// inside the widget, unless they are set up to ignore propagation
406 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
407 ///
408 /// Readable | Writable
409 ///
410 ///
411 /// #### `margin-bottom`
412 /// Margin on bottom side of widget.
413 ///
414 /// This property adds margin outside of the widget's normal size
415 /// request, the margin will be added in addition to the size from
416 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
417 ///
418 /// Readable | Writable
419 ///
420 ///
421 /// #### `margin-end`
422 /// Margin on end of widget, horizontally.
423 ///
424 /// This property supports left-to-right and right-to-left text
425 /// directions.
426 ///
427 /// This property adds margin outside of the widget's normal size
428 /// request, the margin will be added in addition to the size from
429 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
430 ///
431 /// Readable | Writable
432 ///
433 ///
434 /// #### `margin-start`
435 /// Margin on start of widget, horizontally.
436 ///
437 /// This property supports left-to-right and right-to-left text
438 /// directions.
439 ///
440 /// This property adds margin outside of the widget's normal size
441 /// request, the margin will be added in addition to the size from
442 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
443 ///
444 /// Readable | Writable
445 ///
446 ///
447 /// #### `margin-top`
448 /// Margin on top side of widget.
449 ///
450 /// This property adds margin outside of the widget's normal size
451 /// request, the margin will be added in addition to the size from
452 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
453 ///
454 /// Readable | Writable
455 ///
456 ///
457 /// #### `name`
458 /// The name of the widget.
459 ///
460 /// Readable | Writable
461 ///
462 ///
463 /// #### `opacity`
464 /// The requested opacity of the widget.
465 ///
466 /// Readable | Writable
467 ///
468 ///
469 /// #### `overflow`
470 /// How content outside the widget's content area is treated.
471 ///
472 /// This property is meant to be set by widget implementations,
473 /// typically in their instance init function.
474 ///
475 /// Readable | Writable
476 ///
477 ///
478 /// #### `parent`
479 /// The parent widget of this widget.
480 ///
481 /// Readable
482 ///
483 ///
484 /// #### `receives-default`
485 /// Whether the widget will receive the default action when it is focused.
486 ///
487 /// Readable | Writable
488 ///
489 ///
490 /// #### `root`
491 /// The [`Root`][crate::Root] widget of the widget tree containing this widget.
492 ///
493 /// This will be `NULL` if the widget is not contained in a root widget.
494 ///
495 /// Readable
496 ///
497 ///
498 /// #### `scale-factor`
499 /// The scale factor of the widget.
500 ///
501 /// Readable
502 ///
503 ///
504 /// #### `sensitive`
505 /// Whether the widget responds to input.
506 ///
507 /// Readable | Writable
508 ///
509 ///
510 /// #### `tooltip-markup`
511 /// Sets the text of tooltip to be the given string, which is marked up
512 /// with Pango markup.
513 ///
514 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
515 ///
516 /// This is a convenience property which will take care of getting the
517 /// tooltip shown if the given string is not `NULL`:
518 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
519 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
520 /// the default signal handler.
521 ///
522 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
523 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
524 ///
525 /// Readable | Writable
526 ///
527 ///
528 /// #### `tooltip-text`
529 /// Sets the text of tooltip to be the given string.
530 ///
531 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
532 ///
533 /// This is a convenience property which will take care of getting the
534 /// tooltip shown if the given string is not `NULL`:
535 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
536 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
537 /// the default signal handler.
538 ///
539 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
540 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
541 ///
542 /// Readable | Writable
543 ///
544 ///
545 /// #### `valign`
546 /// How to distribute vertical space if widget gets extra space.
547 ///
548 /// Readable | Writable
549 ///
550 ///
551 /// #### `vexpand`
552 /// Whether to expand vertically.
553 ///
554 /// Readable | Writable
555 ///
556 ///
557 /// #### `vexpand-set`
558 /// Whether to use the `vexpand` property.
559 ///
560 /// Readable | Writable
561 ///
562 ///
563 /// #### `visible`
564 /// Whether the widget is visible.
565 ///
566 /// Readable | Writable
567 ///
568 ///
569 /// #### `width-request`
570 /// Overrides for width request of the widget.
571 ///
572 /// If this is -1, the natural request will be used.
573 ///
574 /// Readable | Writable
575 /// </details>
576 /// <details><summary><h4>Accessible</h4></summary>
577 ///
578 ///
579 /// #### `accessible-role`
580 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
581 ///
582 /// The accessible role cannot be changed once set.
583 ///
584 /// Readable | Writable
585 /// </details>
586 /// <details><summary><h4>AppChooser</h4></summary>
587 ///
588 ///
589 /// #### `content-type`
590 /// The content type of the [`AppChooser`][crate::AppChooser] object.
591 ///
592 /// See `GContentType` for more information about content types.
593 ///
594 /// Readable | Writable | Construct Only
595 /// </details>
596 ///
597 /// # Implements
598 ///
599 /// [`DialogExt`][trait@crate::prelude::DialogExt], [`GtkWindowExt`][trait@crate::prelude::GtkWindowExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`NativeExt`][trait@crate::prelude::NativeExt], [`RootExt`][trait@crate::prelude::RootExt], [`ShortcutManagerExt`][trait@crate::prelude::ShortcutManagerExt], [`AppChooserExt`][trait@crate::prelude::AppChooserExt], [`DialogExtManual`][trait@crate::prelude::DialogExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
600 #[doc(alias = "GtkAppChooserDialog")]
601 pub struct AppChooserDialog(Object<ffi::GtkAppChooserDialog>) @extends Dialog, Window, Widget, @implements Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager, AppChooser;
602
603 match fn {
604 type_ => || ffi::gtk_app_chooser_dialog_get_type(),
605 }
606}
607
608#[cfg(not(feature = "v4_10"))]
609glib::wrapper! {
610 #[doc(alias = "GtkAppChooserDialog")]
611 pub struct AppChooserDialog(Object<ffi::GtkAppChooserDialog>) @extends Dialog, Window, Widget, @implements Buildable, ConstraintTarget, Native, Root, ShortcutManager, AppChooser;
612
613 match fn {
614 type_ => || ffi::gtk_app_chooser_dialog_get_type(),
615 }
616}
617
618impl AppChooserDialog {
619 /// Creates a new [`AppChooserDialog`][crate::AppChooserDialog] for the provided `GFile`.
620 ///
621 /// The dialog will show applications that can open the file.
622 ///
623 /// # Deprecated since 4.10
624 ///
625 /// This widget will be removed in GTK 5
626 /// ## `parent`
627 /// a [`Window`][crate::Window]
628 /// ## `flags`
629 /// flags for this dialog
630 /// ## `file`
631 /// a `GFile`
632 ///
633 /// # Returns
634 ///
635 /// a newly created [`AppChooserDialog`][crate::AppChooserDialog]
636 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
637 #[allow(deprecated)]
638 #[doc(alias = "gtk_app_chooser_dialog_new")]
639 pub fn new(
640 parent: Option<&impl IsA<Window>>,
641 flags: DialogFlags,
642 file: &impl IsA<gio::File>,
643 ) -> AppChooserDialog {
644 assert_initialized_main_thread!();
645 unsafe {
646 Widget::from_glib_none(ffi::gtk_app_chooser_dialog_new(
647 parent.map(|p| p.as_ref()).to_glib_none().0,
648 flags.into_glib(),
649 file.as_ref().to_glib_none().0,
650 ))
651 .unsafe_cast()
652 }
653 }
654
655 /// Creates a new [`AppChooserDialog`][crate::AppChooserDialog] for the provided content type.
656 ///
657 /// The dialog will show applications that can open the content type.
658 ///
659 /// # Deprecated since 4.10
660 ///
661 /// This widget will be removed in GTK 5
662 /// ## `parent`
663 /// a [`Window`][crate::Window]
664 /// ## `flags`
665 /// flags for this dialog
666 /// ## `content_type`
667 /// a content type string
668 ///
669 /// # Returns
670 ///
671 /// a newly created [`AppChooserDialog`][crate::AppChooserDialog]
672 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
673 #[allow(deprecated)]
674 #[doc(alias = "gtk_app_chooser_dialog_new_for_content_type")]
675 #[doc(alias = "new_for_content_type")]
676 pub fn for_content_type(
677 parent: Option<&impl IsA<Window>>,
678 flags: DialogFlags,
679 content_type: &str,
680 ) -> AppChooserDialog {
681 assert_initialized_main_thread!();
682 unsafe {
683 Widget::from_glib_none(ffi::gtk_app_chooser_dialog_new_for_content_type(
684 parent.map(|p| p.as_ref()).to_glib_none().0,
685 flags.into_glib(),
686 content_type.to_glib_none().0,
687 ))
688 .unsafe_cast()
689 }
690 }
691
692 /// Returns the text to display at the top of the dialog.
693 ///
694 /// # Deprecated since 4.10
695 ///
696 /// This widget will be removed in GTK 5
697 ///
698 /// # Returns
699 ///
700 /// the text to display at the top of the dialog,
701 /// or [`None`], in which case a default text is displayed
702 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
703 #[allow(deprecated)]
704 #[doc(alias = "gtk_app_chooser_dialog_get_heading")]
705 #[doc(alias = "get_heading")]
706 pub fn heading(&self) -> Option<glib::GString> {
707 unsafe {
708 from_glib_none(ffi::gtk_app_chooser_dialog_get_heading(
709 self.to_glib_none().0,
710 ))
711 }
712 }
713
714 /// Returns the [`AppChooserWidget`][crate::AppChooserWidget] of this dialog.
715 ///
716 /// # Deprecated since 4.10
717 ///
718 /// This widget will be removed in GTK 5
719 ///
720 /// # Returns
721 ///
722 /// the [`AppChooserWidget`][crate::AppChooserWidget] of @self
723 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
724 #[allow(deprecated)]
725 #[doc(alias = "gtk_app_chooser_dialog_get_widget")]
726 #[doc(alias = "get_widget")]
727 pub fn widget(&self) -> Widget {
728 unsafe {
729 from_glib_none(ffi::gtk_app_chooser_dialog_get_widget(
730 self.to_glib_none().0,
731 ))
732 }
733 }
734
735 /// Sets the text to display at the top of the dialog.
736 ///
737 /// If the heading is not set, the dialog displays a default text.
738 ///
739 /// # Deprecated since 4.10
740 ///
741 /// This widget will be removed in GTK 5
742 /// ## `heading`
743 /// a string containing Pango markup
744 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
745 #[allow(deprecated)]
746 #[doc(alias = "gtk_app_chooser_dialog_set_heading")]
747 #[doc(alias = "heading")]
748 pub fn set_heading(&self, heading: &str) {
749 unsafe {
750 ffi::gtk_app_chooser_dialog_set_heading(
751 self.to_glib_none().0,
752 heading.to_glib_none().0,
753 );
754 }
755 }
756
757 /// The GFile used by the [`AppChooserDialog`][crate::AppChooserDialog].
758 ///
759 /// The dialog's [`AppChooserWidget`][crate::AppChooserWidget] content type will
760 /// be guessed from the file, if present.
761 pub fn gfile(&self) -> Option<gio::File> {
762 ObjectExt::property(self, "gfile")
763 }
764
765 #[doc(alias = "heading")]
766 pub fn connect_heading_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
767 unsafe extern "C" fn notify_heading_trampoline<F: Fn(&AppChooserDialog) + 'static>(
768 this: *mut ffi::GtkAppChooserDialog,
769 _param_spec: glib::ffi::gpointer,
770 f: glib::ffi::gpointer,
771 ) {
772 unsafe {
773 let f: &F = &*(f as *const F);
774 f(&from_glib_borrow(this))
775 }
776 }
777 unsafe {
778 let f: Box_<F> = Box_::new(f);
779 connect_raw(
780 self.as_ptr() as *mut _,
781 c"notify::heading".as_ptr(),
782 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
783 notify_heading_trampoline::<F> as *const (),
784 )),
785 Box_::into_raw(f),
786 )
787 }
788 }
789}