summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2013-05-17 10:30:16 +0000
committerThierry Vignaud <tv@mageia.org>2013-05-17 10:30:16 +0000
commit60aac5852545cc4e94ab0f2d1bbb646eefdc68be (patch)
tree692e0e44149ec540fc86b11b7badbbd0b5e2f3d1
parent549ad74c49d16ed5f9c91f1b05bd14045a0a1937 (diff)
downloadurpmi-60aac5852545cc4e94ab0f2d1bbb646eefdc68be.tar
urpmi-60aac5852545cc4e94ab0f2d1bbb646eefdc68be.tar.gz
urpmi-60aac5852545cc4e94ab0f2d1bbb646eefdc68be.tar.bz2
urpmi-60aac5852545cc4e94ab0f2d1bbb646eefdc68be.tar.xz
urpmi-60aac5852545cc4e94ab0f2d1bbb646eefdc68be.zip
(ask_warn) split it out of configure_urpm()
(needed for next commit)
-rwxr-xr-xgurpmi256
1 files changed, 29 insertions, 27 deletions
diff --git a/gurpmi2 b/gurpmi2
index 819d3187..3a3f620b 100755
--- a/gurpmi2
+++ b/gurpmi2
@@ -102,6 +102,34 @@ Gtk2->main;
my ($rpm_lock, $urpmi_lock);
+sub ask_warn {
+ my ($message) = @_;
+ printf STDERR "%s\n", $message;
+
+ if (my $download_errors = delete $urpm->{download_errors}) {
+ $message = join("\n", @$download_errors, $message);
+ }
+ my $nb_lines = $message =~ tr/\n/\n/;
+ my $w;
+ if ($nb_lines > 30 || $message =~ /^transaction is too small/) {
+ $w = Gtk2::Dialog->new(N("Warning"), $mainw, [qw(modal destroy-with-parent)], N("Ok"), 'ok');
+ $w->vbox->add(my $f = Gtk2::Frame->new);
+ my $sw = create_scrolled_window(my $text = Gtk2::TextView->new);
+ $sw->set_border_width(2);
+ $text->set_wrap_mode('word');
+ $f->add($sw);
+ $text->get_buffer->set_text($message);
+ $text->set_editable(0);
+ $_->show foreach $f, $sw, $text;
+ $w->set_size_request(400, 400);
+ $w->set_default_response('ok');
+ } else {
+ $w = Gtk2::MessageDialog->new($mainw, [qw(modal destroy-with-parent)], 'warning', 'ok', $message);
+ }
+ $w->run;
+ $w->destroy;
+}
+
#- Creates and configure an urpm object for this application to use.
sub configure_urpm {
my ($urpm) = @_;
@@ -113,33 +141,7 @@ sub configure_urpm {
exit $_[0];
};
$urpm->{log} = sub { printf "%s\n", $_[0] };
- $urpm->{error} = sub {
- my ($message) = @_;
- printf STDERR "%s\n", $message;
-
- if (my $download_errors = delete $urpm->{download_errors}) {
- $message = join("\n", @$download_errors, $message);
- }
- my $nb_lines = $message =~ tr/\n/\n/;
- my $w;
- if ($nb_lines > 30 || $message =~ /^transaction is too small/) {
- $w = Gtk2::Dialog->new(N("Warning"), $mainw, [qw(modal destroy-with-parent)], N("Ok"), 'ok');
- $w->vbox->add(my $f = Gtk2::Frame->new);
- my $sw = create_scrolled_window(my $text = Gtk2::TextView->new);
- $sw->set_border_width(2);
- $text->set_wrap_mode('word');
- $f->add($sw);
- $text->get_buffer->set_text($message);
- $text->set_editable(0);
- $_->show foreach $f, $sw, $text;
- $w->set_size_request(400, 400);
- $w->set_default_response('ok');
- } else {
- $w = Gtk2::MessageDialog->new($mainw, [qw(modal destroy-with-parent)], 'warning', 'ok', $message);
- }
- $w->run;
- $w->destroy;
- };
+ $urpm->{error} = \&ask_warn;
urpm::select::set_priority_upgrade_option($urpm, $gurpmi::options{previous_priority_upgrade});
$rpm_lock = urpm::lock::rpm_db($urpm, 'exclusive');
$urpmi_lock = urpm::lock::urpmi_db($urpm);