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 /// <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 let f: &F = &*(f as *const F);
845 f(&from_glib_borrow(this))
846 }
847 unsafe {
848 let f: Box_<F> = Box_::new(f);
849 connect_raw(
850 self.as_ptr() as *mut _,
851 c"activate".as_ptr() as *const _,
852 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
853 activate_trampoline::<F> as *const (),
854 )),
855 Box_::into_raw(f),
856 )
857 }
858 }
859
860 #[cfg(feature = "v4_4")]
861 #[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
862 pub fn emit_activate(&self) {
863 self.emit_by_name::<()>("activate", &[]);
864 }
865
866 /// Emitted when the active application changes.
867 #[doc(alias = "changed")]
868 pub fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
869 unsafe extern "C" fn changed_trampoline<F: Fn(&AppChooserButton) + 'static>(
870 this: *mut ffi::GtkAppChooserButton,
871 f: glib::ffi::gpointer,
872 ) {
873 let f: &F = &*(f as *const F);
874 f(&from_glib_borrow(this))
875 }
876 unsafe {
877 let f: Box_<F> = Box_::new(f);
878 connect_raw(
879 self.as_ptr() as *mut _,
880 c"changed".as_ptr() as *const _,
881 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
882 changed_trampoline::<F> as *const (),
883 )),
884 Box_::into_raw(f),
885 )
886 }
887 }
888
889 /// Emitted when a custom item is activated.
890 ///
891 /// Use [`append_custom_item()`][Self::append_custom_item()],
892 /// to add custom items.
893 /// ## `item_name`
894 /// the name of the activated item
895 #[doc(alias = "custom-item-activated")]
896 pub fn connect_custom_item_activated<F: Fn(&Self, &str) + 'static>(
897 &self,
898 detail: Option<&str>,
899 f: F,
900 ) -> SignalHandlerId {
901 unsafe extern "C" fn custom_item_activated_trampoline<
902 F: Fn(&AppChooserButton, &str) + 'static,
903 >(
904 this: *mut ffi::GtkAppChooserButton,
905 item_name: *mut std::ffi::c_char,
906 f: glib::ffi::gpointer,
907 ) {
908 let f: &F = &*(f as *const F);
909 f(
910 &from_glib_borrow(this),
911 &glib::GString::from_glib_borrow(item_name),
912 )
913 }
914 unsafe {
915 let f: Box_<F> = Box_::new(f);
916 let detailed_signal_name =
917 detail.map(|name| format!("custom-item-activated::{name}\0"));
918 let signal_name: &[u8] = detailed_signal_name
919 .as_ref()
920 .map_or(c"custom-item-activated".to_bytes(), |n| n.as_bytes());
921 connect_raw(
922 self.as_ptr() as *mut _,
923 signal_name.as_ptr() as *const _,
924 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
925 custom_item_activated_trampoline::<F> as *const (),
926 )),
927 Box_::into_raw(f),
928 )
929 }
930 }
931
932 #[doc(alias = "heading")]
933 pub fn connect_heading_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
934 unsafe extern "C" fn notify_heading_trampoline<F: Fn(&AppChooserButton) + 'static>(
935 this: *mut ffi::GtkAppChooserButton,
936 _param_spec: glib::ffi::gpointer,
937 f: glib::ffi::gpointer,
938 ) {
939 let f: &F = &*(f as *const F);
940 f(&from_glib_borrow(this))
941 }
942 unsafe {
943 let f: Box_<F> = Box_::new(f);
944 connect_raw(
945 self.as_ptr() as *mut _,
946 c"notify::heading".as_ptr() as *const _,
947 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
948 notify_heading_trampoline::<F> as *const (),
949 )),
950 Box_::into_raw(f),
951 )
952 }
953 }
954
955 #[doc(alias = "modal")]
956 pub fn connect_modal_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
957 unsafe extern "C" fn notify_modal_trampoline<F: Fn(&AppChooserButton) + 'static>(
958 this: *mut ffi::GtkAppChooserButton,
959 _param_spec: glib::ffi::gpointer,
960 f: glib::ffi::gpointer,
961 ) {
962 let f: &F = &*(f as *const F);
963 f(&from_glib_borrow(this))
964 }
965 unsafe {
966 let f: Box_<F> = Box_::new(f);
967 connect_raw(
968 self.as_ptr() as *mut _,
969 c"notify::modal".as_ptr() as *const _,
970 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
971 notify_modal_trampoline::<F> as *const (),
972 )),
973 Box_::into_raw(f),
974 )
975 }
976 }
977
978 #[doc(alias = "show-default-item")]
979 pub fn connect_show_default_item_notify<F: Fn(&Self) + 'static>(
980 &self,
981 f: F,
982 ) -> SignalHandlerId {
983 unsafe extern "C" fn notify_show_default_item_trampoline<
984 F: Fn(&AppChooserButton) + 'static,
985 >(
986 this: *mut ffi::GtkAppChooserButton,
987 _param_spec: glib::ffi::gpointer,
988 f: glib::ffi::gpointer,
989 ) {
990 let f: &F = &*(f as *const F);
991 f(&from_glib_borrow(this))
992 }
993 unsafe {
994 let f: Box_<F> = Box_::new(f);
995 connect_raw(
996 self.as_ptr() as *mut _,
997 c"notify::show-default-item".as_ptr() as *const _,
998 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
999 notify_show_default_item_trampoline::<F> as *const (),
1000 )),
1001 Box_::into_raw(f),
1002 )
1003 }
1004 }
1005
1006 #[doc(alias = "show-dialog-item")]
1007 pub fn connect_show_dialog_item_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1008 unsafe extern "C" fn notify_show_dialog_item_trampoline<
1009 F: Fn(&AppChooserButton) + 'static,
1010 >(
1011 this: *mut ffi::GtkAppChooserButton,
1012 _param_spec: glib::ffi::gpointer,
1013 f: glib::ffi::gpointer,
1014 ) {
1015 let f: &F = &*(f as *const F);
1016 f(&from_glib_borrow(this))
1017 }
1018 unsafe {
1019 let f: Box_<F> = Box_::new(f);
1020 connect_raw(
1021 self.as_ptr() as *mut _,
1022 c"notify::show-dialog-item".as_ptr() as *const _,
1023 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1024 notify_show_dialog_item_trampoline::<F> as *const (),
1025 )),
1026 Box_::into_raw(f),
1027 )
1028 }
1029 }
1030}
1031
1032impl Default for AppChooserButton {
1033 fn default() -> Self {
1034 glib::object::Object::new::<Self>()
1035 }
1036}
1037
1038// rustdoc-stripper-ignore-next
1039/// A [builder-pattern] type to construct [`AppChooserButton`] objects.
1040///
1041/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1042#[must_use = "The builder must be built to be used"]
1043pub struct AppChooserButtonBuilder {
1044 builder: glib::object::ObjectBuilder<'static, AppChooserButton>,
1045}
1046
1047impl AppChooserButtonBuilder {
1048 fn new() -> Self {
1049 Self {
1050 builder: glib::object::Object::builder(),
1051 }
1052 }
1053
1054 /// The text to show at the top of the dialog that can be
1055 /// opened from the button.
1056 ///
1057 /// The string may contain Pango markup.
1058 pub fn heading(self, heading: impl Into<glib::GString>) -> Self {
1059 Self {
1060 builder: self.builder.property("heading", heading.into()),
1061 }
1062 }
1063
1064 /// Whether the app chooser dialog should be modal.
1065 pub fn modal(self, modal: bool) -> Self {
1066 Self {
1067 builder: self.builder.property("modal", modal),
1068 }
1069 }
1070
1071 /// Determines whether the dropdown menu shows the default application
1072 /// on top for the provided content type.
1073 pub fn show_default_item(self, show_default_item: bool) -> Self {
1074 Self {
1075 builder: self
1076 .builder
1077 .property("show-default-item", show_default_item),
1078 }
1079 }
1080
1081 /// Determines whether the dropdown menu shows an item to open
1082 /// a [`AppChooserDialog`][crate::AppChooserDialog].
1083 pub fn show_dialog_item(self, show_dialog_item: bool) -> Self {
1084 Self {
1085 builder: self.builder.property("show-dialog-item", show_dialog_item),
1086 }
1087 }
1088
1089 /// Whether the widget or any of its descendents can accept
1090 /// the input focus.
1091 ///
1092 /// This property is meant to be set by widget implementations,
1093 /// typically in their instance init function.
1094 pub fn can_focus(self, can_focus: bool) -> Self {
1095 Self {
1096 builder: self.builder.property("can-focus", can_focus),
1097 }
1098 }
1099
1100 /// Whether the widget can receive pointer events.
1101 pub fn can_target(self, can_target: bool) -> Self {
1102 Self {
1103 builder: self.builder.property("can-target", can_target),
1104 }
1105 }
1106
1107 /// A list of css classes applied to this widget.
1108 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1109 Self {
1110 builder: self.builder.property("css-classes", css_classes.into()),
1111 }
1112 }
1113
1114 /// The name of this widget in the CSS tree.
1115 ///
1116 /// This property is meant to be set by widget implementations,
1117 /// typically in their instance init function.
1118 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1119 Self {
1120 builder: self.builder.property("css-name", css_name.into()),
1121 }
1122 }
1123
1124 /// The cursor used by @widget.
1125 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1126 Self {
1127 builder: self.builder.property("cursor", cursor.clone()),
1128 }
1129 }
1130
1131 /// Whether the widget should grab focus when it is clicked with the mouse.
1132 ///
1133 /// This property is only relevant for widgets that can take focus.
1134 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1135 Self {
1136 builder: self.builder.property("focus-on-click", focus_on_click),
1137 }
1138 }
1139
1140 /// Whether this widget itself will accept the input focus.
1141 pub fn focusable(self, focusable: bool) -> Self {
1142 Self {
1143 builder: self.builder.property("focusable", focusable),
1144 }
1145 }
1146
1147 /// How to distribute horizontal space if widget gets extra space.
1148 pub fn halign(self, halign: Align) -> Self {
1149 Self {
1150 builder: self.builder.property("halign", halign),
1151 }
1152 }
1153
1154 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1155 /// signal on @widget.
1156 ///
1157 /// A true value indicates that @widget can have a tooltip, in this case
1158 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1159 /// determine whether it will provide a tooltip or not.
1160 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1161 Self {
1162 builder: self.builder.property("has-tooltip", has_tooltip),
1163 }
1164 }
1165
1166 /// Overrides for height request of the widget.
1167 ///
1168 /// If this is -1, the natural request will be used.
1169 pub fn height_request(self, height_request: i32) -> Self {
1170 Self {
1171 builder: self.builder.property("height-request", height_request),
1172 }
1173 }
1174
1175 /// Whether to expand horizontally.
1176 pub fn hexpand(self, hexpand: bool) -> Self {
1177 Self {
1178 builder: self.builder.property("hexpand", hexpand),
1179 }
1180 }
1181
1182 /// Whether to use the `hexpand` property.
1183 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1184 Self {
1185 builder: self.builder.property("hexpand-set", hexpand_set),
1186 }
1187 }
1188
1189 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1190 /// the preferred size of the widget, and allocate its children.
1191 ///
1192 /// This property is meant to be set by widget implementations,
1193 /// typically in their instance init function.
1194 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1195 Self {
1196 builder: self
1197 .builder
1198 .property("layout-manager", layout_manager.clone().upcast()),
1199 }
1200 }
1201
1202 /// Makes this widget act like a modal dialog, with respect to
1203 /// event delivery.
1204 ///
1205 /// Global event controllers will not handle events with targets
1206 /// inside the widget, unless they are set up to ignore propagation
1207 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1208 #[cfg(feature = "v4_18")]
1209 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1210 pub fn limit_events(self, limit_events: bool) -> Self {
1211 Self {
1212 builder: self.builder.property("limit-events", limit_events),
1213 }
1214 }
1215
1216 /// Margin on bottom side of widget.
1217 ///
1218 /// This property adds margin outside of the widget's normal size
1219 /// request, the margin will be added in addition to the size from
1220 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1221 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1222 Self {
1223 builder: self.builder.property("margin-bottom", margin_bottom),
1224 }
1225 }
1226
1227 /// Margin on end of widget, horizontally.
1228 ///
1229 /// This property supports left-to-right and right-to-left text
1230 /// directions.
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_end(self, margin_end: i32) -> Self {
1236 Self {
1237 builder: self.builder.property("margin-end", margin_end),
1238 }
1239 }
1240
1241 /// Margin on start 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_start(self, margin_start: i32) -> Self {
1250 Self {
1251 builder: self.builder.property("margin-start", margin_start),
1252 }
1253 }
1254
1255 /// Margin on top side of widget.
1256 ///
1257 /// This property adds margin outside of the widget's normal size
1258 /// request, the margin will be added in addition to the size from
1259 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1260 pub fn margin_top(self, margin_top: i32) -> Self {
1261 Self {
1262 builder: self.builder.property("margin-top", margin_top),
1263 }
1264 }
1265
1266 /// The name of the widget.
1267 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1268 Self {
1269 builder: self.builder.property("name", name.into()),
1270 }
1271 }
1272
1273 /// The requested opacity of the widget.
1274 pub fn opacity(self, opacity: f64) -> Self {
1275 Self {
1276 builder: self.builder.property("opacity", opacity),
1277 }
1278 }
1279
1280 /// How content outside the widget's content area is treated.
1281 ///
1282 /// This property is meant to be set by widget implementations,
1283 /// typically in their instance init function.
1284 pub fn overflow(self, overflow: Overflow) -> Self {
1285 Self {
1286 builder: self.builder.property("overflow", overflow),
1287 }
1288 }
1289
1290 /// Whether the widget will receive the default action when it is focused.
1291 pub fn receives_default(self, receives_default: bool) -> Self {
1292 Self {
1293 builder: self.builder.property("receives-default", receives_default),
1294 }
1295 }
1296
1297 /// Whether the widget responds to input.
1298 pub fn sensitive(self, sensitive: bool) -> Self {
1299 Self {
1300 builder: self.builder.property("sensitive", sensitive),
1301 }
1302 }
1303
1304 /// Sets the text of tooltip to be the given string, which is marked up
1305 /// with Pango markup.
1306 ///
1307 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1308 ///
1309 /// This is a convenience property which will take care of getting the
1310 /// tooltip shown if the given string is not `NULL`:
1311 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1312 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1313 /// the default signal handler.
1314 ///
1315 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1316 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1317 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1318 Self {
1319 builder: self
1320 .builder
1321 .property("tooltip-markup", tooltip_markup.into()),
1322 }
1323 }
1324
1325 /// Sets the text of tooltip to be the given string.
1326 ///
1327 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1328 ///
1329 /// This is a convenience property which will take care of getting the
1330 /// tooltip shown if the given string is not `NULL`:
1331 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1332 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1333 /// the default signal handler.
1334 ///
1335 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1336 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1337 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1338 Self {
1339 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1340 }
1341 }
1342
1343 /// How to distribute vertical space if widget gets extra space.
1344 pub fn valign(self, valign: Align) -> Self {
1345 Self {
1346 builder: self.builder.property("valign", valign),
1347 }
1348 }
1349
1350 /// Whether to expand vertically.
1351 pub fn vexpand(self, vexpand: bool) -> Self {
1352 Self {
1353 builder: self.builder.property("vexpand", vexpand),
1354 }
1355 }
1356
1357 /// Whether to use the `vexpand` property.
1358 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1359 Self {
1360 builder: self.builder.property("vexpand-set", vexpand_set),
1361 }
1362 }
1363
1364 /// Whether the widget is visible.
1365 pub fn visible(self, visible: bool) -> Self {
1366 Self {
1367 builder: self.builder.property("visible", visible),
1368 }
1369 }
1370
1371 /// Overrides for width request of the widget.
1372 ///
1373 /// If this is -1, the natural request will be used.
1374 pub fn width_request(self, width_request: i32) -> Self {
1375 Self {
1376 builder: self.builder.property("width-request", width_request),
1377 }
1378 }
1379
1380 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1381 ///
1382 /// The accessible role cannot be changed once set.
1383 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1384 Self {
1385 builder: self.builder.property("accessible-role", accessible_role),
1386 }
1387 }
1388
1389 /// The content type of the [`AppChooser`][crate::AppChooser] object.
1390 ///
1391 /// See `GContentType` for more information about content types.
1392 pub fn content_type(self, content_type: impl Into<glib::GString>) -> Self {
1393 Self {
1394 builder: self.builder.property("content-type", content_type.into()),
1395 }
1396 }
1397
1398 // rustdoc-stripper-ignore-next
1399 /// Build the [`AppChooserButton`].
1400 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1401 pub fn build(self) -> AppChooserButton {
1402 assert_initialized_main_thread!();
1403 self.builder.build()
1404 }
1405}