plat/linux_flatpak.rs (Linux)#
Source: lib/plat/linux_flatpak.rs
linux_flatpak -- (pkg.rs) the updates of a Flatpak app through org.freedesktop.portal.Flatpak
FlatpakMonitor::create() CreateUpdateMonitor({handle_token}) on the session bus; the
handle /org/freedesktop/portal/Flatpak/update_monitor/SENDER/TOKEN
is known before the call, so the signals are matched first
poll(ms) the newest UpdateAvailable({running-commit, local-commit,
remote-commit}) that arrived within ms
update(progress, cancel) Update("", {}) and its Progress signals ({n_ops, op, progress,
status: 0 running, 1 nothing to do, 2 done, 3 failed; error,
error_message}) until the end
drop Close()
spawn_latest(args) Spawn(cwd, argv, {}, {}, LATEST_VERSION, {}): the app's newest
installed version with the same program and these arguments
The portal (flatpak-portal, outside the sandbox) checks the app's remote every few minutes
(its --poll-timeout, 300 s by default) while a monitor exists; Update only installs a
version that asks for no more permissions than the running one.
struct FlatpakMonitorthe update monitor of this app (pkg::FlatpakMonitor)
impl FlatpakMonitor
fn create() -> Result<FlatpakMonitor, String>fn poll(&mut self, ms: i32) -> Option<FlatpakUpdate>the newest UpdateAvailable within ms (0: only what has arrived)fn update(&mut self, progress: &mut dyn FnMut(u32, u32, u32), cancel: &dyn Fn() -> bool) -> Result<(), String>install the update: progress(op, n_ops, percent) for every Progress signal, cancel() asked between them (the portal's transaction itself cannot be stopped: Err after it)