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