libadwaita/auto/
alert_dialog.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files.git)
4// DO NOT EDIT
5
6use crate::{ffi, Dialog, DialogPresentationMode, ResponseAppearance};
7use glib::{
8    object::ObjectType as _,
9    prelude::*,
10    signal::{connect_raw, SignalHandlerId},
11    translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16    /// A dialog presenting a message or a question.
17    ///
18    /// <picture>
19    ///   <source srcset="alert-dialog-dark.png" media="(prefers-color-scheme: dark)">
20    ///   <img src="alert-dialog.png" alt="alert-dialog">
21    /// </picture>
22    ///
23    /// Alert dialogs have a heading, a body, an optional child widget, and one or
24    /// multiple responses, each presented as a button.
25    ///
26    /// Each response has a unique string ID, and a button label. Additionally, each
27    /// response can be enabled or disabled, and can have a suggested or destructive
28    /// appearance.
29    ///
30    /// When one of the responses is activated, or the dialog is closed, the
31    /// [`response`][struct@crate::AlertDialog#response] signal will be emitted. This signal is
32    /// detailed, and the detail, as well as the `response` parameter will be set to
33    /// the ID of the activated response, or to the value of the
34    /// [`close-response`][struct@crate::AlertDialog#close-response] property if the dialog had been closed
35    /// without activating any of the responses.
36    ///
37    /// Response buttons can be presented horizontally or vertically depending on
38    /// available space.
39    ///
40    /// When a response is activated, [`AlertDialog`][crate::AlertDialog] is closed automatically.
41    ///
42    /// An example of using an alert dialog:
43    ///
44    /// **⚠️ The following code is in c ⚠️**
45    ///
46    /// ```c
47    /// AdwDialog *dialog;
48    ///
49    /// dialog = adw_alert_dialog_new (_("Replace File?"), NULL);
50    ///
51    /// adw_alert_dialog_format_body (ADW_ALERT_DIALOG (dialog),
52    ///                               _("A file named “%s” already exists. Do you want to replace it?"),
53    ///                               filename);
54    ///
55    /// adw_alert_dialog_add_responses (ADW_ALERT_DIALOG (dialog),
56    ///                                 "cancel",  _("_Cancel"),
57    ///                                 "replace", _("_Replace"),
58    ///                                 NULL);
59    ///
60    /// adw_alert_dialog_set_response_appearance (ADW_ALERT_DIALOG (dialog),
61    ///                                           "replace",
62    ///                                           ADW_RESPONSE_DESTRUCTIVE);
63    ///
64    /// adw_alert_dialog_set_default_response (ADW_ALERT_DIALOG (dialog), "cancel");
65    /// adw_alert_dialog_set_close_response (ADW_ALERT_DIALOG (dialog), "cancel");
66    ///
67    /// g_signal_connect (dialog, "response", G_CALLBACK (response_cb), self);
68    ///
69    /// adw_dialog_present (dialog, parent);
70    /// ```
71    ///
72    /// ## Async API
73    ///
74    /// [`AlertDialog`][crate::AlertDialog] can also be used via the [`AlertDialogExtManual::choose()`][crate::prelude::AlertDialogExtManual::choose()] method.
75    /// This API follows the GIO async pattern, for example:
76    ///
77    /// **⚠️ The following code is in c ⚠️**
78    ///
79    /// ```c
80    /// static void
81    /// dialog_cb (AdwAlertDialog *dialog,
82    ///            GAsyncResult   *result,
83    ///            MyWindow       *self)
84    /// {
85    ///   const char *response = adw_alert_dialog_choose_finish (dialog, result);
86    ///
87    ///   // ...
88    /// }
89    ///
90    /// static void
91    /// show_dialog (MyWindow *self)
92    /// {
93    ///   AdwDialog *dialog;
94    ///
95    ///   dialog = adw_alert_dialog_new (_("Replace File?"), NULL);
96    ///
97    ///   adw_alert_dialog_format_body (ADW_ALERT_DIALOG (dialog),
98    ///                                 _("A file named “%s” already exists. Do you want to replace it?"),
99    ///                                 filename);
100    ///
101    ///   adw_alert_dialog_add_responses (ADW_ALERT_DIALOG (dialog),
102    ///                                   "cancel",  _("_Cancel"),
103    ///                                   "replace", _("_Replace"),
104    ///                                   NULL);
105    ///
106    ///   adw_alert_dialog_set_response_appearance (ADW_ALERT_DIALOG (dialog),
107    ///                                             "replace",
108    ///                                             ADW_RESPONSE_DESTRUCTIVE);
109    ///
110    ///   adw_alert_dialog_set_default_response (ADW_ALERT_DIALOG (dialog), "cancel");
111    ///   adw_alert_dialog_set_close_response (ADW_ALERT_DIALOG (dialog), "cancel");
112    ///
113    ///   adw_alert_dialog_choose (ADW_ALERT_DIALOG (dialog), GTK_WIDGET (self),
114    ///                            NULL, (GAsyncReadyCallback) dialog_cb, self);
115    /// }
116    /// ```
117    ///
118    /// ## AdwAlertDialog as GtkBuildable
119    ///
120    /// [`AlertDialog`][crate::AlertDialog] supports adding responses in UI definitions by via the
121    /// `<responses>` element that may contain multiple `<response>` elements, each
122    /// representing a response.
123    ///
124    /// Each of the `<response>` elements must have the `id` attribute specifying the
125    /// response ID. The contents of the element are used as the response label.
126    ///
127    /// Response labels can be translated with the usual `translatable`, `context`
128    /// and `comments` attributes.
129    ///
130    /// The `<response>` elements can also have `enabled` and/or `appearance`
131    /// attributes. See [`AlertDialogExt::set_response_enabled()`][crate::prelude::AlertDialogExt::set_response_enabled()] and
132    /// [`AlertDialogExt::set_response_appearance()`][crate::prelude::AlertDialogExt::set_response_appearance()] for details.
133    ///
134    /// Example of an [`AlertDialog`][crate::AlertDialog] UI definition:
135    ///
136    /// ```xml
137    /// <object class="AdwAlertDialog" id="dialog">
138    ///   <property name="heading" translatable="yes">Save Changes?</property>
139    ///   <property name="body" translatable="yes">Open documents contain unsaved changes. Changes which are not saved will be permanently lost.</property>
140    ///   <property name="default-response">save</property>
141    ///   <property name="close-response">cancel</property>
142    ///   <signal name="response" handler="response_cb"/>
143    ///   <responses>
144    ///     <response id="cancel" translatable="yes">_Cancel</response>
145    ///     <response id="discard" translatable="yes" appearance="destructive">_Discard</response>
146    ///     <response id="save" translatable="yes" appearance="suggested" enabled="false">_Save</response>
147    ///   </responses>
148    /// </object>
149    /// ```
150    ///
151    /// ## Properties
152    ///
153    ///
154    /// #### `body`
155    ///  The body text of the dialog.
156    ///
157    /// Readable | Writeable
158    ///
159    ///
160    /// #### `body-use-markup`
161    ///  Whether the body text includes Pango markup.
162    ///
163    /// See `parse_markup()`.
164    ///
165    /// Readable | Writeable
166    ///
167    ///
168    /// #### `close-response`
169    ///  The ID of the close response.
170    ///
171    /// It will be passed to [`response`][struct@crate::AlertDialog#response] if the dialog is
172    /// closed by pressing <kbd>Escape</kbd> or with a system action.
173    ///
174    /// It doesn't have to correspond to any of the responses in the dialog.
175    ///
176    /// The default close response is `close`.
177    ///
178    /// Readable | Writeable
179    ///
180    ///
181    /// #### `default-response`
182    ///  The response ID of the default response.
183    ///
184    /// If set, pressing <kbd>Enter</kbd> will activate the corresponding button.
185    ///
186    /// If set to `NULL` or a non-existent response ID, pressing <kbd>Enter</kbd>
187    /// will do nothing.
188    ///
189    /// Readable | Writeable
190    ///
191    ///
192    /// #### `extra-child`
193    ///  The child widget.
194    ///
195    /// Displayed below the heading and body.
196    ///
197    /// Readable | Writeable
198    ///
199    ///
200    /// #### `heading`
201    ///  The heading of the dialog.
202    ///
203    /// Readable | Writeable
204    ///
205    ///
206    /// #### `heading-use-markup`
207    ///  Whether the heading includes Pango markup.
208    ///
209    /// See `parse_markup()`.
210    ///
211    /// Readable | Writeable
212    ///
213    ///
214    /// #### `prefer-wide-layout`
215    ///  Whether to prefer wide layout.
216    ///
217    /// Prefer horizontal button layout when possible, and wider dialog width
218    /// otherwise.
219    ///
220    /// Readable | Writeable
221    /// <details><summary><h4>Dialog</h4></summary>
222    ///
223    ///
224    /// #### `can-close`
225    ///  Whether the dialog can be closed.
226    ///
227    /// If set to `FALSE`, the close button, shortcuts and
228    /// [`AdwDialogExt::close()`][crate::prelude::AdwDialogExt::close()] will result in [`close-attempt`][struct@crate::Dialog#close-attempt] being
229    /// emitted instead, and bottom sheet close swipe will be disabled.
230    /// [`AdwDialogExt::force_close()`][crate::prelude::AdwDialogExt::force_close()] still works.
231    ///
232    /// Readable | Writeable
233    ///
234    ///
235    /// #### `child`
236    ///  The child widget of the [`Dialog`][crate::Dialog].
237    ///
238    /// Readable | Writeable
239    ///
240    ///
241    /// #### `content-height`
242    ///  The height of the dialog's contents.
243    ///
244    /// Set it to -1 to reset it to the content's natural height.
245    ///
246    /// See also: [`default-height`][struct@crate::gtk::Window#default-height]
247    ///
248    /// Readable | Writeable
249    ///
250    ///
251    /// #### `content-width`
252    ///  The width of the dialog's contents.
253    ///
254    /// Set it to -1 to reset it to the content's natural width.
255    ///
256    /// See also: [`default-width`][struct@crate::gtk::Window#default-width]
257    ///
258    /// Readable | Writeable
259    ///
260    ///
261    /// #### `current-breakpoint`
262    ///  The current breakpoint.
263    ///
264    /// Readable
265    ///
266    ///
267    /// #### `default-widget`
268    ///  The default widget.
269    ///
270    /// It's activated when the user presses Enter.
271    ///
272    /// Readable | Writeable
273    ///
274    ///
275    /// #### `focus-widget`
276    ///  The focus widget.
277    ///
278    /// Readable | Writeable
279    ///
280    ///
281    /// #### `follows-content-size`
282    ///  Whether to size content automatically.
283    ///
284    /// If set to `TRUE`, always use the content's natural size instead of
285    /// [`content-width`][struct@crate::Dialog#content-width] and [`content-height`][struct@crate::Dialog#content-height]. If
286    /// the content resizes, the dialog will immediately resize as well.
287    ///
288    /// See also: [`resizable`][struct@crate::gtk::Window#resizable]
289    ///
290    /// Readable | Writeable
291    ///
292    ///
293    /// #### `presentation-mode`
294    ///  The dialog's presentation mode.
295    ///
296    /// When set to `ADW_DIALOG_AUTO`, the dialog appears as a bottom sheet when
297    /// the following condition is met: `max-width: 450px or max-height: 360px`,
298    /// and as a floating window otherwise.
299    ///
300    /// Set it to `ADW_DIALOG_FLOATING` or `ADW_DIALOG_BOTTOM_SHEET` to always
301    /// present it a floating window or a bottom sheet respectively, regardless of
302    /// available size.
303    ///
304    /// Presentation mode does nothing for dialogs presented as a window.
305    ///
306    /// Readable | Writeable
307    ///
308    ///
309    /// #### `title`
310    ///  The title of the dialog.
311    ///
312    /// Readable | Writeable
313    /// </details>
314    /// <details><summary><h4>Widget</h4></summary>
315    ///
316    ///
317    /// #### `can-focus`
318    ///  Whether the widget or any of its descendents can accept
319    /// the input focus.
320    ///
321    /// This property is meant to be set by widget implementations,
322    /// typically in their instance init function.
323    ///
324    /// Readable | Writeable
325    ///
326    ///
327    /// #### `can-target`
328    ///  Whether the widget can receive pointer events.
329    ///
330    /// Readable | Writeable
331    ///
332    ///
333    /// #### `css-classes`
334    ///  A list of css classes applied to this widget.
335    ///
336    /// Readable | Writeable
337    ///
338    ///
339    /// #### `css-name`
340    ///  The name of this widget in the CSS tree.
341    ///
342    /// This property is meant to be set by widget implementations,
343    /// typically in their instance init function.
344    ///
345    /// Readable | Writeable | Construct Only
346    ///
347    ///
348    /// #### `cursor`
349    ///  The cursor used by @widget.
350    ///
351    /// Readable | Writeable
352    ///
353    ///
354    /// #### `focus-on-click`
355    ///  Whether the widget should grab focus when it is clicked with the mouse.
356    ///
357    /// This property is only relevant for widgets that can take focus.
358    ///
359    /// Readable | Writeable
360    ///
361    ///
362    /// #### `focusable`
363    ///  Whether this widget itself will accept the input focus.
364    ///
365    /// Readable | Writeable
366    ///
367    ///
368    /// #### `halign`
369    ///  How to distribute horizontal space if widget gets extra space.
370    ///
371    /// Readable | Writeable
372    ///
373    ///
374    /// #### `has-default`
375    ///  Whether the widget is the default widget.
376    ///
377    /// Readable
378    ///
379    ///
380    /// #### `has-focus`
381    ///  Whether the widget has the input focus.
382    ///
383    /// Readable
384    ///
385    ///
386    /// #### `has-tooltip`
387    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
388    /// signal on @widget.
389    ///
390    /// A true value indicates that @widget can have a tooltip, in this case
391    /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
392    /// determine whether it will provide a tooltip or not.
393    ///
394    /// Readable | Writeable
395    ///
396    ///
397    /// #### `height-request`
398    ///  Overrides for height request of the widget.
399    ///
400    /// If this is -1, the natural request will be used.
401    ///
402    /// Readable | Writeable
403    ///
404    ///
405    /// #### `hexpand`
406    ///  Whether to expand horizontally.
407    ///
408    /// Readable | Writeable
409    ///
410    ///
411    /// #### `hexpand-set`
412    ///  Whether to use the `hexpand` property.
413    ///
414    /// Readable | Writeable
415    ///
416    ///
417    /// #### `layout-manager`
418    ///  The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
419    /// the preferred size of the widget, and allocate its children.
420    ///
421    /// This property is meant to be set by widget implementations,
422    /// typically in their instance init function.
423    ///
424    /// Readable | Writeable
425    ///
426    ///
427    /// #### `limit-events`
428    ///  Makes this widget act like a modal dialog, with respect to
429    /// event delivery.
430    ///
431    /// Global event controllers will not handle events with targets
432    /// inside the widget, unless they are set up to ignore propagation
433    /// limits. See `Gtk::EventController::set_propagation_limit()`.
434    ///
435    /// Readable | Writeable
436    ///
437    ///
438    /// #### `margin-bottom`
439    ///  Margin on bottom side of widget.
440    ///
441    /// This property adds margin outside of the widget's normal size
442    /// request, the margin will be added in addition to the size from
443    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
444    ///
445    /// Readable | Writeable
446    ///
447    ///
448    /// #### `margin-end`
449    ///  Margin on end of widget, horizontally.
450    ///
451    /// This property supports left-to-right and right-to-left text
452    /// directions.
453    ///
454    /// This property adds margin outside of the widget's normal size
455    /// request, the margin will be added in addition to the size from
456    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
457    ///
458    /// Readable | Writeable
459    ///
460    ///
461    /// #### `margin-start`
462    ///  Margin on start of widget, horizontally.
463    ///
464    /// This property supports left-to-right and right-to-left text
465    /// directions.
466    ///
467    /// This property adds margin outside of the widget's normal size
468    /// request, the margin will be added in addition to the size from
469    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
470    ///
471    /// Readable | Writeable
472    ///
473    ///
474    /// #### `margin-top`
475    ///  Margin on top side of widget.
476    ///
477    /// This property adds margin outside of the widget's normal size
478    /// request, the margin will be added in addition to the size from
479    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
480    ///
481    /// Readable | Writeable
482    ///
483    ///
484    /// #### `name`
485    ///  The name of the widget.
486    ///
487    /// Readable | Writeable
488    ///
489    ///
490    /// #### `opacity`
491    ///  The requested opacity of the widget.
492    ///
493    /// Readable | Writeable
494    ///
495    ///
496    /// #### `overflow`
497    ///  How content outside the widget's content area is treated.
498    ///
499    /// This property is meant to be set by widget implementations,
500    /// typically in their instance init function.
501    ///
502    /// Readable | Writeable
503    ///
504    ///
505    /// #### `parent`
506    ///  The parent widget of this widget.
507    ///
508    /// Readable
509    ///
510    ///
511    /// #### `receives-default`
512    ///  Whether the widget will receive the default action when it is focused.
513    ///
514    /// Readable | Writeable
515    ///
516    ///
517    /// #### `root`
518    ///  The [`gtk::Root`][crate::gtk::Root] widget of the widget tree containing this widget.
519    ///
520    /// This will be `NULL` if the widget is not contained in a root widget.
521    ///
522    /// Readable
523    ///
524    ///
525    /// #### `scale-factor`
526    ///  The scale factor of the widget.
527    ///
528    /// Readable
529    ///
530    ///
531    /// #### `sensitive`
532    ///  Whether the widget responds to input.
533    ///
534    /// Readable | Writeable
535    ///
536    ///
537    /// #### `tooltip-markup`
538    ///  Sets the text of tooltip to be the given string, which is marked up
539    /// with Pango markup.
540    ///
541    /// Also see `Gtk::Tooltip::set_markup()`.
542    ///
543    /// This is a convenience property which will take care of getting the
544    /// tooltip shown if the given string is not `NULL`:
545    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
546    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
547    /// the default signal handler.
548    ///
549    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
550    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
551    ///
552    /// Readable | Writeable
553    ///
554    ///
555    /// #### `tooltip-text`
556    ///  Sets the text of tooltip to be the given string.
557    ///
558    /// Also see `Gtk::Tooltip::set_text()`.
559    ///
560    /// This is a convenience property which will take care of getting the
561    /// tooltip shown if the given string is not `NULL`:
562    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
563    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
564    /// the default signal handler.
565    ///
566    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
567    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
568    ///
569    /// Readable | Writeable
570    ///
571    ///
572    /// #### `valign`
573    ///  How to distribute vertical space if widget gets extra space.
574    ///
575    /// Readable | Writeable
576    ///
577    ///
578    /// #### `vexpand`
579    ///  Whether to expand vertically.
580    ///
581    /// Readable | Writeable
582    ///
583    ///
584    /// #### `vexpand-set`
585    ///  Whether to use the `vexpand` property.
586    ///
587    /// Readable | Writeable
588    ///
589    ///
590    /// #### `visible`
591    ///  Whether the widget is visible.
592    ///
593    /// Readable | Writeable
594    ///
595    ///
596    /// #### `width-request`
597    ///  Overrides for width request of the widget.
598    ///
599    /// If this is -1, the natural request will be used.
600    ///
601    /// Readable | Writeable
602    /// </details>
603    /// <details><summary><h4>Accessible</h4></summary>
604    ///
605    ///
606    /// #### `accessible-role`
607    ///  The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
608    ///
609    /// The accessible role cannot be changed once set.
610    ///
611    /// Readable | Writeable
612    /// </details>
613    ///
614    /// ## Signals
615    ///
616    ///
617    /// #### `response`
618    ///  This signal is emitted when the dialog is closed.
619    ///
620    /// @response will be set to the response ID of the button that had been
621    /// activated.
622    ///
623    /// if the dialog was closed by pressing <kbd>Escape</kbd> or with a system
624    /// action, @response will be set to the value of
625    /// [`close-response`][struct@crate::AlertDialog#close-response].
626    ///
627    /// Detailed
628    /// <details><summary><h4>Dialog</h4></summary>
629    ///
630    ///
631    /// #### `close-attempt`
632    ///  Emitted when the close button or shortcut is used, or
633    /// [`AdwDialogExt::close()`][crate::prelude::AdwDialogExt::close()] is called while [`can-close`][struct@crate::Dialog#can-close] is set to
634    /// `FALSE`.
635    ///
636    ///
637    ///
638    ///
639    /// #### `closed`
640    ///  Emitted when the dialog is successfully closed.
641    ///
642    ///
643    /// </details>
644    /// <details><summary><h4>Widget</h4></summary>
645    ///
646    ///
647    /// #### `destroy`
648    ///  Signals that all holders of a reference to the widget should release
649    /// the reference that they hold.
650    ///
651    /// May result in finalization of the widget if all references are released.
652    ///
653    /// This signal is not suitable for saving widget state.
654    ///
655    ///
656    ///
657    ///
658    /// #### `direction-changed`
659    ///  Emitted when the text direction of a widget changes.
660    ///
661    ///
662    ///
663    ///
664    /// #### `hide`
665    ///  Emitted when @widget is hidden.
666    ///
667    ///
668    ///
669    ///
670    /// #### `keynav-failed`
671    ///  Emitted if keyboard navigation fails.
672    ///
673    /// See [`WidgetExtManual::keynav_failed()`][crate::gtk::prelude::WidgetExtManual::keynav_failed()] for details.
674    ///
675    ///
676    ///
677    ///
678    /// #### `map`
679    ///  Emitted when @widget is going to be mapped.
680    ///
681    /// A widget is mapped when the widget is visible (which is controlled with
682    /// [`visible`][struct@crate::gtk::Widget#visible]) and all its parents up to the toplevel widget
683    /// are also visible.
684    ///
685    /// The `::map` signal can be used to determine whether a widget will be drawn,
686    /// for instance it can resume an animation that was stopped during the
687    /// emission of [`unmap`][struct@crate::gtk::Widget#unmap].
688    ///
689    ///
690    ///
691    ///
692    /// #### `mnemonic-activate`
693    ///  Emitted when a widget is activated via a mnemonic.
694    ///
695    /// The default handler for this signal activates @widget if @group_cycling
696    /// is false, or just makes @widget grab focus if @group_cycling is true.
697    ///
698    ///
699    ///
700    ///
701    /// #### `move-focus`
702    ///  Emitted when the focus is moved.
703    ///
704    /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
705    ///
706    /// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
707    /// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
708    ///
709    /// Action
710    ///
711    ///
712    /// #### `query-tooltip`
713    ///  Emitted when the widget’s tooltip is about to be shown.
714    ///
715    /// This happens when the [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] property
716    /// is true and the hover timeout has expired with the cursor hovering
717    /// above @widget; or emitted when @widget got focus in keyboard mode.
718    ///
719    /// Using the given coordinates, the signal handler should determine
720    /// whether a tooltip should be shown for @widget. If this is the case
721    /// true should be returned, false otherwise. Note that if @keyboard_mode
722    /// is true, the values of @x and @y are undefined and should not be used.
723    ///
724    /// The signal handler is free to manipulate @tooltip with the therefore
725    /// destined function calls.
726    ///
727    ///
728    ///
729    ///
730    /// #### `realize`
731    ///  Emitted when @widget is associated with a `GdkSurface`.
732    ///
733    /// This means that [`WidgetExtManual::realize()`][crate::gtk::prelude::WidgetExtManual::realize()] has been called
734    /// or the widget has been mapped (that is, it is going to be drawn).
735    ///
736    ///
737    ///
738    ///
739    /// #### `show`
740    ///  Emitted when @widget is shown.
741    ///
742    ///
743    ///
744    ///
745    /// #### `state-flags-changed`
746    ///  Emitted when the widget state changes.
747    ///
748    /// See [`WidgetExtManual::state_flags()`][crate::gtk::prelude::WidgetExtManual::state_flags()].
749    ///
750    ///
751    ///
752    ///
753    /// #### `unmap`
754    ///  Emitted when @widget is going to be unmapped.
755    ///
756    /// A widget is unmapped when either it or any of its parents up to the
757    /// toplevel widget have been set as hidden.
758    ///
759    /// As `::unmap` indicates that a widget will not be shown any longer,
760    /// it can be used to, for example, stop an animation on the widget.
761    ///
762    ///
763    ///
764    ///
765    /// #### `unrealize`
766    ///  Emitted when the `GdkSurface` associated with @widget is destroyed.
767    ///
768    /// This means that [`WidgetExtManual::unrealize()`][crate::gtk::prelude::WidgetExtManual::unrealize()] has been called
769    /// or the widget has been unmapped (that is, it is going to be hidden).
770    ///
771    ///
772    /// </details>
773    ///
774    /// # Implements
775    ///
776    /// [`AlertDialogExt`][trait@crate::prelude::AlertDialogExt], [`AdwDialogExt`][trait@crate::prelude::AdwDialogExt], [`trait@gtk::prelude::WidgetExt`], [`trait@glib::ObjectExt`], [`trait@gtk::prelude::AccessibleExt`], [`trait@gtk::prelude::BuildableExt`], [`trait@gtk::prelude::ConstraintTargetExt`], [`trait@gtk::prelude::ShortcutManagerExt`], [`AlertDialogExtManual`][trait@crate::prelude::AlertDialogExtManual]
777    #[doc(alias = "AdwAlertDialog")]
778    pub struct AlertDialog(Object<ffi::AdwAlertDialog, ffi::AdwAlertDialogClass>) @extends Dialog, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::ShortcutManager;
779
780    match fn {
781        type_ => || ffi::adw_alert_dialog_get_type(),
782    }
783}
784
785impl AlertDialog {
786    pub const NONE: Option<&'static AlertDialog> = None;
787
788    /// Creates a new [`AlertDialog`][crate::AlertDialog].
789    ///
790    /// @heading and @body can be set to `NULL`. This can be useful if they need to
791    /// be formatted or use markup. In that case, set them to `NULL` and call
792    /// `AlertDialog::format_body()` or similar methods afterwards:
793    ///
794    /// **⚠️ The following code is in c ⚠️**
795    ///
796    /// ```c
797    /// AdwDialog *dialog;
798    ///
799    /// dialog = adw_alert_dialog_new (_("Replace File?"), NULL);
800    /// adw_alert_dialog_format_body (ADW_ALERT_DIALOG (dialog),
801    ///                               _("A file named “%s” already exists.  Do you want to replace it?"),
802    ///                               filename);
803    /// ```
804    /// ## `heading`
805    /// the heading
806    /// ## `body`
807    /// the body text
808    ///
809    /// # Returns
810    ///
811    /// the newly created [`AlertDialog`][crate::AlertDialog]
812    #[doc(alias = "adw_alert_dialog_new")]
813    pub fn new(heading: Option<&str>, body: Option<&str>) -> AlertDialog {
814        assert_initialized_main_thread!();
815        unsafe {
816            Dialog::from_glib_none(ffi::adw_alert_dialog_new(
817                heading.to_glib_none().0,
818                body.to_glib_none().0,
819            ))
820            .unsafe_cast()
821        }
822    }
823
824    // rustdoc-stripper-ignore-next
825    /// Creates a new builder-pattern struct instance to construct [`AlertDialog`] objects.
826    ///
827    /// This method returns an instance of [`AlertDialogBuilder`](crate::builders::AlertDialogBuilder) which can be used to create [`AlertDialog`] objects.
828    pub fn builder() -> AlertDialogBuilder {
829        AlertDialogBuilder::new()
830    }
831}
832
833#[cfg(feature = "v1_5")]
834#[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
835impl Default for AlertDialog {
836    fn default() -> Self {
837        glib::object::Object::new::<Self>()
838    }
839}
840
841// rustdoc-stripper-ignore-next
842/// A [builder-pattern] type to construct [`AlertDialog`] objects.
843///
844/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
845#[must_use = "The builder must be built to be used"]
846pub struct AlertDialogBuilder {
847    builder: glib::object::ObjectBuilder<'static, AlertDialog>,
848}
849
850impl AlertDialogBuilder {
851    fn new() -> Self {
852        Self {
853            builder: glib::object::Object::builder(),
854        }
855    }
856
857    /// The body text of the dialog.
858    #[cfg(feature = "v1_5")]
859    #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
860    pub fn body(self, body: impl Into<glib::GString>) -> Self {
861        Self {
862            builder: self.builder.property("body", body.into()),
863        }
864    }
865
866    /// Whether the body text includes Pango markup.
867    ///
868    /// See `parse_markup()`.
869    #[cfg(feature = "v1_5")]
870    #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
871    pub fn body_use_markup(self, body_use_markup: bool) -> Self {
872        Self {
873            builder: self.builder.property("body-use-markup", body_use_markup),
874        }
875    }
876
877    /// The ID of the close response.
878    ///
879    /// It will be passed to [`response`][struct@crate::AlertDialog#response] if the dialog is
880    /// closed by pressing <kbd>Escape</kbd> or with a system action.
881    ///
882    /// It doesn't have to correspond to any of the responses in the dialog.
883    ///
884    /// The default close response is `close`.
885    #[cfg(feature = "v1_5")]
886    #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
887    pub fn close_response(self, close_response: impl Into<glib::GString>) -> Self {
888        Self {
889            builder: self
890                .builder
891                .property("close-response", close_response.into()),
892        }
893    }
894
895    /// The response ID of the default response.
896    ///
897    /// If set, pressing <kbd>Enter</kbd> will activate the corresponding button.
898    ///
899    /// If set to `NULL` or a non-existent response ID, pressing <kbd>Enter</kbd>
900    /// will do nothing.
901    #[cfg(feature = "v1_5")]
902    #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
903    pub fn default_response(self, default_response: impl Into<glib::GString>) -> Self {
904        Self {
905            builder: self
906                .builder
907                .property("default-response", default_response.into()),
908        }
909    }
910
911    /// The child widget.
912    ///
913    /// Displayed below the heading and body.
914    #[cfg(feature = "v1_5")]
915    #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
916    pub fn extra_child(self, extra_child: &impl IsA<gtk::Widget>) -> Self {
917        Self {
918            builder: self
919                .builder
920                .property("extra-child", extra_child.clone().upcast()),
921        }
922    }
923
924    /// The heading of the dialog.
925    #[cfg(feature = "v1_5")]
926    #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
927    pub fn heading(self, heading: impl Into<glib::GString>) -> Self {
928        Self {
929            builder: self.builder.property("heading", heading.into()),
930        }
931    }
932
933    /// Whether the heading includes Pango markup.
934    ///
935    /// See `parse_markup()`.
936    #[cfg(feature = "v1_5")]
937    #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
938    pub fn heading_use_markup(self, heading_use_markup: bool) -> Self {
939        Self {
940            builder: self
941                .builder
942                .property("heading-use-markup", heading_use_markup),
943        }
944    }
945
946    /// Whether to prefer wide layout.
947    ///
948    /// Prefer horizontal button layout when possible, and wider dialog width
949    /// otherwise.
950    #[cfg(feature = "v1_6")]
951    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
952    pub fn prefer_wide_layout(self, prefer_wide_layout: bool) -> Self {
953        Self {
954            builder: self
955                .builder
956                .property("prefer-wide-layout", prefer_wide_layout),
957        }
958    }
959
960    /// Whether the dialog can be closed.
961    ///
962    /// If set to `FALSE`, the close button, shortcuts and
963    /// [`AdwDialogExt::close()`][crate::prelude::AdwDialogExt::close()] will result in [`close-attempt`][struct@crate::Dialog#close-attempt] being
964    /// emitted instead, and bottom sheet close swipe will be disabled.
965    /// [`AdwDialogExt::force_close()`][crate::prelude::AdwDialogExt::force_close()] still works.
966    #[cfg(feature = "v1_5")]
967    #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
968    pub fn can_close(self, can_close: bool) -> Self {
969        Self {
970            builder: self.builder.property("can-close", can_close),
971        }
972    }
973
974    /// The child widget of the [`Dialog`][crate::Dialog].
975    #[cfg(feature = "v1_5")]
976    #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
977    pub fn child(self, child: &impl IsA<gtk::Widget>) -> Self {
978        Self {
979            builder: self.builder.property("child", child.clone().upcast()),
980        }
981    }
982
983    /// The height of the dialog's contents.
984    ///
985    /// Set it to -1 to reset it to the content's natural height.
986    ///
987    /// See also: [`default-height`][struct@crate::gtk::Window#default-height]
988    #[cfg(feature = "v1_5")]
989    #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
990    pub fn content_height(self, content_height: i32) -> Self {
991        Self {
992            builder: self.builder.property("content-height", content_height),
993        }
994    }
995
996    /// The width of the dialog's contents.
997    ///
998    /// Set it to -1 to reset it to the content's natural width.
999    ///
1000    /// See also: [`default-width`][struct@crate::gtk::Window#default-width]
1001    #[cfg(feature = "v1_5")]
1002    #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
1003    pub fn content_width(self, content_width: i32) -> Self {
1004        Self {
1005            builder: self.builder.property("content-width", content_width),
1006        }
1007    }
1008
1009    /// The default widget.
1010    ///
1011    /// It's activated when the user presses Enter.
1012    #[cfg(feature = "v1_5")]
1013    #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
1014    pub fn default_widget(self, default_widget: &impl IsA<gtk::Widget>) -> Self {
1015        Self {
1016            builder: self
1017                .builder
1018                .property("default-widget", default_widget.clone().upcast()),
1019        }
1020    }
1021
1022    /// The focus widget.
1023    #[cfg(feature = "v1_5")]
1024    #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
1025    pub fn focus_widget(self, focus_widget: &impl IsA<gtk::Widget>) -> Self {
1026        Self {
1027            builder: self
1028                .builder
1029                .property("focus-widget", focus_widget.clone().upcast()),
1030        }
1031    }
1032
1033    /// Whether to size content automatically.
1034    ///
1035    /// If set to `TRUE`, always use the content's natural size instead of
1036    /// [`content-width`][struct@crate::Dialog#content-width] and [`content-height`][struct@crate::Dialog#content-height]. If
1037    /// the content resizes, the dialog will immediately resize as well.
1038    ///
1039    /// See also: [`resizable`][struct@crate::gtk::Window#resizable]
1040    #[cfg(feature = "v1_5")]
1041    #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
1042    pub fn follows_content_size(self, follows_content_size: bool) -> Self {
1043        Self {
1044            builder: self
1045                .builder
1046                .property("follows-content-size", follows_content_size),
1047        }
1048    }
1049
1050    /// The dialog's presentation mode.
1051    ///
1052    /// When set to `ADW_DIALOG_AUTO`, the dialog appears as a bottom sheet when
1053    /// the following condition is met: `max-width: 450px or max-height: 360px`,
1054    /// and as a floating window otherwise.
1055    ///
1056    /// Set it to `ADW_DIALOG_FLOATING` or `ADW_DIALOG_BOTTOM_SHEET` to always
1057    /// present it a floating window or a bottom sheet respectively, regardless of
1058    /// available size.
1059    ///
1060    /// Presentation mode does nothing for dialogs presented as a window.
1061    #[cfg(feature = "v1_5")]
1062    #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
1063    pub fn presentation_mode(self, presentation_mode: DialogPresentationMode) -> Self {
1064        Self {
1065            builder: self
1066                .builder
1067                .property("presentation-mode", presentation_mode),
1068        }
1069    }
1070
1071    /// The title of the dialog.
1072    #[cfg(feature = "v1_5")]
1073    #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
1074    pub fn title(self, title: impl Into<glib::GString>) -> Self {
1075        Self {
1076            builder: self.builder.property("title", title.into()),
1077        }
1078    }
1079
1080    /// Whether the widget or any of its descendents can accept
1081    /// the input focus.
1082    ///
1083    /// This property is meant to be set by widget implementations,
1084    /// typically in their instance init function.
1085    pub fn can_focus(self, can_focus: bool) -> Self {
1086        Self {
1087            builder: self.builder.property("can-focus", can_focus),
1088        }
1089    }
1090
1091    /// Whether the widget can receive pointer events.
1092    pub fn can_target(self, can_target: bool) -> Self {
1093        Self {
1094            builder: self.builder.property("can-target", can_target),
1095        }
1096    }
1097
1098    /// A list of css classes applied to this widget.
1099    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1100        Self {
1101            builder: self.builder.property("css-classes", css_classes.into()),
1102        }
1103    }
1104
1105    /// The name of this widget in the CSS tree.
1106    ///
1107    /// This property is meant to be set by widget implementations,
1108    /// typically in their instance init function.
1109    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1110        Self {
1111            builder: self.builder.property("css-name", css_name.into()),
1112        }
1113    }
1114
1115    /// The cursor used by @widget.
1116    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1117        Self {
1118            builder: self.builder.property("cursor", cursor.clone()),
1119        }
1120    }
1121
1122    /// Whether the widget should grab focus when it is clicked with the mouse.
1123    ///
1124    /// This property is only relevant for widgets that can take focus.
1125    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1126        Self {
1127            builder: self.builder.property("focus-on-click", focus_on_click),
1128        }
1129    }
1130
1131    /// Whether this widget itself will accept the input focus.
1132    pub fn focusable(self, focusable: bool) -> Self {
1133        Self {
1134            builder: self.builder.property("focusable", focusable),
1135        }
1136    }
1137
1138    /// How to distribute horizontal space if widget gets extra space.
1139    pub fn halign(self, halign: gtk::Align) -> Self {
1140        Self {
1141            builder: self.builder.property("halign", halign),
1142        }
1143    }
1144
1145    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
1146    /// signal on @widget.
1147    ///
1148    /// A true value indicates that @widget can have a tooltip, in this case
1149    /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
1150    /// determine whether it will provide a tooltip or not.
1151    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1152        Self {
1153            builder: self.builder.property("has-tooltip", has_tooltip),
1154        }
1155    }
1156
1157    /// Overrides for height request of the widget.
1158    ///
1159    /// If this is -1, the natural request will be used.
1160    pub fn height_request(self, height_request: i32) -> Self {
1161        Self {
1162            builder: self.builder.property("height-request", height_request),
1163        }
1164    }
1165
1166    /// Whether to expand horizontally.
1167    pub fn hexpand(self, hexpand: bool) -> Self {
1168        Self {
1169            builder: self.builder.property("hexpand", hexpand),
1170        }
1171    }
1172
1173    /// Whether to use the `hexpand` property.
1174    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1175        Self {
1176            builder: self.builder.property("hexpand-set", hexpand_set),
1177        }
1178    }
1179
1180    /// The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
1181    /// the preferred size of the widget, and allocate its children.
1182    ///
1183    /// This property is meant to be set by widget implementations,
1184    /// typically in their instance init function.
1185    pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
1186        Self {
1187            builder: self
1188                .builder
1189                .property("layout-manager", layout_manager.clone().upcast()),
1190        }
1191    }
1192
1193    /// Makes this widget act like a modal dialog, with respect to
1194    /// event delivery.
1195    ///
1196    /// Global event controllers will not handle events with targets
1197    /// inside the widget, unless they are set up to ignore propagation
1198    /// limits. See `Gtk::EventController::set_propagation_limit()`.
1199    #[cfg(feature = "gtk_v4_18")]
1200    #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
1201    pub fn limit_events(self, limit_events: bool) -> Self {
1202        Self {
1203            builder: self.builder.property("limit-events", limit_events),
1204        }
1205    }
1206
1207    /// Margin on bottom side of widget.
1208    ///
1209    /// This property adds margin outside of the widget's normal size
1210    /// request, the margin will be added in addition to the size from
1211    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1212    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1213        Self {
1214            builder: self.builder.property("margin-bottom", margin_bottom),
1215        }
1216    }
1217
1218    /// Margin on end of widget, horizontally.
1219    ///
1220    /// This property supports left-to-right and right-to-left text
1221    /// directions.
1222    ///
1223    /// This property adds margin outside of the widget's normal size
1224    /// request, the margin will be added in addition to the size from
1225    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1226    pub fn margin_end(self, margin_end: i32) -> Self {
1227        Self {
1228            builder: self.builder.property("margin-end", margin_end),
1229        }
1230    }
1231
1232    /// Margin on start of widget, horizontally.
1233    ///
1234    /// This property supports left-to-right and right-to-left text
1235    /// directions.
1236    ///
1237    /// This property adds margin outside of the widget's normal size
1238    /// request, the margin will be added in addition to the size from
1239    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1240    pub fn margin_start(self, margin_start: i32) -> Self {
1241        Self {
1242            builder: self.builder.property("margin-start", margin_start),
1243        }
1244    }
1245
1246    /// Margin on top side of widget.
1247    ///
1248    /// This property adds margin outside of the widget's normal size
1249    /// request, the margin will be added in addition to the size from
1250    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1251    pub fn margin_top(self, margin_top: i32) -> Self {
1252        Self {
1253            builder: self.builder.property("margin-top", margin_top),
1254        }
1255    }
1256
1257    /// The name of the widget.
1258    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1259        Self {
1260            builder: self.builder.property("name", name.into()),
1261        }
1262    }
1263
1264    /// The requested opacity of the widget.
1265    pub fn opacity(self, opacity: f64) -> Self {
1266        Self {
1267            builder: self.builder.property("opacity", opacity),
1268        }
1269    }
1270
1271    /// How content outside the widget's content area is treated.
1272    ///
1273    /// This property is meant to be set by widget implementations,
1274    /// typically in their instance init function.
1275    pub fn overflow(self, overflow: gtk::Overflow) -> Self {
1276        Self {
1277            builder: self.builder.property("overflow", overflow),
1278        }
1279    }
1280
1281    /// Whether the widget will receive the default action when it is focused.
1282    pub fn receives_default(self, receives_default: bool) -> Self {
1283        Self {
1284            builder: self.builder.property("receives-default", receives_default),
1285        }
1286    }
1287
1288    /// Whether the widget responds to input.
1289    pub fn sensitive(self, sensitive: bool) -> Self {
1290        Self {
1291            builder: self.builder.property("sensitive", sensitive),
1292        }
1293    }
1294
1295    /// Sets the text of tooltip to be the given string, which is marked up
1296    /// with Pango markup.
1297    ///
1298    /// Also see `Gtk::Tooltip::set_markup()`.
1299    ///
1300    /// This is a convenience property which will take care of getting the
1301    /// tooltip shown if the given string is not `NULL`:
1302    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
1303    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
1304    /// the default signal handler.
1305    ///
1306    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
1307    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
1308    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1309        Self {
1310            builder: self
1311                .builder
1312                .property("tooltip-markup", tooltip_markup.into()),
1313        }
1314    }
1315
1316    /// Sets the text of tooltip to be the given string.
1317    ///
1318    /// Also see `Gtk::Tooltip::set_text()`.
1319    ///
1320    /// This is a convenience property which will take care of getting the
1321    /// tooltip shown if the given string is not `NULL`:
1322    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
1323    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
1324    /// the default signal handler.
1325    ///
1326    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
1327    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
1328    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1329        Self {
1330            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1331        }
1332    }
1333
1334    /// How to distribute vertical space if widget gets extra space.
1335    pub fn valign(self, valign: gtk::Align) -> Self {
1336        Self {
1337            builder: self.builder.property("valign", valign),
1338        }
1339    }
1340
1341    /// Whether to expand vertically.
1342    pub fn vexpand(self, vexpand: bool) -> Self {
1343        Self {
1344            builder: self.builder.property("vexpand", vexpand),
1345        }
1346    }
1347
1348    /// Whether to use the `vexpand` property.
1349    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1350        Self {
1351            builder: self.builder.property("vexpand-set", vexpand_set),
1352        }
1353    }
1354
1355    /// Whether the widget is visible.
1356    pub fn visible(self, visible: bool) -> Self {
1357        Self {
1358            builder: self.builder.property("visible", visible),
1359        }
1360    }
1361
1362    /// Overrides for width request of the widget.
1363    ///
1364    /// If this is -1, the natural request will be used.
1365    pub fn width_request(self, width_request: i32) -> Self {
1366        Self {
1367            builder: self.builder.property("width-request", width_request),
1368        }
1369    }
1370
1371    /// The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
1372    ///
1373    /// The accessible role cannot be changed once set.
1374    pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
1375        Self {
1376            builder: self.builder.property("accessible-role", accessible_role),
1377        }
1378    }
1379
1380    // rustdoc-stripper-ignore-next
1381    /// Build the [`AlertDialog`].
1382    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1383    pub fn build(self) -> AlertDialog {
1384        assert_initialized_main_thread!();
1385        self.builder.build()
1386    }
1387}
1388
1389/// Trait containing all [`struct@AlertDialog`] methods.
1390///
1391/// # Implementors
1392///
1393/// [`AlertDialog`][struct@crate::AlertDialog]
1394pub trait AlertDialogExt: IsA<AlertDialog> + 'static {
1395    /// Adds a response with @id and @label to @self.
1396    ///
1397    /// Responses are represented as buttons in the dialog.
1398    ///
1399    /// Response ID must be unique. It will be used in [`response`][struct@crate::AlertDialog#response]
1400    /// to tell which response had been activated, as well as to inspect and modify
1401    /// the response later.
1402    ///
1403    /// An embedded underline in @label indicates a mnemonic.
1404    ///
1405    /// [`set_response_label()`][Self::set_response_label()] can be used to change the response
1406    /// label after it had been added.
1407    ///
1408    /// [`set_response_enabled()`][Self::set_response_enabled()] and
1409    /// [`set_response_appearance()`][Self::set_response_appearance()] can be used to customize the
1410    /// responses further.
1411    /// ## `id`
1412    /// the response ID
1413    /// ## `label`
1414    /// the response label
1415    #[doc(alias = "adw_alert_dialog_add_response")]
1416    fn add_response(&self, id: &str, label: &str) {
1417        unsafe {
1418            ffi::adw_alert_dialog_add_response(
1419                self.as_ref().to_glib_none().0,
1420                id.to_glib_none().0,
1421                label.to_glib_none().0,
1422            );
1423        }
1424    }
1425
1426    /// Gets the body text of @self.
1427    ///
1428    /// # Returns
1429    ///
1430    /// the body of @self.
1431    #[doc(alias = "adw_alert_dialog_get_body")]
1432    #[doc(alias = "get_body")]
1433    fn body(&self) -> glib::GString {
1434        unsafe {
1435            from_glib_none(ffi::adw_alert_dialog_get_body(
1436                self.as_ref().to_glib_none().0,
1437            ))
1438        }
1439    }
1440
1441    /// Gets whether the body text of @self includes Pango markup.
1442    ///
1443    /// # Returns
1444    ///
1445    /// whether @self uses markup for body text
1446    #[doc(alias = "adw_alert_dialog_get_body_use_markup")]
1447    #[doc(alias = "get_body_use_markup")]
1448    #[doc(alias = "body-use-markup")]
1449    fn is_body_use_markup(&self) -> bool {
1450        unsafe {
1451            from_glib(ffi::adw_alert_dialog_get_body_use_markup(
1452                self.as_ref().to_glib_none().0,
1453            ))
1454        }
1455    }
1456
1457    /// Gets the ID of the close response of @self.
1458    ///
1459    /// # Returns
1460    ///
1461    /// the close response ID
1462    #[doc(alias = "adw_alert_dialog_get_close_response")]
1463    #[doc(alias = "get_close_response")]
1464    #[doc(alias = "close-response")]
1465    fn close_response(&self) -> glib::GString {
1466        unsafe {
1467            from_glib_none(ffi::adw_alert_dialog_get_close_response(
1468                self.as_ref().to_glib_none().0,
1469            ))
1470        }
1471    }
1472
1473    /// Gets the ID of the default response of @self.
1474    ///
1475    /// # Returns
1476    ///
1477    /// the default response ID
1478    #[doc(alias = "adw_alert_dialog_get_default_response")]
1479    #[doc(alias = "get_default_response")]
1480    #[doc(alias = "default-response")]
1481    fn default_response(&self) -> Option<glib::GString> {
1482        unsafe {
1483            from_glib_none(ffi::adw_alert_dialog_get_default_response(
1484                self.as_ref().to_glib_none().0,
1485            ))
1486        }
1487    }
1488
1489    /// Gets the child widget of @self.
1490    ///
1491    /// # Returns
1492    ///
1493    /// the child widget of @self.
1494    #[doc(alias = "adw_alert_dialog_get_extra_child")]
1495    #[doc(alias = "get_extra_child")]
1496    #[doc(alias = "extra-child")]
1497    fn extra_child(&self) -> Option<gtk::Widget> {
1498        unsafe {
1499            from_glib_none(ffi::adw_alert_dialog_get_extra_child(
1500                self.as_ref().to_glib_none().0,
1501            ))
1502        }
1503    }
1504
1505    /// Gets the heading of @self.
1506    ///
1507    /// # Returns
1508    ///
1509    /// the heading of @self.
1510    #[doc(alias = "adw_alert_dialog_get_heading")]
1511    #[doc(alias = "get_heading")]
1512    fn heading(&self) -> Option<glib::GString> {
1513        unsafe {
1514            from_glib_none(ffi::adw_alert_dialog_get_heading(
1515                self.as_ref().to_glib_none().0,
1516            ))
1517        }
1518    }
1519
1520    /// Gets whether the heading of @self includes Pango markup.
1521    ///
1522    /// # Returns
1523    ///
1524    /// whether @self uses markup for heading
1525    #[doc(alias = "adw_alert_dialog_get_heading_use_markup")]
1526    #[doc(alias = "get_heading_use_markup")]
1527    #[doc(alias = "heading-use-markup")]
1528    fn is_heading_use_markup(&self) -> bool {
1529        unsafe {
1530            from_glib(ffi::adw_alert_dialog_get_heading_use_markup(
1531                self.as_ref().to_glib_none().0,
1532            ))
1533        }
1534    }
1535
1536    /// Gets whether @self prefers wide layout.
1537    ///
1538    /// # Returns
1539    ///
1540    /// whether to prefer wide layout
1541    #[doc(alias = "adw_alert_dialog_get_prefer_wide_layout")]
1542    #[doc(alias = "get_prefer_wide_layout")]
1543    #[doc(alias = "prefer-wide-layout")]
1544    fn prefers_wide_layout(&self) -> bool {
1545        unsafe {
1546            from_glib(ffi::adw_alert_dialog_get_prefer_wide_layout(
1547                self.as_ref().to_glib_none().0,
1548            ))
1549        }
1550    }
1551
1552    /// Gets the appearance of @response.
1553    ///
1554    /// See [`set_response_appearance()`][Self::set_response_appearance()].
1555    /// ## `response`
1556    /// a response ID
1557    ///
1558    /// # Returns
1559    ///
1560    /// the appearance of @response
1561    #[doc(alias = "adw_alert_dialog_get_response_appearance")]
1562    #[doc(alias = "get_response_appearance")]
1563    fn response_appearance(&self, response: &str) -> ResponseAppearance {
1564        unsafe {
1565            from_glib(ffi::adw_alert_dialog_get_response_appearance(
1566                self.as_ref().to_glib_none().0,
1567                response.to_glib_none().0,
1568            ))
1569        }
1570    }
1571
1572    /// Gets whether @response is enabled.
1573    ///
1574    /// See [`set_response_enabled()`][Self::set_response_enabled()].
1575    /// ## `response`
1576    /// a response ID
1577    ///
1578    /// # Returns
1579    ///
1580    /// whether @response is enabled
1581    #[doc(alias = "adw_alert_dialog_get_response_enabled")]
1582    #[doc(alias = "get_response_enabled")]
1583    fn is_response_enabled(&self, response: &str) -> bool {
1584        unsafe {
1585            from_glib(ffi::adw_alert_dialog_get_response_enabled(
1586                self.as_ref().to_glib_none().0,
1587                response.to_glib_none().0,
1588            ))
1589        }
1590    }
1591
1592    /// Gets whether @self has a response with the ID @response.
1593    /// ## `response`
1594    /// response ID
1595    ///
1596    /// # Returns
1597    ///
1598    /// whether @self has a response with the ID @response.
1599    #[doc(alias = "adw_alert_dialog_has_response")]
1600    fn has_response(&self, response: &str) -> bool {
1601        unsafe {
1602            from_glib(ffi::adw_alert_dialog_has_response(
1603                self.as_ref().to_glib_none().0,
1604                response.to_glib_none().0,
1605            ))
1606        }
1607    }
1608
1609    /// Removes a response from @self.
1610    /// ## `id`
1611    /// the response ID
1612    #[doc(alias = "adw_alert_dialog_remove_response")]
1613    fn remove_response(&self, id: &str) {
1614        unsafe {
1615            ffi::adw_alert_dialog_remove_response(
1616                self.as_ref().to_glib_none().0,
1617                id.to_glib_none().0,
1618            );
1619        }
1620    }
1621
1622    /// Sets the body text of @self.
1623    /// ## `body`
1624    /// the body of @self
1625    #[doc(alias = "adw_alert_dialog_set_body")]
1626    #[doc(alias = "body")]
1627    fn set_body(&self, body: &str) {
1628        unsafe {
1629            ffi::adw_alert_dialog_set_body(self.as_ref().to_glib_none().0, body.to_glib_none().0);
1630        }
1631    }
1632
1633    /// Sets whether the body text of @self includes Pango markup.
1634    ///
1635    /// See `parse_markup()`.
1636    /// ## `use_markup`
1637    /// whether to use markup for body text
1638    #[doc(alias = "adw_alert_dialog_set_body_use_markup")]
1639    #[doc(alias = "body-use-markup")]
1640    fn set_body_use_markup(&self, use_markup: bool) {
1641        unsafe {
1642            ffi::adw_alert_dialog_set_body_use_markup(
1643                self.as_ref().to_glib_none().0,
1644                use_markup.into_glib(),
1645            );
1646        }
1647    }
1648
1649    /// Sets the ID of the close response of @self.
1650    ///
1651    /// It will be passed to [`response`][struct@crate::AlertDialog#response] if the dialog is closed
1652    /// by pressing <kbd>Escape</kbd> or with a system action.
1653    ///
1654    /// It doesn't have to correspond to any of the responses in the dialog.
1655    ///
1656    /// The default close response is `close`.
1657    /// ## `response`
1658    /// the close response ID
1659    #[doc(alias = "adw_alert_dialog_set_close_response")]
1660    #[doc(alias = "close-response")]
1661    fn set_close_response(&self, response: &str) {
1662        unsafe {
1663            ffi::adw_alert_dialog_set_close_response(
1664                self.as_ref().to_glib_none().0,
1665                response.to_glib_none().0,
1666            );
1667        }
1668    }
1669
1670    /// Sets the ID of the default response of @self.
1671    ///
1672    /// If set, pressing <kbd>Enter</kbd> will activate the corresponding button.
1673    ///
1674    /// If set to `NULL` or to a non-existent response ID, pressing <kbd>Enter</kbd>
1675    /// will do nothing.
1676    /// ## `response`
1677    /// the default response ID
1678    #[doc(alias = "adw_alert_dialog_set_default_response")]
1679    #[doc(alias = "default-response")]
1680    fn set_default_response(&self, response: Option<&str>) {
1681        unsafe {
1682            ffi::adw_alert_dialog_set_default_response(
1683                self.as_ref().to_glib_none().0,
1684                response.to_glib_none().0,
1685            );
1686        }
1687    }
1688
1689    /// Sets the child widget of @self.
1690    ///
1691    /// The child widget is displayed below the heading and body.
1692    /// ## `child`
1693    /// the child widget
1694    #[doc(alias = "adw_alert_dialog_set_extra_child")]
1695    #[doc(alias = "extra-child")]
1696    fn set_extra_child(&self, child: Option<&impl IsA<gtk::Widget>>) {
1697        unsafe {
1698            ffi::adw_alert_dialog_set_extra_child(
1699                self.as_ref().to_glib_none().0,
1700                child.map(|p| p.as_ref()).to_glib_none().0,
1701            );
1702        }
1703    }
1704
1705    /// Sets the heading of @self.
1706    /// ## `heading`
1707    /// the heading of @self
1708    #[doc(alias = "adw_alert_dialog_set_heading")]
1709    #[doc(alias = "heading")]
1710    fn set_heading(&self, heading: Option<&str>) {
1711        unsafe {
1712            ffi::adw_alert_dialog_set_heading(
1713                self.as_ref().to_glib_none().0,
1714                heading.to_glib_none().0,
1715            );
1716        }
1717    }
1718
1719    /// Sets whether the heading of @self includes Pango markup.
1720    ///
1721    /// See `parse_markup()`.
1722    /// ## `use_markup`
1723    /// whether to use markup for heading
1724    #[doc(alias = "adw_alert_dialog_set_heading_use_markup")]
1725    #[doc(alias = "heading-use-markup")]
1726    fn set_heading_use_markup(&self, use_markup: bool) {
1727        unsafe {
1728            ffi::adw_alert_dialog_set_heading_use_markup(
1729                self.as_ref().to_glib_none().0,
1730                use_markup.into_glib(),
1731            );
1732        }
1733    }
1734
1735    /// Sets whether @self prefers wide layout.
1736    ///
1737    /// Prefer horizontal button layout when possible, and wider dialog width
1738    /// otherwise.
1739    /// ## `prefer_wide_layout`
1740    /// whether to prefer wide layout
1741    #[cfg(feature = "v1_6")]
1742    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1743    #[doc(alias = "adw_alert_dialog_set_prefer_wide_layout")]
1744    #[doc(alias = "prefer-wide-layout")]
1745    fn set_prefer_wide_layout(&self, prefer_wide_layout: bool) {
1746        unsafe {
1747            ffi::adw_alert_dialog_set_prefer_wide_layout(
1748                self.as_ref().to_glib_none().0,
1749                prefer_wide_layout.into_glib(),
1750            );
1751        }
1752    }
1753
1754    /// Sets the appearance for @response.
1755    ///
1756    /// <picture>
1757    ///   <source srcset="alert-dialog-appearance-dark.png" media="(prefers-color-scheme: dark)">
1758    ///   <img src="alert-dialog-appearance.png" alt="alert-dialog-appearance">
1759    /// </picture>
1760    ///
1761    /// Use `ADW_RESPONSE_SUGGESTED` to mark important responses such as the
1762    /// affirmative action, like the Save button in the example.
1763    ///
1764    /// Use `ADW_RESPONSE_DESTRUCTIVE` to draw attention to the potentially damaging
1765    /// consequences of using @response. This appearance acts as a warning to the
1766    /// user. The Discard button in the example is using this appearance.
1767    ///
1768    /// The default appearance is `ADW_RESPONSE_DEFAULT`.
1769    ///
1770    /// Negative responses like Cancel or Close should use the default appearance.
1771    /// ## `response`
1772    /// a response ID
1773    /// ## `appearance`
1774    /// appearance for @response
1775    #[doc(alias = "adw_alert_dialog_set_response_appearance")]
1776    fn set_response_appearance(&self, response: &str, appearance: ResponseAppearance) {
1777        unsafe {
1778            ffi::adw_alert_dialog_set_response_appearance(
1779                self.as_ref().to_glib_none().0,
1780                response.to_glib_none().0,
1781                appearance.into_glib(),
1782            );
1783        }
1784    }
1785
1786    /// Sets whether @response is enabled.
1787    ///
1788    /// If @response is not enabled, the corresponding button will have
1789    /// [`sensitive`][struct@crate::gtk::Widget#sensitive] set to `FALSE` and it can't be activated as
1790    /// a default response.
1791    ///
1792    /// @response can still be used as [`close-response`][struct@crate::AlertDialog#close-response] while
1793    /// it's not enabled.
1794    ///
1795    /// Responses are enabled by default.
1796    /// ## `response`
1797    /// a response ID
1798    /// ## `enabled`
1799    /// whether to enable @response
1800    #[doc(alias = "adw_alert_dialog_set_response_enabled")]
1801    fn set_response_enabled(&self, response: &str, enabled: bool) {
1802        unsafe {
1803            ffi::adw_alert_dialog_set_response_enabled(
1804                self.as_ref().to_glib_none().0,
1805                response.to_glib_none().0,
1806                enabled.into_glib(),
1807            );
1808        }
1809    }
1810
1811    /// Sets the label of @response to @label.
1812    ///
1813    /// Labels are displayed on the dialog buttons. An embedded underline in @label
1814    /// indicates a mnemonic.
1815    /// ## `response`
1816    /// a response ID
1817    /// ## `label`
1818    /// the label of @response
1819    #[doc(alias = "adw_alert_dialog_set_response_label")]
1820    fn set_response_label(&self, response: &str, label: &str) {
1821        unsafe {
1822            ffi::adw_alert_dialog_set_response_label(
1823                self.as_ref().to_glib_none().0,
1824                response.to_glib_none().0,
1825                label.to_glib_none().0,
1826            );
1827        }
1828    }
1829
1830    /// This signal is emitted when the dialog is closed.
1831    ///
1832    /// @response will be set to the response ID of the button that had been
1833    /// activated.
1834    ///
1835    /// if the dialog was closed by pressing <kbd>Escape</kbd> or with a system
1836    /// action, @response will be set to the value of
1837    /// [`close-response`][struct@crate::AlertDialog#close-response].
1838    /// ## `response`
1839    /// the response ID
1840    #[cfg(feature = "v1_5")]
1841    #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
1842    #[doc(alias = "response")]
1843    fn connect_response<F: Fn(&Self, &str) + 'static>(
1844        &self,
1845        detail: Option<&str>,
1846        f: F,
1847    ) -> SignalHandlerId {
1848        unsafe extern "C" fn response_trampoline<P: IsA<AlertDialog>, F: Fn(&P, &str) + 'static>(
1849            this: *mut ffi::AdwAlertDialog,
1850            response: *mut std::ffi::c_char,
1851            f: glib::ffi::gpointer,
1852        ) {
1853            let f: &F = &*(f as *const F);
1854            f(
1855                AlertDialog::from_glib_borrow(this).unsafe_cast_ref(),
1856                &glib::GString::from_glib_borrow(response),
1857            )
1858        }
1859        unsafe {
1860            let f: Box_<F> = Box_::new(f);
1861            let detailed_signal_name = detail.map(|name| format!("response::{name}\0"));
1862            let signal_name: &[u8] = detailed_signal_name
1863                .as_ref()
1864                .map_or(c"response".to_bytes(), |n| n.as_bytes());
1865            connect_raw(
1866                self.as_ptr() as *mut _,
1867                signal_name.as_ptr() as *const _,
1868                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1869                    response_trampoline::<Self, F> as *const (),
1870                )),
1871                Box_::into_raw(f),
1872            )
1873        }
1874    }
1875
1876    #[cfg(feature = "v1_5")]
1877    #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
1878    #[doc(alias = "body")]
1879    fn connect_body_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1880        unsafe extern "C" fn notify_body_trampoline<P: IsA<AlertDialog>, F: Fn(&P) + 'static>(
1881            this: *mut ffi::AdwAlertDialog,
1882            _param_spec: glib::ffi::gpointer,
1883            f: glib::ffi::gpointer,
1884        ) {
1885            let f: &F = &*(f as *const F);
1886            f(AlertDialog::from_glib_borrow(this).unsafe_cast_ref())
1887        }
1888        unsafe {
1889            let f: Box_<F> = Box_::new(f);
1890            connect_raw(
1891                self.as_ptr() as *mut _,
1892                c"notify::body".as_ptr() as *const _,
1893                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1894                    notify_body_trampoline::<Self, F> as *const (),
1895                )),
1896                Box_::into_raw(f),
1897            )
1898        }
1899    }
1900
1901    #[cfg(feature = "v1_5")]
1902    #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
1903    #[doc(alias = "body-use-markup")]
1904    fn connect_body_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1905        unsafe extern "C" fn notify_body_use_markup_trampoline<
1906            P: IsA<AlertDialog>,
1907            F: Fn(&P) + 'static,
1908        >(
1909            this: *mut ffi::AdwAlertDialog,
1910            _param_spec: glib::ffi::gpointer,
1911            f: glib::ffi::gpointer,
1912        ) {
1913            let f: &F = &*(f as *const F);
1914            f(AlertDialog::from_glib_borrow(this).unsafe_cast_ref())
1915        }
1916        unsafe {
1917            let f: Box_<F> = Box_::new(f);
1918            connect_raw(
1919                self.as_ptr() as *mut _,
1920                c"notify::body-use-markup".as_ptr() as *const _,
1921                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1922                    notify_body_use_markup_trampoline::<Self, F> as *const (),
1923                )),
1924                Box_::into_raw(f),
1925            )
1926        }
1927    }
1928
1929    #[cfg(feature = "v1_5")]
1930    #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
1931    #[doc(alias = "close-response")]
1932    fn connect_close_response_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1933        unsafe extern "C" fn notify_close_response_trampoline<
1934            P: IsA<AlertDialog>,
1935            F: Fn(&P) + 'static,
1936        >(
1937            this: *mut ffi::AdwAlertDialog,
1938            _param_spec: glib::ffi::gpointer,
1939            f: glib::ffi::gpointer,
1940        ) {
1941            let f: &F = &*(f as *const F);
1942            f(AlertDialog::from_glib_borrow(this).unsafe_cast_ref())
1943        }
1944        unsafe {
1945            let f: Box_<F> = Box_::new(f);
1946            connect_raw(
1947                self.as_ptr() as *mut _,
1948                c"notify::close-response".as_ptr() as *const _,
1949                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1950                    notify_close_response_trampoline::<Self, F> as *const (),
1951                )),
1952                Box_::into_raw(f),
1953            )
1954        }
1955    }
1956
1957    #[cfg(feature = "v1_5")]
1958    #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
1959    #[doc(alias = "default-response")]
1960    fn connect_default_response_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1961        unsafe extern "C" fn notify_default_response_trampoline<
1962            P: IsA<AlertDialog>,
1963            F: Fn(&P) + 'static,
1964        >(
1965            this: *mut ffi::AdwAlertDialog,
1966            _param_spec: glib::ffi::gpointer,
1967            f: glib::ffi::gpointer,
1968        ) {
1969            let f: &F = &*(f as *const F);
1970            f(AlertDialog::from_glib_borrow(this).unsafe_cast_ref())
1971        }
1972        unsafe {
1973            let f: Box_<F> = Box_::new(f);
1974            connect_raw(
1975                self.as_ptr() as *mut _,
1976                c"notify::default-response".as_ptr() as *const _,
1977                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1978                    notify_default_response_trampoline::<Self, F> as *const (),
1979                )),
1980                Box_::into_raw(f),
1981            )
1982        }
1983    }
1984
1985    #[cfg(feature = "v1_5")]
1986    #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
1987    #[doc(alias = "extra-child")]
1988    fn connect_extra_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1989        unsafe extern "C" fn notify_extra_child_trampoline<
1990            P: IsA<AlertDialog>,
1991            F: Fn(&P) + 'static,
1992        >(
1993            this: *mut ffi::AdwAlertDialog,
1994            _param_spec: glib::ffi::gpointer,
1995            f: glib::ffi::gpointer,
1996        ) {
1997            let f: &F = &*(f as *const F);
1998            f(AlertDialog::from_glib_borrow(this).unsafe_cast_ref())
1999        }
2000        unsafe {
2001            let f: Box_<F> = Box_::new(f);
2002            connect_raw(
2003                self.as_ptr() as *mut _,
2004                c"notify::extra-child".as_ptr() as *const _,
2005                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2006                    notify_extra_child_trampoline::<Self, F> as *const (),
2007                )),
2008                Box_::into_raw(f),
2009            )
2010        }
2011    }
2012
2013    #[cfg(feature = "v1_5")]
2014    #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
2015    #[doc(alias = "heading")]
2016    fn connect_heading_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2017        unsafe extern "C" fn notify_heading_trampoline<P: IsA<AlertDialog>, F: Fn(&P) + 'static>(
2018            this: *mut ffi::AdwAlertDialog,
2019            _param_spec: glib::ffi::gpointer,
2020            f: glib::ffi::gpointer,
2021        ) {
2022            let f: &F = &*(f as *const F);
2023            f(AlertDialog::from_glib_borrow(this).unsafe_cast_ref())
2024        }
2025        unsafe {
2026            let f: Box_<F> = Box_::new(f);
2027            connect_raw(
2028                self.as_ptr() as *mut _,
2029                c"notify::heading".as_ptr() as *const _,
2030                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2031                    notify_heading_trampoline::<Self, F> as *const (),
2032                )),
2033                Box_::into_raw(f),
2034            )
2035        }
2036    }
2037
2038    #[cfg(feature = "v1_5")]
2039    #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
2040    #[doc(alias = "heading-use-markup")]
2041    fn connect_heading_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2042        unsafe extern "C" fn notify_heading_use_markup_trampoline<
2043            P: IsA<AlertDialog>,
2044            F: Fn(&P) + 'static,
2045        >(
2046            this: *mut ffi::AdwAlertDialog,
2047            _param_spec: glib::ffi::gpointer,
2048            f: glib::ffi::gpointer,
2049        ) {
2050            let f: &F = &*(f as *const F);
2051            f(AlertDialog::from_glib_borrow(this).unsafe_cast_ref())
2052        }
2053        unsafe {
2054            let f: Box_<F> = Box_::new(f);
2055            connect_raw(
2056                self.as_ptr() as *mut _,
2057                c"notify::heading-use-markup".as_ptr() as *const _,
2058                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2059                    notify_heading_use_markup_trampoline::<Self, F> as *const (),
2060                )),
2061                Box_::into_raw(f),
2062            )
2063        }
2064    }
2065
2066    #[cfg(feature = "v1_6")]
2067    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
2068    #[doc(alias = "prefer-wide-layout")]
2069    fn connect_prefer_wide_layout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2070        unsafe extern "C" fn notify_prefer_wide_layout_trampoline<
2071            P: IsA<AlertDialog>,
2072            F: Fn(&P) + 'static,
2073        >(
2074            this: *mut ffi::AdwAlertDialog,
2075            _param_spec: glib::ffi::gpointer,
2076            f: glib::ffi::gpointer,
2077        ) {
2078            let f: &F = &*(f as *const F);
2079            f(AlertDialog::from_glib_borrow(this).unsafe_cast_ref())
2080        }
2081        unsafe {
2082            let f: Box_<F> = Box_::new(f);
2083            connect_raw(
2084                self.as_ptr() as *mut _,
2085                c"notify::prefer-wide-layout".as_ptr() as *const _,
2086                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2087                    notify_prefer_wide_layout_trampoline::<Self, F> as *const (),
2088                )),
2089                Box_::into_raw(f),
2090            )
2091        }
2092    }
2093}
2094
2095impl<O: IsA<AlertDialog>> AlertDialogExt for O {}