diff options
author | Martin Whitaker <mageia@martin-whitaker.me.uk> | 2020-07-10 17:34:07 +0100 |
---|---|---|
committer | Martin Whitaker <mageia@martin-whitaker.me.uk> | 2020-07-10 17:34:07 +0100 |
commit | 5a1a9a51a205726e2abb43f14a85d289ec9694f5 (patch) | |
tree | 9cf007f486fdab90eddc644e693526f268d09783 | |
parent | c46f1d05459a6b37b4079115eaa412cf2ced07c9 (diff) | |
download | urpmi-5a1a9a51a205726e2abb43f14a85d289ec9694f5.tar urpmi-5a1a9a51a205726e2abb43f14a85d289ec9694f5.tar.gz urpmi-5a1a9a51a205726e2abb43f14a85d289ec9694f5.tar.bz2 urpmi-5a1a9a51a205726e2abb43f14a85d289ec9694f5.tar.xz urpmi-5a1a9a51a205726e2abb43f14a85d289ec9694f5.zip |
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.
-rw-r--r-- | Changes | 2 | ||||
-rwxr-xr-x | gurpmi2 | 19 |
2 files changed, 19 insertions, 2 deletions
@@ -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 @@ -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'; |