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