Skip to main content

gtk4/auto/
app_chooser_widget.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4#![allow(deprecated)]
5
6#[cfg(feature = "v4_10")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
8use crate::Accessible;
9use crate::{
10    AccessibleRole, Align, AppChooser, Buildable, ConstraintTarget, LayoutManager, Overflow,
11    Widget, ffi,
12};
13use glib::{
14    object::ObjectType as _,
15    prelude::*,
16    signal::{SignalHandlerId, connect_raw},
17    translate::*,
18};
19use std::boxed::Box as Box_;
20
21#[cfg(feature = "v4_10")]
22#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
23glib::wrapper! {
24    /// The application selection widgets should be
25    ///   implemented according to the design of each platform and/or
26    ///   application requiring them.
27    /// [`AppChooserWidget`][crate::AppChooserWidget] is a widget for selecting applications.
28    ///
29    /// It is the main building block for [`AppChooserDialog`][crate::AppChooserDialog].
30    /// Most applications only need to use the latter; but you can use
31    /// this widget as part of a larger widget if you have special needs.
32    ///
33    /// [`AppChooserWidget`][crate::AppChooserWidget] offers detailed control over what applications
34    /// are shown, using the
35    /// [`show-default`][struct@crate::AppChooserWidget#show-default],
36    /// [`show-recommended`][struct@crate::AppChooserWidget#show-recommended],
37    /// [`show-fallback`][struct@crate::AppChooserWidget#show-fallback],
38    /// [`show-other`][struct@crate::AppChooserWidget#show-other] and
39    /// [`show-all`][struct@crate::AppChooserWidget#show-all] properties. See the
40    /// [`AppChooser`][crate::AppChooser] documentation for more information about these
41    /// groups of applications.
42    ///
43    /// To keep track of the selected application, use the
44    /// [`application-selected`][struct@crate::AppChooserWidget#application-selected] and
45    /// [`application-activated`][struct@crate::AppChooserWidget#application-activated] signals.
46    ///
47    /// ## CSS nodes
48    ///
49    /// [`AppChooserWidget`][crate::AppChooserWidget] has a single CSS node with name appchooser.
50    ///
51    /// ## Properties
52    ///
53    ///
54    /// #### `default-text`
55    ///  The text that appears in the widget when there are no applications
56    /// for the given content type.
57    ///
58    /// Readable | Writable
59    ///
60    ///
61    /// #### `show-all`
62    ///  If [`true`], the app chooser presents all applications
63    /// in a single list, without subsections for default,
64    /// recommended or related applications.
65    ///
66    /// Readable | Writable | Construct
67    ///
68    ///
69    /// #### `show-default`
70    ///  Determines whether the app chooser should show the default
71    /// handler for the content type in a separate section.
72    ///
73    /// If [`false`], the default handler is listed among the recommended
74    /// applications.
75    ///
76    /// Readable | Writable | Construct
77    ///
78    ///
79    /// #### `show-fallback`
80    ///  Determines whether the app chooser should show a section
81    /// for fallback applications.
82    ///
83    /// If [`false`], the fallback applications are listed among the
84    /// other applications.
85    ///
86    /// Readable | Writable | Construct
87    ///
88    ///
89    /// #### `show-other`
90    ///  Determines whether the app chooser should show a section
91    /// for other applications.
92    ///
93    /// Readable | Writable | Construct
94    ///
95    ///
96    /// #### `show-recommended`
97    ///  Determines whether the app chooser should show a section
98    /// for recommended applications.
99    ///
100    /// If [`false`], the recommended applications are listed
101    /// among the other applications.
102    ///
103    /// Readable | Writable | Construct
104    /// <details><summary><h4>Widget</h4></summary>
105    ///
106    ///
107    /// #### `can-focus`
108    ///  Whether the widget or any of its descendents can accept
109    /// the input focus.
110    ///
111    /// This property is meant to be set by widget implementations,
112    /// typically in their instance init function.
113    ///
114    /// Readable | Writable
115    ///
116    ///
117    /// #### `can-target`
118    ///  Whether the widget can receive pointer events.
119    ///
120    /// Readable | Writable
121    ///
122    ///
123    /// #### `css-classes`
124    ///  A list of css classes applied to this widget.
125    ///
126    /// Readable | Writable
127    ///
128    ///
129    /// #### `css-name`
130    ///  The name of this widget in the CSS tree.
131    ///
132    /// This property is meant to be set by widget implementations,
133    /// typically in their instance init function.
134    ///
135    /// Readable | Writable | Construct Only
136    ///
137    ///
138    /// #### `cursor`
139    ///  The cursor used by @widget.
140    ///
141    /// Readable | Writable
142    ///
143    ///
144    /// #### `focus-on-click`
145    ///  Whether the widget should grab focus when it is clicked with the mouse.
146    ///
147    /// This property is only relevant for widgets that can take focus.
148    ///
149    /// Readable | Writable
150    ///
151    ///
152    /// #### `focusable`
153    ///  Whether this widget itself will accept the input focus.
154    ///
155    /// Readable | Writable
156    ///
157    ///
158    /// #### `halign`
159    ///  How to distribute horizontal space if widget gets extra space.
160    ///
161    /// Readable | Writable
162    ///
163    ///
164    /// #### `has-default`
165    ///  Whether the widget is the default widget.
166    ///
167    /// Readable
168    ///
169    ///
170    /// #### `has-focus`
171    ///  Whether the widget has the input focus.
172    ///
173    /// Readable
174    ///
175    ///
176    /// #### `has-tooltip`
177    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
178    /// signal on @widget.
179    ///
180    /// A true value indicates that @widget can have a tooltip, in this case
181    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
182    /// determine whether it will provide a tooltip or not.
183    ///
184    /// Readable | Writable
185    ///
186    ///
187    /// #### `height-request`
188    ///  Overrides for height request of the widget.
189    ///
190    /// If this is -1, the natural request will be used.
191    ///
192    /// Readable | Writable
193    ///
194    ///
195    /// #### `hexpand`
196    ///  Whether to expand horizontally.
197    ///
198    /// Readable | Writable
199    ///
200    ///
201    /// #### `hexpand-set`
202    ///  Whether to use the `hexpand` property.
203    ///
204    /// Readable | Writable
205    ///
206    ///
207    /// #### `layout-manager`
208    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
209    /// the preferred size of the widget, and allocate its children.
210    ///
211    /// This property is meant to be set by widget implementations,
212    /// typically in their instance init function.
213    ///
214    /// Readable | Writable
215    ///
216    ///
217    /// #### `limit-events`
218    ///  Makes this widget act like a modal dialog, with respect to
219    /// event delivery.
220    ///
221    /// Global event controllers will not handle events with targets
222    /// inside the widget, unless they are set up to ignore propagation
223    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
224    ///
225    /// Readable | Writable
226    ///
227    ///
228    /// #### `margin-bottom`
229    ///  Margin on bottom side of widget.
230    ///
231    /// This property adds margin outside of the widget's normal size
232    /// request, the margin will be added in addition to the size from
233    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
234    ///
235    /// Readable | Writable
236    ///
237    ///
238    /// #### `margin-end`
239    ///  Margin on end of widget, horizontally.
240    ///
241    /// This property supports left-to-right and right-to-left text
242    /// directions.
243    ///
244    /// This property adds margin outside of the widget's normal size
245    /// request, the margin will be added in addition to the size from
246    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
247    ///
248    /// Readable | Writable
249    ///
250    ///
251    /// #### `margin-start`
252    ///  Margin on start of widget, horizontally.
253    ///
254    /// This property supports left-to-right and right-to-left text
255    /// directions.
256    ///
257    /// This property adds margin outside of the widget's normal size
258    /// request, the margin will be added in addition to the size from
259    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
260    ///
261    /// Readable | Writable
262    ///
263    ///
264    /// #### `margin-top`
265    ///  Margin on top side of widget.
266    ///
267    /// This property adds margin outside of the widget's normal size
268    /// request, the margin will be added in addition to the size from
269    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
270    ///
271    /// Readable | Writable
272    ///
273    ///
274    /// #### `name`
275    ///  The name of the widget.
276    ///
277    /// Readable | Writable
278    ///
279    ///
280    /// #### `opacity`
281    ///  The requested opacity of the widget.
282    ///
283    /// Readable | Writable
284    ///
285    ///
286    /// #### `overflow`
287    ///  How content outside the widget's content area is treated.
288    ///
289    /// This property is meant to be set by widget implementations,
290    /// typically in their instance init function.
291    ///
292    /// Readable | Writable
293    ///
294    ///
295    /// #### `parent`
296    ///  The parent widget of this widget.
297    ///
298    /// Readable
299    ///
300    ///
301    /// #### `receives-default`
302    ///  Whether the widget will receive the default action when it is focused.
303    ///
304    /// Readable | Writable
305    ///
306    ///
307    /// #### `root`
308    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
309    ///
310    /// This will be `NULL` if the widget is not contained in a root widget.
311    ///
312    /// Readable
313    ///
314    ///
315    /// #### `scale-factor`
316    ///  The scale factor of the widget.
317    ///
318    /// Readable
319    ///
320    ///
321    /// #### `sensitive`
322    ///  Whether the widget responds to input.
323    ///
324    /// Readable | Writable
325    ///
326    ///
327    /// #### `tooltip-markup`
328    ///  Sets the text of tooltip to be the given string, which is marked up
329    /// with Pango markup.
330    ///
331    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
332    ///
333    /// This is a convenience property which will take care of getting the
334    /// tooltip shown if the given string is not `NULL`:
335    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
336    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
337    /// the default signal handler.
338    ///
339    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
340    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
341    ///
342    /// Readable | Writable
343    ///
344    ///
345    /// #### `tooltip-text`
346    ///  Sets the text of tooltip to be the given string.
347    ///
348    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
349    ///
350    /// This is a convenience property which will take care of getting the
351    /// tooltip shown if the given string is not `NULL`:
352    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
353    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
354    /// the default signal handler.
355    ///
356    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
357    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
358    ///
359    /// Readable | Writable
360    ///
361    ///
362    /// #### `valign`
363    ///  How to distribute vertical space if widget gets extra space.
364    ///
365    /// Readable | Writable
366    ///
367    ///
368    /// #### `vexpand`
369    ///  Whether to expand vertically.
370    ///
371    /// Readable | Writable
372    ///
373    ///
374    /// #### `vexpand-set`
375    ///  Whether to use the `vexpand` property.
376    ///
377    /// Readable | Writable
378    ///
379    ///
380    /// #### `visible`
381    ///  Whether the widget is visible.
382    ///
383    /// Readable | Writable
384    ///
385    ///
386    /// #### `width-request`
387    ///  Overrides for width request of the widget.
388    ///
389    /// If this is -1, the natural request will be used.
390    ///
391    /// Readable | Writable
392    /// </details>
393    /// <details><summary><h4>Accessible</h4></summary>
394    ///
395    ///
396    /// #### `accessible-role`
397    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
398    ///
399    /// The accessible role cannot be changed once set.
400    ///
401    /// Readable | Writable
402    /// </details>
403    /// <details><summary><h4>AppChooser</h4></summary>
404    ///
405    ///
406    /// #### `content-type`
407    ///  The content type of the [`AppChooser`][crate::AppChooser] object.
408    ///
409    /// See `GContentType` for more information about content types.
410    ///
411    /// Readable | Writable | Construct Only
412    /// </details>
413    ///
414    /// ## Signals
415    ///
416    ///
417    /// #### `application-activated`
418    ///  Emitted when an application item is activated from the widget's list.
419    ///
420    /// This usually happens when the user double clicks an item, or an item
421    /// is selected and the user presses one of the keys Space, Shift+Space,
422    /// Return or Enter.
423    ///
424    ///
425    ///
426    ///
427    /// #### `application-selected`
428    ///  Emitted when an application item is selected from the widget's list.
429    ///
430    ///
431    /// <details><summary><h4>Widget</h4></summary>
432    ///
433    ///
434    /// #### `destroy`
435    ///  Signals that all holders of a reference to the widget should release
436    /// the reference that they hold.
437    ///
438    /// May result in finalization of the widget if all references are released.
439    ///
440    /// This signal is not suitable for saving widget state.
441    ///
442    ///
443    ///
444    ///
445    /// #### `direction-changed`
446    ///  Emitted when the text direction of a widget changes.
447    ///
448    ///
449    ///
450    ///
451    /// #### `hide`
452    ///  Emitted when @widget is hidden.
453    ///
454    ///
455    ///
456    ///
457    /// #### `keynav-failed`
458    ///  Emitted if keyboard navigation fails.
459    ///
460    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
461    ///
462    ///
463    ///
464    ///
465    /// #### `map`
466    ///  Emitted when @widget is going to be mapped.
467    ///
468    /// A widget is mapped when the widget is visible (which is controlled with
469    /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
470    /// are also visible.
471    ///
472    /// The `::map` signal can be used to determine whether a widget will be drawn,
473    /// for instance it can resume an animation that was stopped during the
474    /// emission of [`unmap`][struct@crate::Widget#unmap].
475    ///
476    ///
477    ///
478    ///
479    /// #### `mnemonic-activate`
480    ///  Emitted when a widget is activated via a mnemonic.
481    ///
482    /// The default handler for this signal activates @widget if @group_cycling
483    /// is false, or just makes @widget grab focus if @group_cycling is true.
484    ///
485    ///
486    ///
487    ///
488    /// #### `move-focus`
489    ///   to move backward.
490    ///
491    /// Action
492    ///
493    ///
494    /// #### `query-tooltip`
495    ///  s tooltip is about to be shown.
496    ///
497    /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
498    /// is true and the hover timeout has expired with the cursor hovering
499    /// above @widget; or emitted when @widget got focus in keyboard mode.
500    ///
501    /// Using the given coordinates, the signal handler should determine
502    /// whether a tooltip should be shown for @widget. If this is the case
503    /// true should be returned, false otherwise. Note that if @keyboard_mode
504    /// is true, the values of @x and @y are undefined and should not be used.
505    ///
506    /// The signal handler is free to manipulate @tooltip with the therefore
507    /// destined function calls.
508    ///
509    ///
510    ///
511    ///
512    /// #### `realize`
513    ///  Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
514    ///
515    /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
516    /// or the widget has been mapped (that is, it is going to be drawn).
517    ///
518    ///
519    ///
520    ///
521    /// #### `show`
522    ///  Emitted when @widget is shown.
523    ///
524    ///
525    ///
526    ///
527    /// #### `state-flags-changed`
528    ///  Emitted when the widget state changes.
529    ///
530    /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
531    ///
532    ///
533    ///
534    ///
535    /// #### `unmap`
536    ///  Emitted when @widget is going to be unmapped.
537    ///
538    /// A widget is unmapped when either it or any of its parents up to the
539    /// toplevel widget have been set as hidden.
540    ///
541    /// As `::unmap` indicates that a widget will not be shown any longer,
542    /// it can be used to, for example, stop an animation on the widget.
543    ///
544    ///
545    ///
546    ///
547    /// #### `unrealize`
548    ///  Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
549    ///
550    /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
551    /// or the widget has been unmapped (that is, it is going to be hidden).
552    ///
553    ///
554    /// </details>
555    ///
556    /// # Implements
557    ///
558    /// [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`AppChooserExt`][trait@crate::prelude::AppChooserExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
559    #[doc(alias = "GtkAppChooserWidget")]
560    pub struct AppChooserWidget(Object<ffi::GtkAppChooserWidget>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, AppChooser;
561
562    match fn {
563        type_ => || ffi::gtk_app_chooser_widget_get_type(),
564    }
565}
566
567#[cfg(not(feature = "v4_10"))]
568glib::wrapper! {
569    #[doc(alias = "GtkAppChooserWidget")]
570    pub struct AppChooserWidget(Object<ffi::GtkAppChooserWidget>) @extends Widget, @implements Buildable, ConstraintTarget, AppChooser;
571
572    match fn {
573        type_ => || ffi::gtk_app_chooser_widget_get_type(),
574    }
575}
576
577impl AppChooserWidget {
578    /// Creates a new [`AppChooserWidget`][crate::AppChooserWidget] for applications
579    /// that can handle content of the given type.
580    ///
581    /// # Deprecated since 4.10
582    ///
583    /// This widget will be removed in GTK 5
584    /// ## `content_type`
585    /// the content type to show applications for
586    ///
587    /// # Returns
588    ///
589    /// a newly created [`AppChooserWidget`][crate::AppChooserWidget]
590    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
591    #[allow(deprecated)]
592    #[doc(alias = "gtk_app_chooser_widget_new")]
593    pub fn new(content_type: &str) -> AppChooserWidget {
594        assert_initialized_main_thread!();
595        unsafe {
596            Widget::from_glib_none(ffi::gtk_app_chooser_widget_new(
597                content_type.to_glib_none().0,
598            ))
599            .unsafe_cast()
600        }
601    }
602
603    // rustdoc-stripper-ignore-next
604    /// Creates a new builder-pattern struct instance to construct [`AppChooserWidget`] objects.
605    ///
606    /// This method returns an instance of [`AppChooserWidgetBuilder`](crate::builders::AppChooserWidgetBuilder) which can be used to create [`AppChooserWidget`] objects.
607    pub fn builder() -> AppChooserWidgetBuilder {
608        AppChooserWidgetBuilder::new()
609    }
610
611    /// Returns the text that is shown if there are not applications
612    /// that can handle the content type.
613    ///
614    /// # Deprecated since 4.10
615    ///
616    /// This widget will be removed in GTK 5
617    ///
618    /// # Returns
619    ///
620    /// the value of [`default-text`][struct@crate::AppChooserWidget#default-text]
621    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
622    #[allow(deprecated)]
623    #[doc(alias = "gtk_app_chooser_widget_get_default_text")]
624    #[doc(alias = "get_default_text")]
625    #[doc(alias = "default-text")]
626    pub fn default_text(&self) -> Option<glib::GString> {
627        unsafe {
628            from_glib_none(ffi::gtk_app_chooser_widget_get_default_text(
629                self.to_glib_none().0,
630            ))
631        }
632    }
633
634    /// Gets whether the app chooser should show all applications
635    /// in a flat list.
636    ///
637    /// # Deprecated since 4.10
638    ///
639    /// This widget will be removed in GTK 5
640    ///
641    /// # Returns
642    ///
643    /// the value of [`show-all`][struct@crate::AppChooserWidget#show-all]
644    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
645    #[allow(deprecated)]
646    #[doc(alias = "gtk_app_chooser_widget_get_show_all")]
647    #[doc(alias = "get_show_all")]
648    #[doc(alias = "show-all")]
649    pub fn shows_all(&self) -> bool {
650        unsafe {
651            from_glib(ffi::gtk_app_chooser_widget_get_show_all(
652                self.to_glib_none().0,
653            ))
654        }
655    }
656
657    /// Gets whether the app chooser should show the default handler
658    /// for the content type in a separate section.
659    ///
660    /// # Deprecated since 4.10
661    ///
662    /// This widget will be removed in GTK 5
663    ///
664    /// # Returns
665    ///
666    /// the value of [`show-default`][struct@crate::AppChooserWidget#show-default]
667    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
668    #[allow(deprecated)]
669    #[doc(alias = "gtk_app_chooser_widget_get_show_default")]
670    #[doc(alias = "get_show_default")]
671    #[doc(alias = "show-default")]
672    pub fn shows_default(&self) -> bool {
673        unsafe {
674            from_glib(ffi::gtk_app_chooser_widget_get_show_default(
675                self.to_glib_none().0,
676            ))
677        }
678    }
679
680    /// Gets whether the app chooser should show related applications
681    /// for the content type in a separate section.
682    ///
683    /// # Deprecated since 4.10
684    ///
685    /// This widget will be removed in GTK 5
686    ///
687    /// # Returns
688    ///
689    /// the value of [`show-fallback`][struct@crate::AppChooserWidget#show-fallback]
690    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
691    #[allow(deprecated)]
692    #[doc(alias = "gtk_app_chooser_widget_get_show_fallback")]
693    #[doc(alias = "get_show_fallback")]
694    #[doc(alias = "show-fallback")]
695    pub fn shows_fallback(&self) -> bool {
696        unsafe {
697            from_glib(ffi::gtk_app_chooser_widget_get_show_fallback(
698                self.to_glib_none().0,
699            ))
700        }
701    }
702
703    /// Gets whether the app chooser should show applications
704    /// which are unrelated to the content type.
705    ///
706    /// # Deprecated since 4.10
707    ///
708    /// This widget will be removed in GTK 5
709    ///
710    /// # Returns
711    ///
712    /// the value of [`show-other`][struct@crate::AppChooserWidget#show-other]
713    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
714    #[allow(deprecated)]
715    #[doc(alias = "gtk_app_chooser_widget_get_show_other")]
716    #[doc(alias = "get_show_other")]
717    #[doc(alias = "show-other")]
718    pub fn shows_other(&self) -> bool {
719        unsafe {
720            from_glib(ffi::gtk_app_chooser_widget_get_show_other(
721                self.to_glib_none().0,
722            ))
723        }
724    }
725
726    /// Gets whether the app chooser should show recommended applications
727    /// for the content type in a separate section.
728    ///
729    /// # Deprecated since 4.10
730    ///
731    /// This widget will be removed in GTK 5
732    ///
733    /// # Returns
734    ///
735    /// the value of [`show-recommended`][struct@crate::AppChooserWidget#show-recommended]
736    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
737    #[allow(deprecated)]
738    #[doc(alias = "gtk_app_chooser_widget_get_show_recommended")]
739    #[doc(alias = "get_show_recommended")]
740    #[doc(alias = "show-recommended")]
741    pub fn shows_recommended(&self) -> bool {
742        unsafe {
743            from_glib(ffi::gtk_app_chooser_widget_get_show_recommended(
744                self.to_glib_none().0,
745            ))
746        }
747    }
748
749    /// Sets the text that is shown if there are not applications
750    /// that can handle the content type.
751    ///
752    /// # Deprecated since 4.10
753    ///
754    /// This widget will be removed in GTK 5
755    /// ## `text`
756    /// the new value for [`default-text`][struct@crate::AppChooserWidget#default-text]
757    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
758    #[allow(deprecated)]
759    #[doc(alias = "gtk_app_chooser_widget_set_default_text")]
760    #[doc(alias = "default-text")]
761    pub fn set_default_text(&self, text: &str) {
762        unsafe {
763            ffi::gtk_app_chooser_widget_set_default_text(
764                self.to_glib_none().0,
765                text.to_glib_none().0,
766            );
767        }
768    }
769
770    /// Sets whether the app chooser should show all applications
771    /// in a flat list.
772    ///
773    /// # Deprecated since 4.10
774    ///
775    /// This widget will be removed in GTK 5
776    /// ## `setting`
777    /// the new value for [`show-all`][struct@crate::AppChooserWidget#show-all]
778    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
779    #[allow(deprecated)]
780    #[doc(alias = "gtk_app_chooser_widget_set_show_all")]
781    #[doc(alias = "show-all")]
782    pub fn set_show_all(&self, setting: bool) {
783        unsafe {
784            ffi::gtk_app_chooser_widget_set_show_all(self.to_glib_none().0, setting.into_glib());
785        }
786    }
787
788    /// Sets whether the app chooser should show the default handler
789    /// for the content type in a separate section.
790    ///
791    /// # Deprecated since 4.10
792    ///
793    /// This widget will be removed in GTK 5
794    /// ## `setting`
795    /// the new value for [`show-default`][struct@crate::AppChooserWidget#show-default]
796    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
797    #[allow(deprecated)]
798    #[doc(alias = "gtk_app_chooser_widget_set_show_default")]
799    #[doc(alias = "show-default")]
800    pub fn set_show_default(&self, setting: bool) {
801        unsafe {
802            ffi::gtk_app_chooser_widget_set_show_default(
803                self.to_glib_none().0,
804                setting.into_glib(),
805            );
806        }
807    }
808
809    /// Sets whether the app chooser should show related applications
810    /// for the content type in a separate section.
811    ///
812    /// # Deprecated since 4.10
813    ///
814    /// This widget will be removed in GTK 5
815    /// ## `setting`
816    /// the new value for [`show-fallback`][struct@crate::AppChooserWidget#show-fallback]
817    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
818    #[allow(deprecated)]
819    #[doc(alias = "gtk_app_chooser_widget_set_show_fallback")]
820    #[doc(alias = "show-fallback")]
821    pub fn set_show_fallback(&self, setting: bool) {
822        unsafe {
823            ffi::gtk_app_chooser_widget_set_show_fallback(
824                self.to_glib_none().0,
825                setting.into_glib(),
826            );
827        }
828    }
829
830    /// Sets whether the app chooser should show applications
831    /// which are unrelated to the content type.
832    ///
833    /// # Deprecated since 4.10
834    ///
835    /// This widget will be removed in GTK 5
836    /// ## `setting`
837    /// the new value for [`show-other`][struct@crate::AppChooserWidget#show-other]
838    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
839    #[allow(deprecated)]
840    #[doc(alias = "gtk_app_chooser_widget_set_show_other")]
841    #[doc(alias = "show-other")]
842    pub fn set_show_other(&self, setting: bool) {
843        unsafe {
844            ffi::gtk_app_chooser_widget_set_show_other(self.to_glib_none().0, setting.into_glib());
845        }
846    }
847
848    /// Sets whether the app chooser should show recommended applications
849    /// for the content type in a separate section.
850    ///
851    /// # Deprecated since 4.10
852    ///
853    /// This widget will be removed in GTK 5
854    /// ## `setting`
855    /// the new value for [`show-recommended`][struct@crate::AppChooserWidget#show-recommended]
856    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
857    #[allow(deprecated)]
858    #[doc(alias = "gtk_app_chooser_widget_set_show_recommended")]
859    #[doc(alias = "show-recommended")]
860    pub fn set_show_recommended(&self, setting: bool) {
861        unsafe {
862            ffi::gtk_app_chooser_widget_set_show_recommended(
863                self.to_glib_none().0,
864                setting.into_glib(),
865            );
866        }
867    }
868
869    /// Emitted when an application item is activated from the widget's list.
870    ///
871    /// This usually happens when the user double clicks an item, or an item
872    /// is selected and the user presses one of the keys Space, Shift+Space,
873    /// Return or Enter.
874    /// ## `application`
875    /// the activated `GAppInfo`
876    #[doc(alias = "application-activated")]
877    pub fn connect_application_activated<F: Fn(&Self, &gio::AppInfo) + 'static>(
878        &self,
879        f: F,
880    ) -> SignalHandlerId {
881        unsafe extern "C" fn application_activated_trampoline<
882            F: Fn(&AppChooserWidget, &gio::AppInfo) + 'static,
883        >(
884            this: *mut ffi::GtkAppChooserWidget,
885            application: *mut gio::ffi::GAppInfo,
886            f: glib::ffi::gpointer,
887        ) {
888            unsafe {
889                let f: &F = &*(f as *const F);
890                f(&from_glib_borrow(this), &from_glib_borrow(application))
891            }
892        }
893        unsafe {
894            let f: Box_<F> = Box_::new(f);
895            connect_raw(
896                self.as_ptr() as *mut _,
897                c"application-activated".as_ptr(),
898                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
899                    application_activated_trampoline::<F> as *const (),
900                )),
901                Box_::into_raw(f),
902            )
903        }
904    }
905
906    /// Emitted when an application item is selected from the widget's list.
907    /// ## `application`
908    /// the selected `GAppInfo`
909    #[doc(alias = "application-selected")]
910    pub fn connect_application_selected<F: Fn(&Self, &gio::AppInfo) + 'static>(
911        &self,
912        f: F,
913    ) -> SignalHandlerId {
914        unsafe extern "C" fn application_selected_trampoline<
915            F: Fn(&AppChooserWidget, &gio::AppInfo) + 'static,
916        >(
917            this: *mut ffi::GtkAppChooserWidget,
918            application: *mut gio::ffi::GAppInfo,
919            f: glib::ffi::gpointer,
920        ) {
921            unsafe {
922                let f: &F = &*(f as *const F);
923                f(&from_glib_borrow(this), &from_glib_borrow(application))
924            }
925        }
926        unsafe {
927            let f: Box_<F> = Box_::new(f);
928            connect_raw(
929                self.as_ptr() as *mut _,
930                c"application-selected".as_ptr(),
931                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
932                    application_selected_trampoline::<F> as *const (),
933                )),
934                Box_::into_raw(f),
935            )
936        }
937    }
938
939    #[doc(alias = "default-text")]
940    pub fn connect_default_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
941        unsafe extern "C" fn notify_default_text_trampoline<F: Fn(&AppChooserWidget) + 'static>(
942            this: *mut ffi::GtkAppChooserWidget,
943            _param_spec: glib::ffi::gpointer,
944            f: glib::ffi::gpointer,
945        ) {
946            unsafe {
947                let f: &F = &*(f as *const F);
948                f(&from_glib_borrow(this))
949            }
950        }
951        unsafe {
952            let f: Box_<F> = Box_::new(f);
953            connect_raw(
954                self.as_ptr() as *mut _,
955                c"notify::default-text".as_ptr(),
956                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
957                    notify_default_text_trampoline::<F> as *const (),
958                )),
959                Box_::into_raw(f),
960            )
961        }
962    }
963
964    #[doc(alias = "show-all")]
965    pub fn connect_show_all_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
966        unsafe extern "C" fn notify_show_all_trampoline<F: Fn(&AppChooserWidget) + 'static>(
967            this: *mut ffi::GtkAppChooserWidget,
968            _param_spec: glib::ffi::gpointer,
969            f: glib::ffi::gpointer,
970        ) {
971            unsafe {
972                let f: &F = &*(f as *const F);
973                f(&from_glib_borrow(this))
974            }
975        }
976        unsafe {
977            let f: Box_<F> = Box_::new(f);
978            connect_raw(
979                self.as_ptr() as *mut _,
980                c"notify::show-all".as_ptr(),
981                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
982                    notify_show_all_trampoline::<F> as *const (),
983                )),
984                Box_::into_raw(f),
985            )
986        }
987    }
988
989    #[doc(alias = "show-default")]
990    pub fn connect_show_default_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
991        unsafe extern "C" fn notify_show_default_trampoline<F: Fn(&AppChooserWidget) + 'static>(
992            this: *mut ffi::GtkAppChooserWidget,
993            _param_spec: glib::ffi::gpointer,
994            f: glib::ffi::gpointer,
995        ) {
996            unsafe {
997                let f: &F = &*(f as *const F);
998                f(&from_glib_borrow(this))
999            }
1000        }
1001        unsafe {
1002            let f: Box_<F> = Box_::new(f);
1003            connect_raw(
1004                self.as_ptr() as *mut _,
1005                c"notify::show-default".as_ptr(),
1006                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1007                    notify_show_default_trampoline::<F> as *const (),
1008                )),
1009                Box_::into_raw(f),
1010            )
1011        }
1012    }
1013
1014    #[doc(alias = "show-fallback")]
1015    pub fn connect_show_fallback_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1016        unsafe extern "C" fn notify_show_fallback_trampoline<F: Fn(&AppChooserWidget) + 'static>(
1017            this: *mut ffi::GtkAppChooserWidget,
1018            _param_spec: glib::ffi::gpointer,
1019            f: glib::ffi::gpointer,
1020        ) {
1021            unsafe {
1022                let f: &F = &*(f as *const F);
1023                f(&from_glib_borrow(this))
1024            }
1025        }
1026        unsafe {
1027            let f: Box_<F> = Box_::new(f);
1028            connect_raw(
1029                self.as_ptr() as *mut _,
1030                c"notify::show-fallback".as_ptr(),
1031                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1032                    notify_show_fallback_trampoline::<F> as *const (),
1033                )),
1034                Box_::into_raw(f),
1035            )
1036        }
1037    }
1038
1039    #[doc(alias = "show-other")]
1040    pub fn connect_show_other_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1041        unsafe extern "C" fn notify_show_other_trampoline<F: Fn(&AppChooserWidget) + 'static>(
1042            this: *mut ffi::GtkAppChooserWidget,
1043            _param_spec: glib::ffi::gpointer,
1044            f: glib::ffi::gpointer,
1045        ) {
1046            unsafe {
1047                let f: &F = &*(f as *const F);
1048                f(&from_glib_borrow(this))
1049            }
1050        }
1051        unsafe {
1052            let f: Box_<F> = Box_::new(f);
1053            connect_raw(
1054                self.as_ptr() as *mut _,
1055                c"notify::show-other".as_ptr(),
1056                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1057                    notify_show_other_trampoline::<F> as *const (),
1058                )),
1059                Box_::into_raw(f),
1060            )
1061        }
1062    }
1063
1064    #[doc(alias = "show-recommended")]
1065    pub fn connect_show_recommended_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1066        unsafe extern "C" fn notify_show_recommended_trampoline<
1067            F: Fn(&AppChooserWidget) + 'static,
1068        >(
1069            this: *mut ffi::GtkAppChooserWidget,
1070            _param_spec: glib::ffi::gpointer,
1071            f: glib::ffi::gpointer,
1072        ) {
1073            unsafe {
1074                let f: &F = &*(f as *const F);
1075                f(&from_glib_borrow(this))
1076            }
1077        }
1078        unsafe {
1079            let f: Box_<F> = Box_::new(f);
1080            connect_raw(
1081                self.as_ptr() as *mut _,
1082                c"notify::show-recommended".as_ptr(),
1083                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1084                    notify_show_recommended_trampoline::<F> as *const (),
1085                )),
1086                Box_::into_raw(f),
1087            )
1088        }
1089    }
1090}
1091
1092impl Default for AppChooserWidget {
1093    fn default() -> Self {
1094        glib::object::Object::new::<Self>()
1095    }
1096}
1097
1098// rustdoc-stripper-ignore-next
1099/// A [builder-pattern] type to construct [`AppChooserWidget`] objects.
1100///
1101/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1102#[must_use = "The builder must be built to be used"]
1103pub struct AppChooserWidgetBuilder {
1104    builder: glib::object::ObjectBuilder<'static, AppChooserWidget>,
1105}
1106
1107impl AppChooserWidgetBuilder {
1108    fn new() -> Self {
1109        Self {
1110            builder: glib::object::Object::builder(),
1111        }
1112    }
1113
1114    /// The text that appears in the widget when there are no applications
1115    /// for the given content type.
1116    pub fn default_text(self, default_text: impl Into<glib::GString>) -> Self {
1117        Self {
1118            builder: self.builder.property("default-text", default_text.into()),
1119        }
1120    }
1121
1122    /// If [`true`], the app chooser presents all applications
1123    /// in a single list, without subsections for default,
1124    /// recommended or related applications.
1125    pub fn show_all(self, show_all: bool) -> Self {
1126        Self {
1127            builder: self.builder.property("show-all", show_all),
1128        }
1129    }
1130
1131    /// Determines whether the app chooser should show the default
1132    /// handler for the content type in a separate section.
1133    ///
1134    /// If [`false`], the default handler is listed among the recommended
1135    /// applications.
1136    pub fn show_default(self, show_default: bool) -> Self {
1137        Self {
1138            builder: self.builder.property("show-default", show_default),
1139        }
1140    }
1141
1142    /// Determines whether the app chooser should show a section
1143    /// for fallback applications.
1144    ///
1145    /// If [`false`], the fallback applications are listed among the
1146    /// other applications.
1147    pub fn show_fallback(self, show_fallback: bool) -> Self {
1148        Self {
1149            builder: self.builder.property("show-fallback", show_fallback),
1150        }
1151    }
1152
1153    /// Determines whether the app chooser should show a section
1154    /// for other applications.
1155    pub fn show_other(self, show_other: bool) -> Self {
1156        Self {
1157            builder: self.builder.property("show-other", show_other),
1158        }
1159    }
1160
1161    /// Determines whether the app chooser should show a section
1162    /// for recommended applications.
1163    ///
1164    /// If [`false`], the recommended applications are listed
1165    /// among the other applications.
1166    pub fn show_recommended(self, show_recommended: bool) -> Self {
1167        Self {
1168            builder: self.builder.property("show-recommended", show_recommended),
1169        }
1170    }
1171
1172    /// Whether the widget or any of its descendents can accept
1173    /// the input focus.
1174    ///
1175    /// This property is meant to be set by widget implementations,
1176    /// typically in their instance init function.
1177    pub fn can_focus(self, can_focus: bool) -> Self {
1178        Self {
1179            builder: self.builder.property("can-focus", can_focus),
1180        }
1181    }
1182
1183    /// Whether the widget can receive pointer events.
1184    pub fn can_target(self, can_target: bool) -> Self {
1185        Self {
1186            builder: self.builder.property("can-target", can_target),
1187        }
1188    }
1189
1190    /// A list of css classes applied to this widget.
1191    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1192        Self {
1193            builder: self.builder.property("css-classes", css_classes.into()),
1194        }
1195    }
1196
1197    /// The name of this widget in the CSS tree.
1198    ///
1199    /// This property is meant to be set by widget implementations,
1200    /// typically in their instance init function.
1201    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1202        Self {
1203            builder: self.builder.property("css-name", css_name.into()),
1204        }
1205    }
1206
1207    /// The cursor used by @widget.
1208    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1209        Self {
1210            builder: self.builder.property("cursor", cursor.clone()),
1211        }
1212    }
1213
1214    /// Whether the widget should grab focus when it is clicked with the mouse.
1215    ///
1216    /// This property is only relevant for widgets that can take focus.
1217    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1218        Self {
1219            builder: self.builder.property("focus-on-click", focus_on_click),
1220        }
1221    }
1222
1223    /// Whether this widget itself will accept the input focus.
1224    pub fn focusable(self, focusable: bool) -> Self {
1225        Self {
1226            builder: self.builder.property("focusable", focusable),
1227        }
1228    }
1229
1230    /// How to distribute horizontal space if widget gets extra space.
1231    pub fn halign(self, halign: Align) -> Self {
1232        Self {
1233            builder: self.builder.property("halign", halign),
1234        }
1235    }
1236
1237    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1238    /// signal on @widget.
1239    ///
1240    /// A true value indicates that @widget can have a tooltip, in this case
1241    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1242    /// determine whether it will provide a tooltip or not.
1243    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1244        Self {
1245            builder: self.builder.property("has-tooltip", has_tooltip),
1246        }
1247    }
1248
1249    /// Overrides for height request of the widget.
1250    ///
1251    /// If this is -1, the natural request will be used.
1252    pub fn height_request(self, height_request: i32) -> Self {
1253        Self {
1254            builder: self.builder.property("height-request", height_request),
1255        }
1256    }
1257
1258    /// Whether to expand horizontally.
1259    pub fn hexpand(self, hexpand: bool) -> Self {
1260        Self {
1261            builder: self.builder.property("hexpand", hexpand),
1262        }
1263    }
1264
1265    /// Whether to use the `hexpand` property.
1266    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1267        Self {
1268            builder: self.builder.property("hexpand-set", hexpand_set),
1269        }
1270    }
1271
1272    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1273    /// the preferred size of the widget, and allocate its children.
1274    ///
1275    /// This property is meant to be set by widget implementations,
1276    /// typically in their instance init function.
1277    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1278        Self {
1279            builder: self
1280                .builder
1281                .property("layout-manager", layout_manager.clone().upcast()),
1282        }
1283    }
1284
1285    /// Makes this widget act like a modal dialog, with respect to
1286    /// event delivery.
1287    ///
1288    /// Global event controllers will not handle events with targets
1289    /// inside the widget, unless they are set up to ignore propagation
1290    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1291    #[cfg(feature = "v4_18")]
1292    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1293    pub fn limit_events(self, limit_events: bool) -> Self {
1294        Self {
1295            builder: self.builder.property("limit-events", limit_events),
1296        }
1297    }
1298
1299    /// Margin on bottom side of widget.
1300    ///
1301    /// This property adds margin outside of the widget's normal size
1302    /// request, the margin will be added in addition to the size from
1303    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1304    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1305        Self {
1306            builder: self.builder.property("margin-bottom", margin_bottom),
1307        }
1308    }
1309
1310    /// Margin on end of widget, horizontally.
1311    ///
1312    /// This property supports left-to-right and right-to-left text
1313    /// directions.
1314    ///
1315    /// This property adds margin outside of the widget's normal size
1316    /// request, the margin will be added in addition to the size from
1317    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1318    pub fn margin_end(self, margin_end: i32) -> Self {
1319        Self {
1320            builder: self.builder.property("margin-end", margin_end),
1321        }
1322    }
1323
1324    /// Margin on start of widget, horizontally.
1325    ///
1326    /// This property supports left-to-right and right-to-left text
1327    /// directions.
1328    ///
1329    /// This property adds margin outside of the widget's normal size
1330    /// request, the margin will be added in addition to the size from
1331    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1332    pub fn margin_start(self, margin_start: i32) -> Self {
1333        Self {
1334            builder: self.builder.property("margin-start", margin_start),
1335        }
1336    }
1337
1338    /// Margin on top side of widget.
1339    ///
1340    /// This property adds margin outside of the widget's normal size
1341    /// request, the margin will be added in addition to the size from
1342    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1343    pub fn margin_top(self, margin_top: i32) -> Self {
1344        Self {
1345            builder: self.builder.property("margin-top", margin_top),
1346        }
1347    }
1348
1349    /// The name of the widget.
1350    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1351        Self {
1352            builder: self.builder.property("name", name.into()),
1353        }
1354    }
1355
1356    /// The requested opacity of the widget.
1357    pub fn opacity(self, opacity: f64) -> Self {
1358        Self {
1359            builder: self.builder.property("opacity", opacity),
1360        }
1361    }
1362
1363    /// How content outside the widget's content area is treated.
1364    ///
1365    /// This property is meant to be set by widget implementations,
1366    /// typically in their instance init function.
1367    pub fn overflow(self, overflow: Overflow) -> Self {
1368        Self {
1369            builder: self.builder.property("overflow", overflow),
1370        }
1371    }
1372
1373    /// Whether the widget will receive the default action when it is focused.
1374    pub fn receives_default(self, receives_default: bool) -> Self {
1375        Self {
1376            builder: self.builder.property("receives-default", receives_default),
1377        }
1378    }
1379
1380    /// Whether the widget responds to input.
1381    pub fn sensitive(self, sensitive: bool) -> Self {
1382        Self {
1383            builder: self.builder.property("sensitive", sensitive),
1384        }
1385    }
1386
1387    /// Sets the text of tooltip to be the given string, which is marked up
1388    /// with Pango markup.
1389    ///
1390    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1391    ///
1392    /// This is a convenience property which will take care of getting the
1393    /// tooltip shown if the given string is not `NULL`:
1394    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1395    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1396    /// the default signal handler.
1397    ///
1398    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1399    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1400    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1401        Self {
1402            builder: self
1403                .builder
1404                .property("tooltip-markup", tooltip_markup.into()),
1405        }
1406    }
1407
1408    /// Sets the text of tooltip to be the given string.
1409    ///
1410    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1411    ///
1412    /// This is a convenience property which will take care of getting the
1413    /// tooltip shown if the given string is not `NULL`:
1414    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1415    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1416    /// the default signal handler.
1417    ///
1418    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1419    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1420    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1421        Self {
1422            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1423        }
1424    }
1425
1426    /// How to distribute vertical space if widget gets extra space.
1427    pub fn valign(self, valign: Align) -> Self {
1428        Self {
1429            builder: self.builder.property("valign", valign),
1430        }
1431    }
1432
1433    /// Whether to expand vertically.
1434    pub fn vexpand(self, vexpand: bool) -> Self {
1435        Self {
1436            builder: self.builder.property("vexpand", vexpand),
1437        }
1438    }
1439
1440    /// Whether to use the `vexpand` property.
1441    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1442        Self {
1443            builder: self.builder.property("vexpand-set", vexpand_set),
1444        }
1445    }
1446
1447    /// Whether the widget is visible.
1448    pub fn visible(self, visible: bool) -> Self {
1449        Self {
1450            builder: self.builder.property("visible", visible),
1451        }
1452    }
1453
1454    /// Overrides for width request of the widget.
1455    ///
1456    /// If this is -1, the natural request will be used.
1457    pub fn width_request(self, width_request: i32) -> Self {
1458        Self {
1459            builder: self.builder.property("width-request", width_request),
1460        }
1461    }
1462
1463    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1464    ///
1465    /// The accessible role cannot be changed once set.
1466    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1467        Self {
1468            builder: self.builder.property("accessible-role", accessible_role),
1469        }
1470    }
1471
1472    /// The content type of the [`AppChooser`][crate::AppChooser] object.
1473    ///
1474    /// See `GContentType` for more information about content types.
1475    pub fn content_type(self, content_type: impl Into<glib::GString>) -> Self {
1476        Self {
1477            builder: self.builder.property("content-type", content_type.into()),
1478        }
1479    }
1480
1481    // rustdoc-stripper-ignore-next
1482    /// Build the [`AppChooserWidget`].
1483    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1484    pub fn build(self) -> AppChooserWidget {
1485        assert_initialized_main_thread!();
1486        self.builder.build()
1487    }
1488}