This commit is contained in:
guinux 2017-02-20 21:18:58 +01:00
parent deda8208ae
commit e9b8a03acf
3 changed files with 29 additions and 0 deletions

View File

@ -560,6 +560,19 @@ namespace Pamac {
return pkgs; return pkgs;
} }
public async AlpmPackage[] get_explicitly_installed_pkgs () {
AlpmPackage[] pkgs = {};
unowned Alpm.List<unowned Alpm.Package> pkgcache = alpm_handle.localdb.pkgcache;
while (pkgcache != null) {
unowned Alpm.Package alpm_pkg = pkgcache.data;
if (alpm_pkg.reason == Alpm.Package.Reason.EXPLICIT) {
pkgs += initialise_pkg_struct (alpm_pkg);
}
pkgcache.next ();
}
return pkgs;
}
public async AlpmPackage[] get_foreign_pkgs () { public async AlpmPackage[] get_foreign_pkgs () {
AlpmPackage[] pkgs = {}; AlpmPackage[] pkgs = {};
unowned Alpm.List<unowned Alpm.Package> pkgcache = alpm_handle.localdb.pkgcache; unowned Alpm.List<unowned Alpm.Package> pkgcache = alpm_handle.localdb.pkgcache;

View File

@ -383,6 +383,7 @@ namespace Pamac {
selection = states_treeview.get_selection (); selection = states_treeview.get_selection ();
selection.changed.disconnect (on_states_treeview_selection_changed); selection.changed.disconnect (on_states_treeview_selection_changed);
states_list.insert_with_values (null, -1, 0, dgettext (null, "Installed")); states_list.insert_with_values (null, -1, 0, dgettext (null, "Installed"));
states_list.insert_with_values (null, -1, 0, dgettext (null, "Explicitly installed"));
states_list.insert_with_values (null, -1, 0, dgettext (null, "Orphans")); states_list.insert_with_values (null, -1, 0, dgettext (null, "Orphans"));
states_list.insert_with_values (null, -1, 0, dgettext (null, "Foreign")); states_list.insert_with_values (null, -1, 0, dgettext (null, "Foreign"));
states_list.insert_with_values (null, -1, 0, dgettext (null, "Pending")); states_list.insert_with_values (null, -1, 0, dgettext (null, "Pending"));
@ -1414,6 +1415,10 @@ namespace Pamac {
transaction.get_installed_pkgs.begin ((obj, res) => { transaction.get_installed_pkgs.begin ((obj, res) => {
populate_packages_list (transaction.get_installed_pkgs.end (res)); populate_packages_list (transaction.get_installed_pkgs.end (res));
}); });
} else if (state == dgettext (null, "Explicitly installed")) {
transaction.get_explicitly_installed_pkgs.begin ((obj, res) => {
populate_packages_list (transaction.get_explicitly_installed_pkgs.end (res));
});
} else if (state == dgettext (null, "Orphans")) { } else if (state == dgettext (null, "Orphans")) {
transaction.get_orphans.begin ((obj, res) => { transaction.get_orphans.begin ((obj, res) => {
populate_packages_list (transaction.get_orphans.end (res)); populate_packages_list (transaction.get_orphans.end (res));

View File

@ -39,6 +39,7 @@ namespace Pamac {
public abstract uint get_pkg_reason (string pkgname) throws IOError; public abstract uint get_pkg_reason (string pkgname) throws IOError;
public abstract uint get_pkg_origin (string pkgname) throws IOError; public abstract uint get_pkg_origin (string pkgname) throws IOError;
public abstract async AlpmPackage[] get_installed_pkgs () throws IOError; public abstract async AlpmPackage[] get_installed_pkgs () throws IOError;
public abstract async AlpmPackage[] get_explicitly_installed_pkgs () throws IOError;
public abstract async AlpmPackage[] get_foreign_pkgs () throws IOError; public abstract async AlpmPackage[] get_foreign_pkgs () throws IOError;
public abstract async AlpmPackage[] get_orphans () throws IOError; public abstract async AlpmPackage[] get_orphans () throws IOError;
public abstract AlpmPackage find_installed_satisfier (string depstring) throws IOError; public abstract AlpmPackage find_installed_satisfier (string depstring) throws IOError;
@ -538,6 +539,16 @@ namespace Pamac {
return pkgs; return pkgs;
} }
public async AlpmPackage[] get_explicitly_installed_pkgs () {
AlpmPackage[] pkgs = {};
try {
pkgs = yield daemon.get_explicitly_installed_pkgs ();
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
}
return pkgs;
}
public async AlpmPackage[] get_foreign_pkgs () { public async AlpmPackage[] get_foreign_pkgs () {
AlpmPackage[] pkgs = {}; AlpmPackage[] pkgs = {};
try { try {