diff options
author | Thierry Vignaud <tv@mageia.org> | 2012-03-20 19:52:25 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2012-03-20 19:52:25 +0000 |
commit | a7ec2ac258e7fefd647e9e975d4c8d793ae02d3d (patch) | |
tree | 1ae833ea84fc148522f8b24b49c3401e5ea7f00f | |
parent | ad220fe563ab4f7142e50a7830c3866f9592599f (diff) | |
download | rpmdrake-a7ec2ac258e7fefd647e9e975d4c8d793ae02d3d.tar rpmdrake-a7ec2ac258e7fefd647e9e975d4c8d793ae02d3d.tar.gz rpmdrake-a7ec2ac258e7fefd647e9e975d4c8d793ae02d3d.tar.bz2 rpmdrake-a7ec2ac258e7fefd647e9e975d4c8d793ae02d3d.tar.xz rpmdrake-a7ec2ac258e7fefd647e9e975d4c8d793ae02d3d.zip |
(warn_if_no_pkg) split it out of node_state() for readibility
-rw-r--r-- | Rpmdrake/gui.pm | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/Rpmdrake/gui.pm b/Rpmdrake/gui.pm index d578b887..6a4dc745 100644 --- a/Rpmdrake/gui.pm +++ b/Rpmdrake/gui.pm @@ -353,17 +353,13 @@ sub format_pkg_info { )); } -sub node_state { +sub warn_if_no_pkg { my ($name) = @_; - return if !$name; - my $pkg = $pkgs->{$name}; - my $urpm_obj = $pkg->{pkg}; - if (!$urpm_obj) { - my ($short_name) = split_fullname($name); - state $warned; - if (!$warned) { - $warned = 1; - interactive_msg(N("Warning"), + my ($short_name) = split_fullname($name); + state $warned; + if (!$warned) { + $warned = 1; + interactive_msg(N("Warning"), join("\n", N("The package \"%s\" was found.", $name), N("However this package is not in the package list."), @@ -375,13 +371,20 @@ sub node_state { #-PO: this is list fomatting: "- <package_name> (medium: <medium_name>)" #-PO: eg: "- rpmdrake (medium: "Main Release" N("- %s (medium: %s)", $_, pkg2medium($pkgs->{$_}{pkg}, $urpm)->{name}); - } grep { /^$short_name/ } keys %$pkgs), + } grep { /^$short_name/ } keys %$pkgs), ), scroll => 1, ); - } - return 'XXX'; } + return 'XXX'; +} + +sub node_state { + my ($name) = @_; + return if !$name; + my $pkg = $pkgs->{$name}; + my $urpm_obj = $pkg->{pkg}; + return warn_if_no_pkg($name) if !$urpm_obj; #- checks $_[0] -> hack for partial tree displaying return 'XXX' if !$_[0]; $pkg->{selected} ? |