Add portable mode with removable media detection and scanning

This commit is contained in:
lashman
2026-02-28 00:16:52 +02:00
parent f2abfba753
commit 2108b0f3d8
8 changed files with 138 additions and 1 deletions

View File

@@ -149,7 +149,12 @@ pub fn build_priority_badge(record: &AppImageRecord) -> Option<gtk::Label> {
}
}
// 3. Wayland issue (not Native or Unknown)
// 3. Portable / removable media
if record.is_portable {
return Some(widgets::status_badge("Portable", "info"));
}
// 4. Wayland issue (not Native or Unknown)
if let Some(ref ws) = record.wayland_status {
let status = WaylandStatus::from_str(ws);
if status != WaylandStatus::Unknown && status != WaylandStatus::Native {

View File

@@ -1800,6 +1800,22 @@ fn build_storage_tab(
.build();
size_group.add(&appimage_row);
if record.is_portable {
let location_label = if let Some(ref mp) = record.mount_point {
format!("Portable ({})", mp)
} else {
"Portable (removable media)".to_string()
};
let location_row = adw::ActionRow::builder()
.title("Location")
.subtitle(&location_label)
.build();
let badge = widgets::status_badge("Portable", "info");
badge.set_valign(gtk::Align::Center);
location_row.add_suffix(&badge);
size_group.add(&location_row);
}
if !fp.paths.is_empty() {
let categories = [
("Configuration", fp.config_size),

View File

@@ -265,6 +265,17 @@ fn build_behavior_page(settings: &gio::Settings) -> adw::PreferencesPage {
});
automation_group.add(&auto_integrate_row);
let removable_row = adw::SwitchRow::builder()
.title(&i18n("Watch removable media"))
.subtitle(&i18n("Scan USB drives and other removable media for AppImages"))
.active(settings.boolean("watch-removable-media"))
.build();
let settings_rem = settings.clone();
removable_row.connect_active_notify(move |row| {
settings_rem.set_boolean("watch-removable-media", row.is_active()).ok();
});
automation_group.add(&removable_row);
page.add(&automation_group);
// Backup group