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