Add background update checks with configurable interval

Schedule automatic update checks on startup based on elapsed time
since last check. Add interval SpinRow to preferences and show
'Last checked' timestamp on the dashboard updates section.
This commit is contained in:
lashman
2026-02-27 23:52:28 +02:00
parent c50b61fc83
commit c311fb27c3
4 changed files with 89 additions and 0 deletions

View File

@@ -235,6 +235,25 @@ fn build_behavior_page(settings: &gio::Settings) -> adw::PreferencesPage {
});
automation_group.add(&auto_update_row);
let interval_row = adw::SpinRow::builder()
.title(&i18n("Update check interval"))
.subtitle(&i18n("Hours between automatic update checks"))
.build();
let interval_adj = gtk::Adjustment::new(
settings.int("update-check-interval-hours") as f64,
1.0,
168.0,
1.0,
6.0,
0.0,
);
interval_row.set_adjustment(Some(&interval_adj));
let settings_interval = settings.clone();
interval_row.connect_value_notify(move |row| {
settings_interval.set_int("update-check-interval-hours", row.value() as i32).ok();
});
automation_group.add(&interval_row);
let auto_integrate_row = adw::SwitchRow::builder()
.title(&i18n("Auto-integrate new AppImages"))
.subtitle(&i18n("Automatically add newly discovered AppImages to the desktop menu"))