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