libsecret/auto/
collection.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, CollectionCreateFlags, CollectionFlags, Item, Service};
7use glib::{
8    prelude::*,
9    signal::{connect_raw, SignalHandlerId},
10    translate::*,
11};
12use std::{boxed::Box as Box_, pin::Pin};
13
14glib::wrapper! {
15    #[doc(alias = "SecretCollection")]
16    pub struct Collection(Object<ffi::SecretCollection, ffi::SecretCollectionClass>) @extends gio::DBusProxy, @implements gio::DBusInterface, gio::Initable;
17
18    match fn {
19        type_ => || ffi::secret_collection_get_type(),
20    }
21}
22
23impl Collection {
24    pub const NONE: Option<&'static Collection> = None;
25
26    #[doc(alias = "secret_collection_new_for_dbus_path_sync")]
27    #[doc(alias = "new_for_dbus_path_sync")]
28    pub fn for_dbus_path_sync(
29        service: Option<&impl IsA<Service>>,
30        collection_path: &str,
31        flags: CollectionFlags,
32        cancellable: Option<&impl IsA<gio::Cancellable>>,
33    ) -> Result<Collection, glib::Error> {
34        unsafe {
35            let mut error = std::ptr::null_mut();
36            let ret = ffi::secret_collection_new_for_dbus_path_sync(
37                service.map(|p| p.as_ref()).to_glib_none().0,
38                collection_path.to_glib_none().0,
39                flags.into_glib(),
40                cancellable.map(|p| p.as_ref()).to_glib_none().0,
41                &mut error,
42            );
43            if error.is_null() {
44                Ok(from_glib_full(ret))
45            } else {
46                Err(from_glib_full(error))
47            }
48        }
49    }
50
51    #[doc(alias = "secret_collection_create")]
52    pub fn create<P: FnOnce(Result<Collection, glib::Error>) + 'static>(
53        service: Option<&impl IsA<Service>>,
54        label: &str,
55        alias: Option<&str>,
56        flags: CollectionCreateFlags,
57        cancellable: Option<&impl IsA<gio::Cancellable>>,
58        callback: P,
59    ) {
60        let main_context = glib::MainContext::ref_thread_default();
61        let is_main_context_owner = main_context.is_owner();
62        let has_acquired_main_context = (!is_main_context_owner)
63            .then(|| main_context.acquire().ok())
64            .flatten();
65        assert!(
66            is_main_context_owner || has_acquired_main_context.is_some(),
67            "Async operations only allowed if the thread is owning the MainContext"
68        );
69
70        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> =
71            Box_::new(glib::thread_guard::ThreadGuard::new(callback));
72        unsafe extern "C" fn create_trampoline<
73            P: FnOnce(Result<Collection, glib::Error>) + 'static,
74        >(
75            _source_object: *mut glib::gobject_ffi::GObject,
76            res: *mut gio::ffi::GAsyncResult,
77            user_data: glib::ffi::gpointer,
78        ) {
79            let mut error = std::ptr::null_mut();
80            let ret = ffi::secret_collection_create_finish(res, &mut error);
81            let result = if error.is_null() {
82                Ok(from_glib_full(ret))
83            } else {
84                Err(from_glib_full(error))
85            };
86            let callback: Box_<glib::thread_guard::ThreadGuard<P>> =
87                Box_::from_raw(user_data as *mut _);
88            let callback: P = callback.into_inner();
89            callback(result);
90        }
91        let callback = create_trampoline::<P>;
92        unsafe {
93            ffi::secret_collection_create(
94                service.map(|p| p.as_ref()).to_glib_none().0,
95                label.to_glib_none().0,
96                alias.to_glib_none().0,
97                flags.into_glib(),
98                cancellable.map(|p| p.as_ref()).to_glib_none().0,
99                Some(callback),
100                Box_::into_raw(user_data) as *mut _,
101            );
102        }
103    }
104
105    pub fn create_future(
106        service: Option<&(impl IsA<Service> + Clone + 'static)>,
107        label: &str,
108        alias: Option<&str>,
109        flags: CollectionCreateFlags,
110    ) -> Pin<Box_<dyn std::future::Future<Output = Result<Collection, glib::Error>> + 'static>>
111    {
112        let service = service.map(ToOwned::to_owned);
113        let label = String::from(label);
114        let alias = alias.map(ToOwned::to_owned);
115        Box_::pin(gio::GioFuture::new(&(), move |_obj, cancellable, send| {
116            Self::create(
117                service.as_ref().map(::std::borrow::Borrow::borrow),
118                &label,
119                alias.as_ref().map(::std::borrow::Borrow::borrow),
120                flags,
121                Some(cancellable),
122                move |res| {
123                    send.resolve(res);
124                },
125            );
126        }))
127    }
128
129    #[doc(alias = "secret_collection_create_sync")]
130    pub fn create_sync(
131        service: Option<&impl IsA<Service>>,
132        label: &str,
133        alias: Option<&str>,
134        flags: CollectionCreateFlags,
135        cancellable: Option<&impl IsA<gio::Cancellable>>,
136    ) -> Result<Collection, glib::Error> {
137        unsafe {
138            let mut error = std::ptr::null_mut();
139            let ret = ffi::secret_collection_create_sync(
140                service.map(|p| p.as_ref()).to_glib_none().0,
141                label.to_glib_none().0,
142                alias.to_glib_none().0,
143                flags.into_glib(),
144                cancellable.map(|p| p.as_ref()).to_glib_none().0,
145                &mut error,
146            );
147            if error.is_null() {
148                Ok(from_glib_full(ret))
149            } else {
150                Err(from_glib_full(error))
151            }
152        }
153    }
154
155    #[doc(alias = "secret_collection_for_alias")]
156    pub fn for_alias<P: FnOnce(Result<Option<Collection>, glib::Error>) + 'static>(
157        service: Option<&impl IsA<Service>>,
158        alias: &str,
159        flags: CollectionFlags,
160        cancellable: Option<&impl IsA<gio::Cancellable>>,
161        callback: P,
162    ) {
163        let main_context = glib::MainContext::ref_thread_default();
164        let is_main_context_owner = main_context.is_owner();
165        let has_acquired_main_context = (!is_main_context_owner)
166            .then(|| main_context.acquire().ok())
167            .flatten();
168        assert!(
169            is_main_context_owner || has_acquired_main_context.is_some(),
170            "Async operations only allowed if the thread is owning the MainContext"
171        );
172
173        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> =
174            Box_::new(glib::thread_guard::ThreadGuard::new(callback));
175        unsafe extern "C" fn for_alias_trampoline<
176            P: FnOnce(Result<Option<Collection>, glib::Error>) + 'static,
177        >(
178            _source_object: *mut glib::gobject_ffi::GObject,
179            res: *mut gio::ffi::GAsyncResult,
180            user_data: glib::ffi::gpointer,
181        ) {
182            let mut error = std::ptr::null_mut();
183            let ret = ffi::secret_collection_for_alias_finish(res, &mut error);
184            let result = if error.is_null() {
185                Ok(from_glib_full(ret))
186            } else {
187                Err(from_glib_full(error))
188            };
189            let callback: Box_<glib::thread_guard::ThreadGuard<P>> =
190                Box_::from_raw(user_data as *mut _);
191            let callback: P = callback.into_inner();
192            callback(result);
193        }
194        let callback = for_alias_trampoline::<P>;
195        unsafe {
196            ffi::secret_collection_for_alias(
197                service.map(|p| p.as_ref()).to_glib_none().0,
198                alias.to_glib_none().0,
199                flags.into_glib(),
200                cancellable.map(|p| p.as_ref()).to_glib_none().0,
201                Some(callback),
202                Box_::into_raw(user_data) as *mut _,
203            );
204        }
205    }
206
207    pub fn for_alias_future(
208        service: Option<&(impl IsA<Service> + Clone + 'static)>,
209        alias: &str,
210        flags: CollectionFlags,
211    ) -> Pin<
212        Box_<dyn std::future::Future<Output = Result<Option<Collection>, glib::Error>> + 'static>,
213    > {
214        let service = service.map(ToOwned::to_owned);
215        let alias = String::from(alias);
216        Box_::pin(gio::GioFuture::new(&(), move |_obj, cancellable, send| {
217            Self::for_alias(
218                service.as_ref().map(::std::borrow::Borrow::borrow),
219                &alias,
220                flags,
221                Some(cancellable),
222                move |res| {
223                    send.resolve(res);
224                },
225            );
226        }))
227    }
228
229    #[doc(alias = "secret_collection_for_alias_sync")]
230    pub fn for_alias_sync(
231        service: Option<&impl IsA<Service>>,
232        alias: &str,
233        flags: CollectionFlags,
234        cancellable: Option<&impl IsA<gio::Cancellable>>,
235    ) -> Result<Option<Collection>, glib::Error> {
236        unsafe {
237            let mut error = std::ptr::null_mut();
238            let ret = ffi::secret_collection_for_alias_sync(
239                service.map(|p| p.as_ref()).to_glib_none().0,
240                alias.to_glib_none().0,
241                flags.into_glib(),
242                cancellable.map(|p| p.as_ref()).to_glib_none().0,
243                &mut error,
244            );
245            if error.is_null() {
246                Ok(from_glib_full(ret))
247            } else {
248                Err(from_glib_full(error))
249            }
250        }
251    }
252
253    #[doc(alias = "secret_collection_new_for_dbus_path")]
254    pub fn new_for_dbus_path<P: FnOnce(Result<Collection, glib::Error>) + 'static>(
255        service: Option<&impl IsA<Service>>,
256        collection_path: &str,
257        flags: CollectionFlags,
258        cancellable: Option<&impl IsA<gio::Cancellable>>,
259        callback: P,
260    ) {
261        let main_context = glib::MainContext::ref_thread_default();
262        let is_main_context_owner = main_context.is_owner();
263        let has_acquired_main_context = (!is_main_context_owner)
264            .then(|| main_context.acquire().ok())
265            .flatten();
266        assert!(
267            is_main_context_owner || has_acquired_main_context.is_some(),
268            "Async operations only allowed if the thread is owning the MainContext"
269        );
270
271        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> =
272            Box_::new(glib::thread_guard::ThreadGuard::new(callback));
273        unsafe extern "C" fn new_for_dbus_path_trampoline<
274            P: FnOnce(Result<Collection, glib::Error>) + 'static,
275        >(
276            _source_object: *mut glib::gobject_ffi::GObject,
277            res: *mut gio::ffi::GAsyncResult,
278            user_data: glib::ffi::gpointer,
279        ) {
280            let mut error = std::ptr::null_mut();
281            let ret = ffi::secret_collection_new_for_dbus_path_finish(res, &mut error);
282            let result = if error.is_null() {
283                Ok(from_glib_full(ret))
284            } else {
285                Err(from_glib_full(error))
286            };
287            let callback: Box_<glib::thread_guard::ThreadGuard<P>> =
288                Box_::from_raw(user_data as *mut _);
289            let callback: P = callback.into_inner();
290            callback(result);
291        }
292        let callback = new_for_dbus_path_trampoline::<P>;
293        unsafe {
294            ffi::secret_collection_new_for_dbus_path(
295                service.map(|p| p.as_ref()).to_glib_none().0,
296                collection_path.to_glib_none().0,
297                flags.into_glib(),
298                cancellable.map(|p| p.as_ref()).to_glib_none().0,
299                Some(callback),
300                Box_::into_raw(user_data) as *mut _,
301            );
302        }
303    }
304
305    pub fn new_for_dbus_path_future(
306        service: Option<&(impl IsA<Service> + Clone + 'static)>,
307        collection_path: &str,
308        flags: CollectionFlags,
309    ) -> Pin<Box_<dyn std::future::Future<Output = Result<Collection, glib::Error>> + 'static>>
310    {
311        let service = service.map(ToOwned::to_owned);
312        let collection_path = String::from(collection_path);
313        Box_::pin(gio::GioFuture::new(&(), move |_obj, cancellable, send| {
314            Self::new_for_dbus_path(
315                service.as_ref().map(::std::borrow::Borrow::borrow),
316                &collection_path,
317                flags,
318                Some(cancellable),
319                move |res| {
320                    send.resolve(res);
321                },
322            );
323        }))
324    }
325}
326
327mod sealed {
328    pub trait Sealed {}
329    impl<T: super::IsA<super::Collection>> Sealed for T {}
330}
331
332pub trait CollectionExt: IsA<Collection> + sealed::Sealed + 'static {
333    #[doc(alias = "secret_collection_delete")]
334    fn delete<P: FnOnce(Result<(), glib::Error>) + 'static>(
335        &self,
336        cancellable: Option<&impl IsA<gio::Cancellable>>,
337        callback: P,
338    ) {
339        let main_context = glib::MainContext::ref_thread_default();
340        let is_main_context_owner = main_context.is_owner();
341        let has_acquired_main_context = (!is_main_context_owner)
342            .then(|| main_context.acquire().ok())
343            .flatten();
344        assert!(
345            is_main_context_owner || has_acquired_main_context.is_some(),
346            "Async operations only allowed if the thread is owning the MainContext"
347        );
348
349        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> =
350            Box_::new(glib::thread_guard::ThreadGuard::new(callback));
351        unsafe extern "C" fn delete_trampoline<P: FnOnce(Result<(), glib::Error>) + 'static>(
352            _source_object: *mut glib::gobject_ffi::GObject,
353            res: *mut gio::ffi::GAsyncResult,
354            user_data: glib::ffi::gpointer,
355        ) {
356            let mut error = std::ptr::null_mut();
357            let _ = ffi::secret_collection_delete_finish(_source_object as *mut _, res, &mut error);
358            let result = if error.is_null() {
359                Ok(())
360            } else {
361                Err(from_glib_full(error))
362            };
363            let callback: Box_<glib::thread_guard::ThreadGuard<P>> =
364                Box_::from_raw(user_data as *mut _);
365            let callback: P = callback.into_inner();
366            callback(result);
367        }
368        let callback = delete_trampoline::<P>;
369        unsafe {
370            ffi::secret_collection_delete(
371                self.as_ref().to_glib_none().0,
372                cancellable.map(|p| p.as_ref()).to_glib_none().0,
373                Some(callback),
374                Box_::into_raw(user_data) as *mut _,
375            );
376        }
377    }
378
379    fn delete_future(
380        &self,
381    ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
382        Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| {
383            obj.delete(Some(cancellable), move |res| {
384                send.resolve(res);
385            });
386        }))
387    }
388
389    #[doc(alias = "secret_collection_delete_sync")]
390    fn delete_sync(
391        &self,
392        cancellable: Option<&impl IsA<gio::Cancellable>>,
393    ) -> Result<(), glib::Error> {
394        unsafe {
395            let mut error = std::ptr::null_mut();
396            let is_ok = ffi::secret_collection_delete_sync(
397                self.as_ref().to_glib_none().0,
398                cancellable.map(|p| p.as_ref()).to_glib_none().0,
399                &mut error,
400            );
401            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
402            if error.is_null() {
403                Ok(())
404            } else {
405                Err(from_glib_full(error))
406            }
407        }
408    }
409
410    #[doc(alias = "secret_collection_get_created")]
411    #[doc(alias = "get_created")]
412    fn created(&self) -> u64 {
413        unsafe { ffi::secret_collection_get_created(self.as_ref().to_glib_none().0) }
414    }
415
416    #[doc(alias = "secret_collection_get_flags")]
417    #[doc(alias = "get_flags")]
418    fn flags(&self) -> CollectionFlags {
419        unsafe {
420            from_glib(ffi::secret_collection_get_flags(
421                self.as_ref().to_glib_none().0,
422            ))
423        }
424    }
425
426    #[doc(alias = "secret_collection_get_items")]
427    #[doc(alias = "get_items")]
428    fn items(&self) -> Vec<Item> {
429        unsafe {
430            FromGlibPtrContainer::from_glib_full(ffi::secret_collection_get_items(
431                self.as_ref().to_glib_none().0,
432            ))
433        }
434    }
435
436    #[doc(alias = "secret_collection_get_label")]
437    #[doc(alias = "get_label")]
438    fn label(&self) -> glib::GString {
439        unsafe {
440            from_glib_full(ffi::secret_collection_get_label(
441                self.as_ref().to_glib_none().0,
442            ))
443        }
444    }
445
446    #[doc(alias = "secret_collection_get_locked")]
447    #[doc(alias = "get_locked")]
448    #[doc(alias = "locked")]
449    fn is_locked(&self) -> bool {
450        unsafe {
451            from_glib(ffi::secret_collection_get_locked(
452                self.as_ref().to_glib_none().0,
453            ))
454        }
455    }
456
457    #[doc(alias = "secret_collection_get_modified")]
458    #[doc(alias = "get_modified")]
459    fn modified(&self) -> u64 {
460        unsafe { ffi::secret_collection_get_modified(self.as_ref().to_glib_none().0) }
461    }
462
463    #[doc(alias = "secret_collection_get_service")]
464    #[doc(alias = "get_service")]
465    fn service(&self) -> Service {
466        unsafe {
467            from_glib_none(ffi::secret_collection_get_service(
468                self.as_ref().to_glib_none().0,
469            ))
470        }
471    }
472
473    #[doc(alias = "secret_collection_load_items")]
474    fn load_items<P: FnOnce(Result<(), glib::Error>) + 'static>(
475        &self,
476        cancellable: Option<&impl IsA<gio::Cancellable>>,
477        callback: P,
478    ) {
479        let main_context = glib::MainContext::ref_thread_default();
480        let is_main_context_owner = main_context.is_owner();
481        let has_acquired_main_context = (!is_main_context_owner)
482            .then(|| main_context.acquire().ok())
483            .flatten();
484        assert!(
485            is_main_context_owner || has_acquired_main_context.is_some(),
486            "Async operations only allowed if the thread is owning the MainContext"
487        );
488
489        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> =
490            Box_::new(glib::thread_guard::ThreadGuard::new(callback));
491        unsafe extern "C" fn load_items_trampoline<P: FnOnce(Result<(), glib::Error>) + 'static>(
492            _source_object: *mut glib::gobject_ffi::GObject,
493            res: *mut gio::ffi::GAsyncResult,
494            user_data: glib::ffi::gpointer,
495        ) {
496            let mut error = std::ptr::null_mut();
497            let _ =
498                ffi::secret_collection_load_items_finish(_source_object as *mut _, res, &mut error);
499            let result = if error.is_null() {
500                Ok(())
501            } else {
502                Err(from_glib_full(error))
503            };
504            let callback: Box_<glib::thread_guard::ThreadGuard<P>> =
505                Box_::from_raw(user_data as *mut _);
506            let callback: P = callback.into_inner();
507            callback(result);
508        }
509        let callback = load_items_trampoline::<P>;
510        unsafe {
511            ffi::secret_collection_load_items(
512                self.as_ref().to_glib_none().0,
513                cancellable.map(|p| p.as_ref()).to_glib_none().0,
514                Some(callback),
515                Box_::into_raw(user_data) as *mut _,
516            );
517        }
518    }
519
520    fn load_items_future(
521        &self,
522    ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
523        Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| {
524            obj.load_items(Some(cancellable), move |res| {
525                send.resolve(res);
526            });
527        }))
528    }
529
530    #[doc(alias = "secret_collection_load_items_sync")]
531    fn load_items_sync(
532        &self,
533        cancellable: Option<&impl IsA<gio::Cancellable>>,
534    ) -> Result<(), glib::Error> {
535        unsafe {
536            let mut error = std::ptr::null_mut();
537            let is_ok = ffi::secret_collection_load_items_sync(
538                self.as_ref().to_glib_none().0,
539                cancellable.map(|p| p.as_ref()).to_glib_none().0,
540                &mut error,
541            );
542            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
543            if error.is_null() {
544                Ok(())
545            } else {
546                Err(from_glib_full(error))
547            }
548        }
549    }
550
551    #[doc(alias = "secret_collection_refresh")]
552    fn refresh(&self) {
553        unsafe {
554            ffi::secret_collection_refresh(self.as_ref().to_glib_none().0);
555        }
556    }
557
558    #[doc(alias = "secret_collection_set_label")]
559    #[doc(alias = "label")]
560    fn set_label<P: FnOnce(Result<(), glib::Error>) + 'static>(
561        &self,
562        label: &str,
563        cancellable: Option<&impl IsA<gio::Cancellable>>,
564        callback: P,
565    ) {
566        let main_context = glib::MainContext::ref_thread_default();
567        let is_main_context_owner = main_context.is_owner();
568        let has_acquired_main_context = (!is_main_context_owner)
569            .then(|| main_context.acquire().ok())
570            .flatten();
571        assert!(
572            is_main_context_owner || has_acquired_main_context.is_some(),
573            "Async operations only allowed if the thread is owning the MainContext"
574        );
575
576        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> =
577            Box_::new(glib::thread_guard::ThreadGuard::new(callback));
578        unsafe extern "C" fn set_label_trampoline<P: FnOnce(Result<(), glib::Error>) + 'static>(
579            _source_object: *mut glib::gobject_ffi::GObject,
580            res: *mut gio::ffi::GAsyncResult,
581            user_data: glib::ffi::gpointer,
582        ) {
583            let mut error = std::ptr::null_mut();
584            let _ =
585                ffi::secret_collection_set_label_finish(_source_object as *mut _, res, &mut error);
586            let result = if error.is_null() {
587                Ok(())
588            } else {
589                Err(from_glib_full(error))
590            };
591            let callback: Box_<glib::thread_guard::ThreadGuard<P>> =
592                Box_::from_raw(user_data as *mut _);
593            let callback: P = callback.into_inner();
594            callback(result);
595        }
596        let callback = set_label_trampoline::<P>;
597        unsafe {
598            ffi::secret_collection_set_label(
599                self.as_ref().to_glib_none().0,
600                label.to_glib_none().0,
601                cancellable.map(|p| p.as_ref()).to_glib_none().0,
602                Some(callback),
603                Box_::into_raw(user_data) as *mut _,
604            );
605        }
606    }
607
608    fn set_label_future(
609        &self,
610        label: &str,
611    ) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
612        let label = String::from(label);
613        Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| {
614            obj.set_label(&label, Some(cancellable), move |res| {
615                send.resolve(res);
616            });
617        }))
618    }
619
620    #[doc(alias = "secret_collection_set_label_sync")]
621    fn set_label_sync(
622        &self,
623        label: &str,
624        cancellable: Option<&impl IsA<gio::Cancellable>>,
625    ) -> Result<(), glib::Error> {
626        unsafe {
627            let mut error = std::ptr::null_mut();
628            let is_ok = ffi::secret_collection_set_label_sync(
629                self.as_ref().to_glib_none().0,
630                label.to_glib_none().0,
631                cancellable.map(|p| p.as_ref()).to_glib_none().0,
632                &mut error,
633            );
634            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
635            if error.is_null() {
636                Ok(())
637            } else {
638                Err(from_glib_full(error))
639            }
640        }
641    }
642
643    fn set_created(&self, created: u64) {
644        ObjectExt::set_property(self.as_ref(), "created", created)
645    }
646
647    fn set_modified(&self, modified: u64) {
648        ObjectExt::set_property(self.as_ref(), "modified", modified)
649    }
650
651    #[doc(alias = "created")]
652    fn connect_created_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
653        unsafe extern "C" fn notify_created_trampoline<P: IsA<Collection>, F: Fn(&P) + 'static>(
654            this: *mut ffi::SecretCollection,
655            _param_spec: glib::ffi::gpointer,
656            f: glib::ffi::gpointer,
657        ) {
658            let f: &F = &*(f as *const F);
659            f(Collection::from_glib_borrow(this).unsafe_cast_ref())
660        }
661        unsafe {
662            let f: Box_<F> = Box_::new(f);
663            connect_raw(
664                self.as_ptr() as *mut _,
665                b"notify::created\0".as_ptr() as *const _,
666                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
667                    notify_created_trampoline::<Self, F> as *const (),
668                )),
669                Box_::into_raw(f),
670            )
671        }
672    }
673
674    #[doc(alias = "label")]
675    fn connect_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
676        unsafe extern "C" fn notify_label_trampoline<P: IsA<Collection>, F: Fn(&P) + 'static>(
677            this: *mut ffi::SecretCollection,
678            _param_spec: glib::ffi::gpointer,
679            f: glib::ffi::gpointer,
680        ) {
681            let f: &F = &*(f as *const F);
682            f(Collection::from_glib_borrow(this).unsafe_cast_ref())
683        }
684        unsafe {
685            let f: Box_<F> = Box_::new(f);
686            connect_raw(
687                self.as_ptr() as *mut _,
688                b"notify::label\0".as_ptr() as *const _,
689                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
690                    notify_label_trampoline::<Self, F> as *const (),
691                )),
692                Box_::into_raw(f),
693            )
694        }
695    }
696
697    #[doc(alias = "locked")]
698    fn connect_locked_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
699        unsafe extern "C" fn notify_locked_trampoline<P: IsA<Collection>, F: Fn(&P) + 'static>(
700            this: *mut ffi::SecretCollection,
701            _param_spec: glib::ffi::gpointer,
702            f: glib::ffi::gpointer,
703        ) {
704            let f: &F = &*(f as *const F);
705            f(Collection::from_glib_borrow(this).unsafe_cast_ref())
706        }
707        unsafe {
708            let f: Box_<F> = Box_::new(f);
709            connect_raw(
710                self.as_ptr() as *mut _,
711                b"notify::locked\0".as_ptr() as *const _,
712                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
713                    notify_locked_trampoline::<Self, F> as *const (),
714                )),
715                Box_::into_raw(f),
716            )
717        }
718    }
719
720    #[doc(alias = "modified")]
721    fn connect_modified_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
722        unsafe extern "C" fn notify_modified_trampoline<P: IsA<Collection>, F: Fn(&P) + 'static>(
723            this: *mut ffi::SecretCollection,
724            _param_spec: glib::ffi::gpointer,
725            f: glib::ffi::gpointer,
726        ) {
727            let f: &F = &*(f as *const F);
728            f(Collection::from_glib_borrow(this).unsafe_cast_ref())
729        }
730        unsafe {
731            let f: Box_<F> = Box_::new(f);
732            connect_raw(
733                self.as_ptr() as *mut _,
734                b"notify::modified\0".as_ptr() as *const _,
735                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
736                    notify_modified_trampoline::<Self, F> as *const (),
737                )),
738                Box_::into_raw(f),
739            )
740        }
741    }
742}
743
744impl<O: IsA<Collection>> CollectionExt for O {}