gtk/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
5use crate::{
6 Align, AppChooser, BaselinePosition, Box, Buildable, Container, Menu, Orientable, Orientation,
7 ResizeMode, Widget, ffi,
8};
9use glib::{
10 object::ObjectType as _,
11 prelude::*,
12 signal::{SignalHandlerId, connect_raw},
13 translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18 /// [`AppChooserWidget`][crate::AppChooserWidget] is a widget for selecting applications.
19 /// It is the main building block for [`AppChooserDialog`][crate::AppChooserDialog]. Most
20 /// applications only need to use the latter; but you can use
21 /// this widget as part of a larger widget if you have special needs.
22 ///
23 /// [`AppChooserWidget`][crate::AppChooserWidget] offers detailed control over what applications
24 /// are shown, using the
25 /// [`show-default`][struct@crate::AppChooserWidget#show-default],
26 /// [`show-recommended`][struct@crate::AppChooserWidget#show-recommended],
27 /// [`show-fallback`][struct@crate::AppChooserWidget#show-fallback],
28 /// [`show-other`][struct@crate::AppChooserWidget#show-other] and
29 /// [`show-all`][struct@crate::AppChooserWidget#show-all]
30 /// properties. See the [`AppChooser`][crate::AppChooser] documentation for more information
31 /// about these groups of applications.
32 ///
33 /// To keep track of the selected application, use the
34 /// [`application-selected`][struct@crate::AppChooserWidget#application-selected] and [`application-activated`][struct@crate::AppChooserWidget#application-activated] signals.
35 ///
36 /// # CSS nodes
37 ///
38 /// GtkAppChooserWidget has a single CSS node with name appchooser.
39 ///
40 /// ## Properties
41 ///
42 ///
43 /// #### `default-text`
44 /// The [`default-text`][struct@crate::AppChooserWidget#default-text] property determines the text
45 /// that appears in the widget when there are no applications for the
46 /// given content type.
47 /// See also [`AppChooserWidgetExt::set_default_text()`][crate::prelude::AppChooserWidgetExt::set_default_text()].
48 ///
49 /// Readable | Writable
50 ///
51 ///
52 /// #### `show-all`
53 /// If the [`show-all`][struct@crate::AppChooserWidget#show-all] property is [`true`], the app
54 /// chooser presents all applications in a single list, without
55 /// subsections for default, recommended or related applications.
56 ///
57 /// Readable | Writable | Construct
58 ///
59 ///
60 /// #### `show-default`
61 /// The ::show-default property determines whether the app chooser
62 /// should show the default handler for the content type in a
63 /// separate section. If [`false`], the default handler is listed
64 /// among the recommended applications.
65 ///
66 /// Readable | Writable | Construct
67 ///
68 ///
69 /// #### `show-fallback`
70 /// The [`show-fallback`][struct@crate::AppChooserWidget#show-fallback] property determines whether
71 /// the app chooser should show a section for fallback applications.
72 /// If [`false`], the fallback applications are listed among the other
73 /// applications.
74 ///
75 /// Readable | Writable | Construct
76 ///
77 ///
78 /// #### `show-other`
79 /// The [`show-other`][struct@crate::AppChooserWidget#show-other] property determines whether
80 /// the app chooser should show a section for other applications.
81 ///
82 /// Readable | Writable | Construct
83 ///
84 ///
85 /// #### `show-recommended`
86 /// The [`show-recommended`][struct@crate::AppChooserWidget#show-recommended] property determines
87 /// whether the app chooser should show a section for recommended
88 /// applications. If [`false`], the recommended applications are listed
89 /// among the other applications.
90 ///
91 /// Readable | Writable | Construct
92 /// <details><summary><h4>Box</h4></summary>
93 ///
94 ///
95 /// #### `baseline-position`
96 /// Readable | Writable
97 ///
98 ///
99 /// #### `homogeneous`
100 /// Readable | Writable
101 ///
102 ///
103 /// #### `spacing`
104 /// Readable | Writable
105 /// </details>
106 /// <details><summary><h4>Container</h4></summary>
107 ///
108 ///
109 /// #### `border-width`
110 /// Readable | Writable
111 ///
112 ///
113 /// #### `child`
114 /// Writable
115 ///
116 ///
117 /// #### `resize-mode`
118 /// Readable | Writable
119 /// </details>
120 /// <details><summary><h4>Widget</h4></summary>
121 ///
122 ///
123 /// #### `app-paintable`
124 /// Readable | Writable
125 ///
126 ///
127 /// #### `can-default`
128 /// Readable | Writable
129 ///
130 ///
131 /// #### `can-focus`
132 /// Readable | Writable
133 ///
134 ///
135 /// #### `composite-child`
136 /// Readable
137 ///
138 ///
139 /// #### `double-buffered`
140 /// Whether the widget is double buffered.
141 ///
142 /// Readable | Writable
143 ///
144 ///
145 /// #### `events`
146 /// Readable | Writable
147 ///
148 ///
149 /// #### `expand`
150 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
151 ///
152 /// Readable | Writable
153 ///
154 ///
155 /// #### `focus-on-click`
156 /// Whether the widget should grab focus when it is clicked with the mouse.
157 ///
158 /// This property is only relevant for widgets that can take focus.
159 ///
160 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
161 /// GtkComboBox) implemented this property individually.
162 ///
163 /// Readable | Writable
164 ///
165 ///
166 /// #### `halign`
167 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
168 ///
169 /// Readable | Writable
170 ///
171 ///
172 /// #### `has-default`
173 /// Readable | Writable
174 ///
175 ///
176 /// #### `has-focus`
177 /// Readable | Writable
178 ///
179 ///
180 /// #### `has-tooltip`
181 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
182 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
183 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
184 /// whether it will provide a tooltip or not.
185 ///
186 /// Note that setting this property to [`true`] for the first time will change
187 /// the event masks of the GdkWindows of this widget to include leave-notify
188 /// and motion-notify events. This cannot and will not be undone when the
189 /// property is set to [`false`] again.
190 ///
191 /// Readable | Writable
192 ///
193 ///
194 /// #### `height-request`
195 /// Readable | Writable
196 ///
197 ///
198 /// #### `hexpand`
199 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
200 ///
201 /// Readable | Writable
202 ///
203 ///
204 /// #### `hexpand-set`
205 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
206 ///
207 /// Readable | Writable
208 ///
209 ///
210 /// #### `is-focus`
211 /// Readable | Writable
212 ///
213 ///
214 /// #### `margin`
215 /// Sets all four sides' margin at once. If read, returns max
216 /// margin on any side.
217 ///
218 /// Readable | Writable
219 ///
220 ///
221 /// #### `margin-bottom`
222 /// Margin on bottom side of widget.
223 ///
224 /// This property adds margin outside of the widget's normal size
225 /// request, the margin will be added in addition to the size from
226 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
227 ///
228 /// Readable | Writable
229 ///
230 ///
231 /// #### `margin-end`
232 /// Margin on end of widget, horizontally. This property supports
233 /// left-to-right and right-to-left text directions.
234 ///
235 /// This property adds margin outside of the widget's normal size
236 /// request, the margin will be added in addition to the size from
237 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
238 ///
239 /// Readable | Writable
240 ///
241 ///
242 /// #### `margin-left`
243 /// Margin on left side of widget.
244 ///
245 /// This property adds margin outside of the widget's normal size
246 /// request, the margin will be added in addition to the size from
247 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
248 ///
249 /// Readable | Writable
250 ///
251 ///
252 /// #### `margin-right`
253 /// Margin on right side of widget.
254 ///
255 /// This property adds margin outside of the widget's normal size
256 /// request, the margin will be added in addition to the size from
257 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
258 ///
259 /// Readable | Writable
260 ///
261 ///
262 /// #### `margin-start`
263 /// Margin on start of widget, horizontally. This property supports
264 /// left-to-right and right-to-left text directions.
265 ///
266 /// This property adds margin outside of the widget's normal size
267 /// request, the margin will be added in addition to the size from
268 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
269 ///
270 /// Readable | Writable
271 ///
272 ///
273 /// #### `margin-top`
274 /// Margin on top side of widget.
275 ///
276 /// This property adds margin outside of the widget's normal size
277 /// request, the margin will be added in addition to the size from
278 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
279 ///
280 /// Readable | Writable
281 ///
282 ///
283 /// #### `name`
284 /// Readable | Writable
285 ///
286 ///
287 /// #### `no-show-all`
288 /// Readable | Writable
289 ///
290 ///
291 /// #### `opacity`
292 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
293 /// more details about window opacity.
294 ///
295 /// Before 3.8 this was only available in GtkWindow
296 ///
297 /// Readable | Writable
298 ///
299 ///
300 /// #### `parent`
301 /// Readable | Writable
302 ///
303 ///
304 /// #### `receives-default`
305 /// Readable | Writable
306 ///
307 ///
308 /// #### `scale-factor`
309 /// The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
310 /// more details about widget scaling.
311 ///
312 /// Readable
313 ///
314 ///
315 /// #### `sensitive`
316 /// Readable | Writable
317 ///
318 ///
319 /// #### `style`
320 /// The style of the widget, which contains information about how it will look (colors, etc).
321 ///
322 /// Readable | Writable
323 ///
324 ///
325 /// #### `tooltip-markup`
326 /// Sets the text of tooltip to be the given string, which is marked up
327 /// with the [Pango text markup language][PangoMarkupFormat].
328 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
329 ///
330 /// This is a convenience property which will take care of getting the
331 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
332 /// will automatically be set to [`true`] and there will be taken care of
333 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
334 ///
335 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
336 /// are set, the last one wins.
337 ///
338 /// Readable | Writable
339 ///
340 ///
341 /// #### `tooltip-text`
342 /// Sets the text of tooltip to be the given string.
343 ///
344 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
345 ///
346 /// This is a convenience property which will take care of getting the
347 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
348 /// will automatically be set to [`true`] and there will be taken care of
349 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
350 ///
351 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
352 /// are set, the last one wins.
353 ///
354 /// Readable | Writable
355 ///
356 ///
357 /// #### `valign`
358 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
359 ///
360 /// Readable | Writable
361 ///
362 ///
363 /// #### `vexpand`
364 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
365 ///
366 /// Readable | Writable
367 ///
368 ///
369 /// #### `vexpand-set`
370 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
371 ///
372 /// Readable | Writable
373 ///
374 ///
375 /// #### `visible`
376 /// Readable | Writable
377 ///
378 ///
379 /// #### `width-request`
380 /// Readable | Writable
381 ///
382 ///
383 /// #### `window`
384 /// The widget's window if it is realized, [`None`] otherwise.
385 ///
386 /// Readable
387 /// </details>
388 /// <details><summary><h4>Orientable</h4></summary>
389 ///
390 ///
391 /// #### `orientation`
392 /// The orientation of the orientable.
393 ///
394 /// Readable | Writable
395 /// </details>
396 /// <details><summary><h4>AppChooser</h4></summary>
397 ///
398 ///
399 /// #### `content-type`
400 /// The content type of the [`AppChooser`][crate::AppChooser] object.
401 ///
402 /// See [GContentType][gio-GContentType]
403 /// for more information about content types.
404 ///
405 /// Readable | Writable | Construct Only
406 /// </details>
407 ///
408 /// ## Signals
409 ///
410 ///
411 /// #### `application-activated`
412 /// Emitted when an application item is activated from the widget's list.
413 ///
414 /// This usually happens when the user double clicks an item, or an item
415 /// is selected and the user presses one of the keys Space, Shift+Space,
416 /// Return or Enter.
417 ///
418 ///
419 ///
420 ///
421 /// #### `application-selected`
422 /// Emitted when an application item is selected from the widget's list.
423 ///
424 ///
425 ///
426 ///
427 /// #### `populate-popup`
428 /// Emitted when a context menu is about to popup over an application item.
429 /// Clients can insert menu items into the provided [`Menu`][crate::Menu] object in the
430 /// callback of this signal; the context menu will be shown over the item
431 /// if at least one item has been added to the menu.
432 ///
433 ///
434 /// <details><summary><h4>Container</h4></summary>
435 ///
436 ///
437 /// #### `add`
438 ///
439 ///
440 ///
441 /// #### `check-resize`
442 ///
443 ///
444 ///
445 /// #### `remove`
446 ///
447 ///
448 ///
449 /// #### `set-focus-child`
450 ///
451 /// </details>
452 /// <details><summary><h4>Widget</h4></summary>
453 ///
454 ///
455 /// #### `accel-closures-changed`
456 ///
457 ///
458 ///
459 /// #### `button-press-event`
460 /// The ::button-press-event signal will be emitted when a button
461 /// (typically from a mouse) is pressed.
462 ///
463 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
464 /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
465 ///
466 /// This signal will be sent to the grab widget if there is one.
467 ///
468 ///
469 ///
470 ///
471 /// #### `button-release-event`
472 /// The ::button-release-event signal will be emitted when a button
473 /// (typically from a mouse) is released.
474 ///
475 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
476 /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
477 ///
478 /// This signal will be sent to the grab widget if there is one.
479 ///
480 ///
481 ///
482 ///
483 /// #### `can-activate-accel`
484 /// Determines whether an accelerator that activates the signal
485 /// identified by `signal_id` can currently be activated.
486 /// This signal is present to allow applications and derived
487 /// widgets to override the default [`Widget`][crate::Widget] handling
488 /// for determining whether an accelerator can be activated.
489 ///
490 ///
491 ///
492 ///
493 /// #### `child-notify`
494 /// The ::child-notify signal is emitted for each
495 /// [child property][child-properties] that has
496 /// changed on an object. The signal's detail holds the property name.
497 ///
498 /// Detailed
499 ///
500 ///
501 /// #### `composited-changed`
502 /// The ::composited-changed signal is emitted when the composited
503 /// status of `widgets` screen changes.
504 /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
505 ///
506 /// Action
507 ///
508 ///
509 /// #### `configure-event`
510 /// The ::configure-event signal will be emitted when the size, position or
511 /// stacking of the `widget`'s window has changed.
512 ///
513 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
514 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
515 /// automatically for all new windows.
516 ///
517 ///
518 ///
519 ///
520 /// #### `damage-event`
521 /// Emitted when a redirected window belonging to `widget` gets drawn into.
522 /// The region/area members of the event shows what area of the redirected
523 /// drawable was drawn into.
524 ///
525 ///
526 ///
527 ///
528 /// #### `delete-event`
529 /// The ::delete-event signal is emitted if a user requests that
530 /// a toplevel window is closed. The default handler for this signal
531 /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
532 /// this signal will cause the window to be hidden instead, so that
533 /// it can later be shown again without reconstructing it.
534 ///
535 ///
536 ///
537 ///
538 /// #### `destroy`
539 /// Signals that all holders of a reference to the widget should release
540 /// the reference that they hold. May result in finalization of the widget
541 /// if all references are released.
542 ///
543 /// This signal is not suitable for saving widget state.
544 ///
545 ///
546 ///
547 ///
548 /// #### `destroy-event`
549 /// The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
550 /// You rarely get this signal, because most widgets disconnect themselves
551 /// from their window before they destroy it, so no widget owns the
552 /// window at destroy time.
553 ///
554 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
555 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
556 /// automatically for all new windows.
557 ///
558 ///
559 ///
560 ///
561 /// #### `direction-changed`
562 /// The ::direction-changed signal is emitted when the text direction
563 /// of a widget changes.
564 ///
565 ///
566 ///
567 ///
568 /// #### `drag-begin`
569 /// The ::drag-begin signal is emitted on the drag source when a drag is
570 /// started. A typical reason to connect to this signal is to set up a
571 /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
572 ///
573 /// Note that some widgets set up a drag icon in the default handler of
574 /// this signal, so you may have to use `g_signal_connect_after()` to
575 /// override what the default handler did.
576 ///
577 ///
578 ///
579 ///
580 /// #### `drag-data-delete`
581 /// The ::drag-data-delete signal is emitted on the drag source when a drag
582 /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
583 /// handler is responsible for deleting the data that has been dropped. What
584 /// "delete" means depends on the context of the drag operation.
585 ///
586 ///
587 ///
588 ///
589 /// #### `drag-data-get`
590 /// The ::drag-data-get signal is emitted on the drag source when the drop
591 /// site requests the data which is dragged. It is the responsibility of
592 /// the signal handler to fill `data` with the data in the format which
593 /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
594 /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
595 ///
596 ///
597 ///
598 ///
599 /// #### `drag-data-received`
600 /// The ::drag-data-received signal is emitted on the drop site when the
601 /// dragged data has been received. If the data was received in order to
602 /// determine whether the drop will be accepted, the handler is expected
603 /// to call `gdk_drag_status()` and not finish the drag.
604 /// If the data was received in response to a [`drag-drop`][struct@crate::Widget#drag-drop] signal
605 /// (and this is the last target to be received), the handler for this
606 /// signal is expected to process the received data and then call
607 /// `gtk_drag_finish()`, setting the `success` parameter depending on
608 /// whether the data was processed successfully.
609 ///
610 /// Applications must create some means to determine why the signal was emitted
611 /// and therefore whether to call `gdk_drag_status()` or `gtk_drag_finish()`.
612 ///
613 /// The handler may inspect the selected action with
614 /// [`DragContext::selected_action()`][crate::gdk::DragContext::selected_action()] before calling
615 /// `gtk_drag_finish()`, e.g. to implement [`gdk::DragAction::ASK`][crate::gdk::DragAction::ASK] as
616 /// shown in the following example:
617 ///
618 ///
619 /// **⚠️ The following code is in C ⚠️**
620 ///
621 /// ```C
622 /// void
623 /// drag_data_received (GtkWidget *widget,
624 /// GdkDragContext *context,
625 /// gint x,
626 /// gint y,
627 /// GtkSelectionData *data,
628 /// guint info,
629 /// guint time)
630 /// {
631 /// if ((data->length >= 0) && (data->format == 8))
632 /// {
633 /// GdkDragAction action;
634 ///
635 /// // handle data here
636 ///
637 /// action = gdk_drag_context_get_selected_action (context);
638 /// if (action == GDK_ACTION_ASK)
639 /// {
640 /// GtkWidget *dialog;
641 /// gint response;
642 ///
643 /// dialog = gtk_message_dialog_new (NULL,
644 /// GTK_DIALOG_MODAL |
645 /// GTK_DIALOG_DESTROY_WITH_PARENT,
646 /// GTK_MESSAGE_INFO,
647 /// GTK_BUTTONS_YES_NO,
648 /// "Move the data ?\n");
649 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
650 /// gtk_widget_destroy (dialog);
651 ///
652 /// if (response == GTK_RESPONSE_YES)
653 /// action = GDK_ACTION_MOVE;
654 /// else
655 /// action = GDK_ACTION_COPY;
656 /// }
657 ///
658 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
659 /// }
660 /// else
661 /// gtk_drag_finish (context, FALSE, FALSE, time);
662 /// }
663 /// ```
664 ///
665 ///
666 ///
667 ///
668 /// #### `drag-drop`
669 /// The ::drag-drop signal is emitted on the drop site when the user drops
670 /// the data onto the widget. The signal handler must determine whether
671 /// the cursor position is in a drop zone or not. If it is not in a drop
672 /// zone, it returns [`false`] and no further processing is necessary.
673 /// Otherwise, the handler returns [`true`]. In this case, the handler must
674 /// ensure that `gtk_drag_finish()` is called to let the source know that
675 /// the drop is done. The call to `gtk_drag_finish()` can be done either
676 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
677 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
678 /// or more of the supported targets.
679 ///
680 ///
681 ///
682 ///
683 /// #### `drag-end`
684 /// The ::drag-end signal is emitted on the drag source when a drag is
685 /// finished. A typical reason to connect to this signal is to undo
686 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
687 ///
688 ///
689 ///
690 ///
691 /// #### `drag-failed`
692 /// The ::drag-failed signal is emitted on the drag source when a drag has
693 /// failed. The signal handler may hook custom code to handle a failed DnD
694 /// operation based on the type of error, it returns [`true`] is the failure has
695 /// been already handled (not showing the default "drag operation failed"
696 /// animation), otherwise it returns [`false`].
697 ///
698 ///
699 ///
700 ///
701 /// #### `drag-leave`
702 /// The ::drag-leave signal is emitted on the drop site when the cursor
703 /// leaves the widget. A typical reason to connect to this signal is to
704 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
705 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
706 ///
707 ///
708 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
709 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
710 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
711 ///
712 ///
713 ///
714 ///
715 /// #### `drag-motion`
716 /// The ::drag-motion signal is emitted on the drop site when the user
717 /// moves the cursor over the widget during a drag. The signal handler
718 /// must determine whether the cursor position is in a drop zone or not.
719 /// If it is not in a drop zone, it returns [`false`] and no further processing
720 /// is necessary. Otherwise, the handler returns [`true`]. In this case, the
721 /// handler is responsible for providing the necessary information for
722 /// displaying feedback to the user, by calling `gdk_drag_status()`.
723 ///
724 /// If the decision whether the drop will be accepted or rejected can't be
725 /// made based solely on the cursor position and the type of the data, the
726 /// handler may inspect the dragged data by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] and
727 /// defer the `gdk_drag_status()` call to the [`drag-data-received`][struct@crate::Widget#drag-data-received]
728 /// handler. Note that you must pass [`DestDefaults::DROP`][crate::DestDefaults::DROP],
729 /// [`DestDefaults::MOTION`][crate::DestDefaults::MOTION] or [`DestDefaults::ALL`][crate::DestDefaults::ALL] to [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()]
730 /// when using the drag-motion signal that way.
731 ///
732 /// Also note that there is no drag-enter signal. The drag receiver has to
733 /// keep track of whether he has received any drag-motion signals since the
734 /// last [`drag-leave`][struct@crate::Widget#drag-leave] and if not, treat the drag-motion signal as
735 /// an "enter" signal. Upon an "enter", the handler will typically highlight
736 /// the drop site with [`WidgetExt::drag_highlight()`][crate::prelude::WidgetExt::drag_highlight()].
737 ///
738 ///
739 /// **⚠️ The following code is in C ⚠️**
740 ///
741 /// ```C
742 /// static void
743 /// drag_motion (GtkWidget *widget,
744 /// GdkDragContext *context,
745 /// gint x,
746 /// gint y,
747 /// guint time)
748 /// {
749 /// GdkAtom target;
750 ///
751 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
752 ///
753 /// if (!private_data->drag_highlight)
754 /// {
755 /// private_data->drag_highlight = 1;
756 /// gtk_drag_highlight (widget);
757 /// }
758 ///
759 /// target = gtk_drag_dest_find_target (widget, context, NULL);
760 /// if (target == GDK_NONE)
761 /// gdk_drag_status (context, 0, time);
762 /// else
763 /// {
764 /// private_data->pending_status
765 /// = gdk_drag_context_get_suggested_action (context);
766 /// gtk_drag_get_data (widget, context, target, time);
767 /// }
768 ///
769 /// return TRUE;
770 /// }
771 ///
772 /// static void
773 /// drag_data_received (GtkWidget *widget,
774 /// GdkDragContext *context,
775 /// gint x,
776 /// gint y,
777 /// GtkSelectionData *selection_data,
778 /// guint info,
779 /// guint time)
780 /// {
781 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
782 ///
783 /// if (private_data->suggested_action)
784 /// {
785 /// private_data->suggested_action = 0;
786 ///
787 /// // We are getting this data due to a request in drag_motion,
788 /// // rather than due to a request in drag_drop, so we are just
789 /// // supposed to call gdk_drag_status(), not actually paste in
790 /// // the data.
791 ///
792 /// str = gtk_selection_data_get_text (selection_data);
793 /// if (!data_is_acceptable (str))
794 /// gdk_drag_status (context, 0, time);
795 /// else
796 /// gdk_drag_status (context,
797 /// private_data->suggested_action,
798 /// time);
799 /// }
800 /// else
801 /// {
802 /// // accept the drop
803 /// }
804 /// }
805 /// ```
806 ///
807 ///
808 ///
809 ///
810 /// #### `draw`
811 /// This signal is emitted when a widget is supposed to render itself.
812 /// The `widget`'s top left corner must be painted at the origin of
813 /// the passed in context and be sized to the values returned by
814 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
815 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
816 ///
817 /// Signal handlers connected to this signal can modify the cairo
818 /// context passed as `cr` in any way they like and don't need to
819 /// restore it. The signal emission takes care of calling `cairo_save()`
820 /// before and `cairo_restore()` after invoking the handler.
821 ///
822 /// The signal handler will get a `cr` with a clip region already set to the
823 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
824 /// widgets that want to avoid redrawing themselves completely can get the full
825 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
826 /// get a finer-grained representation of the dirty region with
827 /// `cairo_copy_clip_rectangle_list()`.
828 ///
829 ///
830 ///
831 ///
832 /// #### `enter-notify-event`
833 /// The ::enter-notify-event will be emitted when the pointer enters
834 /// the `widget`'s window.
835 ///
836 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
837 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
838 ///
839 /// This signal will be sent to the grab widget if there is one.
840 ///
841 ///
842 ///
843 ///
844 /// #### `event`
845 /// The GTK+ main loop will emit three signals for each GDK event delivered
846 /// to a widget: one generic ::event signal, another, more specific,
847 /// signal that matches the type of event delivered (e.g.
848 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
849 /// [`event-after`][struct@crate::Widget#event-after] signal.
850 ///
851 ///
852 ///
853 ///
854 /// #### `event-after`
855 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
856 /// the second more specific signal, ::event-after will be emitted
857 /// regardless of the previous two signals handlers return values.
858 ///
859 ///
860 ///
861 ///
862 /// #### `focus`
863 ///
864 ///
865 ///
866 /// #### `focus-in-event`
867 /// The ::focus-in-event signal will be emitted when the keyboard focus
868 /// enters the `widget`'s window.
869 ///
870 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
871 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
872 ///
873 ///
874 ///
875 ///
876 /// #### `focus-out-event`
877 /// The ::focus-out-event signal will be emitted when the keyboard focus
878 /// leaves the `widget`'s window.
879 ///
880 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
881 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
882 ///
883 ///
884 ///
885 ///
886 /// #### `grab-broken-event`
887 /// Emitted when a pointer or keyboard grab on a window belonging
888 /// to `widget` gets broken.
889 ///
890 /// On X11, this happens when the grab window becomes unviewable
891 /// (i.e. it or one of its ancestors is unmapped), or if the same
892 /// application grabs the pointer or keyboard again.
893 ///
894 ///
895 ///
896 ///
897 /// #### `grab-focus`
898 /// Action
899 ///
900 ///
901 /// #### `grab-notify`
902 /// The ::grab-notify signal is emitted when a widget becomes
903 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
904 /// another widget, or when it becomes unshadowed due to a grab
905 /// being removed.
906 ///
907 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
908 /// grab widget in the grab stack of its window group is not
909 /// its ancestor.
910 ///
911 ///
912 ///
913 ///
914 /// #### `hide`
915 /// The ::hide signal is emitted when `widget` is hidden, for example with
916 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
917 ///
918 ///
919 ///
920 ///
921 /// #### `hierarchy-changed`
922 /// The ::hierarchy-changed signal is emitted when the
923 /// anchored state of a widget changes. A widget is
924 /// “anchored” when its toplevel
925 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
926 /// a widget changes from un-anchored to anchored or vice-versa.
927 ///
928 ///
929 ///
930 ///
931 /// #### `key-press-event`
932 /// The ::key-press-event signal is emitted when a key is pressed. The signal
933 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
934 ///
935 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
936 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
937 ///
938 /// This signal will be sent to the grab widget if there is one.
939 ///
940 ///
941 ///
942 ///
943 /// #### `key-release-event`
944 /// The ::key-release-event signal is emitted when a key is released.
945 ///
946 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
947 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
948 ///
949 /// This signal will be sent to the grab widget if there is one.
950 ///
951 ///
952 ///
953 ///
954 /// #### `keynav-failed`
955 /// Gets emitted if keyboard navigation fails.
956 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
957 ///
958 ///
959 ///
960 ///
961 /// #### `leave-notify-event`
962 /// The ::leave-notify-event will be emitted when the pointer leaves
963 /// the `widget`'s window.
964 ///
965 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
966 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
967 ///
968 /// This signal will be sent to the grab widget if there is one.
969 ///
970 ///
971 ///
972 ///
973 /// #### `map`
974 /// The ::map signal is emitted when `widget` is going to be mapped, that is
975 /// when the widget is visible (which is controlled with
976 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
977 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
978 /// be emitted.
979 ///
980 /// The ::map signal can be used to determine whether a widget will be drawn,
981 /// for instance it can resume an animation that was stopped during the
982 /// emission of [`unmap`][struct@crate::Widget#unmap].
983 ///
984 ///
985 ///
986 ///
987 /// #### `map-event`
988 /// The ::map-event signal will be emitted when the `widget`'s window is
989 /// mapped. A window is mapped when it becomes visible on the screen.
990 ///
991 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
992 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
993 /// automatically for all new windows.
994 ///
995 ///
996 ///
997 ///
998 /// #### `mnemonic-activate`
999 /// The default handler for this signal activates `widget` if `group_cycling`
1000 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
1001 ///
1002 ///
1003 ///
1004 ///
1005 /// #### `motion-notify-event`
1006 /// The ::motion-notify-event signal is emitted when the pointer moves
1007 /// over the widget's [`gdk::Window`][crate::gdk::Window].
1008 ///
1009 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
1010 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
1011 ///
1012 /// This signal will be sent to the grab widget if there is one.
1013 ///
1014 ///
1015 ///
1016 ///
1017 /// #### `move-focus`
1018 /// Action
1019 ///
1020 ///
1021 /// #### `parent-set`
1022 /// The ::parent-set signal is emitted when a new parent
1023 /// has been set on a widget.
1024 ///
1025 ///
1026 ///
1027 ///
1028 /// #### `popup-menu`
1029 /// This signal gets emitted whenever a widget should pop up a context
1030 /// menu. This usually happens through the standard key binding mechanism;
1031 /// by pressing a certain key while a widget is focused, the user can cause
1032 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
1033 /// a menu with clipboard commands. See the
1034 /// [Popup Menu Migration Checklist][checklist-popup-menu]
1035 /// for an example of how to use this signal.
1036 ///
1037 /// Action
1038 ///
1039 ///
1040 /// #### `property-notify-event`
1041 /// The ::property-notify-event signal will be emitted when a property on
1042 /// the `widget`'s window has been changed or deleted.
1043 ///
1044 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1045 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1046 ///
1047 ///
1048 ///
1049 ///
1050 /// #### `proximity-in-event`
1051 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1052 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1053 ///
1054 /// This signal will be sent to the grab widget if there is one.
1055 ///
1056 ///
1057 ///
1058 ///
1059 /// #### `proximity-out-event`
1060 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1061 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1062 ///
1063 /// This signal will be sent to the grab widget if there is one.
1064 ///
1065 ///
1066 ///
1067 ///
1068 /// #### `query-tooltip`
1069 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1070 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1071 /// focus in keyboard mode.
1072 ///
1073 /// Using the given coordinates, the signal handler should determine
1074 /// whether a tooltip should be shown for `widget`. If this is the case
1075 /// [`true`] should be returned, [`false`] otherwise. Note that if
1076 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1077 /// should not be used.
1078 ///
1079 /// The signal handler is free to manipulate `tooltip` with the therefore
1080 /// destined function calls.
1081 ///
1082 ///
1083 ///
1084 ///
1085 /// #### `realize`
1086 /// The ::realize signal is emitted when `widget` is associated with a
1087 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1088 /// widget has been mapped (that is, it is going to be drawn).
1089 ///
1090 ///
1091 ///
1092 ///
1093 /// #### `screen-changed`
1094 /// The ::screen-changed signal gets emitted when the
1095 /// screen of a widget has changed.
1096 ///
1097 ///
1098 ///
1099 ///
1100 /// #### `scroll-event`
1101 /// The ::scroll-event signal is emitted when a button in the 4 to 7
1102 /// range is pressed. Wheel mice are usually configured to generate
1103 /// button press events for buttons 4 and 5 when the wheel is turned.
1104 ///
1105 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1106 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1107 ///
1108 /// This signal will be sent to the grab widget if there is one.
1109 ///
1110 ///
1111 ///
1112 ///
1113 /// #### `selection-clear-event`
1114 /// The ::selection-clear-event signal will be emitted when the
1115 /// the `widget`'s window has lost ownership of a selection.
1116 ///
1117 ///
1118 ///
1119 ///
1120 /// #### `selection-get`
1121 ///
1122 ///
1123 ///
1124 /// #### `selection-notify-event`
1125 ///
1126 ///
1127 ///
1128 /// #### `selection-received`
1129 ///
1130 ///
1131 ///
1132 /// #### `selection-request-event`
1133 /// The ::selection-request-event signal will be emitted when
1134 /// another client requests ownership of the selection owned by
1135 /// the `widget`'s window.
1136 ///
1137 ///
1138 ///
1139 ///
1140 /// #### `show`
1141 /// The ::show signal is emitted when `widget` is shown, for example with
1142 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1143 ///
1144 ///
1145 ///
1146 ///
1147 /// #### `show-help`
1148 /// Action
1149 ///
1150 ///
1151 /// #### `size-allocate`
1152 ///
1153 ///
1154 ///
1155 /// #### `state-changed`
1156 /// The ::state-changed signal is emitted when the widget state changes.
1157 /// See `gtk_widget_get_state()`.
1158 ///
1159 ///
1160 ///
1161 ///
1162 /// #### `state-flags-changed`
1163 /// The ::state-flags-changed signal is emitted when the widget state
1164 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1165 ///
1166 ///
1167 ///
1168 ///
1169 /// #### `style-set`
1170 /// The ::style-set signal is emitted when a new style has been set
1171 /// on a widget. Note that style-modifying functions like
1172 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1173 ///
1174 /// Note that this signal is emitted for changes to the deprecated
1175 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1176 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1177 ///
1178 ///
1179 ///
1180 ///
1181 /// #### `style-updated`
1182 /// The ::style-updated signal is a convenience signal that is emitted when the
1183 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1184 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1185 ///
1186 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1187 /// cause this signal to be emitted.
1188 ///
1189 ///
1190 ///
1191 ///
1192 /// #### `touch-event`
1193 ///
1194 ///
1195 ///
1196 /// #### `unmap`
1197 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1198 /// means that either it or any of its parents up to the toplevel widget have
1199 /// been set as hidden.
1200 ///
1201 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1202 /// used to, for example, stop an animation on the widget.
1203 ///
1204 ///
1205 ///
1206 ///
1207 /// #### `unmap-event`
1208 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1209 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1210 ///
1211 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1212 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1213 /// automatically for all new windows.
1214 ///
1215 ///
1216 ///
1217 ///
1218 /// #### `unrealize`
1219 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1220 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1221 /// called or the widget has been unmapped (that is, it is going to be
1222 /// hidden).
1223 ///
1224 ///
1225 ///
1226 ///
1227 /// #### `visibility-notify-event`
1228 /// The ::visibility-notify-event will be emitted when the `widget`'s
1229 /// window is obscured or unobscured.
1230 ///
1231 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1232 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1233 ///
1234 ///
1235 ///
1236 ///
1237 /// #### `window-state-event`
1238 /// The ::window-state-event will be emitted when the state of the
1239 /// toplevel window associated to the `widget` changes.
1240 ///
1241 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1242 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1243 /// this mask automatically for all new windows.
1244 ///
1245 ///
1246 /// </details>
1247 ///
1248 /// # Implements
1249 ///
1250 /// [`AppChooserWidgetExt`][trait@crate::prelude::AppChooserWidgetExt], [`BoxExt`][trait@crate::prelude::BoxExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`OrientableExt`][trait@crate::prelude::OrientableExt], [`AppChooserExt`][trait@crate::prelude::AppChooserExt], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
1251 #[doc(alias = "GtkAppChooserWidget")]
1252 pub struct AppChooserWidget(Object<ffi::GtkAppChooserWidget, ffi::GtkAppChooserWidgetClass>) @extends Box, Container, Widget, @implements Buildable, Orientable, AppChooser;
1253
1254 match fn {
1255 type_ => || ffi::gtk_app_chooser_widget_get_type(),
1256 }
1257}
1258
1259impl AppChooserWidget {
1260 pub const NONE: Option<&'static AppChooserWidget> = None;
1261
1262 /// Creates a new [`AppChooserWidget`][crate::AppChooserWidget] for applications
1263 /// that can handle content of the given type.
1264 /// ## `content_type`
1265 /// the content type to show applications for
1266 ///
1267 /// # Returns
1268 ///
1269 /// a newly created [`AppChooserWidget`][crate::AppChooserWidget]
1270 #[doc(alias = "gtk_app_chooser_widget_new")]
1271 pub fn new(content_type: &str) -> AppChooserWidget {
1272 assert_initialized_main_thread!();
1273 unsafe {
1274 Widget::from_glib_none(ffi::gtk_app_chooser_widget_new(
1275 content_type.to_glib_none().0,
1276 ))
1277 .unsafe_cast()
1278 }
1279 }
1280
1281 // rustdoc-stripper-ignore-next
1282 /// Creates a new builder-pattern struct instance to construct [`AppChooserWidget`] objects.
1283 ///
1284 /// This method returns an instance of [`AppChooserWidgetBuilder`](crate::builders::AppChooserWidgetBuilder) which can be used to create [`AppChooserWidget`] objects.
1285 pub fn builder() -> AppChooserWidgetBuilder {
1286 AppChooserWidgetBuilder::new()
1287 }
1288}
1289
1290impl Default for AppChooserWidget {
1291 fn default() -> Self {
1292 glib::object::Object::new::<Self>()
1293 }
1294}
1295
1296// rustdoc-stripper-ignore-next
1297/// A [builder-pattern] type to construct [`AppChooserWidget`] objects.
1298///
1299/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1300#[must_use = "The builder must be built to be used"]
1301pub struct AppChooserWidgetBuilder {
1302 builder: glib::object::ObjectBuilder<'static, AppChooserWidget>,
1303}
1304
1305impl AppChooserWidgetBuilder {
1306 fn new() -> Self {
1307 Self {
1308 builder: glib::object::Object::builder(),
1309 }
1310 }
1311
1312 /// The [`default-text`][struct@crate::AppChooserWidget#default-text] property determines the text
1313 /// that appears in the widget when there are no applications for the
1314 /// given content type.
1315 /// See also [`AppChooserWidgetExt::set_default_text()`][crate::prelude::AppChooserWidgetExt::set_default_text()].
1316 pub fn default_text(self, default_text: impl Into<glib::GString>) -> Self {
1317 Self {
1318 builder: self.builder.property("default-text", default_text.into()),
1319 }
1320 }
1321
1322 /// If the [`show-all`][struct@crate::AppChooserWidget#show-all] property is [`true`], the app
1323 /// chooser presents all applications in a single list, without
1324 /// subsections for default, recommended or related applications.
1325 pub fn show_all(self, show_all: bool) -> Self {
1326 Self {
1327 builder: self.builder.property("show-all", show_all),
1328 }
1329 }
1330
1331 /// The ::show-default property determines whether the app chooser
1332 /// should show the default handler for the content type in a
1333 /// separate section. If [`false`], the default handler is listed
1334 /// among the recommended applications.
1335 pub fn show_default(self, show_default: bool) -> Self {
1336 Self {
1337 builder: self.builder.property("show-default", show_default),
1338 }
1339 }
1340
1341 /// The [`show-fallback`][struct@crate::AppChooserWidget#show-fallback] property determines whether
1342 /// the app chooser should show a section for fallback applications.
1343 /// If [`false`], the fallback applications are listed among the other
1344 /// applications.
1345 pub fn show_fallback(self, show_fallback: bool) -> Self {
1346 Self {
1347 builder: self.builder.property("show-fallback", show_fallback),
1348 }
1349 }
1350
1351 /// The [`show-other`][struct@crate::AppChooserWidget#show-other] property determines whether
1352 /// the app chooser should show a section for other applications.
1353 pub fn show_other(self, show_other: bool) -> Self {
1354 Self {
1355 builder: self.builder.property("show-other", show_other),
1356 }
1357 }
1358
1359 /// The [`show-recommended`][struct@crate::AppChooserWidget#show-recommended] property determines
1360 /// whether the app chooser should show a section for recommended
1361 /// applications. If [`false`], the recommended applications are listed
1362 /// among the other applications.
1363 pub fn show_recommended(self, show_recommended: bool) -> Self {
1364 Self {
1365 builder: self.builder.property("show-recommended", show_recommended),
1366 }
1367 }
1368
1369 pub fn baseline_position(self, baseline_position: BaselinePosition) -> Self {
1370 Self {
1371 builder: self
1372 .builder
1373 .property("baseline-position", baseline_position),
1374 }
1375 }
1376
1377 pub fn homogeneous(self, homogeneous: bool) -> Self {
1378 Self {
1379 builder: self.builder.property("homogeneous", homogeneous),
1380 }
1381 }
1382
1383 pub fn spacing(self, spacing: i32) -> Self {
1384 Self {
1385 builder: self.builder.property("spacing", spacing),
1386 }
1387 }
1388
1389 pub fn border_width(self, border_width: u32) -> Self {
1390 Self {
1391 builder: self.builder.property("border-width", border_width),
1392 }
1393 }
1394
1395 pub fn child(self, child: &impl IsA<Widget>) -> Self {
1396 Self {
1397 builder: self.builder.property("child", child.clone().upcast()),
1398 }
1399 }
1400
1401 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1402 Self {
1403 builder: self.builder.property("resize-mode", resize_mode),
1404 }
1405 }
1406
1407 pub fn app_paintable(self, app_paintable: bool) -> Self {
1408 Self {
1409 builder: self.builder.property("app-paintable", app_paintable),
1410 }
1411 }
1412
1413 pub fn can_default(self, can_default: bool) -> Self {
1414 Self {
1415 builder: self.builder.property("can-default", can_default),
1416 }
1417 }
1418
1419 pub fn can_focus(self, can_focus: bool) -> Self {
1420 Self {
1421 builder: self.builder.property("can-focus", can_focus),
1422 }
1423 }
1424
1425 pub fn events(self, events: gdk::EventMask) -> Self {
1426 Self {
1427 builder: self.builder.property("events", events),
1428 }
1429 }
1430
1431 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1432 pub fn expand(self, expand: bool) -> Self {
1433 Self {
1434 builder: self.builder.property("expand", expand),
1435 }
1436 }
1437
1438 /// Whether the widget should grab focus when it is clicked with the mouse.
1439 ///
1440 /// This property is only relevant for widgets that can take focus.
1441 ///
1442 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1443 /// GtkComboBox) implemented this property individually.
1444 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1445 Self {
1446 builder: self.builder.property("focus-on-click", focus_on_click),
1447 }
1448 }
1449
1450 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1451 pub fn halign(self, halign: Align) -> Self {
1452 Self {
1453 builder: self.builder.property("halign", halign),
1454 }
1455 }
1456
1457 pub fn has_default(self, has_default: bool) -> Self {
1458 Self {
1459 builder: self.builder.property("has-default", has_default),
1460 }
1461 }
1462
1463 pub fn has_focus(self, has_focus: bool) -> Self {
1464 Self {
1465 builder: self.builder.property("has-focus", has_focus),
1466 }
1467 }
1468
1469 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1470 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1471 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1472 /// whether it will provide a tooltip or not.
1473 ///
1474 /// Note that setting this property to [`true`] for the first time will change
1475 /// the event masks of the GdkWindows of this widget to include leave-notify
1476 /// and motion-notify events. This cannot and will not be undone when the
1477 /// property is set to [`false`] again.
1478 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1479 Self {
1480 builder: self.builder.property("has-tooltip", has_tooltip),
1481 }
1482 }
1483
1484 pub fn height_request(self, height_request: i32) -> Self {
1485 Self {
1486 builder: self.builder.property("height-request", height_request),
1487 }
1488 }
1489
1490 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1491 pub fn hexpand(self, hexpand: bool) -> Self {
1492 Self {
1493 builder: self.builder.property("hexpand", hexpand),
1494 }
1495 }
1496
1497 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1498 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1499 Self {
1500 builder: self.builder.property("hexpand-set", hexpand_set),
1501 }
1502 }
1503
1504 pub fn is_focus(self, is_focus: bool) -> Self {
1505 Self {
1506 builder: self.builder.property("is-focus", is_focus),
1507 }
1508 }
1509
1510 /// Sets all four sides' margin at once. If read, returns max
1511 /// margin on any side.
1512 pub fn margin(self, margin: i32) -> Self {
1513 Self {
1514 builder: self.builder.property("margin", margin),
1515 }
1516 }
1517
1518 /// Margin on bottom side of widget.
1519 ///
1520 /// This property adds margin outside of the widget's normal size
1521 /// request, the margin will be added in addition to the size from
1522 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1523 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1524 Self {
1525 builder: self.builder.property("margin-bottom", margin_bottom),
1526 }
1527 }
1528
1529 /// Margin on end of widget, horizontally. This property supports
1530 /// left-to-right and right-to-left text directions.
1531 ///
1532 /// This property adds margin outside of the widget's normal size
1533 /// request, the margin will be added in addition to the size from
1534 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1535 pub fn margin_end(self, margin_end: i32) -> Self {
1536 Self {
1537 builder: self.builder.property("margin-end", margin_end),
1538 }
1539 }
1540
1541 /// Margin on start of widget, horizontally. This property supports
1542 /// left-to-right and right-to-left text directions.
1543 ///
1544 /// This property adds margin outside of the widget's normal size
1545 /// request, the margin will be added in addition to the size from
1546 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1547 pub fn margin_start(self, margin_start: i32) -> Self {
1548 Self {
1549 builder: self.builder.property("margin-start", margin_start),
1550 }
1551 }
1552
1553 /// Margin on top side of widget.
1554 ///
1555 /// This property adds margin outside of the widget's normal size
1556 /// request, the margin will be added in addition to the size from
1557 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1558 pub fn margin_top(self, margin_top: i32) -> Self {
1559 Self {
1560 builder: self.builder.property("margin-top", margin_top),
1561 }
1562 }
1563
1564 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1565 Self {
1566 builder: self.builder.property("name", name.into()),
1567 }
1568 }
1569
1570 pub fn no_show_all(self, no_show_all: bool) -> Self {
1571 Self {
1572 builder: self.builder.property("no-show-all", no_show_all),
1573 }
1574 }
1575
1576 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1577 /// more details about window opacity.
1578 ///
1579 /// Before 3.8 this was only available in GtkWindow
1580 pub fn opacity(self, opacity: f64) -> Self {
1581 Self {
1582 builder: self.builder.property("opacity", opacity),
1583 }
1584 }
1585
1586 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1587 Self {
1588 builder: self.builder.property("parent", parent.clone().upcast()),
1589 }
1590 }
1591
1592 pub fn receives_default(self, receives_default: bool) -> Self {
1593 Self {
1594 builder: self.builder.property("receives-default", receives_default),
1595 }
1596 }
1597
1598 pub fn sensitive(self, sensitive: bool) -> Self {
1599 Self {
1600 builder: self.builder.property("sensitive", sensitive),
1601 }
1602 }
1603
1604 /// Sets the text of tooltip to be the given string, which is marked up
1605 /// with the [Pango text markup language][PangoMarkupFormat].
1606 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1607 ///
1608 /// This is a convenience property which will take care of getting the
1609 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1610 /// will automatically be set to [`true`] and there will be taken care of
1611 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1612 ///
1613 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1614 /// are set, the last one wins.
1615 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1616 Self {
1617 builder: self
1618 .builder
1619 .property("tooltip-markup", tooltip_markup.into()),
1620 }
1621 }
1622
1623 /// Sets the text of tooltip to be the given string.
1624 ///
1625 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1626 ///
1627 /// This is a convenience property which will take care of getting the
1628 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1629 /// will automatically be set to [`true`] and there will be taken care of
1630 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1631 ///
1632 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1633 /// are set, the last one wins.
1634 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1635 Self {
1636 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1637 }
1638 }
1639
1640 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1641 pub fn valign(self, valign: Align) -> Self {
1642 Self {
1643 builder: self.builder.property("valign", valign),
1644 }
1645 }
1646
1647 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1648 pub fn vexpand(self, vexpand: bool) -> Self {
1649 Self {
1650 builder: self.builder.property("vexpand", vexpand),
1651 }
1652 }
1653
1654 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1655 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1656 Self {
1657 builder: self.builder.property("vexpand-set", vexpand_set),
1658 }
1659 }
1660
1661 pub fn visible(self, visible: bool) -> Self {
1662 Self {
1663 builder: self.builder.property("visible", visible),
1664 }
1665 }
1666
1667 pub fn width_request(self, width_request: i32) -> Self {
1668 Self {
1669 builder: self.builder.property("width-request", width_request),
1670 }
1671 }
1672
1673 /// The orientation of the orientable.
1674 pub fn orientation(self, orientation: Orientation) -> Self {
1675 Self {
1676 builder: self.builder.property("orientation", orientation),
1677 }
1678 }
1679
1680 /// The content type of the [`AppChooser`][crate::AppChooser] object.
1681 ///
1682 /// See [GContentType][gio-GContentType]
1683 /// for more information about content types.
1684 pub fn content_type(self, content_type: impl Into<glib::GString>) -> Self {
1685 Self {
1686 builder: self.builder.property("content-type", content_type.into()),
1687 }
1688 }
1689
1690 // rustdoc-stripper-ignore-next
1691 /// Build the [`AppChooserWidget`].
1692 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1693 pub fn build(self) -> AppChooserWidget {
1694 assert_initialized_main_thread!();
1695 self.builder.build()
1696 }
1697}
1698
1699/// Trait containing all [`struct@AppChooserWidget`] methods.
1700///
1701/// # Implementors
1702///
1703/// [`AppChooserWidget`][struct@crate::AppChooserWidget]
1704pub trait AppChooserWidgetExt: IsA<AppChooserWidget> + 'static {
1705 /// Returns the text that is shown if there are not applications
1706 /// that can handle the content type.
1707 ///
1708 /// # Returns
1709 ///
1710 /// the value of [`default-text`][struct@crate::AppChooserWidget#default-text]
1711 #[doc(alias = "gtk_app_chooser_widget_get_default_text")]
1712 #[doc(alias = "get_default_text")]
1713 #[doc(alias = "default-text")]
1714 fn default_text(&self) -> Option<glib::GString> {
1715 unsafe {
1716 from_glib_none(ffi::gtk_app_chooser_widget_get_default_text(
1717 self.as_ref().to_glib_none().0,
1718 ))
1719 }
1720 }
1721
1722 /// Returns the current value of the [`show-all`][struct@crate::AppChooserWidget#show-all]
1723 /// property.
1724 ///
1725 /// # Returns
1726 ///
1727 /// the value of [`show-all`][struct@crate::AppChooserWidget#show-all]
1728 #[doc(alias = "gtk_app_chooser_widget_get_show_all")]
1729 #[doc(alias = "get_show_all")]
1730 #[doc(alias = "show-all")]
1731 fn shows_all(&self) -> bool {
1732 unsafe {
1733 from_glib(ffi::gtk_app_chooser_widget_get_show_all(
1734 self.as_ref().to_glib_none().0,
1735 ))
1736 }
1737 }
1738
1739 /// Returns the current value of the [`show-default`][struct@crate::AppChooserWidget#show-default]
1740 /// property.
1741 ///
1742 /// # Returns
1743 ///
1744 /// the value of [`show-default`][struct@crate::AppChooserWidget#show-default]
1745 #[doc(alias = "gtk_app_chooser_widget_get_show_default")]
1746 #[doc(alias = "get_show_default")]
1747 #[doc(alias = "show-default")]
1748 fn shows_default(&self) -> bool {
1749 unsafe {
1750 from_glib(ffi::gtk_app_chooser_widget_get_show_default(
1751 self.as_ref().to_glib_none().0,
1752 ))
1753 }
1754 }
1755
1756 /// Returns the current value of the [`show-fallback`][struct@crate::AppChooserWidget#show-fallback]
1757 /// property.
1758 ///
1759 /// # Returns
1760 ///
1761 /// the value of [`show-fallback`][struct@crate::AppChooserWidget#show-fallback]
1762 #[doc(alias = "gtk_app_chooser_widget_get_show_fallback")]
1763 #[doc(alias = "get_show_fallback")]
1764 #[doc(alias = "show-fallback")]
1765 fn shows_fallback(&self) -> bool {
1766 unsafe {
1767 from_glib(ffi::gtk_app_chooser_widget_get_show_fallback(
1768 self.as_ref().to_glib_none().0,
1769 ))
1770 }
1771 }
1772
1773 /// Returns the current value of the [`show-other`][struct@crate::AppChooserWidget#show-other]
1774 /// property.
1775 ///
1776 /// # Returns
1777 ///
1778 /// the value of [`show-other`][struct@crate::AppChooserWidget#show-other]
1779 #[doc(alias = "gtk_app_chooser_widget_get_show_other")]
1780 #[doc(alias = "get_show_other")]
1781 #[doc(alias = "show-other")]
1782 fn shows_other(&self) -> bool {
1783 unsafe {
1784 from_glib(ffi::gtk_app_chooser_widget_get_show_other(
1785 self.as_ref().to_glib_none().0,
1786 ))
1787 }
1788 }
1789
1790 /// Returns the current value of the [`show-recommended`][struct@crate::AppChooserWidget#show-recommended]
1791 /// property.
1792 ///
1793 /// # Returns
1794 ///
1795 /// the value of [`show-recommended`][struct@crate::AppChooserWidget#show-recommended]
1796 #[doc(alias = "gtk_app_chooser_widget_get_show_recommended")]
1797 #[doc(alias = "get_show_recommended")]
1798 #[doc(alias = "show-recommended")]
1799 fn shows_recommended(&self) -> bool {
1800 unsafe {
1801 from_glib(ffi::gtk_app_chooser_widget_get_show_recommended(
1802 self.as_ref().to_glib_none().0,
1803 ))
1804 }
1805 }
1806
1807 /// Sets the text that is shown if there are not applications
1808 /// that can handle the content type.
1809 /// ## `text`
1810 /// the new value for [`default-text`][struct@crate::AppChooserWidget#default-text]
1811 #[doc(alias = "gtk_app_chooser_widget_set_default_text")]
1812 #[doc(alias = "default-text")]
1813 fn set_default_text(&self, text: &str) {
1814 unsafe {
1815 ffi::gtk_app_chooser_widget_set_default_text(
1816 self.as_ref().to_glib_none().0,
1817 text.to_glib_none().0,
1818 );
1819 }
1820 }
1821
1822 /// Sets whether the app chooser should show all applications
1823 /// in a flat list.
1824 /// ## `setting`
1825 /// the new value for [`show-all`][struct@crate::AppChooserWidget#show-all]
1826 #[doc(alias = "gtk_app_chooser_widget_set_show_all")]
1827 #[doc(alias = "show-all")]
1828 fn set_show_all(&self, setting: bool) {
1829 unsafe {
1830 ffi::gtk_app_chooser_widget_set_show_all(
1831 self.as_ref().to_glib_none().0,
1832 setting.into_glib(),
1833 );
1834 }
1835 }
1836
1837 /// Sets whether the app chooser should show the default handler
1838 /// for the content type in a separate section.
1839 /// ## `setting`
1840 /// the new value for [`show-default`][struct@crate::AppChooserWidget#show-default]
1841 #[doc(alias = "gtk_app_chooser_widget_set_show_default")]
1842 #[doc(alias = "show-default")]
1843 fn set_show_default(&self, setting: bool) {
1844 unsafe {
1845 ffi::gtk_app_chooser_widget_set_show_default(
1846 self.as_ref().to_glib_none().0,
1847 setting.into_glib(),
1848 );
1849 }
1850 }
1851
1852 /// Sets whether the app chooser should show related applications
1853 /// for the content type in a separate section.
1854 /// ## `setting`
1855 /// the new value for [`show-fallback`][struct@crate::AppChooserWidget#show-fallback]
1856 #[doc(alias = "gtk_app_chooser_widget_set_show_fallback")]
1857 #[doc(alias = "show-fallback")]
1858 fn set_show_fallback(&self, setting: bool) {
1859 unsafe {
1860 ffi::gtk_app_chooser_widget_set_show_fallback(
1861 self.as_ref().to_glib_none().0,
1862 setting.into_glib(),
1863 );
1864 }
1865 }
1866
1867 /// Sets whether the app chooser should show applications
1868 /// which are unrelated to the content type.
1869 /// ## `setting`
1870 /// the new value for [`show-other`][struct@crate::AppChooserWidget#show-other]
1871 #[doc(alias = "gtk_app_chooser_widget_set_show_other")]
1872 #[doc(alias = "show-other")]
1873 fn set_show_other(&self, setting: bool) {
1874 unsafe {
1875 ffi::gtk_app_chooser_widget_set_show_other(
1876 self.as_ref().to_glib_none().0,
1877 setting.into_glib(),
1878 );
1879 }
1880 }
1881
1882 /// Sets whether the app chooser should show recommended applications
1883 /// for the content type in a separate section.
1884 /// ## `setting`
1885 /// the new value for [`show-recommended`][struct@crate::AppChooserWidget#show-recommended]
1886 #[doc(alias = "gtk_app_chooser_widget_set_show_recommended")]
1887 #[doc(alias = "show-recommended")]
1888 fn set_show_recommended(&self, setting: bool) {
1889 unsafe {
1890 ffi::gtk_app_chooser_widget_set_show_recommended(
1891 self.as_ref().to_glib_none().0,
1892 setting.into_glib(),
1893 );
1894 }
1895 }
1896
1897 /// Emitted when an application item is activated from the widget's list.
1898 ///
1899 /// This usually happens when the user double clicks an item, or an item
1900 /// is selected and the user presses one of the keys Space, Shift+Space,
1901 /// Return or Enter.
1902 /// ## `application`
1903 /// the activated [`gio::AppInfo`][crate::gio::AppInfo]
1904 #[doc(alias = "application-activated")]
1905 fn connect_application_activated<F: Fn(&Self, &gio::AppInfo) + 'static>(
1906 &self,
1907 f: F,
1908 ) -> SignalHandlerId {
1909 unsafe extern "C" fn application_activated_trampoline<
1910 P: IsA<AppChooserWidget>,
1911 F: Fn(&P, &gio::AppInfo) + 'static,
1912 >(
1913 this: *mut ffi::GtkAppChooserWidget,
1914 application: *mut gio::ffi::GAppInfo,
1915 f: glib::ffi::gpointer,
1916 ) {
1917 unsafe {
1918 let f: &F = &*(f as *const F);
1919 f(
1920 AppChooserWidget::from_glib_borrow(this).unsafe_cast_ref(),
1921 &from_glib_borrow(application),
1922 )
1923 }
1924 }
1925 unsafe {
1926 let f: Box_<F> = Box_::new(f);
1927 connect_raw(
1928 self.as_ptr() as *mut _,
1929 c"application-activated".as_ptr(),
1930 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1931 application_activated_trampoline::<Self, F> as *const (),
1932 )),
1933 Box_::into_raw(f),
1934 )
1935 }
1936 }
1937
1938 /// Emitted when an application item is selected from the widget's list.
1939 /// ## `application`
1940 /// the selected [`gio::AppInfo`][crate::gio::AppInfo]
1941 #[doc(alias = "application-selected")]
1942 fn connect_application_selected<F: Fn(&Self, &gio::AppInfo) + 'static>(
1943 &self,
1944 f: F,
1945 ) -> SignalHandlerId {
1946 unsafe extern "C" fn application_selected_trampoline<
1947 P: IsA<AppChooserWidget>,
1948 F: Fn(&P, &gio::AppInfo) + 'static,
1949 >(
1950 this: *mut ffi::GtkAppChooserWidget,
1951 application: *mut gio::ffi::GAppInfo,
1952 f: glib::ffi::gpointer,
1953 ) {
1954 unsafe {
1955 let f: &F = &*(f as *const F);
1956 f(
1957 AppChooserWidget::from_glib_borrow(this).unsafe_cast_ref(),
1958 &from_glib_borrow(application),
1959 )
1960 }
1961 }
1962 unsafe {
1963 let f: Box_<F> = Box_::new(f);
1964 connect_raw(
1965 self.as_ptr() as *mut _,
1966 c"application-selected".as_ptr(),
1967 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1968 application_selected_trampoline::<Self, F> as *const (),
1969 )),
1970 Box_::into_raw(f),
1971 )
1972 }
1973 }
1974
1975 /// Emitted when a context menu is about to popup over an application item.
1976 /// Clients can insert menu items into the provided [`Menu`][crate::Menu] object in the
1977 /// callback of this signal; the context menu will be shown over the item
1978 /// if at least one item has been added to the menu.
1979 /// ## `menu`
1980 /// the [`Menu`][crate::Menu] to populate
1981 /// ## `application`
1982 /// the current [`gio::AppInfo`][crate::gio::AppInfo]
1983 #[doc(alias = "populate-popup")]
1984 fn connect_populate_popup<F: Fn(&Self, &Menu, &gio::AppInfo) + 'static>(
1985 &self,
1986 f: F,
1987 ) -> SignalHandlerId {
1988 unsafe extern "C" fn populate_popup_trampoline<
1989 P: IsA<AppChooserWidget>,
1990 F: Fn(&P, &Menu, &gio::AppInfo) + 'static,
1991 >(
1992 this: *mut ffi::GtkAppChooserWidget,
1993 menu: *mut ffi::GtkMenu,
1994 application: *mut gio::ffi::GAppInfo,
1995 f: glib::ffi::gpointer,
1996 ) {
1997 unsafe {
1998 let f: &F = &*(f as *const F);
1999 f(
2000 AppChooserWidget::from_glib_borrow(this).unsafe_cast_ref(),
2001 &from_glib_borrow(menu),
2002 &from_glib_borrow(application),
2003 )
2004 }
2005 }
2006 unsafe {
2007 let f: Box_<F> = Box_::new(f);
2008 connect_raw(
2009 self.as_ptr() as *mut _,
2010 c"populate-popup".as_ptr(),
2011 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2012 populate_popup_trampoline::<Self, F> as *const (),
2013 )),
2014 Box_::into_raw(f),
2015 )
2016 }
2017 }
2018
2019 #[doc(alias = "default-text")]
2020 fn connect_default_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2021 unsafe extern "C" fn notify_default_text_trampoline<
2022 P: IsA<AppChooserWidget>,
2023 F: Fn(&P) + 'static,
2024 >(
2025 this: *mut ffi::GtkAppChooserWidget,
2026 _param_spec: glib::ffi::gpointer,
2027 f: glib::ffi::gpointer,
2028 ) {
2029 unsafe {
2030 let f: &F = &*(f as *const F);
2031 f(AppChooserWidget::from_glib_borrow(this).unsafe_cast_ref())
2032 }
2033 }
2034 unsafe {
2035 let f: Box_<F> = Box_::new(f);
2036 connect_raw(
2037 self.as_ptr() as *mut _,
2038 c"notify::default-text".as_ptr(),
2039 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2040 notify_default_text_trampoline::<Self, F> as *const (),
2041 )),
2042 Box_::into_raw(f),
2043 )
2044 }
2045 }
2046
2047 #[doc(alias = "show-all")]
2048 fn connect_show_all_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2049 unsafe extern "C" fn notify_show_all_trampoline<
2050 P: IsA<AppChooserWidget>,
2051 F: Fn(&P) + 'static,
2052 >(
2053 this: *mut ffi::GtkAppChooserWidget,
2054 _param_spec: glib::ffi::gpointer,
2055 f: glib::ffi::gpointer,
2056 ) {
2057 unsafe {
2058 let f: &F = &*(f as *const F);
2059 f(AppChooserWidget::from_glib_borrow(this).unsafe_cast_ref())
2060 }
2061 }
2062 unsafe {
2063 let f: Box_<F> = Box_::new(f);
2064 connect_raw(
2065 self.as_ptr() as *mut _,
2066 c"notify::show-all".as_ptr(),
2067 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2068 notify_show_all_trampoline::<Self, F> as *const (),
2069 )),
2070 Box_::into_raw(f),
2071 )
2072 }
2073 }
2074
2075 #[doc(alias = "show-default")]
2076 fn connect_show_default_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2077 unsafe extern "C" fn notify_show_default_trampoline<
2078 P: IsA<AppChooserWidget>,
2079 F: Fn(&P) + 'static,
2080 >(
2081 this: *mut ffi::GtkAppChooserWidget,
2082 _param_spec: glib::ffi::gpointer,
2083 f: glib::ffi::gpointer,
2084 ) {
2085 unsafe {
2086 let f: &F = &*(f as *const F);
2087 f(AppChooserWidget::from_glib_borrow(this).unsafe_cast_ref())
2088 }
2089 }
2090 unsafe {
2091 let f: Box_<F> = Box_::new(f);
2092 connect_raw(
2093 self.as_ptr() as *mut _,
2094 c"notify::show-default".as_ptr(),
2095 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2096 notify_show_default_trampoline::<Self, F> as *const (),
2097 )),
2098 Box_::into_raw(f),
2099 )
2100 }
2101 }
2102
2103 #[doc(alias = "show-fallback")]
2104 fn connect_show_fallback_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2105 unsafe extern "C" fn notify_show_fallback_trampoline<
2106 P: IsA<AppChooserWidget>,
2107 F: Fn(&P) + 'static,
2108 >(
2109 this: *mut ffi::GtkAppChooserWidget,
2110 _param_spec: glib::ffi::gpointer,
2111 f: glib::ffi::gpointer,
2112 ) {
2113 unsafe {
2114 let f: &F = &*(f as *const F);
2115 f(AppChooserWidget::from_glib_borrow(this).unsafe_cast_ref())
2116 }
2117 }
2118 unsafe {
2119 let f: Box_<F> = Box_::new(f);
2120 connect_raw(
2121 self.as_ptr() as *mut _,
2122 c"notify::show-fallback".as_ptr(),
2123 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2124 notify_show_fallback_trampoline::<Self, F> as *const (),
2125 )),
2126 Box_::into_raw(f),
2127 )
2128 }
2129 }
2130
2131 #[doc(alias = "show-other")]
2132 fn connect_show_other_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2133 unsafe extern "C" fn notify_show_other_trampoline<
2134 P: IsA<AppChooserWidget>,
2135 F: Fn(&P) + 'static,
2136 >(
2137 this: *mut ffi::GtkAppChooserWidget,
2138 _param_spec: glib::ffi::gpointer,
2139 f: glib::ffi::gpointer,
2140 ) {
2141 unsafe {
2142 let f: &F = &*(f as *const F);
2143 f(AppChooserWidget::from_glib_borrow(this).unsafe_cast_ref())
2144 }
2145 }
2146 unsafe {
2147 let f: Box_<F> = Box_::new(f);
2148 connect_raw(
2149 self.as_ptr() as *mut _,
2150 c"notify::show-other".as_ptr(),
2151 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2152 notify_show_other_trampoline::<Self, F> as *const (),
2153 )),
2154 Box_::into_raw(f),
2155 )
2156 }
2157 }
2158
2159 #[doc(alias = "show-recommended")]
2160 fn connect_show_recommended_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2161 unsafe extern "C" fn notify_show_recommended_trampoline<
2162 P: IsA<AppChooserWidget>,
2163 F: Fn(&P) + 'static,
2164 >(
2165 this: *mut ffi::GtkAppChooserWidget,
2166 _param_spec: glib::ffi::gpointer,
2167 f: glib::ffi::gpointer,
2168 ) {
2169 unsafe {
2170 let f: &F = &*(f as *const F);
2171 f(AppChooserWidget::from_glib_borrow(this).unsafe_cast_ref())
2172 }
2173 }
2174 unsafe {
2175 let f: Box_<F> = Box_::new(f);
2176 connect_raw(
2177 self.as_ptr() as *mut _,
2178 c"notify::show-recommended".as_ptr(),
2179 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2180 notify_show_recommended_trampoline::<Self, F> as *const (),
2181 )),
2182 Box_::into_raw(f),
2183 )
2184 }
2185 }
2186}
2187
2188impl<O: IsA<AppChooserWidget>> AppChooserWidgetExt for O {}