diff options
Diffstat (limited to 'gurpmi2')
-rwxr-xr-x | gurpmi2 | 27 |
1 files changed, 14 insertions, 13 deletions
@@ -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 { |