From 0bf26233b2d8462a32162b32e77cced0fc90e13e Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 28 Aug 2002 12:31:38 +0000 Subject: add "Mount" and "Unmount" --- perl-install/diskdrake/dav.pm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'perl-install/diskdrake/dav.pm') diff --git a/perl-install/diskdrake/dav.pm b/perl-install/diskdrake/dav.pm index 13f6e09fa..ad06f958c 100644 --- a/perl-install/diskdrake/dav.pm +++ b/perl-install/diskdrake/dav.pm @@ -42,9 +42,9 @@ sub config { my $dav = { %$dav_ }; #- working on a local copy so that "Cancel" works - my %actions = my @actions = actions(); my $action; while ($action ne 'Done') { + my %actions = my @actions = actions($dav); $action = $in->ask_from_list_('', format_dav_info($dav), [ map { $_->[0] } group_by2 @actions ], 'Done') or return; $actions{$action}->($in, $dav, $all_hds); @@ -53,7 +53,11 @@ sub config { } sub actions { + my ($dav) = @_; + ( + if_($dav && $dav->{isMounted}, __("Unmount") => sub { try('Unmount', @_) }), + if_($dav && $dav->{mntpoint} && !$dav->{isMounted}, __("Mount") => sub { try('Mount', @_) }), __("Server") => \&ask_server, __("Mount point") => \&mount_point, __("Options") => \&options, @@ -61,6 +65,15 @@ sub actions { ); } +sub try { + my ($name, $in, $dav) = @_; + my $f = $diskdrake::interactive::{$name} or die "unknown function $name"; + eval { $f->($in, {}, $dav) }; + if (my $err = $@) { + $in->ask_warn(_("Error"), formatError($err)); + } +} + sub ask_server { my ($in, $dav, $all_hds) = @_; -- cgit v1.2.1