aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-07-20 02:17:40 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-07-20 02:17:40 +0000
commite0994c6cf0bfab77b9c6704596da142bbe3fad22 (patch)
tree721be7ae3a69c85c513135f56968406ae6c85b02
parent9f17bae225e402bdf43f642afff8fb10d11bf468 (diff)
downloadrpmdrake-e0994c6cf0bfab77b9c6704596da142bbe3fad22.tar
rpmdrake-e0994c6cf0bfab77b9c6704596da142bbe3fad22.tar.gz
rpmdrake-e0994c6cf0bfab77b9c6704596da142bbe3fad22.tar.bz2
rpmdrake-e0994c6cf0bfab77b9c6704596da142bbe3fad22.tar.xz
rpmdrake-e0994c6cf0bfab77b9c6704596da142bbe3fad22.zip
When asked to display the information about a package that hasn't been
loaded, give up, instead of screwing up the display (bug #10343).
-rwxr-xr-xrpmdrake67
1 files changed, 36 insertions, 31 deletions
diff --git a/rpmdrake b/rpmdrake
index 4d130e9f..b0842b71 100755
--- a/rpmdrake
+++ b/rpmdrake
@@ -643,37 +643,42 @@ or you already installed all of them."));
get_status => sub { $MODE eq 'install' ? N("Selected: %d MB / Free disk space: %d MB",
$size_selected/(1024*1024), $size_free/1024)
: N("Selected size: %d MB", $size_selected/(1024*1024)) },
- get_info => sub { my ($key) = @_;
- exists $pkgs->{$key} or return; #- related to the partial tree displaying hackery ($key can be '')
- my ($name, $version) = split_fullname($key);
- exists $pkgs->{$key}{description} && (!@$max_info_in_descr || exists $pkgs->{$key}{files})
- or slow_func($tree->window, sub { extract_header($pkgs->{$key}, $urpm) });
- my $tag_tag = { 'foreground' => 'royalblue3', 'weight' => Gtk2::Pango->PANGO_WEIGHT_BOLD };
- my $tag_fix = { 'font' => 'monospace' };
- my @files = ([ N("Files:\n"), $tag_tag ], exists $pkgs->{$key}{files}
- ? [ join("\n", map { "\x{200e}$_" } @{$pkgs->{$key}{files}}), $tag_fix ]
- : [ N("(Not available)") ]);
- my @chglo = ([ N("Changelog:\n"), $tag_tag ], @{$pkgs->{$key}{changelog} || [[ N("(Not available)") ]]});
- my @source_info = ($MODE eq 'remove' || !@$max_info_in_descr ? ()
- : ([ N("Medium: "), $tag_tag ],
- [ pkg2medium($pkgs->{$key}{pkg}, $urpm)->{name} ], [ "\n" ],
- [ N("Currently installed version: "), $tag_tag ],
- [ find_installed_version($pkgs->{$key}{pkg}) ], [ "\n" ]));
- my @max_info = if_(@$max_info_in_descr, $options{'changelog-first'} ? (@chglo, [ "\n" ], @files)
- : (@files, [ "\n\n" ], @chglo));
- [ [ N("Name: "), $tag_tag ], [ "$name\n" ],
- [ N("Version: "), $tag_tag ], [ "$version\n" ],
- [ N("Size: "), $tag_tag ], [ N("%s KB", int($pkgs->{$key}{pkg}->size/1024))."\n" ],
- if_($MODE eq 'update',
- [ N("Importance: "), $tag_tag ], [ "$descriptions->{$name}{importance}\n" ]),
- @source_info,
- [ "\n".N("Summary: "), $tag_tag ], [ "$pkgs->{$key}{summary}\n\n" ],
- if_($MODE eq 'update',
- [ N("Reason for update: "), $tag_tag ],
- [ rpm_description($descriptions->{$name}{pre})."\n" ]),
- [ N("Description: "), $tag_tag ], [ ($pkgs->{$key}{description} || $descriptions->{$name}{description}) . "\n" ],
- @max_info ];
- },
+ get_info => sub {
+ my ($key) = @_;
+ return if $key eq ''; #- related to the partial tree displaying hackery
+ #- the package information hasn't been loaded. Instead of rescanning the media, just give up.
+ exists $pkgs->{$key}
+ or return [ [ N("Description not available for this package\n") ] ];
+ my ($name, $version) = split_fullname($key);
+ exists $pkgs->{$key}{description} && (!@$max_info_in_descr || exists $pkgs->{$key}{files})
+ or slow_func($tree->window, sub { extract_header($pkgs->{$key}, $urpm) });
+ my $tag_tag = { 'foreground' => 'royalblue3', 'weight' => Gtk2::Pango->PANGO_WEIGHT_BOLD };
+ my $tag_fix = { 'font' => 'monospace' };
+ my @files = ([ N("Files:\n"), $tag_tag ], exists $pkgs->{$key}{files}
+ ? [ join("\n", map { "\x{200e}$_" } @{$pkgs->{$key}{files}}), $tag_fix ]
+ : [ N("(Not available)") ]);
+ my @chglo = ([ N("Changelog:\n"), $tag_tag ], @{$pkgs->{$key}{changelog} || [[ N("(Not available)") ]]});
+ my @source_info = ($MODE eq 'remove' || !@$max_info_in_descr ? ()
+ : ([ N("Medium: "), $tag_tag ],
+ [ pkg2medium($pkgs->{$key}{pkg}, $urpm)->{name} ], [ "\n" ],
+ [ N("Currently installed version: "), $tag_tag ],
+ [ find_installed_version($pkgs->{$key}{pkg}) ], [ "\n" ]));
+ my @max_info = if_(@$max_info_in_descr, $options{'changelog-first'}
+ ? (@chglo, [ "\n" ], @files)
+ : (@files, [ "\n\n" ], @chglo));
+ [ [ N("Name: "), $tag_tag ], [ "$name\n" ],
+ [ N("Version: "), $tag_tag ], [ "$version\n" ],
+ [ N("Size: "), $tag_tag ], [ N("%s KB", int($pkgs->{$key}{pkg}->size/1024))."\n" ],
+ if_($MODE eq 'update',
+ [ N("Importance: "), $tag_tag ], [ "$descriptions->{$name}{importance}\n" ]),
+ @source_info,
+ [ "\n".N("Summary: "), $tag_tag ], [ "$pkgs->{$key}{summary}\n\n" ],
+ if_($MODE eq 'update',
+ [ N("Reason for update: "), $tag_tag ],
+ [ rpm_description($descriptions->{$name}{pre})."\n" ]),
+ [ N("Description: "), $tag_tag ], [ ($pkgs->{$key}{description} || $descriptions->{$name}{description} || 'no description') . "\n" ],
+ @max_info ];
+ },
check_interactive_to_toggle => sub { 1 },
grep_allowed_to_toggle => sub { @_ },
rebuild_tree => sub {},