### Get Installation Priority Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/auto/installation.rs.html?search= Retrieves the configured priority value for the installation. ```rust /// # Returns /// /// an integer with the configured priority value #[doc(alias = "flatpak_installation_get_priority")] #[doc(alias = "get_priority")] fn priority(&self) -> i32 { unsafe { ffi::flatpak_installation_get_priority(self.as_ref().to_glib_none().0) } } ``` -------------------------------- ### Option::map Example Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/installation.rs.html?search=u32+-%3E+bool Demonstrates how to use the `map` method on an `Option` to transform its value. ```rust let five = Some(5); let six = five.map(|n| n + 1); let none: Option = None; let none_six = none.map(|n| n + 1); ``` -------------------------------- ### FlatpakInstallation Functions Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak_sys/lib.rs.html?search= This snippet shows various function signatures related to managing Flatpak installations, including getting information, installing, and launching applications. ```rust pub fn flatpak_installation_get_default_locales( self_: *mut FlatpakInstallation, error: *mut *mut glib::GError, ) -> *mut *mut c_char; #[cfg(feature = "v0_8")] #[cfg_attr(docsrs, doc(cfg(feature = "v0_8")))] pub fn flatpak_installation_get_display_name(self_: *mut FlatpakInstallation) -> *const c_char; #[cfg(feature = "v0_8")] #[cfg_attr(docsrs, doc(cfg(feature = "v0_8")))] pub fn flatpak_installation_get_id(self_: *mut FlatpakInstallation) -> *const c_char; pub fn flatpak_installation_get_installed_ref( self_: *mut FlatpakInstallation, kind: FlatpakRefKind, name: *const c_char, arch: *const c_char, branch: *const c_char, cancellable: *mut gio::GCancellable, error: *mut *mut glib::GError, ) -> *mut FlatpakInstalledRef; pub fn flatpak_installation_get_is_user(self_: *mut FlatpakInstallation) -> gboolean; #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub fn flatpak_installation_get_min_free_space_bytes( self_: *mut FlatpakInstallation, out_bytes: *mut u64, error: *mut *mut glib::GError, ) -> gboolean; #[cfg(feature = "v1_1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1_1")))] pub fn flatpak_installation_get_no_interaction(self_: *mut FlatpakInstallation) -> gboolean; pub fn flatpak_installation_get_path(self_: *mut FlatpakInstallation) -> *mut gio::GFile; #[cfg(feature = "v0_8")] #[cfg_attr(docsrs, doc(cfg(feature = "v0_8")))] pub fn flatpak_installation_get_priority(self_: *mut FlatpakInstallation) -> c_int; pub fn flatpak_installation_get_remote_by_name( self_: *mut FlatpakInstallation, name: *const c_char, cancellable: *mut gio::GCancellable, error: *mut *mut glib::GError, ) -> *mut FlatpakRemote; #[cfg(feature = "v0_8")] #[cfg_attr(docsrs, doc(cfg(feature = "v0_8")))] pub fn flatpak_installation_get_storage_type( self_: *mut FlatpakInstallation, ) -> FlatpakStorageType; pub fn flatpak_installation_install( self_: *mut FlatpakInstallation, remote_name: *const c_char, kind: FlatpakRefKind, name: *const c_char, arch: *const c_char, branch: *const c_char, progress: FlatpakProgressCallback, progress_data: gpointer, cancellable: *mut gio::GCancellable, error: *mut *mut glib::GError, ) -> *mut FlatpakInstalledRef; pub fn flatpak_installation_install_bundle( self_: *mut FlatpakInstallation, file: *mut gio::GFile, progress: FlatpakProgressCallback, progress_data: gpointer, cancellable: *mut gio::GCancellable, error: *mut *mut glib::GError, ) -> *mut FlatpakInstalledRef; pub fn flatpak_installation_install_full( self_: *mut FlatpakInstallation, flags: FlatpakInstallFlags, remote_name: *const c_char, kind: FlatpakRefKind, name: *const c_char, arch: *const c_char, branch: *const c_char, subpaths: *const *const c_char, progress: FlatpakProgressCallback, progress_data: gpointer, cancellable: *mut gio::GCancellable, error: *mut *mut glib::GError, ) -> *mut FlatpakInstalledRef; #[cfg(feature = "v0_6_10")] #[cfg_attr(docsrs, doc(cfg(feature = "v0_6_10")))] pub fn flatpak_installation_install_ref_file( self_: *mut FlatpakInstallation, ref_file_data: *mut glib::GBytes, cancellable: *mut gio::GCancellable, error: *mut *mut glib::GError, ) -> *mut FlatpakRemoteRef; pub fn flatpak_installation_launch( self_: *mut FlatpakInstallation, name: *const c_char, arch: *const c_char, branch: *const c_char, commit: *const c_char, cancellable: *mut gio::GCancellable, error: *mut *mut glib::GError, ) -> gboolean; #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub fn flatpak_installation_launch_full( self_: *mut FlatpakInstallation, flags: FlatpakLaunchFlags, name: *const c_char, arch: *const c_char, branch: *const c_char, commit: *const c_char, instance_out: *mut *mut FlatpakInstance, cancellable: *mut gio::GCancellable, error: *mut *mut glib::GError, ) -> gboolean; pub fn flatpak_installation_list_installed_refs( self_: *mut FlatpakInstallation, cancellable: *mut gio::GCancellable, error: *mut *mut glib::GError, ) ``` -------------------------------- ### Launch Application Full Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/installation.rs.html This snippet demonstrates the `launch_full` function, which allows launching an installed application with detailed options and returns an `Instance` for managing the running process. ```Rust unsafe { let mut error = ptr::null_mut(); let mut instance = ptr::null_mut(); let _ = ffi::flatpak_installation_launch_full( self.as_ref().to_glib_none().0, flags.into_glib(), name.to_glib_none().0, arch.to_glib_none().0, branch.to_glib_none().0, commit.to_glib_none().0, &mut instance, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error, ); if error.is_null() { Ok(from_glib_none(instance)) } else { Err(from_glib_full(error)) } } ``` -------------------------------- ### Get installed size Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/auto/transaction_operation.rs.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Method to get the installed size for the operation. Available when the transaction is resolved. ```rust /// 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) } } ``` -------------------------------- ### Get Installed Size Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/auto/transaction_operation.rs.html?search= Method to get the installed size for the operation. Returns 0 for uninstall operations. ```rust impl TransactionOperation { // ... other methods /// 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) } } // ... other methods } ``` -------------------------------- ### Installation::new_system Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/auto/installation.rs.html?search= Creates a new `Installation` for the default system-wide installation. ```rust /// Creates a new [`Installation`][crate::Installation] for the default system-wide installation. /// ## `cancellable` /// a [`gio::Cancellable`][crate::gio::Cancellable] /// /// # Returns /// /// a new [`Installation`][crate::Installation] #[doc(alias = "flatpak_installation_new_system")] pub fn new_system( cancellable: Option<&impl IsA>, ) -> Result { assert_initialized_main_thread!(); unsafe { let mut error = std::ptr::null_mut(); let ret = ffi::flatpak_installation_new_system( cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error, ); if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } ``` -------------------------------- ### Get Installation Priority Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/auto/installation.rs.html?search=std%3A%3Avec Retrieves the configured priority value for the installation. ```rust 764 /// # Returns 765 /// 766 /// an integer with the configured priority value 767 #[doc(alias = "flatpak_installation_get_priority")] 768 #[doc(alias = "get_priority")] 769 fn priority(&self) -> i32 { 770 unsafe { ffi::flatpak_installation_get_priority(self.as_ref().to_glib_none().0) } 771 } ``` -------------------------------- ### Installation::new_user Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/auto/installation.rs.html?search= Creates a new `Installation` for the per-user installation. ```rust /// Creates a new [`Installation`][crate::Installation] for the per-user installation. /// ## `cancellable` /// a [`gio::Cancellable`][crate::gio::Cancellable] /// /// # Returns /// /// a new [`Installation`][crate::Installation] #[doc(alias = "flatpak_installation_new_user")] pub fn new_user( cancellable: Option<&impl IsA>, ) -> Result { assert_initialized_main_thread!(); unsafe { let mut error = std::ptr::null_mut(); let ret = ffi::flatpak_installation_new_user( ``` -------------------------------- ### Install a new application or runtime Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/installation.rs.html?search= This function installs a new application or runtime. It is deprecated and users should use `TransactionExt::add_install()` instead. It handles progress callbacks and cancellable operations. ```rust #[cfg_attr(feature = "v1_7", deprecated = "Since 1.7")] #[doc(alias = "flatpak_installation_install")] fn install( &self, remote_name: &str, kind: RefKind, name: &str, arch: Option<&str>, branch: Option<&str>, progress: Option<&mut dyn FnMut(&str, u32, bool)>, cancellable: Option<&impl IsA>, ) -> Result { let progress_data: Option<&mut dyn FnMut(&str, u32, bool)> = progress; unsafe extern "C" fn progress_func( status: *const libc::c_char, progress: libc::c_uint, estimating: glib::ffi::gboolean, user_data: glib::ffi::gpointer, ) { let status: Borrowed = from_glib_borrow(status); let estimating = from_glib(estimating); let callback: *mut Option<&mut dyn FnMut(&str, u32, bool)> = user_data as *const _ as usize as *mut Option<&mut dyn FnMut(&str, u32, bool)>; if let Some(ref mut callback) = *callback { callback(status.as_str(), progress, estimating) } else { panic!("cannot get closure...") }; } let progress = if progress_data.is_some() { Some(progress_func as _) } else { None }; let super_callback0: &Option<&mut dyn FnMut(&str, u32, bool)> = &progress_data; unsafe { let mut error = ptr::null_mut(); let ret = ffi::flatpak_installation_install( self.as_ref().to_glib_none().0, remote_name.to_glib_none().0, kind.into_glib(), name.to_glib_none().0, arch.to_glib_none().0, branch.to_glib_none().0, progress, super_callback0 as *const _ as usize as *mut _, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error, ); if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } ``` -------------------------------- ### installation Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/libflatpak/struct.Transaction.html Gets the installation this transaction was created for. ```rust fn installation(&self) -> Option ``` -------------------------------- ### installation Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/libflatpak/prelude/trait.TransactionExt.html?search=u32+-%3E+bool Gets the installation this transaction was created for. ```rust fn installation(&self) -> Option Gets the installation this transaction was created for. ##### §Returns a `Installation` Source ``` -------------------------------- ### list_remote_refs_sync_full Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/auto/installation.rs.html?search= Lists all the applications and runtimes in a remote. ```rust #[cfg(feature = "v1_3_3")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_3_3")))] #[doc(alias = "flatpak_installation_list_remote_refs_sync_full")] fn list_remote_refs_sync_full( &self, remote_or_uri: &str, flags: QueryFlags, cancellable: Option<&impl IsA>, ) -> Result, glib::Error> { unsafe { let mut error = std::ptr::null_mut(); let ret = ffi::flatpak_installation_list_remote_refs_sync_full( self.as_ref().to_glib_none().0, remote_or_uri.to_glib_none().0, flags.into_glib(), 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)) } } } ``` -------------------------------- ### Installation::new_user function Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/libflatpak/struct.Installation.html?search= Creates a new Installation for the per-user installation. ```rust pub fn new_user( cancellable: Option<&impl IsA>, ) -> Result ``` -------------------------------- ### Get Installation Priority Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/auto/installation.rs.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Retrieves the configured priority value for the Flatpak installation. ```rust 769 fn priority(&self) -> i32 { unsafe { ffi::flatpak_installation_get_priority(self.as_ref().to_glib_none().0) } } ``` -------------------------------- ### Installation::for_path function Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/libflatpak/struct.Installation.html?search= Creates a new Installation for a given path. ```rust pub fn for_path( path: &impl IsA, user: bool, cancellable: Option<&impl IsA>, ) -> Result ``` -------------------------------- ### installation Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/auto/transaction.rs.html Gets the installation this transaction was created for. ```rust #[doc(alias = "flatpak_transaction_get_installation")] #[doc(alias = "get_installation")] fn installation(&self) -> Option { unsafe { from_glib_full(ffi::flatpak_transaction_get_installation( self.as_ref().to_glib_none().0, )) } } ``` -------------------------------- ### Installation::for_path Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/auto/installation.rs.html?search= Creates a new `Installation` for the installation at the given path. ```rust impl Installation { pub const NONE: Option<&'static Installation> = None; /// Creates a new [`Installation`][crate::Installation] for the installation at the given `path`. /// ## `path` /// a [`gio::File`][crate::gio::File] /// ## `user` /// whether this is a user-specific location /// ## `cancellable` /// a [`gio::Cancellable`][crate::gio::Cancellable] /// /// # Returns /// /// a new [`Installation`][crate::Installation] #[doc(alias = "flatpak_installation_new_for_path")] #[doc(alias = "new_for_path")] pub fn for_path( path: &impl IsA, user: bool, cancellable: Option<&impl IsA>, ) -> Result { assert_initialized_main_thread!(); unsafe { let mut error = std::ptr::null_mut(); let ret = ffi::flatpak_installation_new_for_path( path.as_ref().to_glib_none().0, user.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error, ); if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } // ... other methods ``` -------------------------------- ### Get Transaction Installation Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/auto/transaction.rs.html?search= Retrieves the installation associated with this transaction. ```rust #[doc(alias = "flatpak_transaction_get_installation")] #[doc(alias = "get_installation")] fn installation(&self) -> Option { unsafe { from_glib_full(ffi::flatpak_transaction_get_installation( self.as_ref().to_glib_none().0, )) } } ``` -------------------------------- ### Get property type Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/libflatpak/struct.Installation.html Gets the type of the property `property_name` of this object. ```rust fn property_type(&self, property_name: &str) -> Option ``` -------------------------------- ### Parent instance initialization Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/libflatpak/struct.Installation.html Initializes the parent instance for subclassing. ```rust fn parent_instance_init(instance: &mut InitializingObject) where T: ObjectSubclass, ::Parent: IsSubclassable ``` -------------------------------- ### Get Installation Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/auto/transaction.rs.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Retrieves the installation associated with this transaction. ```rust fn installation(&self) -> Option { unsafe { from_glib_full(ffi::flatpak_transaction_get_installation( self.as_ref().to_glib_none().0, )) } } ``` -------------------------------- ### List all properties Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/libflatpak/struct.Installation.html Returns all `ParamSpec` of the properties of this object. ```rust fn list_properties(&self) -> PtrSlice ``` -------------------------------- ### config Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/auto/installation.rs.html Get a configuration value from the installation. ```rust #[doc(alias = "flatpak_installation_get_config")] #[doc(alias = "get_config")] fn config( &self, key: &str, cancellable: Option<&impl IsA>, ) -> Result { unsafe { let mut error = std::ptr::null_mut(); let ret = ffi::flatpak_installation_get_config( self.as_ref().to_glib_none().0, key.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error, ); if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } ``` -------------------------------- ### path Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/auto/installation.rs.html?search= Returns the installation location for self. ```rust fn path(&self) -> Option { unsafe { from_glib_full(ffi::flatpak_installation_get_path( self.as_ref().to_glib_none().0, )) } } ``` -------------------------------- ### FlatpakInstallation Installation and Launch Functions Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak_sys/lib.rs.html This snippet includes function signatures for installing and launching Flatpak applications, with options for bundles, full installations, and specific commits. ```rust pub fn flatpak_installation_install( self_: *mut FlatpakInstallation, remote_name: *const c_char, kind: FlatpakRefKind, name: *const c_char, arch: *const c_char, branch: *const c_char, progress: FlatpakProgressCallback, progress_data: gpointer, cancellable: *mut gio::GCancellable, error: *mut *mut glib::GError, ) -> *mut FlatpakInstalledRef; pub fn flatpak_installation_install_bundle( self_: *mut FlatpakInstallation, file: *mut gio::GFile, progress: FlatpakProgressCallback, progress_data: gpointer, cancellable: *mut gio::GCancellable, error: *mut *mut glib::GError, ) -> *mut FlatpakInstalledRef; pub fn flatpak_installation_install_full( self_: *mut FlatpakInstallation, flags: FlatpakInstallFlags, remote_name: *const c_char, kind: FlatpakRefKind, name: *const c_char, arch: *const c_char, branch: *const c_char, subpaths: *const *const c_char, progress: FlatpakProgressCallback, progress_data: gpointer, cancellable: *mut gio::GCancellable, error: *mut *mut glib::GError, ) -> *mut FlatpakInstalledRef; #[cfg(feature = "v0_6_10")] #[cfg_attr(docsrs, doc(cfg(feature = "v0_6_10")))] pub fn flatpak_installation_install_ref_file( self_: *mut FlatpakInstallation, ref_file_data: *mut glib::GBytes, cancellable: *mut gio::GCancellable, error: *mut *mut glib::GError, ) -> *mut FlatpakRemoteRef; pub fn flatpak_installation_launch( self_: *mut FlatpakInstallation, name: *const c_char, arch: *const c_char, branch: *const c_char, commit: *const c_char, cancellable: *mut gio::GCancellable, error: *mut *mut glib::GError, ) -> gboolean; #[cfg(feature = "v1_1")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))] pub fn flatpak_installation_launch_full( self_: *mut FlatpakInstallation, flags: FlatpakLaunchFlags, name: *const c_char, arch: *const c_char, branch: *const c_char, commit: *const c_char, instance_out: *mut *mut FlatpakInstance, cancellable: *mut gio::GCancellable, error: *mut *mut glib::GError, ) -> gboolean; pub fn flatpak_installation_list_installed_refs( self_: *mut FlatpakInstallation, cancellable: *mut gio::GCancellable, ``` -------------------------------- ### Get Storage Type Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/auto/installation.rs.html?search= Returns the type of storage used by the installation. ```rust /// Returns the type of storage of the installation for `self`. /// /// # Returns /// /// a [`StorageType`][crate::StorageType] #[doc(alias = "flatpak_installation_get_storage_type")] #[doc(alias = "get_storage_type")] fn storage_type(&self) -> StorageType { unsafe { from_glib(ffi::flatpak_installation_get_storage_type( self.as_ref().to_glib_none().0, )) } } ``` -------------------------------- ### current_installed_app Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/auto/installation.rs.html?search= Gets the last installed build of a reference application by name. ```rust fn current_installed_app( &self, name: &str, cancellable: Option<&impl IsA>, ) -> Result { unsafe { let mut error = std::ptr::null_mut(); let ret = ffi::flatpak_installation_get_current_installed_app( self.as_ref().to_glib_none().0, name.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error, ); if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } ``` -------------------------------- ### Installation::new_system_with_id Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/auto/installation.rs.html?search= Creates a new `Installation` for the system-wide installation with a specific ID. ```rust /// Creates a new [`Installation`][crate::Installation] for the system-wide installation `id`. /// ## `id` /// the ID of the system-wide installation /// ## `cancellable` /// a [`gio::Cancellable`][crate::gio::Cancellable] /// /// # Returns /// /// a new [`Installation`][crate::Installation] #[doc(alias = "flatpak_installation_new_system_with_id")] pub fn new_system_with_id( id: Option<&str>, cancellable: Option<&impl IsA>, ) -> Result { assert_initialized_main_thread!(); unsafe { let mut error = std::ptr::null_mut(); let ret = ffi::flatpak_installation_new_system_with_id( id.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error, ); if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } ``` -------------------------------- ### Installation::new_system function Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/libflatpak/struct.Installation.html?search= Creates a new Installation for the default system-wide installation. ```rust pub fn new_system( cancellable: Option<&impl IsA>, ) -> Result ``` -------------------------------- ### Get object property value Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/libflatpak/struct.Installation.html Gets the property `property_name` of the object as a `Value`. ```rust fn property_value(&self, property_name: &str) -> Value ``` -------------------------------- ### FlatpakBundleRef Get Installed Size Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak_sys/lib.rs.html?search=u32+-%3E+bool Retrieves the installed size of a FlatpakBundleRef. ```rust pub fn flatpak_bundle_ref_get_installed_size(self_: *mut FlatpakBundleRef) -> u64; ``` -------------------------------- ### Launch an application or runtime Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/auto/installation.rs.html?search= This function launches an application or runtime with optional parameters for architecture, branch, and commit. It returns a `Result` indicating success or a `glib::Error` on failure. ```rust fn launch( &self, name: &str, arch: Option<&str>, branch: Option<&str>, commit: Option<&str>, cancellable: Option<&impl IsA>, ) -> Result<(), glib::Error> { unsafe { let mut error = std::ptr::null_mut(); let is_ok = ffi::flatpak_installation_launch( self.as_ref().to_glib_none().0, name.to_glib_none().0, arch.to_glib_none().0, branch.to_glib_none().0, commit.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error, ); debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } ``` -------------------------------- ### Get Storage Type Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/auto/installation.rs.html?search=std%3A%3Avec Returns the type of storage used by the installation. ```rust 806 /// Returns the type of storage of the installation for `self`. 807 /// 808 /// # Returns 809 /// 810 /// a [`StorageType`][crate::StorageType] 811 #[doc(alias = "flatpak_installation_get_storage_type")] 812 #[doc(alias = "get_storage_type")] 813 fn storage_type(&self) -> StorageType { 814 unsafe { 815 from_glib(ffi::flatpak_installation_get_storage_type( 816 self.as_ref().to_glib_none().0, 817 )) 818 } 819 } ``` -------------------------------- ### Launch an installed application Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/libflatpak/struct.Installation.html This function launches an installed application with specified flags and optional parameters. ```rust fn launch_full( &self, flags: LaunchFlags, name: &str, arch: Option<&str>, branch: Option<&str>, commit: Option<&str>, cancellable: Option<&impl IsA>, ) -> Result ``` -------------------------------- ### Install Function Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/installation.rs.html The `install` function is used to install a new application or runtime. It is deprecated and recommends using `TransactionExt::add_install()` instead. It handles progress callbacks and cancellable operations. ```rust fn install( &self, remote_name: &str, kind: RefKind, name: &str, arch: Option<&str>, branch: Option<&str>, progress: Option<&mut dyn FnMut(&str, u32, bool)>, cancellable: Option<&impl IsA>, ) -> Result { let progress_data: Option<&mut dyn FnMut(&str, u32, bool)> = progress; unsafe extern "C" fn progress_func( status: *const libc::c_char, progress: libc::c_uint, estimating: glib::ffi::gboolean, user_data: glib::ffi::gpointer, ) { let status: Borrowed = from_glib_borrow(status); let estimating = from_glib(estimating); let callback: *mut Option<&mut dyn FnMut(&str, u32, bool)> = user_data as *const _ as usize as *mut Option<&mut dyn FnMut(&str, u32, bool)>; if let Some(ref mut callback) = *callback { callback(status.as_str(), progress, estimating) } else { panic!("cannot get closure...") }; } let progress = if progress_data.is_some() { Some(progress_func as _) } else { None }; let super_callback0: &Option<&mut dyn FnMut(&str, u32, bool)> = &progress_data; unsafe { let mut error = ptr::null_mut(); let ret = ffi::flatpak_installation_install( self.as_ref().to_glib_none().0, remote_name.to_glib_none().0, kind.into_glib(), name.to_glib_none().0, arch.to_glib_none().0, branch.to_glib_none().0, progress, super_callback0 as *const _ as usize as *mut _, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error, ); if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } ``` -------------------------------- ### Get object property Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/libflatpak/struct.Installation.html Gets the property `property_name` of the object and casts it to type `V`. ```rust fn property(&self, property_name: &str) -> V where V: for<'b> FromValue<'b> + 'static ``` -------------------------------- ### Get Remote by Name Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/auto/installation.rs.html?search=std%3A%3Avec Looks up a remote repository by its name within the installation. ```rust 773 /// Looks up a remote by name. 774 /// ## `name` 775 /// a remote name 776 /// ## `cancellable` 777 /// a [`gio::Cancellable`][crate::gio::Cancellable] 778 /// 779 /// # Returns 780 /// 781 /// a [`Remote`][crate::Remote] instance, or [`None`] with `error` 782 /// set 783 #[doc(alias = "flatpak_installation_get_remote_by_name")] 784 #[doc(alias = "get_remote_by_name")] 785 fn remote_by_name( 786 &self, 787 name: &str, 788 cancellable: Option<&impl IsA>, 789 ) -> Result { 790 unsafe { 791 let mut error = std::ptr::null_mut(); 792 let ret = ffi::flatpak_installation_get_remote_by_name( 793 self.as_ref().to_glib_none().0, 794 name.to_glib_none().0, 795 cancellable.map(|p| p.as_ref()).to_glib_none().0, 796 &mut error, 797 ); 798 if error.is_null() { 799 Ok(from_glib_full(ret)) 800 } else { 801 Err(from_glib_full(error)) 802 } 803 } 804 } ``` -------------------------------- ### Launch Full Function Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/installation.rs.html?search= This snippet shows the `launch_full` function for launching a flatpak application, returning an `Instance`. ```rust let mut error = ptr::null_mut(); let mut instance = ptr::null_mut(); let _ = ffi::flatpak_installation_launch_full( self.as_ref().to_glib_none().0, flags.into_glib(), name.to_glib_none().0, arch.to_glib_none().0, branch.to_glib_none().0, commit.to_glib_none().0, &mut instance, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error, ); if error.is_null() { Ok(from_glib_none(instance)) } else { Err(from_glib_full(error)) } ``` -------------------------------- ### Get Storage Type Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/auto/installation.rs.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Returns the type of storage used by the Flatpak installation. ```rust 813 fn storage_type(&self) -> StorageType { unsafe { from_glib(ffi::flatpak_installation_get_storage_type( self.as_ref().to_glib_none().0, )) } } ``` -------------------------------- ### Create File Monitor Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/auto/installation.rs.html?search= Creates a new `gio::FileMonitor` instance to watch for changes in the installation. Returns `None` on error. ```rust fn create_monitor( &self, cancellable: Option<&impl IsA>, ) -> Result { unsafe { let mut error = std::ptr::null_mut(); let ret = ffi::flatpak_installation_create_monitor( self.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error, ); if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } ``` -------------------------------- ### Launch Application Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/auto/installation.rs.html?search= Launches an installed application. Requires specifying the application name, and optionally architecture, branch, and commit. ```rust /// Launch an installed application. /// /// You can use `flatpak_installation_get_installed_ref()` or /// [`current_installed_app()`][Self::current_installed_app()] to find out what builds /// are available, in order to get a value for `commit`. /// ## `name` /// name of the app to launch /// ## `arch` /// which architecture to launch (default: current architecture) /// ## `branch` /// which branch of the application (default: "master") /// ## `commit` /// the commit of `branch` to launch /// ## `cancellable` /// a [`gio::Cancellable`][crate::gio::Cancellable] /// /// # Returns /// /// [`true`], unless an error occurred #[doc(alias = "flatpak_installation_launch")] fn launch( &self, name: &str, ``` -------------------------------- ### Example of unwrap Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/libflatpak_sys/type.FlatpakProgressCallback.html?search=u32+-%3E+bool This example shows the basic usage of the unwrap method to get the value from a Some variant. ```rust let x = Some("air"); assert_eq!(x.unwrap(), "air"); ``` -------------------------------- ### Installation Progress Callback Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/installation.rs.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E This snippet shows the structure of a callback function used for tracking installation progress. It receives status, progress, and an estimating flag. ```rust unsafe extern "C" fn progress_func( status: *mut glib::ffi::gchar, progress: u32, estimating: glib::ffi::gboolean, user_data: glib::ffi::gpointer, ) { let status: Borrowed = from_glib_borrow(status); let estimating = from_glib(estimating); let callback: *mut Option<&mut dyn FnMut(&str, u32, bool)> = user_data as *const _ as usize as *mut Option<&mut dyn FnMut(&str, u32, bool)>; if let Some(ref mut callback) = *callback { callback(status.as_str(), progress, estimating) } else { panic!("cannot get closure...") }; } ``` -------------------------------- ### current_installed_app Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/auto/installation.rs.html Get the last build of reference `name` that was installed with `InstallationExtManual::install()`, or `None` if the reference has never been installed locally. ```rust /// Get the last build of reference `name` that was installed with /// [`InstallationExtManual::install()`][crate::prelude::InstallationExtManual::install()], or [`None`] if the reference has /// never been installed locally. /// ## `name` /// the name of the app /// ## `cancellable` /// a [`gio::Cancellable`][crate::gio::Cancellable] /// /// # Returns /// /// an [`InstalledRef`][crate::InstalledRef] #[doc(alias = "flatpak_installation_get_current_installed_app")] #[doc(alias = "get_current_installed_app")] fn current_installed_app( &self, name: &str, cancellable: Option<&impl IsA>, ) -> Result { unsafe { let mut error = std::ptr::null_mut(); let ret = ffi::flatpak_installation_get_current_installed_app( self.as_ref().to_glib_none().0, name.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error, ); if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } ``` -------------------------------- ### flatpak_remote_ref_get_installed_size Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/libflatpak_sys/fn.flatpak_remote_ref_get_installed_size.html Gets the installed size of a FlatpakRemoteRef. ```rust pub unsafe extern "C" fn flatpak_remote_ref_get_installed_size( self_: *mut FlatpakRemoteRef, ) -> u64 ``` -------------------------------- ### Installation Function Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/installation.rs.html?search= This snippet demonstrates the `install_full` function for installing a flatpak, including progress callback handling. ```rust let progress = if progress_data.is_some() { Some(progress_func as _) } else { None }; let super_callback0: &Option<&mut dyn FnMut(&str, u32, bool)> = &progress_data; unsafe { let mut error = ptr::null_mut(); let ret = ffi::flatpak_installation_install_full( self.as_ref().to_glib_none().0, flags.into_glib(), remote_name.to_glib_none().0, kind.into_glib(), name.to_glib_none().0, arch.to_glib_none().0, branch.to_glib_none().0, subpaths.to_glib_none().0, progress, super_callback0 as *const _ as usize as *mut _, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error, ); if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } ``` -------------------------------- ### flatpak_installed_ref_get_subpaths Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/libflatpak_sys/fn.flatpak_installed_ref_get_subpaths.html Gets the subpaths of an installed ref. ```rust pub unsafe extern "C" fn flatpak_installed_ref_get_subpaths( self_: *mut FlatpakInstalledRef, ) -> *const *const c_char ``` -------------------------------- ### Installation::NONE constant Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/libflatpak/struct.Installation.html?search= A constant representing no Installation. ```rust pub const NONE: Option<&'static Installation> = None ``` -------------------------------- ### flatpak_installed_ref_get_origin Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/libflatpak_sys/fn.flatpak_installed_ref_get_origin.html Gets the origin of the installed ref. ```rust pub unsafe extern "C" fn flatpak_installed_ref_get_origin( self_: *mut FlatpakInstalledRef, ) -> *const c_char ``` -------------------------------- ### Create File Monitor Source: https://world.pages.gitlab.gnome.org/Rust/libflatpak-rs/stable/latest/docs/src/libflatpak/auto/installation.rs.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Creates a new `gio::FileMonitor` instance to watch for changes in the installation. Returns `None` on error. ```rust /// a new [`gio::FileMonitor`][crate::gio::FileMonitor] instance, or [`None`] on error #[doc(alias = "flatpak_installation_create_monitor")] fn create_monitor( &self, cancellable: Option<&impl IsA>, ) -> Result { unsafe { let mut error = std::ptr::null_mut(); let ret = ffi::flatpak_installation_create_monitor( self.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error, ); if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } ```