aboutsummaryrefslogtreecommitdiffstats
path: root/Rpmdrake/gui.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2010-03-03 22:22:49 +0000
committerThierry Vignaud <tv@mandriva.org>2010-03-03 22:22:49 +0000
commit0217140c1f22b97ae92b8901e7db1ac430bc682e (patch)
treef64ee2d6c6ed6021b42e67994396678c8c60014d /Rpmdrake/gui.pm
parent3a19a244df81ce481d38430c0013b29a7a017a66 (diff)
downloadrpmdrake-0217140c1f22b97ae92b8901e7db1ac430bc682e.tar
rpmdrake-0217140c1f22b97ae92b8901e7db1ac430bc682e.tar.gz
rpmdrake-0217140c1f22b97ae92b8901e7db1ac430bc682e.tar.bz2
rpmdrake-0217140c1f22b97ae92b8901e7db1ac430bc682e.tar.xz
rpmdrake-0217140c1f22b97ae92b8901e7db1ac430bc682e.zip
(get_main_text,get_string_from_keywords) explain what are official, backports ... packages
Diffstat (limited to 'Rpmdrake/gui.pm')
-rw-r--r--Rpmdrake/gui.pm42
1 files changed, 40 insertions, 2 deletions
diff --git a/Rpmdrake/gui.pm b/Rpmdrake/gui.pm
index 940a28cd..4898fe08 100644
--- a/Rpmdrake/gui.pm
+++ b/Rpmdrake/gui.pm
@@ -149,8 +149,45 @@ sub get_description {
)) };
}
+sub get_string_from_keywords {
+ my ($medium) = @_;
+ return if !$medium->{mediacfg};
+ my ($distribconf, $medium_name) = @{$medium->{mediacfg}};
+
+ return if !$distribconf;
+
+ my @media_types = split(':', $distribconf->getvalue($medium_name, 'media_type'));
+
+ my $unsupported = N("It is <b>not supported</b> by Mandriva.");
+ my $dangerous = N("It may <b>break</b> your system.");
+ my $s;
+ $s .= N("This package is not free software") . "\n" if member('non-free', @media_types);
+ if (member('backport', @media_types)) {
+ return join("\n",
+ N("This package contains a new version that was backported."),
+ $unsupported, $dangerous, $s);
+ } elsif (member('testing', @media_types)) {
+ return join("\n",
+ N("This package is a potential candidate for an update."),
+ $unsupported, $dangerous, $s);
+ } elsif (member('updates', @media_types)) {
+ return join("\n",
+ (member('official', @media_types) && member('official', @media_types) ?
+ N("This is an offical update which is supported by Mandriva.")
+ : N("This is an unoffical update which is <b>not supported</b>.")),
+ N("This package contains a new version that was backported."),
+ $unsupported, $s);
+ } else {
+ $s .= N("This is an official package supported by Mandriva") . "\n" if member('official', @media_types);
+ return $s;
+ }
+}
+
sub get_main_text {
- my ($name, $summary, $is_update, $update_descr) = @_;
+ my ($medium, $name, $summary, $is_update, $update_descr) = @_;
+
+ my $txt = get_string_from_keywords($medium);
+
ugtk2::markup_to_TextView_format(
# force align "name - summary" to the right with RTL languages (#33603):
if_(lang::text_direction_rtl(), "\x{200f}") .
@@ -158,6 +195,7 @@ sub get_main_text {
format_header(join(' - ', $name, $summary)) .
# workaround gtk+ bug where GtkTextView wronly limit embedded widget size to bigger line's width (#25533):
"\x{200b} \x{feff}" . ' ' x 120,
+ if_($txt, format_field(N("Notice: ")) . $txt) .
if_($is_update, # is it an update?
format_field(N("Importance: ")) . format_update_field($update_descr->{importance}),
format_field(N("Reason for update: ")) . format_update_field(rpm_description($update_descr->{pre})),
@@ -251,7 +289,7 @@ sub format_pkg_simplifiedinfo {
# discard update fields if not matching:
my $is_update = ($upkg->flag_upgrade && $update_descr && $update_descr->{pre});
my $summary = get_summary($key);
- my $s = get_main_text($name, $summary, $is_update, $update_descr);
+ my $s = get_main_text($raw_medium, $name, $summary, $is_update, $update_descr);
push @$s, get_advisory_link($update_descr) if $is_update;
push @$s, get_description($pkg, $update_descr);