1use 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 #[doc(alias = "AdwAlertDialog")]
17 pub struct AlertDialog(Object<ffi::AdwAlertDialog, ffi::AdwAlertDialogClass>) @extends Dialog, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::ShortcutManager;
18
19 match fn {
20 type_ => || ffi::adw_alert_dialog_get_type(),
21 }
22}
23
24impl AlertDialog {
25 pub const NONE: Option<&'static AlertDialog> = None;
26
27 #[doc(alias = "adw_alert_dialog_new")]
28 pub fn new(heading: Option<&str>, body: Option<&str>) -> AlertDialog {
29 assert_initialized_main_thread!();
30 unsafe {
31 Dialog::from_glib_none(ffi::adw_alert_dialog_new(
32 heading.to_glib_none().0,
33 body.to_glib_none().0,
34 ))
35 .unsafe_cast()
36 }
37 }
38
39 pub fn builder() -> AlertDialogBuilder {
44 AlertDialogBuilder::new()
45 }
46}
47
48#[cfg(feature = "v1_5")]
49#[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
50impl Default for AlertDialog {
51 fn default() -> Self {
52 glib::object::Object::new::<Self>()
53 }
54}
55
56#[must_use = "The builder must be built to be used"]
61pub struct AlertDialogBuilder {
62 builder: glib::object::ObjectBuilder<'static, AlertDialog>,
63}
64
65impl AlertDialogBuilder {
66 fn new() -> Self {
67 Self {
68 builder: glib::object::Object::builder(),
69 }
70 }
71
72 #[cfg(feature = "v1_5")]
73 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
74 pub fn body(self, body: impl Into<glib::GString>) -> Self {
75 Self {
76 builder: self.builder.property("body", body.into()),
77 }
78 }
79
80 #[cfg(feature = "v1_5")]
81 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
82 pub fn body_use_markup(self, body_use_markup: bool) -> Self {
83 Self {
84 builder: self.builder.property("body-use-markup", body_use_markup),
85 }
86 }
87
88 #[cfg(feature = "v1_5")]
89 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
90 pub fn close_response(self, close_response: impl Into<glib::GString>) -> Self {
91 Self {
92 builder: self
93 .builder
94 .property("close-response", close_response.into()),
95 }
96 }
97
98 #[cfg(feature = "v1_5")]
99 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
100 pub fn default_response(self, default_response: impl Into<glib::GString>) -> Self {
101 Self {
102 builder: self
103 .builder
104 .property("default-response", default_response.into()),
105 }
106 }
107
108 #[cfg(feature = "v1_5")]
109 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
110 pub fn extra_child(self, extra_child: &impl IsA<gtk::Widget>) -> Self {
111 Self {
112 builder: self
113 .builder
114 .property("extra-child", extra_child.clone().upcast()),
115 }
116 }
117
118 #[cfg(feature = "v1_5")]
119 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
120 pub fn heading(self, heading: impl Into<glib::GString>) -> Self {
121 Self {
122 builder: self.builder.property("heading", heading.into()),
123 }
124 }
125
126 #[cfg(feature = "v1_5")]
127 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
128 pub fn heading_use_markup(self, heading_use_markup: bool) -> Self {
129 Self {
130 builder: self
131 .builder
132 .property("heading-use-markup", heading_use_markup),
133 }
134 }
135
136 #[cfg(feature = "v1_6")]
137 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
138 pub fn prefer_wide_layout(self, prefer_wide_layout: bool) -> Self {
139 Self {
140 builder: self
141 .builder
142 .property("prefer-wide-layout", prefer_wide_layout),
143 }
144 }
145
146 #[cfg(feature = "v1_5")]
147 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
148 pub fn can_close(self, can_close: bool) -> Self {
149 Self {
150 builder: self.builder.property("can-close", can_close),
151 }
152 }
153
154 #[cfg(feature = "v1_5")]
155 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
156 pub fn child(self, child: &impl IsA<gtk::Widget>) -> Self {
157 Self {
158 builder: self.builder.property("child", child.clone().upcast()),
159 }
160 }
161
162 #[cfg(feature = "v1_5")]
163 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
164 pub fn content_height(self, content_height: i32) -> Self {
165 Self {
166 builder: self.builder.property("content-height", content_height),
167 }
168 }
169
170 #[cfg(feature = "v1_5")]
171 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
172 pub fn content_width(self, content_width: i32) -> Self {
173 Self {
174 builder: self.builder.property("content-width", content_width),
175 }
176 }
177
178 #[cfg(feature = "v1_5")]
179 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
180 pub fn default_widget(self, default_widget: &impl IsA<gtk::Widget>) -> Self {
181 Self {
182 builder: self
183 .builder
184 .property("default-widget", default_widget.clone().upcast()),
185 }
186 }
187
188 #[cfg(feature = "v1_5")]
189 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
190 pub fn focus_widget(self, focus_widget: &impl IsA<gtk::Widget>) -> Self {
191 Self {
192 builder: self
193 .builder
194 .property("focus-widget", focus_widget.clone().upcast()),
195 }
196 }
197
198 #[cfg(feature = "v1_5")]
199 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
200 pub fn follows_content_size(self, follows_content_size: bool) -> Self {
201 Self {
202 builder: self
203 .builder
204 .property("follows-content-size", follows_content_size),
205 }
206 }
207
208 #[cfg(feature = "v1_5")]
209 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
210 pub fn presentation_mode(self, presentation_mode: DialogPresentationMode) -> Self {
211 Self {
212 builder: self
213 .builder
214 .property("presentation-mode", presentation_mode),
215 }
216 }
217
218 #[cfg(feature = "v1_5")]
219 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
220 pub fn title(self, title: impl Into<glib::GString>) -> Self {
221 Self {
222 builder: self.builder.property("title", title.into()),
223 }
224 }
225
226 pub fn can_focus(self, can_focus: bool) -> Self {
227 Self {
228 builder: self.builder.property("can-focus", can_focus),
229 }
230 }
231
232 pub fn can_target(self, can_target: bool) -> Self {
233 Self {
234 builder: self.builder.property("can-target", can_target),
235 }
236 }
237
238 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
239 Self {
240 builder: self.builder.property("css-classes", css_classes.into()),
241 }
242 }
243
244 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
245 Self {
246 builder: self.builder.property("css-name", css_name.into()),
247 }
248 }
249
250 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
251 Self {
252 builder: self.builder.property("cursor", cursor.clone()),
253 }
254 }
255
256 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
257 Self {
258 builder: self.builder.property("focus-on-click", focus_on_click),
259 }
260 }
261
262 pub fn focusable(self, focusable: bool) -> Self {
263 Self {
264 builder: self.builder.property("focusable", focusable),
265 }
266 }
267
268 pub fn halign(self, halign: gtk::Align) -> Self {
269 Self {
270 builder: self.builder.property("halign", halign),
271 }
272 }
273
274 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
275 Self {
276 builder: self.builder.property("has-tooltip", has_tooltip),
277 }
278 }
279
280 pub fn height_request(self, height_request: i32) -> Self {
281 Self {
282 builder: self.builder.property("height-request", height_request),
283 }
284 }
285
286 pub fn hexpand(self, hexpand: bool) -> Self {
287 Self {
288 builder: self.builder.property("hexpand", hexpand),
289 }
290 }
291
292 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
293 Self {
294 builder: self.builder.property("hexpand-set", hexpand_set),
295 }
296 }
297
298 pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
299 Self {
300 builder: self
301 .builder
302 .property("layout-manager", layout_manager.clone().upcast()),
303 }
304 }
305
306 #[cfg(feature = "gtk_v4_18")]
307 #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
308 pub fn limit_events(self, limit_events: bool) -> Self {
309 Self {
310 builder: self.builder.property("limit-events", limit_events),
311 }
312 }
313
314 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
315 Self {
316 builder: self.builder.property("margin-bottom", margin_bottom),
317 }
318 }
319
320 pub fn margin_end(self, margin_end: i32) -> Self {
321 Self {
322 builder: self.builder.property("margin-end", margin_end),
323 }
324 }
325
326 pub fn margin_start(self, margin_start: i32) -> Self {
327 Self {
328 builder: self.builder.property("margin-start", margin_start),
329 }
330 }
331
332 pub fn margin_top(self, margin_top: i32) -> Self {
333 Self {
334 builder: self.builder.property("margin-top", margin_top),
335 }
336 }
337
338 pub fn name(self, name: impl Into<glib::GString>) -> Self {
339 Self {
340 builder: self.builder.property("name", name.into()),
341 }
342 }
343
344 pub fn opacity(self, opacity: f64) -> Self {
345 Self {
346 builder: self.builder.property("opacity", opacity),
347 }
348 }
349
350 pub fn overflow(self, overflow: gtk::Overflow) -> Self {
351 Self {
352 builder: self.builder.property("overflow", overflow),
353 }
354 }
355
356 pub fn receives_default(self, receives_default: bool) -> Self {
357 Self {
358 builder: self.builder.property("receives-default", receives_default),
359 }
360 }
361
362 pub fn sensitive(self, sensitive: bool) -> Self {
363 Self {
364 builder: self.builder.property("sensitive", sensitive),
365 }
366 }
367
368 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
369 Self {
370 builder: self
371 .builder
372 .property("tooltip-markup", tooltip_markup.into()),
373 }
374 }
375
376 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
377 Self {
378 builder: self.builder.property("tooltip-text", tooltip_text.into()),
379 }
380 }
381
382 pub fn valign(self, valign: gtk::Align) -> Self {
383 Self {
384 builder: self.builder.property("valign", valign),
385 }
386 }
387
388 pub fn vexpand(self, vexpand: bool) -> Self {
389 Self {
390 builder: self.builder.property("vexpand", vexpand),
391 }
392 }
393
394 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
395 Self {
396 builder: self.builder.property("vexpand-set", vexpand_set),
397 }
398 }
399
400 pub fn visible(self, visible: bool) -> Self {
401 Self {
402 builder: self.builder.property("visible", visible),
403 }
404 }
405
406 pub fn width_request(self, width_request: i32) -> Self {
407 Self {
408 builder: self.builder.property("width-request", width_request),
409 }
410 }
411
412 pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
413 Self {
414 builder: self.builder.property("accessible-role", accessible_role),
415 }
416 }
417
418 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
421 pub fn build(self) -> AlertDialog {
422 assert_initialized_main_thread!();
423 self.builder.build()
424 }
425}
426
427pub trait AlertDialogExt: IsA<AlertDialog> + 'static {
428 #[doc(alias = "adw_alert_dialog_add_response")]
429 fn add_response(&self, id: &str, label: &str) {
430 unsafe {
431 ffi::adw_alert_dialog_add_response(
432 self.as_ref().to_glib_none().0,
433 id.to_glib_none().0,
434 label.to_glib_none().0,
435 );
436 }
437 }
438
439 #[doc(alias = "adw_alert_dialog_get_body")]
440 #[doc(alias = "get_body")]
441 fn body(&self) -> glib::GString {
442 unsafe {
443 from_glib_none(ffi::adw_alert_dialog_get_body(
444 self.as_ref().to_glib_none().0,
445 ))
446 }
447 }
448
449 #[doc(alias = "adw_alert_dialog_get_body_use_markup")]
450 #[doc(alias = "get_body_use_markup")]
451 #[doc(alias = "body-use-markup")]
452 fn is_body_use_markup(&self) -> bool {
453 unsafe {
454 from_glib(ffi::adw_alert_dialog_get_body_use_markup(
455 self.as_ref().to_glib_none().0,
456 ))
457 }
458 }
459
460 #[doc(alias = "adw_alert_dialog_get_close_response")]
461 #[doc(alias = "get_close_response")]
462 #[doc(alias = "close-response")]
463 fn close_response(&self) -> glib::GString {
464 unsafe {
465 from_glib_none(ffi::adw_alert_dialog_get_close_response(
466 self.as_ref().to_glib_none().0,
467 ))
468 }
469 }
470
471 #[doc(alias = "adw_alert_dialog_get_default_response")]
472 #[doc(alias = "get_default_response")]
473 #[doc(alias = "default-response")]
474 fn default_response(&self) -> Option<glib::GString> {
475 unsafe {
476 from_glib_none(ffi::adw_alert_dialog_get_default_response(
477 self.as_ref().to_glib_none().0,
478 ))
479 }
480 }
481
482 #[doc(alias = "adw_alert_dialog_get_extra_child")]
483 #[doc(alias = "get_extra_child")]
484 #[doc(alias = "extra-child")]
485 fn extra_child(&self) -> Option<gtk::Widget> {
486 unsafe {
487 from_glib_none(ffi::adw_alert_dialog_get_extra_child(
488 self.as_ref().to_glib_none().0,
489 ))
490 }
491 }
492
493 #[doc(alias = "adw_alert_dialog_get_heading")]
494 #[doc(alias = "get_heading")]
495 fn heading(&self) -> Option<glib::GString> {
496 unsafe {
497 from_glib_none(ffi::adw_alert_dialog_get_heading(
498 self.as_ref().to_glib_none().0,
499 ))
500 }
501 }
502
503 #[doc(alias = "adw_alert_dialog_get_heading_use_markup")]
504 #[doc(alias = "get_heading_use_markup")]
505 #[doc(alias = "heading-use-markup")]
506 fn is_heading_use_markup(&self) -> bool {
507 unsafe {
508 from_glib(ffi::adw_alert_dialog_get_heading_use_markup(
509 self.as_ref().to_glib_none().0,
510 ))
511 }
512 }
513
514 #[doc(alias = "adw_alert_dialog_get_prefer_wide_layout")]
515 #[doc(alias = "get_prefer_wide_layout")]
516 #[doc(alias = "prefer-wide-layout")]
517 fn prefers_wide_layout(&self) -> bool {
518 unsafe {
519 from_glib(ffi::adw_alert_dialog_get_prefer_wide_layout(
520 self.as_ref().to_glib_none().0,
521 ))
522 }
523 }
524
525 #[doc(alias = "adw_alert_dialog_get_response_appearance")]
526 #[doc(alias = "get_response_appearance")]
527 fn response_appearance(&self, response: &str) -> ResponseAppearance {
528 unsafe {
529 from_glib(ffi::adw_alert_dialog_get_response_appearance(
530 self.as_ref().to_glib_none().0,
531 response.to_glib_none().0,
532 ))
533 }
534 }
535
536 #[doc(alias = "adw_alert_dialog_get_response_enabled")]
537 #[doc(alias = "get_response_enabled")]
538 fn is_response_enabled(&self, response: &str) -> bool {
539 unsafe {
540 from_glib(ffi::adw_alert_dialog_get_response_enabled(
541 self.as_ref().to_glib_none().0,
542 response.to_glib_none().0,
543 ))
544 }
545 }
546
547 #[doc(alias = "adw_alert_dialog_has_response")]
548 fn has_response(&self, response: &str) -> bool {
549 unsafe {
550 from_glib(ffi::adw_alert_dialog_has_response(
551 self.as_ref().to_glib_none().0,
552 response.to_glib_none().0,
553 ))
554 }
555 }
556
557 #[doc(alias = "adw_alert_dialog_remove_response")]
558 fn remove_response(&self, id: &str) {
559 unsafe {
560 ffi::adw_alert_dialog_remove_response(
561 self.as_ref().to_glib_none().0,
562 id.to_glib_none().0,
563 );
564 }
565 }
566
567 #[doc(alias = "adw_alert_dialog_set_body")]
568 #[doc(alias = "body")]
569 fn set_body(&self, body: &str) {
570 unsafe {
571 ffi::adw_alert_dialog_set_body(self.as_ref().to_glib_none().0, body.to_glib_none().0);
572 }
573 }
574
575 #[doc(alias = "adw_alert_dialog_set_body_use_markup")]
576 #[doc(alias = "body-use-markup")]
577 fn set_body_use_markup(&self, use_markup: bool) {
578 unsafe {
579 ffi::adw_alert_dialog_set_body_use_markup(
580 self.as_ref().to_glib_none().0,
581 use_markup.into_glib(),
582 );
583 }
584 }
585
586 #[doc(alias = "adw_alert_dialog_set_close_response")]
587 #[doc(alias = "close-response")]
588 fn set_close_response(&self, response: &str) {
589 unsafe {
590 ffi::adw_alert_dialog_set_close_response(
591 self.as_ref().to_glib_none().0,
592 response.to_glib_none().0,
593 );
594 }
595 }
596
597 #[doc(alias = "adw_alert_dialog_set_default_response")]
598 #[doc(alias = "default-response")]
599 fn set_default_response(&self, response: Option<&str>) {
600 unsafe {
601 ffi::adw_alert_dialog_set_default_response(
602 self.as_ref().to_glib_none().0,
603 response.to_glib_none().0,
604 );
605 }
606 }
607
608 #[doc(alias = "adw_alert_dialog_set_extra_child")]
609 #[doc(alias = "extra-child")]
610 fn set_extra_child(&self, child: Option<&impl IsA<gtk::Widget>>) {
611 unsafe {
612 ffi::adw_alert_dialog_set_extra_child(
613 self.as_ref().to_glib_none().0,
614 child.map(|p| p.as_ref()).to_glib_none().0,
615 );
616 }
617 }
618
619 #[doc(alias = "adw_alert_dialog_set_heading")]
620 #[doc(alias = "heading")]
621 fn set_heading(&self, heading: Option<&str>) {
622 unsafe {
623 ffi::adw_alert_dialog_set_heading(
624 self.as_ref().to_glib_none().0,
625 heading.to_glib_none().0,
626 );
627 }
628 }
629
630 #[doc(alias = "adw_alert_dialog_set_heading_use_markup")]
631 #[doc(alias = "heading-use-markup")]
632 fn set_heading_use_markup(&self, use_markup: bool) {
633 unsafe {
634 ffi::adw_alert_dialog_set_heading_use_markup(
635 self.as_ref().to_glib_none().0,
636 use_markup.into_glib(),
637 );
638 }
639 }
640
641 #[cfg(feature = "v1_6")]
642 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
643 #[doc(alias = "adw_alert_dialog_set_prefer_wide_layout")]
644 #[doc(alias = "prefer-wide-layout")]
645 fn set_prefer_wide_layout(&self, prefer_wide_layout: bool) {
646 unsafe {
647 ffi::adw_alert_dialog_set_prefer_wide_layout(
648 self.as_ref().to_glib_none().0,
649 prefer_wide_layout.into_glib(),
650 );
651 }
652 }
653
654 #[doc(alias = "adw_alert_dialog_set_response_appearance")]
655 fn set_response_appearance(&self, response: &str, appearance: ResponseAppearance) {
656 unsafe {
657 ffi::adw_alert_dialog_set_response_appearance(
658 self.as_ref().to_glib_none().0,
659 response.to_glib_none().0,
660 appearance.into_glib(),
661 );
662 }
663 }
664
665 #[doc(alias = "adw_alert_dialog_set_response_enabled")]
666 fn set_response_enabled(&self, response: &str, enabled: bool) {
667 unsafe {
668 ffi::adw_alert_dialog_set_response_enabled(
669 self.as_ref().to_glib_none().0,
670 response.to_glib_none().0,
671 enabled.into_glib(),
672 );
673 }
674 }
675
676 #[doc(alias = "adw_alert_dialog_set_response_label")]
677 fn set_response_label(&self, response: &str, label: &str) {
678 unsafe {
679 ffi::adw_alert_dialog_set_response_label(
680 self.as_ref().to_glib_none().0,
681 response.to_glib_none().0,
682 label.to_glib_none().0,
683 );
684 }
685 }
686
687 #[cfg(feature = "v1_5")]
688 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
689 #[doc(alias = "response")]
690 fn connect_response<F: Fn(&Self, &str) + 'static>(
691 &self,
692 detail: Option<&str>,
693 f: F,
694 ) -> SignalHandlerId {
695 unsafe extern "C" fn response_trampoline<P: IsA<AlertDialog>, F: Fn(&P, &str) + 'static>(
696 this: *mut ffi::AdwAlertDialog,
697 response: *mut std::ffi::c_char,
698 f: glib::ffi::gpointer,
699 ) {
700 let f: &F = &*(f as *const F);
701 f(
702 AlertDialog::from_glib_borrow(this).unsafe_cast_ref(),
703 &glib::GString::from_glib_borrow(response),
704 )
705 }
706 unsafe {
707 let f: Box_<F> = Box_::new(f);
708 let detailed_signal_name = detail.map(|name| format!("response::{name}\0"));
709 let signal_name: &[u8] = detailed_signal_name
710 .as_ref()
711 .map_or(c"response".to_bytes(), |n| n.as_bytes());
712 connect_raw(
713 self.as_ptr() as *mut _,
714 signal_name.as_ptr() as *const _,
715 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
716 response_trampoline::<Self, F> as *const (),
717 )),
718 Box_::into_raw(f),
719 )
720 }
721 }
722
723 #[cfg(feature = "v1_5")]
724 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
725 #[doc(alias = "body")]
726 fn connect_body_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
727 unsafe extern "C" fn notify_body_trampoline<P: IsA<AlertDialog>, F: Fn(&P) + 'static>(
728 this: *mut ffi::AdwAlertDialog,
729 _param_spec: glib::ffi::gpointer,
730 f: glib::ffi::gpointer,
731 ) {
732 let f: &F = &*(f as *const F);
733 f(AlertDialog::from_glib_borrow(this).unsafe_cast_ref())
734 }
735 unsafe {
736 let f: Box_<F> = Box_::new(f);
737 connect_raw(
738 self.as_ptr() as *mut _,
739 c"notify::body".as_ptr() as *const _,
740 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
741 notify_body_trampoline::<Self, F> as *const (),
742 )),
743 Box_::into_raw(f),
744 )
745 }
746 }
747
748 #[cfg(feature = "v1_5")]
749 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
750 #[doc(alias = "body-use-markup")]
751 fn connect_body_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
752 unsafe extern "C" fn notify_body_use_markup_trampoline<
753 P: IsA<AlertDialog>,
754 F: Fn(&P) + 'static,
755 >(
756 this: *mut ffi::AdwAlertDialog,
757 _param_spec: glib::ffi::gpointer,
758 f: glib::ffi::gpointer,
759 ) {
760 let f: &F = &*(f as *const F);
761 f(AlertDialog::from_glib_borrow(this).unsafe_cast_ref())
762 }
763 unsafe {
764 let f: Box_<F> = Box_::new(f);
765 connect_raw(
766 self.as_ptr() as *mut _,
767 c"notify::body-use-markup".as_ptr() as *const _,
768 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
769 notify_body_use_markup_trampoline::<Self, F> as *const (),
770 )),
771 Box_::into_raw(f),
772 )
773 }
774 }
775
776 #[cfg(feature = "v1_5")]
777 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
778 #[doc(alias = "close-response")]
779 fn connect_close_response_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
780 unsafe extern "C" fn notify_close_response_trampoline<
781 P: IsA<AlertDialog>,
782 F: Fn(&P) + 'static,
783 >(
784 this: *mut ffi::AdwAlertDialog,
785 _param_spec: glib::ffi::gpointer,
786 f: glib::ffi::gpointer,
787 ) {
788 let f: &F = &*(f as *const F);
789 f(AlertDialog::from_glib_borrow(this).unsafe_cast_ref())
790 }
791 unsafe {
792 let f: Box_<F> = Box_::new(f);
793 connect_raw(
794 self.as_ptr() as *mut _,
795 c"notify::close-response".as_ptr() as *const _,
796 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
797 notify_close_response_trampoline::<Self, F> as *const (),
798 )),
799 Box_::into_raw(f),
800 )
801 }
802 }
803
804 #[cfg(feature = "v1_5")]
805 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
806 #[doc(alias = "default-response")]
807 fn connect_default_response_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
808 unsafe extern "C" fn notify_default_response_trampoline<
809 P: IsA<AlertDialog>,
810 F: Fn(&P) + 'static,
811 >(
812 this: *mut ffi::AdwAlertDialog,
813 _param_spec: glib::ffi::gpointer,
814 f: glib::ffi::gpointer,
815 ) {
816 let f: &F = &*(f as *const F);
817 f(AlertDialog::from_glib_borrow(this).unsafe_cast_ref())
818 }
819 unsafe {
820 let f: Box_<F> = Box_::new(f);
821 connect_raw(
822 self.as_ptr() as *mut _,
823 c"notify::default-response".as_ptr() as *const _,
824 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
825 notify_default_response_trampoline::<Self, F> as *const (),
826 )),
827 Box_::into_raw(f),
828 )
829 }
830 }
831
832 #[cfg(feature = "v1_5")]
833 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
834 #[doc(alias = "extra-child")]
835 fn connect_extra_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
836 unsafe extern "C" fn notify_extra_child_trampoline<
837 P: IsA<AlertDialog>,
838 F: Fn(&P) + 'static,
839 >(
840 this: *mut ffi::AdwAlertDialog,
841 _param_spec: glib::ffi::gpointer,
842 f: glib::ffi::gpointer,
843 ) {
844 let f: &F = &*(f as *const F);
845 f(AlertDialog::from_glib_borrow(this).unsafe_cast_ref())
846 }
847 unsafe {
848 let f: Box_<F> = Box_::new(f);
849 connect_raw(
850 self.as_ptr() as *mut _,
851 c"notify::extra-child".as_ptr() as *const _,
852 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
853 notify_extra_child_trampoline::<Self, F> as *const (),
854 )),
855 Box_::into_raw(f),
856 )
857 }
858 }
859
860 #[cfg(feature = "v1_5")]
861 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
862 #[doc(alias = "heading")]
863 fn connect_heading_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
864 unsafe extern "C" fn notify_heading_trampoline<P: IsA<AlertDialog>, F: Fn(&P) + 'static>(
865 this: *mut ffi::AdwAlertDialog,
866 _param_spec: glib::ffi::gpointer,
867 f: glib::ffi::gpointer,
868 ) {
869 let f: &F = &*(f as *const F);
870 f(AlertDialog::from_glib_borrow(this).unsafe_cast_ref())
871 }
872 unsafe {
873 let f: Box_<F> = Box_::new(f);
874 connect_raw(
875 self.as_ptr() as *mut _,
876 c"notify::heading".as_ptr() as *const _,
877 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
878 notify_heading_trampoline::<Self, F> as *const (),
879 )),
880 Box_::into_raw(f),
881 )
882 }
883 }
884
885 #[cfg(feature = "v1_5")]
886 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
887 #[doc(alias = "heading-use-markup")]
888 fn connect_heading_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
889 unsafe extern "C" fn notify_heading_use_markup_trampoline<
890 P: IsA<AlertDialog>,
891 F: Fn(&P) + 'static,
892 >(
893 this: *mut ffi::AdwAlertDialog,
894 _param_spec: glib::ffi::gpointer,
895 f: glib::ffi::gpointer,
896 ) {
897 let f: &F = &*(f as *const F);
898 f(AlertDialog::from_glib_borrow(this).unsafe_cast_ref())
899 }
900 unsafe {
901 let f: Box_<F> = Box_::new(f);
902 connect_raw(
903 self.as_ptr() as *mut _,
904 c"notify::heading-use-markup".as_ptr() as *const _,
905 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
906 notify_heading_use_markup_trampoline::<Self, F> as *const (),
907 )),
908 Box_::into_raw(f),
909 )
910 }
911 }
912
913 #[cfg(feature = "v1_6")]
914 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
915 #[doc(alias = "prefer-wide-layout")]
916 fn connect_prefer_wide_layout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
917 unsafe extern "C" fn notify_prefer_wide_layout_trampoline<
918 P: IsA<AlertDialog>,
919 F: Fn(&P) + 'static,
920 >(
921 this: *mut ffi::AdwAlertDialog,
922 _param_spec: glib::ffi::gpointer,
923 f: glib::ffi::gpointer,
924 ) {
925 let f: &F = &*(f as *const F);
926 f(AlertDialog::from_glib_borrow(this).unsafe_cast_ref())
927 }
928 unsafe {
929 let f: Box_<F> = Box_::new(f);
930 connect_raw(
931 self.as_ptr() as *mut _,
932 c"notify::prefer-wide-layout".as_ptr() as *const _,
933 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
934 notify_prefer_wide_layout_trampoline::<Self, F> as *const (),
935 )),
936 Box_::into_raw(f),
937 )
938 }
939 }
940}
941
942impl<O: IsA<AlertDialog>> AlertDialogExt for O {}