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
// 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 glib;
use glib::translate::*;
use glib::GString;
use glib_sys;
use ostree_sys;
use std::fmt;
use BootconfigParser;
#[cfg(any(feature = "v2016_4", feature = "dox"))]
use DeploymentUnlockedState;

glib_wrapper! {
    pub struct Deployment(Object<ostree_sys::OstreeDeployment, DeploymentClass>);

    match fn {
        get_type => || ostree_sys::ostree_deployment_get_type(),
    }
}

impl Deployment {
    pub fn new(index: i32, osname: &str, csum: &str, deployserial: i32, bootcsum: Option<&str>, bootserial: i32) -> Deployment {
        unsafe {
            from_glib_full(ostree_sys::ostree_deployment_new(index, osname.to_glib_none().0, csum.to_glib_none().0, deployserial, bootcsum.to_glib_none().0, bootserial))
        }
    }

    pub fn clone(&self) -> Option<Deployment> {
        unsafe {
            from_glib_full(ostree_sys::ostree_deployment_clone(self.to_glib_none().0))
        }
    }

    pub fn equal(&self, bp: &Deployment) -> bool {
        unsafe {
            from_glib(ostree_sys::ostree_deployment_equal(ToGlibPtr::<*mut ostree_sys::OstreeDeployment>::to_glib_none(self).0 as glib_sys::gconstpointer, ToGlibPtr::<*mut ostree_sys::OstreeDeployment>::to_glib_none(bp).0 as glib_sys::gconstpointer))
        }
    }

    pub fn get_bootconfig(&self) -> Option<BootconfigParser> {
        unsafe {
            from_glib_none(ostree_sys::ostree_deployment_get_bootconfig(self.to_glib_none().0))
        }
    }

    pub fn get_bootcsum(&self) -> Option<GString> {
        unsafe {
            from_glib_none(ostree_sys::ostree_deployment_get_bootcsum(self.to_glib_none().0))
        }
    }

    pub fn get_bootserial(&self) -> i32 {
        unsafe {
            ostree_sys::ostree_deployment_get_bootserial(self.to_glib_none().0)
        }
    }

    pub fn get_csum(&self) -> Option<GString> {
        unsafe {
            from_glib_none(ostree_sys::ostree_deployment_get_csum(self.to_glib_none().0))
        }
    }

    pub fn get_deployserial(&self) -> i32 {
        unsafe {
            ostree_sys::ostree_deployment_get_deployserial(self.to_glib_none().0)
        }
    }

    pub fn get_index(&self) -> i32 {
        unsafe {
            ostree_sys::ostree_deployment_get_index(self.to_glib_none().0)
        }
    }

    pub fn get_origin(&self) -> Option<glib::KeyFile> {
        unsafe {
            from_glib_none(ostree_sys::ostree_deployment_get_origin(self.to_glib_none().0))
        }
    }

    pub fn get_origin_relpath(&self) -> Option<GString> {
        unsafe {
            from_glib_full(ostree_sys::ostree_deployment_get_origin_relpath(self.to_glib_none().0))
        }
    }

    pub fn get_osname(&self) -> Option<GString> {
        unsafe {
            from_glib_none(ostree_sys::ostree_deployment_get_osname(self.to_glib_none().0))
        }
    }

    #[cfg(any(feature = "v2016_4", feature = "dox"))]
    pub fn get_unlocked(&self) -> DeploymentUnlockedState {
        unsafe {
            from_glib(ostree_sys::ostree_deployment_get_unlocked(self.to_glib_none().0))
        }
    }

    pub fn hash(&self) -> u32 {
        unsafe {
            ostree_sys::ostree_deployment_hash(ToGlibPtr::<*mut ostree_sys::OstreeDeployment>::to_glib_none(self).0 as glib_sys::gconstpointer)
        }
    }

    #[cfg(any(feature = "v2018_3", feature = "dox"))]
    pub fn is_pinned(&self) -> bool {
        unsafe {
            from_glib(ostree_sys::ostree_deployment_is_pinned(self.to_glib_none().0))
        }
    }

    #[cfg(any(feature = "v2018_3", feature = "dox"))]
    pub fn is_staged(&self) -> bool {
        unsafe {
            from_glib(ostree_sys::ostree_deployment_is_staged(self.to_glib_none().0))
        }
    }

    pub fn set_bootconfig(&self, bootconfig: Option<&BootconfigParser>) {
        unsafe {
            ostree_sys::ostree_deployment_set_bootconfig(self.to_glib_none().0, bootconfig.to_glib_none().0);
        }
    }

    pub fn set_bootserial(&self, index: i32) {
        unsafe {
            ostree_sys::ostree_deployment_set_bootserial(self.to_glib_none().0, index);
        }
    }

    pub fn set_index(&self, index: i32) {
        unsafe {
            ostree_sys::ostree_deployment_set_index(self.to_glib_none().0, index);
        }
    }

    pub fn set_origin(&self, origin: Option<&glib::KeyFile>) {
        unsafe {
            ostree_sys::ostree_deployment_set_origin(self.to_glib_none().0, origin.to_glib_none().0);
        }
    }

    #[cfg(any(feature = "v2018_3", feature = "dox"))]
    pub fn origin_remove_transient_state(origin: &glib::KeyFile) {
        unsafe {
            ostree_sys::ostree_deployment_origin_remove_transient_state(origin.to_glib_none().0);
        }
    }

    #[cfg(any(feature = "v2016_4", feature = "dox"))]
    pub fn unlocked_state_to_string(state: DeploymentUnlockedState) -> Option<GString> {
        unsafe {
            from_glib_none(ostree_sys::ostree_deployment_unlocked_state_to_string(state.to_glib()))
        }
    }
}

impl fmt::Display for Deployment {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "Deployment")
    }
}