Skip to main content

gstreamer_editing_services/auto/
asset.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5#![allow(deprecated)]
6
7use crate::{Extractable, MetaContainer, ffi};
8use glib::{
9    prelude::*,
10    signal::{SignalHandlerId, connect_raw},
11    translate::*,
12};
13use std::{boxed::Box as Box_, pin::Pin};
14
15glib::wrapper! {
16    /// data), GES_META_FORMATTER_EXTENSION));
17    ///  }
18    ///
19    ///  g_list_free (transition_assets);
20    ///
21    /// ]|
22    ///
23    /// ## ID
24    ///
25    /// Each asset is uniquely defined in the cache by its
26    /// [`extractable-type`][struct@crate::Asset#extractable-type] and [`id`][struct@crate::Asset#id]. Depending on the
27    /// [`extractable-type`][struct@crate::Asset#extractable-type], the [`id`][struct@crate::Asset#id] can be used to parametrise
28    /// the creation of the object upon extraction. By default, a class that
29    /// implements [`Extractable`][crate::Extractable] will only have a single associated asset,
30    /// with an [`id`][struct@crate::Asset#id] set to the type name of its objects. However, this
31    /// is overwritten by some implementations, which allow a class to have
32    /// multiple associated assets. For example, for [`TransitionClip`][crate::TransitionClip] the
33    /// [`id`][struct@crate::Asset#id] will be a nickname of the [`vtype`][struct@crate::TransitionClip#vtype]. You
34    /// should check the documentation for each extractable type to see if they
35    /// differ from the default.
36    ///
37    /// Moreover, each [`extractable-type`][struct@crate::Asset#extractable-type] may also associate itself
38    /// with a specific asset subclass. In such cases, when their asset is
39    /// requested, an asset of this subclass will be returned instead.
40    ///
41    /// ## Managing
42    ///
43    /// You can use a [`Project`][crate::Project] to easily manage the assets of a
44    /// [`Timeline`][crate::Timeline].
45    ///
46    /// ## Proxies
47    ///
48    /// Some assets can (temporarily) act as the [`proxy`][struct@crate::Asset#proxy] of another
49    /// asset. When the original asset is requested from the cache, the proxy
50    /// will be returned in its place. This can be useful if, say, you want
51    /// to substitute a [`UriClipAsset`][crate::UriClipAsset] corresponding to a high resolution
52    /// media file with the asset of a lower resolution stand in.
53    ///
54    /// An asset may even have several proxies, the first of which will act as
55    /// its default and be returned on requests, but the others will be ordered
56    /// to take its place once it is removed. You can add a proxy to an asset,
57    /// or set its default, using [`AssetExt::set_proxy()`][crate::prelude::AssetExt::set_proxy()], and you can remove
58    /// them with [`AssetExt::unproxy()`][crate::prelude::AssetExt::unproxy()].
59    ///
60    /// ## Properties
61    ///
62    ///
63    /// #### `extractable-type`
64    ///  The [`Extractable`][crate::Extractable] object type that can be extracted from the asset.
65    ///
66    /// Readable | Writable | Construct Only
67    ///
68    ///
69    /// #### `id`
70    ///  The ID of the asset. This should be unique amongst all assets with
71    /// the same [`extractable-type`][struct@crate::Asset#extractable-type]. Depending on the associated
72    /// [`Extractable`][crate::Extractable] implementation, this id may convey some information
73    /// about the [`glib::Object`][crate::glib::Object] that should be extracted. Note that, as such, the
74    /// ID will have an expected format, and you can not choose this value
75    /// arbitrarily. By default, this will be set to the type name of the
76    /// [`extractable-type`][struct@crate::Asset#extractable-type], but you should check the documentation
77    /// of the extractable type to see whether they differ from the
78    /// default behaviour.
79    ///
80    /// Readable | Writable | Construct Only
81    ///
82    ///
83    /// #### `proxy`
84    ///  The default proxy for this asset, or [`None`] if it has no proxy. A
85    /// proxy will act as a substitute for the original asset when the
86    /// original is requested (see [`Asset::request_with_type()`][crate::Asset::request_with_type()]).
87    ///
88    /// Setting this property will not usually remove the existing proxy, but
89    /// will replace it as the default (see [`AssetExt::set_proxy()`][crate::prelude::AssetExt::set_proxy()]).
90    ///
91    /// Readable | Writable
92    ///
93    ///
94    /// #### `proxy-target`
95    ///  The asset that this asset is a proxy for, or [`None`] if it is not a
96    /// proxy for another asset.
97    ///
98    /// Note that even if this asset is acting as a proxy for another asset,
99    /// but this asset is not the default [`proxy`][struct@crate::Asset#proxy], then `proxy`-target
100    /// will *still* point to this other asset. So you should check the
101    /// [`proxy`][struct@crate::Asset#proxy] property of `target`-proxy before assuming it is the
102    /// current default proxy for the target.
103    ///
104    /// Note that the [`notify`][struct@crate::glib::Object#notify] for this property is emitted after
105    /// the [`proxy`][struct@crate::Asset#proxy] [`notify`][struct@crate::glib::Object#notify] for the corresponding (if any)
106    /// asset it is now the proxy of/no longer the proxy of.
107    ///
108    /// Readable
109    ///
110    /// # Implements
111    ///
112    /// [`AssetExt`][trait@crate::prelude::AssetExt], [`trait@glib::ObjectExt`], [`MetaContainerExt`][trait@crate::prelude::MetaContainerExt]
113    #[doc(alias = "GESAsset")]
114    pub struct Asset(Object<ffi::GESAsset, ffi::GESAssetClass>) @implements MetaContainer;
115
116    match fn {
117        type_ => || ffi::ges_asset_get_type(),
118    }
119}
120
121impl Asset {
122    pub const NONE: Option<&'static Asset> = None;
123
124    /// Indicate that an existing [`Asset`][crate::Asset] in the cache should be reloaded
125    /// upon the next request. This can be used when some condition has
126    /// changed, which may require that an existing asset should be updated.
127    /// For example, if an external resource has changed or now become
128    /// available.
129    ///
130    /// Note, the asset is not immediately changed, but will only actually
131    /// reload on the next call to [`request_with_type()`][Self::request_with_type()] or
132    /// [`request_async_with_type()`][Self::request_async_with_type()].
133    /// ## `extractable_type`
134    /// The [`extractable-type`][struct@crate::Asset#extractable-type] of the asset that
135    /// needs reloading
136    /// ## `id`
137    /// The [`id`][struct@crate::Asset#id] of the asset asset that needs
138    /// reloading
139    ///
140    /// # Returns
141    ///
142    /// [`true`] if the specified asset exists in the cache and could be
143    /// marked for reloading.
144    #[doc(alias = "ges_asset_needs_reload")]
145    #[doc(alias = "needs_reload")]
146    pub fn needs_reload_with_type(extractable_type: glib::types::Type, id: Option<&str>) -> bool {
147        assert_initialized_main_thread!();
148        unsafe {
149            from_glib(ffi::ges_asset_needs_reload(
150                extractable_type.into_glib(),
151                id.to_glib_none().0,
152            ))
153        }
154    }
155
156    /// Returns an asset with the given properties. If such an asset already
157    /// exists in the cache (it has been previously created in GES), then a
158    /// reference to the existing asset is returned. Otherwise, a newly created
159    /// asset is returned, and also added to the cache.
160    ///
161    /// If the requested asset has been loaded with an error, then `error` is
162    /// set, if given, and [`None`] will be returned instead.
163    ///
164    /// Note that the given `id` may not be exactly the [`id`][struct@crate::Asset#id] that is
165    /// set on the returned asset. For instance, it may be adjusted into a
166    /// standard format. Or, if a [`Extractable`][crate::Extractable] type does not have its
167    /// extraction parametrised, as is the case by default, then the given `id`
168    /// may be ignored entirely and the [`id`][struct@crate::Asset#id] set to some standard, in
169    /// which case a [`None`] `id` can be given.
170    ///
171    /// Similarly, the given `extractable_type` may not be exactly the
172    /// [`extractable-type`][struct@crate::Asset#extractable-type] that is set on the returned asset. Instead,
173    /// the actual extractable type may correspond to a subclass of the given
174    /// `extractable_type`, depending on the given `id`.
175    ///
176    /// Moreover, depending on the given `extractable_type`, the returned asset
177    /// may belong to a subclass of [`Asset`][crate::Asset].
178    ///
179    /// Finally, if the requested asset has a [`proxy`][struct@crate::Asset#proxy], then the proxy
180    /// that is found at the end of the chain of proxies is returned (a proxy's
181    /// proxy will take its place, and so on, unless it has no proxy).
182    ///
183    /// Some asset subclasses only support asynchronous construction of its
184    /// assets, such as [`UriClip`][crate::UriClip]. For such assets this method will fail, and
185    /// you should use [`request_async_with_type()`][Self::request_async_with_type()] instead. In the case of
186    /// [`UriClip`][crate::UriClip], you can use [`UriClipAsset::request_sync()`][crate::UriClipAsset::request_sync()] if you only
187    /// want to wait for the request to finish.
188    /// ## `extractable_type`
189    /// The [`extractable-type`][struct@crate::Asset#extractable-type] of the asset
190    /// ## `id`
191    /// The [`id`][struct@crate::Asset#id] of the asset
192    ///
193    /// # Returns
194    ///
195    /// A reference to the requested
196    /// asset, or [`None`] if an error occurred.
197    #[doc(alias = "ges_asset_request")]
198    #[doc(alias = "request")]
199    pub fn request_with_type(
200        extractable_type: glib::types::Type,
201        id: Option<&str>,
202    ) -> Result<Option<Asset>, glib::Error> {
203        assert_initialized_main_thread!();
204        unsafe {
205            let mut error = std::ptr::null_mut();
206            let ret = ffi::ges_asset_request(
207                extractable_type.into_glib(),
208                id.to_glib_none().0,
209                &mut error,
210            );
211            if error.is_null() {
212                Ok(from_glib_full(ret))
213            } else {
214                Err(from_glib_full(error))
215            }
216        }
217    }
218
219    /// message);
220    ///  }
221    ///
222    ///  gst_object_unref (asset);
223    /// }
224    ///
225    /// // The request:
226    /// ges_asset_request_async (GES_TYPE_URI_CLIP, some_uri, NULL,
227    ///  (GAsyncReadyCallback) asset_loaded_cb, user_data);
228    /// ```text
229    ///
230    /// ## `extractable_type`
231    /// The [`extractable-type`][struct@crate::Asset#extractable-type] of the asset
232    /// ## `id`
233    /// The [`id`][struct@crate::Asset#id] of the asset
234    /// ## `cancellable`
235    /// An object to allow cancellation of the
236    /// asset request, or [`None`] to ignore
237    /// ## `callback`
238    /// A function to call when the initialization is finished
239    #[doc(alias = "ges_asset_request_async")]
240    #[doc(alias = "request_async")]
241    pub fn request_async_with_type<P: FnOnce(Result<Asset, glib::Error>) + 'static>(
242        extractable_type: glib::types::Type,
243        id: Option<&str>,
244        cancellable: Option<&impl IsA<gio::Cancellable>>,
245        callback: P,
246    ) {
247        assert_initialized_main_thread!();
248
249        let main_context = glib::MainContext::ref_thread_default();
250        let is_main_context_owner = main_context.is_owner();
251        let has_acquired_main_context = (!is_main_context_owner)
252            .then(|| main_context.acquire().ok())
253            .flatten();
254        assert!(
255            is_main_context_owner || has_acquired_main_context.is_some(),
256            "Async operations only allowed if the thread is owning the MainContext"
257        );
258
259        let user_data: Box_<glib::thread_guard::ThreadGuard<P>> =
260            Box_::new(glib::thread_guard::ThreadGuard::new(callback));
261        unsafe extern "C" fn request_async_with_type_trampoline<
262            P: FnOnce(Result<Asset, glib::Error>) + 'static,
263        >(
264            _source_object: *mut glib::gobject_ffi::GObject,
265            res: *mut gio::ffi::GAsyncResult,
266            user_data: glib::ffi::gpointer,
267        ) {
268            unsafe {
269                let mut error = std::ptr::null_mut();
270                let ret = ffi::ges_asset_request_finish(res, &mut error);
271                let result = if error.is_null() {
272                    Ok(from_glib_full(ret))
273                } else {
274                    Err(from_glib_full(error))
275                };
276                let callback: Box_<glib::thread_guard::ThreadGuard<P>> =
277                    Box_::from_raw(user_data as *mut _);
278                let callback: P = callback.into_inner();
279                callback(result);
280            }
281        }
282        let callback = request_async_with_type_trampoline::<P>;
283        unsafe {
284            ffi::ges_asset_request_async(
285                extractable_type.into_glib(),
286                id.to_glib_none().0,
287                cancellable.map(|p| p.as_ref()).to_glib_none().0,
288                Some(callback),
289                Box_::into_raw(user_data) as *mut _,
290            );
291        }
292    }
293
294    pub fn request_async_with_type_future(
295        extractable_type: glib::types::Type,
296        id: Option<&str>,
297    ) -> Pin<Box_<dyn std::future::Future<Output = Result<Asset, glib::Error>> + 'static>> {
298        skip_assert_initialized!();
299        let id = id.map(ToOwned::to_owned);
300        Box_::pin(gio::GioFuture::new(&(), move |_obj, cancellable, send| {
301            Self::request_async_with_type(
302                extractable_type,
303                id.as_ref().map(::std::borrow::Borrow::borrow),
304                Some(cancellable),
305                move |res| {
306                    send.resolve(res);
307                },
308            );
309        }))
310    }
311}
312
313unsafe impl Send for Asset {}
314unsafe impl Sync for Asset {}
315
316/// Trait containing all [`struct@Asset`] methods.
317///
318/// # Implementors
319///
320/// [`Asset`][struct@crate::Asset], [`ClipAsset`][struct@crate::ClipAsset], [`Project`][struct@crate::Project], [`TrackElementAsset`][struct@crate::TrackElementAsset]
321pub trait AssetExt: IsA<Asset> + 'static {
322    /// Extracts a new [`extractable-type`][struct@crate::Asset#extractable-type] object from the asset. The
323    /// [`id`][struct@crate::Asset#id] of the asset may determine the properties and state of the
324    /// newly created object.
325    ///
326    /// # Returns
327    ///
328    /// A newly created object, or [`None`] if an
329    /// error occurred.
330    #[doc(alias = "ges_asset_extract")]
331    fn extract(&self) -> Result<Extractable, glib::Error> {
332        unsafe {
333            let mut error = std::ptr::null_mut();
334            let ret = ffi::ges_asset_extract(self.as_ref().to_glib_none().0, &mut error);
335            if error.is_null() {
336                Ok(from_glib_none(ret))
337            } else {
338                Err(from_glib_full(error))
339            }
340        }
341    }
342
343    /// Retrieve the error that was set on the asset when it was loaded.
344    ///
345    /// # Deprecated since 1.30
346    ///
347    /// Use [`error_full()`][Self::error_full()] instead for MT-safety.
348    ///
349    /// # Returns
350    ///
351    /// The error set on `asset`, or
352    /// [`None`] if no error occurred when `asset` was loaded.
353    #[cfg_attr(feature = "v1_30", deprecated = "Since 1.30")]
354    #[allow(deprecated)]
355    #[doc(alias = "ges_asset_get_error")]
356    #[doc(alias = "get_error")]
357    fn error(&self) -> Option<glib::Error> {
358        unsafe { from_glib_none(ffi::ges_asset_get_error(self.as_ref().to_glib_none().0)) }
359    }
360
361    /// Retrieve the error that was set on the asset when it was loaded.
362    ///
363    /// # Returns
364    ///
365    /// A copy of the error set on `asset`,
366    /// or [`None`] if no error occurred when `asset` was loaded. Free with
367    /// `g_error_free()` when no longer needed.
368    #[cfg(feature = "v1_30")]
369    #[cfg_attr(docsrs, doc(cfg(feature = "v1_30")))]
370    #[doc(alias = "ges_asset_get_error_full")]
371    #[doc(alias = "get_error_full")]
372    fn error_full(&self) -> Option<glib::Error> {
373        unsafe {
374            from_glib_full(ffi::ges_asset_get_error_full(
375                self.as_ref().to_glib_none().0,
376            ))
377        }
378    }
379
380    /// Gets the [`extractable-type`][struct@crate::Asset#extractable-type] of the asset.
381    ///
382    /// # Returns
383    ///
384    /// The extractable type of `self`.
385    #[doc(alias = "ges_asset_get_extractable_type")]
386    #[doc(alias = "get_extractable_type")]
387    #[doc(alias = "extractable-type")]
388    fn extractable_type(&self) -> glib::types::Type {
389        unsafe {
390            from_glib(ffi::ges_asset_get_extractable_type(
391                self.as_ref().to_glib_none().0,
392            ))
393        }
394    }
395
396    /// Gets the [`id`][struct@crate::Asset#id] of the asset.
397    ///
398    /// # Returns
399    ///
400    /// The ID of `self`.
401    #[doc(alias = "ges_asset_get_id")]
402    #[doc(alias = "get_id")]
403    fn id(&self) -> glib::GString {
404        unsafe { from_glib_none(ffi::ges_asset_get_id(self.as_ref().to_glib_none().0)) }
405    }
406
407    /// Gets the default [`proxy`][struct@crate::Asset#proxy] of the asset.
408    ///
409    /// # Deprecated since 1.30
410    ///
411    /// Use [`proxy_full()`][Self::proxy_full()] instead for MT-safety.
412    ///
413    /// # Returns
414    ///
415    /// The default proxy of `self`.
416    #[cfg_attr(feature = "v1_30", deprecated = "Since 1.30")]
417    #[allow(deprecated)]
418    #[doc(alias = "ges_asset_get_proxy")]
419    #[doc(alias = "get_proxy")]
420    #[must_use]
421    fn proxy(&self) -> Option<Asset> {
422        unsafe { from_glib_none(ffi::ges_asset_get_proxy(self.as_ref().to_glib_none().0)) }
423    }
424
425    /// Gets the default [`proxy`][struct@crate::Asset#proxy] of the asset.
426    ///
427    /// # Returns
428    ///
429    /// The default proxy of `self`,
430    /// or [`None`] if `self` has no proxy.
431    #[cfg(feature = "v1_30")]
432    #[cfg_attr(docsrs, doc(cfg(feature = "v1_30")))]
433    #[doc(alias = "ges_asset_get_proxy_full")]
434    #[doc(alias = "get_proxy_full")]
435    #[must_use]
436    fn proxy_full(&self) -> Option<Asset> {
437        unsafe {
438            from_glib_full(ffi::ges_asset_get_proxy_full(
439                self.as_ref().to_glib_none().0,
440            ))
441        }
442    }
443
444    /// Gets the [`proxy-target`][struct@crate::Asset#proxy-target] of the asset.
445    ///
446    /// Note that the proxy target may have loaded with an error, so you should
447    /// call [`error()`][Self::error()] on the returned target.
448    ///
449    /// # Deprecated since 1.30
450    ///
451    /// Use [`proxy_target_full()`][Self::proxy_target_full()] instead for MT-safety.
452    ///
453    /// # Returns
454    ///
455    /// The asset that `self` is a proxy
456    /// of.
457    #[cfg_attr(feature = "v1_30", deprecated = "Since 1.30")]
458    #[allow(deprecated)]
459    #[doc(alias = "ges_asset_get_proxy_target")]
460    #[doc(alias = "get_proxy_target")]
461    #[doc(alias = "proxy-target")]
462    #[must_use]
463    fn proxy_target(&self) -> Option<Asset> {
464        unsafe {
465            from_glib_none(ffi::ges_asset_get_proxy_target(
466                self.as_ref().to_glib_none().0,
467            ))
468        }
469    }
470
471    /// Gets the [`proxy-target`][struct@crate::Asset#proxy-target] of the asset.
472    ///
473    /// Note that the proxy target may have loaded with an error, so you should
474    /// call [`error()`][Self::error()] on the returned target.
475    ///
476    /// # Returns
477    ///
478    /// The asset that `self` is a proxy
479    /// of, or [`None`] if `self` is not a proxy for another asset.
480    #[cfg(feature = "v1_30")]
481    #[cfg_attr(docsrs, doc(cfg(feature = "v1_30")))]
482    #[doc(alias = "ges_asset_get_proxy_target_full")]
483    #[doc(alias = "get_proxy_target_full")]
484    #[must_use]
485    fn proxy_target_full(&self) -> Option<Asset> {
486        unsafe {
487            from_glib_full(ffi::ges_asset_get_proxy_target_full(
488                self.as_ref().to_glib_none().0,
489            ))
490        }
491    }
492
493    /// Get all the proxies that the asset has. The first item of the list will
494    /// be the default [`proxy`][struct@crate::Asset#proxy]. The second will be the proxy that is
495    /// 'next in line' to be default, and so on.
496    ///
497    /// # Deprecated since 1.30
498    ///
499    /// Use [`list_proxies_full()`][Self::list_proxies_full()] instead for MT-safety.
500    ///
501    /// # Returns
502    ///
503    /// The list of proxies
504    /// that `self` has.
505    #[cfg_attr(feature = "v1_30", deprecated = "Since 1.30")]
506    #[allow(deprecated)]
507    #[doc(alias = "ges_asset_list_proxies")]
508    fn list_proxies(&self) -> Vec<Asset> {
509        unsafe {
510            FromGlibPtrContainer::from_glib_none(ffi::ges_asset_list_proxies(
511                self.as_ref().to_glib_none().0,
512            ))
513        }
514    }
515
516    /// Get all the proxies that the asset has. The first item of the list will
517    /// be the default [`proxy`][struct@crate::Asset#proxy]. The second will be the proxy that is
518    /// 'next in line' to be default, and so on.
519    ///
520    /// # Returns
521    ///
522    /// The list of proxies
523    /// that `self` has.
524    #[cfg(feature = "v1_30")]
525    #[cfg_attr(docsrs, doc(cfg(feature = "v1_30")))]
526    #[doc(alias = "ges_asset_list_proxies_full")]
527    fn list_proxies_full(&self) -> Vec<Asset> {
528        unsafe {
529            FromGlibPtrContainer::from_glib_full(ffi::ges_asset_list_proxies_full(
530                self.as_ref().to_glib_none().0,
531            ))
532        }
533    }
534
535    /// Sets the [`proxy`][struct@crate::Asset#proxy] for the asset.
536    ///
537    /// If `proxy` is among the existing proxies of the asset (see
538    /// [`list_proxies()`][Self::list_proxies()]) it will be moved to become the default
539    /// proxy. Otherwise, if `proxy` is not [`None`], it will be added to the list
540    /// of proxies, as the new default. The previous default proxy will become
541    /// 'next in line' for if the new one is removed, and so on. As such, this
542    /// will **not** actually remove the previous default proxy (use
543    /// [`unproxy()`][Self::unproxy()] for that).
544    ///
545    /// Note that an asset can only act as a proxy for one other asset.
546    ///
547    /// As a special case, if `proxy` is [`None`], then this method will actually
548    /// remove **all** proxies from the asset.
549    /// ## `proxy`
550    /// A new default proxy for `self`
551    ///
552    /// # Returns
553    ///
554    /// [`true`] if `proxy` was successfully set as the default for
555    /// `self`.
556    #[doc(alias = "ges_asset_set_proxy")]
557    #[doc(alias = "proxy")]
558    fn set_proxy(&self, proxy: Option<&impl IsA<Asset>>) -> Result<(), glib::error::BoolError> {
559        unsafe {
560            glib::result_from_gboolean!(
561                ffi::ges_asset_set_proxy(
562                    self.as_ref().to_glib_none().0,
563                    proxy.map(|p| p.as_ref()).to_glib_none().0
564                ),
565                "Failed to set proxy"
566            )
567        }
568    }
569
570    /// Removes the proxy from the available list of proxies for the asset. If
571    /// the given proxy is the default proxy of the list, then the next proxy
572    /// in the available list (see [`list_proxies()`][Self::list_proxies()]) will become the
573    /// default. If there are no other proxies, then the asset will no longer
574    /// have a default [`proxy`][struct@crate::Asset#proxy].
575    /// ## `proxy`
576    /// An existing proxy of `self`
577    ///
578    /// # Returns
579    ///
580    /// [`true`] if `proxy` was successfully removed from `self`'s proxy
581    /// list.
582    #[doc(alias = "ges_asset_unproxy")]
583    fn unproxy(&self, proxy: &impl IsA<Asset>) -> Result<(), glib::error::BoolError> {
584        unsafe {
585            glib::result_from_gboolean!(
586                ffi::ges_asset_unproxy(
587                    self.as_ref().to_glib_none().0,
588                    proxy.as_ref().to_glib_none().0
589                ),
590                "Failed to unproxy asset"
591            )
592        }
593    }
594
595    #[doc(alias = "proxy")]
596    fn connect_proxy_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
597        unsafe extern "C" fn notify_proxy_trampoline<
598            P: IsA<Asset>,
599            F: Fn(&P) + Send + Sync + 'static,
600        >(
601            this: *mut ffi::GESAsset,
602            _param_spec: glib::ffi::gpointer,
603            f: glib::ffi::gpointer,
604        ) {
605            unsafe {
606                let f: &F = &*(f as *const F);
607                f(Asset::from_glib_borrow(this).unsafe_cast_ref())
608            }
609        }
610        unsafe {
611            let f: Box_<F> = Box_::new(f);
612            connect_raw(
613                self.as_ptr() as *mut _,
614                c"notify::proxy".as_ptr(),
615                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
616                    notify_proxy_trampoline::<Self, F> as *const (),
617                )),
618                Box_::into_raw(f),
619            )
620        }
621    }
622
623    #[doc(alias = "proxy-target")]
624    fn connect_proxy_target_notify<F: Fn(&Self) + Send + Sync + 'static>(
625        &self,
626        f: F,
627    ) -> SignalHandlerId {
628        unsafe extern "C" fn notify_proxy_target_trampoline<
629            P: IsA<Asset>,
630            F: Fn(&P) + Send + Sync + 'static,
631        >(
632            this: *mut ffi::GESAsset,
633            _param_spec: glib::ffi::gpointer,
634            f: glib::ffi::gpointer,
635        ) {
636            unsafe {
637                let f: &F = &*(f as *const F);
638                f(Asset::from_glib_borrow(this).unsafe_cast_ref())
639            }
640        }
641        unsafe {
642            let f: Box_<F> = Box_::new(f);
643            connect_raw(
644                self.as_ptr() as *mut _,
645                c"notify::proxy-target".as_ptr(),
646                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
647                    notify_proxy_target_trampoline::<Self, F> as *const (),
648                )),
649                Box_::into_raw(f),
650            )
651        }
652    }
653}
654
655impl<O: IsA<Asset>> AssetExt for O {}