1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files.git)
// DO NOT EDIT

use crate::ffi;
use glib::{
    prelude::*,
    signal::{connect_raw, SignalHandlerId},
    translate::*,
};
use std::{boxed::Box as Box_, pin::Pin};

glib::wrapper! {
    ///
    ///
    /// ## Properties
    ///
    ///
    /// #### `icon`
    ///  The "icon" property contains a [`gio::Icon`][crate::gio::Icon] that describes the save
    /// operation. Generally, this should be the symbolic icon of the
    /// document class you are saving.
    ///
    /// Alternatively, you can use [`icon-name`][struct@crate::SaveDelegate#icon-name] for a
    /// named icon.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `icon-name`
    ///  The "icon-name" property contains the name of an icon to use when
    /// showing information about the save operation in UI such as a save
    /// dialog.
    ///
    /// You can also use [`icon`][struct@crate::SaveDelegate#icon] to set a [`gio::Icon`][crate::gio::Icon] instead of
    /// an icon name.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `is-draft`
    ///  The "is-draft" property indicates that the document represented by the
    /// delegate is a draft and might be lost of not saved.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `progress`
    ///  The "progress" property contains progress between 0.0 and 1.0 and
    /// should be updated by the delegate implementation as saving progresses.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `subtitle`
    ///  The "subtitle" property contains additional information that may
    /// not make sense to put in the title. This might include the directory
    /// that the file will be saved within.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `title`
    ///  The "title" property contains the title of the document being saved.
    /// Generally, this should be the base name of the document such as
    /// `file.txt`.
    ///
    /// Readable | Writeable
    ///
    /// ## Signals
    ///
    ///
    /// #### `close`
    ///  This signal is emitted when the save delegate should close
    /// the widget it is related to. This can happen after saving as
    /// part of a close request and it is now save for the delegate to
    /// close.
    ///
    /// Implementations are encouraged to connect to this signal (or
    /// implement the virtual method) and call [`PanelWidgetExt::force_close()`][crate::prelude::PanelWidgetExt::force_close()].
    ///
    ///
    ///
    ///
    /// #### `discard`
    ///  This signal is emitted when the user has requested that the
    /// delegate discard the changes instead of saving them.
    ///
    /// Implementations are encouraged to connect to this signal (or
    /// implement the virtual method) and revert the document to the
    /// last saved state and/or close the document.
    ///
    ///
    ///
    ///
    /// #### `save`
    ///  This signal can be used when subclassing [`SaveDelegate`][crate::SaveDelegate] is not
    /// possible or cumbersome. The default implementation of
    /// `PanelSaveDelegateClass.save_async()` will emit this signal to allow
    /// the consumer to implement asynchronous save in a flexible manner.
    ///
    /// The caller is expected to complete `task` with a boolean when the
    /// save operation has completed.
    ///
    ///
    ///
    /// # Implements
    ///
    /// [`SaveDelegateExt`][trait@crate::prelude::SaveDelegateExt], [`trait@glib::ObjectExt`], [`SaveDelegateExtManual`][trait@crate::prelude::SaveDelegateExtManual]
    #[doc(alias = "PanelSaveDelegate")]
    pub struct SaveDelegate(Object<ffi::PanelSaveDelegate, ffi::PanelSaveDelegateClass>);

    match fn {
        type_ => || ffi::panel_save_delegate_get_type(),
    }
}

impl SaveDelegate {
    pub const NONE: Option<&'static SaveDelegate> = None;

    /// Create a new [`SaveDelegate`][crate::SaveDelegate].
    ///
    /// # Returns
    ///
    /// a newly created [`SaveDelegate`][crate::SaveDelegate]
    #[doc(alias = "panel_save_delegate_new")]
    pub fn new() -> SaveDelegate {
        assert_initialized_main_thread!();
        unsafe { from_glib_full(ffi::panel_save_delegate_new()) }
    }

    // rustdoc-stripper-ignore-next
    /// Creates a new builder-pattern struct instance to construct [`SaveDelegate`] objects.
    ///
    /// This method returns an instance of [`SaveDelegateBuilder`](crate::builders::SaveDelegateBuilder) which can be used to create [`SaveDelegate`] objects.
    pub fn builder() -> SaveDelegateBuilder {
        SaveDelegateBuilder::new()
    }
}

