diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2003-01-02 12:59:30 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2003-01-02 12:59:30 +0000 |
commit | a3f3acc9299043f6c541d17acb0f468a12614349 (patch) | |
tree | 9ce795c335d1acc065ad1072d84a089648e3a8cb /perl-install/interactive.pm | |
parent | 17f99ab660bfc768322f373e459a2fb44698120a (diff) | |
download | drakx-a3f3acc9299043f6c541d17acb0f468a12614349.tar drakx-a3f3acc9299043f6c541d17acb0f468a12614349.tar.gz drakx-a3f3acc9299043f6c541d17acb0f468a12614349.tar.bz2 drakx-a3f3acc9299043f6c541d17acb0f468a12614349.tar.xz drakx-a3f3acc9299043f6c541d17acb0f468a12614349.zip |
add ask_from__add_modify_remove, and use it for bootloader entries
Diffstat (limited to 'perl-install/interactive.pm')
-rw-r--r-- | perl-install/interactive.pm | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm index 223b9800c..a99627309 100644 --- a/perl-install/interactive.pm +++ b/perl-install/interactive.pm @@ -250,6 +250,32 @@ sub ask_from_entries { undef; } +sub ask_from__add_modify_remove { + my ($o, $title, $message, $l, %callback) = @_; + die "ask_from__add_modify_remove only handles one item" if @$l != 1; + + if ($o->can('ask_from__add_modify_removeW')) { + ask_from__add_modify_removeW($o, $title, $message, $l, %callback); + } else { + my $e = $l->[0]; + my $chosen_element; + put_in_hash($e, { allow_empty_list => 1, val => \$chosen_element, type => 'list' }); + + while (1) { + my $c; + my @l = (@$l, + map { my $s = $_; { val => translate($_), clicked_may_quit => sub { $c = $s; 1 } } } + N_("Add"), if_(@{$e->{list}} > 0, N_("Modify"), N_("Remove"))); + $o->ask_from_({ title => $title, messages => $message, callbacks => \%callback }, \@l); + + return 1 if $c eq 'Done'; + + $callback{$c}->($chosen_element); + } + } +} + + #- can get a hash of callback: focus_out changed and complete #- moreove if you pass a hash with a field list -> combo #- if you pass a hash with a field hidden -> emulate stty -echo |