Clean up unused catalog function and wire source info into catalog view
This commit is contained in:
@@ -95,10 +95,20 @@ pub fn build_catalog_page(db: &Rc<Database>) -> adw::NavigationPage {
|
||||
stack.add_named(&scrolled, Some("results"));
|
||||
|
||||
// Show empty or results based on catalog data
|
||||
let sources = catalog::get_sources(db);
|
||||
let enabled_sources: Vec<_> = sources.iter().filter(|s| s.enabled).collect();
|
||||
let app_count = db.catalog_app_count().unwrap_or(0);
|
||||
if app_count > 0 {
|
||||
stack.set_visible_child_name("results");
|
||||
title.set_subtitle(&format!("{} apps available", app_count));
|
||||
if let Some(src) = enabled_sources.first() {
|
||||
let synced = src.last_synced.as_deref().unwrap_or("never");
|
||||
title.set_subtitle(&format!(
|
||||
"{} apps from {} ({}), synced: {}",
|
||||
src.app_count, src.name, src.source_type.as_str(), synced,
|
||||
));
|
||||
} else {
|
||||
title.set_subtitle(&format!("{} apps available", app_count));
|
||||
}
|
||||
} else {
|
||||
stack.set_visible_child_name("empty");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user