aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-10-23 13:58:20 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-10-23 13:58:20 +0000
commit3fcd71f40c221bc8fe4ebedd6f66e50580365417 (patch)
tree9db397893abe9d5d18aace2eb92f93d9538e7a59
parent698a7cde76866270cc448e4dc3afe70d726c3c8f (diff)
downloadpaludis-3fcd71f40c221bc8fe4ebedd6f66e50580365417.tar.gz
paludis-3fcd71f40c221bc8fe4ebedd6f66e50580365417.tar.xz
Display mask reasons
-rw-r--r--src/gtkpaludis/package_overview.cc45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/gtkpaludis/package_overview.cc b/src/gtkpaludis/package_overview.cc
index 99c66ec..be00d8a 100644
--- a/src/gtkpaludis/package_overview.cc
+++ b/src/gtkpaludis/package_overview.cc
@@ -86,6 +86,46 @@ PackageOverview::~PackageOverview()
namespace
{
+ std::string mask_reasons_to_letters(const MaskReasons & masks)
+ {
+ std::string reasons;
+ for (MaskReason m(MaskReason(0)) ; m < last_mr ;
+ m = MaskReason(static_cast<int>(m) + 1))
+ {
+ if (! masks.test(m))
+ continue;
+
+ switch (m)
+ {
+ case mr_keyword:
+ reasons.append("K");
+ break;
+ case mr_user_mask:
+ reasons.append("U");
+ break;
+ case mr_profile_mask:
+ reasons.append("P");
+ break;
+ case mr_repository_mask:
+ reasons.append("R");
+ break;
+ case mr_eapi:
+ reasons.append("E");
+ break;
+ case mr_license:
+ reasons.append("L");
+ break;
+ case mr_by_association:
+ reasons.append("A");
+ break;
+ case last_mr:
+ break;
+ }
+ }
+
+ return reasons;
+ }
+
class Populate :
public PaludisThread::Launchable
{
@@ -149,6 +189,11 @@ namespace
if (! value.empty())
value.append(" ");
value.append(stringify(i->version));
+
+ std::string reasons(mask_reasons_to_letters(DefaultEnvironment::get_instance()->mask_reasons(*i)));
+ if (! reasons.empty())
+ value.append("(" + reasons + ")");
+
(*r->second)[_imp->columns.col_right] = value;
}
}