1use crate::{ffi, Breakpoint, DialogPresentationMode};
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 = "AdwDialog")]
17 pub struct Dialog(Object<ffi::AdwDialog, ffi::AdwDialogClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::ShortcutManager;
18
19 match fn {
20 type_ => || ffi::adw_dialog_get_type(),
21 }
22}
23
24impl Dialog {
25 pub const NONE: Option<&'static Dialog> = None;
26
27 #[doc(alias = "adw_dialog_new")]
28 pub fn new() -> Dialog {
29 assert_initialized_main_thread!();
30 unsafe { from_glib_none(ffi::adw_dialog_new()) }
31 }
32
33 pub fn builder() -> DialogBuilder {
38 DialogBuilder::new()
39 }
40}
41
42#[cfg(feature = "v1_5")]
43#[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
44impl Default for Dialog {
45 fn default() -> Self {
46 Self::new()
47 }
48}
49
50#[must_use = "The builder must be built to be used"]
55pub struct DialogBuilder {
56 builder: glib::object::ObjectBuilder<'static, Dialog>,
57}
58
59impl DialogBuilder {
60 fn new() -> Self {
61 Self {
62 builder: glib::object::Object::builder(),
63 }
64 }
65
66 #[cfg(feature = "v1_5")]
67 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
68 pub fn can_close(self, can_close: bool) -> Self {
69 Self {
70 builder: self.builder.property("can-close", can_close),
71 }
72 }
73
74 #[cfg(feature = "v1_5")]
75 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
76 pub fn child(self, child: &impl IsA<gtk::Widget>) -> Self {
77 Self {
78 builder: self.builder.property("child", child.clone().upcast()),
79 }
80 }
81
82 #[cfg(feature = "v1_5")]
83 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
84 pub fn content_height(self, content_height: i32) -> Self {
85 Self {
86 builder: self.builder.property("content-height", content_height),
87 }
88 }
89
90 #[cfg(feature = "v1_5")]
91 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
92 pub fn content_width(self, content_width: i32) -> Self {
93 Self {
94 builder: self.builder.property("content-width", content_width),
95 }
96 }
97
98 #[cfg(feature = "v1_5")]
99 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
100 pub fn default_widget(self, default_widget: &impl IsA<gtk::Widget>) -> Self {
101 Self {
102 builder: self
103 .builder
104 .property("default-widget", default_widget.clone().upcast()),
105 }
106 }
107
108 #[cfg(feature = "v1_5")]
109 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
110 pub fn focus_widget(self, focus_widget: &impl IsA<gtk::Widget>) -> Self {
111 Self {
112 builder: self
113 .builder
114 .property("focus-widget", focus_widget.clone().upcast()),
115 }
116 }
117
118 #[cfg(feature = "v1_5")]
119 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
120 pub fn follows_content_size(self, follows_content_size: bool) -> Self {
121 Self {
122 builder: self
123 .builder
124 .property("follows-content-size", follows_content_size),
125 }
126 }
127
128 #[cfg(feature = "v1_5")]
129 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
130 pub fn presentation_mode(self, presentation_mode: DialogPresentationMode) -> Self {
131 Self {
132 builder: self
133 .builder
134 .property("presentation-mode", presentation_mode),
135 }
136 }
137
138 #[cfg(feature = "v1_5")]
139 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
140 pub fn title(self, title: impl Into<glib::GString>) -> Self {
141 Self {
142 builder: self.builder.property("title", title.into()),
143 }
144 }
145
146 pub fn can_focus(self, can_focus: bool) -> Self {
147 Self {
148 builder: self.builder.property("can-focus", can_focus),
149 }
150 }
151
152 pub fn can_target(self, can_target: bool) -> Self {
153 Self {
154 builder: self.builder.property("can-target", can_target),
155 }
156 }
157
158 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
159 Self {
160 builder: self.builder.property("css-classes", css_classes.into()),
161 }
162 }
163
164 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
165 Self {
166 builder: self.builder.property("css-name", css_name.into()),
167 }
168 }
169
170 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
171 Self {
172 builder: self.builder.property("cursor", cursor.clone()),
173 }
174 }
175
176 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
177 Self {
178 builder: self.builder.property("focus-on-click", focus_on_click),
179 }
180 }
181
182 pub fn focusable(self, focusable: bool) -> Self {
183 Self {
184 builder: self.builder.property("focusable", focusable),
185 }
186 }
187
188 pub fn halign(self, halign: gtk::Align) -> Self {
189 Self {
190 builder: self.builder.property("halign", halign),
191 }
192 }
193
194 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
195 Self {
196 builder: self.builder.property("has-tooltip", has_tooltip),
197 }
198 }
199
200 pub fn height_request(self, height_request: i32) -> Self {
201 Self {
202 builder: self.builder.property("height-request", height_request),
203 }
204 }
205
206 pub fn hexpand(self, hexpand: bool) -> Self {
207 Self {
208 builder: self.builder.property("hexpand", hexpand),
209 }
210 }
211
212 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
213 Self {
214 builder: self.builder.property("hexpand-set", hexpand_set),
215 }
216 }
217
218 pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
219 Self {
220 builder: self
221 .builder
222 .property("layout-manager", layout_manager.clone().upcast()),
223 }
224 }
225
226 #[cfg(feature = "gtk_v4_18")]
227 #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
228 pub fn limit_events(self, limit_events: bool) -> Self {
229 Self {
230 builder: self.builder.property("limit-events", limit_events),
231 }
232 }
233
234 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
235 Self {
236 builder: self.builder.property("margin-bottom", margin_bottom),
237 }
238 }
239
240 pub fn margin_end(self, margin_end: i32) -> Self {
241 Self {
242 builder: self.builder.property("margin-end", margin_end),
243 }
244 }
245
246 pub fn margin_start(self, margin_start: i32) -> Self {
247 Self {
248 builder: self.builder.property("margin-start", margin_start),
249 }
250 }
251
252 pub fn margin_top(self, margin_top: i32) -> Self {
253 Self {
254 builder: self.builder.property("margin-top", margin_top),
255 }
256 }
257
258 pub fn name(self, name: impl Into<glib::GString>) -> Self {
259 Self {
260 builder: self.builder.property("name", name.into()),
261 }
262 }
263
264 pub fn opacity(self, opacity: f64) -> Self {
265 Self {
266 builder: self.builder.property("opacity", opacity),
267 }
268 }
269
270 pub fn overflow(self, overflow: gtk::Overflow) -> Self {
271 Self {
272 builder: self.builder.property("overflow", overflow),
273 }
274 }
275
276 pub fn receives_default(self, receives_default: bool) -> Self {
277 Self {
278 builder: self.builder.property("receives-default", receives_default),
279 }
280 }
281
282 pub fn sensitive(self, sensitive: bool) -> Self {
283 Self {
284 builder: self.builder.property("sensitive", sensitive),
285 }
286 }
287
288 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
289 Self {
290 builder: self
291 .builder
292 .property("tooltip-markup", tooltip_markup.into()),
293 }
294 }
295
296 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
297 Self {
298 builder: self.builder.property("tooltip-text", tooltip_text.into()),
299 }
300 }
301
302 pub fn valign(self, valign: gtk::Align) -> Self {
303 Self {
304 builder: self.builder.property("valign", valign),
305 }
306 }
307
308 pub fn vexpand(self, vexpand: bool) -> Self {
309 Self {
310 builder: self.builder.property("vexpand", vexpand),
311 }
312 }
313
314 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
315 Self {
316 builder: self.builder.property("vexpand-set", vexpand_set),
317 }
318 }
319
320 pub fn visible(self, visible: bool) -> Self {
321 Self {
322 builder: self.builder.property("visible", visible),
323 }
324 }
325
326 pub fn width_request(self, width_request: i32) -> Self {
327 Self {
328 builder: self.builder.property("width-request", width_request),
329 }
330 }
331
332 pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
333 Self {
334 builder: self.builder.property("accessible-role", accessible_role),
335 }
336 }
337
338 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
341 pub fn build(self) -> Dialog {
342 assert_initialized_main_thread!();
343 self.builder.build()
344 }
345}
346
347pub trait AdwDialogExt: IsA<Dialog> + 'static {
348 #[doc(alias = "adw_dialog_add_breakpoint")]
349 fn add_breakpoint(&self, breakpoint: Breakpoint) {
350 unsafe {
351 ffi::adw_dialog_add_breakpoint(
352 self.as_ref().to_glib_none().0,
353 breakpoint.into_glib_ptr(),
354 );
355 }
356 }
357
358 #[doc(alias = "adw_dialog_close")]
359 fn close(&self) -> bool {
360 unsafe { from_glib(ffi::adw_dialog_close(self.as_ref().to_glib_none().0)) }
361 }
362
363 #[doc(alias = "adw_dialog_force_close")]
364 fn force_close(&self) {
365 unsafe {
366 ffi::adw_dialog_force_close(self.as_ref().to_glib_none().0);
367 }
368 }
369
370 #[doc(alias = "adw_dialog_get_can_close")]
371 #[doc(alias = "get_can_close")]
372 #[doc(alias = "can-close")]
373 fn can_close(&self) -> bool {
374 unsafe {
375 from_glib(ffi::adw_dialog_get_can_close(
376 self.as_ref().to_glib_none().0,
377 ))
378 }
379 }
380
381 #[doc(alias = "adw_dialog_get_child")]
382 #[doc(alias = "get_child")]
383 fn child(&self) -> Option<gtk::Widget> {
384 unsafe { from_glib_none(ffi::adw_dialog_get_child(self.as_ref().to_glib_none().0)) }
385 }
386
387 #[doc(alias = "adw_dialog_get_content_height")]
388 #[doc(alias = "get_content_height")]
389 #[doc(alias = "content-height")]
390 fn content_height(&self) -> i32 {
391 unsafe { ffi::adw_dialog_get_content_height(self.as_ref().to_glib_none().0) }
392 }
393
394 #[doc(alias = "adw_dialog_get_content_width")]
395 #[doc(alias = "get_content_width")]
396 #[doc(alias = "content-width")]
397 fn content_width(&self) -> i32 {
398 unsafe { ffi::adw_dialog_get_content_width(self.as_ref().to_glib_none().0) }
399 }
400
401 #[doc(alias = "adw_dialog_get_current_breakpoint")]
402 #[doc(alias = "get_current_breakpoint")]
403 #[doc(alias = "current-breakpoint")]
404 fn current_breakpoint(&self) -> Option<Breakpoint> {
405 unsafe {
406 from_glib_none(ffi::adw_dialog_get_current_breakpoint(
407 self.as_ref().to_glib_none().0,
408 ))
409 }
410 }
411
412 #[doc(alias = "adw_dialog_get_default_widget")]
413 #[doc(alias = "get_default_widget")]
414 #[doc(alias = "default-widget")]
415 fn default_widget(&self) -> Option<gtk::Widget> {
416 unsafe {
417 from_glib_none(ffi::adw_dialog_get_default_widget(
418 self.as_ref().to_glib_none().0,
419 ))
420 }
421 }
422
423 #[doc(alias = "adw_dialog_get_focus")]
424 #[doc(alias = "get_focus")]
425 #[doc(alias = "focus-widget")]
426 fn focus(&self) -> Option<gtk::Widget> {
427 unsafe { from_glib_none(ffi::adw_dialog_get_focus(self.as_ref().to_glib_none().0)) }
428 }
429
430 #[doc(alias = "adw_dialog_get_follows_content_size")]
431 #[doc(alias = "get_follows_content_size")]
432 #[doc(alias = "follows-content-size")]
433 fn follows_content_size(&self) -> bool {
434 unsafe {
435 from_glib(ffi::adw_dialog_get_follows_content_size(
436 self.as_ref().to_glib_none().0,
437 ))
438 }
439 }
440
441 #[doc(alias = "adw_dialog_get_presentation_mode")]
442 #[doc(alias = "get_presentation_mode")]
443 #[doc(alias = "presentation-mode")]
444 fn presentation_mode(&self) -> DialogPresentationMode {
445 unsafe {
446 from_glib(ffi::adw_dialog_get_presentation_mode(
447 self.as_ref().to_glib_none().0,
448 ))
449 }
450 }
451
452 #[doc(alias = "adw_dialog_get_title")]
453 #[doc(alias = "get_title")]
454 fn title(&self) -> glib::GString {
455 unsafe { from_glib_none(ffi::adw_dialog_get_title(self.as_ref().to_glib_none().0)) }
456 }
457
458 #[doc(alias = "adw_dialog_present")]
459 fn present(&self, parent: Option<&impl IsA<gtk::Widget>>) {
460 unsafe {
461 ffi::adw_dialog_present(
462 self.as_ref().to_glib_none().0,
463 parent.map(|p| p.as_ref()).to_glib_none().0,
464 );
465 }
466 }
467
468 #[doc(alias = "adw_dialog_set_can_close")]
469 #[doc(alias = "can-close")]
470 fn set_can_close(&self, can_close: bool) {
471 unsafe {
472 ffi::adw_dialog_set_can_close(self.as_ref().to_glib_none().0, can_close.into_glib());
473 }
474 }
475
476 #[doc(alias = "adw_dialog_set_child")]
477 #[doc(alias = "child")]
478 fn set_child(&self, child: Option<&impl IsA<gtk::Widget>>) {
479 unsafe {
480 ffi::adw_dialog_set_child(
481 self.as_ref().to_glib_none().0,
482 child.map(|p| p.as_ref()).to_glib_none().0,
483 );
484 }
485 }
486
487 #[doc(alias = "adw_dialog_set_content_height")]
488 #[doc(alias = "content-height")]
489 fn set_content_height(&self, content_height: i32) {
490 unsafe {
491 ffi::adw_dialog_set_content_height(self.as_ref().to_glib_none().0, content_height);
492 }
493 }
494
495 #[doc(alias = "adw_dialog_set_content_width")]
496 #[doc(alias = "content-width")]
497 fn set_content_width(&self, content_width: i32) {
498 unsafe {
499 ffi::adw_dialog_set_content_width(self.as_ref().to_glib_none().0, content_width);
500 }
501 }
502
503 #[doc(alias = "adw_dialog_set_default_widget")]
504 #[doc(alias = "default-widget")]
505 fn set_default_widget(&self, default_widget: Option<&impl IsA<gtk::Widget>>) {
506 unsafe {
507 ffi::adw_dialog_set_default_widget(
508 self.as_ref().to_glib_none().0,
509 default_widget.map(|p| p.as_ref()).to_glib_none().0,
510 );
511 }
512 }
513
514 #[doc(alias = "adw_dialog_set_focus")]
515 #[doc(alias = "focus-widget")]
516 fn set_focus(&self, focus: Option<&impl IsA<gtk::Widget>>) {
517 unsafe {
518 ffi::adw_dialog_set_focus(
519 self.as_ref().to_glib_none().0,
520 focus.map(|p| p.as_ref()).to_glib_none().0,
521 );
522 }
523 }
524
525 #[doc(alias = "adw_dialog_set_follows_content_size")]
526 #[doc(alias = "follows-content-size")]
527 fn set_follows_content_size(&self, follows_content_size: bool) {
528 unsafe {
529 ffi::adw_dialog_set_follows_content_size(
530 self.as_ref().to_glib_none().0,
531 follows_content_size.into_glib(),
532 );
533 }
534 }
535
536 #[doc(alias = "adw_dialog_set_presentation_mode")]
537 #[doc(alias = "presentation-mode")]
538 fn set_presentation_mode(&self, presentation_mode: DialogPresentationMode) {
539 unsafe {
540 ffi::adw_dialog_set_presentation_mode(
541 self.as_ref().to_glib_none().0,
542 presentation_mode.into_glib(),
543 );
544 }
545 }
546
547 #[doc(alias = "adw_dialog_set_title")]
548 #[doc(alias = "title")]
549 fn set_title(&self, title: &str) {
550 unsafe {
551 ffi::adw_dialog_set_title(self.as_ref().to_glib_none().0, title.to_glib_none().0);
552 }
553 }
554
555 #[cfg(feature = "v1_5")]
556 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
557 #[doc(alias = "close-attempt")]
558 fn connect_close_attempt<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
559 unsafe extern "C" fn close_attempt_trampoline<P: IsA<Dialog>, F: Fn(&P) + 'static>(
560 this: *mut ffi::AdwDialog,
561 f: glib::ffi::gpointer,
562 ) {
563 let f: &F = &*(f as *const F);
564 f(Dialog::from_glib_borrow(this).unsafe_cast_ref())
565 }
566 unsafe {
567 let f: Box_<F> = Box_::new(f);
568 connect_raw(
569 self.as_ptr() as *mut _,
570 c"close-attempt".as_ptr() as *const _,
571 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
572 close_attempt_trampoline::<Self, F> as *const (),
573 )),
574 Box_::into_raw(f),
575 )
576 }
577 }
578
579 #[cfg(feature = "v1_5")]
580 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
581 #[doc(alias = "closed")]
582 fn connect_closed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
583 unsafe extern "C" fn closed_trampoline<P: IsA<Dialog>, F: Fn(&P) + 'static>(
584 this: *mut ffi::AdwDialog,
585 f: glib::ffi::gpointer,
586 ) {
587 let f: &F = &*(f as *const F);
588 f(Dialog::from_glib_borrow(this).unsafe_cast_ref())
589 }
590 unsafe {
591 let f: Box_<F> = Box_::new(f);
592 connect_raw(
593 self.as_ptr() as *mut _,
594 c"closed".as_ptr() as *const _,
595 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
596 closed_trampoline::<Self, F> as *const (),
597 )),
598 Box_::into_raw(f),
599 )
600 }
601 }
602
603 #[cfg(feature = "v1_5")]
604 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
605 #[doc(alias = "can-close")]
606 fn connect_can_close_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
607 unsafe extern "C" fn notify_can_close_trampoline<P: IsA<Dialog>, F: Fn(&P) + 'static>(
608 this: *mut ffi::AdwDialog,
609 _param_spec: glib::ffi::gpointer,
610 f: glib::ffi::gpointer,
611 ) {
612 let f: &F = &*(f as *const F);
613 f(Dialog::from_glib_borrow(this).unsafe_cast_ref())
614 }
615 unsafe {
616 let f: Box_<F> = Box_::new(f);
617 connect_raw(
618 self.as_ptr() as *mut _,
619 c"notify::can-close".as_ptr() as *const _,
620 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
621 notify_can_close_trampoline::<Self, F> as *const (),
622 )),
623 Box_::into_raw(f),
624 )
625 }
626 }
627
628 #[cfg(feature = "v1_5")]
629 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
630 #[doc(alias = "child")]
631 fn connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
632 unsafe extern "C" fn notify_child_trampoline<P: IsA<Dialog>, F: Fn(&P) + 'static>(
633 this: *mut ffi::AdwDialog,
634 _param_spec: glib::ffi::gpointer,
635 f: glib::ffi::gpointer,
636 ) {
637 let f: &F = &*(f as *const F);
638 f(Dialog::from_glib_borrow(this).unsafe_cast_ref())
639 }
640 unsafe {
641 let f: Box_<F> = Box_::new(f);
642 connect_raw(
643 self.as_ptr() as *mut _,
644 c"notify::child".as_ptr() as *const _,
645 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
646 notify_child_trampoline::<Self, F> as *const (),
647 )),
648 Box_::into_raw(f),
649 )
650 }
651 }
652
653 #[cfg(feature = "v1_5")]
654 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
655 #[doc(alias = "content-height")]
656 fn connect_content_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
657 unsafe extern "C" fn notify_content_height_trampoline<
658 P: IsA<Dialog>,
659 F: Fn(&P) + 'static,
660 >(
661 this: *mut ffi::AdwDialog,
662 _param_spec: glib::ffi::gpointer,
663 f: glib::ffi::gpointer,
664 ) {
665 let f: &F = &*(f as *const F);
666 f(Dialog::from_glib_borrow(this).unsafe_cast_ref())
667 }
668 unsafe {
669 let f: Box_<F> = Box_::new(f);
670 connect_raw(
671 self.as_ptr() as *mut _,
672 c"notify::content-height".as_ptr() as *const _,
673 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
674 notify_content_height_trampoline::<Self, F> as *const (),
675 )),
676 Box_::into_raw(f),
677 )
678 }
679 }
680
681 #[cfg(feature = "v1_5")]
682 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
683 #[doc(alias = "content-width")]
684 fn connect_content_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
685 unsafe extern "C" fn notify_content_width_trampoline<
686 P: IsA<Dialog>,
687 F: Fn(&P) + 'static,
688 >(
689 this: *mut ffi::AdwDialog,
690 _param_spec: glib::ffi::gpointer,
691 f: glib::ffi::gpointer,
692 ) {
693 let f: &F = &*(f as *const F);
694 f(Dialog::from_glib_borrow(this).unsafe_cast_ref())
695 }
696 unsafe {
697 let f: Box_<F> = Box_::new(f);
698 connect_raw(
699 self.as_ptr() as *mut _,
700 c"notify::content-width".as_ptr() as *const _,
701 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
702 notify_content_width_trampoline::<Self, F> as *const (),
703 )),
704 Box_::into_raw(f),
705 )
706 }
707 }
708
709 #[cfg(feature = "v1_5")]
710 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
711 #[doc(alias = "current-breakpoint")]
712 fn connect_current_breakpoint_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
713 unsafe extern "C" fn notify_current_breakpoint_trampoline<
714 P: IsA<Dialog>,
715 F: Fn(&P) + 'static,
716 >(
717 this: *mut ffi::AdwDialog,
718 _param_spec: glib::ffi::gpointer,
719 f: glib::ffi::gpointer,
720 ) {
721 let f: &F = &*(f as *const F);
722 f(Dialog::from_glib_borrow(this).unsafe_cast_ref())
723 }
724 unsafe {
725 let f: Box_<F> = Box_::new(f);
726 connect_raw(
727 self.as_ptr() as *mut _,
728 c"notify::current-breakpoint".as_ptr() as *const _,
729 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
730 notify_current_breakpoint_trampoline::<Self, F> as *const (),
731 )),
732 Box_::into_raw(f),
733 )
734 }
735 }
736
737 #[cfg(feature = "v1_5")]
738 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
739 #[doc(alias = "default-widget")]
740 fn connect_default_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
741 unsafe extern "C" fn notify_default_widget_trampoline<
742 P: IsA<Dialog>,
743 F: Fn(&P) + 'static,
744 >(
745 this: *mut ffi::AdwDialog,
746 _param_spec: glib::ffi::gpointer,
747 f: glib::ffi::gpointer,
748 ) {
749 let f: &F = &*(f as *const F);
750 f(Dialog::from_glib_borrow(this).unsafe_cast_ref())
751 }
752 unsafe {
753 let f: Box_<F> = Box_::new(f);
754 connect_raw(
755 self.as_ptr() as *mut _,
756 c"notify::default-widget".as_ptr() as *const _,
757 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
758 notify_default_widget_trampoline::<Self, F> as *const (),
759 )),
760 Box_::into_raw(f),
761 )
762 }
763 }
764
765 #[cfg(feature = "v1_5")]
766 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
767 #[doc(alias = "focus-widget")]
768 fn connect_focus_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
769 unsafe extern "C" fn notify_focus_widget_trampoline<P: IsA<Dialog>, F: Fn(&P) + 'static>(
770 this: *mut ffi::AdwDialog,
771 _param_spec: glib::ffi::gpointer,
772 f: glib::ffi::gpointer,
773 ) {
774 let f: &F = &*(f as *const F);
775 f(Dialog::from_glib_borrow(this).unsafe_cast_ref())
776 }
777 unsafe {
778 let f: Box_<F> = Box_::new(f);
779 connect_raw(
780 self.as_ptr() as *mut _,
781 c"notify::focus-widget".as_ptr() as *const _,
782 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
783 notify_focus_widget_trampoline::<Self, F> as *const (),
784 )),
785 Box_::into_raw(f),
786 )
787 }
788 }
789
790 #[cfg(feature = "v1_5")]
791 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
792 #[doc(alias = "follows-content-size")]
793 fn connect_follows_content_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
794 unsafe extern "C" fn notify_follows_content_size_trampoline<
795 P: IsA<Dialog>,
796 F: Fn(&P) + 'static,
797 >(
798 this: *mut ffi::AdwDialog,
799 _param_spec: glib::ffi::gpointer,
800 f: glib::ffi::gpointer,
801 ) {
802 let f: &F = &*(f as *const F);
803 f(Dialog::from_glib_borrow(this).unsafe_cast_ref())
804 }
805 unsafe {
806 let f: Box_<F> = Box_::new(f);
807 connect_raw(
808 self.as_ptr() as *mut _,
809 c"notify::follows-content-size".as_ptr() as *const _,
810 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
811 notify_follows_content_size_trampoline::<Self, F> as *const (),
812 )),
813 Box_::into_raw(f),
814 )
815 }
816 }
817
818 #[cfg(feature = "v1_5")]
819 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
820 #[doc(alias = "presentation-mode")]
821 fn connect_presentation_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
822 unsafe extern "C" fn notify_presentation_mode_trampoline<
823 P: IsA<Dialog>,
824 F: Fn(&P) + 'static,
825 >(
826 this: *mut ffi::AdwDialog,
827 _param_spec: glib::ffi::gpointer,
828 f: glib::ffi::gpointer,
829 ) {
830 let f: &F = &*(f as *const F);
831 f(Dialog::from_glib_borrow(this).unsafe_cast_ref())
832 }
833 unsafe {
834 let f: Box_<F> = Box_::new(f);
835 connect_raw(
836 self.as_ptr() as *mut _,
837 c"notify::presentation-mode".as_ptr() as *const _,
838 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
839 notify_presentation_mode_trampoline::<Self, F> as *const (),
840 )),
841 Box_::into_raw(f),
842 )
843 }
844 }
845
846 #[cfg(feature = "v1_5")]
847 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
848 #[doc(alias = "title")]
849 fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
850 unsafe extern "C" fn notify_title_trampoline<P: IsA<Dialog>, F: Fn(&P) + 'static>(
851 this: *mut ffi::AdwDialog,
852 _param_spec: glib::ffi::gpointer,
853 f: glib::ffi::gpointer,
854 ) {
855 let f: &F = &*(f as *const F);
856 f(Dialog::from_glib_borrow(this).unsafe_cast_ref())
857 }
858 unsafe {
859 let f: Box_<F> = Box_::new(f);
860 connect_raw(
861 self.as_ptr() as *mut _,
862 c"notify::title".as_ptr() as *const _,
863 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
864 notify_title_trampoline::<Self, F> as *const (),
865 )),
866 Box_::into_raw(f),
867 )
868 }
869 }
870}
871
872impl<O: IsA<Dialog>> AdwDialogExt for O {}