impl Default for SaveDelegate {
    fn default() -> Self {
        Self::new()
    }
}

// rustdoc-stripper-ignore-next
/// A [builder-pattern] type to construct [`SaveDelegate`] objects.
///
/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
#[must_use = "The builder must be built to be used"]
pub struct SaveDelegateBuilder {
    builder: glib::object::ObjectBuilder<'static, SaveDelegate>,
}

impl SaveDelegateBuilder {
    fn new() -> Self {
        Self {
            builder: glib::object::Object::builder(),
        }
    }

    /// The "icon" property contains a [`gio::Icon`][crate::gio::Icon] that describes the save
    /// operation. Generally, this should be the symbolic icon of the
    /// document class you are saving.
    ///
    /// Alternatively, you can use [`icon-name`][struct@crate::SaveDelegate#icon-name] for a
    /// named icon.
    pub fn icon(self, icon: &impl IsA<gio::Icon>) -> Self {
        Self {
            builder: self.builder.property("icon", icon.clone().upcast()),
        }
    }

    /// The "icon-name" property contains the name of an icon to use when
    /// showing information about the save operation in UI such as a save
    /// dialog.
    ///
    /// You can also use [`icon`][struct@crate::SaveDelegate#icon] to set a [`gio::Icon`][crate::gio::Icon] instead of
    /// an icon name.
    pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
        Self {
            builder: self.builder.property("icon-name", icon_name.into()),
        }
    }

    /// The "is-draft" property indicates that the document represented by the
    /// delegate is a draft and might be lost of not saved.
    pub fn is_draft(self, is_draft: bool) -> Self {
        Self {
            builder: self.builder.property("is-draft", is_draft),
        }
    }

    /// The "progress" property contains progress between 0.0 and 1.0 and
    /// should be updated by the delegate implementation as saving progresses.
    pub fn progress(self, progress: f64) -> Self {
        Self {
            builder: self.builder.property("progress", progress),
        }
    }

    /// The "subtitle" property contains additional information that may
    /// not make sense to put in the title. This might include the directory
    /// that the file will be saved within.
    pub fn subtitle(self, subtitle: impl Into<glib::GString>) -> Self {
        Self {
            builder: self.builder.property("subtitle", subtitle.into()),
        }
    }

    /// The "title" property contains the title of the document being saved.
    /// Generally, this should be the base name of the document such as
    /// `file.txt`.
    pub fn title(self, title: impl Into<glib::GString>) -> Self {
        Self {
            builder: self.builder.property("title", title.into()),
        }
    }

    // rustdoc-stripper-ignore-next
    /// Build the [`SaveDelegate`].
    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
    pub fn build(self) -> SaveDelegate {
        self.builder.build()
    }
}

mod sealed {
    pub trait Sealed {}
    impl<T: super::IsA<super::SaveDelegate>> Sealed for T {}
}

