diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2003-12-29 18:46:45 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2003-12-29 18:46:45 +0000 |
commit | 455a9ed27c9ffdfd2e93df58e97eec12a502a12a (patch) | |
tree | aa3db96e42b0f1897aeb5f480aaad95f7a780a69 /perl-install/standalone/drakconnect | |
parent | 9353e81b58fcf496bc0d75ef1cf380a3e04b13f7 (diff) | |
download | drakx-455a9ed27c9ffdfd2e93df58e97eec12a502a12a.tar drakx-455a9ed27c9ffdfd2e93df58e97eec12a502a12a.tar.gz drakx-455a9ed27c9ffdfd2e93df58e97eec12a502a12a.tar.bz2 drakx-455a9ed27c9ffdfd2e93df58e97eec12a502a12a.tar.xz drakx-455a9ed27c9ffdfd2e93df58e97eec12a502a12a.zip |
(wip but requested for string freeze)
- do not silently discard errors by ignoring exceptions
- use new wizard layer
- begin to renew wizard steps (mdk10.0 specs)
Diffstat (limited to 'perl-install/standalone/drakconnect')
-rwxr-xr-x | perl-install/standalone/drakconnect | 79 |
1 files changed, 45 insertions, 34 deletions
diff --git a/perl-install/standalone/drakconnect b/perl-install/standalone/drakconnect index 3e582d997..c5ff9587c 100755 --- a/perl-install/standalone/drakconnect +++ b/perl-install/standalone/drakconnect @@ -52,8 +52,9 @@ my $in = 'interactive'->vnew('su'); if ($in->isa('interactive::gtk')) { require ugtk2; ugtk2->import(qw(:create :dialogs :helpers :wrappers)); - reread_net_conf(); } +reread_net_conf(); +$::Wizard_title = N("Network & Internet Configuration"); $::Wizard_pix_up = "wiz_drakconnect.png"; MDK::Common::Globals::init( @@ -68,6 +69,10 @@ MDK::Common::Globals::init( /--skip-wizard/ and goto manage; /--add/ and add_intf(); /--del/ and del_intf(); +if (/--install/) { + $::isInstall = 1; + add_intf() +} /--internet/ and configure_net($netcnx, $netc, $intf); # default is to run wizard @@ -189,46 +194,52 @@ gtkflush(); $window1->main; ugtk2->exit(0); + sub add_intf() { - $::Wizard_title = N("Network & Internet Configuration"); $::isWizard = 1; network::netconnect::load_conf($netcnx, $netc, $intf); - network::netconnect::main('', $netcnx, $in); + # network::netconnect::add_interface($in, $netcnx); + eval { network::netconnect::main('', $netcnx, $in, $netc, undef, $intf) }; + my $err = $@; + if ($err && $in->isa('interactive::gtk')) { + err_dialog(N("Error"), N("An unexpected error has happened:\n%s", $err)); + } $in->exit(0); } sub del_intf() { - $::Wizard_title = N("Remove a network interface"); - $::isWizard = 1; - $::Wizard_no_previous = 1; - my $intf; - - $in->ask_from(N("Network Configuration"), - N("Select the network interface to remove:"), - [ { label => N("Net Device"), val => \$intf, list => [ detect_devices::getNet() ], allow_empty_list => 1 } ]); - - eval { - modules::mergein_conf('/etc/modules.conf'); - modules::remove_alias($intf); - modules::write_conf(); - rm_rf("/etc/sysconfig/network-scripts/ifcfg-$intf"); - }; - my $faillure = $@; - $::Wizard_finished = 1; - eval { - $in->ask_okcancel(N("Network Configuration"), ($faillure ? - N("An error occured while deleting the \"%s\" network interface:\n\n%s", - $intf, $faillure) : - N("Congratulations, the \"%s\" network interface has been succesfully deleted", $intf) - ), - 1); - }; - my $err = $@; - if ($err =~ /wizcancel/) { - $in->exit(0); - } else { - die $err; - } + my ($intf, $faillure); + my $wiz = + { + defaultimage => "wiz_drakconnect.png", + name => N("Remove a network interface"), + pages => { + welcome => { + no_back => 1, + name => N("Select the network interface to remove:"), + data => [ { label => N("Net Device"), val => \$intf, list => [ detect_devices::getNet() ], allow_empty_list => 1 } ], + post => sub { + eval { + modules::mergein_conf('/etc/modules.conf'); + modules::remove_alias($intf); + modules::write_conf(); + rm_rf("/etc/sysconfig/network-scripts/ifcfg-$intf"); + }; + $faillure = $@; + }, + next => "end", + name => sub { + ($faillure ? + N("An error occured while deleting the \"%s\" network interface:\n\n%s", + $intf, $faillure) : + N("Congratulations, the \"%s\" network interface has been succesfully deleted", $intf) + ) + }, + }, + }, + }; + require wizards; + wizards->new->safe_process($wiz, $in); } |