gtk4/auto/app_chooser_button.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4#![allow(deprecated)]
5
6#[cfg(feature = "v4_10")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
8use crate::Accessible;
9use crate::{
10 AccessibleRole, Align, AppChooser, Buildable, ConstraintTarget, LayoutManager, Overflow,
11 Widget, ffi,
12};
13use glib::{
14 object::ObjectType as _,
15 prelude::*,
16 signal::{SignalHandlerId, connect_raw},
17 translate::*,
18};
19use std::boxed::Box as Box_;
20
21#[cfg(feature = "v4_10")]
22#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
23glib::wrapper! {
24 /// The application selection widgets should be
25 /// implemented according to the design of each platform and/or
26 /// application requiring them.
27 ///
28 ///
29 /// 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 | Writable
63 ///
64 ///
65 /// #### `modal`
66 /// Whether the app chooser dialog should be modal.
67 ///
68 /// Readable | Writable | 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 | Writable | 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 | Writable | 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 | Writable
94 ///
95 ///
96 /// #### `can-target`
97 /// Whether the widget can receive pointer events.
98 ///
99 /// Readable | Writable
100 ///
101 ///
102 /// #### `css-classes`
103 /// A list of css classes applied to this widget.
104 ///
105 /// Readable | Writable
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 | Writable | Construct Only
115 ///
116 ///
117 /// #### `cursor`
118 /// The cursor used by @widget.
119 ///
120 /// Readable | Writable
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 | Writable
129 ///
130 ///
131 /// #### `focusable`
132 /// Whether this widget itself will accept the input focus.
133 ///
134 /// Readable | Writable
135 ///
136 ///
137 /// #### `halign`
138 /// How to distribute horizontal space if widget gets extra space.
139 ///
140 /// Readable | Writable
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 | Writable
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 | Writable
172 ///
173 ///
174 /// #### `hexpand`
175 /// Whether to expand horizontally.
176 ///
177 /// Readable | Writable
178 ///
179 ///
180 /// #### `hexpand-set`
181 /// Whether to use the `hexpand` property.
182 ///
183 /// Readable | Writable
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 | Writable
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 | Writable
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 | Writable
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 | Writable
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 | Writable
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 | Writable
251 ///
252 ///
253 /// #### `name`
254 /// The name of the widget.
255 ///
256 /// Readable | Writable
257 ///
258 ///
259 /// #### `opacity`
260 /// The requested opacity of the widget.
261 ///
262 /// Readable | Writable
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 | Writable
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 | Writable
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 | Writable
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 | Writable
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 | Writable
339 ///
340 ///
341 /// #### `valign`
342 /// How to distribute vertical space if widget gets extra space.
343 ///
344 /// Readable | Writable
345 ///
346 ///
347 /// #### `vexpand`
348 /// Whether to expand vertically.
349 ///
350 /// Readable | Writable
351 ///
352 ///
353 /// #### `vexpand-set`
354 /// Whether to use the `vexpand` property.
355 ///
356 /// Readable | Writable
357 ///
358 ///
359 /// #### `visible`
360 /// Whether the widget is visible.
361 ///
362 /// Readable | Writable
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 | Writable
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 | Writable
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 | Writable | 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 /// to move backward.
477 ///
478 /// Action
479 ///
480 ///
481 /// #### `query-tooltip`
482 /// Emitted when the widget’s tooltip is about to be shown.
483 ///
484 /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
485 /// is true and the hover timeout has expired with the cursor hovering
486 /// above @widget; or emitted when @widget got focus in keyboard mode.
487 ///
488 /// Using the given coordinates, the signal handler should determine
489 /// whether a tooltip should be shown for @widget. If this is the case
490 /// true should be returned, false otherwise. Note that if @keyboard_mode
491 /// is true, the values of @x and @y are undefined and should not be used.
492 ///
493 /// The signal handler is free to manipulate @tooltip with the therefore
494 /// destined function calls.
495 ///
496 ///
497 ///
498 ///
499 /// #### `realize`
500 /// Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
501 ///
502 /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
503 /// or the widget has been mapped (that is, it is going to be drawn).
504 ///
505 ///
506 ///
507 ///
508 /// #### `show`
509 /// Emitted when @widget is shown.
510 ///
511 ///
512 ///
513 ///
514 /// #### `state-flags-changed`
515 /// Emitted when the widget state changes.
516 ///
517 /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
518 ///
519 ///
520 ///
521 ///
522 /// #### `unmap`
523 /// Emitted when @widget is going to be unmapped.
524 ///
525 /// A widget is unmapped when either it or any of its parents up to the
526 /// toplevel widget have been set as hidden.
527 ///
528 /// As `::unmap` indicates that a widget will not be shown any longer,
529 /// it can be used to, for example, stop an animation on the widget.
530 ///
531 ///
532 ///
533 ///
534 /// #### `unrealize`
535 /// Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
536 ///
537 /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
538 /// or the widget has been unmapped (that is, it is going to be hidden).
539 ///
540 ///
541 /// </details>
542 ///
543 /// # Implements
544 ///
545 /// [`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]
546 #[doc(alias = "GtkAppChooserButton")]
547 pub struct AppChooserButton(Object<ffi::GtkAppChooserButton>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, AppChooser;
548
549 match fn {
550 type_ => || ffi::gtk_app_chooser_button_get_type(),
551 }
552}
553
554#[cfg(not(feature = "v4_10"))]
555glib::wrapper! {
556 #[doc(alias = "GtkAppChooserButton")]
557 pub struct AppChooserButton(Object<ffi::GtkAppChooserButton>) @extends Widget, @implements Buildable, ConstraintTarget, AppChooser;
558
559 match fn {
560 type_ => || ffi::gtk_app_chooser_button_get_type(),
561 }
562}
563
564impl AppChooserButton {
565 /// Creates a new [`AppChooserButton`][crate::AppChooserButton] for applications
566 /// that can handle content of the given type.
567 ///
568 /// # Deprecated since 4.10
569 ///
570 /// This widget will be removed in GTK 5
571 /// ## `content_type`
572 /// the content type to show applications for
573 ///
574 /// # Returns
575 ///
576 /// a newly created [`AppChooserButton`][crate::AppChooserButton]
577 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
578 #[allow(deprecated)]
579 #[doc(alias = "gtk_app_chooser_button_new")]
580 pub fn new(content_type: &str) -> AppChooserButton {
581 assert_initialized_main_thread!();
582 unsafe {
583 Widget::from_glib_none(ffi::gtk_app_chooser_button_new(
584 content_type.to_glib_none().0,
585 ))
586 .unsafe_cast()
587 }
588 }
589
590 // rustdoc-stripper-ignore-next
591 /// Creates a new builder-pattern struct instance to construct [`AppChooserButton`] objects.
592 ///
593 /// This method returns an instance of [`AppChooserButtonBuilder`](crate::builders::AppChooserButtonBuilder) which can be used to create [`AppChooserButton`] objects.
594 pub fn builder() -> AppChooserButtonBuilder {
595 AppChooserButtonBuilder::new()
596 }
597
598 /// Appends a custom item to the list of applications that is shown
599 /// in the popup.
600 ///
601 /// The item name must be unique per-widget. Clients can use the
602 /// provided name as a detail for the
603 /// [`custom-item-activated`][struct@crate::AppChooserButton#custom-item-activated] signal, to add a
604 /// callback for the activation of a particular custom item in the list.
605 ///
606 /// See also [`append_separator()`][Self::append_separator()].
607 ///
608 /// # Deprecated since 4.10
609 ///
610 /// This widget will be removed in GTK 5
611 /// ## `name`
612 /// the name of the custom item
613 /// ## `label`
614 /// the label for the custom item
615 /// ## `icon`
616 /// the icon for the custom item
617 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
618 #[allow(deprecated)]
619 #[doc(alias = "gtk_app_chooser_button_append_custom_item")]
620 pub fn append_custom_item(&self, name: &str, label: &str, icon: &impl IsA<gio::Icon>) {
621 unsafe {
622 ffi::gtk_app_chooser_button_append_custom_item(
623 self.to_glib_none().0,
624 name.to_glib_none().0,
625 label.to_glib_none().0,
626 icon.as_ref().to_glib_none().0,
627 );
628 }
629 }
630
631 /// Appends a separator to the list of applications that is shown
632 /// in the popup.
633 ///
634 /// # Deprecated since 4.10
635 ///
636 /// This widget will be removed in GTK 5
637 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
638 #[allow(deprecated)]
639 #[doc(alias = "gtk_app_chooser_button_append_separator")]
640 pub fn append_separator(&self) {
641 unsafe {
642 ffi::gtk_app_chooser_button_append_separator(self.to_glib_none().0);
643 }
644 }
645
646 /// Returns the text to display at the top of the dialog.
647 ///
648 /// # Deprecated since 4.10
649 ///
650 /// This widget will be removed in GTK 5
651 ///
652 /// # Returns
653 ///
654 /// the text to display at the top of the dialog,
655 /// or [`None`], in which case a default text is displayed
656 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
657 #[allow(deprecated)]
658 #[doc(alias = "gtk_app_chooser_button_get_heading")]
659 #[doc(alias = "get_heading")]
660 pub fn heading(&self) -> Option<glib::GString> {
661 unsafe {
662 from_glib_none(ffi::gtk_app_chooser_button_get_heading(
663 self.to_glib_none().0,
664 ))
665 }
666 }
667
668 /// Gets whether the dialog is modal.
669 ///
670 /// # Deprecated since 4.10
671 ///
672 /// This widget will be removed in GTK 5
673 ///
674 /// # Returns
675 ///
676 /// [`true`] if the dialog is modal
677 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
678 #[allow(deprecated)]
679 #[doc(alias = "gtk_app_chooser_button_get_modal")]
680 #[doc(alias = "get_modal")]
681 #[doc(alias = "modal")]
682 pub fn is_modal(&self) -> bool {
683 unsafe { from_glib(ffi::gtk_app_chooser_button_get_modal(self.to_glib_none().0)) }
684 }
685
686 /// Returns whether the dropdown menu should show the default
687 /// application at the top.
688 ///
689 /// # Deprecated since 4.10
690 ///
691 /// This widget will be removed in GTK 5
692 ///
693 /// # Returns
694 ///
695 /// the value of [`show-default-item`][struct@crate::AppChooserButton#show-default-item]
696 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
697 #[allow(deprecated)]
698 #[doc(alias = "gtk_app_chooser_button_get_show_default_item")]
699 #[doc(alias = "get_show_default_item")]
700 #[doc(alias = "show-default-item")]
701 pub fn shows_default_item(&self) -> bool {
702 unsafe {
703 from_glib(ffi::gtk_app_chooser_button_get_show_default_item(
704 self.to_glib_none().0,
705 ))
706 }
707 }
708
709 /// Returns whether the dropdown menu shows an item
710 /// for a [`AppChooserDialog`][crate::AppChooserDialog].
711 ///
712 /// # Deprecated since 4.10
713 ///
714 /// This widget will be removed in GTK 5
715 ///
716 /// # Returns
717 ///
718 /// the value of [`show-dialog-item`][struct@crate::AppChooserButton#show-dialog-item]
719 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
720 #[allow(deprecated)]
721 #[doc(alias = "gtk_app_chooser_button_get_show_dialog_item")]
722 #[doc(alias = "get_show_dialog_item")]
723 #[doc(alias = "show-dialog-item")]
724 pub fn shows_dialog_item(&self) -> bool {
725 unsafe {
726 from_glib(ffi::gtk_app_chooser_button_get_show_dialog_item(
727 self.to_glib_none().0,
728 ))
729 }
730 }
731
732 /// Selects a custom item.
733 ///
734 /// See [`append_custom_item()`][Self::append_custom_item()].
735 ///
736 /// Use [`AppChooserExt::refresh()`][crate::prelude::AppChooserExt::refresh()] to bring the selection
737 /// to its initial state.
738 ///
739 /// # Deprecated since 4.10
740 ///
741 /// This widget will be removed in GTK 5
742 /// ## `name`
743 /// the name of the custom item
744 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
745 #[allow(deprecated)]
746 #[doc(alias = "gtk_app_chooser_button_set_active_custom_item")]
747 pub fn set_active_custom_item(&self, name: &str) {
748 unsafe {
749 ffi::gtk_app_chooser_button_set_active_custom_item(
750 self.to_glib_none().0,
751 name.to_glib_none().0,
752 );
753 }
754 }
755
756 /// Sets the text to display at the top of the dialog.
757 ///
758 /// If the heading is not set, the dialog displays a default text.
759 ///
760 /// # Deprecated since 4.10
761 ///
762 /// This widget will be removed in GTK 5
763 /// ## `heading`
764 /// a string containing Pango markup
765 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
766 #[allow(deprecated)]
767 #[doc(alias = "gtk_app_chooser_button_set_heading")]
768 #[doc(alias = "heading")]
769 pub fn set_heading(&self, heading: &str) {
770 unsafe {
771 ffi::gtk_app_chooser_button_set_heading(
772 self.to_glib_none().0,
773 heading.to_glib_none().0,
774 );
775 }
776 }
777
778 /// Sets whether the dialog should be modal.
779 ///
780 /// # Deprecated since 4.10
781 ///
782 /// This widget will be removed in GTK 5
783 /// ## `modal`
784 /// [`true`] to make the dialog modal
785 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
786 #[allow(deprecated)]
787 #[doc(alias = "gtk_app_chooser_button_set_modal")]
788 #[doc(alias = "modal")]
789 pub fn set_modal(&self, modal: bool) {
790 unsafe {
791 ffi::gtk_app_chooser_button_set_modal(self.to_glib_none().0, modal.into_glib());
792 }
793 }
794
795 /// Sets whether the dropdown menu of this button should show the
796 /// default application for the given content type at top.
797 ///
798 /// # Deprecated since 4.10
799 ///
800 /// This widget will be removed in GTK 5
801 /// ## `setting`
802 /// the new value for [`show-default-item`][struct@crate::AppChooserButton#show-default-item]
803 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
804 #[allow(deprecated)]
805 #[doc(alias = "gtk_app_chooser_button_set_show_default_item")]
806 #[doc(alias = "show-default-item")]
807 pub fn set_show_default_item(&self, setting: bool) {
808 unsafe {
809 ffi::gtk_app_chooser_button_set_show_default_item(
810 self.to_glib_none().0,
811 setting.into_glib(),
812 );
813 }
814 }
815
816 /// Sets whether the dropdown menu of this button should show an
817 /// entry to trigger a [`AppChooserDialog`][crate::AppChooserDialog].
818 ///
819 /// # Deprecated since 4.10
820 ///
821 /// This widget will be removed in GTK 5
822 /// ## `setting`
823 /// the new value for [`show-dialog-item`][struct@crate::AppChooserButton#show-dialog-item]
824 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
825 #[allow(deprecated)]
826 #[doc(alias = "gtk_app_chooser_button_set_show_dialog_item")]
827 #[doc(alias = "show-dialog-item")]
828 pub fn set_show_dialog_item(&self, setting: bool) {
829 unsafe {
830 ffi::gtk_app_chooser_button_set_show_dialog_item(
831 self.to_glib_none().0,
832 setting.into_glib(),
833 );
834 }
835 }
836
837 /// Emitted to when the button is activated.
838 ///
839 /// The `::activate` signal on [`AppChooserButton`][crate::AppChooserButton] is an action signal and
840 /// emitting it causes the button to pop up its dialog.
841 #[cfg(feature = "v4_4")]
842 #[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
843 #[doc(alias = "activate")]
844 pub fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
845 unsafe extern "C" fn activate_trampoline<F: Fn(&AppChooserButton) + 'static>(
846 this: *mut ffi::GtkAppChooserButton,
847 f: glib::ffi::gpointer,
848 ) {
849 unsafe {
850 let f: &F = &*(f as *const F);
851 f(&from_glib_borrow(this))
852 }
853 }
854 unsafe {
855 let f: Box_<F> = Box_::new(f);
856 connect_raw(
857 self.as_ptr() as *mut _,
858 c"activate".as_ptr(),
859 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
860 activate_trampoline::<F> as *const (),
861 )),
862 Box_::into_raw(f),
863 )
864 }
865 }
866
867 #[cfg(feature = "v4_4")]
868 #[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
869 pub fn emit_activate(&self) {
870 self.emit_by_name::<()>("activate", &[]);
871 }
872
873 /// Emitted when the active application changes.
874 #[doc(alias = "changed")]
875 pub fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
876 unsafe extern "C" fn changed_trampoline<F: Fn(&AppChooserButton) + 'static>(
877 this: *mut ffi::GtkAppChooserButton,
878 f: glib::ffi::gpointer,
879 ) {
880 unsafe {
881 let f: &F = &*(f as *const F);
882 f(&from_glib_borrow(this))
883 }
884 }
885 unsafe {
886 let f: Box_<F> = Box_::new(f);
887 connect_raw(
888 self.as_ptr() as *mut _,
889 c"changed".as_ptr(),
890 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
891 changed_trampoline::<F> as *const (),
892 )),
893 Box_::into_raw(f),
894 )
895 }
896 }
897
898 /// Emitted when a custom item is activated.
899 ///
900 /// Use [`append_custom_item()`][Self::append_custom_item()],
901 /// to add custom items.
902 /// ## `item_name`
903 /// the name of the activated item
904 #[doc(alias = "custom-item-activated")]
905 pub fn connect_custom_item_activated<F: Fn(&Self, &str) + 'static>(
906 &self,
907 detail: Option<&str>,
908 f: F,
909 ) -> SignalHandlerId {
910 unsafe extern "C" fn custom_item_activated_trampoline<
911 F: Fn(&AppChooserButton, &str) + 'static,
912 >(
913 this: *mut ffi::GtkAppChooserButton,
914 item_name: *mut std::ffi::c_char,
915 f: glib::ffi::gpointer,
916 ) {
917 unsafe {
918 let f: &F = &*(f as *const F);
919 f(
920 &from_glib_borrow(this),
921 &glib::GString::from_glib_borrow(item_name),
922 )
923 }
924 }
925 unsafe {
926 let f: Box_<F> = Box_::new(f);
927 let detailed_signal_name =
928 detail.map(|name| format!("custom-item-activated::{name}\0"));
929 let signal_name = detailed_signal_name
930 .as_ref()
931 .map_or(c"custom-item-activated", |n| {
932 std::ffi::CStr::from_bytes_with_nul_unchecked(n.as_bytes())
933 });
934 connect_raw(
935 self.as_ptr() as *mut _,
936 signal_name.as_ptr(),
937 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
938 custom_item_activated_trampoline::<F> as *const (),
939 )),
940 Box_::into_raw(f),
941 )
942 }
943 }
944
945 #[doc(alias = "heading")]
946 pub fn connect_heading_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
947 unsafe extern "C" fn notify_heading_trampoline<F: Fn(&AppChooserButton) + 'static>(
948 this: *mut ffi::GtkAppChooserButton,
949 _param_spec: glib::ffi::gpointer,
950 f: glib::ffi::gpointer,
951 ) {
952 unsafe {
953 let f: &F = &*(f as *const F);
954 f(&from_glib_borrow(this))
955 }
956 }
957 unsafe {
958 let f: Box_<F> = Box_::new(f);
959 connect_raw(
960 self.as_ptr() as *mut _,
961 c"notify::heading".as_ptr(),
962 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
963 notify_heading_trampoline::<F> as *const (),
964 )),
965 Box_::into_raw(f),
966 )
967 }
968 }
969
970 #[doc(alias = "modal")]
971 pub fn connect_modal_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
972 unsafe extern "C" fn notify_modal_trampoline<F: Fn(&AppChooserButton) + 'static>(
973 this: *mut ffi::GtkAppChooserButton,
974 _param_spec: glib::ffi::gpointer,
975 f: glib::ffi::gpointer,
976 ) {
977 unsafe {
978 let f: &F = &*(f as *const F);
979 f(&from_glib_borrow(this))
980 }
981 }
982 unsafe {
983 let f: Box_<F> = Box_::new(f);
984 connect_raw(
985 self.as_ptr() as *mut _,
986 c"notify::modal".as_ptr(),
987 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
988 notify_modal_trampoline::<F> as *const (),
989 )),
990 Box_::into_raw(f),
991 )
992 }
993 }
994
995 #[doc(alias = "show-default-item")]
996 pub fn connect_show_default_item_notify<F: Fn(&Self) + 'static>(
997 &self,
998 f: F,
999 ) -> SignalHandlerId {
1000 unsafe extern "C" fn notify_show_default_item_trampoline<
1001 F: Fn(&AppChooserButton) + 'static,
1002 >(
1003 this: *mut ffi::GtkAppChooserButton,
1004 _param_spec: glib::ffi::gpointer,
1005 f: glib::ffi::gpointer,
1006 ) {
1007 unsafe {
1008 let f: &F = &*(f as *const F);
1009 f(&from_glib_borrow(this))
1010 }
1011 }
1012 unsafe {
1013 let f: Box_<F> = Box_::new(f);
1014 connect_raw(
1015 self.as_ptr() as *mut _,
1016 c"notify::show-default-item".as_ptr(),
1017 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1018 notify_show_default_item_trampoline::<F> as *const (),
1019 )),
1020 Box_::into_raw(f),
1021 )
1022 }
1023 }
1024
1025 #[doc(alias = "show-dialog-item")]
1026 pub fn connect_show_dialog_item_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1027 unsafe extern "C" fn notify_show_dialog_item_trampoline<
1028 F: Fn(&AppChooserButton) + 'static,
1029 >(
1030 this: *mut ffi::GtkAppChooserButton,
1031 _param_spec: glib::ffi::gpointer,
1032 f: glib::ffi::gpointer,
1033 ) {
1034 unsafe {
1035 let f: &F = &*(f as *const F);
1036 f(&from_glib_borrow(this))
1037 }
1038 }
1039 unsafe {
1040 let f: Box_<F> = Box_::new(f);
1041 connect_raw(
1042 self.as_ptr() as *mut _,
1043 c"notify::show-dialog-item".as_ptr(),
1044 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1045 notify_show_dialog_item_trampoline::<F> as *const (),
1046 )),
1047 Box_::into_raw(f),
1048 )
1049 }
1050 }
1051}
1052
1053impl Default for AppChooserButton {
1054 fn default() -> Self {
1055 glib::object::Object::new::<Self>()
1056 }
1057}
1058
1059// rustdoc-stripper-ignore-next
1060/// A [builder-pattern] type to construct [`AppChooserButton`] objects.
1061///
1062/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1063#[must_use = "The builder must be built to be used"]
1064pub struct AppChooserButtonBuilder {
1065 builder: glib::object::ObjectBuilder<'static, AppChooserButton>,
1066}
1067
1068impl AppChooserButtonBuilder {
1069 fn new() -> Self {
1070 Self {
1071 builder: glib::object::Object::builder(),
1072 }
1073 }
1074
1075 /// The text to show at the top of the dialog that can be
1076 /// opened from the button.
1077 ///
1078 /// The string may contain Pango markup.
1079 pub fn heading(self, heading: impl Into<glib::GString>) -> Self {
1080 Self {
1081 builder: self.builder.property("heading", heading.into()),
1082 }
1083 }
1084
1085 /// Whether the app chooser dialog should be modal.
1086 pub fn modal(self, modal: bool) -> Self {
1087 Self {
1088 builder: self.builder.property("modal", modal),
1089 }
1090 }
1091
1092 /// Determines whether the dropdown menu shows the default application
1093 /// on top for the provided content type.
1094 pub fn show_default_item(self, show_default_item: bool) -> Self {
1095 Self {
1096 builder: self
1097 .builder
1098 .property("show-default-item", show_default_item),
1099 }
1100 }
1101
1102 /// Determines whether the dropdown menu shows an item to open
1103 /// a [`AppChooserDialog`][crate::AppChooserDialog].
1104 pub fn show_dialog_item(self, show_dialog_item: bool) -> Self {
1105 Self {
1106 builder: self.builder.property("show-dialog-item", show_dialog_item),
1107 }
1108 }
1109
1110 /// Whether the widget or any of its descendents can accept
1111 /// the input focus.
1112 ///
1113 /// This property is meant to be set by widget implementations,
1114 /// typically in their instance init function.
1115 pub fn can_focus(self, can_focus: bool) -> Self {
1116 Self {
1117 builder: self.builder.property("can-focus", can_focus),
1118 }
1119 }
1120
1121 /// Whether the widget can receive pointer events.
1122 pub fn can_target(self, can_target: bool) -> Self {
1123 Self {
1124 builder: self.builder.property("can-target", can_target),
1125 }
1126 }
1127
1128 /// A list of css classes applied to this widget.
1129 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1130 Self {
1131 builder: self.builder.property("css-classes", css_classes.into()),
1132 }
1133 }
1134
1135 /// The name of this widget in the CSS tree.
1136 ///
1137 /// This property is meant to be set by widget implementations,
1138 /// typically in their instance init function.
1139 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1140 Self {
1141 builder: self.builder.property("css-name", css_name.into()),
1142 }
1143 }
1144
1145 /// The cursor used by @widget.
1146 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1147 Self {
1148 builder: self.builder.property("cursor", cursor.clone()),
1149 }
1150 }
1151
1152 /// Whether the widget should grab focus when it is clicked with the mouse.
1153 ///
1154 /// This property is only relevant for widgets that can take focus.
1155 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1156 Self {
1157 builder: self.builder.property("focus-on-click", focus_on_click),
1158 }
1159 }
1160
1161 /// Whether this widget itself will accept the input focus.
1162 pub fn focusable(self, focusable: bool) -> Self {
1163 Self {
1164 builder: self.builder.property("focusable", focusable),
1165 }
1166 }
1167
1168 /// How to distribute horizontal space if widget gets extra space.
1169 pub fn halign(self, halign: Align) -> Self {
1170 Self {
1171 builder: self.builder.property("halign", halign),
1172 }
1173 }
1174
1175 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1176 /// signal on @widget.
1177 ///
1178 /// A true value indicates that @widget can have a tooltip, in this case
1179 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1180 /// determine whether it will provide a tooltip or not.
1181 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1182 Self {
1183 builder: self.builder.property("has-tooltip", has_tooltip),
1184 }
1185 }
1186
1187 /// Overrides for height request of the widget.
1188 ///
1189 /// If this is -1, the natural request will be used.
1190 pub fn height_request(self, height_request: i32) -> Self {
1191 Self {
1192 builder: self.builder.property("height-request", height_request),
1193 }
1194 }
1195
1196 /// Whether to expand horizontally.
1197 pub fn hexpand(self, hexpand: bool) -> Self {
1198 Self {
1199 builder: self.builder.property("hexpand", hexpand),
1200 }
1201 }
1202
1203 /// Whether to use the `hexpand` property.
1204 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1205 Self {
1206 builder: self.builder.property("hexpand-set", hexpand_set),
1207 }
1208 }
1209
1210 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1211 /// the preferred size of the widget, and allocate its children.
1212 ///
1213 /// This property is meant to be set by widget implementations,
1214 /// typically in their instance init function.
1215 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1216 Self {
1217 builder: self
1218 .builder
1219 .property("layout-manager", layout_manager.clone().upcast()),
1220 }
1221 }
1222
1223 /// Makes this widget act like a modal dialog, with respect to
1224 /// event delivery.
1225 ///
1226 /// Global event controllers will not handle events with targets
1227 /// inside the widget, unless they are set up to ignore propagation
1228 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1229 #[cfg(feature = "v4_18")]
1230 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1231 pub fn limit_events(self, limit_events: bool) -> Self {
1232 Self {
1233 builder: self.builder.property("limit-events", limit_events),
1234 }
1235 }
1236
1237 /// Margin on bottom side of widget.
1238 ///
1239 /// This property adds margin outside of the widget's normal size
1240 /// request, the margin will be added in addition to the size from
1241 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1242 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1243 Self {
1244 builder: self.builder.property("margin-bottom", margin_bottom),
1245 }
1246 }
1247
1248 /// Margin on end of widget, horizontally.
1249 ///
1250 /// This property supports left-to-right and right-to-left text
1251 /// directions.
1252 ///
1253 /// This property adds margin outside of the widget's normal size
1254 /// request, the margin will be added in addition to the size from
1255 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1256 pub fn margin_end(self, margin_end: i32) -> Self {
1257 Self {
1258 builder: self.builder.property("margin-end", margin_end),
1259 }
1260 }
1261
1262 /// Margin on start of widget, horizontally.
1263 ///
1264 /// This property supports left-to-right and right-to-left text
1265 /// directions.
1266 ///
1267 /// This property adds margin outside of the widget's normal size
1268 /// request, the margin will be added in addition to the size from
1269 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1270 pub fn margin_start(self, margin_start: i32) -> Self {
1271 Self {
1272 builder: self.builder.property("margin-start", margin_start),
1273 }
1274 }
1275
1276 /// Margin on top side of widget.
1277 ///
1278 /// This property adds margin outside of the widget's normal size
1279 /// request, the margin will be added in addition to the size from
1280 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1281 pub fn margin_top(self, margin_top: i32) -> Self {
1282 Self {
1283 builder: self.builder.property("margin-top", margin_top),
1284 }
1285 }
1286
1287 /// The name of the widget.
1288 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1289 Self {
1290 builder: self.builder.property("name", name.into()),
1291 }
1292 }
1293
1294 /// The requested opacity of the widget.
1295 pub fn opacity(self, opacity: f64) -> Self {
1296 Self {
1297 builder: self.builder.property("opacity", opacity),
1298 }
1299 }
1300
1301 /// How content outside the widget's content area is treated.
1302 ///
1303 /// This property is meant to be set by widget implementations,
1304 /// typically in their instance init function.
1305 pub fn overflow(self, overflow: Overflow) -> Self {
1306 Self {
1307 builder: self.builder.property("overflow", overflow),
1308 }
1309 }
1310
1311 /// Whether the widget will receive the default action when it is focused.
1312 pub fn receives_default(self, receives_default: bool) -> Self {
1313 Self {
1314 builder: self.builder.property("receives-default", receives_default),
1315 }
1316 }
1317
1318 /// Whether the widget responds to input.
1319 pub fn sensitive(self, sensitive: bool) -> Self {
1320 Self {
1321 builder: self.builder.property("sensitive", sensitive),
1322 }
1323 }
1324
1325 /// Sets the text of tooltip to be the given string, which is marked up
1326 /// with Pango markup.
1327 ///
1328 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1329 ///
1330 /// This is a convenience property which will take care of getting the
1331 /// tooltip shown if the given string is not `NULL`:
1332 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1333 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1334 /// the default signal handler.
1335 ///
1336 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1337 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1338 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1339 Self {
1340 builder: self
1341 .builder
1342 .property("tooltip-markup", tooltip_markup.into()),
1343 }
1344 }
1345
1346 /// Sets the text of tooltip to be the given string.
1347 ///
1348 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1349 ///
1350 /// This is a convenience property which will take care of getting the
1351 /// tooltip shown if the given string is not `NULL`:
1352 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1353 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1354 /// the default signal handler.
1355 ///
1356 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1357 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1358 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1359 Self {
1360 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1361 }
1362 }
1363
1364 /// How to distribute vertical space if widget gets extra space.
1365 pub fn valign(self, valign: Align) -> Self {
1366 Self {
1367 builder: self.builder.property("valign", valign),
1368 }
1369 }
1370
1371 /// Whether to expand vertically.
1372 pub fn vexpand(self, vexpand: bool) -> Self {
1373 Self {
1374 builder: self.builder.property("vexpand", vexpand),
1375 }
1376 }
1377
1378 /// Whether to use the `vexpand` property.
1379 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1380 Self {
1381 builder: self.builder.property("vexpand-set", vexpand_set),
1382 }
1383 }
1384
1385 /// Whether the widget is visible.
1386 pub fn visible(self, visible: bool) -> Self {
1387 Self {
1388 builder: self.builder.property("visible", visible),
1389 }
1390 }
1391
1392 /// Overrides for width request of the widget.
1393 ///
1394 /// If this is -1, the natural request will be used.
1395 pub fn width_request(self, width_request: i32) -> Self {
1396 Self {
1397 builder: self.builder.property("width-request", width_request),
1398 }
1399 }
1400
1401 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1402 ///
1403 /// The accessible role cannot be changed once set.
1404 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1405 Self {
1406 builder: self.builder.property("accessible-role", accessible_role),
1407 }
1408 }
1409
1410 /// The content type of the [`AppChooser`][crate::AppChooser] object.
1411 ///
1412 /// See `GContentType` for more information about content types.
1413 pub fn content_type(self, content_type: impl Into<glib::GString>) -> Self {
1414 Self {
1415 builder: self.builder.property("content-type", content_type.into()),
1416 }
1417 }
1418
1419 // rustdoc-stripper-ignore-next
1420 /// Build the [`AppChooserButton`].
1421 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1422 pub fn build(self) -> AppChooserButton {
1423 assert_initialized_main_thread!();
1424 self.builder.build()
1425 }
1426}