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