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    ffi, Accessible, AccessibleRole, Align, AppChooser, Buildable, ConstraintTarget, LayoutManager,
8    Overflow, Widget,
9};
10use glib::{
11    object::ObjectType as _,
12    prelude::*,
13    signal::{connect_raw, SignalHandlerId},
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    /// ![An example GtkAppChooserButton](appchooserbutton.png)
25    ///
26    /// Initially, a [`AppChooserButton`][crate::AppChooserButton] selects the first application
27    /// in its list, which will either be the most-recently used application
28    /// or, if [`show-default-item`][struct@crate::AppChooserButton#show-default-item] is [`true`], the
29    /// default application.
30    ///
31    /// The list of applications shown in a [`AppChooserButton`][crate::AppChooserButton] includes
32    /// the recommended applications for the given content type. When
33    /// [`show-default-item`][struct@crate::AppChooserButton#show-default-item] is set, the default
34    /// application is also included. To let the user chooser other applications,
35    /// you can set the [`show-dialog-item`][struct@crate::AppChooserButton#show-dialog-item] property,
36    /// which allows to open a full [`AppChooserDialog`][crate::AppChooserDialog].
37    ///
38    /// It is possible to add custom items to the list, using
39    /// [`append_custom_item()`][Self::append_custom_item()]. These items cause
40    /// the [`custom-item-activated`][struct@crate::AppChooserButton#custom-item-activated] signal to be
41    /// emitted when they are selected.
42    ///
43    /// To track changes in the selected application, use the
44    /// [`changed`][struct@crate::AppChooserButton#changed] signal.
45    ///
46    /// ## CSS nodes
47    ///
48    /// [`AppChooserButton`][crate::AppChooserButton] has a single CSS node with the name “appchooserbutton”.
49    ///
50    /// ## Properties
51    ///
52    ///
53    /// #### `heading`
54    ///  The text to show at the top of the dialog that can be
55    /// opened from the button.
56    ///
57    /// The string may contain Pango markup.
58    ///
59    /// Readable | Writeable
60    ///
61    ///
62    /// #### `modal`
63    ///  Whether the app chooser dialog should be modal.
64    ///
65    /// Readable | Writeable | Construct
66    ///
67    ///
68    /// #### `show-default-item`
69    ///  Determines whether the dropdown menu shows the default application
70    /// on top for the provided content type.
71    ///
72    /// Readable | Writeable | Construct
73    ///
74    ///
75    /// #### `show-dialog-item`
76    ///  Determines whether the dropdown menu shows an item to open
77    /// a [`AppChooserDialog`][crate::AppChooserDialog].
78    ///
79    /// Readable | Writeable | Construct
80    /// <details><summary><h4>Widget</h4></summary>
81    ///
82    ///
83    /// #### `can-focus`
84    ///  Whether the widget or any of its descendents can accept
85    /// the input focus.
86    ///
87    /// This property is meant to be set by widget implementations,
88    /// typically in their instance init function.
89    ///
90    /// Readable | Writeable
91    ///
92    ///
93    /// #### `can-target`
94    ///  Whether the widget can receive pointer events.
95    ///
96    /// Readable | Writeable
97    ///
98    ///
99    /// #### `css-classes`
100    ///  A list of css classes applied to this widget.
101    ///
102    /// Readable | Writeable
103    ///
104    ///
105    /// #### `css-name`
106    ///  The name of this widget in the CSS tree.
107    ///
108    /// This property is meant to be set by widget implementations,
109    /// typically in their instance init function.
110    ///
111    /// Readable | Writeable | Construct Only
112    ///
113    ///
114    /// #### `cursor`
115    ///  The cursor used by @widget.
116    ///
117    /// Readable | Writeable
118    ///
119    ///
120    /// #### `focus-on-click`
121    ///  Whether the widget should grab focus when it is clicked with the mouse.
122    ///
123    /// This property is only relevant for widgets that can take focus.
124    ///
125    /// Readable | Writeable
126    ///
127    ///
128    /// #### `focusable`
129    ///  Whether this widget itself will accept the input focus.
130    ///
131    /// Readable | Writeable
132    ///
133    ///
134    /// #### `halign`
135    ///  How to distribute horizontal space if widget gets extra space.
136    ///
137    /// Readable | Writeable
138    ///
139    ///
140    /// #### `has-default`
141    ///  Whether the widget is the default widget.
142    ///
143    /// Readable
144    ///
145    ///
146    /// #### `has-focus`
147    ///  Whether the widget has the input focus.
148    ///
149    /// Readable
150    ///
151    ///
152    /// #### `has-tooltip`
153    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
154    /// signal on @widget.
155    ///
156    /// A true value indicates that @widget can have a tooltip, in this case
157    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
158    /// determine whether it will provide a tooltip or not.
159    ///
160    /// Readable | Writeable
161    ///
162    ///
163    /// #### `height-request`
164    ///  Overrides for height request of the widget.
165    ///
166    /// If this is -1, the natural request will be used.
167    ///
168    /// Readable | Writeable
169    ///
170    ///
171    /// #### `hexpand`
172    ///  Whether to expand horizontally.
173    ///
174    /// Readable | Writeable
175    ///
176    ///
177    /// #### `hexpand-set`
178    ///  Whether to use the `hexpand` property.
179    ///
180    /// Readable | Writeable
181    ///
182    ///
183    /// #### `layout-manager`
184    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
185    /// the preferred size of the widget, and allocate its children.
186    ///
187    /// This property is meant to be set by widget implementations,
188    /// typically in their instance init function.
189    ///
190    /// Readable | Writeable
191    ///
192    ///
193    /// #### `limit-events`
194    ///  Makes this widget act like a modal dialog, with respect to
195    /// event delivery.
196    ///
197    /// Global event controllers will not handle events with targets
198    /// inside the widget, unless they are set up to ignore propagation
199    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
200    ///
201    /// Readable | Writeable
202    ///
203    ///
204    /// #### `margin-bottom`
205    ///  Margin on bottom side of widget.
206    ///
207    /// This property adds margin outside of the widget's normal size
208    /// request, the margin will be added in addition to the size from
209    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
210    ///
211    /// Readable | Writeable
212    ///
213    ///
214    /// #### `margin-end`
215    ///  Margin on end of widget, horizontally.
216    ///
217    /// This property supports left-to-right and right-to-left text
218    /// directions.
219    ///
220    /// This property adds margin outside of the widget's normal size
221    /// request, the margin will be added in addition to the size from
222    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
223    ///
224    /// Readable | Writeable
225    ///
226    ///
227    /// #### `margin-start`
228    ///  Margin on start of widget, horizontally.
229    ///
230    /// This property supports left-to-right and right-to-left text
231    /// directions.
232    ///
233    /// This property adds margin outside of the widget's normal size
234    /// request, the margin will be added in addition to the size from
235    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
236    ///
237    /// Readable | Writeable
238    ///
239    ///
240    /// #### `margin-top`
241    ///  Margin on top side of widget.
242    ///
243    /// This property adds margin outside of the widget's normal size
244    /// request, the margin will be added in addition to the size from
245    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
246    ///
247    /// Readable | Writeable
248    ///
249    ///
250    /// #### `name`
251    ///  The name of the widget.
252    ///
253    /// Readable | Writeable
254    ///
255    ///
256    /// #### `opacity`
257    ///  The requested opacity of the widget.
258    ///
259    /// Readable | Writeable
260    ///
261    ///
262    /// #### `overflow`
263    ///  How content outside the widget's content area is treated.
264    ///
265    /// This property is meant to be set by widget implementations,
266    /// typically in their instance init function.
267    ///
268    /// Readable | Writeable
269    ///
270    ///
271    /// #### `parent`
272    ///  The parent widget of this widget.
273    ///
274    /// Readable
275    ///
276    ///
277    /// #### `receives-default`
278    ///  Whether the widget will receive the default action when it is focused.
279    ///
280    /// Readable | Writeable
281    ///
282    ///
283    /// #### `root`
284    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
285    ///
286    /// This will be `NULL` if the widget is not contained in a root widget.
287    ///
288    /// Readable
289    ///
290    ///
291    /// #### `scale-factor`
292    ///  The scale factor of the widget.
293    ///
294    /// Readable
295    ///
296    ///
297    /// #### `sensitive`
298    ///  Whether the widget responds to input.
299    ///
300    /// Readable | Writeable
301    ///
302    ///
303    /// #### `tooltip-markup`
304    ///  Sets the text of tooltip to be the given string, which is marked up
305    /// with Pango markup.
306    ///
307    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
308    ///
309    /// This is a convenience property which will take care of getting the
310    /// tooltip shown if the given string is not `NULL`:
311    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
312    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
313    /// the default signal handler.
314    ///
315    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
316    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
317    ///
318    /// Readable | Writeable
319    ///
320    ///
321    /// #### `tooltip-text`
322    ///  Sets the text of tooltip to be the given string.
323    ///
324    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
325    ///
326    /// This is a convenience property which will take care of getting the
327    /// tooltip shown if the given string is not `NULL`:
328    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
329    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
330    /// the default signal handler.
331    ///
332    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
333    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
334    ///
335    /// Readable | Writeable
336    ///
337    ///
338    /// #### `valign`
339    ///  How to distribute vertical space if widget gets extra space.
340    ///
341    /// Readable | Writeable
342    ///
343    ///
344    /// #### `vexpand`
345    ///  Whether to expand vertically.
346    ///
347    /// Readable | Writeable
348    ///
349    ///
350    /// #### `vexpand-set`
351    ///  Whether to use the `vexpand` property.
352    ///
353    /// Readable | Writeable
354    ///
355    ///
356    /// #### `visible`
357    ///  Whether the widget is visible.
358    ///
359    /// Readable | Writeable
360    ///
361    ///
362    /// #### `width-request`
363    ///  Overrides for width request of the widget.
364    ///
365    /// If this is -1, the natural request will be used.
366    ///
367    /// Readable | Writeable
368    /// </details>
369    /// <details><summary><h4>Accessible</h4></summary>
370    ///
371    ///
372    /// #### `accessible-role`
373    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
374    ///
375    /// The accessible role cannot be changed once set.
376    ///
377    /// Readable | Writeable
378    /// </details>
379    /// <details><summary><h4>AppChooser</h4></summary>
380    ///
381    ///
382    /// #### `content-type`
383    ///  The content type of the [`AppChooser`][crate::AppChooser] object.
384    ///
385    /// See `GContentType` for more information about content types.
386    ///
387    /// Readable | Writeable | Construct Only
388    /// </details>
389    ///
390    /// ## Signals
391    ///
392    ///
393    /// #### `activate`
394    ///  Emitted to when the button is activated.
395    ///
396    /// The `::activate` signal on [`AppChooserButton`][crate::AppChooserButton] is an action signal and
397    /// emitting it causes the button to pop up its dialog.
398    ///
399    /// Action
400    ///
401    ///
402    /// #### `changed`
403    ///  Emitted when the active application changes.
404    ///
405    ///
406    ///
407    ///
408    /// #### `custom-item-activated`
409    ///  Emitted when a custom item is activated.
410    ///
411    /// Use [`AppChooserButton::append_custom_item()`][crate::AppChooserButton::append_custom_item()],
412    /// to add custom items.
413    ///
414    /// Detailed
415    /// <details><summary><h4>Widget</h4></summary>
416    ///
417    ///
418    /// #### `destroy`
419    ///  Signals that all holders of a reference to the widget should release
420    /// the reference that they hold.
421    ///
422    /// May result in finalization of the widget if all references are released.
423    ///
424    /// This signal is not suitable for saving widget state.
425    ///
426    ///
427    ///
428    ///
429    /// #### `direction-changed`
430    ///  Emitted when the text direction of a widget changes.
431    ///
432    ///
433    ///
434    ///
435    /// #### `hide`
436    ///  Emitted when @widget is hidden.
437    ///
438    ///
439    ///
440    ///
441    /// #### `keynav-failed`
442    ///  Emitted if keyboard navigation fails.
443    ///
444    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
445    ///
446    ///
447    ///
448    ///
449    /// #### `map`
450    ///  Emitted when @widget is going to be mapped.
451    ///
452    /// A widget is mapped when the widget is visible (which is controlled with
453    /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
454    /// are also visible.
455    ///
456    /// The `::map` signal can be used to determine whether a widget will be drawn,
457    /// for instance it can resume an animation that was stopped during the
458    /// emission of [`unmap`][struct@crate::Widget#unmap].
459    ///
460    ///
461    ///
462    ///
463    /// #### `mnemonic-activate`
464    ///  Emitted when a widget is activated via a mnemonic.
465    ///
466    /// The default handler for this signal activates @widget if @group_cycling
467    /// is false, or just makes @widget grab focus if @group_cycling is true.
468    ///
469    ///
470    ///
471    ///
472    /// #### `move-focus`
473    ///  Emitted when the focus is moved.
474    ///
475    /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
476    ///
477    /// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
478    /// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
479    ///
480    /// Action
481    ///
482    ///
483    /// #### `query-tooltip`
484    ///  Emitted when the widget’s tooltip is about to be shown.
485    ///
486    /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
487    /// is true and the hover timeout has expired with the cursor hovering
488    /// above @widget; or emitted when @widget got focus in keyboard mode.
489    ///
490    /// Using the given coordinates, the signal handler should determine
491    /// whether a tooltip should be shown for @widget. If this is the case
492    /// true should be returned, false otherwise. Note that if @keyboard_mode
493    /// is true, the values of @x and @y are undefined and should not be used.
494    ///
495    /// The signal handler is free to manipulate @tooltip with the therefore
496    /// destined function calls.
497    ///
498    ///
499    ///
500    ///
501    /// #### `realize`
502    ///  Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
503    ///
504    /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
505    /// or the widget has been mapped (that is, it is going to be drawn).
506    ///
507    ///
508    ///
509    ///
510    /// #### `show`
511    ///  Emitted when @widget is shown.
512    ///
513    ///
514    ///
515    ///
516    /// #### `state-flags-changed`
517    ///  Emitted when the widget state changes.
518    ///
519    /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
520    ///
521    ///
522    ///
523    ///
524    /// #### `unmap`
525    ///  Emitted when @widget is going to be unmapped.
526    ///
527    /// A widget is unmapped when either it or any of its parents up to the
528    /// toplevel widget have been set as hidden.
529    ///
530    /// As `::unmap` indicates that a widget will not be shown any longer,
531    /// it can be used to, for example, stop an animation on the widget.
532    ///
533    ///
534    ///
535    ///
536    /// #### `unrealize`
537    ///  Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
538    ///
539    /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
540    /// or the widget has been unmapped (that is, it is going to be hidden).
541    ///
542    ///
543    /// </details>
544    ///
545    /// # Implements
546    ///
547    /// [`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]
548    #[doc(alias = "GtkAppChooserButton")]
549    pub struct AppChooserButton(Object<ffi::GtkAppChooserButton>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, AppChooser;
550
551    match fn {
552        type_ => || ffi::gtk_app_chooser_button_get_type(),
553    }
554}
555
556impl AppChooserButton {
557    /// Creates a new [`AppChooserButton`][crate::AppChooserButton] for applications
558    /// that can handle content of the given type.
559    ///
560    /// # Deprecated since 4.10
561    ///
562    /// This widget will be removed in GTK 5
563    /// ## `content_type`
564    /// the content type to show applications for
565    ///
566    /// # Returns
567    ///
568    /// a newly created [`AppChooserButton`][crate::AppChooserButton]
569    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
570    #[allow(deprecated)]
571    #[doc(alias = "gtk_app_chooser_button_new")]
572    pub fn new(content_type: &str) -> AppChooserButton {
573        assert_initialized_main_thread!();
574        unsafe {
575            Widget::from_glib_none(ffi::gtk_app_chooser_button_new(
576                content_type.to_glib_none().0,
577            ))
578            .unsafe_cast()
579        }
580    }
581
582    // rustdoc-stripper-ignore-next
583    /// Creates a new builder-pattern struct instance to construct [`AppChooserButton`] objects.
584    ///
585    /// This method returns an instance of [`AppChooserButtonBuilder`](crate::builders::AppChooserButtonBuilder) which can be used to create [`AppChooserButton`] objects.
586    pub fn builder() -> AppChooserButtonBuilder {
587        AppChooserButtonBuilder::new()
588    }
589
590    /// Appends a custom item to the list of applications that is shown
591    /// in the popup.
592    ///
593    /// The item name must be unique per-widget. Clients can use the
594    /// provided name as a detail for the
595    /// [`custom-item-activated`][struct@crate::AppChooserButton#custom-item-activated] signal, to add a
596    /// callback for the activation of a particular custom item in the list.
597    ///
598    /// See also [`append_separator()`][Self::append_separator()].
599    ///
600    /// # Deprecated since 4.10
601    ///
602    /// This widget will be removed in GTK 5
603    /// ## `name`
604    /// the name of the custom item
605    /// ## `label`
606    /// the label for the custom item
607    /// ## `icon`
608    /// the icon for the custom item
609    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
610    #[allow(deprecated)]
611    #[doc(alias = "gtk_app_chooser_button_append_custom_item")]
612    pub fn append_custom_item(&self, name: &str, label: &str, icon: &impl IsA<gio::Icon>) {
613        unsafe {
614            ffi::gtk_app_chooser_button_append_custom_item(
615                self.to_glib_none().0,
616                name.to_glib_none().0,
617                label.to_glib_none().0,
618                icon.as_ref().to_glib_none().0,
619            );
620        }
621    }
622
623    /// Appends a separator to the list of applications that is shown
624    /// in the popup.
625    ///
626    /// # Deprecated since 4.10
627    ///
628    /// This widget will be removed in GTK 5
629    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
630    #[allow(deprecated)]
631    #[doc(alias = "gtk_app_chooser_button_append_separator")]
632    pub fn append_separator(&self) {
633        unsafe {
634            ffi::gtk_app_chooser_button_append_separator(self.to_glib_none().0);
635        }
636    }
637
638    /// Returns the text to display at the top of the dialog.
639    ///
640    /// # Deprecated since 4.10
641    ///
642    /// This widget will be removed in GTK 5
643    ///
644    /// # Returns
645    ///
646    /// the text to display at the top of the dialog,
647    ///   or [`None`], in which case a default text is displayed
648    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
649    #[allow(deprecated)]
650    #[doc(alias = "gtk_app_chooser_button_get_heading")]
651    #[doc(alias = "get_heading")]
652    pub fn heading(&self) -> Option<glib::GString> {
653        unsafe {
654            from_glib_none(ffi::gtk_app_chooser_button_get_heading(
655                self.to_glib_none().0,
656            ))
657        }
658    }
659
660    /// Gets whether the dialog is modal.
661    ///
662    /// # Deprecated since 4.10
663    ///
664    /// This widget will be removed in GTK 5
665    ///
666    /// # Returns
667    ///
668    /// [`true`] if the dialog is modal
669    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
670    #[allow(deprecated)]
671    #[doc(alias = "gtk_app_chooser_button_get_modal")]
672    #[doc(alias = "get_modal")]
673    #[doc(alias = "modal")]
674    pub fn is_modal(&self) -> bool {
675        unsafe { from_glib(ffi::gtk_app_chooser_button_get_modal(self.to_glib_none().0)) }
676    }
677
678    /// Returns whether the dropdown menu should show the default
679    /// application at the top.
680    ///
681    /// # Deprecated since 4.10
682    ///
683    /// This widget will be removed in GTK 5
684    ///
685    /// # Returns
686    ///
687    /// the value of [`show-default-item`][struct@crate::AppChooserButton#show-default-item]
688    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
689    #[allow(deprecated)]
690    #[doc(alias = "gtk_app_chooser_button_get_show_default_item")]
691    #[doc(alias = "get_show_default_item")]
692    #[doc(alias = "show-default-item")]
693    pub fn shows_default_item(&self) -> bool {
694        unsafe {
695            from_glib(ffi::gtk_app_chooser_button_get_show_default_item(
696                self.to_glib_none().0,
697            ))
698        }
699    }
700
701    /// Returns whether the dropdown menu shows an item
702    /// for a [`AppChooserDialog`][crate::AppChooserDialog].
703    ///
704    /// # Deprecated since 4.10
705    ///
706    /// This widget will be removed in GTK 5
707    ///
708    /// # Returns
709    ///
710    /// the value of [`show-dialog-item`][struct@crate::AppChooserButton#show-dialog-item]
711    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
712    #[allow(deprecated)]
713    #[doc(alias = "gtk_app_chooser_button_get_show_dialog_item")]
714    #[doc(alias = "get_show_dialog_item")]
715    #[doc(alias = "show-dialog-item")]
716    pub fn shows_dialog_item(&self) -> bool {
717        unsafe {
718            from_glib(ffi::gtk_app_chooser_button_get_show_dialog_item(
719                self.to_glib_none().0,
720            ))
721        }
722    }
723
724    /// Selects a custom item.
725    ///
726    /// See [`append_custom_item()`][Self::append_custom_item()].
727    ///
728    /// Use [`AppChooserExt::refresh()`][crate::prelude::AppChooserExt::refresh()] to bring the selection
729    /// to its initial state.
730    ///
731    /// # Deprecated since 4.10
732    ///
733    /// This widget will be removed in GTK 5
734    /// ## `name`
735    /// the name of the custom item
736    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
737    #[allow(deprecated)]
738    #[doc(alias = "gtk_app_chooser_button_set_active_custom_item")]
739    pub fn set_active_custom_item(&self, name: &str) {
740        unsafe {
741            ffi::gtk_app_chooser_button_set_active_custom_item(
742                self.to_glib_none().0,
743                name.to_glib_none().0,
744            );
745        }
746    }
747
748    /// Sets the text to display at the top of the dialog.
749    ///
750    /// If the heading is not set, the dialog displays a default text.
751    ///
752    /// # Deprecated since 4.10
753    ///
754    /// This widget will be removed in GTK 5
755    /// ## `heading`
756    /// a string containing Pango markup
757    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
758    #[allow(deprecated)]
759    #[doc(alias = "gtk_app_chooser_button_set_heading")]
760    #[doc(alias = "heading")]
761    pub fn set_heading(&self, heading: &str) {
762        unsafe {
763            ffi::gtk_app_chooser_button_set_heading(
764                self.to_glib_none().0,
765                heading.to_glib_none().0,
766            );
767        }
768    }
769
770    /// Sets whether the dialog should be modal.
771    ///
772    /// # Deprecated since 4.10
773    ///
774    /// This widget will be removed in GTK 5
775    /// ## `modal`
776    /// [`true`] to make the dialog modal
777    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
778    #[allow(deprecated)]
779    #[doc(alias = "gtk_app_chooser_button_set_modal")]
780    #[doc(alias = "modal")]
781    pub fn set_modal(&self, modal: bool) {
782        unsafe {
783            ffi::gtk_app_chooser_button_set_modal(self.to_glib_none().0, modal.into_glib());
784        }
785    }
786
787    /// Sets whether the dropdown menu of this button should show the
788    /// default application for the given content type at top.
789    ///
790    /// # Deprecated since 4.10
791    ///
792    /// This widget will be removed in GTK 5
793    /// ## `setting`
794    /// the new value for [`show-default-item`][struct@crate::AppChooserButton#show-default-item]
795    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
796    #[allow(deprecated)]
797    #[doc(alias = "gtk_app_chooser_button_set_show_default_item")]
798    #[doc(alias = "show-default-item")]
799    pub fn set_show_default_item(&self, setting: bool) {
800        unsafe {
801            ffi::gtk_app_chooser_button_set_show_default_item(
802                self.to_glib_none().0,
803                setting.into_glib(),
804            );
805        }
806    }
807
808    /// Sets whether the dropdown menu of this button should show an
809    /// entry to trigger a [`AppChooserDialog`][crate::AppChooserDialog].
810    ///
811    /// # Deprecated since 4.10
812    ///
813    /// This widget will be removed in GTK 5
814    /// ## `setting`
815    /// the new value for [`show-dialog-item`][struct@crate::AppChooserButton#show-dialog-item]
816    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
817    #[allow(deprecated)]
818    #[doc(alias = "gtk_app_chooser_button_set_show_dialog_item")]
819    #[doc(alias = "show-dialog-item")]
820    pub fn set_show_dialog_item(&self, setting: bool) {
821        unsafe {
822            ffi::gtk_app_chooser_button_set_show_dialog_item(
823                self.to_glib_none().0,
824                setting.into_glib(),
825            );
826        }
827    }
828
829    /// Emitted to when the button is activated.
830    ///
831    /// The `::activate` signal on [`AppChooserButton`][crate::AppChooserButton] is an action signal and
832    /// emitting it causes the button to pop up its dialog.
833    #[cfg(feature = "v4_4")]
834    #[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
835    #[doc(alias = "activate")]
836    pub fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
837        unsafe extern "C" fn activate_trampoline<F: Fn(&AppChooserButton) + 'static>(
838            this: *mut ffi::GtkAppChooserButton,
839            f: glib::ffi::gpointer,
840        ) {
841            let f: &F = &*(f as *const F);
842            f(&from_glib_borrow(this))
843        }
844        unsafe {
845            let f: Box_<F> = Box_::new(f);
846            connect_raw(
847                self.as_ptr() as *mut _,
848                b"activate\0".as_ptr() as *const _,
849                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
850                    activate_trampoline::<F> as *const (),
851                )),
852                Box_::into_raw(f),
853            )
854        }
855    }
856
857    #[cfg(feature = "v4_4")]
858    #[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
859    pub fn emit_activate(&self) {
860        self.emit_by_name::<()>("activate", &[]);
861    }
862
863    /// Emitted when the active application changes.
864    #[doc(alias = "changed")]
865    pub fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
866        unsafe extern "C" fn changed_trampoline<F: Fn(&AppChooserButton) + 'static>(
867            this: *mut ffi::GtkAppChooserButton,
868            f: glib::ffi::gpointer,
869        ) {
870            let f: &F = &*(f as *const F);
871            f(&from_glib_borrow(this))
872        }
873        unsafe {
874            let f: Box_<F> = Box_::new(f);
875            connect_raw(
876                self.as_ptr() as *mut _,
877                b"changed\0".as_ptr() as *const _,
878                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
879                    changed_trampoline::<F> as *const (),
880                )),
881                Box_::into_raw(f),
882            )
883        }
884    }
885
886    /// Emitted when a custom item is activated.
887    ///
888    /// Use [`append_custom_item()`][Self::append_custom_item()],
889    /// to add custom items.
890    /// ## `item_name`
891    /// the name of the activated item
892    #[doc(alias = "custom-item-activated")]
893    pub fn connect_custom_item_activated<F: Fn(&Self, &str) + 'static>(
894        &self,
895        detail: Option<&str>,
896        f: F,
897    ) -> SignalHandlerId {
898        unsafe extern "C" fn custom_item_activated_trampoline<
899            F: Fn(&AppChooserButton, &str) + 'static,
900        >(
901            this: *mut ffi::GtkAppChooserButton,
902            item_name: *mut std::ffi::c_char,
903            f: glib::ffi::gpointer,
904        ) {
905            let f: &F = &*(f as *const F);
906            f(
907                &from_glib_borrow(this),
908                &glib::GString::from_glib_borrow(item_name),
909            )
910        }
911        unsafe {
912            let f: Box_<F> = Box_::new(f);
913            let detailed_signal_name =
914                detail.map(|name| format!("custom-item-activated::{name}\0"));
915            let signal_name: &[u8] = detailed_signal_name
916                .as_ref()
917                .map_or(&b"custom-item-activated\0"[..], |n| n.as_bytes());
918            connect_raw(
919                self.as_ptr() as *mut _,
920                signal_name.as_ptr() as *const _,
921                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
922                    custom_item_activated_trampoline::<F> as *const (),
923                )),
924                Box_::into_raw(f),
925            )
926        }
927    }
928
929    #[doc(alias = "heading")]
930    pub fn connect_heading_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
931        unsafe extern "C" fn notify_heading_trampoline<F: Fn(&AppChooserButton) + 'static>(
932            this: *mut ffi::GtkAppChooserButton,
933            _param_spec: glib::ffi::gpointer,
934            f: glib::ffi::gpointer,
935        ) {
936            let f: &F = &*(f as *const F);
937            f(&from_glib_borrow(this))
938        }
939        unsafe {
940            let f: Box_<F> = Box_::new(f);
941            connect_raw(
942                self.as_ptr() as *mut _,
943                b"notify::heading\0".as_ptr() as *const _,
944                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
945                    notify_heading_trampoline::<F> as *const (),
946                )),
947                Box_::into_raw(f),
948            )
949        }
950    }
951
952    #[doc(alias = "modal")]
953    pub fn connect_modal_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
954        unsafe extern "C" fn notify_modal_trampoline<F: Fn(&AppChooserButton) + 'static>(
955            this: *mut ffi::GtkAppChooserButton,
956            _param_spec: glib::ffi::gpointer,
957            f: glib::ffi::gpointer,
958        ) {
959            let f: &F = &*(f as *const F);
960            f(&from_glib_borrow(this))
961        }
962        unsafe {
963            let f: Box_<F> = Box_::new(f);
964            connect_raw(
965                self.as_ptr() as *mut _,
966                b"notify::modal\0".as_ptr() as *const _,
967                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
968                    notify_modal_trampoline::<F> as *const (),
969                )),
970                Box_::into_raw(f),
971            )
972        }
973    }
974
975    #[doc(alias = "show-default-item")]
976    pub fn connect_show_default_item_notify<F: Fn(&Self) + 'static>(
977        &self,
978        f: F,
979    ) -> SignalHandlerId {
980        unsafe extern "C" fn notify_show_default_item_trampoline<
981            F: Fn(&AppChooserButton) + 'static,
982        >(
983            this: *mut ffi::GtkAppChooserButton,
984            _param_spec: glib::ffi::gpointer,
985            f: glib::ffi::gpointer,
986        ) {
987            let f: &F = &*(f as *const F);
988            f(&from_glib_borrow(this))
989        }
990        unsafe {
991            let f: Box_<F> = Box_::new(f);
992            connect_raw(
993                self.as_ptr() as *mut _,
994                b"notify::show-default-item\0".as_ptr() as *const _,
995                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
996                    notify_show_default_item_trampoline::<F> as *const (),
997                )),
998                Box_::into_raw(f),
999            )
1000        }
1001    }
1002
1003    #[doc(alias = "show-dialog-item")]
1004    pub fn connect_show_dialog_item_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1005        unsafe extern "C" fn notify_show_dialog_item_trampoline<
1006            F: Fn(&AppChooserButton) + 'static,
1007        >(
1008            this: *mut ffi::GtkAppChooserButton,
1009            _param_spec: glib::ffi::gpointer,
1010            f: glib::ffi::gpointer,
1011        ) {
1012            let f: &F = &*(f as *const F);
1013            f(&from_glib_borrow(this))
1014        }
1015        unsafe {
1016            let f: Box_<F> = Box_::new(f);
1017            connect_raw(
1018                self.as_ptr() as *mut _,
1019                b"notify::show-dialog-item\0".as_ptr() as *const _,
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}