Skip to content

Commit

Permalink
feat: run update-desktop-database on updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanabx committed Apr 15, 2024
1 parent 19b9480 commit 8bf9f4d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::{
collections::{HashMap, HashSet},
fs::remove_file,
path::PathBuf,
process::Command,
};

use zbus::names::{OwnedUniqueName, UniqueName};
Expand All @@ -26,6 +27,9 @@ impl EntryCatalog {
.insert(name.clone(), (Vec::new(), Vec::new()));
}
self.owned_resources.get_mut(&name).unwrap().0.push(entry);
if self.change_handlers.is_empty() {
let _ = Command::new("update-desktop-database").spawn();
}
}

pub fn add_icon(&mut self, name: OwnedUniqueName, entry: IconEntry) {
Expand All @@ -34,6 +38,9 @@ impl EntryCatalog {
.insert(name.clone(), (Vec::new(), Vec::new()));
}
self.owned_resources.get_mut(&name).unwrap().1.push(entry);
if self.change_handlers.is_empty() {
let _ = Command::new("update-desktop-database").spawn();
}
}

pub fn remove_owner(&mut self, name: OwnedUniqueName) {
Expand All @@ -49,6 +56,9 @@ impl EntryCatalog {
}

self.owned_resources.remove(&name);
if self.change_handlers.is_empty() {
let _ = Command::new("update-desktop-database").spawn();
}
log::info!("Removed owner with name {:?}", name);
}
}
Expand Down

0 comments on commit 8bf9f4d

Please sign in to comment.