mod apply_plan;
mod config;
mod foreign_overlap;
mod modal_data;
mod pacman_conf;
pub use apply_plan::{
DEFAULT_DROPIN_PATH, DEFAULT_MAIN_PACMAN_PATH, MANAGED_DROPIN_FILE, PACMAN_MANAGED_BEGIN,
PACMAN_MANAGED_END, RepoApplyBundle, build_repo_apply_bundle, build_repo_key_refresh_bundle,
read_main_pacman_conf_text,
};
pub use config::{
RepoRow, ReposConfFile, build_dynamic_visibility, build_repo_name_to_filter_map,
canonical_results_filter_key, disable_repo_section_in_repos_conf_if_enabled,
load_repo_name_map_from_path, load_resolve_repos_from_str, repo_row_declares_apply_sources,
repos_conf_repo_names_for_index_sl, repos_conf_section_is_disabled_with_apply_sources,
row_is_enabled_for_repos_conf, save_repos_conf_file, toggle_repo_enabled_for_section_in_file,
};
pub use foreign_overlap::{
ForeignRepoOverlapAnalysis, ForeignRepoOverlapEntry, analyze_foreign_repo_overlap,
analyze_foreign_repo_overlap_with_qm_snapshot, build_foreign_to_sync_migrate_bundle,
compute_foreign_repo_overlap, list_foreign_packages, sync_repo_pkgnames,
};
pub use modal_data::{build_repositories_modal_fields, build_repositories_modal_fields_default};
pub use pacman_conf::{PacmanConfScan, PacmanRepoPresence, scan_pacman_conf_path};
use crate::state::AppState;
use crate::theme::Settings;
pub fn load_repos_config_into_app(app: &mut AppState, repos_path: Option<std::path::PathBuf>) {
let Some(path) = repos_path else {
app.repo_results_filter_by_name.clear();
return;
};
app.repo_results_filter_by_name = load_repo_name_map_from_path(&path);
}
pub fn refresh_dynamic_filters_in_app(app: &mut AppState, prefs: &Settings) {
app.results_filter_dynamic = build_dynamic_visibility(
&prefs.results_filter_toggles,
&app.repo_results_filter_by_name,
);
}
pub fn persist_dynamic_filter_toggle_and_refresh(
app: &mut AppState,
canonical_id: &str,
new_visible: bool,
) {
if !app.results_filter_dynamic.contains_key(canonical_id) {
return;
}
if let Some(v) = app.results_filter_dynamic.get_mut(canonical_id) {
*v = new_visible;
}
crate::theme::save_results_filter_show_canonical(canonical_id, new_visible);
crate::logic::apply_filters_and_sort_preserve_selection(app);
}
pub fn persist_dynamic_filters_set_all(app: &mut AppState, new_visible: bool) {
if app.results_filter_dynamic.is_empty() {
return;
}
let ids: Vec<String> = app.results_filter_dynamic.keys().cloned().collect();
for id in &ids {
if let Some(v) = app.results_filter_dynamic.get_mut(id) {
*v = new_visible;
}
crate::theme::save_results_filter_show_canonical(id, new_visible);
}
crate::logic::apply_filters_and_sort_preserve_selection(app);
}
#[must_use]
pub const fn repositories_linux_actions_supported() -> bool {
cfg!(target_os = "linux")
}