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