diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2005-02-15 16:36:47 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2005-02-15 16:36:47 +0000 |
commit | 770daeb5d2b473d50d67b4e9423c2e914aed718b (patch) | |
tree | 13a3bc7061ef806d71406238b079fc1247450f4e /perl-install | |
parent | 3758e9d2c6ffe12820ceba5e35fdf5f1173108ad (diff) | |
download | drakx-backup-do-not-use-770daeb5d2b473d50d67b4e9423c2e914aed718b.tar drakx-backup-do-not-use-770daeb5d2b473d50d67b4e9423c2e914aed718b.tar.gz drakx-backup-do-not-use-770daeb5d2b473d50d67b4e9423c2e914aed718b.tar.bz2 drakx-backup-do-not-use-770daeb5d2b473d50d67b4e9423c2e914aed718b.tar.xz drakx-backup-do-not-use-770daeb5d2b473d50d67b4e9423c2e914aed718b.zip |
create ->ask_filename and ->ask_directory to replace ->ask_file
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/interactive.pm | 20 | ||||
-rw-r--r-- | perl-install/interactive/gtk.pm | 16 |
2 files changed, 28 insertions, 8 deletions
diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm index c31d333d3..1d704112e 100644 --- a/perl-install/interactive.pm +++ b/perl-install/interactive.pm @@ -161,13 +161,27 @@ sub ask_okcancel_ { } } +sub ask_filename { + my ($o, $common) = @_; + $common->{want_a_dir} = 0; + $o->ask_fileW($common); +} + +sub ask_directory { + my ($o, $common) = @_; + $common->{want_a_dir} = 1; + $o->ask_fileW($common); +} + +#- predecated sub ask_file { my ($o, $title, $o_dir) = @_; - $o->ask_fileW($title, $o_dir); + $o->ask_fileW({ title => $title, want_a_dir => 0, directory => $o_dir }); } + sub ask_fileW { - my ($o, $title, $_dir) = @_; - $o->ask_from_entry($title, N("Choose a file")); + my ($o, $common) = @_; + $o->ask_from_entry($common->{title}, $common->{message} || N("Choose a file")); } sub ask_from_list { diff --git a/perl-install/interactive/gtk.pm b/perl-install/interactive/gtk.pm index c55a5f41c..d29c2df9b 100644 --- a/perl-install/interactive/gtk.pm +++ b/perl-install/interactive/gtk.pm @@ -24,11 +24,17 @@ sub leave_console { my ($o) = @_; common::setVirtual(delete $o->{suspended}) } sub exit { ugtk2::exit(@_) } sub ask_fileW { - my ($_o, $title, $dir) = @_; - my $w = ugtk2->new($title); - $dir .= '/' if $dir !~ m|/$|; - ugtk2::_ask_file($w, $title, $dir); - $w->main; + my ($in, $common) = @_; + + my $w = ugtk2::create_file_selector(%$common); + + my $file; + $w->main(sub { + $file = $w->{chooser}->get_filename; + my $err = ugtk2::file_selected_check($common->{save}, $common->{want_a_dir}, $file); + $err and $in->ask_warn('', $err); + !$err; + }) && $file; } sub create_boxradio { |