/// Trait containing all [`struct@SaveDelegate`] methods.
///
/// # Implementors
///
/// [`SaveDelegate`][struct@crate::SaveDelegate]
pub trait SaveDelegateExt: IsA<SaveDelegate> + sealed::Sealed + 'static {
    #[doc(alias = "panel_save_delegate_close")]
    fn close(&self) {
        unsafe {
            ffi::panel_save_delegate_close(self.as_ref().to_glib_none().0);
        }
    }

    #[doc(alias = "panel_save_delegate_discard")]
    fn discard(&self) {
        unsafe {
            ffi::panel_save_delegate_discard(self.as_ref().to_glib_none().0);
        }
    }

    /// Gets the [`gio::Icon`][crate::gio::Icon] for the save delegate, or [`None`] if unset.
    ///
    /// # Returns
    ///
    /// a [`gio::Icon`][crate::gio::Icon] or [`None`]
    #[doc(alias = "panel_save_delegate_get_icon")]
    #[doc(alias = "get_icon")]
    fn icon(&self) -> Option<gio::Icon> {
        unsafe {
            from_glib_none(ffi::panel_save_delegate_get_icon(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Gets the icon name for the save delegate.
    ///
    /// # Returns
    ///
    /// the icon name or [`None`]
    #[doc(alias = "panel_save_delegate_get_icon_name")]
    #[doc(alias = "get_icon_name")]
    #[doc(alias = "icon-name")]
    fn icon_name(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_none(ffi::panel_save_delegate_get_icon_name(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "panel_save_delegate_get_is_draft")]
    #[doc(alias = "get_is_draft")]
    #[doc(alias = "is-draft")]
    fn is_draft(&self) -> bool {
        unsafe {
            from_glib(ffi::panel_save_delegate_get_is_draft(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "panel_save_delegate_get_progress")]
    #[doc(alias = "get_progress")]
    fn progress(&self) -> f64 {
        unsafe { ffi::panel_save_delegate_get_progress(self.as_ref().to_glib_none().0) }
    }

    /// Gets the subtitle for the save delegate.
    ///
    /// # Returns
    ///
    /// the subtitle or [`None`]
    #[doc(alias = "panel_save_delegate_get_subtitle")]
    #[doc(alias = "get_subtitle")]
    fn subtitle(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_none(ffi::panel_save_delegate_get_subtitle(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Gets the title for the save delegate.
    ///
    /// # Returns
    ///
    /// the title or [`None`]
    #[doc(alias = "panel_save_delegate_get_title")]
    #[doc(alias = "get_title")]
    fn title(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_none(ffi::panel_save_delegate_get_title(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "panel_save_delegate_save_async")]
    fn save_async<P: FnOnce(Result<(), glib::Error>) + 'static>(
        &self,
        cancellable: Option<&impl IsA<gio::Cancellable>>,
        callback: P,
    ) {
        let main_context = glib::MainContext::ref_thread_default();
        let is_main_context_owner = main_context.is_owner();
        let has_acquired_main_context = (!is_main_context_owner)
            .then(|| main_context.acquire().ok())
            .flatten();
        assert!(
            is_main_context_owner || has_acquired_main_context.is_some(),
            "Async operations only allowed if the thread is owning the MainContext"
        );

        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> =
            Box_::new(glib::thread_guard::ThreadGuard::new(callback));
        unsafe extern "C" fn save_async_trampoline<P: FnOnce(Result<(), glib::Error>) + 'static>(
            _source_object: *mut glib::gobject_ffi::GObject,
            res: *mut gio::ffi::GAsyncResult,
            user_data: glib::ffi::gpointer,
        ) {
            let mut error = std::ptr::null_mut();
            let _ = ffi::panel_save_delegate_save_finish(_source_object as *mut _, res, &mut error);
            let result = if error.is_null() {
                Ok(())
            } else {
                Err(from_glib_full(error))
            };
            let callback: Box_<glib::thread_guard::ThreadGuard<P>> =
                Box_::from_raw(user_data as *mut _);
            let callback: P = callback.into_inner();
            callback(result);
        }
        let callback = save_async_trampoline::<P>;
        unsafe {
            ffi::panel_save_delegate_save_async(
                self.as_ref().to_glib_none().0,
                cancellable.map(|p| p.as_ref()).to_glib_none().0,
                Some(callback),
                Box_::into_raw(user_data) as *mut _,
            );
        }
    }

    fn save_future(
        &self,
    ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
        Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| {
            obj.save_async(Some(cancellable), move |res| {
                send.resolve(res);
            });
        }))
    }

    /// Sets the [`gio::Icon`][crate::gio::Icon] for the save delegate. Pass [`None`] to unset.
    /// ## `icon`
    /// a [`gio::Icon`][crate::gio::Icon] or [`None`]
    #[doc(alias = "panel_save_delegate_set_icon")]
    #[doc(alias = "icon")]
    fn set_icon(&self, icon: Option<&impl IsA<gio::Icon>>) {
        unsafe {
            ffi::panel_save_delegate_set_icon(
                self.as_ref().to_glib_none().0,
                icon.map(|p| p.as_ref()).to_glib_none().0,
            );
        }
    }

    /// Sets the icon name for the save delegate. Pass [`None`] to unset.
    /// ## `icon`
    /// the icon name or [`None`]
    #[doc(alias = "panel_save_delegate_set_icon_name")]
    #[doc(alias = "icon-name")]
    fn set_icon_name(&self, icon: Option<&str>) {
        unsafe {
            ffi::panel_save_delegate_set_icon_name(
                self.as_ref().to_glib_none().0,
                icon.to_glib_none().0,
            );
        }
    }

    #[doc(alias = "panel_save_delegate_set_is_draft")]
    #[doc(alias = "is-draft")]
    fn set_is_draft(&self, is_draft: bool) {
        unsafe {
            ffi::panel_save_delegate_set_is_draft(
                self.as_ref().to_glib_none().0,
                is_draft.into_glib(),
            );
        }
    }

    #[doc(alias = "panel_save_delegate_set_progress")]
    #[doc(alias = "progress")]
    fn set_progress(&self, progress: f64) {
        unsafe {
            ffi::panel_save_delegate_set_progress(self.as_ref().to_glib_none().0, progress);
        }
    }

    /// Sets the subtitle for the save delegate. Pass [`None`] to unset.
    /// ## `subtitle`
    /// the subtitle or [`None`]
    #[doc(alias = "panel_save_delegate_set_subtitle")]
    #[doc(alias = "subtitle")]
    fn set_subtitle(&self, subtitle: Option<&str>) {
        unsafe {
            ffi::panel_save_delegate_set_subtitle(
                self.as_ref().to_glib_none().0,
                subtitle.to_glib_none().0,
            );
        }
    }

    /// Sets the title for the save delegate. Pass [`None`] to unset.
    /// ## `title`
    /// the title or [`None`]
    #[doc(alias = "panel_save_delegate_set_title")]
    #[doc(alias = "title")]
    fn set_title(&self, title: Option<&str>) {
        unsafe {
            ffi::panel_save_delegate_set_title(
                self.as_ref().to_glib_none().0,
                title.to_glib_none().0,
            );
        }
    }

    /// This signal is emitted when the save delegate should close
    /// the widget it is related to. This can happen after saving as
    /// part of a close request and it is now save for the delegate to
    /// close.
    ///
    /// Implementations are encouraged to connect to this signal (or
    /// implement the virtual method) and call [`PanelWidgetExt::force_close()`][crate::prelude::PanelWidgetExt::force_close()].
    #[doc(alias = "close")]
    fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn close_trampoline<P: IsA<SaveDelegate>, F: Fn(&P) + 'static>(
            this: *mut ffi::PanelSaveDelegate,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(SaveDelegate::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"close\0".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    close_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    /// This signal is emitted when the user has requested that the
    /// delegate discard the changes instead of saving them.
    ///
    /// Implementations are encouraged to connect to this signal (or
    /// implement the virtual method) and revert the document to the
    /// last saved state and/or close the document.
    #[doc(alias = "discard")]
    fn connect_discard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn discard_trampoline<P: IsA<SaveDelegate>, F: Fn(&P) + 'static>(
            this: *mut ffi::PanelSaveDelegate,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(SaveDelegate::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"discard\0".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    discard_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "icon")]
    fn connect_icon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_icon_trampoline<P: IsA<SaveDelegate>, F: Fn(&P) + 'static>(
            this: *mut ffi::PanelSaveDelegate,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(SaveDelegate::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::icon\0".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_icon_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "icon-name")]
    fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_icon_name_trampoline<
            P: IsA<SaveDelegate>,
            F: Fn(&P) + 'static,
        >(
            this: *mut ffi::PanelSaveDelegate,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(SaveDelegate::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::icon-name\0".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_icon_name_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "is-draft")]
    fn connect_is_draft_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_is_draft_trampoline<
            P: IsA<SaveDelegate>,
            F: Fn(&P) + 'static,
        >(
            this: *mut ffi::PanelSaveDelegate,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(SaveDelegate::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::is-draft\0".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_is_draft_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "progress")]
    fn connect_progress_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_progress_trampoline<
            P: IsA<SaveDelegate>,
            F: Fn(&P) + 'static,
        >(
            this: *mut ffi::PanelSaveDelegate,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(SaveDelegate::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::progress\0".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_progress_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "subtitle")]
    fn connect_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_subtitle_trampoline<
            P: IsA<SaveDelegate>,
            F: Fn(&P) + 'static,
        >(
            this: *mut ffi::PanelSaveDelegate,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(SaveDelegate::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::subtitle\0".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_subtitle_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "title")]
    fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_title_trampoline<P: IsA<SaveDelegate>, F: Fn(&P) + 'static>(
            this: *mut ffi::PanelSaveDelegate,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(SaveDelegate::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::title\0".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_title_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }
}

impl<O: IsA<SaveDelegate>> SaveDelegateExt for O {}