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
// 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, Installation};
use glib::{prelude::*, translate::*};
/// Returns the canonical name for the arch of the current machine.
///
/// # Returns
///
/// an arch string
#[doc(alias = "flatpak_get_default_arch")]
#[doc(alias = "get_default_arch")]
pub fn default_arch() -> Option<glib::GString> {
assert_initialized_main_thread!();
unsafe { from_glib_none(ffi::flatpak_get_default_arch()) }
}
/// Returns the canonical names for the arches that are supported (i.e. can run)
/// on the current machine, in order of priority (default is first).
///
/// # Returns
///
/// a zero terminated array of arch strings
#[doc(alias = "flatpak_get_supported_arches")]
#[doc(alias = "get_supported_arches")]
pub fn supported_arches() -> Vec<glib::GString> {
assert_initialized_main_thread!();
unsafe { FromGlibPtrContainer::from_glib_none(ffi::flatpak_get_supported_arches()) }
}
/// Lists the system installations according to the current configuration and current
/// availability (e.g. doesn't return a configured installation if not reachable).
/// ## `cancellable`
/// a [`gio::Cancellable`][crate::gio::Cancellable]
///
/// # Returns
///
/// a GPtrArray of
/// [`Installation`][crate::Installation] instances
#[doc(alias = "flatpak_get_system_installations")]
#[doc(alias = "get_system_installations")]
pub fn system_installations(
cancellable: Option<&impl IsA<gio::Cancellable>>,
) -> Result<Vec<Installation>, glib::Error> {
assert_initialized_main_thread!();
unsafe {
let mut error = std::ptr::null_mut();
let ret = ffi::flatpak_get_system_installations(
cancellable.map(|p| p.as_ref()).to_glib_none().0,
&mut error,
);
if error.is_null() {
Ok(FromGlibPtrContainer::from_glib_container(ret))
} else {
Err(from_glib_full(error))
}
}
}