libpanel/auto/
save_delegate.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files.git)
4// DO NOT EDIT
5
6use crate::ffi;
7use glib::{
8    object::ObjectType as _,
9    prelude::*,
10    signal::{connect_raw, SignalHandlerId},
11    translate::*,
12};
13use std::{boxed::Box as Box_, pin::Pin};
14
15glib::wrapper! {
16    ///
17    ///
18    /// ## Properties
19    ///
20    ///
21    /// #### `icon`
22    ///  The "icon" property contains a [`gio::Icon`][crate::gio::Icon] that describes the save
23    /// operation. Generally, this should be the symbolic icon of the
24    /// document class you are saving.
25    ///
26    /// Alternatively, you can use [`icon-name`][struct@crate::SaveDelegate#icon-name] for a
27    /// named icon.
28    ///
29    /// Readable | Writeable
30    ///
31    ///
32    /// #### `icon-name`
33    ///  The "icon-name" property contains the name of an icon to use when
34    /// showing information about the save operation in UI such as a save
35    /// dialog.
36    ///
37    /// You can also use [`icon`][struct@crate::SaveDelegate#icon] to set a [`gio::Icon`][crate::gio::Icon] instead of
38    /// an icon name.
39    ///
40    /// Readable | Writeable
41    ///
42    ///
43    /// #### `is-draft`
44    ///  The "is-draft" property indicates that the document represented by the
45    /// delegate is a draft and might be lost of not saved.
46    ///
47    /// Readable | Writeable
48    ///
49    ///
50    /// #### `progress`
51    ///  The "progress" property contains progress between 0.0 and 1.0 and
52    /// should be updated by the delegate implementation as saving progresses.
53    ///
54    /// Readable | Writeable
55    ///
56    ///
57    /// #### `subtitle`
58    ///  The "subtitle" property contains additional information that may
59    /// not make sense to put in the title. This might include the directory
60    /// that the file will be saved within.
61    ///
62    /// Readable | Writeable
63    ///
64    ///
65    /// #### `title`
66    ///  The "title" property contains the title of the document being saved.
67    /// Generally, this should be the base name of the document such as
68    /// `file.txt`.
69    ///
70    /// Readable | Writeable
71    ///
72    /// ## Signals
73    ///
74    ///
75    /// #### `close`
76    ///  This signal is emitted when the save delegate should close
77    /// the widget it is related to. This can happen after saving as
78    /// part of a close request and it is now save for the delegate to
79    /// close.
80    ///
81    /// Implementations are encouraged to connect to this signal (or
82    /// implement the virtual method) and call [`PanelWidgetExt::force_close()`][crate::prelude::PanelWidgetExt::force_close()].
83    ///
84    ///
85    ///
86    ///
87    /// #### `discard`
88    ///  This signal is emitted when the user has requested that the
89    /// delegate discard the changes instead of saving them.
90    ///
91    /// Implementations are encouraged to connect to this signal (or
92    /// implement the virtual method) and revert the document to the
93    /// last saved state and/or close the document.
94    ///
95    ///
96    ///
97    ///
98    /// #### `save`
99    ///  This signal can be used when subclassing [`SaveDelegate`][crate::SaveDelegate] is not
100    /// possible or cumbersome. The default implementation of
101    /// `PanelSaveDelegateClass.save_async()` will emit this signal to allow
102    /// the consumer to implement asynchronous save in a flexible manner.
103    ///
104    /// The caller is expected to complete `task` with a boolean when the
105    /// save operation has completed.
106    ///
107    ///
108    ///
109    /// # Implements
110    ///
111    /// [`SaveDelegateExt`][trait@crate::prelude::SaveDelegateExt], [`trait@glib::ObjectExt`], [`SaveDelegateExtManual`][trait@crate::prelude::SaveDelegateExtManual]
112    #[doc(alias = "PanelSaveDelegate")]
113    pub struct SaveDelegate(Object<ffi::PanelSaveDelegate, ffi::PanelSaveDelegateClass>);
114
115    match fn {
116        type_ => || ffi::panel_save_delegate_get_type(),
117    }
118}
119
120impl SaveDelegate {
121    pub const NONE: Option<&'static SaveDelegate> = None;
122
123    /// Create a new [`SaveDelegate`][crate::SaveDelegate].
124    ///
125    /// # Returns
126    ///
127    /// a newly created [`SaveDelegate`][crate::SaveDelegate]
128    #[doc(alias = "panel_save_delegate_new")]
129    pub fn new() -> SaveDelegate {
130        assert_initialized_main_thread!();
131        unsafe { from_glib_full(ffi::panel_save_delegate_new()) }
132    }
133
134    // rustdoc-stripper-ignore-next
135    /// Creates a new builder-pattern struct instance to construct [`SaveDelegate`] objects.
136    ///
137    /// This method returns an instance of [`SaveDelegateBuilder`](crate::builders::SaveDelegateBuilder) which can be used to create [`SaveDelegate`] objects.
138    pub fn builder() -> SaveDelegateBuilder {
139        SaveDelegateBuilder::new()
140    }
141}
142
143impl Default for SaveDelegate {
144    fn default() -> Self {
145        Self::new()
146    }
147}
148
149// rustdoc-stripper-ignore-next
150/// A [builder-pattern] type to construct [`SaveDelegate`] objects.
151///
152/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
153#[must_use = "The builder must be built to be used"]
154pub struct SaveDelegateBuilder {
155    builder: glib::object::ObjectBuilder<'static, SaveDelegate>,
156}
157
158impl SaveDelegateBuilder {
159    fn new() -> Self {
160        Self {
161            builder: glib::object::Object::builder(),
162        }
163    }
164
165    /// The "icon" property contains a [`gio::Icon`][crate::gio::Icon] that describes the save
166    /// operation. Generally, this should be the symbolic icon of the
167    /// document class you are saving.
168    ///
169    /// Alternatively, you can use [`icon-name`][struct@crate::SaveDelegate#icon-name] for a
170    /// named icon.
171    pub fn icon(self, icon: &impl IsA<gio::Icon>) -> Self {
172        Self {
173            builder: self.builder.property("icon", icon.clone().upcast()),
174        }
175    }
176
177    /// The "icon-name" property contains the name of an icon to use when
178    /// showing information about the save operation in UI such as a save
179    /// dialog.
180    ///
181    /// You can also use [`icon`][struct@crate::SaveDelegate#icon] to set a [`gio::Icon`][crate::gio::Icon] instead of
182    /// an icon name.
183    pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
184        Self {
185            builder: self.builder.property("icon-name", icon_name.into()),
186        }
187    }
188
189    /// The "is-draft" property indicates that the document represented by the
190    /// delegate is a draft and might be lost of not saved.
191    pub fn is_draft(self, is_draft: bool) -> Self {
192        Self {
193            builder: self.builder.property("is-draft", is_draft),
194        }
195    }
196
197    /// The "progress" property contains progress between 0.0 and 1.0 and
198    /// should be updated by the delegate implementation as saving progresses.
199    pub fn progress(self, progress: f64) -> Self {
200        Self {
201            builder: self.builder.property("progress", progress),
202        }
203    }
204
205    /// The "subtitle" property contains additional information that may
206    /// not make sense to put in the title. This might include the directory
207    /// that the file will be saved within.
208    pub fn subtitle(self, subtitle: impl Into<glib::GString>) -> Self {
209        Self {
210            builder: self.builder.property("subtitle", subtitle.into()),
211        }
212    }
213
214    /// The "title" property contains the title of the document being saved.
215    /// Generally, this should be the base name of the document such as
216    /// `file.txt`.
217    pub fn title(self, title: impl Into<glib::GString>) -> Self {
218        Self {
219            builder: self.builder.property("title", title.into()),
220        }
221    }
222
223    // rustdoc-stripper-ignore-next
224    /// Build the [`SaveDelegate`].
225    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
226    pub fn build(self) -> SaveDelegate {
227        assert_initialized_main_thread!();
228        self.builder.build()
229    }
230}
231
232/// Trait containing all [`struct@SaveDelegate`] methods.
233///
234/// # Implementors
235///
236/// [`SaveDelegate`][struct@crate::SaveDelegate]
237pub trait SaveDelegateExt: IsA<SaveDelegate> + 'static {
238    #[doc(alias = "panel_save_delegate_close")]
239    fn close(&self) {
240        unsafe {
241            ffi::panel_save_delegate_close(self.as_ref().to_glib_none().0);
242        }
243    }
244
245    #[doc(alias = "panel_save_delegate_discard")]
246    fn discard(&self) {
247        unsafe {
248            ffi::panel_save_delegate_discard(self.as_ref().to_glib_none().0);
249        }
250    }
251
252    /// Gets the [`gio::Icon`][crate::gio::Icon] for the save delegate, or [`None`] if unset.
253    ///
254    /// # Returns
255    ///
256    /// a [`gio::Icon`][crate::gio::Icon] or [`None`]
257    #[doc(alias = "panel_save_delegate_get_icon")]
258    #[doc(alias = "get_icon")]
259    fn icon(&self) -> Option<gio::Icon> {
260        unsafe {
261            from_glib_none(ffi::panel_save_delegate_get_icon(
262                self.as_ref().to_glib_none().0,
263            ))
264        }
265    }
266
267    /// Gets the icon name for the save delegate.
268    ///
269    /// # Returns
270    ///
271    /// the icon name or [`None`]
272    #[doc(alias = "panel_save_delegate_get_icon_name")]
273    #[doc(alias = "get_icon_name")]
274    #[doc(alias = "icon-name")]
275    fn icon_name(&self) -> Option<glib::GString> {
276        unsafe {
277            from_glib_none(ffi::panel_save_delegate_get_icon_name(
278                self.as_ref().to_glib_none().0,
279            ))
280        }
281    }
282
283    #[doc(alias = "panel_save_delegate_get_is_draft")]
284    #[doc(alias = "get_is_draft")]
285    #[doc(alias = "is-draft")]
286    fn is_draft(&self) -> bool {
287        unsafe {
288            from_glib(ffi::panel_save_delegate_get_is_draft(
289                self.as_ref().to_glib_none().0,
290            ))
291        }
292    }
293
294    #[doc(alias = "panel_save_delegate_get_progress")]
295    #[doc(alias = "get_progress")]
296    fn progress(&self) -> f64 {
297        unsafe { ffi::panel_save_delegate_get_progress(self.as_ref().to_glib_none().0) }
298    }
299
300    /// Gets the subtitle for the save delegate.
301    ///
302    /// # Returns
303    ///
304    /// the subtitle or [`None`]
305    #[doc(alias = "panel_save_delegate_get_subtitle")]
306    #[doc(alias = "get_subtitle")]
307    fn subtitle(&self) -> Option<glib::GString> {
308        unsafe {
309            from_glib_none(ffi::panel_save_delegate_get_subtitle(
310                self.as_ref().to_glib_none().0,
311            ))
312        }
313    }
314
315    /// Gets the title for the save delegate.
316    ///
317    /// # Returns
318    ///
319    /// the title or [`None`]
320    #[doc(alias = "panel_save_delegate_get_title")]
321    #[doc(alias = "get_title")]
322    fn title(&self) -> Option<glib::GString> {
323        unsafe {
324            from_glib_none(ffi::panel_save_delegate_get_title(
325                self.as_ref().to_glib_none().0,
326            ))
327        }
328    }
329
330    #[doc(alias = "panel_save_delegate_save_async")]
331    fn save_async<P: FnOnce(Result<(), glib::Error>) + 'static>(
332        &self,
333        cancellable: Option<&impl IsA<gio::Cancellable>>,
334        callback: P,
335    ) {
336        let main_context = glib::MainContext::ref_thread_default();
337        let is_main_context_owner = main_context.is_owner();
338        let has_acquired_main_context = (!is_main_context_owner)
339            .then(|| main_context.acquire().ok())
340            .flatten();
341        assert!(
342            is_main_context_owner || has_acquired_main_context.is_some(),
343            "Async operations only allowed if the thread is owning the MainContext"
344        );
345
346        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> =
347            Box_::new(glib::thread_guard::ThreadGuard::new(callback));
348        unsafe extern "C" fn save_async_trampoline<P: FnOnce(Result<(), glib::Error>) + 'static>(
349            _source_object: *mut glib::gobject_ffi::GObject,
350            res: *mut gio::ffi::GAsyncResult,
351            user_data: glib::ffi::gpointer,
352        ) {
353            let mut error = std::ptr::null_mut();
354            ffi::panel_save_delegate_save_finish(_source_object as *mut _, res, &mut error);
355            let result = if error.is_null() {
356                Ok(())
357            } else {
358                Err(from_glib_full(error))
359            };
360            let callback: Box_<glib::thread_guard::ThreadGuard<P>> =
361                Box_::from_raw(user_data as *mut _);
362            let callback: P = callback.into_inner();
363            callback(result);
364        }
365        let callback = save_async_trampoline::<P>;
366        unsafe {
367            ffi::panel_save_delegate_save_async(
368                self.as_ref().to_glib_none().0,
369                cancellable.map(|p| p.as_ref()).to_glib_none().0,
370                Some(callback),
371                Box_::into_raw(user_data) as *mut _,
372            );
373        }
374    }
375
376    fn save_future(
377        &self,
378    ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
379        Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| {
380            obj.save_async(Some(cancellable), move |res| {
381                send.resolve(res);
382            });
383        }))
384    }
385
386    /// Sets the [`gio::Icon`][crate::gio::Icon] for the save delegate. Pass [`None`] to unset.
387    /// ## `icon`
388    /// a [`gio::Icon`][crate::gio::Icon] or [`None`]
389    #[doc(alias = "panel_save_delegate_set_icon")]
390    #[doc(alias = "icon")]
391    fn set_icon(&self, icon: Option<&impl IsA<gio::Icon>>) {
392        unsafe {
393            ffi::panel_save_delegate_set_icon(
394                self.as_ref().to_glib_none().0,
395                icon.map(|p| p.as_ref()).to_glib_none().0,
396            );
397        }
398    }
399
400    /// Sets the icon name for the save delegate. Pass [`None`] to unset.
401    /// ## `icon`
402    /// the icon name or [`None`]
403    #[doc(alias = "panel_save_delegate_set_icon_name")]
404    #[doc(alias = "icon-name")]
405    fn set_icon_name(&self, icon: Option<&str>) {
406        unsafe {
407            ffi::panel_save_delegate_set_icon_name(
408                self.as_ref().to_glib_none().0,
409                icon.to_glib_none().0,
410            );
411        }
412    }
413
414    #[doc(alias = "panel_save_delegate_set_is_draft")]
415    #[doc(alias = "is-draft")]
416    fn set_is_draft(&self, is_draft: bool) {
417        unsafe {
418            ffi::panel_save_delegate_set_is_draft(
419                self.as_ref().to_glib_none().0,
420                is_draft.into_glib(),
421            );
422        }
423    }
424
425    #[doc(alias = "panel_save_delegate_set_progress")]
426    #[doc(alias = "progress")]
427    fn set_progress(&self, progress: f64) {
428        unsafe {
429            ffi::panel_save_delegate_set_progress(self.as_ref().to_glib_none().0, progress);
430        }
431    }
432
433    /// Sets the subtitle for the save delegate. Pass [`None`] to unset.
434    /// ## `subtitle`
435    /// the subtitle or [`None`]
436    #[doc(alias = "panel_save_delegate_set_subtitle")]
437    #[doc(alias = "subtitle")]
438    fn set_subtitle(&self, subtitle: Option<&str>) {
439        unsafe {
440            ffi::panel_save_delegate_set_subtitle(
441                self.as_ref().to_glib_none().0,
442                subtitle.to_glib_none().0,
443            );
444        }
445    }
446
447    /// Sets the title for the save delegate. Pass [`None`] to unset.
448    /// ## `title`
449    /// the title or [`None`]
450    #[doc(alias = "panel_save_delegate_set_title")]
451    #[doc(alias = "title")]
452    fn set_title(&self, title: Option<&str>) {
453        unsafe {
454            ffi::panel_save_delegate_set_title(
455                self.as_ref().to_glib_none().0,
456                title.to_glib_none().0,
457            );
458        }
459    }
460
461    /// This signal is emitted when the save delegate should close
462    /// the widget it is related to. This can happen after saving as
463    /// part of a close request and it is now save for the delegate to
464    /// close.
465    ///
466    /// Implementations are encouraged to connect to this signal (or
467    /// implement the virtual method) and call [`PanelWidgetExt::force_close()`][crate::prelude::PanelWidgetExt::force_close()].
468    #[doc(alias = "close")]
469    fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
470        unsafe extern "C" fn close_trampoline<P: IsA<SaveDelegate>, F: Fn(&P) + 'static>(
471            this: *mut ffi::PanelSaveDelegate,
472            f: glib::ffi::gpointer,
473        ) {
474            let f: &F = &*(f as *const F);
475            f(SaveDelegate::from_glib_borrow(this).unsafe_cast_ref())
476        }
477        unsafe {
478            let f: Box_<F> = Box_::new(f);
479            connect_raw(
480                self.as_ptr() as *mut _,
481                c"close".as_ptr() as *const _,
482                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
483                    close_trampoline::<Self, F> as *const (),
484                )),
485                Box_::into_raw(f),
486            )
487        }
488    }
489
490    /// This signal is emitted when the user has requested that the
491    /// delegate discard the changes instead of saving them.
492    ///
493    /// Implementations are encouraged to connect to this signal (or
494    /// implement the virtual method) and revert the document to the
495    /// last saved state and/or close the document.
496    #[doc(alias = "discard")]
497    fn connect_discard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
498        unsafe extern "C" fn discard_trampoline<P: IsA<SaveDelegate>, F: Fn(&P) + 'static>(
499            this: *mut ffi::PanelSaveDelegate,
500            f: glib::ffi::gpointer,
501        ) {
502            let f: &F = &*(f as *const F);
503            f(SaveDelegate::from_glib_borrow(this).unsafe_cast_ref())
504        }
505        unsafe {
506            let f: Box_<F> = Box_::new(f);
507            connect_raw(
508                self.as_ptr() as *mut _,
509                c"discard".as_ptr() as *const _,
510                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
511                    discard_trampoline::<Self, F> as *const (),
512                )),
513                Box_::into_raw(f),
514            )
515        }
516    }
517
518    #[doc(alias = "icon")]
519    fn connect_icon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
520        unsafe extern "C" fn notify_icon_trampoline<P: IsA<SaveDelegate>, F: Fn(&P) + 'static>(
521            this: *mut ffi::PanelSaveDelegate,
522            _param_spec: glib::ffi::gpointer,
523            f: glib::ffi::gpointer,
524        ) {
525            let f: &F = &*(f as *const F);
526            f(SaveDelegate::from_glib_borrow(this).unsafe_cast_ref())
527        }
528        unsafe {
529            let f: Box_<F> = Box_::new(f);
530            connect_raw(
531                self.as_ptr() as *mut _,
532                c"notify::icon".as_ptr() as *const _,
533                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
534                    notify_icon_trampoline::<Self, F> as *const (),
535                )),
536                Box_::into_raw(f),
537            )
538        }
539    }
540
541    #[doc(alias = "icon-name")]
542    fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
543        unsafe extern "C" fn notify_icon_name_trampoline<
544            P: IsA<SaveDelegate>,
545            F: Fn(&P) + 'static,
546        >(
547            this: *mut ffi::PanelSaveDelegate,
548            _param_spec: glib::ffi::gpointer,
549            f: glib::ffi::gpointer,
550        ) {
551            let f: &F = &*(f as *const F);
552            f(SaveDelegate::from_glib_borrow(this).unsafe_cast_ref())
553        }
554        unsafe {
555            let f: Box_<F> = Box_::new(f);
556            connect_raw(
557                self.as_ptr() as *mut _,
558                c"notify::icon-name".as_ptr() as *const _,
559                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
560                    notify_icon_name_trampoline::<Self, F> as *const (),
561                )),
562                Box_::into_raw(f),
563            )
564        }
565    }
566
567    #[doc(alias = "is-draft")]
568    fn connect_is_draft_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
569        unsafe extern "C" fn notify_is_draft_trampoline<
570            P: IsA<SaveDelegate>,
571            F: Fn(&P) + 'static,
572        >(
573            this: *mut ffi::PanelSaveDelegate,
574            _param_spec: glib::ffi::gpointer,
575            f: glib::ffi::gpointer,
576        ) {
577            let f: &F = &*(f as *const F);
578            f(SaveDelegate::from_glib_borrow(this).unsafe_cast_ref())
579        }
580        unsafe {
581            let f: Box_<F> = Box_::new(f);
582            connect_raw(
583                self.as_ptr() as *mut _,
584                c"notify::is-draft".as_ptr() as *const _,
585                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
586                    notify_is_draft_trampoline::<Self, F> as *const (),
587                )),
588                Box_::into_raw(f),
589            )
590        }
591    }
592
593    #[doc(alias = "progress")]
594    fn connect_progress_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
595        unsafe extern "C" fn notify_progress_trampoline<
596            P: IsA<SaveDelegate>,
597            F: Fn(&P) + 'static,
598        >(
599            this: *mut ffi::PanelSaveDelegate,
600            _param_spec: glib::ffi::gpointer,
601            f: glib::ffi::gpointer,
602        ) {
603            let f: &F = &*(f as *const F);
604            f(SaveDelegate::from_glib_borrow(this).unsafe_cast_ref())
605        }
606        unsafe {
607            let f: Box_<F> = Box_::new(f);
608            connect_raw(
609                self.as_ptr() as *mut _,
610                c"notify::progress".as_ptr() as *const _,
611                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
612                    notify_progress_trampoline::<Self, F> as *const (),
613                )),
614                Box_::into_raw(f),
615            )
616        }
617    }
618
619    #[doc(alias = "subtitle")]
620    fn connect_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
621        unsafe extern "C" fn notify_subtitle_trampoline<
622            P: IsA<SaveDelegate>,
623            F: Fn(&P) + 'static,
624        >(
625            this: *mut ffi::PanelSaveDelegate,
626            _param_spec: glib::ffi::gpointer,
627            f: glib::ffi::gpointer,
628        ) {
629            let f: &F = &*(f as *const F);
630            f(SaveDelegate::from_glib_borrow(this).unsafe_cast_ref())
631        }
632        unsafe {
633            let f: Box_<F> = Box_::new(f);
634            connect_raw(
635                self.as_ptr() as *mut _,
636                c"notify::subtitle".as_ptr() as *const _,
637                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
638                    notify_subtitle_trampoline::<Self, F> as *const (),
639                )),
640                Box_::into_raw(f),
641            )
642        }
643    }
644
645    #[doc(alias = "title")]
646    fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
647        unsafe extern "C" fn notify_title_trampoline<P: IsA<SaveDelegate>, F: Fn(&P) + 'static>(
648            this: *mut ffi::PanelSaveDelegate,
649            _param_spec: glib::ffi::gpointer,
650            f: glib::ffi::gpointer,
651        ) {
652            let f: &F = &*(f as *const F);
653            f(SaveDelegate::from_glib_borrow(this).unsafe_cast_ref())
654        }
655        unsafe {
656            let f: Box_<F> = Box_::new(f);
657            connect_raw(
658                self.as_ptr() as *mut _,
659                c"notify::title".as_ptr() as *const _,
660                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
661                    notify_title_trampoline::<Self, F> as *const (),
662                )),
663                Box_::into_raw(f),
664            )
665        }
666    }
667}
668
669impl<O: IsA<SaveDelegate>> SaveDelegateExt for O {}