mirror of
https://github.com/vlinkz/nix-software-center.git
synced 2024-09-11 21:37:38 +03:00
Fix installation indicators
This commit is contained in:
parent
469b78847b
commit
f355d40336
@ -313,7 +313,7 @@ impl Component for PkgModel {
|
||||
},
|
||||
}
|
||||
}
|
||||
} else if model.installeduserpkgs.contains(&model.pname) {
|
||||
} else if model.installeduserpkgs.contains(match model.userpkgtype { UserPkgs::Env => &model.pname, UserPkgs::Profile => &model.pkg }) {
|
||||
gtk::Box {
|
||||
set_halign: gtk::Align::End,
|
||||
set_valign: gtk::Align::Center,
|
||||
@ -1061,7 +1061,7 @@ impl Component for PkgModel {
|
||||
self.set_installeduserpkgs(pkgmodel.installeduserpkgs);
|
||||
self.set_installedsystempkgs(pkgmodel.installedsystempkgs);
|
||||
|
||||
if self.installedsystempkgs.contains(&self.pkg) && !self.installeduserpkgs.contains(&self.pname) {
|
||||
if self.installedsystempkgs.contains(&self.pkg) && !self.installeduserpkgs.contains(match self.userpkgtype { UserPkgs::Env => &self.pname, UserPkgs::Profile => &self.pkg }) {
|
||||
self.set_installtype(InstallType::System)
|
||||
} else {
|
||||
self.set_installtype(InstallType::User)
|
||||
@ -1069,7 +1069,7 @@ impl Component for PkgModel {
|
||||
|
||||
self.launchable = if let Some(l) = pkgmodel.launchable {
|
||||
Some(Launch::GtkApp(l))
|
||||
} else if self.installeduserpkgs.contains(&self.pname) {
|
||||
} else if self.installeduserpkgs.contains(match self.userpkgtype { UserPkgs::Env => &self.pname, UserPkgs::Profile => &self.pkg }) {
|
||||
if let Ok(o) = Command::new("command").arg("-v").arg(&self.pname).output() {
|
||||
if o.status.success() {
|
||||
Some(Launch::TerminalApp(self.pname.to_string()))
|
||||
@ -1346,7 +1346,10 @@ impl Component for PkgModel {
|
||||
InstallType::User => {
|
||||
match work.action {
|
||||
PkgAction::Install => {
|
||||
self.installeduserpkgs.insert(work.pname.clone());
|
||||
match self.userpkgtype {
|
||||
UserPkgs::Env => self.installeduserpkgs.insert(work.pname.to_string()),
|
||||
UserPkgs::Profile => self.installeduserpkgs.insert(work.pkg.to_string()),
|
||||
};
|
||||
if self.launchable.is_none() {
|
||||
if let Ok(o) = Command::new("command").arg("-v").arg(&self.pname).output() {
|
||||
if o.status.success() {
|
||||
@ -1356,7 +1359,10 @@ impl Component for PkgModel {
|
||||
}
|
||||
}
|
||||
PkgAction::Remove => {
|
||||
self.installeduserpkgs.remove(&work.pname);
|
||||
match self.userpkgtype {
|
||||
UserPkgs::Env => self.installeduserpkgs.remove(&work.pname),
|
||||
UserPkgs::Profile => self.installeduserpkgs.remove(&work.pkg),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -773,6 +773,7 @@ impl Component for AppModel {
|
||||
let installeduser = self.installeduserpkgs.clone();
|
||||
let installedsystem = self.installedsystempkgs.clone();
|
||||
let poolref = self.pkgdb.clone();
|
||||
let userpkgtype = self.userpkgtype.clone();
|
||||
sender.oneshot_command(async move {
|
||||
let mut pkgtiles = vec![];
|
||||
if let Ok(pool) = &SqlitePool::connect(&format!("sqlite://{}", poolref)).await {
|
||||
@ -791,7 +792,7 @@ impl Component for AppModel {
|
||||
} else {
|
||||
pname.0.to_string()
|
||||
},
|
||||
pname: pname.0,
|
||||
pname: pname.0.to_string(),
|
||||
icon: data
|
||||
.icon
|
||||
.as_ref()
|
||||
@ -803,7 +804,7 @@ impl Component for AppModel {
|
||||
.and_then(|x| x.get("C"))
|
||||
.map(|x| x.to_string())
|
||||
.unwrap_or_default(),
|
||||
installeduser: installeduser.contains_key(&pkg),
|
||||
installeduser: installeduser.contains_key(&match userpkgtype { UserPkgs::Env => pname.0, UserPkgs::Profile => pkg.to_string() }),
|
||||
installedsystem: installedsystem.contains(&pkg),
|
||||
})
|
||||
}
|
||||
@ -1837,11 +1838,10 @@ FROM pkgs JOIN meta ON (pkgs.attribute = meta.attribute) WHERE pkgs.attribute =
|
||||
debug!("Got recommended apps guard");
|
||||
for item in recommendedapps_guard.iter_mut() {
|
||||
debug!("Got item {}", item.pkg);
|
||||
item.installeduser = self.installeduserpkgs.contains_key(&item.pname);
|
||||
item.installedsystem = self.installedsystempkgs.contains(&item.pname);
|
||||
item.installeduser = self.installeduserpkgs.contains_key(match self.userpkgtype { UserPkgs::Env => &item.pname, UserPkgs::Profile => &item.pkg });
|
||||
item.installedsystem = self.installedsystempkgs.contains(&item.pkg);
|
||||
}
|
||||
if self.searching {
|
||||
// self.update_searching(|_| ());
|
||||
self.searchpage.emit(SearchPageMsg::UpdateInstalled(
|
||||
self.installeduserpkgs.keys().cloned().collect(),
|
||||
self.installedsystempkgs.clone(),
|
||||
|
Loading…
Reference in New Issue
Block a user