From 5a1a9a51a205726e2abb43f14a85d289ec9694f5 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Fri, 10 Jul 2020 17:34:07 +0100 Subject: gurpmi2: ensure download error report fits on screen. With a batch size of 50, the number of failed downloads can be large. That causes the message dialogue to exceed the screen height, making the retry Yes/No buttons invisible and inaccessible. --- Changes | 2 ++ gurpmi2 | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index 24e26237..5e294ce3 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,5 @@ +- gurpmi2: + o ensure download error report fits on screen - Make it work with no feature qw(indirect) (aka perl7) - small Kwalitee cleanups - stop truncating disk names when prompting for a CD/USB key diff --git a/gurpmi2 b/gurpmi2 index d69b6a52..0c874800 100755 --- a/gurpmi2 +++ b/gurpmi2 @@ -380,8 +380,23 @@ return_with_exit_code: sub ask_yes_or_no { my ($_title, $msg) = @_; - # MessageDialogs have no titles unless using 'secondary-text' - my $w = Gtk3::MessageDialog->new($mainw, [qw(modal destroy-with-parent)], 'warning', 'yes-no', $msg); + my $w; + my $nb_lines = $msg =~ tr/\n/\n/; + if ($nb_lines > 20) { + $w = Gtk3::Dialog->new(N("Warning"), $mainw, [qw(modal destroy-with-parent)], N("No"), 'no', N("Yes"), 'yes'); + my @lines = split("\n", $msg); + my $vbox = Gtk3::VBox->new(0, 5); + $vbox->pack_start(new_label($lines[0]), 1, 1, 0); + $vbox->pack_start(new_label(join("\n", @lines[1 .. $nb_lines - 1])), 1, 1, 0); + $vbox->pack_start(new_label($lines[$nb_lines]), 1, 1, 0); + $vbox->set_size_request(400, 320); + $w->get_child->add($vbox); + $vbox->show_all; + $w->set_default_response('yes'); + } else { + # MessageDialogs have no titles unless using 'secondary-text' + $w = Gtk3::MessageDialog->new($mainw, [qw(modal destroy-with-parent)], 'warning', 'yes-no', $msg); + } my $response = $w->run; $w->destroy; $response eq 'yes'; -- cgit v1.2.1