From 86ce86bba775eb45c9d186cc04c5d1ae32cc1c6f Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Tue, 7 Jun 2005 05:51:29 +0000 Subject: Choice window wasn't working (bug #16104) --- gurpmi2 | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'gurpmi2') diff --git a/gurpmi2 b/gurpmi2 index aa7f64f4..f781e832 100755 --- a/gurpmi2 +++ b/gurpmi2 @@ -111,27 +111,28 @@ sub ask_choice { my @radios = map { $radio = Gtk2::RadioButton->new_with_label( $radio ? $radio->get_group : undef, - (scalar $_->fullname) . "\n" . $_->summary + (scalar $_->fullname) . " : " . $_->summary . ($_->flag_installed ? N(" (to upgrade)") : '') . ($_->flag_upgrade ? N(" (to install)") : '') ); } @$choices; - my $vbox = Gtk2::VBox->new(0, 5); + my $d = Gtk2::Dialog->new(N("Package choice"), $mainw, [], N("_Cancel") => 0, N("_Ok") => 1); my $label = Gtk2::Label->new(N("One of the following packages is needed:")); $label->set_alignment(0.5, 0.5); - $vbox->pack_start($label, 1, 1, 0); - $vbox->pack_start($_, 1, 1, 0) foreach @radios; - my $cancel_button = Gtk2::Button->new(but(N("_Cancel"))); - my $choice_button = Gtk2::Button->new(but(N("_Ok"))); - $cancel_button->signal_connect(clicked => \&quit); - $choice_button->signal_connect(clicked => sub { - my $n = 0; - foreach (@radios) { last if $_->get_active; ++$n } - $choices->[$n]; + $d->vbox->pack_start($label, 1, 1, 0); + $d->vbox->pack_start($_, 1, 1, 0) foreach @radios; + my $n = 0; + $d->signal_connect(response => sub { + if ($_[1] == 1) { #- "ok" + foreach (@radios) { last if $_->get_active; ++$n } + } + $d->destroy; + exit 0 if $_[1] == 0; #- "cancel" }); - add_button_box($vbox, $cancel_button, $choice_button); - change_mainw($vbox); $radios[0]->set_active(1); + $d->show_all; + $d->run; + $choices->[$n]; } sub ask_continue { -- cgit v1.2.1