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
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use ges_sys;
use glib;
use glib::object::IsA;
use glib::translate::*;
use glib::GString;
use Asset;

glib_wrapper! {
    /// FIXME: Long description needed
    ///
    /// # Implements
    ///
    /// [`ExtractableExt`](trait.ExtractableExt.html), [`glib::object::ObjectExt`](../glib/object/trait.ObjectExt.html)
    pub struct Extractable(Interface<ges_sys::GESExtractable>);

    match fn {
        get_type => || ges_sys::ges_extractable_get_type(),
    }
}

pub const NONE_EXTRACTABLE: Option<&Extractable> = None;

/// Trait containing all `Extractable` methods.
///
/// # Implementors
///
/// [`BaseEffect`](struct.BaseEffect.html), [`Clip`](struct.Clip.html), [`Container`](struct.Container.html), [`Effect`](struct.Effect.html), [`Extractable`](struct.Extractable.html), [`Group`](struct.Group.html), [`Layer`](struct.Layer.html), [`TimelineElement`](struct.TimelineElement.html), [`Timeline`](struct.Timeline.html), [`TrackElement`](struct.TrackElement.html), [`UriClip`](struct.UriClip.html)
pub trait ExtractableExt: 'static {
    /// Method for getting an asset from a `Extractable`
    ///
    /// # Returns
    ///
    /// The `Asset` or `None` if none has
    /// been set
    fn get_asset(&self) -> Option<Asset>;

    ///
    /// # Returns
    ///
    /// The `id` of the associated `Asset`, free with `g_free`
    fn get_id(&self) -> Option<GString>;

    /// Method to set the asset which instantiated the specified object
    /// ## `asset`
    /// The `Asset` to set
    ///
    /// # Returns
    ///
    /// `true` if `asset` could be set `false` otherwize
    fn set_asset<P: IsA<Asset>>(&self, asset: &P) -> Result<(), glib::error::BoolError>;
}

impl<O: IsA<Extractable>> ExtractableExt for O {
    fn get_asset(&self) -> Option<Asset> {
        unsafe {
            from_glib_none(ges_sys::ges_extractable_get_asset(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_id(&self) -> Option<GString> {
        unsafe {
            from_glib_full(ges_sys::ges_extractable_get_id(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn set_asset<P: IsA<Asset>>(&self, asset: &P) -> Result<(), glib::error::BoolError> {
        unsafe {
            glib_result_from_gboolean!(
                ges_sys::ges_extractable_set_asset(
                    self.as_ref().to_glib_none().0,
                    asset.as_ref().to_glib_none().0
                ),
                "Failed to set asset"
            )
        }
    }
}