Skip to main content

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