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 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files.git)
// DO NOT EDIT
use crate::{ffi, TransactionOperationType};
use glib::translate::*;
glib::wrapper! {
///
#[doc(alias = "FlatpakTransactionOperation")]
pub struct TransactionOperation(Object<ffi::FlatpakTransactionOperation, ffi::FlatpakTransactionOperationClass>);
match fn {
type_ => || ffi::flatpak_transaction_operation_get_type(),
}
}
impl TransactionOperation {
/// Gets the path to the bundle.
///
/// # Returns
///
/// the bundle [`gio::File`][crate::gio::File] or [`None`]
#[doc(alias = "flatpak_transaction_operation_get_bundle_path")]
#[doc(alias = "get_bundle_path")]
pub fn bundle_path(&self) -> Option<gio::File> {
unsafe {
from_glib_none(ffi::flatpak_transaction_operation_get_bundle_path(
self.to_glib_none().0,
))
}
}
/// Gets the commit ID for the operation.
///
/// This information is available when the transaction is resolved,
/// i.e. when [`ready`][struct@crate::Transaction#ready] is emitted.
///
/// # Returns
///
/// the commit ID
#[doc(alias = "flatpak_transaction_operation_get_commit")]
#[doc(alias = "get_commit")]
pub fn commit(&self) -> Option<glib::GString> {
unsafe {
from_glib_none(ffi::flatpak_transaction_operation_get_commit(
self.to_glib_none().0,
))
}
}
/// Gets the maximum download size for the operation.
///
/// Note that this does not include the size of dependencies, and
/// the actual download may be smaller, if some of the data is already
/// available locally.
///
/// For uninstall operations, this returns 0.
///
/// This information is available when the transaction is resolved,
/// i.e. when [`ready`][struct@crate::Transaction#ready] is emitted.
///
/// # Returns
///
/// the download size, in bytes
#[cfg(feature = "v1_1_2")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_1_2")))]
#[doc(alias = "flatpak_transaction_operation_get_download_size")]
#[doc(alias = "get_download_size")]
pub fn download_size(&self) -> u64 {
unsafe { ffi::flatpak_transaction_operation_get_download_size(self.to_glib_none().0) }
}
/// Gets the installed size for the operation.
///
/// Note that even for a new install, the extra space required on
/// disk may be smaller than this number, if some of the data is already
/// available locally.
///
/// For uninstall operations, this returns 0.
///
/// This information is available when the transaction is resolved,
/// i.e. when [`ready`][struct@crate::Transaction#ready] is emitted.
///
/// # Returns
///
/// the installed size, in bytes
#[cfg(feature = "v1_1_2")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_1_2")))]
#[doc(alias = "flatpak_transaction_operation_get_installed_size")]
#[doc(alias = "get_installed_size")]
pub fn installed_size(&self) -> u64 {
unsafe { ffi::flatpak_transaction_operation_get_installed_size(self.to_glib_none().0) }
}
/// Gets whether this operation will be skipped when the transaction is run.
/// Operations are skipped in some transaction situations, for example when an
/// app has reached end of life and needs a rebase, or when it would have been
/// updated but no update is available. By default, skipped
/// operations are not returned by [`TransactionExt::operations()`][crate::prelude::TransactionExt::operations()] — but
/// they can be accessed by traversing the operation graph using
/// [`related_to_ops()`][Self::related_to_ops()].
///
/// # Returns
///
/// [`true`] if the operation has been marked as to skip, [`false`] otherwise
#[cfg(feature = "v1_7_3")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_7_3")))]
#[doc(alias = "flatpak_transaction_operation_get_is_skipped")]
#[doc(alias = "get_is_skipped")]
pub fn is_skipped(&self) -> bool {
unsafe {
from_glib(ffi::flatpak_transaction_operation_get_is_skipped(
self.to_glib_none().0,
))
}
}
/// Gets the metadata that will be applicable when the
/// operation is done.
///
/// This can be compared to the current metadata returned
/// by [`old_metadata()`][Self::old_metadata()]
/// to find new required permissions and similar changes.
///
/// This information is available when the transaction is resolved,
/// i.e. when [`ready`][struct@crate::Transaction#ready] is emitted.
///
/// # Returns
///
/// the metadata [`glib::KeyFile`][crate::glib::KeyFile]
#[doc(alias = "flatpak_transaction_operation_get_metadata")]
#[doc(alias = "get_metadata")]
pub fn metadata(&self) -> Option<glib::KeyFile> {
unsafe {
from_glib_none(ffi::flatpak_transaction_operation_get_metadata(
self.to_glib_none().0,
))
}
}
/// Gets the metadata current metadata for the ref that `self` works on.
/// Also see [`metadata()`][Self::metadata()].
///
/// This information is available when the transaction is resolved,
/// i.e. when [`ready`][struct@crate::Transaction#ready] is emitted.
///
/// # Returns
///
/// the old metadata [`glib::KeyFile`][crate::glib::KeyFile]
#[doc(alias = "flatpak_transaction_operation_get_old_metadata")]
#[doc(alias = "get_old_metadata")]
pub fn old_metadata(&self) -> Option<glib::KeyFile> {
unsafe {
from_glib_none(ffi::flatpak_transaction_operation_get_old_metadata(
self.to_glib_none().0,
))
}
}
/// Gets the type of the operation.
///
/// # Returns
///
/// the type of operation, as [`TransactionOperationType`][crate::TransactionOperationType]
#[doc(alias = "flatpak_transaction_operation_get_operation_type")]
#[doc(alias = "get_operation_type")]
pub fn operation_type(&self) -> TransactionOperationType {
unsafe {
from_glib(ffi::flatpak_transaction_operation_get_operation_type(
self.to_glib_none().0,
))
}
}
#[doc(alias = "flatpak_transaction_operation_get_ref")]
pub fn get_ref(&self) -> Option<glib::GString> {
unsafe {
from_glib_none(ffi::flatpak_transaction_operation_get_ref(
self.to_glib_none().0,
))
}
}
/// Gets the operation(s) which caused this operation to be added to the
/// transaction. In the case of a runtime, it's the app(s) whose runtime it is,
/// and/or a runtime extension in the special case of an extra-data extension
/// that doesn't define the "NoRuntime" key. In the case of a related ref such
/// as an extension, it's the main app or runtime. In the case of a main app or
/// something added to the transaction by e.g. [`TransactionExt::add_install()`][crate::prelude::TransactionExt::add_install()]
/// and which is not otherwise needed, [`None`] or an empty array will be returned.
///
/// Note that an op will be returned even if it’s marked as to be skipped when
/// the transaction is run. Check that using
/// [`is_skipped()`][Self::is_skipped()].
///
/// Elements in the returned array are only safe to access while the parent
/// [`Transaction`][crate::Transaction] is alive.
///
/// # Returns
///
/// the
/// `FlatpakTransactionOperations` this one is related to (may be [`None`] or an
/// empty array, which are equivalent)
#[cfg(feature = "v1_7_3")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_7_3")))]
#[doc(alias = "flatpak_transaction_operation_get_related_to_ops")]
#[doc(alias = "get_related_to_ops")]
pub fn related_to_ops(&self) -> Vec<TransactionOperation> {
unsafe {
FromGlibPtrContainer::from_glib_none(
ffi::flatpak_transaction_operation_get_related_to_ops(self.to_glib_none().0),
)
}
}
/// Gets the remote that the operation applies to.
///
/// # Returns
///
/// the remote
#[doc(alias = "flatpak_transaction_operation_get_remote")]
#[doc(alias = "get_remote")]
pub fn remote(&self) -> Option<glib::GString> {
unsafe {
from_glib_none(ffi::flatpak_transaction_operation_get_remote(
self.to_glib_none().0,
))
}
}
/// Gets whether the given operation will require authentication to acquire
/// needed tokens. See also the documentation for
/// [`ready-pre-auth`][struct@crate::Transaction#ready-pre-auth].
///
/// # Returns
///
/// whether `self` requires authentication
#[cfg(feature = "v1_9_1")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_9_1")))]
#[doc(alias = "flatpak_transaction_operation_get_requires_authentication")]
#[doc(alias = "get_requires_authentication")]
pub fn requires_authentication(&self) -> bool {
unsafe {
from_glib(
ffi::flatpak_transaction_operation_get_requires_authentication(
self.to_glib_none().0,
),
)
}
}
/// Gets the set of subpaths that will be pulled from this ref.
///
/// Some refs are only partially installed, such as translations. These
/// are subset by the toplevel directory (typically by translation name).
/// The subset to install can be specified at install time, but is otherwise
/// decided based on configurations and things like the current locale and
/// how the app was previously installed.
///
/// If there is no subsetting active, this will always return [`None`]
/// (even though some other APIs also take an empty string to mean no
/// subsetting).
///
/// This information is available when the transaction is resolved,
/// i.e. when [`ready`][struct@crate::Transaction#ready] is emitted.
///
/// # Returns
///
/// the set of subpaths that will be pulled, or [`None`] if no subsetting.
#[cfg(feature = "v1_9_1")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_9_1")))]
#[doc(alias = "flatpak_transaction_operation_get_subpaths")]
#[doc(alias = "get_subpaths")]
pub fn subpaths(&self) -> Vec<glib::GString> {
unsafe {
FromGlibPtrContainer::from_glib_none(ffi::flatpak_transaction_operation_get_subpaths(
self.to_glib_none().0,
))
}
}
}