From e9b8a03acf9db327143a6f092e48103c07553473 Mon Sep 17 00:00:00 2001 From: guinux Date: Mon, 20 Feb 2017 21:18:58 +0100 Subject: [PATCH] fix #197 --- src/daemon.vala | 13 +++++++++++++ src/manager_window.vala | 5 +++++ src/transaction.vala | 11 +++++++++++ 3 files changed, 29 insertions(+) diff --git a/src/daemon.vala b/src/daemon.vala index 66dbda0..8e2a963 100644 --- a/src/daemon.vala +++ b/src/daemon.vala @@ -560,6 +560,19 @@ namespace Pamac { return pkgs; } + public async AlpmPackage[] get_explicitly_installed_pkgs () { + AlpmPackage[] pkgs = {}; + unowned Alpm.List 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 () { AlpmPackage[] pkgs = {}; unowned Alpm.List pkgcache = alpm_handle.localdb.pkgcache; diff --git a/src/manager_window.vala b/src/manager_window.vala index f1d82cf..507304f 100644 --- a/src/manager_window.vala +++ b/src/manager_window.vala @@ -383,6 +383,7 @@ namespace Pamac { selection = states_treeview.get_selection (); 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, "Explicitly installed")); 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, "Pending")); @@ -1414,6 +1415,10 @@ namespace Pamac { transaction.get_installed_pkgs.begin ((obj, 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")) { transaction.get_orphans.begin ((obj, res) => { populate_packages_list (transaction.get_orphans.end (res)); diff --git a/src/transaction.vala b/src/transaction.vala index 922faeb..62b16ed 100644 --- a/src/transaction.vala +++ b/src/transaction.vala @@ -39,6 +39,7 @@ namespace Pamac { public abstract uint get_pkg_reason (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_explicitly_installed_pkgs () throws IOError; public abstract async AlpmPackage[] get_foreign_pkgs () throws IOError; public abstract async AlpmPackage[] get_orphans () throws IOError; public abstract AlpmPackage find_installed_satisfier (string depstring) throws IOError; @@ -538,6 +539,16 @@ namespace Pamac { 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 () { AlpmPackage[] pkgs = {}; try {