From 0217140c1f22b97ae92b8901e7db1ac430bc682e Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 3 Mar 2010 22:22:49 +0000 Subject: (get_main_text,get_string_from_keywords) explain what are official, backports ... packages --- NEWS | 1 + Rpmdrake/gui.pm | 42 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index f2afa266..24a3e16a 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,5 @@ - do not show file list if empty +- explain what are official, backports ... packages - edit-urpm-sources: o fix crashing when deleting media with UTF-8 characters (#57644) 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 not supported by Mandriva."); + my $dangerous = N("It may break 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 not supported.")), + 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); -- cgit v1.2.1